public EscenaControles(TgcCamera Camera, string MediaDir, string ShadersDir, TgcText2D DrawText, float TimeBetweenUpdates, TgcD3dInput Input) : base(Camera, MediaDir, ShadersDir, DrawText, TimeBetweenUpdates, Input) { TgcScene escena = new TgcSceneLoader().loadSceneFromFile(MediaDir + "Cancha-TgcScene.xml"); pasto = new Pasto(escena.Meshes[0], TGCShaders.Instance.LoadEffect(ShadersDir + "CustomShaders.fx"), 32, .5f); paredes = escena.getMeshByName("Box_5"); Camera.SetCamera(new TGCVector3(20, 10, -20), new TGCVector3(0, 5, -7)); skyBox = new TgcSkyBox(); skyBox.Center = new TGCVector3(0, 500, 0); skyBox.Size = new TGCVector3(10000, 10000, 10000); var texturesPath = MediaDir + "Textures\\SkyBox LostAtSeaDay\\"; skyBox.setFaceTexture(TgcSkyBox.SkyFaces.Up, texturesPath + "lostatseaday_up.jpg"); skyBox.setFaceTexture(TgcSkyBox.SkyFaces.Down, texturesPath + "lostatseaday_dn.jpg"); skyBox.setFaceTexture(TgcSkyBox.SkyFaces.Left, texturesPath + "lostatseaday_lf.jpg"); skyBox.setFaceTexture(TgcSkyBox.SkyFaces.Right, texturesPath + "lostatseaday_rt.jpg"); skyBox.setFaceTexture(TgcSkyBox.SkyFaces.Front, texturesPath + "lostatseaday_bk.jpg"); skyBox.setFaceTexture(TgcSkyBox.SkyFaces.Back, texturesPath + "lostatseaday_ft.jpg"); skyBox.Init(); unSprite = new CustomSprite(); unSprite.Bitmap = new CustomBitmap(MediaDir + "Textures\\Controles2.png", D3DDevice.Instance.Device); //unSprite.Scaling = new TGCVector2(unSprite.Bitmap.Width, unSprite.Bitmap.Height); unSprite.Position = new TGCVector2((float)D3DDevice.Instance.Width / 2 - unSprite.Bitmap.Width / 2, (float)D3DDevice.Instance.Height / 2 - unSprite.Bitmap.Height / 2); }
private void initMeshes() { //Crear SkyBox skyBox = new TgcSkyBox(); skyBox.Center = new TGCVector3(0, 500, 0); skyBox.Size = new TGCVector3(10000, 10000, 10000); var texturesPath = MediaDir + "Textures\\SkyBox LostAtSea" + (dia ? "Day\\" : "Night\\"); skyBox.setFaceTexture(TgcSkyBox.SkyFaces.Up, texturesPath + "lostatseaday_up.jpg"); skyBox.setFaceTexture(TgcSkyBox.SkyFaces.Down, texturesPath + "lostatseaday_dn.jpg"); skyBox.setFaceTexture(TgcSkyBox.SkyFaces.Left, texturesPath + "lostatseaday_lf.jpg"); skyBox.setFaceTexture(TgcSkyBox.SkyFaces.Right, texturesPath + "lostatseaday_rt.jpg"); skyBox.setFaceTexture(TgcSkyBox.SkyFaces.Front, texturesPath + "lostatseaday_bk.jpg"); skyBox.setFaceTexture(TgcSkyBox.SkyFaces.Back, texturesPath + "lostatseaday_ft.jpg"); skyBox.Init(); Microsoft.DirectX.Direct3D.Effect customShaders = TGCShaders.Instance.LoadEffect(ShadersDir + "CustomShaders.fx"); //cargar escena escena = new TgcSceneLoader().loadSceneFromFile(MediaDir + "Cancha-TgcScene.xml"); pasto = new Pasto(escena.Meshes[0], customShaders.Clone(D3DDevice.Instance.Device), 20, .5f); TgcMesh meshTurbo = escena.getMeshByName("Turbo"); turbos = new List <Turbo>() { new Turbo(meshTurbo, new TGCVector3(80, -.2f, 100)), new Turbo(meshTurbo, new TGCVector3(-80, -.2f, -100)), new Turbo(meshTurbo, new TGCVector3(80, -.2f, -100)), new Turbo(meshTurbo, new TGCVector3(-80, -.2f, 100)), new Turbo(meshTurbo, new TGCVector3(0, -.2f, 130)), new Turbo(meshTurbo, new TGCVector3(0, -.2f, -130)), new Turbo(meshTurbo, new TGCVector3(0, -.2f, 250)), new Turbo(meshTurbo, new TGCVector3(0, -.2f, -250)), new Turbo(meshTurbo, new TGCVector3(220, -.2f, 0), 100), new Turbo(meshTurbo, new TGCVector3(-220, -.2f, 0), 100), new Turbo(meshTurbo, new TGCVector3(220, -.2f, 300), 100), new Turbo(meshTurbo, new TGCVector3(-220, -.2f, -300), 100), new Turbo(meshTurbo, new TGCVector3(-220, -.2f, 300), 100), new Turbo(meshTurbo, new TGCVector3(220, -.2f, -300), 100) }; foreach (TgcMesh mesh in escena.Meshes) { mesh.Effect = customShaders.Clone(D3DDevice.Instance.Device); mesh.Technique = "BlinnPhong"; } }