Intel GPU/OpenGL 2.x planet normals fix
This commit is contained in:
Executable
+13
@@ -0,0 +1,13 @@
|
|||||||
|
attribute vec4 a_position;
|
||||||
|
attribute vec3 a_normal;
|
||||||
|
|
||||||
|
uniform mat4 u_proj;
|
||||||
|
uniform mat4 u_trans;
|
||||||
|
uniform vec4 u_color;
|
||||||
|
|
||||||
|
varying vec4 v_col;
|
||||||
|
|
||||||
|
void main(){
|
||||||
|
v_col = vec4(1.0);
|
||||||
|
gl_Position = u_proj * u_trans * a_position;
|
||||||
|
}
|
||||||
@@ -33,7 +33,7 @@ public class Shaders{
|
|||||||
public static AtmosphereShader atmosphere;
|
public static AtmosphereShader atmosphere;
|
||||||
public static ShockwaveShader shockwave;
|
public static ShockwaveShader shockwave;
|
||||||
public static MeshShader mesh;
|
public static MeshShader mesh;
|
||||||
public static Shader unlit;
|
public static Shader unlit, unlitWhite;
|
||||||
public static Shader screenspace;
|
public static Shader screenspace;
|
||||||
|
|
||||||
public static void init(){
|
public static void init(){
|
||||||
@@ -70,6 +70,7 @@ public class Shaders{
|
|||||||
planetGrid = new PlanetGridShader();
|
planetGrid = new PlanetGridShader();
|
||||||
atmosphere = new AtmosphereShader();
|
atmosphere = new AtmosphereShader();
|
||||||
unlit = new LoadShader("planet", "unlit");
|
unlit = new LoadShader("planet", "unlit");
|
||||||
|
unlitWhite = new LoadShader("planet", "unlitwhite");
|
||||||
screenspace = new LoadShader("screenspace", "screenspace");
|
screenspace = new LoadShader("screenspace", "screenspace");
|
||||||
|
|
||||||
//disabled for now...
|
//disabled for now...
|
||||||
@@ -144,6 +145,7 @@ public class Shaders{
|
|||||||
camDir.set(renderer.planets.cam.direction).rotate(Vec3.Y, planet.getRotation());
|
camDir.set(renderer.planets.cam.direction).rotate(Vec3.Y, planet.getRotation());
|
||||||
|
|
||||||
setUniformf("u_alpha", alpha);
|
setUniformf("u_alpha", alpha);
|
||||||
|
setUniformf("u_emissive", 0f);
|
||||||
setUniformf("u_lightdir", lightDir);
|
setUniformf("u_lightdir", lightDir);
|
||||||
setUniformf("u_ambientColor", ambientColor.r, ambientColor.g, ambientColor.b);
|
setUniformf("u_ambientColor", ambientColor.r, ambientColor.g, ambientColor.b);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -275,8 +275,8 @@ public class MeshBuilder{
|
|||||||
if(floats.length > 5) floats[5] = emissive;
|
if(floats.length > 5) floats[5] = emissive;
|
||||||
}else{
|
}else{
|
||||||
floats[3] = normal.x;
|
floats[3] = normal.x;
|
||||||
floats[4] = normal.x;
|
floats[4] = normal.y;
|
||||||
floats[5] = normal.x;
|
floats[5] = normal.z;
|
||||||
|
|
||||||
floats[6] = color;
|
floats[6] = color;
|
||||||
if(floats.length > 7) floats[7] = emissive;
|
if(floats.length > 7) floats[7] = emissive;
|
||||||
|
|||||||
@@ -160,7 +160,7 @@ public class Planet extends UnlockableContent{
|
|||||||
/** Content (usually planet-specific) that is unlocked upon landing here. */
|
/** Content (usually planet-specific) that is unlocked upon landing here. */
|
||||||
public Seq<UnlockableContent> unlockedOnLand = new Seq<>();
|
public Seq<UnlockableContent> unlockedOnLand = new Seq<>();
|
||||||
/** Loads the mesh. Clientside only. Defaults to a boring sphere mesh. */
|
/** 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. */
|
/** Loads the planet grid outline mesh. Clientside only. */
|
||||||
public Prov<Mesh> gridMeshLoader = () -> MeshBuilder.buildPlanetGrid(grid, outlineColor, outlineRad * radius);
|
public Prov<Mesh> gridMeshLoader = () -> MeshBuilder.buildPlanetGrid(grid, outlineColor, outlineRad * radius);
|
||||||
|
|
||||||
|
|||||||
@@ -52,7 +52,7 @@ public class DesktopLauncher extends ClientLauncher{
|
|||||||
height = 700;
|
height = 700;
|
||||||
|
|
||||||
//on Windows, Intel drivers might be buggy with OpenGL 3.x, so only use 2.x. See https://github.com/Anuken/Mindustry/issues/11041
|
//on Windows, Intel drivers might be buggy with OpenGL 3.x, so only use 2.x. See https://github.com/Anuken/Mindustry/issues/11041
|
||||||
if(GpuDetect.hasIntel && (!GpuDetect.hasAMD || !GpuDetect.hasNvidia)){
|
if(GpuDetect.hasIntel && !GpuDetect.hasAMD && !GpuDetect.hasNvidia){
|
||||||
allowGl30 = false;
|
allowGl30 = false;
|
||||||
coreProfile = false;
|
coreProfile = false;
|
||||||
glVersions = new int[][]{{2, 1}, {2, 0}};
|
glVersions = new int[][]{{2, 1}, {2, 0}};
|
||||||
|
|||||||
Reference in New Issue
Block a user