adjusted shaders
This commit is contained in:
@@ -5,11 +5,15 @@ struct Material {
|
|||||||
vec3 baseColor;
|
vec3 baseColor;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
vec3 directional_light = vec3(-1.0,-1.0,-1.0);
|
||||||
|
|
||||||
layout(location = 0) in vec3 normal;
|
layout(location = 0) in vec3 normal;
|
||||||
layout(location = 1) in Material material;
|
layout(location = 1) in Material material;
|
||||||
|
|
||||||
layout(location = 0) out vec4 outColor;
|
layout(location = 0) out vec4 outColor;
|
||||||
|
|
||||||
void main() {
|
void main() {
|
||||||
outColor = vec4(material.baseColor, 1.0);
|
//float intensity = ((dot(normalize(normal), normalize(directional_light)) +1)/2.0)+0.05;
|
||||||
|
|
||||||
|
//outColor = vec4(material.baseColor * intensity, 1.0);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -13,15 +13,15 @@ struct Material {
|
|||||||
};
|
};
|
||||||
|
|
||||||
struct Mesh {
|
struct Mesh {
|
||||||
uint indexBufferIndex;
|
uint asd;
|
||||||
uint vertexBufferIndex;
|
|
||||||
uint materialBufferIndex;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
layout( push_constant ) uniform constants
|
layout( push_constant ) uniform constants
|
||||||
{
|
{
|
||||||
mat4 render_matrix;
|
mat4 render_matrix;
|
||||||
uint meshIndex;
|
uint indexBufferIndex;
|
||||||
|
uint vertexBufferIndex;
|
||||||
|
uint materialBufferIndex;
|
||||||
} PushConstants;
|
} PushConstants;
|
||||||
|
|
||||||
layout(set = 0, binding = 0) uniform CameraParam {
|
layout(set = 0, binding = 0) uniform CameraParam {
|
||||||
@@ -50,13 +50,15 @@ layout(location = 1) out Material material;
|
|||||||
|
|
||||||
void main()
|
void main()
|
||||||
{
|
{
|
||||||
Mesh mesh = MeshBuffers[PushConstants.meshIndex].mesh;
|
//Mesh mesh = MeshBuffers[PushConstants.meshIndex].mesh;
|
||||||
material = MaterialBuffers[ mesh.materialBufferIndex ].material;
|
//material = MaterialBuffers[ mesh.materialBufferIndex ].material;
|
||||||
|
material = MaterialBuffers[ PushConstants.materialBufferIndex ].material;
|
||||||
|
|
||||||
uint index = IndexBuffers[ mesh.indexBufferIndex ].indices[gl_VertexIndex];
|
uint index = IndexBuffers[ PushConstants.indexBufferIndex ].indices[gl_VertexIndex];
|
||||||
Vertex vertex = VertexBuffers[ mesh.vertexBufferIndex ].vertices[ index ];
|
//uint index = IndexBuffers[ mesh.indexBufferIndex ].indices[gl_VertexIndex];
|
||||||
|
//Vertex vertex = VertexBuffers[ mesh.vertexBufferIndex ].vertices[ index ];
|
||||||
|
Vertex vertex = VertexBuffers[ PushConstants.vertexBufferIndex ].vertices[ index ];
|
||||||
|
|
||||||
normal = vertex.normal.xyz;
|
normal = vertex.normal.xyz;
|
||||||
float scale = 0.3;
|
gl_Position = Camera.projection * Camera.view * PushConstants.render_matrix * vec4(vertex.position.x, vertex.position.y, vertex.position.z, 1.0);
|
||||||
gl_Position = Camera.projection * Camera.view * PushConstants.render_matrix * vec4(vertex.position.x * scale - 0.1, vertex.position.y * scale - 0.7, (vertex.position.z * scale * -1.0 + 0.9), 1.0);
|
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user