コード例 #1
0
        private SSSkeletalMeshMD5[] readMeshes()
        {
            Match[] matches;
            seekEntry("MD5Version", "10");
            seekEntry("commandline", SSMD5Parser._quotedStrRegex);

            matches = seekEntry("numJoints", SSMD5Parser._uintRegex);
            var joints = new SSSkeletalJoint[Convert.ToUInt32(matches[1].Value)];

            matches = seekEntry("numMeshes", SSMD5Parser._uintRegex);
            var meshes = new SSSkeletalMeshMD5[Convert.ToUInt32(matches [1].Value)];

            seekEntry("joints", "{");
            for (int j = 0; j < joints.Length; ++j)
            {
                joints[j]             = readJoint();
                joints [j].jointIndex = j;
            }
            seekEntry("}");
            transformBindPoseToJointLocal(joints);

            for (int m = 0; m < meshes.Length; ++m)
            {
                seekEntry("mesh", "{");
                meshes [m]        = readMesh(joints);
                meshes [m].joints = joints;
                seekEntry("}");

                meshes [m].assetContext = Context;
            }
            return(meshes);
        }
コード例 #2
0
        private SSSkeletalMeshMD5 readMesh(SSSkeletalJoint[] joints)
        {
            SSSkeletalMeshMD5 newMesh = new SSSkeletalMeshMD5();

            Match[] matches;
            matches = seekEntry("shader", SSMD5Parser._quotedStrRegex);
            newMesh.materialShaderString = matches[1].Value;

            matches = seekEntry("numverts", SSMD5Parser._uintRegex);
            int numVertices = Convert.ToInt32(matches [1].Value);

            newMesh.vertices = new SSSkeletalVertex[numVertices];

            for (int v = 0; v < numVertices; ++v)
            {
                int vertexIndex;
                var vertex = readVertex(out vertexIndex);
                newMesh.vertices [vertexIndex] = vertex;
            }

            matches = seekEntry("numtris", SSMD5Parser._uintRegex);
            int numTris = Convert.ToUInt16(matches [1].Value);

            newMesh.triangleIndices = new UInt16[numTris * 3];
            for (int t = 0; t < numTris; ++t)
            {
                readTriangle(newMesh.triangleIndices);
            }

            matches = seekEntry("numweights", SSMD5Parser._uintRegex);
            int numWeights = Convert.ToInt32(matches [1].Value);

            newMesh.weights = new SSSkeletalWeight[numWeights];
            for (int w = 0; w < numWeights; ++w)
            {
                int weightIdx;
                SSSkeletalWeight weight = readWeight(out weightIdx);
                newMesh.weights [weightIdx] = weight;
            }

            return(newMesh);
        }
コード例 #3
0
        private SSSkeletalMeshMD5 readMesh(SSSkeletalJoint[] joints)
        {
            SSSkeletalMeshMD5 newMesh = new SSSkeletalMeshMD5 ();

            Match[] matches;
            matches = seekEntry("shader", SSMD5Parser._quotedStrRegex);
            newMesh.materialShaderString = matches[1].Value;

            matches = seekEntry ("numverts", SSMD5Parser._uintRegex);
            int numVertices = Convert.ToInt32 (matches [1].Value);
            newMesh.vertices = new SSSkeletalVertex[numVertices];

            for (int v = 0; v < numVertices; ++v) {
                int vertexIndex;
                var vertex = readVertex (out vertexIndex);
                newMesh.vertices [vertexIndex] = vertex;
            }

            matches = seekEntry ("numtris", SSMD5Parser._uintRegex);
            int numTris = Convert.ToUInt16 (matches [1].Value);
            newMesh.triangleIndices = new UInt16[numTris * 3];
            for (int t = 0; t < numTris; ++t) {
                readTriangle (newMesh.triangleIndices);
            }

            matches = seekEntry ("numweights", SSMD5Parser._uintRegex);
            int numWeights = Convert.ToInt32 (matches [1].Value);
            newMesh.weights = new SSSkeletalWeight[numWeights];
            for (int w = 0; w < numWeights; ++w) {
                int weightIdx;
                SSSkeletalWeight weight = readWeight(out weightIdx);
                newMesh.weights [weightIdx] = weight;
            }

            return newMesh;
        }
コード例 #4
0
        private SSSkeletalMeshMD5[] readMeshes()
        {
            Match[] matches;
            seekEntry ("MD5Version", "10");
            seekEntry ("commandline", SSMD5Parser._quotedStrRegex);

            matches = seekEntry ("numJoints", SSMD5Parser._uintRegex);
            var joints = new SSSkeletalJoint[Convert.ToUInt32(matches[1].Value)];

            matches = seekEntry ( "numMeshes", SSMD5Parser._uintRegex);
            var meshes = new SSSkeletalMeshMD5[Convert.ToUInt32 (matches [1].Value)];

            seekEntry ("joints", "{");
            for (int j = 0; j < joints.Length; ++j) {
                joints[j] = readJoint();
                joints [j].jointIndex = j;
            }
            seekEntry ("}");
            transformBindPoseToJointLocal (joints);

            for (int m = 0; m < meshes.Length; ++m) {
                seekEntry ("mesh", "{");
                meshes [m] = readMesh (joints);
                meshes [m].joints = joints;
                seekEntry ("}");

                meshes [m].assetContext = Context;
            }
            return meshes;
        }