public Vehicle(string cfmFile) { _model = CarModelCache.GetCfm(cfmFile); _effect = new AlphaTestEffect(Engine.Instance.Device); Direction = Vector3.Forward; Up = Vector3.Up; }
private void Parse(string filename) { string carFile = Path.Combine(GameConfig.CdDataPath, filename); BinaryReader br = new BinaryReader(File.Open(carFile, FileMode.Open)); HeaderChunk rootChunk = new HeaderChunk(); rootChunk.Read(br, true); // Cfm files contain a high-res model + bitmaps at index 0, and a low-res model + bitmaps at index 1. We only use the high-res resources. rootChunk.MeshChunks[0].Load(br); rootChunk.BitmapChunks[0].TextureGenerated += CfmFile_TextureGenerated; rootChunk.BitmapChunks[0].Load(br); br.Close(); Mesh = new CarMesh(rootChunk.MeshChunks[0], rootChunk.BitmapChunks[0], _brakeColor); }