mirror of
https://github.com/JonasunderscoreJones/nicer-skies.git
synced 2025-10-23 11:49:17 +02:00
refactor: static hell is now dynamic hell! fuck oop xdd
This commit is contained in:
parent
885d2b1059
commit
5f77c6d483
4 changed files with 166 additions and 130 deletions
|
@ -0,0 +1,25 @@
|
|||
package codes.ztereohype.example.nebula;
|
||||
|
||||
import net.minecraft.util.Mth;
|
||||
import net.minecraft.world.level.levelgen.synth.PerlinNoise;
|
||||
|
||||
public abstract class SkyboxPainter {
|
||||
protected final PerlinNoise noise;
|
||||
|
||||
SkyboxPainter(PerlinNoise noise) {
|
||||
this.noise = noise;
|
||||
}
|
||||
|
||||
abstract int getColour(float x, float y, float z);
|
||||
|
||||
public float[] projectOnSphere(float x, float y, float z) {
|
||||
float invDistance = Mth.fastInvSqrt(x * x + y * y + z * z);
|
||||
|
||||
//divide by distance to get projection on sphere (shorten the vector)
|
||||
x *= invDistance;
|
||||
y *= invDistance;
|
||||
z *= invDistance;
|
||||
|
||||
return new float[] {x, y, z};
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue