implement custom chunk meshes, models and shaders.
This commit is contained in:
parent
e4d536bc87
commit
e805891885
7 changed files with 800 additions and 57 deletions
|
|
@ -2,13 +2,13 @@
|
|||
|
||||
in vec3 vertexPosition;
|
||||
in vec2 vertexTexCoord;
|
||||
in vec2 vertexTexCoord2;
|
||||
in vec4 vertexColor;
|
||||
in vec4 vertexTangent; // metadata1
|
||||
in vec3 vertexNormal;
|
||||
in vec2 vertexTileTexCoord;
|
||||
in vec4 vertexMetadata1;
|
||||
|
||||
out vec2 fragTexCoord;
|
||||
out vec2 fragTexCoord2;
|
||||
out vec4 fragColor;
|
||||
out vec3 fragNormal;
|
||||
out vec2 fragTileTexCoord;
|
||||
|
||||
flat out int ambientOcclusionSide1;
|
||||
flat out int ambientOcclusionSide2;
|
||||
|
|
@ -22,18 +22,18 @@ uniform mat4 mvp;
|
|||
|
||||
void main() {
|
||||
fragTexCoord = vertexTexCoord;
|
||||
fragColor = vertexColor;
|
||||
fragTexCoord2 = vertexTexCoord2;
|
||||
fragTileTexCoord = vertexTileTexCoord;
|
||||
fragNormal = vertexNormal;
|
||||
gl_Position = mvp*vec4(vertexPosition, 1.0);
|
||||
|
||||
// metadata 1 processing
|
||||
ambientOcclusionSide1 = floatBitsToInt(vertexTangent.x);
|
||||
ambientOcclusionSide2 = floatBitsToInt(vertexTangent.y);
|
||||
int metadata1Z = floatBitsToInt(vertexTangent.z);
|
||||
int metadata1W = floatBitsToInt(vertexTangent.w);
|
||||
ambientOcclusionCorner1 = (metadata1Z & 0x1) >> 0;
|
||||
ambientOcclusionCorner2 = (metadata1Z & 0x2) >> 1;
|
||||
ambientOcclusionCorner3 = (metadata1Z & 0x4) >> 2;
|
||||
quadHeight = (metadata1Z & 0x1f8) >> 3;
|
||||
quadWidth = (metadata1Z & 0x7e00) >> 9;
|
||||
// metadata 1 parsing
|
||||
ambientOcclusionSide1 = floatBitsToInt(vertexMetadata1.x);
|
||||
ambientOcclusionSide2 = floatBitsToInt(vertexMetadata1.y);
|
||||
int metadata1Z = floatBitsToInt(vertexMetadata1.z);
|
||||
int metadata1W = floatBitsToInt(vertexMetadata1.w);
|
||||
ambientOcclusionCorner1 = (metadata1Z & 0x1) >> 0; // Take 0th bit.
|
||||
ambientOcclusionCorner2 = (metadata1Z & 0x2) >> 1; // Take 1st bit.
|
||||
ambientOcclusionCorner3 = (metadata1Z & 0x4) >> 2; // Take 2nd bit.
|
||||
quadHeight = (metadata1Z & 0x1f8) >> 3; // Take 3rd-8th bits.
|
||||
quadWidth = (metadata1Z & 0x7e00) >> 9; // Take 9th-14th bits.
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue