|
@@ -1,13 +1,17 @@
|
|
|
Parameters =
|
|
Parameters =
|
|
|
{
|
|
{
|
|
|
- mat4x4 worldTransform;
|
|
|
|
|
- float invViewportWidth;
|
|
|
|
|
- float invViewportHeight;
|
|
|
|
|
|
|
+ mat4x4 gWorldTransform;
|
|
|
|
|
+ float gInvViewportWidth;
|
|
|
|
|
+ float gInvViewportHeight;
|
|
|
|
|
+ color gTint;
|
|
|
|
|
|
|
|
- Sampler2D mainTexSamp : alias("mainTexture");
|
|
|
|
|
- Texture2D mainTexture;
|
|
|
|
|
-
|
|
|
|
|
- color tint;
|
|
|
|
|
|
|
+ Sampler2D gMainTexSamp : alias("gMainTexture");
|
|
|
|
|
+ Texture2D gMainTexture;
|
|
|
|
|
+};
|
|
|
|
|
+
|
|
|
|
|
+Blocks =
|
|
|
|
|
+{
|
|
|
|
|
+ Block GUIParams : auto("GUIParams");
|
|
|
};
|
|
};
|
|
|
|
|
|
|
|
Technique : base("SpriteImage") =
|
|
Technique : base("SpriteImage") =
|
|
@@ -19,22 +23,29 @@ Technique : base("SpriteImage") =
|
|
|
DepthRead = false;
|
|
DepthRead = false;
|
|
|
DepthWrite = false;
|
|
DepthWrite = false;
|
|
|
|
|
|
|
|
|
|
+ Common =
|
|
|
|
|
+ {
|
|
|
|
|
+ cbuffer GUIParams
|
|
|
|
|
+ {
|
|
|
|
|
+ float4x4 gWorldTransform;
|
|
|
|
|
+ float gInvViewportWidth;
|
|
|
|
|
+ float gInvViewportHeight;
|
|
|
|
|
+ float4 gTint;
|
|
|
|
|
+ }
|
|
|
|
|
+ };
|
|
|
|
|
+
|
|
|
Vertex =
|
|
Vertex =
|
|
|
{
|
|
{
|
|
|
- float invViewportWidth;
|
|
|
|
|
- float invViewportHeight;
|
|
|
|
|
- float4x4 worldTransform;
|
|
|
|
|
-
|
|
|
|
|
void main(
|
|
void main(
|
|
|
in float3 inPos : POSITION,
|
|
in float3 inPos : POSITION,
|
|
|
in float2 uv : TEXCOORD0,
|
|
in float2 uv : TEXCOORD0,
|
|
|
out float4 oPosition : SV_Position,
|
|
out float4 oPosition : SV_Position,
|
|
|
out float2 oUv : TEXCOORD0)
|
|
out float2 oUv : TEXCOORD0)
|
|
|
{
|
|
{
|
|
|
- float4 tfrmdPos = mul(worldTransform, float4(inPos.xy, 0, 1));
|
|
|
|
|
|
|
+ float4 tfrmdPos = mul(gWorldTransform, float4(inPos.xy, 0, 1));
|
|
|
|
|
|
|
|
- float tfrmdX = -1.0f + (tfrmdPos.x * invViewportWidth);
|
|
|
|
|
- float tfrmdY = 1.0f - (tfrmdPos.y * invViewportHeight);
|
|
|
|
|
|
|
+ float tfrmdX = -1.0f + (tfrmdPos.x * gInvViewportWidth);
|
|
|
|
|
+ float tfrmdY = 1.0f - (tfrmdPos.y * gInvViewportHeight);
|
|
|
|
|
|
|
|
oPosition = float4(tfrmdX, tfrmdY, 0, 1);
|
|
oPosition = float4(tfrmdX, tfrmdY, 0, 1);
|
|
|
oUv = uv;
|
|
oUv = uv;
|
|
@@ -43,14 +54,13 @@ Technique : base("SpriteImage") =
|
|
|
|
|
|
|
|
Fragment =
|
|
Fragment =
|
|
|
{
|
|
{
|
|
|
- SamplerState mainTexSamp : register(s0);
|
|
|
|
|
- Texture2D mainTexture : register(t0);
|
|
|
|
|
- float4 tint;
|
|
|
|
|
-
|
|
|
|
|
|
|
+ SamplerState gMainTexSamp : register(s0);
|
|
|
|
|
+ Texture2D gMainTexture : register(t0);
|
|
|
|
|
+
|
|
|
float4 main(in float4 inPos : SV_Position, float2 uv : TEXCOORD0) : SV_Target
|
|
float4 main(in float4 inPos : SV_Position, float2 uv : TEXCOORD0) : SV_Target
|
|
|
{
|
|
{
|
|
|
- float4 color = mainTexture.Sample(mainTexSamp, uv);
|
|
|
|
|
- return color * tint;
|
|
|
|
|
|
|
+ float4 color = gMainTexture.Sample(gMainTexSamp, uv);
|
|
|
|
|
+ return color * gTint;
|
|
|
}
|
|
}
|
|
|
};
|
|
};
|
|
|
};
|
|
};
|
|
@@ -65,15 +75,19 @@ Technique : base("SpriteImage") =
|
|
|
DepthRead = false;
|
|
DepthRead = false;
|
|
|
DepthWrite = false;
|
|
DepthWrite = false;
|
|
|
|
|
|
|
|
- Vertex =
|
|
|
|
|
|
|
+ Common =
|
|
|
{
|
|
{
|
|
|
- layout (binding = 0) uniform VertUBO
|
|
|
|
|
|
|
+ layout (binding = 0, std140) uniform GUIParams
|
|
|
{
|
|
{
|
|
|
- float invViewportWidth;
|
|
|
|
|
- float invViewportHeight;
|
|
|
|
|
- mat4 worldTransform;
|
|
|
|
|
- };
|
|
|
|
|
-
|
|
|
|
|
|
|
+ mat4 gWorldTransform;
|
|
|
|
|
+ float gInvViewportWidth;
|
|
|
|
|
+ float gInvViewportHeight;
|
|
|
|
|
+ vec4 gTint;
|
|
|
|
|
+ };
|
|
|
|
|
+ };
|
|
|
|
|
+
|
|
|
|
|
+ Vertex =
|
|
|
|
|
+ {
|
|
|
layout (location = 0) in vec3 bs_position;
|
|
layout (location = 0) in vec3 bs_position;
|
|
|
layout (location = 1) in vec2 bs_texcoord0;
|
|
layout (location = 1) in vec2 bs_texcoord0;
|
|
|
|
|
|
|
@@ -86,10 +100,10 @@ Technique : base("SpriteImage") =
|
|
|
|
|
|
|
|
void main()
|
|
void main()
|
|
|
{
|
|
{
|
|
|
- vec4 tfrmdPos = worldTransform * vec4(bs_position.xy, 0, 1);
|
|
|
|
|
|
|
+ vec4 tfrmdPos = gWorldTransform * vec4(bs_position.xy, 0, 1);
|
|
|
|
|
|
|
|
- float tfrmdX = -1.0f + (tfrmdPos.x * invViewportWidth);
|
|
|
|
|
- float tfrmdY = 1.0f - (tfrmdPos.y * invViewportHeight);
|
|
|
|
|
|
|
+ float tfrmdX = -1.0f + (tfrmdPos.x * gInvViewportWidth);
|
|
|
|
|
+ float tfrmdY = 1.0f - (tfrmdPos.y * gInvViewportHeight);
|
|
|
|
|
|
|
|
gl_Position = vec4(tfrmdX, tfrmdY, 0, 1);
|
|
gl_Position = vec4(tfrmdX, tfrmdY, 0, 1);
|
|
|
texcoord0 = bs_texcoord0;
|
|
texcoord0 = bs_texcoord0;
|
|
@@ -98,20 +112,15 @@ Technique : base("SpriteImage") =
|
|
|
|
|
|
|
|
Fragment =
|
|
Fragment =
|
|
|
{
|
|
{
|
|
|
- layout (binding = 1) uniform FragUBO
|
|
|
|
|
- {
|
|
|
|
|
- vec4 tint;
|
|
|
|
|
- };
|
|
|
|
|
-
|
|
|
|
|
- layout (binding = 2) uniform sampler2D mainTexture;
|
|
|
|
|
|
|
+ layout (binding = 1) uniform sampler2D gMainTexture;
|
|
|
|
|
|
|
|
layout (location = 0) in vec2 texcoord0;
|
|
layout (location = 0) in vec2 texcoord0;
|
|
|
layout (location = 0) out vec4 fragColor;
|
|
layout (location = 0) out vec4 fragColor;
|
|
|
|
|
|
|
|
void main()
|
|
void main()
|
|
|
{
|
|
{
|
|
|
- vec4 color = texture2D(mainTexture, texcoord0.st);
|
|
|
|
|
- fragColor = color * tint;
|
|
|
|
|
|
|
+ vec4 color = texture2D(gMainTexture, texcoord0.st);
|
|
|
|
|
+ fragColor = color * gTint;
|
|
|
}
|
|
}
|
|
|
};
|
|
};
|
|
|
};
|
|
};
|