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(); }
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); }
public override void Init() { //Crear SkyBox skyBox = new TgcSkyBox(); skyBox.Center = new Vector3(0, 0, 0); skyBox.Size = new Vector3(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.InitSkyBox(); //Modifier para ver BoundingBox Modifiers.addBoolean("moveWhitCamera", "Move Whit Camera", false); Camara = new TgcFpsCamera(); }
/// <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(); }
public override void init() { Device d3dDevice = GuiController.Instance.D3dDevice; string texturesPath = GuiController.Instance.ExamplesMediaDir + "Texturas\\Quake\\SkyBox1\\"; //Crear SkyBox skyBox = new TgcSkyBox(); skyBox.Center = new Vector3(0, 0, 0); skyBox.Size = new Vector3(1000, 1000, 1000); //Configurar color //skyBox.Color = Color.OrangeRed; //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"); //Actualizar todos los valores para crear el SkyBox skyBox.updateValues(); GuiController.Instance.FpsCamera.Enable = 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; }
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(); }
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; }
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); }
public override void init() { Microsoft.DirectX.Direct3D.Device d3dDevice = GuiController.Instance.D3dDevice; setConfigVars(); //Cargar escenario específico para este ejemplo TgcSceneLoader loader = new TgcSceneLoader(); escenario = loader.loadSceneFromFile(GuiController.Instance.ExamplesDir + "\\Collision\\SphereCollision\\PatioDeJuegos\\PatioDeJuegos-TgcScene.xml"); //Configurar camara en Tercer Persona camara = new Camara(); camara.Enable = true; camara.TargetDisplacement = new Vector3(0, 100, 0); movimientoController = new MovimientoController(camara); camara.setCamera(movimientoController.getPersonaje().Position, 100, -400); //Almacenar volumenes de colision del escenario objetosColisionables.Clear(); foreach (TgcMesh mesh in escenario.Meshes) { objetosColisionables.Add(mesh.BoundingBox); } movimientoController.setObjetosColisionables(objetosColisionables); //Crear SkyBox skyBox = new TgcSkyBox(); skyBox.Center = new Vector3(0, 0, 0); skyBox.Size = new Vector3(10000, 10000, 10000); string texturesPath = GuiController.Instance.ExamplesMediaDir + "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.updateValues(); //Modifier para ver BoundingBox GuiController.Instance.Modifiers.addBoolean("showBoundingBox", "Bouding Box", verLasEsferas); //Modifiers para desplazamiento del personaje GuiController.Instance.Modifiers.addFloat("VelocidadCaminar", 0, 100, 5); GuiController.Instance.Modifiers.addFloat("VelocidadRotacion", 1f, 360f, 150f); GuiController.Instance.Modifiers.addBoolean("HabilitarGravedad", "Habilitar Gravedad", true); GuiController.Instance.Modifiers.addVertex3f("Gravedad", new Vector3(-50, -50, -50), new Vector3(50, 50, 50), new Vector3(0, -10, 0)); GuiController.Instance.Modifiers.addFloat("SlideFactor", 1f, 2f, 1.3f); GuiController.Instance.UserVars.addVar("Movement"); }
public void skyboxTormentoso(TgcSkyBox skyBox) { string texturesPath = GuiController.Instance.AlumnoEjemplosMediaDir + "grave\\"; skyBox.setFaceTexture(TgcSkyBox.SkyFaces.Up, texturesPath + "grave_top.jpg"); skyBox.setFaceTexture(TgcSkyBox.SkyFaces.Down, texturesPath + "grave_top.jpg"); skyBox.setFaceTexture(TgcSkyBox.SkyFaces.Left, texturesPath + "grave_left.jpg"); skyBox.setFaceTexture(TgcSkyBox.SkyFaces.Right, texturesPath + "grave_right.jpg"); skyBox.setFaceTexture(TgcSkyBox.SkyFaces.Front, texturesPath + "grave_front.jpg"); skyBox.setFaceTexture(TgcSkyBox.SkyFaces.Back, texturesPath + "grave_back.jpg"); skyBox.SkyEpsilon = 50f; skyBox.updateValues(); }
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 cargarTexturas() { string texturesPath = GuiController.Instance.AlumnoEjemplosMediaDir + "RenderGroup\\texturas\\celeste\\"; //Configurar las texturas para cada una de las 6 caras skyBox.setFaceTexture(TgcSkyBox.SkyFaces.Up, texturesPath + "topax2.png"); skyBox.setFaceTexture(TgcSkyBox.SkyFaces.Down, texturesPath + "algo.png"); skyBox.setFaceTexture(TgcSkyBox.SkyFaces.Left, texturesPath + "cielo.png"); skyBox.setFaceTexture(TgcSkyBox.SkyFaces.Right, texturesPath + "cielo.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, texturesPath + "cielo.png"); skyBox.setFaceTexture(TgcSkyBox.SkyFaces.Back, texturesPath + "cielo.png"); //Configurar color //skyBox.Color = Color.OrangeRed; }
private void crearNivel2() { //El segundo nivel quedó a medio hacer, la idea era tener un nivel por personaje TgcBox piso; TgcSimpleTerrain terrain; string currentHeightmap; string currentTexture; float currentScaleXZ; float currentScaleY; //Path de Heightmap default del terreno y Modifier para cambiarla currentHeightmap = GuiController.Instance.ExamplesMediaDir + "Heighmaps\\" + "Heightmap2.jpg"; //Modifiers para variar escala del mapa currentScaleXZ = 20f; currentScaleY = 1.3f; //Path de Textura default del terreno y Modifier para cambiarla currentTexture = GuiController.Instance.ExamplesMediaDir + "Heighmaps\\" + "TerrainTexture2.jpg"; //Cargar terreno: cargar heightmap y textura de color terrain = new TgcSimpleTerrain(); terrain.loadHeightmap(currentHeightmap, currentScaleXZ, currentScaleY, new Vector3(50, -120, 50)); terrain.loadTexture(currentTexture); TgcTexture textura = TgcTexture.createTexture(GuiController.Instance.D3dDevice, GuiController.Instance.AlumnoEjemplosMediaDir + "LosBorbotones\\escenario\\pista3.jpg"); piso = TgcBox.fromSize(new Vector3(0, 0, 0), new Vector3(15000, 0, 5000), textura); //es un cubo plano con una textura (foto de la pista) cielo = new TgcSkyBox(); cielo.Center = new Vector3(0, 500, 0); cielo.Size = new Vector3(20000, 5000, 20000); string texturesPath = GuiController.Instance.ExamplesMediaDir + "Texturas\\Quake\\SkyBox LostAtSeaDay\\"; cielo.setFaceTexture(TgcSkyBox.SkyFaces.Up, texturesPath + "lostatseaday_up.jpg"); cielo.setFaceTexture(TgcSkyBox.SkyFaces.Down, texturesPath + "lostatseaday_dn.jpg"); cielo.setFaceTexture(TgcSkyBox.SkyFaces.Left, texturesPath + "lostatseaday_lf.jpg"); cielo.setFaceTexture(TgcSkyBox.SkyFaces.Right, texturesPath + "lostatseaday_rt.jpg"); cielo.setFaceTexture(TgcSkyBox.SkyFaces.Front, texturesPath + "lostatseaday_bk.jpg"); cielo.setFaceTexture(TgcSkyBox.SkyFaces.Back, texturesPath + "lostatseaday_ft.jpg"); cielo.updateValues(); cajas.Add(piso); terrenos.Add(terrain); }
public Escenario() { Device d3dDevice = GuiController.Instance.D3dDevice; skyBox = new TgcSkyBox(); skyBox.Center = new Vector3(0, -20, 0); skyBox.Size = new Vector3(50, 100, 50); string texturesPath = GuiController.Instance.ExamplesMediaDir + "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.updateValues(); }
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(); }
public override void init() { Device d3dDevice = GuiController.Instance.D3dDevice; //Crear SkyBox skyBox = new TgcSkyBox(); skyBox.Center = new Vector3(0, 500, 0); skyBox.Size = new Vector3(10000, 10000, 10000); string texturesPath = GuiController.Instance.ExamplesMediaDir + "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.updateValues(); //Cargar escenario de Isla TgcSceneLoader loader = new TgcSceneLoader(); TgcScene scene = loader.loadSceneFromFile(GuiController.Instance.ExamplesDir + "Optimizacion\\Isla\\Isla-TgcScene.xml"); //Separar el Terreno del resto de los objetos List <TgcMesh> list1 = new List <TgcMesh>(); scene.separeteMeshList(new string[] { "Terreno" }, out list1, out objetosIsla); terreno = list1[0]; //Crear grilla grilla = new GrillaRegular(); grilla.create(objetosIsla, scene.BoundingBox); grilla.createDebugMeshes(); //Camara en 1ra persona GuiController.Instance.FpsCamera.Enable = true; GuiController.Instance.FpsCamera.setCamera(new Vector3(1500, 800, 0), new Vector3(0, 0, -1)); GuiController.Instance.FpsCamera.MovementSpeed = 500f; GuiController.Instance.FpsCamera.JumpSpeed = 500f; GuiController.Instance.Modifiers.addBoolean("showGrid", "Show Grid", false); GuiController.Instance.Modifiers.addBoolean("showTerrain", "Show Terrain", true); }
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(); }
private void crearSkyBoxDia() { // Crear SkyBox: skyBox = new TgcSkyBox(); skyBox.Center = new Vector3(0, 0, 0); skyBox.Size = new Vector3(LIMITEX_SBOX, LIMITEY_SBOX, LIMITEZ_SBOX); string texturesPath = GuiController.Instance.AlumnoEjemplosMediaDir + "Dunedains\\Texturas\\Skybox\\"; skyBox.setFaceTexture(TgcSkyBox.SkyFaces.Up, texturesPath + "dune2_up.jpg"); skyBox.setFaceTexture(TgcSkyBox.SkyFaces.Down, texturesPath + "dune2_dn.jpg"); skyBox.setFaceTexture(TgcSkyBox.SkyFaces.Front, texturesPath + "dune2_ft.jpg"); skyBox.setFaceTexture(TgcSkyBox.SkyFaces.Back, texturesPath + "dune2_bk.jpg"); skyBox.setFaceTexture(TgcSkyBox.SkyFaces.Right, texturesPath + "dune2_rt.jpg"); skyBox.setFaceTexture(TgcSkyBox.SkyFaces.Left, texturesPath + "dune2_lt.jpg"); skyBox.SkyEpsilon = 50f; skyBox.updateValues(); }
private void crearSkyBoxNoche() { // Crear SkyBox: skyBox = new TgcSkyBox(); skyBox.Center = new Vector3(0, 0, 0); skyBox.Size = new Vector3(LIMITEX_SBOX, LIMITEY_SBOX, LIMITEZ_SBOX); /*string texturesPath = GuiController.Instance.ExamplesMediaDir + "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.Front, texturesPath + "lostatseaday_lf.jpg"); * skyBox.setFaceTexture(TgcSkyBox.SkyFaces.Back, texturesPath + "lostatseaday_bk.jpg"); * skyBox.setFaceTexture(TgcSkyBox.SkyFaces.Right, texturesPath + "lostatseaday_rt.jpg"); * skyBox.setFaceTexture(TgcSkyBox.SkyFaces.Left, texturesPath + "lostatseaday_ft.jpg");*/ //string texturesPath = GuiController.Instance.ExamplesMediaDir + "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.Front, texturesPath + "lun4_lf.jpg"); //skyBox.setFaceTexture(TgcSkyBox.SkyFaces.Back, texturesPath + "lun4_bk.jpg"); //skyBox.setFaceTexture(TgcSkyBox.SkyFaces.Right, texturesPath + "lun4_rt.jpg"); //skyBox.setFaceTexture(TgcSkyBox.SkyFaces.Left, texturesPath + "lun4_ft.jpg"); /*string texturesPath = GuiController.Instance.AlumnoEjemplosMediaDir + "Dunedains\\Texturas\\"; * skyBox.setFaceTexture(TgcSkyBox.SkyFaces.Up, texturesPath + "nublado.jpg"); * skyBox.setFaceTexture(TgcSkyBox.SkyFaces.Down, texturesPath + "lostatseaday_dn.jpg"); * skyBox.setFaceTexture(TgcSkyBox.SkyFaces.Front, texturesPath + "noche.jpg"); * skyBox.setFaceTexture(TgcSkyBox.SkyFaces.Back, texturesPath + "nublado.jpg"); * skyBox.setFaceTexture(TgcSkyBox.SkyFaces.Right, texturesPath + "nublado.jpg"); * skyBox.setFaceTexture(TgcSkyBox.SkyFaces.Left, texturesPath + "nublado.jpg");*/ string texturesPath = GuiController.Instance.AlumnoEjemplosMediaDir + "Dunedains\\Texturas\\Skybox\\"; skyBox.setFaceTexture(TgcSkyBox.SkyFaces.Up, texturesPath + "dune3_up.jpg"); skyBox.setFaceTexture(TgcSkyBox.SkyFaces.Down, texturesPath + "dune3_dn.jpg"); skyBox.setFaceTexture(TgcSkyBox.SkyFaces.Front, texturesPath + "dune3_ft.jpg"); skyBox.setFaceTexture(TgcSkyBox.SkyFaces.Back, texturesPath + "dune3_bk.jpg"); skyBox.setFaceTexture(TgcSkyBox.SkyFaces.Right, texturesPath + "dune3_rt.jpg"); skyBox.setFaceTexture(TgcSkyBox.SkyFaces.Left, texturesPath + "dune3_lt.jpg"); skyBox.SkyEpsilon = 50f; skyBox.updateValues(); }
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); }
/// <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; }