/// <summary> /// Actualizar parámetros de la pared según los valores cargados /// </summary> private void updateWall() { Device d3dDevice = GuiController.Instance.D3dDevice; //Origen, dimensiones, tiling y AutoAdjust Vector3 origin = (Vector3)GuiController.Instance.Modifiers["origin"]; Vector3 dimension = (Vector3)GuiController.Instance.Modifiers["dimension"]; Vector2 tiling = (Vector2)GuiController.Instance.Modifiers["tiling"]; bool autoAdjust = (bool)GuiController.Instance.Modifiers["autoAdjust"]; //Cambiar orienación string orientation = (string)GuiController.Instance.Modifiers["orientation"]; TgcPlaneWall.Orientations or; if (orientation == "XY") { or = TgcPlaneWall.Orientations.XYplane; } else if (orientation == "XZ") { or = TgcPlaneWall.Orientations.XZplane; } else { or = TgcPlaneWall.Orientations.YZplane; } //Cambiar textura string text = (string)GuiController.Instance.Modifiers["texture"]; if (text != currentTexture.FilePath) { currentTexture = TgcTexture.createTexture(d3dDevice, text); wall.setTexture(currentTexture); } //Aplicar valores en pared wall.Origin = origin; wall.Size = dimension; wall.Orientation = or; wall.AutoAdjustUv = autoAdjust; wall.UTile = tiling.X; wall.VTile = tiling.Y; //Es necesario ejecutar updateValues() para que los cambios tomen efecto wall.updateValues(); //Ajustar camara segun tamaño de la pared GuiController.Instance.RotCamera.targetObject(wall.BoundingBox); }
public Skybox() { string skyTexPath = GuiController.Instance.AlumnoEjemplosMediaDir + "Jet_Pilot\\" + "Skybox\\"; TgcTexture texture; up = new TgcPlaneWall(); texture = TgcTexture.createTexture(GuiController.Instance.D3dDevice, skyTexPath + "up.jpg"); up.setTexture(texture); up.Origin = new Vector3(-size * 0.5f, size * 0.5f, size * 0.5f); up.Size = new Vector3(size, size, -size); up.Orientation = TgcPlaneWall.Orientations.XZplane; //dn = new TgcPlaneWall(); //texture = TgcTexture.createTexture(GuiController.Instance.D3dDevice, skyTexPath + "dn.jpg"); //dn.setTexture(texture); //dn.Origin = new Vector3(-size * 0.5f, -size * 0.5f, -size * 0.5f); //dn.Size = new Vector3(size, size, size); //dn.Orientation = TgcPlaneWall.Orientations.XZplane; lt = new TgcPlaneWall(); texture = TgcTexture.createTexture(GuiController.Instance.D3dDevice, skyTexPath + "bk.jpg"); lt.setTexture(texture); lt.Origin = new Vector3(size * 0.5f, -size * 0.5f, size * 0.5f); lt.Size = new Vector3(size, size, -size); lt.Orientation = TgcPlaneWall.Orientations.YZplane; rt = new TgcPlaneWall(); texture = TgcTexture.createTexture(GuiController.Instance.D3dDevice, skyTexPath + "ft.jpg"); rt.setTexture(texture); rt.Origin = new Vector3(-size * 0.5f, -size * 0.5f, -size * 0.5f); rt.Size = new Vector3(size, size, size); rt.Orientation = TgcPlaneWall.Orientations.YZplane; ft = new TgcPlaneWall(); texture = TgcTexture.createTexture(GuiController.Instance.D3dDevice, skyTexPath + "lf.jpg"); ft.setTexture(texture); ft.Origin = new Vector3(size * 0.5f, -size * 0.5f, -size * 0.5f); ft.Size = new Vector3(-size, size, size); ft.Orientation = TgcPlaneWall.Orientations.XYplane; bk = new TgcPlaneWall(); texture = TgcTexture.createTexture(GuiController.Instance.D3dDevice, skyTexPath + "rt.jpg"); bk.setTexture(texture); bk.Origin = new Vector3(-size * 0.5f, -size * 0.5f, size * 0.5f); bk.Size = new Vector3(size, size, size); bk.Orientation = TgcPlaneWall.Orientations.XYplane; this.Reset(); }
/// <summary> /// Actualizar parámetros de la pared según los valores cargados /// </summary> private void updateWall() { //Origen, dimensiones, tiling y AutoAdjust var origin = (Vector3)Modifiers["origin"]; var dimension = (Vector3)Modifiers["dimension"]; var tiling = (Vector2)Modifiers["tiling"]; var autoAdjust = (bool)Modifiers["autoAdjust"]; //Cambiar orienación var orientation = (string)Modifiers["orientation"]; TgcPlaneWall.Orientations or; if (orientation == "XY") { or = TgcPlaneWall.Orientations.XYplane; } else if (orientation == "XZ") { or = TgcPlaneWall.Orientations.XZplane; } else { or = TgcPlaneWall.Orientations.YZplane; } //Cambiar textura var text = (string)Modifiers["texture"]; if (text != currentTexture.FilePath) { currentTexture = TgcTexture.createTexture(D3DDevice.Instance.Device, text); wall.setTexture(currentTexture); } //Aplicar valores en pared wall.Origin = origin; wall.Size = dimension; wall.Orientation = or; wall.AutoAdjustUv = autoAdjust; wall.UTile = tiling.X; wall.VTile = tiling.Y; //Es necesario ejecutar updateValues() para que los cambios tomen efecto wall.updateValues(); //Ajustar camara segun tamaño de la pared Camara = new TgcRotationalCamera(wall.BoundingBox.calculateBoxCenter(), wall.BoundingBox.calculateBoxRadius() * 2); }
public override void render(float elapsedTime) { Device d3dDevice = GuiController.Instance.D3dDevice; updateWall(); string text = (string)GuiController.Instance.Modifiers["texture"]; if (text != currentTexture.FilePath) { currentTexture = TgcTexture.createTexture(d3dDevice, text); wall.setTexture(currentTexture); } wall.render(); mesh.render(); }
public override void Render() { PreRender(); var d3dDevice = D3DDevice.Instance.Device; updateWall(); var text = (string)Modifiers["texture"]; if (text != currentTexture.FilePath) { currentTexture = TgcTexture.createTexture(d3dDevice, text); wall.setTexture(currentTexture); } wall.render(); mesh.render(); PostRender(); }
public void animateTexture() { int i = 0; if (MUZZLE_DELAY <= MAX_DELAY && MUZZLE_DELAY > 0.05f) { i = 0; } if (MUZZLE_DELAY < 0.05f && MUZZLE_DELAY > 0) { i = 1; } if (MUZZLE_DELAY <= 0) { i = 2; } Device d3dDevice = GuiController.Instance.D3dDevice; string texturePath = GuiController.Instance.AlumnoEjemplosMediaDir + "Los_Borbotones\\Sprites\\" + textures_flash[i]; TgcTexture pasto_texture = TgcTexture.createTexture(d3dDevice, texturePath); muzzleFlash.setTexture(pasto_texture); }
public void crearPasto(Device d3dDevice, int pastoSecuense, Vector3 origen) { string textureName = "pasto1.png"; switch (pastoSecuense) { case 0: textureName = "pasto3.png"; break; case 1: textureName = "pasto2.png"; break; case 2: textureName = "pasto1.png"; break; } string texturePath = GuiController.Instance.AlumnoEjemplosMediaDir + "Los_Borbotones\\Mapas\\Textures\\" + textureName; TgcTexture pasto_texture = TgcTexture.createTexture(d3dDevice, texturePath); //Crear pared TgcPlaneWall pastoWall = new TgcPlaneWall(); pastoWall.AlphaBlendEnable = true; pastoWall.setTexture(pasto_texture); //Aplicar valores en pared pastoWall.Origin = origen; pastoWall.Size = new Vector3(36, 30, 36); pastoWall.AutoAdjustUv = true; pastoWall.UTile = 1; pastoWall.VTile = 1; pastoWall.updateValues(); partePasto.Add(pastoWall); }
public void crearMuzzle() { Device d3dDevice = GuiController.Instance.D3dDevice; textures_flash.Add("flash1.png"); textures_flash.Add("flash2.png"); textures_flash.Add("flash3.png"); MAX_RENDER = MAX_DELAY + MAX_DELAY / 2; string texturePath = GuiController.Instance.AlumnoEjemplosMediaDir + "Los_Borbotones\\Sprites\\" + textures_flash[0]; TgcTexture pasto_texture = TgcTexture.createTexture(d3dDevice, texturePath); //Crear pared muzzleFlash = new TgcPlaneWall(); muzzleFlash.AlphaBlendEnable = true; muzzleFlash.setTexture(pasto_texture); //Aplicar valores en pared //muzzleFlash.Origin = new Vector3(-50, 917.8f, 4.1f); muzzleFlash.Size = new Vector3(14, 14, 14); muzzleFlash.AutoAdjustUv = false; muzzleFlash.UTile = 1; muzzleFlash.VTile = 1; //Offsets /* * BLoffset = new Vector3(-100, -17.7f, 14.7f); * TLoffset = new Vector3(-100, -17.7f, 14.7f + muzzleFlash.Size.Z); * BRoffset = new Vector3(-100, -17.7f + muzzleFlash.Size.Y, 14.7f); * TRoffset = new Vector3(-100, -17.7f + muzzleFlash.Size.Y, 14.7f + muzzleFlash.Size.Z); */ BLoffset = new Vector3(3.5f, -12f, 50); TLoffset = new Vector3(3.5f + muzzleFlash.Size.X, -12f, 50); BRoffset = new Vector3(3.5f, -12f + muzzleFlash.Size.Y, 50); TRoffset = new Vector3(3.5f + muzzleFlash.Size.X, -12f + muzzleFlash.Size.Y, 50); }
public override void Init() { //Modifiers para variar parámetros de la pared Modifiers.addVertex3f("origin", new Vector3(-100, -100, -100), new Vector3(100, 100, 100), new Vector3(0, 0, 0)); Modifiers.addVertex3f("dimension", new Vector3(-100, -100, -100), new Vector3(1000, 1000, 100), new Vector3(100, 100, 100)); Modifiers.addInterval("orientation", new[] { "XY", "XZ", "YZ" }, 0); Modifiers.addVertex2f("tiling", new Vector2(0, 0), new Vector2(10, 10), new Vector2(1, 1)); Modifiers.addBoolean("autoAdjust", "autoAdjust", false); //Modifier de textura var texturePath = MediaDir + "Texturas\\Quake\\TexturePack2\\brick1_1.jpg"; currentTexture = TgcTexture.createTexture(D3DDevice.Instance.Device, texturePath); Modifiers.addTexture("texture", currentTexture.FilePath); //Crear pared wall = new TgcPlaneWall(); wall.setTexture(currentTexture); //Actualizar según valores cargados updateWall(); }
public override void setTexture(TgcTexture texture, int slot) { mesh.setTexture(texture); }