Ejemplo n.º 1
0
        protected static void AddNode(Scene scene, Node node, DataStructures.Models.Model model, DataStructures.Models.Texture tex, Matrix4x4 parentMatrix)
        {
            Matrix4x4 selfMatrix = node.Transform * parentMatrix;

            foreach (var meshIndex in node.MeshIndices)
            {
                DataStructures.Models.Mesh sledgeMesh = AddMesh(model, scene.Meshes[meshIndex], selfMatrix);
                foreach (var v in sledgeMesh.Vertices)
                {
                    v.TextureU *= tex.Width;
                    v.TextureV *= tex.Height;
                }
                model.AddMesh("mesh", 0, sledgeMesh);
            }

            foreach (var subNode in node.Children)
            {
                AddNode(scene, subNode, model, tex, selfMatrix);
            }
        }