aboutsummaryrefslogtreecommitdiff
path: root/NvCloth/samples/resources/shaders/physx_primitive.hlsl
diff options
context:
space:
mode:
authormtamis <[email protected]>2017-02-28 18:24:59 +0100
committermtamis <[email protected]>2017-02-28 18:24:59 +0100
commit5581909a4d19db97304449f66404ff99a0429d3f (patch)
treea90f7eb85c095a8aba45cf5e909c82c1cdbed77d /NvCloth/samples/resources/shaders/physx_primitive.hlsl
parentFix cmake visual studio project generation (locate_gw_root.bat) (diff)
downloadnvcloth-5581909a4d19db97304449f66404ff99a0429d3f.tar.xz
nvcloth-5581909a4d19db97304449f66404ff99a0429d3f.zip
Add visual samples.
Diffstat (limited to 'NvCloth/samples/resources/shaders/physx_primitive.hlsl')
-rw-r--r--NvCloth/samples/resources/shaders/physx_primitive.hlsl37
1 files changed, 37 insertions, 0 deletions
diff --git a/NvCloth/samples/resources/shaders/physx_primitive.hlsl b/NvCloth/samples/resources/shaders/physx_primitive.hlsl
new file mode 100644
index 0000000..03fd137
--- /dev/null
+++ b/NvCloth/samples/resources/shaders/physx_primitive.hlsl
@@ -0,0 +1,37 @@
+#include "common_buffers.hlsl"
+#include "lighting.hlsl"
+
+struct VS_INPUT
+{
+ float3 position : POSITION0;
+ float3 normal : NORMAL0;
+};
+
+struct VS_OUTPUT
+{
+ float4 position : SV_POSITION;
+ float4 worldPos : POSITION0;
+ float3 normal : NORMAL0;
+};
+
+VS_OUTPUT VS(VS_INPUT iV)
+{
+ VS_OUTPUT oV;
+
+ float4 worldSpacePos = mul(float4(iV.position, 1.0f), model);
+ oV.position = mul(worldSpacePos, viewProjection);
+
+ oV.worldPos = worldSpacePos;
+
+ // normals
+ float3 worldNormal = mul(iV.normal, (float3x3)model);
+ oV.normal = worldNormal;
+
+ return oV;
+}
+
+float4 PS(VS_OUTPUT iV) : SV_Target0
+{
+ float3 lightColor = CalcPixelLight(defaultColor.xyz, iV.worldPos.xyz, iV.normal);
+ return float4(lightColor, 1);
+} \ No newline at end of file