예제 #1
0
        public void Create()
        {
            m = ContentManager.GetModelByName("carro.3DS");
            m.CreateDisplayList(); //optimice the model and load it in opengl display lists

            m.ScaleX = 0.1f;
            m.ScaleY = 0.1f;
            m.ScaleZ = 0.1f;

            foreach (var item in m.GetMeshes)
            {
                item.CalcCenterPoint();// calculate th epivot point
                switch (item.Name)
                {
                case "tireA":
                case "tireB":
                case "tireC":
                case "tire":
                case "rimA":
                case "rimB":
                case "rimC":
                case "rim":
                    tires.Add(item);
                    break;

                case "body":
                    body = item;
                    break;
                }
            }

            if (color == Color.Blue)
            {
                texture = ContentManager.GetTextureByName("bodyBlue.jpg");
            }
            if (color == Color.Red)
            {
                texture = ContentManager.GetTextureByName("bodyRed.jpg");
            }
            if (color == Color.Green)
            {
                texture = ContentManager.GetTextureByName("bodyGreen.jpg");
            }
            if (color == Color.Violet)
            {
                texture = ContentManager.GetTextureByName("bodyViolet.jpg");
                m.RemoveMeshesWithName("body");
                m.RemoveMeshesWithName("tire");
                m.RemoveMeshesWithName("rim");
            }
        }