better system for texture terrain.
This commit is contained in:
parent
3aa6b5bc83
commit
443b3a319d
9 changed files with 120 additions and 69 deletions
|
|
@ -70,7 +70,7 @@ namespace Map3DRendering {
|
|||
}
|
||||
}
|
||||
private void InitializeBlock(int x, int y, BlockStruct block, Shader _shader) {
|
||||
int lenghPacket = 21;
|
||||
int lenghPacket = 20;
|
||||
// Initialisez le VAO, VBO et EBO pour le bloc à (x, y)...
|
||||
// Utilisez le code de votre méthode OnLoad originale pour configurer le VAO, VBO et EBO.
|
||||
int tempVertexArray = GL.GenVertexArray();
|
||||
|
|
@ -112,10 +112,6 @@ namespace Map3DRendering {
|
|||
var terraintypeLocation = _shader.GetAttribLocation("aTexType");
|
||||
GL.EnableVertexAttribArray(terraintypeLocation);
|
||||
GL.VertexAttribPointer(terraintypeLocation, 4, VertexAttribPointerType.Float, false, lenghPacket * sizeof(float), 16 * sizeof(float));
|
||||
|
||||
var realterraintypeLocation = _shader.GetAttribLocation("aRealTexType");
|
||||
GL.EnableVertexAttribArray(realterraintypeLocation);
|
||||
GL.VertexAttribPointer(realterraintypeLocation, 1, VertexAttribPointerType.Float, false, lenghPacket * sizeof(float), 20 * sizeof(float));
|
||||
}
|
||||
public void Render(Shader shader) {
|
||||
for (int y = startY; y <= endY; y++) {
|
||||
|
|
|
|||
|
|
@ -12,7 +12,6 @@ in vec3 Normal;
|
|||
in vec3 FragPos;
|
||||
in vec2 TexCoord;
|
||||
in vec4 TexType;
|
||||
in float RealType;
|
||||
|
||||
void main()
|
||||
{
|
||||
|
|
|
|||
|
|
@ -5,7 +5,6 @@ layout (location = 2) in vec4 aColor;
|
|||
layout (location = 3) in vec4 aColorFar;
|
||||
layout (location = 4) in vec2 aTexCoord;
|
||||
layout (location = 5) in vec4 aTexType;
|
||||
layout (location = 6) in float aRealTexType;
|
||||
|
||||
uniform mat4 model;
|
||||
uniform mat4 view;
|
||||
|
|
@ -17,7 +16,6 @@ out vec4 Color;
|
|||
out vec4 FarColor;
|
||||
out vec2 TexCoord;
|
||||
out vec4 TexType;
|
||||
out float RealType;
|
||||
|
||||
void main()
|
||||
{
|
||||
|
|
@ -28,5 +26,4 @@ void main()
|
|||
FarColor = aColorFar;
|
||||
TexCoord = aTexCoord;
|
||||
TexType = aTexType;
|
||||
RealType = aRealTexType;
|
||||
}
|
||||
|
|
@ -83,7 +83,7 @@ namespace Map3DRendering {
|
|||
|
||||
//_shader.SetVector3("objectColor", new Vector3(0.5f, 0.5f, 0.5f));
|
||||
_shader.SetVector3("lightColor", new Vector3(1.0f, 1.0f, 1.0f));
|
||||
_shader.SetVector3("lightPos", _lightPosVec);
|
||||
_shader.SetVector3("lightPos", _camera.Position);
|
||||
|
||||
GL.LineWidth(5.0f);
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue