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); }
public override void Init() { skyBox = new TgcSkyBox(); skyBox.Center = TGCVector3.Empty; skyBox.Size = new TGCVector3(10000, 10000, 10000); //especifico donde estan las texturas cargadas var rutaTextura = MediaDir + "Superficie\\"; //coloco cada textura en cada cara del cubo del skyBox skyBox.setFaceTexture(TgcSkyBox.SkyFaces.Up, rutaTextura + "bluecloud_up.jpg"); skyBox.setFaceTexture(TgcSkyBox.SkyFaces.Down, rutaTextura + "bluecloud_dn.jpg"); skyBox.setFaceTexture(TgcSkyBox.SkyFaces.Left, rutaTextura + "bluecloud_lf.jpg"); skyBox.setFaceTexture(TgcSkyBox.SkyFaces.Right, rutaTextura + "bluecloud_rt.jpg"); skyBox.setFaceTexture(TgcSkyBox.SkyFaces.Front, rutaTextura + "bluecloud_bk.jpg"); skyBox.setFaceTexture(TgcSkyBox.SkyFaces.Back, rutaTextura + "bluecloud_ft.jpg"); skyBox.SkyEpsilon = 25f; skyBox.Init(); D3DDevice.Instance.Device.Transform.Projection = TGCMatrix.PerspectiveFovLH(D3DDevice.Instance.FieldOfView, D3DDevice.Instance.AspectRatio, D3DDevice.Instance.ZNearPlaneDistance, D3DDevice.Instance.ZFarPlaneDistance * 2f).ToMatrix(); }
/// <summary> /// Genera el skymap y lo configura /// </summary> private void CreateSkyBox() { //Crear SkyBox SkyBox = new TgcSkyBox(); SkyBox.Center = new Vector3(0, 0, 0); int SkyBoxLength = 0; if (MapLength > 7000) { SkyBoxLength = 7000; } else { SkyBoxLength = MapLength; } SkyBox.Size = new Vector3(SkyBoxLength, SkyBoxLength, SkyBoxLength); var texturesPath = MediaDir + "Textures\\SkyBox\\"; String imgNameRoot = "clouds"; String imgExtension = "png"; //Configurar las texturas para cada una de las 6 caras SkyBox.setFaceTexture(TgcSkyBox.SkyFaces.Up, texturesPath + imgNameRoot + "_up." + imgExtension); SkyBox.setFaceTexture(TgcSkyBox.SkyFaces.Down, texturesPath + imgNameRoot + "_dn." + imgExtension); SkyBox.setFaceTexture(TgcSkyBox.SkyFaces.Left, texturesPath + imgNameRoot + "_lf." + imgExtension); SkyBox.setFaceTexture(TgcSkyBox.SkyFaces.Right, texturesPath + imgNameRoot + "_rt." + imgExtension); //Hay veces es necesario invertir las texturas Front y Back si se pasa de un sistema RightHanded a uno LeftHanded SkyBox.setFaceTexture(TgcSkyBox.SkyFaces.Front, texturesPath + imgNameRoot + "_bk." + imgExtension); SkyBox.setFaceTexture(TgcSkyBox.SkyFaces.Back, texturesPath + imgNameRoot + "_ft." + imgExtension); SkyBox.SkyEpsilon = 25f; //Inicializa todos los valores para crear el SkyBox SkyBox.Init(); }
private void LoadSkybox() { skyBox = new TgcSkyBox(); skyBox.Center = TGCVector3.Up * (skyBoxDimensions.Y / 11f); skyBox.Size = new TGCVector3(skyBoxDimensions); skyBox.setFaceTexture(TgcSkyBox.SkyFaces.Up, MediaDir + "Skybox\\up.jpg"); skyBox.setFaceTexture(TgcSkyBox.SkyFaces.Down, MediaDir + "Skybox\\down.jpg"); skyBox.setFaceTexture(TgcSkyBox.SkyFaces.Left, MediaDir + "Skybox\\left.jpg"); skyBox.setFaceTexture(TgcSkyBox.SkyFaces.Right, MediaDir + "Skybox\\right.jpg"); skyBox.setFaceTexture(TgcSkyBox.SkyFaces.Front, MediaDir + "Skybox\\front.jpg"); skyBox.setFaceTexture(TgcSkyBox.SkyFaces.Back, MediaDir + "Skybox\\back.jpg"); skyBox.Init(); var effect = TGCShaders.Instance.LoadEffect(ShadersDir + "SkyboxShader.fx"); effect.SetValue("ColorFog", fog.Color.ToArgb()); effect.SetValue("WaterLevel", waterY); foreach (var face in skyBox.Faces) { face.Effect = effect; face.Technique = "Default"; } skyBox.AlphaBlendEnable = true; }
/// <summary> /// Se llama una sola vez, al principio cuando se ejecuta el ejemplo. /// Escribir aquí todo el código de inicialización: cargar modelos, texturas, estructuras de optimización, todo /// procesamiento que podemos pre calcular para nuestro juego. /// Borrar el codigo ejemplo no utilizado. /// </summary> public override void Init() { //Crear SkyBox skyBox = new TgcSkyBox(); skyBox.Center = TGCVector3.Empty; skyBox.Size = new TGCVector3(20000, 5000, 20000); //Configurar las texturas para cada una de las 6 caras skyBox.setFaceTexture(TgcSkyBox.SkyFaces.Up, MediaDir + "\\SkyBox\\SkyBox1\\lun4_up.jpg"); skyBox.setFaceTexture(TgcSkyBox.SkyFaces.Down, MediaDir + "\\SkyBox\\SkyBox1\\lun4_dn.jpg"); skyBox.setFaceTexture(TgcSkyBox.SkyFaces.Left, MediaDir + "\\SkyBox\\SkyBox1\\lun4_lf.jpg"); skyBox.setFaceTexture(TgcSkyBox.SkyFaces.Right, MediaDir + "\\SkyBox\\SkyBox1\\lun4_rt.jpg"); //Hay veces es necesario invertir las texturas Front y Back si se pasa de un sistema RightHanded a uno LeftHanded skyBox.setFaceTexture(TgcSkyBox.SkyFaces.Front, MediaDir + "\\SkyBox\\SkyBox1\\lun4_ft.jpg"); skyBox.setFaceTexture(TgcSkyBox.SkyFaces.Back, MediaDir + "\\SkyBox\\SkyBox1\\lun4_bk.jpg"); skyBox.SkyEpsilon = 25f; //Inicializa todos los valores para crear el SkyBox skyBox.Init(); tgcPersonaje.Init(this); escenario1.Init(this); camaraInterna = new CamaraEnTerceraPersona(tgcPersonaje.getPosicion(), 35, -100); Camara = camaraInterna; }
public override void Init() { //Crear SkyBox skyBox = new TgcSkyBox(); skyBox.Center = new TGCVector3(0, 500, 0); skyBox.Size = new TGCVector3(10000, 10000, 10000); var texturesPath = MediaDir + "Texturas\\Quake\\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(); //Cargar escenario de Isla var loader = new TgcSceneLoader(); var scene = loader.loadSceneFromFile(MediaDir + "Isla\\Isla-TgcScene.xml"); //Separar el Terreno del resto de los objetos var list1 = new List<TgcMesh>(); scene.separeteMeshList(new[] { "Terreno" }, out list1, out objetosIsla); terreno = list1[0]; //Crear grilla grilla = new GrillaRegular(); grilla.create(objetosIsla, scene.BoundingBox); grilla.createDebugMeshes(); //Camara en 1ra persona Camara = new TgcFpsCamera(new TGCVector3(1500, 800, 0), Input); showGridModifier = AddBoolean("showGrid", "Show Grid", false); showTerrainModifier = AddBoolean("showTerrain", "Show Terrain", true); }
private void initSky() { //aumentar render distance D3DDevice.Instance.Device.Transform.Projection = TGCMatrix.PerspectiveFovLH(D3DDevice.Instance.FieldOfView, D3DDevice.Instance.AspectRatio, D3DDevice.Instance.ZNearPlaneDistance, D3DDevice.Instance.ZFarPlaneDistance * 1000f).ToMatrix(); sky = new TgcSkyBox(); sky.Center = TGCVector3.Empty; sky.Size = new TGCVector3(800000, 800000, 800000); //sky.Color = Color.OrangeRed; var texturesPath = g.game.MediaDir + "SkyBox\\"; sky.setFaceTexture(TgcSkyBox.SkyFaces.Up, texturesPath + "lun4_up.jpg"); sky.setFaceTexture(TgcSkyBox.SkyFaces.Down, texturesPath + "lun4_dn.jpg"); sky.setFaceTexture(TgcSkyBox.SkyFaces.Left, texturesPath + "lun4_lf2.jpg"); sky.setFaceTexture(TgcSkyBox.SkyFaces.Right, texturesPath + "lun4_rt2.jpg"); sky.setFaceTexture(TgcSkyBox.SkyFaces.Front, texturesPath + "lun4_bk2.jpg"); sky.setFaceTexture(TgcSkyBox.SkyFaces.Back, texturesPath + "lun4_ft2.jpg"); sky.SkyEpsilon = 25f; sky.Init(); }
public override void Init() { //Crear SkyBox skyBox = new TgcSkyBox(); skyBox.Center = TGCVector3.Empty; skyBox.Size = new TGCVector3(10000, 10000, 10000); //Configurar color //skyBox.Color = Color.OrangeRed; var texturesPath = MediaDir + "Texturas\\Quake\\SkyBox1\\"; //Configurar las texturas para cada una de las 6 caras skyBox.setFaceTexture(TgcSkyBox.SkyFaces.Up, texturesPath + "phobos_up.jpg"); skyBox.setFaceTexture(TgcSkyBox.SkyFaces.Down, texturesPath + "phobos_dn.jpg"); skyBox.setFaceTexture(TgcSkyBox.SkyFaces.Left, texturesPath + "phobos_lf.jpg"); skyBox.setFaceTexture(TgcSkyBox.SkyFaces.Right, texturesPath + "phobos_rt.jpg"); //Hay veces es necesario invertir las texturas Front y Back si se pasa de un sistema RightHanded a uno LeftHanded skyBox.setFaceTexture(TgcSkyBox.SkyFaces.Front, texturesPath + "phobos_bk.jpg"); skyBox.setFaceTexture(TgcSkyBox.SkyFaces.Back, texturesPath + "phobos_ft.jpg"); skyBox.SkyEpsilon = 25f; //Inicializa todos los valores para crear el SkyBox skyBox.Init(); //Modifier para mover el skybox con la posicion de la caja con traslaciones. moveWithCameraModifier = AddBoolean("moveWithCamera", "Move With Camera", false); Camara = new TgcFpsCamera(Input); }
public override void Init() { Tiempo = 0; D3dDevice = D3DDevice.Instance.Device; Plaza = new TgcSceneLoader().loadSceneFromFile(MediaDir + "Plaza-TgcScene.xml"); MayasIA = new TgcSceneLoader().loadSceneFromFile(MediaDir + "AutoPolicia-TgcScene.xml").Meshes; MayasAutoFisico1 = new TgcSceneLoader().loadSceneFromFile(MediaDir + "AutoAmarillo-TgcScene.xml").Meshes; MayasAutoFisico2 = new TgcSceneLoader().loadSceneFromFile(MediaDir + "AutoNaranja-TgcScene.xml").Meshes; PathHumo = MediaDir + "Textures\\TexturaHumo.png"; Sonidos = new Sonidos(MediaDir, DirectSound.DsDevice); Invisible = new ShaderInvisibilidad(D3dDevice, ShadersDir); EnvMap = new ShaderEnvMap(ShadersDir); //Cielo Cielo = new TgcSkyBox { Center = TGCVector3.Empty, Size = new TGCVector3(10000, 10000, 10000) }; var cieloPath = MediaDir + "Cielo\\"; Cielo.setFaceTexture(TgcSkyBox.SkyFaces.Up, cieloPath + "cloudtop_up.jpg"); Cielo.setFaceTexture(TgcSkyBox.SkyFaces.Down, cieloPath + "cloudtop_down.jpg"); Cielo.setFaceTexture(TgcSkyBox.SkyFaces.Left, cieloPath + "cloudtop_left.jpg"); Cielo.setFaceTexture(TgcSkyBox.SkyFaces.Right, cieloPath + "cloudtop_right.jpg"); Cielo.setFaceTexture(TgcSkyBox.SkyFaces.Front, cieloPath + "cloudtop_front.jpg"); Cielo.setFaceTexture(TgcSkyBox.SkyFaces.Back, cieloPath + "cloudtop_back.jpg"); Cielo.SkyEpsilon = 11f; Cielo.Init(); // Implemento la fisica Fisica = new FisicaMundo(); for (int i = 30; i < 238; i++) { var objetos = BulletRigidBodyFactory.Instance.CreateRigidBodyFromTgcMesh(Plaza.Meshes[i]); Fisica.dynamicsWorld.AddRigidBody(objetos); } // Inicializo los coches AutoFisico1 = new AutoManejable(MayasAutoFisico1, new TGCVector3(-1000, 0, 3500), 270, Fisica, PathHumo, MediaDir, Sonidos); AutoFisico2 = new AutoManejable(MayasAutoFisico2, new TGCVector3(4000, 0, 3500), 270, Fisica, PathHumo, MediaDir, Sonidos); AutoFisico2.ConfigurarTeclas(Key.W, Key.S, Key.D, Key.A, Key.LeftControl, Key.Tab); AutoFisico1.ConfigurarTeclas(Key.UpArrow, Key.DownArrow, Key.RightArrow, Key.LeftArrow, Key.RightControl, Key.Space); AutoFisico1.Vida = 1000; AutoFisico2.Vida = 1000; Jugadores = new[] { AutoFisico1, AutoFisico2 }; GrupoPolicias = new PoliciasIA(MayasIA, Fisica, PathHumo, Jugadores, MediaDir, Sonidos); Players = new List <AutoManejable> { AutoFisico1, AutoFisico2 }; // Para el sonido y las colisiones SwitchInicio = 1; SwitchCamara = 1; Hud = new Hud(MediaDir, Jugadores); }
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"; } }
protected void CreateSkyBox(TGCVector3 center, TGCVector3 size, string name) { SkyBox = new TgcSkyBox(); SkyBox.Center = center; SkyBox.Size = size; var TexturesPath = Env.MediaDir + name + "\\"; SkyBox.setFaceTexture(TgcSkyBox.SkyFaces.Up, TexturesPath + "Up.jpg"); SkyBox.setFaceTexture(TgcSkyBox.SkyFaces.Down, TexturesPath + "Down.jpg"); SkyBox.setFaceTexture(TgcSkyBox.SkyFaces.Left, TexturesPath + "Left.jpg"); SkyBox.setFaceTexture(TgcSkyBox.SkyFaces.Right, TexturesPath + "Right.jpg"); SkyBox.setFaceTexture(TgcSkyBox.SkyFaces.Back, TexturesPath + "Back.jpg"); SkyBox.setFaceTexture(TgcSkyBox.SkyFaces.Front, TexturesPath + "Front.jpg"); SkyBox.Init(); }
public void init() { skybox = new TgcSkyBox(); skybox.Center = new Vector3(0, 0, 0); skybox.Size = new Vector3(10000, 10000, 10000); skybox.setFaceTexture(TgcSkyBox.SkyFaces.Up, MediaDir + "SkyBoxTron\\bottom.png"); skybox.setFaceTexture(TgcSkyBox.SkyFaces.Down, MediaDir + "SkyBoxTron\\bottom.png"); skybox.setFaceTexture(TgcSkyBox.SkyFaces.Left, MediaDir + "SkyBoxTron\\Pared.jpg"); skybox.setFaceTexture(TgcSkyBox.SkyFaces.Right, MediaDir + "SkyBoxTron\\Pared.jpg"); skybox.setFaceTexture(TgcSkyBox.SkyFaces.Front, MediaDir + "SkyBoxTron\\Pared.jpg"); skybox.setFaceTexture(TgcSkyBox.SkyFaces.Back, MediaDir + "SkyBoxTron\\Pared.jpg"); skybox.SkyEpsilon = 25f; skybox.Init(); }
private void LoadSkyBox() { var texturesPath = MediaDir + Constants.SKYBOX_TEXTURE_FOLDER; skybox.setFaceTexture(TgcSkyBox.SkyFaces.Up, texturesPath + Constants.SKYBOX_FACE_TEXTURE_UP); skybox.setFaceTexture(TgcSkyBox.SkyFaces.Down, texturesPath + Constants.SKYBOX_FACE_TEXTURE_DOWN); skybox.setFaceTexture(TgcSkyBox.SkyFaces.Left, texturesPath + Constants.SKYBOX_FACE_TEXTURE_LEFT); skybox.setFaceTexture(TgcSkyBox.SkyFaces.Right, texturesPath + Constants.SKYBOX_FACE_TEXTURE_RIGHT); skybox.setFaceTexture(TgcSkyBox.SkyFaces.Front, texturesPath + Constants.SKYBOX_FACE_TEXTURE_FRONT); skybox.setFaceTexture(TgcSkyBox.SkyFaces.Back, texturesPath + Constants.SKYBOX_FACE_TEXTURE_BACK); skybox.SkyEpsilon = 60f; skybox.Init(); CalculatePerimeter(); }
public void InitSkybox() { string path = $"{MediaDir}Skybox\\SkyBox1\\"; skyBox = new TgcSkyBox { Center = TGCVector3.Empty, Size = new TGCVector3(10000, 10000, 10000) }; skyBox.setFaceTexture(TgcSkyBox.SkyFaces.Up, $"{path}\\phobos_up.jpg"); skyBox.setFaceTexture(TgcSkyBox.SkyFaces.Down, $"{path}\\phobos_dn.jpg"); skyBox.setFaceTexture(TgcSkyBox.SkyFaces.Left, $"{path}\\phobos_lf.jpg"); skyBox.setFaceTexture(TgcSkyBox.SkyFaces.Right, $"{path}\\phobos_rt.jpg"); skyBox.setFaceTexture(TgcSkyBox.SkyFaces.Front, $"{path}\\phobos_bk.jpg"); skyBox.setFaceTexture(TgcSkyBox.SkyFaces.Back, $"{path}\\phobos_ft.jpg"); skyBox.Init(); }
private void LoadSkyBoxUndersea() { skyBoxUndersea = new TgcSkyBox(); skyBoxUndersea.Center = new TGCVector3(3200, 0, 3200); skyBoxUndersea.Size = new TGCVector3(12700, 9000, 12700); var texturesPath = MediaDir + "\\Level1\\Textures\\SkyBox\\"; skyBoxUndersea.setFaceTexture(TgcSkyBox.SkyFaces.Up, texturesPath + "fd.PNG"); skyBoxUndersea.setFaceTexture(TgcSkyBox.SkyFaces.Down, texturesPath + "others.PNG"); skyBoxUndersea.setFaceTexture(TgcSkyBox.SkyFaces.Left, texturesPath + "2.PNG"); skyBoxUndersea.setFaceTexture(TgcSkyBox.SkyFaces.Right, texturesPath + "4.PNG"); skyBoxUndersea.setFaceTexture(TgcSkyBox.SkyFaces.Front, texturesPath + "1.PNG"); skyBoxUndersea.setFaceTexture(TgcSkyBox.SkyFaces.Back, texturesPath + "3.PNG"); skyBoxUndersea.SkyEpsilon = 25f; skyBoxUndersea.Init(); }
private void LoadSkyBox() { var skyBoxSize = 80000 / 4; skyBox = new TgcSkyBox(); skyBox.Center = TGCVector3.Empty; skyBox.Size = new TGCVector3(skyBoxSize, skyBoxSize, skyBoxSize); var texturesPath = MediaDir + "Level1\\Textures\\SkyBox\\"; skyBox.setFaceTexture(TgcSkyBox.SkyFaces.Up, texturesPath + "cave3_up.png"); skyBox.setFaceTexture(TgcSkyBox.SkyFaces.Down, texturesPath + "cave3_dn.png"); skyBox.setFaceTexture(TgcSkyBox.SkyFaces.Left, texturesPath + "cave3_lf.png"); skyBox.setFaceTexture(TgcSkyBox.SkyFaces.Right, texturesPath + "cave3_rt.png"); skyBox.setFaceTexture(TgcSkyBox.SkyFaces.Back, texturesPath + "cave3_ft.png"); skyBox.setFaceTexture(TgcSkyBox.SkyFaces.Front, texturesPath + "cave3_bk.png"); skyBox.SkyEpsilon = 25f; skyBox.Init(); }
public static TgcSkyBox InitSkybox() { var skyBox = new TgcSkyBox { Center = new TGCVector3(0, 600, 0), Size = new TGCVector3(13000, 12000, 13000) }; var texturesPath = Game.Default.MediaDirectory + "Images\\"; skyBox.setFaceTexture(TgcSkyBox.SkyFaces.Up, texturesPath + "skybox.png"); skyBox.setFaceTexture(TgcSkyBox.SkyFaces.Down, texturesPath + "skybox.png"); skyBox.setFaceTexture(TgcSkyBox.SkyFaces.Left, texturesPath + "skybox left.png"); skyBox.setFaceTexture(TgcSkyBox.SkyFaces.Right, texturesPath + "skybox right.png"); skyBox.setFaceTexture(TgcSkyBox.SkyFaces.Front, texturesPath + "skybox front.png"); skyBox.setFaceTexture(TgcSkyBox.SkyFaces.Back, texturesPath + "skybox back.png"); skyBox.Init(); return(skyBox); }
public override void Init() { //-------ESCENA--------// var loader = new TgcSceneLoader(); //clase para cargar el terreno var center = TGCVector3.Empty; //posicion inicial para la scene scene = loader.loadSceneFromFile(MediaDir + "Selva\\Selva-TgcScene.xml"); var pathTextura = MediaDir + "Walls.jpg"; pista = new Track(center, pathTextura, 5); //------SKYBOX------// skyBox = new TgcSkyBox(); skyBox.Center = TGCVector3.Empty; skyBox.Size = new TGCVector3(10000, 10000, 10000); var pathSkybox = MediaDir + "SkyBox\\"; skyBox.setFaceTexture(TgcSkyBox.SkyFaces.Front, pathSkybox + "Back.jpg"); skyBox.setFaceTexture(TgcSkyBox.SkyFaces.Back, pathSkybox + "Front.jpg"); skyBox.setFaceTexture(TgcSkyBox.SkyFaces.Left, pathSkybox + "Left.jpg"); skyBox.setFaceTexture(TgcSkyBox.SkyFaces.Right, pathSkybox + "Right.jpg"); skyBox.setFaceTexture(TgcSkyBox.SkyFaces.Up, pathSkybox + "Up.jpg"); skyBox.setFaceTexture(TgcSkyBox.SkyFaces.Down, pathSkybox + "Down.jpg"); skyBox.Init(); this.ship = new Player(loader, MediaDir, ShadersDir, Input); //------ENEMIGO------// enemigo = new Enemy(MediaDir + "Enemy\\", new TGCVector3(0, 0, 200)); pickingRay = new TgcPickingRay(Input); //-------CAMARA--------// camera = new CamaraNave(ship.Position, 0); Camara = camera; buliEne = true; }
public void InstanciarSkyBox() { //Configurar tamaño SkyBox skyBox.Center = new TGCVector3(-250, 1000, -1500); skyBox.Size = new TGCVector3(30000, 5000, 30000); //Configurar las texturas para cada una de las 6 caras skyBox.setFaceTexture(TgcSkyBox.SkyFaces.Up, MediaDir + "Sky.jpg"); skyBox.setFaceTexture(TgcSkyBox.SkyFaces.Down, MediaDir + "Sky.jpg"); skyBox.setFaceTexture(TgcSkyBox.SkyFaces.Left, MediaDir + "Sky 3.png"); skyBox.setFaceTexture(TgcSkyBox.SkyFaces.Right, MediaDir + "Sky 4.png"); //Hay veces es necesario invertir las texturas Front y Back si se pasa de un sistema RightHanded a uno LeftHanded skyBox.setFaceTexture(TgcSkyBox.SkyFaces.Front, MediaDir + "Sky 1.png"); skyBox.setFaceTexture(TgcSkyBox.SkyFaces.Back, MediaDir + "Sky 2.png"); //Inicializa las configuraciones del skybox skyBox.Init(); }
public StartMenu() : base() { onGameStartCallback = onGameExitCallback = () => {}; drawer = new Drawer2D(); InitFonts(); InitTitle(); InitBlackRectangle(); x = spriteBlackRectangle.Position.X + 200; yStartWord = (int)(spriteBlackRectangle.Position.Y + 10); Screen.CenterSprite(title); title.Position = new TGCVector2( title.Position.X, Screen.Height * (1f / 5) ); skyBox = new TgcSkyBox(); skyBox.Center = new TGCVector3(0, 500, 0); skyBox.Size = new TGCVector3(10000, 10000, 10000); var baseDir = Game.Default.ResDirectory; skyBox.setFaceTexture(TgcSkyBox.SkyFaces.Up, baseDir + "skybox-up.jpg"); skyBox.setFaceTexture(TgcSkyBox.SkyFaces.Down, baseDir + "skybox-down.jpg"); skyBox.setFaceTexture(TgcSkyBox.SkyFaces.Left, baseDir + "skybox-left.jpg"); skyBox.setFaceTexture(TgcSkyBox.SkyFaces.Right, baseDir + "skybox-right.jpg"); skyBox.setFaceTexture(TgcSkyBox.SkyFaces.Front, baseDir + "skybox-front.jpg"); skyBox.setFaceTexture(TgcSkyBox.SkyFaces.Back, baseDir + "skybox-back.jpg"); skyBox.Init(); Camera = CameraFactory.Create(TGCVector3.Empty, Input); pressed[GameInput.Down] = () => pointer = Pointer.DOWN; pressed[GameInput.Up] = () => pointer = Pointer.UP; pressed[GameInput.Right] = () => Cheats.ActivateNext(); pressed[GameInput.Left] = () => Cheats.DesactivateNext(); pressed[GameInput.Accept] = fireAction; }
/// <summary> /// Crea un SkyBox que rodea toda la cancha y da una sensacion mas de realizamo /// </summary> /// <param name="pathRecursos"> la ruta donde se encuentran los recursos </param> /// <returns></returns> private TgcSkyBox CrearSkyBox(string pathRecursos, TgcBox pisoCancha) { //Crear SkyBox TgcSkyBox skyBox = new TgcSkyBox(); skyBox.Size = new Vector3(pisoCancha.Size.X + 100, 1000, pisoCancha.Size.Z + 100); skyBox.Center = new Vector3(pisoCancha.Position.X, pisoCancha.Position.Y - 1 + skyBox.Size.Y / 2, pisoCancha.Position.Z); //Configurar las texturas para cada una de las 6 caras skyBox.setFaceTexture(TgcSkyBox.SkyFaces.Up, pathRecursos + Settings.Default.textureSkyFacesUp); skyBox.setFaceTexture(TgcSkyBox.SkyFaces.Down, pathRecursos + Settings.Default.textureSkyFaceDown); skyBox.setFaceTexture(TgcSkyBox.SkyFaces.Left, pathRecursos + Settings.Default.textureSkyFaceLeft); skyBox.setFaceTexture(TgcSkyBox.SkyFaces.Right, pathRecursos + Settings.Default.textureSkyFaceRight); //Hay veces es necesario invertir las texturas Front y Back si se pasa de un sistema RightHanded a uno LeftHanded skyBox.setFaceTexture(TgcSkyBox.SkyFaces.Front, pathRecursos + Settings.Default.textureSkyFaceFront); skyBox.setFaceTexture(TgcSkyBox.SkyFaces.Back, pathRecursos + Settings.Default.textureSkyFaceBack); //Actualizar todos los valores para crear el SkyBox skyBox.Init(); return(skyBox); }
private void iniciarCielo() { //Crear SkyBox skyBox = new TgcSkyBox(); skyBox.Center = new Vector3(1000, 0, 1000); skyBox.Size = new Vector3(20000, 20000, 20000); var texturesPath = MediaDir + "Texturas\\Quake\\SkyBox3\\"; //Configurar las texturas para cada una de las 6 caras skyBox.setFaceTexture(TgcSkyBox.SkyFaces.Up, texturesPath + "Up.jpg"); skyBox.setFaceTexture(TgcSkyBox.SkyFaces.Down, texturesPath + "Down.jpg"); skyBox.setFaceTexture(TgcSkyBox.SkyFaces.Left, texturesPath + "Left.jpg"); skyBox.setFaceTexture(TgcSkyBox.SkyFaces.Right, texturesPath + "Right.jpg"); //Hay veces es necesario invertir las texturas Front y Back si se pasa de un sistema RightHanded a uno LeftHanded skyBox.setFaceTexture(TgcSkyBox.SkyFaces.Front, texturesPath + "Back.jpg"); skyBox.setFaceTexture(TgcSkyBox.SkyFaces.Back, texturesPath + "Front.jpg"); skyBox.SkyEpsilon = 40f; //Inicializa todos los valores para crear el SkyBox skyBox.Init(); }
public override void Init() { //Crear SkyBox skyBox = new TgcSkyBox(); skyBox.Center = new TGCVector3(0, 500, 0); skyBox.Size = new TGCVector3(10000, 10000, 10000); var texturesPath = MediaDir + "Texturas\\Quake\\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(); //Cargar escenario de Isla var loader = new TgcSceneLoader(); scene = loader.loadSceneFromFile(MediaDir + "Isla\\Isla-TgcScene.xml"); //Cargar Shader personalizado effect = TgcShaders.loadEffect(ShadersDir + "TgcViewer\\TgcFogShader.fx"); //Camara en 1ra persona Camara = new TgcFpsCamera(new TGCVector3(1500, 800, 0), Input); //Modifiers para configurar valores de niebla fogShaderModifier = AddBoolean("FogShader", "FogShader", true); startDistanceModifier = AddFloat("startDistance", 1, 10000, 2000); endDistanceModifier = AddFloat("endDistance", 1, 10000, 5000); densityModifier = AddFloat("density", 0, 1, 0.0025f); colorModifier = AddColor("color", Color.LightGray); fog = new TgcFog(); }
public void Init() { skyBox = new TgcSkyBox { Center = TGCVector3.Empty, Size = new TGCVector3(10000, 10000, 10000) }; string texturesPath = mediaDir + "\\Skybox\\"; skyBox.setFaceTexture(TgcSkyBox.SkyFaces.Up, texturesPath + "phobos_up.jpg"); skyBox.setFaceTexture(TgcSkyBox.SkyFaces.Down, texturesPath + "phobos_dn.jpg"); skyBox.setFaceTexture(TgcSkyBox.SkyFaces.Left, texturesPath + "phobos_lf.jpg"); skyBox.setFaceTexture(TgcSkyBox.SkyFaces.Right, texturesPath + "phobos_rt.jpg"); //Hay veces es necesario invertir las texturas Front y Back si se pasa de un sistema RightHanded a uno LeftHanded skyBox.setFaceTexture(TgcSkyBox.SkyFaces.Front, texturesPath + "phobos_bk.jpg"); skyBox.setFaceTexture(TgcSkyBox.SkyFaces.Back, texturesPath + "phobos_ft.jpg"); skyBox.SkyEpsilon = 25f; skyBox.Init(); }
public override void Init() { Device d3dDevice = D3DDevice.Instance.Device; //Cargamos un escenario TgcSceneLoader loader = new TgcSceneLoader(); TgcScene scene = loader.loadSceneFromFile(MediaDir + "MeshCreator\\Scenes\\Selva\\Selva-TgcScene.xml"); meshes = scene.Meshes; TgcScene scene2 = loader.loadSceneFromFile(MediaDir + "MeshCreator\\Meshes\\Vegetacion\\Pasto\\Pasto-TgcScene.xml"); pasto = scene2.Meshes[0]; TgcScene scene3 = loader.loadSceneFromFile(MediaDir + "MeshCreator\\Meshes\\Vegetacion\\ArbolSelvatico\\ArbolSelvatico-TgcScene.xml"); arbol = scene3.Meshes[0]; arbol.Transform = TGCMatrix.Scaling(1, 3, 1); TgcScene scene4 = loader.loadSceneFromFile(MediaDir + "MeshCreator\\Meshes\\Vegetacion\\Arbusto2\\Arbusto2-TgcScene.xml"); arbusto = scene4.Meshes[0]; //Cargar terreno: cargar heightmap y textura de color terrain = new TgcSimpleTerrain(); terrain.loadHeightmap(MediaDir + "Heighmaps\\" + "TerrainTexture2.jpg", 20, 0.3f, new TGCVector3(0, -115, 0)); terrain.loadTexture(MediaDir + "Heighmaps\\" + "grass.jpg"); //Crear SkyBox skyBox = new TgcSkyBox(); skyBox.Center = new TGCVector3(0, 500, 0); skyBox.Size = new TGCVector3(10000, 10000, 10000); string texturesPath = MediaDir + "Texturas\\Quake\\SkyBox2\\"; skyBox.setFaceTexture(TgcSkyBox.SkyFaces.Up, texturesPath + "lun4_up.jpg"); skyBox.setFaceTexture(TgcSkyBox.SkyFaces.Down, texturesPath + "lun4_dn.jpg"); skyBox.setFaceTexture(TgcSkyBox.SkyFaces.Left, texturesPath + "lun4_lf.jpg"); skyBox.setFaceTexture(TgcSkyBox.SkyFaces.Right, texturesPath + "lun4_rt.jpg"); skyBox.setFaceTexture(TgcSkyBox.SkyFaces.Front, texturesPath + "lun4_bk.jpg"); skyBox.setFaceTexture(TgcSkyBox.SkyFaces.Back, texturesPath + "lun4_ft.jpg"); skyBox.Init(); //Cargar Shader personalizado string compilationErrors; effect = Effect.FromFile(d3dDevice, ShadersDir + "WorkshopShaders\\GaussianBlur.fx", null, null, ShaderFlags.PreferFlowControl, null, out compilationErrors); if (effect == null) { throw new Exception("Error al cargar shader. Errores: " + compilationErrors); } //Configurar Technique dentro del shader effect.Technique = "DefaultTechnique"; //Camara en primera persona TGCVector3 positionEye = new TGCVector3(-944.1269f, 100f, -1033.307f); Camera = new TgcFpsCamera(positionEye, 300, 10, Input); g_pDepthStencil = d3dDevice.CreateDepthStencilSurface(d3dDevice.PresentationParameters.BackBufferWidth, d3dDevice.PresentationParameters.BackBufferHeight, DepthFormat.D24S8, MultiSampleType.None, 0, true); // inicializo el render target g_pRenderTarget = new Texture(d3dDevice, d3dDevice.PresentationParameters.BackBufferWidth, d3dDevice.PresentationParameters.BackBufferHeight, 1, Usage.RenderTarget, Format.A16B16G16R16F, Pool.Default); g_pGlowMap = new Texture(d3dDevice, d3dDevice.PresentationParameters.BackBufferWidth, d3dDevice.PresentationParameters.BackBufferHeight, 1, Usage.RenderTarget, Format.A16B16G16R16F, Pool.Default); g_pRenderTarget4 = new Texture(d3dDevice, d3dDevice.PresentationParameters.BackBufferWidth / 4, d3dDevice.PresentationParameters.BackBufferHeight / 4, 1, Usage.RenderTarget, Format.A16B16G16R16F, Pool.Default); g_pRenderTarget4Aux = new Texture(d3dDevice, d3dDevice.PresentationParameters.BackBufferWidth / 4, d3dDevice.PresentationParameters.BackBufferHeight / 4, 1, Usage.RenderTarget, Format.A16B16G16R16F, Pool.Default); // Para computar el promedio de Luminance int tx_size = 1; for (int i = 0; i < NUM_REDUCE_TX; ++i) { g_pLuminance[i] = new Texture(d3dDevice, tx_size, tx_size, 1, Usage.RenderTarget, Format.A16B16G16R16F, Pool.Default); tx_size *= 4; } g_pLuminance_ant = new Texture(d3dDevice, 1, 1, 1, Usage.RenderTarget, Format.A16B16G16R16F, Pool.Default); effect.SetValue("g_RenderTarget", g_pRenderTarget); // Resolucion de pantalla effect.SetValue("screen_dx", d3dDevice.PresentationParameters.BackBufferWidth); effect.SetValue("screen_dy", d3dDevice.PresentationParameters.BackBufferHeight); CustomVertex.PositionTextured[] vertices = new CustomVertex.PositionTextured[] { new CustomVertex.PositionTextured(-1, 1, 1, 0, 0), new CustomVertex.PositionTextured(1, 1, 1, 1, 0), new CustomVertex.PositionTextured(-1, -1, 1, 0, 1), new CustomVertex.PositionTextured(1, -1, 1, 1, 1) }; //vertex buffer de los triangulos g_pVBV3D = new VertexBuffer(typeof(CustomVertex.PositionTextured), 4, d3dDevice, Usage.Dynamic | Usage.WriteOnly, CustomVertex.PositionTextured.Format, Pool.Default); g_pVBV3D.SetData(vertices, 0, LockFlags.None); activarGlowModifier = AddBoolean("activar_glow", "Activar Glow", true); pantallaCompletaModifier = AddBoolean("pantalla_completa", "Pant.completa", true); tmIzqModifier = AddEnum("tm_izq", typeof(ToneMapping), ToneMapping.MiddleGray); tmDerModifier = AddEnum("tm_der", typeof(ToneMapping), ToneMapping.Nada); adaptacionPupilaModifier = AddInterval("adaptacion_pupila", new object[] { 1.0f, 2.0f, 3.0f, 4.0f, 5.0f }, 2); }
public override void Init() { var d3dDevice = D3DDevice.Instance.Device; MyShaderDir = ShadersDir + "WorkshopShaders\\"; circuito = new F1Circuit(MediaDir); //Cargar terreno: cargar heightmap y textura de color terrain = new TgcSimpleTerrain(); terrain.loadHeightmap(MediaDir + "Heighmaps\\" + "TerrainTexture2.jpg", 20, 0.1f, new TGCVector3(0, -125, 0)); terrain.loadTexture(MediaDir + "Heighmaps\\" + "TerrainTexture2.jpg"); //Crear SkyBox skyBox = new TgcSkyBox(); skyBox.Center = new TGCVector3(0, 500, 0); skyBox.Size = new TGCVector3(10000, 10000, 10000); var texturesPath = MediaDir + "Texturas\\Quake\\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(); var loader = new TgcSceneLoader(); var scene = loader.loadSceneFromFile(MediaDir + "MeshCreator\\Meshes\\Vehiculos\\Auto\\Auto-TgcScene.xml"); car = scene.Meshes[0]; //Cargar Shader personalizado string compilationErrors; effect = Effect.FromFile(D3DDevice.Instance.Device, MyShaderDir + "OutRun.fx", null, null, ShaderFlags.PreferFlowControl, null, out compilationErrors); if (effect == null) { throw new Exception("Error al cargar shader. Errores: " + compilationErrors); } //Configurar Technique dentro del shader effect.Technique = "DefaultTechnique"; //Configurar FPS Camara Camara.SetCamera(new TGCVector3(315.451f, 40, -464.28490f), new TGCVector3(315.451f, 40, -465.28490f)); reset_pos(); // para capturar el mouse var focusWindows = D3DDevice.Instance.Device.CreationParameters.FocusWindow; mouseCenter = focusWindows.PointToScreen(new Point(focusWindows.Width / 2, focusWindows.Height / 2)); mouseCaptured = true; Cursor.Hide(); // stencil g_pDepthStencil = d3dDevice.CreateDepthStencilSurface(d3dDevice.PresentationParameters.BackBufferWidth, d3dDevice.PresentationParameters.BackBufferHeight, DepthFormat.D24S8, MultiSampleType.None, 0, true); g_pDepthStencilOld = d3dDevice.DepthStencilSurface; // inicializo el render target g_pRenderTarget = new Texture(d3dDevice, d3dDevice.PresentationParameters.BackBufferWidth , d3dDevice.PresentationParameters.BackBufferHeight, 1, Usage.RenderTarget, Format.X8R8G8B8, Pool.Default); g_pRenderTarget2 = new Texture(d3dDevice, d3dDevice.PresentationParameters.BackBufferWidth , d3dDevice.PresentationParameters.BackBufferHeight, 1, Usage.RenderTarget, Format.X8R8G8B8, Pool.Default); g_pRenderTarget3 = new Texture(d3dDevice, d3dDevice.PresentationParameters.BackBufferWidth , d3dDevice.PresentationParameters.BackBufferHeight, 1, Usage.RenderTarget, Format.X8R8G8B8, Pool.Default); g_pRenderTarget4 = new Texture(d3dDevice, d3dDevice.PresentationParameters.BackBufferWidth , d3dDevice.PresentationParameters.BackBufferHeight, 1, Usage.RenderTarget, Format.X8R8G8B8, Pool.Default); g_pRenderTarget5 = new Texture(d3dDevice, d3dDevice.PresentationParameters.BackBufferWidth , d3dDevice.PresentationParameters.BackBufferHeight, 1, Usage.RenderTarget, Format.X8R8G8B8, Pool.Default); // Resolucion de pantalla effect.SetValue("screen_dx", d3dDevice.PresentationParameters.BackBufferWidth); effect.SetValue("screen_dy", d3dDevice.PresentationParameters.BackBufferHeight); CustomVertex.PositionTextured[] vertices = { new CustomVertex.PositionTextured(-1, 1, 1, 0, 0), new CustomVertex.PositionTextured(1, 1, 1, 1, 0), new CustomVertex.PositionTextured(-1, -1, 1, 0, 1), new CustomVertex.PositionTextured(1, -1, 1, 1, 1) }; //vertex buffer de los triangulos g_pVBV3D = new VertexBuffer(typeof(CustomVertex.PositionTextured), 4, d3dDevice, Usage.Dynamic | Usage.WriteOnly, CustomVertex.PositionTextured.Format, Pool.Default); g_pVBV3D.SetData(vertices, 0, LockFlags.None); }
public override void Init() { //Cargar escenario específico para este ejemplo var loader = new TgcSceneLoader(); escenario = loader.loadSceneFromFile(MediaDir + "PatioDeJuegos\\PatioDeJuegos-TgcScene.xml"); //Cargar personaje con animaciones var skeletalLoader = new TgcSkeletalLoader(); personaje = skeletalLoader.loadMeshAndAnimationsFromFile( MediaDir + "SkeletalAnimations\\Robot\\Robot-TgcSkeletalMesh.xml", MediaDir + "SkeletalAnimations\\Robot\\", new[] { MediaDir + "SkeletalAnimations\\Robot\\Caminando-TgcSkeletalAnim.xml", MediaDir + "SkeletalAnimations\\Robot\\Parado-TgcSkeletalAnim.xml" }); //Le cambiamos la textura para diferenciarlo un poco personaje.changeDiffuseMaps(new[] { TgcTexture.createTexture(D3DDevice.Instance.Device, MediaDir + "SkeletalAnimations\\Robot\\Textures\\uvwGreen.jpg") }); //Configurar animacion inicial personaje.playAnimation("Parado", true); //Escalarlo porque es muy grande personaje.Position = new TGCVector3(0, 500, -100); //Rotarlo 180° porque esta mirando para el otro lado personaje.RotateY(Geometry.DegreeToRadian(180f)); //Escalamos el personaje ya que sino la escalera es demaciado grande. personaje.Scale = new TGCVector3(1.5f, 1.5f, 1.5f); characterSphere = new TgcBoundingSphere(personaje.BoundingBox.calculateBoxCenter(), personaje.BoundingBox.calculateBoxRadius()); //Almacenar volumenes de colision del escenario objetosColisionables.Clear(); foreach (var mesh in escenario.Meshes) { objetosColisionables.Add(mesh.BoundingBox); } //Crear linea para mostrar la direccion del movimiento del personaje directionArrow = new TgcArrow(); directionArrow.BodyColor = Color.Red; directionArrow.HeadColor = Color.Green; directionArrow.Thickness = 1; directionArrow.HeadSize = new TGCVector2(10, 20); //Crear manejador de colisiones collisionManager = new SphereCollisionManager(); collisionManager.GravityEnabled = true; //Configurar camara en Tercer Persona camaraInterna = new TgcThirdPersonCamera(personaje.Position, new TGCVector3(0, 100, 0), 100, -400); Camara = camaraInterna; //Crear SkyBox skyBox = new TgcSkyBox(); skyBox.Center = TGCVector3.Empty; skyBox.Size = new TGCVector3(10000, 10000, 10000); var texturesPath = MediaDir + "Texturas\\Quake\\SkyBox3\\"; skyBox.setFaceTexture(TgcSkyBox.SkyFaces.Up, texturesPath + "Up.jpg"); skyBox.setFaceTexture(TgcSkyBox.SkyFaces.Down, texturesPath + "Down.jpg"); skyBox.setFaceTexture(TgcSkyBox.SkyFaces.Left, texturesPath + "Left.jpg"); skyBox.setFaceTexture(TgcSkyBox.SkyFaces.Right, texturesPath + "Right.jpg"); skyBox.setFaceTexture(TgcSkyBox.SkyFaces.Front, texturesPath + "Back.jpg"); skyBox.setFaceTexture(TgcSkyBox.SkyFaces.Back, texturesPath + "Front.jpg"); skyBox.Init(); //Modifier para ver BoundingBox showBoundingBoxModifier = AddBoolean("showBoundingBox", "Bouding Box", true); //Modifiers para desplazamiento del personaje velocidadCaminarModifier = AddFloat("VelocidadCaminar", 0, 20, 10); velocidadRotacionModifier = AddFloat("VelocidadRotacion", 1f, 360f, 150f); habilitarGravedadModifier = AddBoolean("HabilitarGravedad", "Habilitar Gravedad", true); gravedadModifier = AddVertex3f("Gravedad", new TGCVector3(-50, -50, -50), new TGCVector3(50, 50, 50), new TGCVector3(0, -10, 0)); slideFactorModifier = AddFloat("SlideFactor", 1f, 2f, 1.3f); UserVars.addVar("Movement"); }
public override void Init() { //Cargar escenario específico para este ejemplo var loader = new TgcSceneLoader(); escenario = loader.loadSceneFromFile(MediaDir + "\\MeshCreator\\Scenes\\Mountains\\Mountains-TgcScene.xml"); //Cargar personaje con animaciones var skeletalLoader = new TgcSkeletalLoader(); personaje = skeletalLoader.loadMeshAndAnimationsFromFile( MediaDir + "SkeletalAnimations\\Robot\\Robot-TgcSkeletalMesh.xml", MediaDir + "SkeletalAnimations\\Robot\\", new[] { MediaDir + "SkeletalAnimations\\Robot\\Caminando-TgcSkeletalAnim.xml", MediaDir + "SkeletalAnimations\\Robot\\Parado-TgcSkeletalAnim.xml" }); //Le cambiamos la textura para diferenciarlo un poco personaje.changeDiffuseMaps(new[] { TgcTexture.createTexture(D3DDevice.Instance.Device, MediaDir + "SkeletalAnimations\\Robot\\Textures\\uvwGreen.jpg") }); //Se utiliza autotransform, aunque este es un claro ejemplo de que no se debe usar autotransform, //hay muchas operaciones y la mayoria las maneja el manager de colisiones, con lo cual se esta //perdiendo el control de las transformaciones del personaje. personaje.AutoTransformEnable = true; //Configurar animacion inicial personaje.playAnimation("Parado", true); //Escalarlo porque es muy grande personaje.Position = new Vector3(0, 2500, -150); //Rotarlo 180° porque esta mirando para el otro lado personaje.rotateY(Geometry.DegreeToRadian(180f)); //escalamos el personaje porque es muy grande. personaje.Scale = new Vector3(0.5f, 0.5f, 0.5f); //BoundingSphere que va a usar el personaje personaje.AutoUpdateBoundingBox = false; characterSphere = new TgcBoundingSphere(personaje.BoundingBox.calculateBoxCenter(), personaje.BoundingBox.calculateBoxRadius()); jumping = false; //Almacenar volumenes de colision del escenario objetosColisionables.Clear(); foreach (var mesh in escenario.Meshes) { //Los objetos del layer "TriangleCollision" son colisiones a nivel de triangulo if (mesh.Layer == "TriangleCollision") { objetosColisionables.Add(TriangleMeshCollider.fromMesh(mesh)); } //El resto de los objetos son colisiones de BoundingBox else { objetosColisionables.Add(BoundingBoxCollider.fromBoundingBox(mesh.BoundingBox)); } } //Crear linea para mostrar la direccion del movimiento del personaje directionArrow = new TgcArrow(); directionArrow.BodyColor = Color.Red; directionArrow.HeadColor = Color.Green; directionArrow.Thickness = 0.4f; directionArrow.HeadSize = new Vector2(5, 10); //Linea para normal de colision collisionNormalArrow = new TgcArrow(); collisionNormalArrow.BodyColor = Color.Blue; collisionNormalArrow.HeadColor = Color.Yellow; collisionNormalArrow.Thickness = 0.4f; collisionNormalArrow.HeadSize = new Vector2(2, 5); //Caja para marcar punto de colision collisionPoint = TgcBox.fromSize(new Vector3(4, 4, 4), Color.Red); collisionPoint.AutoTransformEnable = true; //Crear manejador de colisiones collisionManager = new SphereTriangleCollisionManager(); collisionManager.GravityEnabled = true; //Configurar camara en Tercer Persona camaraInterna = new TgcThirdPersonCamera(personaje.Position, new Vector3(0, 45, 0), 35, -150); Camara = camaraInterna; //Crear SkyBox skyBox = new TgcSkyBox(); skyBox.Center = new Vector3(0, 0, 0); skyBox.Size = new Vector3(10000, 10000, 10000); var texturesPath = MediaDir + "Texturas\\Quake\\SkyBox3\\"; skyBox.setFaceTexture(TgcSkyBox.SkyFaces.Up, texturesPath + "Up.jpg"); skyBox.setFaceTexture(TgcSkyBox.SkyFaces.Down, texturesPath + "Down.jpg"); skyBox.setFaceTexture(TgcSkyBox.SkyFaces.Left, texturesPath + "Left.jpg"); skyBox.setFaceTexture(TgcSkyBox.SkyFaces.Right, texturesPath + "Right.jpg"); skyBox.setFaceTexture(TgcSkyBox.SkyFaces.Front, texturesPath + "Back.jpg"); skyBox.setFaceTexture(TgcSkyBox.SkyFaces.Back, texturesPath + "Front.jpg"); skyBox.Init(); //Modifier para ver BoundingBox Modifiers.addBoolean("Collisions", "Collisions", true); Modifiers.addBoolean("showBoundingBox", "Bouding Box", true); //Modifiers para desplazamiento del personaje Modifiers.addFloat("VelocidadCaminar", 0, 10, 2); Modifiers.addFloat("VelocidadRotacion", 1f, 360f, 150f); Modifiers.addBoolean("HabilitarGravedad", "Habilitar Gravedad", true); Modifiers.addVertex3f("Gravedad", new Vector3(-5, -10, -5), new Vector3(5, 5, 5), new Vector3(0, -6, 0)); Modifiers.addFloat("SlideFactor", 0f, 2f, 1f); Modifiers.addFloat("Pendiente", 0f, 1f, 0.7f); Modifiers.addFloat("VelocidadSalto", 0f, 10f, 2f); Modifiers.addFloat("TiempoSalto", 0f, 2f, 0.5f); UserVars.addVar("Movement"); UserVars.addVar("ySign"); }
public void Init() { var loader = new TgcSceneLoader(); Items = new List <Recolectable>(); Piezas = new List <Pieza>(); Objetos = new List <Colisionable>(); MeshARenderizar = new List <TgcMesh>(); meshFogatas = new List <TgcMesh>(); IluminacionEscenario = new List <Fogata>(); //Instancia de skybox skyBox = new TgcSkyBox(); skyBox.Center = TGCVector3.Empty; skyBox.Size = new TGCVector3(9000, 9000, 9000); skyBox.setFaceTexture(TgcSkyBox.SkyFaces.Up, MediaDir + "cielo.jpg"); skyBox.setFaceTexture(TgcSkyBox.SkyFaces.Down, MediaDir + "cielo.jpg"); skyBox.setFaceTexture(TgcSkyBox.SkyFaces.Left, MediaDir + "cielo.jpg"); skyBox.setFaceTexture(TgcSkyBox.SkyFaces.Right, MediaDir + "cielo.jpg"); skyBox.setFaceTexture(TgcSkyBox.SkyFaces.Front, MediaDir + "cielo.jpg"); skyBox.setFaceTexture(TgcSkyBox.SkyFaces.Back, MediaDir + "cielo.jpg"); skyBox.SkyEpsilon = 25f; skyBox.Init(); //Instancio la vegetacion var scene = loader.loadSceneFromFile(MediaDir + @"Pino-TgcScene.xml"); var PinoOriginal = scene.Meshes[0]; List <TGCVector3> posicionesArboles = new List <TGCVector3>(); posicionesArboles.Add(new TGCVector3(1, 1, 1)); posicionesArboles.Add(new TGCVector3(-3442, 1, -2736)); posicionesArboles.Add(new TGCVector3(-3689, 1, -3039)); posicionesArboles.Add(new TGCVector3(-3799, 1, -2719)); posicionesArboles.Add(new TGCVector3(-3417, 1, -2480)); posicionesArboles.Add(new TGCVector3(-2917, 1, -2433)); posicionesArboles.Add(new TGCVector3(-3668, 1, -2025)); posicionesArboles.Add(new TGCVector3(-3362, 1, -2009)); posicionesArboles.Add(new TGCVector3(-3451, 1, -3786)); posicionesArboles.Add(new TGCVector3(-4037, 1, -2329)); posicionesArboles.Add(new TGCVector3(-2885, 1, -1826)); posicionesArboles.Add(new TGCVector3(-4123, 1, -1581)); posicionesArboles.Add(new TGCVector3(-3289, 1, -909)); posicionesArboles.Add(new TGCVector3(-4261, 1, -435)); posicionesArboles.Add(new TGCVector3(-2883, 1, -655)); posicionesArboles.Add(new TGCVector3(-3352, 1, -1761)); posicionesArboles.Add(new TGCVector3(-3244, 1, -2394)); posicionesArboles.Add(new TGCVector3(-3978, 1, -2572)); posicionesArboles.Add(new TGCVector3(-3517, 1, -1982)); posicionesArboles.Add(new TGCVector3(-3118, 1, -1524)); posicionesArboles.Add(new TGCVector3(-3349, 1, -980)); posicionesArboles.Add(new TGCVector3(-4110, 1, -407)); posicionesArboles.Add(new TGCVector3(-3304, 1, -1774)); posicionesArboles.Add(new TGCVector3(-3139, 1, -1269)); posicionesArboles.Add(new TGCVector3(-2140, 1, -562)); posicionesArboles.Add(new TGCVector3(-4094, 1, -145)); posicionesArboles.Add(new TGCVector3(-3103, 1, -1337)); posicionesArboles.Add(new TGCVector3(-2896, 1, -1087)); posicionesArboles.Add(new TGCVector3(-2529, 1, 10)); posicionesArboles.Add(new TGCVector3(-3917, 1, 772)); posicionesArboles.Add(new TGCVector3(746, 1, 157)); posicionesArboles.Add(new TGCVector3(951, 1, 637)); posicionesArboles.Add(new TGCVector3(1361, 1, 404)); posicionesArboles.Add(new TGCVector3(1361, 1, 440)); posicionesArboles.Add(new TGCVector3(-3877, 1, -678)); posicionesArboles.Add(new TGCVector3(-3997, 1, -1079)); posicionesArboles.Add(new TGCVector3(-3996, 1, -1617)); posicionesArboles.Add(new TGCVector3(-3701, 1, -1505)); posicionesArboles.Add(new TGCVector3(-3761, 1, -1069)); posicionesArboles.Add(new TGCVector3(-3968, 1, -1952)); posicionesArboles.Add(new TGCVector3(-3550, 1, -1562)); posicionesArboles.Add(new TGCVector3(-3557, 1, -1192)); posicionesArboles.Add(new TGCVector3(-3938, 1, -1048)); posicionesArboles.Add(new TGCVector3(-3148, 1, -268)); posicionesArboles.Add(new TGCVector3(-4120, 1, 433)); posicionesArboles.Add(new TGCVector3(-3136, 1, -135)); posicionesArboles.Add(new TGCVector3(-2793, 1, -476)); var indiceArbolDirectorio = (new Random()).Next(posicionesArboles.Count, posicionesArboles.Count + 100); arbolesMesh = new List <TgcMesh>(); Colisionable Arbol; for (var i = 0; i < posicionesArboles.Count; i++) { var Instance = PinoOriginal.createMeshInstance("Pino" + i); Arbol = new SinEfecto(Instance); Arbol.mesh.Move(0, 0, 0); Arbol.mesh.Scale = new TGCVector3(0.05f * i, 0.05f * i, 0.05f * i); Arbol.mesh.Move(posicionesArboles[i]); Arbol.mesh.Transform = TGCMatrix.Translation(posicionesArboles[i]); Objetos.Add(Arbol); MeshARenderizar.Add(Arbol.mesh); arbolesMesh.Add(Arbol.mesh); } for (var i = posicionesArboles.Count; i < posicionesArboles.Count + 100; i++) { var Instance = PinoOriginal.createMeshInstance("Pino" + i); if (i == indiceArbolDirectorio) { Arbol = new ArbolDirectorio(MediaDir); } else { Arbol = new SinEfecto(Instance); } Arbol.mesh.Move(0, 0, 0); Arbol.mesh.Scale = new TGCVector3(0.01f * i, 0.01f * i, 0.01f * i); Arbol.mesh.Move(new TGCVector3(((float)Math.Pow(i, Math.PI) % 2066) + 98, 1, ((float)Math.Pow(i, Math.E) % 3136) - 1339)); Arbol.mesh.Transform = TGCMatrix.Translation(new TGCVector3(((float)Math.Pow(i, Math.PI) % 2066) + 98, 1, ((float)Math.Pow(i, Math.E) % 3136) - 1339)); Objetos.Add(Arbol); MeshARenderizar.Add(Arbol.mesh); arbolesMesh.Add(Arbol.mesh); } foreach (var mesh in arbolesMesh) { mesh.AlphaBlendEnable = true; } //Instancio el terreno (Heigthmap) terreno = new TgcSimpleTerrain(); var pathTextura = MediaDir + "Textures\\mapa1.jpg"; var pathHeighmap = MediaDir + "mapa1.jpg"; currentScaleXZ = 100f; currentScaleY = 3f; terreno.loadHeightmap(pathHeighmap, currentScaleXZ, currentScaleY, new TGCVector3(0, -30, 0)); terreno.loadTexture(pathTextura); //Instancio el piso var pisoTexture = TgcTexture.createTexture(D3DDevice.Instance.Device, MediaDir + "Textures\\water2.jpg"); Plano = new TgcPlane(new TGCVector3(-tamanioMapa / 2, 0, -tamanioMapa / 2), new TGCVector3(tamanioMapa, 0, tamanioMapa), TgcPlane.Orientations.XZplane, pisoTexture, 50f, 50f); MeshPlano = Plano.toMesh("MeshPlano"); Objetos.Add(new SinEfecto(MeshPlano)); MeshARenderizar.Add(MeshPlano); piezaAsociadaLago = new Pieza(2, "Pieza 2", MediaDir + "\\2D\\windows\\windows_2.png", null); pistaAsociadaLago = new Pista(null, MediaDir + "\\2D\\pista_hacha.png", null); //Instancio la Cabania var sceneCabania = loader.loadSceneFromFile(MediaDir + @"cabania-TgcScene.xml"); foreach (var Mesh in sceneCabania.Meshes) { Mesh.Move(-500, 20, 500); Mesh.Scale = new TGCVector3(4.5f, 4.5f, 4.5f); Mesh.Transform = TGCMatrix.Scaling(Mesh.Scale); Objetos.Add(new SinEfecto(Mesh)); MeshARenderizar.Add(Mesh); } cabaniaBoundingBox = new TgcBoundingAxisAlignBox(new TGCVector3(-500, 20, 500), new TGCVector3(0, 1001, 1080)); var sceneBridge = loader.loadSceneFromFile(MediaDir + @"Bridge-TgcScene.xml"); foreach (var Mesh in sceneBridge.Meshes) { Mesh.Move(-2561, 12, 159); Mesh.Scale = new TGCVector3(4.5f, .75f, 1.35f); Mesh.Transform = TGCMatrix.Scaling(Mesh.Scale); Objetos.Add(new SinEfecto(Mesh)); MeshARenderizar.Add(Mesh); } var sceneCanoa = loader.loadSceneFromFile(MediaDir + @"Canoa-TgcScene.xml"); foreach (var Mesh in sceneCanoa.Meshes) { Mesh.Move(-482, 20, -3110); Mesh.Scale = new TGCVector3(1.5f, 1.5f, 1.5f); Mesh.Transform = TGCMatrix.Scaling(Mesh.Scale); Objetos.Add(new SinEfecto(Mesh)); MeshARenderizar.Add(Mesh); } //Cabania es lugar seguro if (TgcCollisionUtils.testAABBAABB(personaje.mesh.BoundingBox, cabaniaBoundingBox)) { personaje.tiempoDesprotegido = 0; } }
public override void Init() { MyMediaDir = MediaDir; //Crear loader var loader = new TgcSceneLoader(); // ------------------------------------------------------------ // Creo el Heightmap para el terreno: var PosTerrain = TGCVector3.Empty; currentHeightmap = MyMediaDir + "Heighmaps\\Heightmap2.jpg"; currentScaleXZ = 100f; currentScaleY = 2f; currentTexture = MyMediaDir + "Heighmaps\\TerrainTexture3.jpg"; terrain = new TgcSimpleTerrain(); terrain.loadHeightmap(currentHeightmap, currentScaleXZ, currentScaleY, PosTerrain); terrain.loadTexture(currentTexture); // ------------------------------------------------------------ // Crear SkyBox: skyBox = new TgcSkyBox(); skyBox.Center = TGCVector3.Empty; skyBox.Size = new TGCVector3(8000, 8000, 8000); var texturesPath = MediaDir + "Texturas\\Quake\\SkyBox1\\"; skyBox.setFaceTexture(TgcSkyBox.SkyFaces.Up, texturesPath + "phobos_up.jpg"); skyBox.setFaceTexture(TgcSkyBox.SkyFaces.Down, texturesPath + "phobos_dn.jpg"); skyBox.setFaceTexture(TgcSkyBox.SkyFaces.Left, texturesPath + "phobos_lf.jpg"); skyBox.setFaceTexture(TgcSkyBox.SkyFaces.Right, texturesPath + "phobos_rt.jpg"); skyBox.setFaceTexture(TgcSkyBox.SkyFaces.Front, texturesPath + "phobos_bk.jpg"); skyBox.setFaceTexture(TgcSkyBox.SkyFaces.Back, texturesPath + "phobos_ft.jpg"); skyBox.SkyEpsilon = 50f; skyBox.Init(); // ------------------------------------------------------------ //Cargar los mesh: scene = loader.loadSceneFromFile(MediaDir + "MeshCreator\\Meshes\\Vehiculos\\TanqueFuturistaRuedas\\TanqueFuturistaRuedas-TgcScene.xml"); mesh = scene.Meshes[0]; sceneX = loader.loadSceneFromFile(MediaDir + "ModelosTgc\\Sphere\\Sphere-TgcScene.xml"); meshX = sceneX.Meshes[0]; meshX.AutoTransform = true; scene2 = loader.loadSceneFromFile(MediaDir + "MeshCreator\\Meshes\\Vegetacion\\Palmera\\Palmera-TgcScene.xml"); palmera = scene2.Meshes[0]; palmera.AutoTransform = true; scene3 = loader.loadSceneFromFile(MediaDir + "MeshCreator\\Meshes\\Vehiculos\\AvionCaza\\AvionCaza-TgcScene.xml"); avion = scene3.Meshes[0]; mesh.Scale = new TGCVector3(0.5f, 0.5f, 0.5f); mesh.Position = new TGCVector3(0f, 0f, 0f); var size = mesh.BoundingBox.calculateSize(); largo_tanque = Math.Abs(size.Z); alto_tanque = Math.Abs(size.Y) * mesh.Scale.Y; avion.Scale = new TGCVector3(1f, 1f, 1f); avion.Position = new TGCVector3(3000f, 550f, 0f); dir_avion = new TGCVector3(0, 0, 1); size = palmera.BoundingBox.calculateSize(); var alto_palmera = Math.Abs(size.Y); int i; bosque = new List <TgcMesh>(); float[] r = { 1900f, 2100f, 2300f, 1800f }; for (i = 0; i < 4; i++) { for (var j = 0; j < 15; j++) { var instance = palmera.createMeshInstance(palmera.Name + i); instance.AutoTransform = true; instance.Scale = new TGCVector3(0.5f, 1.5f, 0.5f); var x = r[i] * (float)Math.Cos(Geometry.DegreeToRadian(180 + 10.0f * j)); var z = r[i] * (float)Math.Sin(Geometry.DegreeToRadian(180 + 10.0f * j)); instance.Position = new TGCVector3(x, CalcularAltura(x, z) /*+ alto_palmera / 2 * instance.Scale.Y*/, z); bosque.Add(instance); } } // Arreglo las normales del tanque /*int[] adj = new int[mesh.D3dMesh.NumberFaces * 3]; * mesh.D3dMesh.GenerateAdjacency(0, adj); * mesh.D3dMesh.ComputeNormals(adj); */ // Arreglo las normales de la esfera { var adj = new int[meshX.D3dMesh.NumberFaces * 3]; meshX.D3dMesh.GenerateAdjacency(0, adj); meshX.D3dMesh.ComputeNormals(adj); } //Cargar Shader personalizado effect = TgcShaders.loadEffect(ShadersDir + "WorkshopShaders\\EnvMap.fx"); // le asigno el efecto a la malla mesh.Effect = effect; meshX.Effect = effect; vel_tanque = 10; //Centrar camara rotacional respecto a este mesh CamaraRot = new TgcRotationalCamera(mesh.BoundingBox.calculateBoxCenter(), mesh.BoundingBox.calculateBoxRadius() * 2, Input); CamaraRot.CameraDistance = 300; CamaraRot.RotationSpeed = 1.5f; Camara = CamaraRot; kx = kc = 0.5f; reflexionModifier = AddFloat("Reflexion", 0, 1, kx); refraccionModifier = AddFloat("Refraccion", 0, 1, kc); fresnelModifier = AddBoolean("Fresnel", "fresnel", true); }
/// <summary> /// Crea un SkyBox que rodea toda la cancha y da una sensacion mas de realizamo /// </summary> /// <param name="pathRecursos"> la ruta donde se encuentran los recursos </param> /// <returns></returns> private TgcSkyBox CrearSkyBox(string pathRecursos, TgcBox pisoCancha) { //Crear SkyBox TgcSkyBox skyBox = new TgcSkyBox(); skyBox.Size = new Vector3(pisoCancha.Size.X + 100, 1000, pisoCancha.Size.Z + 100); skyBox.Center = new Vector3(pisoCancha.Position.X, pisoCancha.Position.Y - 1 + skyBox.Size.Y / 2, pisoCancha.Position.Z); //Configurar las texturas para cada una de las 6 caras skyBox.setFaceTexture(TgcSkyBox.SkyFaces.Up, pathRecursos + Settings.Default.textureSkyFacesUp); skyBox.setFaceTexture(TgcSkyBox.SkyFaces.Down, pathRecursos + Settings.Default.textureSkyFaceDown); skyBox.setFaceTexture(TgcSkyBox.SkyFaces.Left, pathRecursos + Settings.Default.textureSkyFaceLeft); skyBox.setFaceTexture(TgcSkyBox.SkyFaces.Right, pathRecursos + Settings.Default.textureSkyFaceRight); //Hay veces es necesario invertir las texturas Front y Back si se pasa de un sistema RightHanded a uno LeftHanded skyBox.setFaceTexture(TgcSkyBox.SkyFaces.Front, pathRecursos + Settings.Default.textureSkyFaceFront); skyBox.setFaceTexture(TgcSkyBox.SkyFaces.Back, pathRecursos + Settings.Default.textureSkyFaceBack); //Actualizar todos los valores para crear el SkyBox skyBox.Init(); return skyBox; }