예제 #1
0
        public ModelMD5(Game game, MD5Mesh meshFile)
        {
            ResourceContentManager rm = new ResourceContentManager(game.Services, XNAQ3Lib.MD5.Resources.MD5Resources.ResourceManager);

            mesh                = meshFile;
            graphicsDevice      = game.GraphicsDevice;
            animationController = new MD5AnimationController(mesh.Hierarchy);
            UseMaximumBounds    = true;

            modelEffect       = rm.Load <Effect>("SkinnedModelEffect");
            boundingBoxEffect = rm.Load <Effect>("BoundingBoxEffect");

            vertices = new MD5VertexFormat[mesh.Submeshes.Length][];
            indices  = new short[mesh.Submeshes.Length][];
            MD5Logger logger = new MD5Logger(game.Content.RootDirectory + "\\" + meshFile.Filename + ".txt");

            for (int i = 0; i < mesh.Submeshes.Length; i++)
            {
                vertices[i] = new MD5VertexFormat[mesh.Submeshes[i].Vertices.Length];
                if (System.IO.File.Exists(game.Content.RootDirectory + @"\" + mesh.Submeshes[i].Shader + ".xnb"))
                {
                    mesh.Submeshes[i].Texture = game.Content.Load <Texture2D>(mesh.Submeshes[i].Shader);
                }
                else
                {
                    logger.WriteLine("Missing texture: " + mesh.Submeshes[i].Shader);
                }
            }

            SetIndices();
            SetVertices();

            SetBoundingBoxVerticesAndIndices(graphicsDevice);
        }
예제 #2
0
 public MD5AnimationTrack(int position, MD5AnimationController parent, MD5Animation animation, MD5AnimationRepeatSetting looping, int bias)
 {
     this.trackPosition = position;
     this.parent        = parent;
     this.animation     = animation;
     this.looping       = looping;
     this.bias          = bias;
 }