Example #1
0
        public override void ResetToDefaultParameters()
        {
            Magic   = new GrimFourCC("MDL1");
            Version = 2;
            Nodes.Clear();

            // Add RootNode
            Nodes.Add(new GrimModelNode("RootNode", GrimMat4x3.IdentityMatrix(), -1, -1, null));
        }
Example #2
0
 public override void ResetToDefaultParameters()
 {
     Magic           = new GrimFourCC("ANIM");
     Version         = 1;
     AnimationName   = "";
     FramesPerSecond = 30;
     NumFrames       = 0;
     Items           = null;
 }
Example #3
0
 public GrimAnimation(String name, Single fps, Int32 numFrames, GrimAnimationItem[] items)
 {
     Magic           = new GrimFourCC("ANIM");
     Version         = 1;
     AnimationName   = name;
     FramesPerSecond = fps;
     NumFrames       = numFrames;
     Items           = items;
 }
Example #4
0
        protected override void DoRead(System.IO.BinaryReader reader)
        {
            Magic       = new GrimFourCC(reader);
            Version     = reader.ReadInt32();
            NumVertices = reader.ReadInt32();

            if (!Magic.Value.Equals("MESH"))
            {
                throw new Exception("GrimModelMeshData: Invalid FourCC");
            }

            if (NumVertices > 0)
            {
                for (int i = 0; i < VertexArrays.Length; i++)
                {
                    VertexArrays[i] = new GrimModelVertexArray(this, reader);
                }
            }

            int NumIndices = reader.ReadInt32();

            Indices = new UInt32[NumIndices];

            for (int i = 0; i < NumIndices; i++)
            {
                Indices[i] = reader.ReadUInt32();
            }

            int NumSegments = reader.ReadInt32();

            Segments = new GrimModelMeshSegment[NumSegments];

            for (int i = 0; i < NumSegments; i++)
            {
                GrimModelMeshSegment segment = new GrimModelMeshSegment(reader);

                if ((segment.TriCount * 3) > NumIndices)
                {
                    Logger.Instance.Warning("GrimModelMeshData: Too many triangles in this segment, capping to the number of triangles in the mesh.");
                    segment.TriCount = (NumIndices - segment.FirstIndex) / 3;
                }

                Segments[i] = segment;
            }

            BoundCenter = new GrimVec3(reader);
            BoundRadius = reader.ReadSingle();
            BoundMin    = new GrimVec3(reader);
            BoundMax    = new GrimVec3(reader);
        }
Example #5
0
        public override void ResetToDefaultParameters()
        {
            Magic        = new GrimFourCC("MESH");
            Version      = 2;
            NumVertices  = 0;
            VertexArrays = new GrimModelVertexArray[15];
            Indices      = null;
            Segments     = null;
            BoundCenter  = new GrimVec3();
            BoundRadius  = 0.0f;
            BoundMin     = new GrimVec3();
            BoundMax     = new GrimVec3();

            for (int i = 0; i < VertexArrays.Length; i++)
            {
                VertexArrays[i] = new GrimModelVertexArray(this);
            }
        }
Example #6
0
        protected override void DoRead(System.IO.BinaryReader reader)
        {
            Magic = new GrimFourCC(reader);

            if (!Magic.Value.Equals("MDL1"))
            {
                throw new Exception("Invalid FourCC. Expected MDL1");
            }

            Version = reader.ReadInt32();
            int NumNodes = reader.ReadInt32();

            Nodes.Clear();

            for (int i = 0; i < NumNodes; i++)
            {
                Nodes.Add(new GrimModelNode(reader));
            }
        }
Example #7
0
        protected override void DoRead(System.IO.BinaryReader reader)
        {
            Magic           = new GrimFourCC(reader);
            Version         = reader.ReadInt32();
            AnimationName   = ReadString(reader);
            FramesPerSecond = reader.ReadSingle();
            NumFrames       = reader.ReadInt32();

            Int32 NumItems = reader.ReadInt32();

            if (NumItems > 0)
            {
                Items = new GrimAnimationItem[NumItems];

                for (int i = 0; i < NumItems; i++)
                {
                    Items[i] = new GrimAnimationItem(reader);
                }
            }
        }