Im running this on a win desktop Gl template.
The problem im having appears to be a very strange bug.
I attempted to load a matrix array to the shader
// in the shader
matrix Bones[50];
in game1
Matrix[] allBones = new Matrix[50];
for (int i = 0; i < 50; i++)
allBones[i] = Matrix.Identity;
effect.Parameters["Bones"].SetValue(allBones);
Now if i loop the entire array with a calculation it works fine and as expected the model is just in its identity state.
// ____________________________
VsOutputQuad VertexShaderQuadDraw(VsInputQuad input)
{
VsOutputQuad output;
float4 pos = mul(input.Position, World);
//Case1
// compiles and runs with no problems.
for (int i = 0; i < 50; i++)
pos = mul(pos, Bones[i]);
// case1 ends
float4x4 vp = mul(View, Projection);
output.Position = mul(pos, vp);
output.TexureCoordinateA = input.TexureCoordinateA;
return output;
}
However that isn’t very useful sooo…
Making the modification to use a index is were the big problem comes in.
Replacing case 1 with the following
// Case2
// little alt test
int index = (int) (pos.x);
index = min(index, 0);
index = max(index, 49);
pos = mul(pos, Bones[index]);
the app compiles and runs … but … The model doesn’t show and the mouse and keyboard no longer responds.
however other user primitives draw and the frame rate continue to display.
This appears to be a bug but i would of thought someone would of seen it already?
or
Is this simply not the way its typically done.
I was thinking that for complex models with lots of bones it would be better to just load a really big array of bone matrices and have the vertice bone weight indices point to the index in that way so for a single mesh object i wouldn’t need to split up the mesh into parts and it would be fairly easy to instance it.
Of course that would probably also mean hard coding a set amount of matrices which i really don’t like that idea… but… this problem came up before i could even make up my mind and im wondering what is wrong if its something this code is doing or if this is actually a bug.
Because my alternate route is to use 4 matrices with mesh parts but still what happens when a vertice only has one bone do i have to for loop all the matrices anyways ?