Add shader uniform "u" prefix
This commit is contained in:
+1
-1
@@ -231,7 +231,7 @@ public class DebugRenderer
|
||||
boxTransform.multiply(Mat4f.createScaleMatrix(box.maxPos.x - box.minPos.x, box.maxPos.y - box.minPos.y, box.maxPos.z - box.minPos.z));
|
||||
Mat4f t = this.transformationMatrixThisFrame.copy();
|
||||
t.multiply(boxTransform);
|
||||
this.basicShader.setUniform(this.basicShader.getUniformLocation("transform"), t);
|
||||
this.basicShader.setUniform(this.basicShader.getUniformLocation("uTransform"), t);
|
||||
this.basicShader.setUniform(this.basicShader.getUniformLocation("uColor"), box.color);
|
||||
GL32.glDrawElements(GL32.GL_LINES, BOX_OUTLINE_INDICES.length, GL32.GL_UNSIGNED_INT, 0);
|
||||
}
|
||||
|
||||
+55
-52
@@ -40,34 +40,30 @@ import com.seibel.distanthorizons.core.util.math.Vec3f;
|
||||
*/
|
||||
public class DhTerrainShaderProgram extends ShaderProgram implements IDhApiShaderProgram
|
||||
{
|
||||
public static final String VERTEX_SHADER_PATH = "shaders/standard.vert";
|
||||
public static final String VERTEX_CURVE_SHADER_PATH = "shaders/curve.vert";
|
||||
public static final String FRAGMENT_SHADER_PATH = "shaders/flat_shaded.frag";
|
||||
|
||||
public final AbstractVertexAttribute vao;
|
||||
|
||||
// Uniforms
|
||||
public final int combinedMatUniform;
|
||||
public final int modelOffsetUniform;
|
||||
public final int worldYOffsetUniform;
|
||||
public final int uCombinedMatrix;
|
||||
public final int uModelOffset;
|
||||
public final int uWorldYOffset;
|
||||
|
||||
public final int mircoOffsetUniform;
|
||||
public final int uMircoOffset;
|
||||
|
||||
public final int earthRadiusUniform;
|
||||
public final int uEarthRadius;
|
||||
|
||||
public final int lightMapUniform;
|
||||
public final int uLightMap;
|
||||
|
||||
// Fog/Clip Uniforms
|
||||
public final int clipDistanceUniform;
|
||||
public final int uClipDistance;
|
||||
|
||||
// Noise Uniforms
|
||||
public final int noiseEnabledUniform;
|
||||
public final int noiseStepsUniform;
|
||||
public final int noiseIntensityUniform;
|
||||
public final int noiseDropoffUniform;
|
||||
public final int uNoiseEnabled;
|
||||
public final int uNoiseSteps;
|
||||
public final int uNoiseIntensity;
|
||||
public final int uNoiseDropoff;
|
||||
|
||||
// Debug Uniform
|
||||
public final int whiteWorldUniform;
|
||||
public final int uWhiteWorld;
|
||||
|
||||
|
||||
|
||||
@@ -78,48 +74,55 @@ public class DhTerrainShaderProgram extends ShaderProgram implements IDhApiShade
|
||||
// This will bind AbstractVertexAttribute
|
||||
public DhTerrainShaderProgram()
|
||||
{
|
||||
super(() -> Shader.loadFile(Config.Client.Advanced.Graphics.AdvancedGraphics.earthCurveRatio.get() != 0 ? VERTEX_CURVE_SHADER_PATH : VERTEX_SHADER_PATH,
|
||||
super(
|
||||
() -> Shader.loadFile(Config.Client.Advanced.Graphics.AdvancedGraphics.earthCurveRatio.get() != 0
|
||||
? "shaders/curve.vert"
|
||||
: "shaders/standard.vert",
|
||||
false, new StringBuilder()).toString(),
|
||||
() -> Shader.loadFile(FRAGMENT_SHADER_PATH, false, new StringBuilder()).toString(),
|
||||
() -> Shader.loadFile("shaders/flat_shaded.frag", false, new StringBuilder()).toString(),
|
||||
"fragColor", new String[]{"vPosition", "color"});
|
||||
|
||||
combinedMatUniform = getUniformLocation("combinedMatrix");
|
||||
modelOffsetUniform = getUniformLocation("modelOffset");
|
||||
worldYOffsetUniform = tryGetUniformLocation("worldYOffset");
|
||||
mircoOffsetUniform = getUniformLocation("mircoOffset");
|
||||
earthRadiusUniform = tryGetUniformLocation("earthRadius");
|
||||
this.uCombinedMatrix = this.getUniformLocation("uCombinedMatrix");
|
||||
this.uModelOffset = this.getUniformLocation("uModelOffset");
|
||||
this.uWorldYOffset = this.tryGetUniformLocation("uWorldYOffset");
|
||||
this.uMircoOffset = this.getUniformLocation("uMircoOffset");
|
||||
this.uEarthRadius = this.tryGetUniformLocation("uEarthRadius");
|
||||
|
||||
lightMapUniform = getUniformLocation("lightMap");
|
||||
this.uLightMap = this.getUniformLocation("uLightMap");
|
||||
|
||||
// Fog/Clip Uniforms
|
||||
clipDistanceUniform = getUniformLocation("clipDistance");
|
||||
this.uClipDistance = this.getUniformLocation("uClipDistance");
|
||||
|
||||
// Noise Uniforms
|
||||
noiseEnabledUniform = getUniformLocation("noiseEnabled");
|
||||
noiseStepsUniform = getUniformLocation("noiseSteps");
|
||||
noiseIntensityUniform = getUniformLocation("noiseIntensity");
|
||||
noiseDropoffUniform = getUniformLocation("noiseDropoff");
|
||||
this.uNoiseEnabled = this.getUniformLocation("uNoiseEnabled");
|
||||
this.uNoiseSteps = this.getUniformLocation("uNoiseSteps");
|
||||
this.uNoiseIntensity = this.getUniformLocation("uNoiseIntensity");
|
||||
this.uNoiseDropoff = this.getUniformLocation("uNoiseDropoff");
|
||||
|
||||
// Debug Uniform
|
||||
whiteWorldUniform = getUniformLocation("whiteWorld");
|
||||
this.uWhiteWorld = this.getUniformLocation("uWhiteWorld");
|
||||
|
||||
|
||||
// TODO: Add better use of the LODFormat thing
|
||||
int vertexByteCount = LodUtil.LOD_VERTEX_FORMAT.getByteSize();
|
||||
if (GLProxy.getInstance().vertexAttributeBufferBindingSupported)
|
||||
vao = new VertexAttributePostGL43(); // also binds AbstractVertexAttribute
|
||||
{
|
||||
this.vao = new VertexAttributePostGL43(); // also binds AbstractVertexAttribute
|
||||
}
|
||||
else
|
||||
vao = new VertexAttributePreGL43(); // also binds AbstractVertexAttribute
|
||||
vao.bind();
|
||||
{
|
||||
this.vao = new VertexAttributePreGL43(); // also binds AbstractVertexAttribute
|
||||
}
|
||||
this.vao.bind();
|
||||
|
||||
// TODO comment what each attribute represents
|
||||
vao.setVertexAttribute(0, 0, VertexPointer.addUnsignedShortsPointer(4, false, true)); // 2+2+2+2 // TODO probably color, blockpos
|
||||
vao.setVertexAttribute(0, 1, VertexPointer.addUnsignedBytesPointer(4, true, false)); // +4 // TODO ?
|
||||
vao.setVertexAttribute(0, 2, VertexPointer.addUnsignedBytesPointer(4, true, true)); // +4 // TODO probably normal index and Iris block ID
|
||||
this.vao.setVertexAttribute(0, 0, VertexPointer.addUnsignedShortsPointer(4, false, true)); // 2+2+2+2 // TODO probably color, blockpos
|
||||
this.vao.setVertexAttribute(0, 1, VertexPointer.addUnsignedBytesPointer(4, true, false)); // +4 // TODO ?
|
||||
this.vao.setVertexAttribute(0, 2, VertexPointer.addUnsignedBytesPointer(4, true, true)); // +4 // TODO probably normal index and Iris block ID
|
||||
|
||||
try
|
||||
{
|
||||
vao.completeAndCheck(vertexByteCount);
|
||||
this.vao.completeAndCheck(vertexByteCount);
|
||||
}
|
||||
catch (RuntimeException e)
|
||||
{
|
||||
@@ -127,15 +130,15 @@ public class DhTerrainShaderProgram extends ShaderProgram implements IDhApiShade
|
||||
throw e;
|
||||
}
|
||||
|
||||
if (earthRadiusUniform != -1) setUniform(earthRadiusUniform,
|
||||
if (this.uEarthRadius != -1) this.setUniform(this.uEarthRadius,
|
||||
/*6371KM*/ 6371000.0f / Config.Client.Advanced.Graphics.AdvancedGraphics.earthCurveRatio.get());
|
||||
|
||||
|
||||
// Noise Uniforms
|
||||
setUniform(noiseEnabledUniform, Config.Client.Advanced.Graphics.NoiseTextureSettings.noiseEnabled.get());
|
||||
setUniform(noiseStepsUniform, Config.Client.Advanced.Graphics.NoiseTextureSettings.noiseSteps.get());
|
||||
setUniform(noiseIntensityUniform, Config.Client.Advanced.Graphics.NoiseTextureSettings.noiseIntensity.get().floatValue());
|
||||
setUniform(noiseDropoffUniform, Config.Client.Advanced.Graphics.NoiseTextureSettings.noiseDropoff.get());
|
||||
this.setUniform(this.uNoiseEnabled, Config.Client.Advanced.Graphics.NoiseTextureSettings.noiseEnabled.get());
|
||||
this.setUniform(this.uNoiseSteps, Config.Client.Advanced.Graphics.NoiseTextureSettings.noiseSteps.get());
|
||||
this.setUniform(this.uNoiseIntensity, Config.Client.Advanced.Graphics.NoiseTextureSettings.noiseIntensity.get().floatValue());
|
||||
this.setUniform(this.uNoiseDropoff, Config.Client.Advanced.Graphics.NoiseTextureSettings.noiseDropoff.get());
|
||||
}
|
||||
|
||||
|
||||
@@ -148,19 +151,19 @@ public class DhTerrainShaderProgram extends ShaderProgram implements IDhApiShade
|
||||
public void bind()
|
||||
{
|
||||
super.bind();
|
||||
vao.bind();
|
||||
this.vao.bind();
|
||||
}
|
||||
@Override
|
||||
public void unbind()
|
||||
{
|
||||
super.unbind();
|
||||
vao.unbind();
|
||||
this.vao.unbind();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void free()
|
||||
{
|
||||
vao.free();
|
||||
this.vao.free();
|
||||
super.free();
|
||||
}
|
||||
|
||||
@@ -176,16 +179,16 @@ public class DhTerrainShaderProgram extends ShaderProgram implements IDhApiShade
|
||||
super.bind();
|
||||
|
||||
// uniforms
|
||||
setUniform(combinedMatUniform, combinedMatrix);
|
||||
setUniform(mircoOffsetUniform, 0.01f); // 0.01 block offset
|
||||
this.setUniform(this.uCombinedMatrix, combinedMatrix);
|
||||
this.setUniform(this.uMircoOffset, 0.01f); // 0.01 block offset
|
||||
|
||||
// setUniform(skyLightUniform, skyLight);
|
||||
setUniform(lightMapUniform, 0); // TODO this should probably be passed in
|
||||
this.setUniform(this.uLightMap, 0); // TODO this should probably be passed in
|
||||
|
||||
if (worldYOffsetUniform != -1) setUniform(worldYOffsetUniform, (float) renderParameters.worldYOffset);
|
||||
if (this.uWorldYOffset != -1) this.setUniform(this.uWorldYOffset, (float) renderParameters.worldYOffset);
|
||||
|
||||
// Debug
|
||||
setUniform(whiteWorldUniform, Config.Client.Advanced.Debugging.enableWhiteWorld.get());
|
||||
this.setUniform(this.uWhiteWorld, Config.Client.Advanced.Debugging.enableWhiteWorld.get());
|
||||
|
||||
// Clip Uniform
|
||||
float dhNearClipDistance = RenderUtil.getNearClipPlaneDistanceInBlocks(renderParameters.partialTicks);
|
||||
@@ -199,11 +202,11 @@ public class DhTerrainShaderProgram extends ShaderProgram implements IDhApiShade
|
||||
{
|
||||
dhNearClipDistance = 1.0f;
|
||||
}
|
||||
this.setUniform(this.clipDistanceUniform, dhNearClipDistance);
|
||||
this.setUniform(this.uClipDistance, dhNearClipDistance);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setModelOffsetPos(DhApiVec3f modelOffsetPos) { this.setUniform(this.modelOffsetUniform, new Vec3f(modelOffsetPos)); }
|
||||
public void setModelOffsetPos(DhApiVec3f modelOffsetPos) { this.setUniform(this.uModelOffset, new Vec3f(modelOffsetPos)); }
|
||||
|
||||
@Override
|
||||
public int getId() { return this.id; }
|
||||
|
||||
@@ -8,17 +8,17 @@ out vec4 vertexColor;
|
||||
out vec3 vertexWorldPos;
|
||||
out float vertexYPos;
|
||||
|
||||
uniform bool whiteWorld;
|
||||
uniform bool uWhiteWorld;
|
||||
|
||||
uniform mat4 combinedMatrix;
|
||||
uniform vec3 modelOffset;
|
||||
uniform float worldYOffset;
|
||||
uniform mat4 uCombinedMatrix;
|
||||
uniform vec3 uModelOffset;
|
||||
uniform float uWorldYOffset;
|
||||
|
||||
uniform int worldSkyLight;
|
||||
uniform sampler2D lightMap;
|
||||
uniform float mircoOffset;
|
||||
uniform int uWorldSkyLight;
|
||||
uniform sampler2D uLightMap;
|
||||
uniform float uMircoOffset;
|
||||
|
||||
uniform float earthRadius;
|
||||
uniform float uEarthRadius;
|
||||
|
||||
/**
|
||||
* TODO in the future this and standard.vert should be merged together to prevent inconsistencies between the two
|
||||
@@ -35,9 +35,9 @@ void main()
|
||||
{
|
||||
vPos = vPosition; // This is so it can be passed to the fragment shader
|
||||
|
||||
vertexWorldPos = vPosition.xyz + modelOffset;
|
||||
vertexWorldPos = vPosition.xyz + uModelOffset;
|
||||
|
||||
vertexYPos = vPosition.y + worldYOffset;
|
||||
vertexYPos = vPosition.y + uWorldYOffset;
|
||||
|
||||
uint meta = vPosition.a;
|
||||
|
||||
@@ -46,11 +46,11 @@ void main()
|
||||
// 0b01 = positive offset
|
||||
// 0b11 = negative offset
|
||||
// format is: 0b00zzyyxx
|
||||
float mx = (mirco & 1u) != 0u ? mircoOffset : 0.0;
|
||||
float mx = (mirco & 1u) != 0u ? uMircoOffset : 0.0;
|
||||
mx = (mirco & 2u) != 0u ? -mx : mx;
|
||||
float my = (mirco & 4u) != 0u ? mircoOffset : 0.0;
|
||||
float my = (mirco & 4u) != 0u ? uMircoOffset : 0.0;
|
||||
my = (mirco & 8u) != 0u ? -my : my;
|
||||
float mz = (mirco & 16u) != 0u ? mircoOffset : 0.0;
|
||||
float mz = (mirco & 16u) != 0u ? uMircoOffset : 0.0;
|
||||
mz = (mirco & 32u) != 0u ? -mz : mz;
|
||||
vertexWorldPos.x += mx;
|
||||
vertexWorldPos.y += my;
|
||||
@@ -58,7 +58,7 @@ void main()
|
||||
|
||||
|
||||
// vertex transformation logic - stduhpf
|
||||
float localRadius = earthRadius + vertexYPos;
|
||||
float localRadius = uEarthRadius + vertexYPos;
|
||||
float phi = length(vertexWorldPos.xz) / localRadius;
|
||||
vertexWorldPos.y += (cos(phi) - 1.0) * localRadius;
|
||||
vertexWorldPos.xz = vertexWorldPos.xz * sin(phi) / phi;
|
||||
@@ -68,12 +68,12 @@ void main()
|
||||
|
||||
float light2 = (mod(float(lights), 16.0) + 0.5) / 16.0;
|
||||
float light = (float(lights / 16u) + 0.5) / 16.0;
|
||||
vertexColor = vec4(texture(lightMap, vec2(light, light2)).xyz, 1.0);
|
||||
vertexColor = vec4(texture(uLightMap, vec2(light, light2)).xyz, 1.0);
|
||||
|
||||
if (!whiteWorld)
|
||||
if (!uWhiteWorld)
|
||||
{
|
||||
vertexColor *= color;
|
||||
}
|
||||
|
||||
gl_Position = combinedMatrix * vec4(vertexWorldPos, 1.0);
|
||||
gl_Position = uCombinedMatrix * vec4(vertexWorldPos, 1.0);
|
||||
}
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
#version 150 core
|
||||
|
||||
uniform vec4 uColor;
|
||||
|
||||
out vec4 fragColor;
|
||||
|
||||
void main()
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
#version 150 core
|
||||
|
||||
uniform mat4 transform;
|
||||
uniform mat4 uTransform;
|
||||
|
||||
in vec3 vPosition;
|
||||
|
||||
void main()
|
||||
{
|
||||
gl_Position = transform * vec4(vPosition, 1.0);
|
||||
gl_Position = uTransform * vec4(vPosition, 1.0);
|
||||
}
|
||||
@@ -9,13 +9,13 @@ out vec4 fragColor;
|
||||
|
||||
|
||||
// Fog/Clip Uniforms
|
||||
uniform float clipDistance = 0.0;
|
||||
uniform float uClipDistance = 0.0;
|
||||
|
||||
// Noise Uniforms
|
||||
uniform bool noiseEnabled;
|
||||
uniform int noiseSteps;
|
||||
uniform float noiseIntensity;
|
||||
uniform int noiseDropoff;
|
||||
uniform bool uNoiseEnabled;
|
||||
uniform int uNoiseSteps;
|
||||
uniform float uNoiseIntensity;
|
||||
uniform int uNoiseDropoff;
|
||||
|
||||
|
||||
// The random functions for diffrent dimentions
|
||||
@@ -38,13 +38,13 @@ void applyNoise(inout vec4 fragColor, const in float viewDist)
|
||||
// This bit of code is required to fix the vertex position problem cus of floats in the verted world position varuable
|
||||
vec3 fixedVPos = vPos.xyz + vertexNormal * 0.001;
|
||||
|
||||
float noiseAmplification = noiseIntensity * 0.01;
|
||||
float noiseAmplification = uNoiseIntensity * 0.01;
|
||||
float lum = (fragColor.r + fragColor.g + fragColor.b) / 3.0;
|
||||
noiseAmplification = (1.0 - pow(lum * 2.0 - 1.0, 2.0)) * noiseAmplification; // Lessen the effect on depending on how dark the object is, equasion for this is -(2x-1)^{2}+1
|
||||
noiseAmplification *= fragColor.a; // The effect would lessen on transparent objects
|
||||
|
||||
// Random value for each position
|
||||
float randomValue = rand(quantize(fixedVPos, noiseSteps))
|
||||
float randomValue = rand(quantize(fixedVPos, uNoiseSteps))
|
||||
* 2.0 * noiseAmplification - noiseAmplification;
|
||||
|
||||
// Modifies the color
|
||||
@@ -52,8 +52,8 @@ void applyNoise(inout vec4 fragColor, const in float viewDist)
|
||||
vec3 newCol = fragColor.rgb + (1.0 - fragColor.rgb) * randomValue;
|
||||
newCol = clamp(newCol, 0.0, 1.0);
|
||||
|
||||
if (noiseDropoff != 0) {
|
||||
float distF = min(viewDist / noiseDropoff, 1.0);
|
||||
if (uNoiseDropoff != 0) {
|
||||
float distF = min(viewDist / uNoiseDropoff, 1.0);
|
||||
newCol = mix(newCol, fragColor.rgb, distF); // The further away it gets, the less noise gets applied
|
||||
}
|
||||
|
||||
@@ -67,12 +67,12 @@ void main()
|
||||
fragColor = vertexColor;
|
||||
|
||||
float viewDist = length(vertexWorldPos);
|
||||
if (viewDist < clipDistance && clipDistance > 0.0)
|
||||
if (viewDist < uClipDistance && uClipDistance > 0.0)
|
||||
{
|
||||
discard;
|
||||
}
|
||||
|
||||
if (noiseEnabled)
|
||||
if (uNoiseEnabled)
|
||||
{
|
||||
applyNoise(fragColor, viewDist);
|
||||
}
|
||||
|
||||
@@ -7,9 +7,9 @@ out vec4 fragColor;
|
||||
|
||||
uniform float distanceScale;
|
||||
|
||||
uniform int noiseSteps;
|
||||
uniform float noiseIntensity;
|
||||
uniform float noiseDropoff;
|
||||
uniform int uNoiseSteps;
|
||||
uniform float uNoiseIntensity;
|
||||
uniform float uNoiseDropoff;
|
||||
|
||||
|
||||
|
||||
@@ -43,12 +43,12 @@ void main() {
|
||||
vec3 fixedVPos = vPos.xyz - vertexNormal * 0.001;
|
||||
|
||||
|
||||
float noiseAmplification = noiseIntensity / 100;
|
||||
float noiseAmplification = uNoiseIntensity / 100;
|
||||
noiseAmplification = (-1 * pow(2*((vertexColor.x + vertexColor.y + vertexColor.z) / 3) - 1, 2) + 1) * noiseAmplification; // Lessen the effect on depending on how dark the object is, equasion for this is -(2x-1)^{2}+1
|
||||
noiseAmplification *= vertexColor.w; // The effect would lessen on transparent objects
|
||||
|
||||
// Random value for each position
|
||||
float randomValue = rand(quantize(fixedVPos.xyz, noiseSteps))
|
||||
float randomValue = rand(quantize(fixedVPos.xyz, uNoiseSteps))
|
||||
* 2.0 * noiseAmplification - noiseAmplification;
|
||||
|
||||
|
||||
@@ -57,7 +57,7 @@ void main() {
|
||||
vec3 newCol = (1.0 - vertexColor.rgb) * randomValue;
|
||||
|
||||
// Clamps it and turns it back into a vec4
|
||||
float distA = length(vertexWorldPos) * distanceScale * noiseDropoff;
|
||||
float distA = length(vertexWorldPos) * distanceScale * uNoiseDropoff;
|
||||
fragColor = clamp(vec4(newCol.rgb, distA), 0.0, 1.0); // The further away it gets, the less noise gets applied
|
||||
|
||||
// The further away it gets, the less noise gets applied
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
#version 150 core
|
||||
|
||||
in vec2 vPosition;
|
||||
|
||||
out vec2 TexCoord;
|
||||
|
||||
/**
|
||||
|
||||
@@ -8,15 +8,15 @@ out vec4 vertexColor;
|
||||
out vec3 vertexWorldPos;
|
||||
out float vertexYPos;
|
||||
|
||||
uniform bool whiteWorld;
|
||||
uniform bool uWhiteWorld;
|
||||
|
||||
uniform mat4 combinedMatrix;
|
||||
uniform vec3 modelOffset;
|
||||
uniform float worldYOffset;
|
||||
uniform mat4 uCombinedMatrix;
|
||||
uniform vec3 uModelOffset;
|
||||
uniform float uWorldYOffset;
|
||||
|
||||
uniform int worldSkyLight;
|
||||
uniform sampler2D lightMap;
|
||||
uniform float mircoOffset;
|
||||
uniform int uWorldSkyLight;
|
||||
uniform sampler2D uLightMap;
|
||||
uniform float uMircoOffset;
|
||||
|
||||
|
||||
/**
|
||||
@@ -33,9 +33,9 @@ void main()
|
||||
{
|
||||
vPos = vPosition; // This is so it can be passed to the fragment shader
|
||||
|
||||
vertexWorldPos = vPosition.xyz + modelOffset;
|
||||
vertexWorldPos = vPosition.xyz + uModelOffset;
|
||||
|
||||
vertexYPos = vPosition.y + worldYOffset;
|
||||
vertexYPos = vPosition.y + uWorldYOffset;
|
||||
|
||||
uint meta = vPosition.a;
|
||||
|
||||
@@ -44,23 +44,23 @@ void main()
|
||||
// 0b01 = positive offset
|
||||
// 0b11 = negative offset
|
||||
// format is: 0b00zzyyxx
|
||||
float mx = (mirco & 1u)!=0u ? mircoOffset : 0.0;
|
||||
float mx = (mirco & 1u)!=0u ? uMircoOffset : 0.0;
|
||||
mx = (mirco & 2u)!=0u ? -mx : mx;
|
||||
float my = (mirco & 4u)!=0u ? mircoOffset : 0.0;
|
||||
float my = (mirco & 4u)!=0u ? uMircoOffset : 0.0;
|
||||
my = (mirco & 8u)!=0u ? -my : my;
|
||||
float mz = (mirco & 16u)!=0u ? mircoOffset : 0.0;
|
||||
float mz = (mirco & 16u)!=0u ? uMircoOffset : 0.0;
|
||||
mz = (mirco & 32u)!=0u ? -mz : mz;
|
||||
|
||||
uint lights = meta & 0xFFu;
|
||||
|
||||
float light2 = (mod(float(lights), 16.0)+0.5) / 16.0;
|
||||
float light = (float(lights/16u)+0.5) / 16.0;
|
||||
vertexColor = vec4(texture(lightMap, vec2(light, light2)).xyz, 1.0);
|
||||
vertexColor = vec4(texture(uLightMap, vec2(light, light2)).xyz, 1.0);
|
||||
|
||||
if (!whiteWorld)
|
||||
if (!uWhiteWorld)
|
||||
{
|
||||
vertexColor *= color;
|
||||
}
|
||||
|
||||
gl_Position = combinedMatrix * vec4(vertexWorldPos + vec3(mx, 0, mz), 1.0);
|
||||
gl_Position = uCombinedMatrix * vec4(vertexWorldPos + vec3(mx, 0, mz), 1.0);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user