-
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.
Merge branch 'main' of https://github.com/Contraband-Software/Rock
- Loading branch information
Showing
50 changed files
with
2,732 additions
and
132 deletions.
There are no files selected for viewing
68 changes: 34 additions & 34 deletions
68
GREngine.Core/GREngine.Core.PebbleRenderer/.config/dotnet-tools.json
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 |
---|---|---|
@@ -1,36 +1,36 @@ | ||
{ | ||
"version": 1, | ||
"isRoot": true, | ||
"tools": { | ||
"dotnet-mgcb": { | ||
"version": "3.8.1.303", | ||
"commands": [ | ||
"mgcb" | ||
] | ||
}, | ||
"dotnet-mgcb-editor": { | ||
"version": "3.8.1.303", | ||
"commands": [ | ||
"mgcb-editor" | ||
] | ||
}, | ||
"dotnet-mgcb-editor-linux": { | ||
"version": "3.8.1.303", | ||
"commands": [ | ||
"mgcb-editor-linux" | ||
] | ||
}, | ||
"dotnet-mgcb-editor-windows": { | ||
"version": "3.8.1.303", | ||
"commands": [ | ||
"mgcb-editor-windows" | ||
] | ||
}, | ||
"dotnet-mgcb-editor-mac": { | ||
"version": "3.8.1.303", | ||
"commands": [ | ||
"mgcb-editor-mac" | ||
] | ||
"version": 1, | ||
"isRoot": true, | ||
"tools": { | ||
"dotnet-mgcb": { | ||
"version": "3.8.1.303", | ||
"commands": [ | ||
"mgcb" | ||
] | ||
}, | ||
"dotnet-mgcb-editor": { | ||
"version": "3.8.1.303", | ||
"commands": [ | ||
"mgcb-editor" | ||
] | ||
}, | ||
"dotnet-mgcb-editor-linux": { | ||
"version": "3.8.1.303", | ||
"commands": [ | ||
"mgcb-editor-linux" | ||
] | ||
}, | ||
"dotnet-mgcb-editor-windows": { | ||
"version": "3.8.1.303", | ||
"commands": [ | ||
"mgcb-editor-windows" | ||
] | ||
}, | ||
"dotnet-mgcb-editor-mac": { | ||
"version": "3.8.1.303", | ||
"commands": [ | ||
"mgcb-editor-mac" | ||
] | ||
} | ||
} | ||
} | ||
} | ||
} |
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
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
72 changes: 72 additions & 0 deletions
72
GREngine.Core/GREngine.Core.PebbleRenderer/Content/crtPostProcess.fx
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,72 @@ | ||
#if OPENGL | ||
#define SV_POSITION POSITION | ||
#define VS_SHADERMODEL vs_3_0 | ||
#define PS_SHADERMODEL ps_3_0 | ||
#else | ||
#define VS_SHADERMODEL vs_4_0_level_9_1 | ||
#define PS_SHADERMODEL ps_4_0_level_9_1 | ||
#endif | ||
|
||
Texture2D SpriteTexture; | ||
|
||
float4x4 viewProjection; | ||
float time; | ||
|
||
|
||
sampler2D screenSampler = sampler_state | ||
{ | ||
Texture = <SpriteTexture>; | ||
}; | ||
|
||
struct VertexShaderOutput | ||
{ | ||
float4 Position : SV_POSITION; | ||
float4 Color : COLOR0; | ||
float2 TextureCoordinates : TEXCOORD0; | ||
}; | ||
|
||
float2 curve(float2 uv) | ||
{ | ||
uv = (uv - 0.5) * 2.0; | ||
uv *= 1.1; | ||
uv.x *= 1.0 + pow((abs(uv.y) / 5.0), 2.0); | ||
uv.y *= 1.0 + pow((abs(uv.x) / 4.0), 2.0); | ||
uv = (uv / 2.0) + 0.5; | ||
uv = uv * 0.92 + 0.04; | ||
return uv; | ||
} | ||
|
||
float4 MainPS(VertexShaderOutput input) : COLOR | ||
{ | ||
//Curve | ||
float2 uv = input.TextureCoordinates; | ||
uv = curve(uv); | ||
|
||
float3 col; | ||
|
||
// Chromatic | ||
col.r = tex2D(screenSampler, float2(uv.x + 0.003, uv.y)).x; | ||
col.g = tex2D(screenSampler, float2(uv.x + 0.000, uv.y)).y; | ||
col.b = tex2D(screenSampler, float2(uv.x - 0.003, uv.y)).z; | ||
|
||
col *= step(0.0, uv.x) * step(0.0, uv.y); | ||
col *= 1.0 - step(1.0, uv.x) * 1.0 - step(1.0, uv.y); | ||
|
||
col *= 0.5 + 0.5 * 16.0 * uv.x * uv.y * (1.0 - uv.x) * (1.0 - uv.y); | ||
col *= float3(0.95, 1.05, 0.95); | ||
|
||
col *= 0.9 + 0.1 * sin(10.0 * time + uv.y * 700.0); | ||
|
||
col *= 0.99 + 0.01 * sin(110.0 * time); | ||
|
||
return float4(col, 1.0); | ||
|
||
} | ||
|
||
technique SpriteDrawing | ||
{ | ||
pass P0 | ||
{ | ||
PixelShader = compile PS_SHADERMODEL MainPS(); | ||
} | ||
}; |
44 changes: 44 additions & 0 deletions
44
GREngine.Core/GREngine.Core.PebbleRenderer/Content/defaultDiffuseShader.fx
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,44 @@ | ||
#if OPENGL | ||
#define SV_POSITION POSITION | ||
#define VS_SHADERMODEL vs_3_0 | ||
#define PS_SHADERMODEL ps_3_0 | ||
#else | ||
#define VS_SHADERMODEL vs_4_0_level_9_1 | ||
#define PS_SHADERMODEL ps_4_0_level_9_1 | ||
#endif | ||
|
||
int width; | ||
int height; | ||
float time; | ||
float3 ambientColor; | ||
|
||
|
||
sampler diffuseSampler : register(s0); | ||
sampler lightMap : register(s1); | ||
|
||
struct VertexShaderOutput | ||
{ | ||
float4 Position : SV_POSITION0; | ||
float4 Color : COLOR0; | ||
float2 TextureCoordinates : TEXCOORD0; | ||
}; | ||
|
||
float4 MainPS(VertexShaderOutput input) : COLOR | ||
{ | ||
float2 ligtmapUV = float2(input.Position.x / width, input.Position.y / height); | ||
float3 lightColor = tex2D(lightMap, ligtmapUV).rgb + ambientColor; //baked in ambient todo make it a parameter | ||
|
||
float2 uv = input.TextureCoordinates; | ||
float4 sample = tex2D(diffuseSampler, uv); | ||
return float4(sample * lightColor, sample.a) * input.Color; //a is alpha right? | ||
//+ (max(dot(lightColor, lightColor) - 2, 0) * lightColor * 0.2) //crude hdr | ||
|
||
} | ||
|
||
technique SpriteDrawing | ||
{ | ||
pass P0 | ||
{ | ||
PixelShader = compile PS_SHADERMODEL MainPS(); | ||
} | ||
}; |
45 changes: 45 additions & 0 deletions
45
GREngine.Core/GREngine.Core.PebbleRenderer/Content/defaultNormalShader.fx
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,45 @@ | ||
#if OPENGL | ||
#define SV_POSITION POSITION | ||
#define VS_SHADERMODEL vs_3_0 | ||
#define PS_SHADERMODEL ps_3_0 | ||
#else | ||
#define VS_SHADERMODEL vs_4_0_level_9_1 | ||
#define PS_SHADERMODEL ps_4_0_level_9_1 | ||
#endif | ||
|
||
Texture2D SpriteTexture; | ||
|
||
float4x4 viewProjection; | ||
float time; | ||
|
||
|
||
sampler2D SpriteTextureSampler = sampler_state | ||
{ | ||
Texture = <SpriteTexture>; | ||
}; | ||
|
||
struct VertexShaderOutput | ||
{ | ||
float4 Position : SV_POSITION; | ||
float4 Color : COLOR0; | ||
float2 TextureCoordinates : TEXCOORD0; | ||
float Depth : DEPTH0; //? | ||
}; | ||
|
||
float4 MainPS(VertexShaderOutput input) : COLOR | ||
{ | ||
float4 sample = tex2D(SpriteTextureSampler, input.TextureCoordinates) * input.Color; | ||
if (input.Color.r == 0 && input.Color.g == 0 && input.Color.b == 0 && sample.a != 0) | ||
{ | ||
sample = float4(0.5, 0.5, 1, 1); | ||
} | ||
return sample; | ||
} | ||
|
||
technique SpriteDrawing | ||
{ | ||
pass P0 | ||
{ | ||
PixelShader = compile PS_SHADERMODEL MainPS(); | ||
} | ||
}; |
74 changes: 74 additions & 0 deletions
74
GREngine.Core/GREngine.Core.PebbleRenderer/Content/dither.fx
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,74 @@ | ||
#if OPENGL | ||
#define SV_POSITION POSITION | ||
#define VS_SHADERMODEL vs_3_0 | ||
#define PS_SHADERMODEL ps_3_0 | ||
#else | ||
#define VS_SHADERMODEL vs_4_0_level_9_1 | ||
#define PS_SHADERMODEL ps_4_0_level_9_1 | ||
#endif | ||
|
||
Texture2D SpriteTexture; | ||
|
||
sampler SpriteTextureSampler : register(s0); | ||
sampler ditherSampler : register(s1); | ||
|
||
struct VertexShaderOutput | ||
{ | ||
float4 Position : SV_POSITION; | ||
float4 Color : COLOR0; | ||
float2 TextureCoordinates : TEXCOORD0; | ||
}; | ||
|
||
float2 ditherSize = float2(8., 8.); | ||
float3 RGB_CHANNELS = float3(10, 10, 10); | ||
float dither_f(float x, float c) | ||
{ | ||
x = min(x, 0.999); | ||
return floor(c * x) / c + 1. / (2. * c); | ||
} | ||
float3 dither(float3 color, float2 pixCoord) | ||
{ | ||
float3 col = color; | ||
float3 col2 = color; | ||
|
||
|
||
float3 col3 = float3(0,0,0); | ||
col3.r = dither_f(col.r, RGB_CHANNELS.r - 1.); | ||
col3.g = dither_f(col.g, RGB_CHANNELS.g - 1.); | ||
col3.b = dither_f(col.b, RGB_CHANNELS.b - 1.); | ||
|
||
col2 = col3 - 1. / (2. * (RGB_CHANNELS - 1.)); | ||
col = col3 + 1. / (2. * (RGB_CHANNELS - 1.)); | ||
|
||
|
||
float lerpR = (color.r - col.r) / (col2.r - col.r); | ||
float lerpG = (color.g - col.g) / (col2.g - col.g); | ||
float lerpB = (color.b - col.b) / (col2.b - col.b); | ||
|
||
float2 ditherCoordinate = pixCoord / ditherSize; | ||
|
||
float ditherval = tex2D(ditherSampler, ditherCoordinate).r; | ||
|
||
float3 ditheredval = float3(step(ditherval, lerpR), step(ditherval, lerpG), step(ditherval, lerpB)); | ||
|
||
col = lerp(col, col2, ditheredval); | ||
|
||
return col; | ||
} | ||
|
||
|
||
|
||
float4 MainPS(VertexShaderOutput input) : COLOR | ||
{ | ||
|
||
float4 col = tex2D(SpriteTextureSampler, input.TextureCoordinates); | ||
return float4(dither(col.rgb, input.TextureCoordinates),1); | ||
} | ||
|
||
technique SpriteDrawing | ||
{ | ||
pass P0 | ||
{ | ||
PixelShader = compile PS_SHADERMODEL MainPS(); | ||
} | ||
}; |
38 changes: 38 additions & 0 deletions
38
GREngine.Core/GREngine.Core.PebbleRenderer/Content/isolate.fx
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,38 @@ | ||
#if OPENGL | ||
#define SV_POSITION POSITION | ||
#define VS_SHADERMODEL vs_3_0 | ||
#define PS_SHADERMODEL ps_3_0 | ||
#else | ||
#define VS_SHADERMODEL vs_4_0_level_9_1 | ||
#define PS_SHADERMODEL ps_4_0_level_9_1 | ||
#endif | ||
|
||
Texture2D SpriteTexture; | ||
float threshold = 0.9;// add param | ||
|
||
sampler2D SpriteTextureSampler = sampler_state | ||
{ | ||
Texture = <SpriteTexture>; | ||
}; | ||
|
||
struct VertexShaderOutput | ||
{ | ||
float4 Position : SV_POSITION; | ||
float4 Color : COLOR0; | ||
float2 TextureCoordinates : TEXCOORD0; | ||
}; | ||
|
||
float4 MainPS(VertexShaderOutput input) : COLOR | ||
{ | ||
float4 sample = tex2D(SpriteTextureSampler, input.TextureCoordinates); | ||
|
||
return float4(step(0.9, dot(sample.rgb, sample.rgb)) * sample.rgb*2, sample.a)*0.1; | ||
} | ||
|
||
technique SpriteDrawing | ||
{ | ||
pass P0 | ||
{ | ||
PixelShader = compile PS_SHADERMODEL MainPS(); | ||
} | ||
}; |
Oops, something went wrong.