|
|
@@ -8,9 +8,9 @@
|
|
|
|
|
|
#include <AnKi/Shaders/ForwardShadingCommon.glsl>
|
|
|
|
|
|
-struct PerDraw
|
|
|
+#pragma anki reflect AnKiLocalUniforms
|
|
|
+struct AnKiLocalUniforms
|
|
|
{
|
|
|
- Mat3x4 m_ankiTransform;
|
|
|
#if ANIMATED_TEXTURE == 1
|
|
|
F32 m_animationPeriod;
|
|
|
#endif
|
|
|
@@ -18,27 +18,29 @@ struct PerDraw
|
|
|
ANKI_RP Vec4 m_colorBias;
|
|
|
};
|
|
|
|
|
|
-#pragma anki reflect b_ankiPerDraw
|
|
|
-layout(set = 1, binding = 0, row_major, scalar) uniform b_ankiPerDraw
|
|
|
+layout(set = MATERIAL_SET_EXTERNAL, binding = MATERIAL_BINDING_RENDERABLE_GPU_VIEW, row_major, scalar) uniform b_renderableGpuViews
|
|
|
{
|
|
|
- PerDraw u_ankiPerDraw;
|
|
|
+ RenderableGpuView u_renderableGpuViews[1];
|
|
|
};
|
|
|
|
|
|
-#pragma anki reflect b_ankiGlobalUniforms
|
|
|
-layout(set = 1, binding = 1, row_major, scalar) uniform b_ankiGlobalUniforms
|
|
|
+layout(set = MATERIAL_SET_EXTERNAL, binding = MATERIAL_BINDING_LOCAL_UNIFORMS, row_major, scalar) uniform b_localUniforms
|
|
|
+{
|
|
|
+ AnKiLocalUniforms u_localUniforms;
|
|
|
+};
|
|
|
+
|
|
|
+layout(set = MATERIAL_SET_EXTERNAL, binding = MATERIAL_BINDING_GLOBAL_UNIFORMS, row_major, scalar) uniform b_ankiGlobalUniforms
|
|
|
{
|
|
|
MaterialGlobalUniforms u_ankiGlobals;
|
|
|
};
|
|
|
|
|
|
-#pragma anki reflect u_ankiGlobalSampler
|
|
|
-layout(set = 1, binding = 2) uniform sampler u_ankiGlobalSampler;
|
|
|
+layout(set = MATERIAL_SET_EXTERNAL, binding = MATERIAL_BINDING_GLOBAL_SAMPLER) uniform sampler u_ankiGlobalSampler;
|
|
|
#if ANIMATED_TEXTURE == 0
|
|
|
# pragma anki reflect u_diffuseMap
|
|
|
-layout(set = 1, binding = 3) uniform ANKI_RP texture2D u_diffuseMap;
|
|
|
+layout(set = MATERIAL_SET_EXTERNAL, binding = MATERIAL_BINDING_FIRST_NON_STANDARD) uniform ANKI_RP texture2D u_diffuseMap;
|
|
|
#endif
|
|
|
#if ANIMATED_TEXTURE == 1
|
|
|
# pragma anki reflect u_diffuseMapArr
|
|
|
-layout(set = 1, binding = 3) uniform ANKI_RP texture2DArray u_diffuseMapArr;
|
|
|
+layout(set = MATERIAL_SET_EXTERNAL, binding = MATERIAL_BINDING_FIRST_NON_STANDARD) uniform ANKI_RP texture2DArray u_diffuseMapArr;
|
|
|
#endif
|
|
|
|
|
|
#pragma anki start vert
|
|
|
@@ -56,7 +58,7 @@ void main()
|
|
|
|
|
|
out_worldPos = u_ankiGlobals.m_cameraRotationMatrix * Vec3((out_uv - 0.5) * in_scale, 0.0) + in_position;
|
|
|
gl_Position =
|
|
|
- u_ankiGlobals.m_viewProjectionMatrix * Vec4(u_ankiPerDraw.m_ankiTransform * Vec4(out_worldPos, 1.0), 1.0);
|
|
|
+ u_ankiGlobals.m_viewProjectionMatrix * Vec4(u_renderableGpuViews[0].m_worldTransform * Vec4(out_worldPos, 1.0), 1.0);
|
|
|
|
|
|
out_alpha = in_alpha;
|
|
|
}
|
|
|
@@ -71,7 +73,7 @@ layout(location = 2) in Vec3 in_worldPos;
|
|
|
void main()
|
|
|
{
|
|
|
#if ANIMATED_TEXTURE == 1
|
|
|
- ANKI_RP Vec4 texCol = readAnimatedTextureRgba(u_diffuseMapArr, u_ankiGlobalSampler, u_ankiPerDraw.m_animationPeriod,
|
|
|
+ ANKI_RP Vec4 texCol = readAnimatedTextureRgba(u_diffuseMapArr, u_ankiGlobalSampler, u_localUniforms.m_animationPeriod,
|
|
|
in_uv, u_clusteredShading.m_time);
|
|
|
#else
|
|
|
ANKI_RP Vec4 texCol = texture(u_diffuseMap, u_ankiGlobalSampler, in_uv);
|
|
|
@@ -81,8 +83,8 @@ void main()
|
|
|
texCol.rgb = computeLightColorLow(texCol.rgb, in_worldPos);
|
|
|
#endif
|
|
|
|
|
|
- ANKI_RP Vec4 colScale = u_ankiPerDraw.m_colorScale;
|
|
|
+ ANKI_RP Vec4 colScale = u_localUniforms.m_colorScale;
|
|
|
colScale.a *= in_alpha;
|
|
|
- particleAlpha(texCol, colScale, u_ankiPerDraw.m_colorBias);
|
|
|
+ particleAlpha(texCol, colScale, u_localUniforms.m_colorBias);
|
|
|
}
|
|
|
#pragma anki end
|