mirror of
https://github.com/Anuken/Mindustry.git
synced 2025-12-06 02:40:23 -08:00
Intel GPU/OpenGL 2.x planet normals fix
This commit is contained in:
parent
576b7f6b6b
commit
a0cf5b7265
6 changed files with 22 additions and 7 deletions
13
core/assets/shaders/unlitwhite.vert
Executable file
13
core/assets/shaders/unlitwhite.vert
Executable file
|
|
@ -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 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);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
|
||||
|
|
|
|||
|
|
@ -52,7 +52,7 @@ public class DesktopLauncher extends ClientLauncher{
|
|||
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
|
||||
if(GpuDetect.hasIntel && (!GpuDetect.hasAMD || !GpuDetect.hasNvidia)){
|
||||
if(GpuDetect.hasIntel && !GpuDetect.hasAMD && !GpuDetect.hasNvidia){
|
||||
allowGl30 = false;
|
||||
coreProfile = false;
|
||||
glVersions = new int[][]{{2, 1}, {2, 0}};
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue