From d9e3af17953e43bea618d38394e36098806d28c3 Mon Sep 17 00:00:00 2001 From: "sha..RD" Date: Thu, 18 Apr 2013 03:02:55 +0000 Subject: [PATCH] * Unshaded material now supports HW skinning git-svn-id: https://jmonkeyengine.googlecode.com/svn/trunk@10553 75d07b2b-3a1a-0410-a2c5-0572b91ccdca --- engine/src/core-data/Common/MatDefs/Misc/Unshaded.j3md | 6 ++++++ engine/src/core-data/Common/MatDefs/Misc/Unshaded.vert | 8 +++++++- 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/engine/src/core-data/Common/MatDefs/Misc/Unshaded.j3md b/engine/src/core-data/Common/MatDefs/Misc/Unshaded.j3md index 0637087e9..744bb6e4d 100644 --- a/engine/src/core-data/Common/MatDefs/Misc/Unshaded.j3md +++ b/engine/src/core-data/Common/MatDefs/Misc/Unshaded.j3md @@ -11,6 +11,10 @@ MaterialDef Unshaded { Texture2D GlowMap // The glow color of the object Color GlowColor + + // For hardware skinning + Int NumberOfBones + Matrix4Array BoneMatrices } Technique { @@ -27,6 +31,7 @@ MaterialDef Unshaded { HAS_LIGHTMAP : LightMap HAS_VERTEXCOLOR : VertexColor HAS_COLOR : Color + NUM_BONES : NumberOfBones } } @@ -62,6 +67,7 @@ MaterialDef Unshaded { NEED_TEXCOORD1 HAS_GLOWMAP : GlowMap HAS_GLOWCOLOR : GlowColor + NUM_BONES : NumberOfBones } } } \ No newline at end of file diff --git a/engine/src/core-data/Common/MatDefs/Misc/Unshaded.vert b/engine/src/core-data/Common/MatDefs/Misc/Unshaded.vert index bfc347d63..1d47bb395 100644 --- a/engine/src/core-data/Common/MatDefs/Misc/Unshaded.vert +++ b/engine/src/core-data/Common/MatDefs/Misc/Unshaded.vert @@ -1,3 +1,5 @@ +#import "Common/ShaderLib/Skinning.glsllib" + uniform mat4 g_WorldViewProjectionMatrix; attribute vec3 inPosition; @@ -27,5 +29,9 @@ void main(){ vertColor = inColor; #endif - gl_Position = g_WorldViewProjectionMatrix * vec4(inPosition, 1.0); + vec4 modelSpacePos = vec4(inPosition, 1.0); + #ifdef NUM_BONES + Skinning_Compute(modelSpacePos); + #endif + gl_Position = g_WorldViewProjectionMatrix * modelSpacePos; } \ No newline at end of file