-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Initial - slang support, render layers
- Loading branch information
Showing
45 changed files
with
14,847 additions
and
623 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
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,53 @@ | ||
Shader | ||
{ | ||
Name = "AgX Shader"; | ||
Description = "AgX Tonemap Shader"; | ||
} | ||
|
||
Common | ||
{ | ||
// Empty | ||
} | ||
|
||
Vertex | ||
{ | ||
struct fs_in | ||
{ | ||
vec2 vTexCoord; | ||
}; | ||
|
||
layout (location = 0) in vec3 vPosition; | ||
layout (location = 1) in vec2 vTexCoord; | ||
|
||
layout (location = 0) out fs_in vs_out; | ||
|
||
void main() | ||
{ | ||
vs_out.vTexCoord = vTexCoord; | ||
gl_Position = vec4( vPosition, 1.0 ); | ||
} | ||
} | ||
|
||
Fragment | ||
{ | ||
struct fs_in | ||
{ | ||
vec2 vTexCoord; | ||
}; | ||
|
||
layout (location = 0) in fs_in vs_out; | ||
layout (location = 0) out vec4 outFragColor; | ||
|
||
layout (set = 0, binding = 0) uniform sampler2D renderTexture; | ||
|
||
vec3 sampleTexture( sampler2D target ) | ||
{ | ||
return texture( target, vs_out.vTexCoord.xy ).rgb; | ||
} | ||
|
||
void main() | ||
{ | ||
vec3 fragColor = sampleTexture( renderTexture ); | ||
outFragColor = vec4(fragColor, 1.0f); | ||
} | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
namespace Mocha; | ||
|
||
public enum SceneMeshFlags | ||
{ | ||
WorldLayer = 1 << 1, | ||
UILayer = 1 << 2, | ||
|
||
Default = WorldLayer, | ||
PostProcess = UILayer, | ||
}; |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
namespace Mocha; | ||
|
||
public class PostProcess | ||
{ | ||
private Glue.SceneMesh Native => NativeEngine.GetSceneGraph().GetMesh( NativeHandle ); | ||
private uint NativeHandle; | ||
|
||
private Material material; | ||
private Model model; | ||
|
||
public PostProcess( string shaderPath ) | ||
{ | ||
material = Material.FromShader( | ||
shaderPath, | ||
[ | ||
new VertexAttribute( "Position", VertexAttributeFormat.Float3 ), | ||
new VertexAttribute( "UV", VertexAttributeFormat.Float2 ) | ||
] | ||
); | ||
|
||
NativeHandle = NativeEngine.GetSceneGraph().CreateMesh(); | ||
Native.SetFlags( SceneMeshFlags.PostProcess ); | ||
|
||
model = new Model( | ||
[ | ||
new Vertex() { Position = new Vector3( -1, -1, 0 ), UV = new Vector2(0, 0)}, | ||
new Vertex() { Position = new Vector3( 3, -1, 0 ), UV = new Vector2(2, 0)}, | ||
new Vertex() { Position = new Vector3( -1, 3, 0 ), UV = new Vector2(0, 2)}, | ||
], | ||
material | ||
); | ||
|
||
Native.SetModel( model.NativeModel ); | ||
} | ||
} |
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
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.