/// <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() { //Device de DirectX para crear primitivas. var d3dDevice = D3DDevice.Instance.Device; timestamp = DateTime.Now; //Utilizando esta propiedad puedo activar el update/render a intervalos constantes. FixedTickEnable = true; //Se puede configurar el tiempo en estas propiedades TimeBetweenUpdates y TimeBetweenRenders, por defecto esta puedo en 1F / FPS_60 es a lo minimo que deberia correr el TP. //De no estar a gusto como se ejecuta el metodo Tick (el que maneja el GameLoop) el mismo es virtual con lo cual pueden sobrescribirlo. //Esconder cursor focusWindows = d3dDevice.CreationParameters.FocusWindow; mousePosition = focusWindows.PointToScreen(new Point(focusWindows.Width / 2, focusWindows.Height / 2)); //Cursor.Hide(); Sounds.SoundsManager.Instance().sound = DirectSound.DsDevice; Sounds.SoundsManager.Instance().mediaDir = MediaDir; //Burbujas D3DDevice.Instance.ParticlesEnabled = true; D3DDevice.Instance.EnableParticles(); Particulas.Init(MediaDir, 20); //Oceano Oceano.Init(TGCVector3.Up * nivelDelAgua * 0.8f, 100, 100, ShadersDir); //Settear jugador y camara FPSCamara = new FPSCamara(Camera, Input); Player = Player.Instance(); Player.SetInput(Input); Player.Init(FPSCamara); //Inicializar camara var cameraPosition = new TGCVector3(0, 100, -250); var lookAt = new TGCVector3(0, nivelDelAgua, 0); Camera.SetCamera(cameraPosition, lookAt); sonidoUnderwater = new TgcStaticSound(); sonidoUnderwater.loadSound(MediaDir + "Sounds\\mar.wav", DirectSound.DsDevice); effect = TGCShaders.Instance.LoadEffect(ShadersDir + "e_fog.fx"); efectoInterior = TGCShaders.Instance.LoadEffect(ShadersDir + "interior.fx"); //Iniciar HUD Hud.Init(MediaDir); Hud.ChangeStatus(Hud.Status.MainMenu); //Cargar enviroment oceano = new Fondo(MediaDir, ShadersDir); oceano.Init(); oceano.Camera = Camera; heightmap = new TgcSimpleTerrain(); heightmap.loadHeightmap(MediaDir + marBnwDir, marScaleXZ, marScaleY, new TGCVector3(0, marOffsetY, 0)); heightmap.loadTexture(MediaDir + marTexDir); //Cargar entidades var loader = new TgcSceneLoader(); var scene = loader.loadSceneFromFile(MediaDir + "yellow_fish-TgcScene.xml"); var mesh = scene.Meshes[0]; peces = new List <Fish>(); corales = new List <Coral>(); metales = new List <Metal>(); piedras = new List <Metal>(); int i = 0; while (i < 20) { Fish fish; string meshName = i.ToString(); fish = new Fish(mesh.clone(meshName)); fish = (Fish)setearMeshParaLista(fish, i); peces.Add(fish); fish.Effect(effect); fish.Technique("RenderScene"); i++; } scene = loader.loadSceneFromFile(MediaDir + "shark-TgcScene.xml"); mesh = scene.Meshes[0]; shark = new Shark(mesh); shark.Init(); sharkSound = new Tgc3dSound(MediaDir + "Sounds\\shark.wav", shark.GetMesh().Position, DirectSound.DsDevice); shark.setearSonido(sharkSound); shark.setearAlturaMaxima(nivelDelAgua - 19f); efectoDesaparecer = TGCShaders.Instance.LoadEffect(ShadersDir + "perlin.fx"); shark.setearEfectoPerlin(efectoDesaparecer); perlinTexture = TgcTexture.createTexture(D3DDevice.Instance.Device, MediaDir + "Textures\\perlin.png"); shark.setearPerlin(perlinTexture); scene = loader.loadSceneFromFile(MediaDir + "coral-TgcScene.xml"); mesh = scene.Meshes[0]; i = 0; while (i < 25) { Coral coral; string meshName = i.ToString(); coral = new Coral(mesh.createMeshInstance(meshName)); coral = (Coral)setearMeshParaLista(coral, i * 4, -17); corales.Add(coral); coral.Effect(effect); coral.Technique("RenderScene"); i++; } scene = loader.loadSceneFromFile(MediaDir + "Oro-TgcScene.xml"); mesh = scene.Meshes[0]; i = 0; while (i < 15) { Metal oro; string meshName = i.ToString(); oro = new Metal(mesh.createMeshInstance(meshName)); oro = (Metal)setearMeshParaLista(oro, i * 8, -17); oro.Tipo = ElementoRecolectable.oro; metales.Add(oro); oro.Effect(effect); oro.Technique("RenderSceneLight"); i++; } scene = loader.loadSceneFromFile(MediaDir + "Hierro-TgcScene.xml"); mesh = scene.Meshes[0]; i = 0; while (i < 15) { Metal hierro; string meshName = i.ToString() + i.ToString(); hierro = new Metal(mesh.createMeshInstance(meshName)); hierro = (Metal)setearMeshParaLista(hierro, (i + 10) * 8, -17); hierro.Tipo = ElementoRecolectable.hierro; metales.Add(hierro); hierro.Effect(effect); hierro.Technique("RenderScene"); i++; } scene = loader.loadSceneFromFile(MediaDir + "Roca-TgcScene.xml"); mesh = scene.Meshes[0]; i = 0; while (i < 15) { Metal roca; string meshName = i.ToString() + i.ToString() + i.ToString(); roca = new Metal(mesh.createMeshInstance(meshName)); roca = (Metal)setearMeshParaLista(roca, (i + 10) * 8, -17); roca.Tipo = ElementoRecolectable.madera; roca.escalar(new TGCVector3(0.3f, 0.3f, 0.3f)); piedras.Add(roca); roca.Effect(effect); roca.Technique("RenderScene"); i++; } scene = loader.loadSceneFromFile(MediaDir + "ship-TgcScene.xml"); nave = Nave.Instance(); nave.Init(scene, nivelDelAgua); scene = loader.loadSceneFromFile(MediaDir + "EspadaDoble-TgcScene.xml"); mesh = scene.Meshes[0]; arma = new Arma(mesh); scene = loader.loadSceneFromFile(MediaDir + "Mesa-TgcScene.xml"); mesaNave = MesaNave.Instance(); mesaNave.Init(scene); mesaNave.Effect(efectoInterior); mesaNave.Technique("RenderScene"); scene = loader.loadSceneFromFile(MediaDir + "SogaEnrollada-TgcScene.xml"); mesh = scene.Meshes[0]; sogaInterior = SogaInterior.Instance(); sogaInterior.Init(mesh); sogaInterior.Effect(efectoInterior); sogaInterior.Technique("RenderScene"); scene = loader.loadSceneFromFile(MediaDir + "silla-TgcScene.xml"); sillaInterior = SillaInterior.Instance(); sillaInterior.Init(scene); sillaInterior.Effect(efectoInterior); sillaInterior.Technique("RenderScene"); scene = loader.loadSceneFromFile(MediaDir + "Timon-TgcScene.xml"); timonInterior = TimonInterior.Instance(); timonInterior.Init(scene); timonInterior.Effect(efectoInterior); timonInterior.Technique("RenderScene"); scene = loader.loadSceneFromFile(MediaDir + "LamparaTecho-TgcScene.xml"); lamparaNave = new LamparaNave(scene.Meshes[0]); lamparaNave.Effect(efectoInterior); lamparaNave.Technique("RenderScene"); //Cargar shaders fog = new TgcFog(); fog.Color = Color.FromArgb(30, 144, 255); fog.Density = 1; fog.EndDistance = 1000; fog.StartDistance = 1; fog.Enabled = true; effect.SetValue("screen_dx", d3dDevice.PresentationParameters.BackBufferWidth); effect.SetValue("screen_dy", d3dDevice.PresentationParameters.BackBufferHeight); //Fog + Lights effect.SetValue("nivelAgua", nivelDelAgua); interiorNave = InteriorNave.Instance(); interiorNave.Init(MediaDir); DirectSound.ListenerTracking = Player.Instance().mesh; //Mascara post process maskTexture = TgcTexture.createTexture(D3DDevice.Instance.Device, MediaDir + "Textures\\mascara.png"); effect.SetValue("textura_mascara", maskTexture.D3dTexture); // seteamos los efectos aca porque son fijos oceano.Effect(effect); oceano.Technique("RenderScene"); heightmap.Effect = effect; heightmap.Technique = "RenderScene"; shark.Effect(effect); shark.Technique("RenderScene"); nave.Effect(effect); nave.Technique("RenderSceneLight"); effect.SetValue("ambientColor", Color.FromArgb(255, 255, 255).ToArgb()); effect.SetValue("diffuseColor", Color.FromArgb(255, 255, 255).ToArgb()); effect.SetValue("specularColor", Color.FromArgb(255, 255, 255).ToArgb()); efectoInterior.SetValue("ambientColor", Color.FromArgb(255, 255, 255).ToArgb()); efectoInterior.SetValue("diffuseColor", Color.FromArgb(255, 255, 255).ToArgb()); efectoInterior.SetValue("specularColor", Color.FromArgb(255, 255, 255).ToArgb()); // dibujo el full screen quad 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 fullScreenQuad = new VertexBuffer(typeof(CustomVertex.PositionTextured), 4, d3dDevice, Usage.Dynamic | Usage.WriteOnly, CustomVertex.PositionTextured.Format, Pool.Default); fullScreenQuad.SetData(vertices, 0, LockFlags.None); // dibujo render target depthStencil = d3dDevice.CreateDepthStencilSurface(d3dDevice.PresentationParameters.BackBufferWidth, d3dDevice.PresentationParameters.BackBufferHeight, DepthFormat.D24S8, MultiSampleType.None, 0, true); renderTarget = new Texture(d3dDevice, d3dDevice.PresentationParameters.BackBufferWidth, d3dDevice.PresentationParameters.BackBufferHeight, 1, Usage.RenderTarget, Format.X8R8G8B8, Pool.Default); // inicializo los FB que uso para el Bloom coralesBrillantes = new Texture(d3dDevice, d3dDevice.PresentationParameters.BackBufferWidth, d3dDevice.PresentationParameters.BackBufferHeight, 1, Usage.RenderTarget, Format.X8R8G8B8, Pool.Default); FBHorizontalBool = new Texture(d3dDevice, d3dDevice.PresentationParameters.BackBufferWidth, d3dDevice.PresentationParameters.BackBufferHeight, 1, Usage.RenderTarget, Format.X8R8G8B8, Pool.Default); FBVerticalBloom = new Texture(d3dDevice, d3dDevice.PresentationParameters.BackBufferWidth, d3dDevice.PresentationParameters.BackBufferHeight, 1, Usage.RenderTarget, Format.X8R8G8B8, Pool.Default); }
public unsafe override void Init() { Device d3dDevice = GuiController.Instance.D3dDevice; GuiController.Instance.CustomRenderEnabled = true; MyMediaDir = MediaDir + "WorkshopShaders\\"; MyShaderDir = ShadersDir + "WorkshopShaders\\"; time = 0f; vel_x = new float[MAX_DS, MAX_DS]; vel_z = new float[MAX_DS, MAX_DS]; pos_x = new float[MAX_DS, MAX_DS]; pos_y = new float[MAX_DS, MAX_DS]; pos_z = new float[MAX_DS, MAX_DS]; //Crear loader TgcSceneLoader loader = new TgcSceneLoader(); // ------------------------------------------------------------ //Path de Heightmap default del terreno y Path de Textura default del terreno TGCVector3 PosTerrain = new TGCVector3(0, 0, 0); currentHeightmap = MyMediaDir + "Heighmaps\\" + "Heightmap2.jpg"; currentScaleXZ = 100f; currentScaleY = 6f; currentTexture = MyMediaDir + "Heighmaps\\" + "Heightmap2.JPG"; //+ "grid.JPG"; terrain = new TgcSimpleTerrain(); terrain.loadHeightmap(currentHeightmap, currentScaleXZ, currentScaleY, PosTerrain); terrain.loadTexture(currentTexture); // tomo el ancho de la textura, ojo tiene que ser cuadrada float terrain_width = (float)terrain.HeightmapData.GetLength(0); // mesh principal scene = loader.loadSceneFromFile(MediaDir + "ModelosTgc\\Sphere\\Sphere-TgcScene.xml"); Bitmap b = (Bitmap)Bitmap.FromFile(MyMediaDir + "Heighmaps\\grid.jpg"); g_pBaseTexture = Texture.FromBitmap(d3dDevice, b, Usage.None, Pool.Managed); b.Dispose(); mesh = scene.Meshes[0]; mesh.Scale = new TGCVector3(0.5f, 0.5f, 0.5f); mesh.Position = new TGCVector3(0f, 0f, 0f); mesh.AutoTransformEnable = false; TGCVector3 size = mesh.BoundingBox.calculateSize(); esfera_radio = Math.Abs(size.Y) / 2; //Cargar Shader string compilationErrors; effect = Effect.FromFile(d3dDevice, MyShaderDir + "GPUCompute.fx", null, null, ShaderFlags.None, null, out compilationErrors); if (effect == null) { throw new Exception("Error al cargar shader. Errores: " + compilationErrors); } //Configurar Technique effect.Technique = "DefaultTechnique"; effect.SetValue("map_size", terrain_width); effect.SetValue("map_desf", 0.5f / terrain_width); arrow = new TgcArrow(); arrow.Thickness = 1f; arrow.HeadSize = new TGCVector2(2f, 2f); arrow.BodyColor = Color.Blue; arrowN = new TgcArrow(); arrowN.Thickness = 1f; arrowN.HeadSize = new TGCVector2(2f, 2f); arrowN.BodyColor = Color.Red; arrowT = new TgcArrow(); arrowT.Thickness = 1f; arrowT.HeadSize = new TGCVector2(2f, 2f); arrowT.BodyColor = Color.Green; GuiController.Instance.RotCamera.CameraCenter = new TGCVector3(0, 0, 0); GuiController.Instance.RotCamera.CameraDistance = 3200; GuiController.Instance.RotCamera.RotationSpeed = 2f; LookAt = new TGCVector3(0, 0, 0); LookFrom = new TGCVector3(3200, 3000, 3200); float aspectRatio = (float)GuiController.Instance.Panel3d.Width / GuiController.Instance.Panel3d.Height; GuiController.Instance.CurrentCamera.updateCamera(); d3dDevice.Transform.Projection = TGCMatrix.PerspectiveFovLH(Geometry.DegreeToRadian(45.0f), aspectRatio, 5f, 40000f); // Creo el mapa de velocidad g_pVelocidad = new Texture(d3dDevice, MAX_DS, MAX_DS, 1, Usage.RenderTarget, Format.A32B32G32R32F, Pool.Default); g_pVelocidadOut = new Texture(d3dDevice, MAX_DS, MAX_DS, 1, Usage.RenderTarget, Format.A32B32G32R32F, Pool.Default); // Mapa de Posicion g_pPos = new Texture(d3dDevice, MAX_DS, MAX_DS, 1, Usage.RenderTarget, Format.A32B32G32R32F, Pool.Default); g_pPosOut = new Texture(d3dDevice, MAX_DS, MAX_DS, 1, Usage.RenderTarget, Format.A32B32G32R32F, Pool.Default); // stencil compatible sin multisampling g_pDepthStencil = d3dDevice.CreateDepthStencilSurface(MAX_DS, MAX_DS, DepthFormat.D24S8, MultiSampleType.None, 0, true); // temporaria para recuperar los valores g_pTempVel = new Texture(d3dDevice, MAX_DS, MAX_DS, 1, 0, Format.A32B32G32R32F, Pool.SystemMemory); g_pTempPos = new Texture(d3dDevice, MAX_DS, MAX_DS, 1, 0, Format.A32B32G32R32F, Pool.SystemMemory); effect.SetValue("g_pVelocidad", g_pVelocidad); effect.SetValue("g_pPos", g_pPos); // Textura del heigmap g_pHeightmap = TextureLoader.FromFile(d3dDevice, currentHeightmap); effect.SetValue("height_map", g_pHeightmap); // Resolucion de pantalla effect.SetValue("screen_dx", d3dDevice.PresentationParameters.BackBufferWidth); effect.SetValue("screen_dy", d3dDevice.PresentationParameters.BackBufferHeight); effect.SetValue("currentScaleXZ", currentScaleXZ); effect.SetValue("currentScaleY", currentScaleY); //Se crean 2 triangulos con las dimensiones de la pantalla con sus posiciones ya transformadas // x = -1 es el extremo izquiedo de la pantalla, x=1 es el extremo derecho // Lo mismo para la Y con arriba y abajo // la Z en 1 simpre 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); g_pVB = new VertexBuffer(typeof(CustomVertex.PositionColored), MAX_DS * MAX_DS, d3dDevice, Usage.Dynamic | Usage.None, CustomVertex.PositionColored.Format, Pool.Default); // inicializo el mapa de velocidades Device device = GuiController.Instance.D3dDevice; TGCMatrix ant_Proj = device.Transform.Projection; TGCMatrix ant_World = device.Transform.World; TGCMatrix ant_View = device.Transform.View; device.Transform.Projection = TGCMatrix.Identity; device.Transform.World = TGCMatrix.Identity; device.Transform.View = TGCMatrix.Identity; // rt1 = velocidad Surface pOldRT = device.GetRenderTarget(0); Surface pSurf = g_pVelocidad.GetSurfaceLevel(0); device.SetRenderTarget(0, pSurf); Surface pOldDS = device.DepthStencilSurface; device.DepthStencilSurface = g_pDepthStencil; // rt2 = posicion Surface pSurf2 = g_pPos.GetSurfaceLevel(0); device.SetRenderTarget(1, pSurf2); device.Clear(ClearFlags.Target | ClearFlags.ZBuffer, Color.Black, 1.0f, 0); device.BeginScene(); effect.Technique = "ComputeVel"; device.VertexFormat = CustomVertex.PositionTextured.Format; device.SetStreamSource(0, g_pVBV3D, 0); effect.Begin(FX.None); effect.BeginPass(0); device.DrawPrimitives(PrimitiveType.TriangleStrip, 0, 2); effect.EndPass(); effect.End(); device.EndScene(); effect.SetValue("Kp", esfera_radio * (float)Math.PI / 2); // restauro los RT device.SetRenderTarget(0, pOldRT); device.SetRenderTarget(1, null); device.DepthStencilSurface = pOldDS; // restauro las Transf. device.Transform.Projection = ant_Proj; device.Transform.World = ant_World; device.Transform.View = ant_View; Modifiers.addBoolean("dibujar_terreno", "Dibujar Terreno", true); }
public override void Init() { MyMediaDir = MediaDir; MyShaderDir = ShadersDir + "WorkshopShaders\\"; //Crear loader var loader = new TgcSceneLoader(); // ------------------------------------------------------------ // Creo el Heightmap para el terreno: var PosTerrain = new Vector3(0, 0, 0); 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 = new Vector3(0, 0, 0); skyBox.Size = new Vector3(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.InitSkyBox(); // ------------------------------------------------------------ //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]; scene2 = loader.loadSceneFromFile(MediaDir + "MeshCreator\\Meshes\\Vegetacion\\Palmera\\Palmera-TgcScene.xml"); palmera = scene2.Meshes[0]; scene3 = loader.loadSceneFromFile(MediaDir + "MeshCreator\\Meshes\\Vehiculos\\AvionCaza\\AvionCaza-TgcScene.xml"); avion = scene3.Meshes[0]; mesh.Scale = new Vector3(0.5f, 0.5f, 0.5f); mesh.Position = new Vector3(0f, 0f, 0f); mesh.AutoTransformEnable = false; var size = mesh.BoundingBox.calculateSize(); largo_tanque = Math.Abs(size.Z); alto_tanque = Math.Abs(size.Y) * mesh.Scale.Y; avion.Scale = new Vector3(1f, 1f, 1f); avion.Position = new Vector3(3000f, 550f, 0f); avion.AutoTransformEnable = false; dir_avion = new Vector3(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.Scale = new Vector3(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 Vector3(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); CamaraRot.CameraDistance = 300; CamaraRot.RotationSpeed = 1.5f; Camara = CamaraRot; kx = kc = 0.5f; Modifiers.addFloat("Reflexion", 0, 1, kx); Modifiers.addFloat("Refraccion", 0, 1, kc); Modifiers.addBoolean("Fresnel", "fresnel", true); }
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() { 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.Scale = new TGCVector3(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 personas TGCVector3 positionEye = new TGCVector3(-944.1269f, 100f, -1033.307f); Camara = 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 virtual void Render(List <TgcMesh> meshTotales, TgcSimpleTerrain terreno, TGCVector3 camaraDir, TGCVector3 direccionLuz, string ShadersDir, List <TgcMesh> meshFogatas) { }
/// <summary> /// Método que se llama cuando se quiere exportar la informacion de la escena a un XML. /// /// /// MODIFICAR ESTA SECCION PARA ADAPTARSE A LAS NECESIDADES DEL ALUMNO /// /// /// /// </summary> internal void exportScene(string savePath) { //Crea XML XmlDocument doc = new XmlDocument(); XmlNode root = doc.CreateElement("SceneEditor-Export"); //Guardar info del terreno XmlElement terrainNode = doc.CreateElement("Terrain"); TgcSimpleTerrain terrain = modifier.EditorControl.TgcTerrain; if (terrain != null) { terrainNode.SetAttribute("enable", true.ToString()); terrainNode.SetAttribute("heightmap", modifier.EditorControl.heighmap.Text); terrainNode.SetAttribute("texture", modifier.EditorControl.terrainTexture.Text); terrainNode.SetAttribute("xzScale", modifier.EditorControl.terrainXZscale.Value.ToString()); terrainNode.SetAttribute("yScale", modifier.EditorControl.terrainYscale.Value.ToString()); terrainNode.SetAttribute("center", TgcParserUtils.printVector3FromString( modifier.EditorControl.terrainCenterX.Text, modifier.EditorControl.terrainCenterY.Text, modifier.EditorControl.terrainCenterZ.Text)); } else { terrainNode.SetAttribute("enable", false.ToString()); } root.AppendChild(terrainNode); //Recorrer Meshes del escenario, ordenadas por grupo List <SceneEditorMeshObject> meshObjects = modifier.EditorControl.getMeshObjectsOrderByGroup(); XmlElement meshesNode = doc.CreateElement("Meshes"); int groupIndex = -1; XmlElement lastGroupNode = null; foreach (SceneEditorMeshObject meshObject in meshObjects) { //Crear grupo con corte de control if (meshObject.groupIndex > groupIndex) { groupIndex = meshObject.groupIndex; lastGroupNode = doc.CreateElement("MeshGroup"); lastGroupNode.SetAttribute("groupIndex", groupIndex.ToString()); meshesNode.AppendChild(lastGroupNode); } //Guardar info de mesh TgcMesh mesh = meshObject.mesh; XmlElement meshNode = doc.CreateElement("Mesh"); meshNode.SetAttribute("name", meshObject.name); meshNode.SetAttribute("index", meshObject.index.ToString()); meshNode.SetAttribute("file", meshObject.fileName); meshNode.SetAttribute("folder", meshObject.folderName); meshNode.SetAttribute("position", TgcParserUtils.printVector3(mesh.Position)); meshNode.SetAttribute("rotation", TgcParserUtils.printVector3(mesh.Rotation)); meshNode.SetAttribute("scale", TgcParserUtils.printVector3(mesh.Scale)); meshNode.SetAttribute("userInfo", meshObject.userInfo); lastGroupNode.AppendChild(meshNode); } root.AppendChild(meshesNode); //Guardar XML doc.AppendChild(root); doc.Save(savePath); }
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 Camera Camera.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 void setTerrain(TgcSimpleTerrain terreno) { this.terreno = terreno; }