Original Post
I'm using VB.NET and DirectX9 to animate a mesh. The following code is the Draw function:
As you can see there are multiple world matrices that are passed in different indexes in device. The thing is that I use an HLSL effect file to render the mesh and I don't know how to pass and use multiple world matrices in my effect. I want to replace the commented line:
with a line that passes those world matrices in my effect and then some HLSL code to use those world matrices in my vertex shader.
Any help will be appreciated.
p = FX.Begin(Direct3D.FX.None)
For k = 0 To p - 1
FX.BeginPass(k)
For iattrib As Integer = 0 To mesh.NumberAttributes - 1
Dim boneCombo As BoneCombination = mesh.BoneTable(iattrib)
For i As Integer = 0 To mesh.NumberInfluences - 1
Dim matrixIndex As Integer = boneCombo.BoneId(i)
If matrixIndex <> -1 Then
Dim tempMatrix As Matrix = offsetMatrices(matrixIndex) * frameMatrices(matrixIndex).Combined
'DXDEV.Transform.SetWorldMatrixByIndex(i, tempMatrix)
'''''''''''''''''''''
End If
Next
DXDEV.RenderState.VertexBlend = DirectCast(boneCombo.BoneId.Length, VertexBlend) - 1
mesh.MeshData.Mesh.DrawSubset(iattrib)
Next
FX.EndPass()
Next k
FX.End()
As you can see there are multiple world matrices that are passed in different indexes in device. The thing is that I use an HLSL effect file to render the mesh and I don't know how to pass and use multiple world matrices in my effect. I want to replace the commented line:
DXDEV.Transform.SetWorldMatrixByIndex(i, tempMatrix)
with a line that passes those world matrices in my effect and then some HLSL code to use those world matrices in my vertex shader.
Any help will be appreciated.