aboutsummaryrefslogtreecommitdiff
path: root/PhysX_3.4/Media/SampleRenderer/4/shaders/include/config.cg
diff options
context:
space:
mode:
authorgit perforce import user <a@b>2016-10-25 12:29:14 -0600
committerSheikh Dawood Abdul Ajees <Sheikh Dawood Abdul Ajees>2016-10-25 18:56:37 -0500
commit3dfe2108cfab31ba3ee5527e217d0d8e99a51162 (patch)
treefa6485c169e50d7415a651bf838f5bcd0fd3bfbd /PhysX_3.4/Media/SampleRenderer/4/shaders/include/config.cg
downloadphysx-3.4-3dfe2108cfab31ba3ee5527e217d0d8e99a51162.tar.xz
physx-3.4-3dfe2108cfab31ba3ee5527e217d0d8e99a51162.zip
Initial commit:
PhysX 3.4.0 Update @ 21294896 APEX 1.4.0 Update @ 21275617 [CL 21300167]
Diffstat (limited to 'PhysX_3.4/Media/SampleRenderer/4/shaders/include/config.cg')
-rw-r--r--PhysX_3.4/Media/SampleRenderer/4/shaders/include/config.cg111
1 files changed, 111 insertions, 0 deletions
diff --git a/PhysX_3.4/Media/SampleRenderer/4/shaders/include/config.cg b/PhysX_3.4/Media/SampleRenderer/4/shaders/include/config.cg
new file mode 100644
index 00000000..51098d19
--- /dev/null
+++ b/PhysX_3.4/Media/SampleRenderer/4/shaders/include/config.cg
@@ -0,0 +1,111 @@
+
+#ifndef CONFIG_H
+#define CONFIG_H
+
+// The VFACE register sign indicates if the face is backfacing or not.
+// The Renderer will define this if its supported...
+#if !defined(ENABLE_VFACE)
+ #define ENABLE_VFACE 0
+#endif
+
+// When true, ENABLE_COLOR_SWIZZLE_SUPPORT provides dynamic
+// color swizzling support from rgb/bgr -> bgr/rgb
+// if g_bSwizzleColor is true
+// This prevents the need for CPU color swizzling on platforms
+// expecting a color format different from that provided
+#if !defined(ENABLE_COLOR_SWIZZLE_SUPPORT)
+ #define ENABLE_COLOR_SWIZZLE_SUPPORT 0
+#endif
+
+// The D3D compiler will #define this as TANGENT!!
+#ifndef SEMANTIC_TANGENT
+#define SEMANTIC_TANGENT TEXCOORD5
+#endif
+
+#define SEMANTIC_INSTANCE_T TEXCOORD8
+#define SEMANTIC_INSTANCE_X TEXCOORD9
+#define SEMANTIC_INSTANCE_Y TEXCOORD10
+#define SEMANTIC_INSTANCE_Z TEXCOORD11
+
+#define SEMANTIC_INSTANCE_UV TEXCOORD12
+#define SEMANTIC_INSTANCE_LOCAL TEXCOORD13
+
+#define SEMANTIC_DISPLACEMENT TEXCOORD14
+#define SEMANTIC_DISPLACEMENT_FLAGS TEXCOORD15
+
+#define SEMANTIC_SPRITE_ROT_SCALEX_SCALEY TEXCOORD14
+
+#define SEMANTIC_BONEINDEX TEXCOORD6
+
+#if !defined(RENDERER_DISPLACED)
+#define RENDERER_DISPLACED 0
+#endif
+#if !defined(ENABLE_TESSELLATION)
+#define ENABLE_TESSELLATION 0
+#endif
+
+// Parameters passed from the vertex shader to the fragment shader.
+struct FragmentParameters
+{
+ float3 worldSpacePosition : TEXCOORD4;
+ float3 worldSpaceNormal : TEXCOORD5;
+ float3 worldSpaceTangent : TEXCOORD6;
+ float3 worldSpaceBinormal : TEXCOORD7;
+#if defined(PX_X360) && defined(RENDERER_FRAGMENT)
+ float2 spriteTexCoord : SPRITETEXCOORD;
+#endif
+#if defined (RENDERER_GXM)
+ float2 spriteTexCoord : SPRITECOORD;
+#endif
+ float4 texcoord0 : TEXCOORD0;
+ float4 texcoord1 : TEXCOORD1;
+ float4 texcoord2 : TEXCOORD2;
+#if !defined (RENDERER_WIN8ARM)
+ float4 texcoord3 : TEXCOORD3;
+#endif
+ half4 color : COLOR;
+};
+
+// Material information for a given fragment.
+struct SurfaceMaterial
+{
+ half3 diffuseColor;
+ half alpha;
+ half3 emissiveColor;
+ half3 specularColor;
+ half specularPower;
+ half3 tangentSpaceNormal;
+};
+
+// Lighting information for a given fragment.
+struct Lighting
+{
+ half3 diffuseColor;
+ half3 specularColor;
+};
+
+// Final output for a Forward Rendered Fragment.
+struct Fragment
+{
+ half4 color : COLOR0;
+};
+
+// Final output for a Deferred Rendered Fragment.
+struct DeferredFragment
+{
+ // TODO: COLOR0 alpha should be the alpha value... not emissiveIntensity.
+ half4 diffuseColor : COLOR0; // rgb=diffuseColor
+ half4 emissiveColor : COLOR1; // rgb=emissiveColor
+ half4 worldSpaceNormalAndSpecularPower : COLOR2; // rgb=worldSpaceNormal, a=specularPower
+};
+
+
+
+// user implemented functions...
+SurfaceMaterial computeSurfaceMaterial(const FragmentParameters params);
+
+// lighting functions...
+Lighting computeLighting(const FragmentParameters params, const SurfaceMaterial material);
+
+
+#endif