-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
12 changed files
with
219 additions
and
92 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
58 changes: 58 additions & 0 deletions
58
examples/DeferredRendering/DeferredRendering.Assets/Shaders/BaseTypes.glsl
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
struct PackedVec2 | ||
{ | ||
float x; | ||
float y; | ||
}; | ||
|
||
struct PackedVec3 | ||
{ | ||
float x; | ||
float y; | ||
float z; | ||
}; | ||
|
||
struct PackedVec4 | ||
{ | ||
float x; | ||
float y; | ||
float z; | ||
float w; | ||
}; | ||
|
||
vec2 PackedToVec2(in PackedVec2 v) | ||
{ | ||
return vec2(v.x, v.y); | ||
} | ||
|
||
PackedVec2 Vec2ToPacked(in vec2 v) | ||
{ | ||
return PackedVec2(v.x, v.y); | ||
} | ||
|
||
vec3 PackedToVec3(in PackedVec3 v) | ||
{ | ||
return vec3(v.x, v.y, v.z); | ||
} | ||
|
||
PackedVec3 Vec3ToPacked(in vec3 v) | ||
{ | ||
return PackedVec3(v.x, v.y, v.z); | ||
} | ||
|
||
vec4 PackedToVec4(in PackedVec4 v) | ||
{ | ||
return vec4(v.x, v.y, v.z, v.w); | ||
} | ||
|
||
PackedVec4 Vec4ToPacked(in vec4 v) | ||
{ | ||
return PackedVec4(v.x, v.y, v.z, v.w); | ||
} | ||
|
||
struct Vertex | ||
{ | ||
PackedVec3 position; | ||
PackedVec3 normal; | ||
PackedVec2 uv; | ||
PackedVec4 tangent; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
31 changes: 31 additions & 0 deletions
31
examples/DeferredRendering/DeferredRendering.Assets/Shaders/SceneVertexPulling.vs.glsl
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
#version 460 core | ||
|
||
#include "BaseTypes.glsl" | ||
|
||
layout (location = 0) out gl_PerVertex | ||
{ | ||
vec4 gl_Position; | ||
}; | ||
layout(location = 0) out vec3 v_position; | ||
layout(location = 1) out vec3 v_normal; | ||
layout(location = 2) out vec2 v_uv; | ||
layout(location = 3) out flat int v_model_mesh_material_id; | ||
|
||
layout(std430, binding = 3) restrict readonly buffer VertexBuffer | ||
{ | ||
Vertex Vertices[]; | ||
}; | ||
|
||
#include "Common.glsl" | ||
|
||
void main() | ||
{ | ||
Vertex vertex = Vertices[gl_VertexID]; | ||
|
||
GpuModelMeshInstance modelMeshInstance = ModelMeshInstances[gl_BaseInstance]; | ||
v_position = (modelMeshInstance.World * vec4(PackedToVec3(vertex.position), 1.0)).xyz; | ||
v_normal = normalize(inverse(transpose(mat3(modelMeshInstance.World))) * PackedToVec3(vertex.normal)); | ||
v_uv = PackedToVec2(vertex.uv); | ||
v_model_mesh_material_id = modelMeshInstance.MaterialId.x; | ||
gl_Position = ViewProj * vec4(v_position, 1.0); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.