-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
cfb2f31
commit 2dac578
Showing
6 changed files
with
110 additions
and
89 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
SamplerState rBaseTexture: register(s0); | ||
float4 rBaseColor; | ||
|
||
struct PS_INPUT { | ||
float2 texcoord: TEXCOORD0; | ||
float4 color: COLOR0; | ||
}; | ||
|
||
struct PS_OUTPUT { | ||
float4 color: COLOR0; | ||
}; | ||
|
||
PS_OUTPUT main(PS_INPUT input) { | ||
PS_OUTPUT output; | ||
|
||
float4 albedo = tex2D(rBaseTexture, input.texcoord); | ||
|
||
output.color = albedo * input.color * rBaseColor; | ||
|
||
return output; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
float4x4 rMatrixW, rMatrixWVP; | ||
float4x4 rJointMatrix[32]; | ||
bool rSkinEnabled; | ||
|
||
struct VS_INPUT { | ||
float3 normal: NORMAL; | ||
float3 tangent: TANGENT0; | ||
float4 position: POSITION0; | ||
float2 texcoord: TEXCOORD0; | ||
int4 joints: BLENDINDICES0; | ||
float4 weights: BLENDWEIGHT0; | ||
}; | ||
|
||
struct VS_OUTPUT { | ||
float4 position: POSITION0; | ||
float2 texcoord: TEXCOORD0; | ||
//float4 light_col_front: COLOR0; | ||
//float4 light_col_back: COLOR1; | ||
}; | ||
|
||
VS_OUTPUT main(VS_INPUT input) { | ||
VS_OUTPUT output; | ||
|
||
if (rSkinEnabled) { | ||
float4x4 skin_mtx = | ||
rJointMatrix[input.joints.x] * input.weights.x + | ||
rJointMatrix[input.joints.y] * input.weights.y + | ||
rJointMatrix[input.joints.z] * input.weights.z + | ||
rJointMatrix[input.joints.w] * input.weights.w; | ||
input.position = mul(skin_mtx, input.position); | ||
input.normal = mul(skin_mtx, float4(input.normal, 0)).xyz; | ||
} | ||
|
||
output.position = mul(rMatrixWVP, input.position); | ||
output.texcoord = input.texcoord; | ||
|
||
return output; | ||
} |