I've been working on skinned meshes lately, and I've run into a bit of a problem:
While loading a .x file that I exported from Blender, I noticed that one of my SJoint's AttachedMeshes is empty, even though the SJoint has a mesh attached to it and is not a bone.
Calling getMeshBuffers().size() on the ISkinnedMesh revealed that there is a mesh attached to the ISkinnedMesh, it's just not being associated with any SJoint :\
Here's some code that demonstrates the problem:
Code: Select all
std::cout << "starting\n";
IrrlichtDevice *device = createDevice( video::EDT_OPENGL, dimension2d<s32>(640, 480), 16, 0, false, false, 0);
assert(device);
IVideoDriver* videoDriver = device->getVideoDriver();
assert(videoDriver);
ISceneManager* sceneManager = device->getSceneManager();
assert(sceneManager);
IGUIEnvironment* guiEnvironment = device->getGUIEnvironment();
assert(guiEnvironment);
std::cout << "init done\n";
IAnimatedMesh* referenceMesh = sceneManager->getMesh("oricon.x");
assert(referenceMesh);
ISkinnedMesh* skinnedMesh = (ISkinnedMesh*)referenceMesh;
std::cout << "meshBuffer length: " << skinnedMesh->getMeshBuffers().size() << "\n";
std::cout << "joint count: " << skinnedMesh->getJointCount() << "\n";
for(int i=0; i<skinnedMesh->getAllJoints().size(); i++)
{
std::cout << "\nname: " << (skinnedMesh->getAllJoints())[i]->Name.c_str() << "\n";
std::cout << "child children count: " << (skinnedMesh->getAllJoints())[i]->Children.size() << "\n";
std::cout << "child mesh count: " << (skinnedMesh->getAllJoints())[i]->AttachedMeshes.size() << "\n";
}
Code: Select all
xof 0303txt 0032
template VertexDuplicationIndices {
<b8d65549-d7c9-4995-89cf-53a9a8b031e3>
DWORD nIndices;
DWORD nOriginalVertices;
array DWORD indices[nIndices];
}
template XSkinMeshHeader {
<3cf169ce-ff7c-44ab-93c0-f78f62d172e2>
WORD nMaxSkinWeightsPerVertex;
WORD nMaxSkinWeightsPerFace;
WORD nBones;
}
template SkinWeights {
<6f0d123b-bad2-4167-a0d0-80224f25fabb>
STRING transformNodeName;
DWORD nWeights;
array DWORD vertexIndices[nWeights];
array float weights[nWeights];
Matrix4x4 matrixOffset;
}
Frame RootFrame {
FrameTransformMatrix {
1.000000,0.000000,0.000000,0.000000,
0.000000,-0.000000,1.000000,0.000000,
0.000000,1.000000,0.000000,0.000000,
0.000000,0.000000,0.000000,1.000000;;
}
Frame cameraFPSBone {
FrameTransformMatrix {
-1.000000,0.000000,0.000000,0.000000,
0.000000,0.000000,1.000000,0.000000,
0.000000,1.000000,-0.000000,0.000000,
0.000000,1.000000,0.000000,1.000000;;
}
}
Frame cameraFPS {
FrameTransformMatrix {
0.300000,0.000000,0.000000,0.000000,
0.000000,0.300000,0.000000,0.000000,
0.000000,0.000000,0.300000,0.000000,
-0.005500,-1.943100,-0.072000,1.000000;;
}
Mesh {
24;
0.294500; -1.643100; -0.372000;,
0.294500; -2.243100; -0.372000;,
-0.305500; -2.243100; -0.372000;,
-0.305500; -1.643100; -0.372000;,
0.294500; -1.643100; 0.228000;,
-0.305500; -1.643100; 0.228000;,
-0.305500; -2.243100; 0.228000;,
0.294500; -2.243100; 0.228000;,
0.294500; -1.643100; -0.372000;,
0.294500; -1.643100; 0.228000;,
0.294500; -2.243100; 0.228000;,
0.294500; -2.243100; -0.372000;,
0.294500; -2.243100; -0.372000;,
0.294500; -2.243100; 0.228000;,
-0.305500; -2.243100; 0.228000;,
-0.305500; -2.243100; -0.372000;,
-0.305500; -2.243100; -0.372000;,
-0.305500; -2.243100; 0.228000;,
-0.305500; -1.643100; 0.228000;,
-0.305500; -1.643100; -0.372000;,
0.294500; -1.643100; 0.228000;,
0.294500; -1.643100; -0.372000;,
-0.305500; -1.643100; -0.372000;,
-0.305500; -1.643100; 0.228000;;
6;
4; 0, 3, 2, 1;,
4; 4, 7, 6, 5;,
4; 8, 11, 10, 9;,
4; 12, 15, 14, 13;,
4; 16, 19, 18, 17;,
4; 20, 23, 22, 21;;
MeshMaterialList {
0;
6;
0,
0,
0,
0,
0,
0;;
} //End of MeshMaterialList
MeshNormals {
24;
0.577349; 0.577349; -0.577349;,
0.577349; -0.577349; -0.577349;,
-0.577349; -0.577349; -0.577349;,
-0.577349; 0.577349; -0.577349;,
0.577349; 0.577349; 0.577349;,
-0.577349; 0.577349; 0.577349;,
-0.577349; -0.577349; 0.577349;,
0.577349; -0.577349; 0.577349;,
0.577349; 0.577349; -0.577349;,
0.577349; 0.577349; 0.577349;,
0.577349; -0.577349; 0.577349;,
0.577349; -0.577349; -0.577349;,
0.577349; -0.577349; -0.577349;,
0.577349; -0.577349; 0.577349;,
-0.577349; -0.577349; 0.577349;,
-0.577349; -0.577349; -0.577349;,
-0.577349; -0.577349; -0.577349;,
-0.577349; -0.577349; 0.577349;,
-0.577349; 0.577349; 0.577349;,
-0.577349; 0.577349; -0.577349;,
0.577349; 0.577349; 0.577349;,
0.577349; 0.577349; -0.577349;,
-0.577349; 0.577349; -0.577349;,
-0.577349; 0.577349; 0.577349;;
6;
4; 0, 3, 2, 1;,
4; 4, 7, 6, 5;,
4; 8, 11, 10, 9;,
4; 12, 15, 14, 13;,
4; 16, 19, 18, 17;,
4; 20, 23, 22, 21;;
} //End of MeshNormals
XSkinMeshHeader {
1;
3;
1;
}
SkinWeights {
"cameraFPSBone";
24;
0,
8,
21,
1,
11,
12,
2,
15,
16,
3,
19,
22,
4,
9,
20,
7,
10,
13,
6,
14,
17,
5,
18,
23;
1.000000,
1.000000,
1.000000,
1.000000,
1.000000,
1.000000,
1.000000,
1.000000,
1.000000,
1.000000,
1.000000,
1.000000,
1.000000,
1.000000,
1.000000,
1.000000,
1.000000,
1.000000,
1.000000,
1.000000,
1.000000,
1.000000,
1.000000,
1.000000;
-1.000000,0.000000,0.000000,0.000000,
0.000000,-1.000000,0.000000,0.000000,
0.000000,0.000000,1.000000,0.000000,
-0.000000,0.000000,-0.000000,1.000000;;
}
} // End of XSkinMeshHeader
} // End of the Object cameraFPS
} // End of the Root Frame
Removing the SkinWeights { ... } part of the file fixes the problem: the cameraFPS SJoint now has an AttachedMesh
I'll look into this and see if I can create a patch, or if someone else could, that would be cool
*EDIT*
I guess I should've mentioned that I'm using the Irrlicht trunk....sorry XD
Thanks,
-wyrmmage