Intel GPU/OpenGL 2.x planet normals fix

This commit is contained in:
Anuken
2025-10-08 08:45:40 +09:00
parent 576b7f6b6b
commit a0cf5b7265
6 changed files with 22 additions and 7 deletions

View File

@@ -33,7 +33,7 @@ public class Shaders{
public static AtmosphereShader atmosphere;
public static ShockwaveShader shockwave;
public static MeshShader mesh;
public static Shader unlit;
public static Shader unlit, unlitWhite;
public static Shader screenspace;
public static void init(){
@@ -70,6 +70,7 @@ public class Shaders{
planetGrid = new PlanetGridShader();
atmosphere = new AtmosphereShader();
unlit = new LoadShader("planet", "unlit");
unlitWhite = new LoadShader("planet", "unlitwhite");
screenspace = new LoadShader("screenspace", "screenspace");
//disabled for now...
@@ -144,6 +145,7 @@ public class Shaders{
camDir.set(renderer.planets.cam.direction).rotate(Vec3.Y, planet.getRotation());
setUniformf("u_alpha", alpha);
setUniformf("u_emissive", 0f);
setUniformf("u_lightdir", lightDir);
setUniformf("u_ambientColor", ambientColor.r, ambientColor.g, ambientColor.b);
}

View File

@@ -275,8 +275,8 @@ public class MeshBuilder{
if(floats.length > 5) floats[5] = emissive;
}else{
floats[3] = normal.x;
floats[4] = normal.x;
floats[5] = normal.x;
floats[4] = normal.y;
floats[5] = normal.z;
floats[6] = color;
if(floats.length > 7) floats[7] = emissive;

View File

@@ -160,7 +160,7 @@ public class Planet extends UnlockableContent{
/** Content (usually planet-specific) that is unlocked upon landing here. */
public Seq<UnlockableContent> unlockedOnLand = new Seq<>();
/** Loads the mesh. Clientside only. Defaults to a boring sphere mesh. */
public Prov<GenericMesh> meshLoader = () -> new ShaderSphereMesh(this, Shaders.unlit, 2), cloudMeshLoader = () -> null;
public Prov<GenericMesh> meshLoader = () -> new ShaderSphereMesh(this, Shaders.unlitWhite, 2), cloudMeshLoader = () -> null;
/** Loads the planet grid outline mesh. Clientside only. */
public Prov<Mesh> gridMeshLoader = () -> MeshBuilder.buildPlanetGrid(grid, outlineColor, outlineRad * radius);