public void Quit() { WMap.LoadThreadWork = false; WMap.LoadHeightmapsThreadWork = false; // We want to quit the project, so we start by desroyng // the texture factory. TextureFactory = null; // We destroy the land and Atmos object. Land = null; Atmos = null; // Don't forget to destroy the inputengine object... InputEngine = null; // Dispose of the GFX effect class GraphicFX = null; // Then, we destroy the scene object. Scene = null; // Dispose the Globals Object Globals = null; // We finish the frenetic destroy with the TV object. TV = null; }
public void Quit() { //first of all, we close the world map manager WMap.Quit(); // We want to quit the project, so we start by desroyng // the texture factory. TextureFactory = null; // We destroy the land and Atmos object. Land = null; Atmos = null; // Don't forget to destroy the inputengine object... InputEngine = null; // Dispose of the GFX effect class GraphicFX = null; // Then, we destroy the scene object. Scene = null; // Dispose the Globals Object Globals = null; // We finish the frenetic destroy with the TV object. TV = null; }
public void Delete() { if (_mesh != null) { _mesh.DeleteAll(); _mesh = null; } }
public override void Load() { IDDiff = Game.Textures.LoadTexture("Landscape/texture.dds", "LandTexture", 2048, 2048); IDMat = Game.Materials.CreateLightMaterial(1, 1, 1, 1, 0.25f, 1, "LandLightMaterial"); land = Game.Scene.CreateLandscape("Land"); land.GenerateTerrain("Landscape/landHM.png", CONST_TV_LANDSCAPE_PRECISION.TV_PRECISION_BEST, 8, 8, -0, 0, -0); land.SetCullMode(CONST_TV_CULLING.TV_DOUBLESIDED); land.ExpandTexture(Game.Globals.GetTex("LandTexture"), 0, 0, 8, 8); land.SetMaterial(IDMat); land.SetTexture(IDDiff); land.SetPosition(-0, 0, -0); land.EnableLOD(true); }
public MapTile(TilePosition TilePosition) { this.TilePosition = TilePosition; // We create the tile Landscape = GlobalVars.GameEngine.Scene.CreateLandscape("Land" + TilePosition.TileX + ";" + TilePosition.TileZ); Landscape.GenerateTerrain(null, CONST_TV_LANDSCAPE_PRECISION.TV_PRECISION_HIGH, TileSize, TileSize, TilePosition.TileX * 256 * TileSize, 0, TilePosition.TileZ * 256 * TileSize); //Landscape.CreateEmptyTerrain(CONST_TV_LANDSCAPE_PRECISION.TV_PRECISION_LOW, TileSize, TileSize, TilePosition.TileX * 256 * TileSize, 0, TilePosition.TileZ * 256 * TileSize); //Landscape.CreateEmptyTerrain(CONST_TV_LANDSCAPE_PRECISION.TV_PRECISION_LOW, TileSize, TileSize, TilePosition.TileX * 256 + (TileSize - 1) * 256, 0, TilePosition.TileZ * 256 + (TileSize - 1) * 256); //Latest : //Landscape.EnableLOD(true, 100, CONST_TV_LANDSCAPE_PRECISION.TV_PRECISION_ULTRA_LOW, 0, true); Landscape.SetCullMode(CONST_TV_CULLING.TV_BACK_CULL); Landscape.SetCollisionEnable(false); System.Diagnostics.Debug.WriteLine(" Create landscape X:" + TilePosition.TileX * TileSize * 256 + "; Y:0; Z:" + TilePosition.TileZ * TileSize * 256 + "!"); }
public MapTile(TilePosition TilePosition) { this.TilePosition = TilePosition; // We create the tile Landscape = GlobalVars.GameEngine.Scene.CreateLandscape("Land" + TilePosition.TileX + ";" + TilePosition.TileZ); Landscape.GenerateTerrain(null, CONST_TV_LANDSCAPE_PRECISION.TV_PRECISION_HIGH, TileSize, TileSize, TilePosition.TileX * 256 * TileSize, 0, TilePosition.TileZ * 256 * TileSize); //Landscape.CreateEmptyTerrain(CONST_TV_LANDSCAPE_PRECISION.TV_PRECISION_LOW, TileSize, TileSize, TilePosition.TileX * 256 * TileSize, 0, TilePosition.TileZ * 256 * TileSize); //Landscape.CreateEmptyTerrain(CONST_TV_LANDSCAPE_PRECISION.TV_PRECISION_LOW, TileSize, TileSize, TilePosition.TileX * 256 + (TileSize - 1) * 256, 0, TilePosition.TileZ * 256 + (TileSize - 1) * 256); //Latest : //Landscape.EnableLOD(true, 100, CONST_TV_LANDSCAPE_PRECISION.TV_PRECISION_ULTRA_LOW, 0, true); Landscape.SetCullMode(CONST_TV_CULLING.TV_BACK_CULL); Landscape.SetCollisionEnable(false); System.Diagnostics.Debug.WriteLine(" Create landscape X:" + TilePosition.TileX * TileSize * 256 + "; Y:0; Z:" + TilePosition.TileZ * TileSize * 256 + "!"); }
public Landscape(ICore core) : base(core) { this.core = core; landTextureIdx = -1; heightTextureIdx = -1; landTextureIdx = Helpers.GetTextureFromResource(core, Resources.defaultTexture); land = core.Scene.CreateLandscape(); land.GenerateTerrain(Helpers.GetTextureSourceFromResource(core, Resources.defaultHeight), CONST_TV_LANDSCAPE_PRECISION.TV_PRECISION_HIGH, 8, 8, 0, 0, 0); land.SetCullMode(CONST_TV_CULLING.TV_BACK_CULL); land.ExpandTexture(landTextureIdx, 0, 0, 8, 8); mesh = core.Scene.CreateMeshBuilder(); Name = "Landscape"; UniqueId = land.GetName(); }
public Landscape(ICore core) : base(core) { this.core = core; landTextureIdx = -1; heightTextureIdx = -1; landTextureIdx = Helpers.GetTextureFromResource(core, Resources.defaultTexture); land = core.Scene.CreateLandscape(); land.GenerateTerrain(Helpers.GetTextureSourceFromResource(core, Resources.defaultHeight), CONST_TV_LANDSCAPE_PRECISION.TV_PRECISION_HIGH, 8, 8, 0, 0, 0); land.SetCullMode(CONST_TV_CULLING.TV_BACK_CULL); land.ExpandTexture(landTextureIdx, 0, 0, 8, 8); mesh = core.Scene.CreateMeshBuilder(); Name = "Landscape"; UniqueId = land.GetName(); }
private void SetTexture() { if (!string.IsNullOrEmpty(landTexture)) { landTextureIdx = core.TextureFactory.LoadTexture(landTexture); LandTextureFileName = GetPath(landTexture); } if (!string.IsNullOrEmpty(heightTexture)) { heightTextureIdx = core.TextureFactory.LoadTexture(heightTexture); HeightTextureFileName = GetPath(heightTexture); } core.Scene.DestroyAllLandscapes(); land = core.Scene.CreateLandscape(); land.GenerateTerrain(heightTexture, CONST_TV_LANDSCAPE_PRECISION.TV_PRECISION_HIGH, 8, 8, 0, 0, 0); land.SetCullMode(CONST_TV_CULLING.TV_BACK_CULL); land.ExpandTexture(landTextureIdx, 0, 0, 8, 8); land.SetLightingMode(CONST_TV_LIGHTINGMODE.TV_LIGHTING_MANAGED); }
public void Init() { //bool DebugToConsole = true; // We have to create the TV object before anything else. TV = new TVEngine(); // Set the search directory of the objects, textures, ... TV.SetSearchDirectory(Application.StartupPath); // We put the debug file in the app directory //TV.SetDebugFile(Application.StartupPath + "\\WorldEngine-Debug.txt"); //TV.SetDebugMode(true, true, DebugToConsole); TV.SetDebugMode(false, false, false, false); // We initialize TV in the picture box of the form. TV.Init3DWindowed(GameHandle); // We want to see the FPS. TV.DisplayFPS(true); // We create the TVGlobals object. Globals = new TVGlobals(); // We create the input object. InputEngine = new TVInputEngine(); InputEngine.Initialize(); // New : we create the graphic object so we can add some fog. GraphicFX = new TVGraphicEffect(); // We create the scene (the world). Scene = new TVScene(); //Scene.SetViewFrustum(45, 20000); //Scene.SetViewFrustum(45, 20); // We create the atmosphere class Atmos = new TVAtmosphere(); // As said above, we need to create a new object which will // hold all the textures needed for our land. TextureFactory = new TVTextureFactory(); // We load the sky texture. TextureFactory.LoadTexture("Media\\sky\\sunset\\up.jpg", "SkyTop", -1, -1); TextureFactory.LoadTexture("Media\\sky\\sunset\\down.jpg", "SkyBottom", -1, -1); TextureFactory.LoadTexture("Media\\sky\\sunset\\left.jpg", "SkyLeft", -1, -1); TextureFactory.LoadTexture("Media\\sky\\sunset\\right.jpg", "SkyRight", -1, -1); TextureFactory.LoadTexture("Media\\sky\\sunset\\front.jpg", "SkyFront", -1, -1); TextureFactory.LoadTexture("Media\\sky\\sunset\\back.jpg", "SkyBack", -1, -1); // We set the sky textures. Atmos.SkyBox_SetTexture(Globals.GetTex("SkyFront"), Globals.GetTex("SkyBack"), Globals.GetTex("SkyLeft"), Globals.GetTex("SkyRight"), Globals.GetTex("SkyTop"), Globals.GetTex("SkyBottom")); Atmos.SkyBox_Enable(true); // New : the land generation. This is so much fun because it's // so simple! You load a texture as a height map, the engine // does the rest. But before this, we create the land object. Land = new TVLandscape(); //Land = Scene.CreateLandscape("Land"); // Generate the height of the land from the grayscale of the image. //Land.GenerateTerrain("Media\\heightmap.jpg", CONST_TV_LANDSCAPE_PRECISION.TV_PRECISION_LOW, 8, 8, -1024, 0, -1024, true); //Land.CreateEmptyTerrain(CONST_TV_LANDSCAPE_PRECISION.TV_PRECISION_LOW, 1, 1, -128, 0, -128); // Because we don't want to have mountains with height that get to // the clouds, we adjust the height (Y) factor. //Land.SetScale(1, 0.7f, 1); // Then, we load the land texture. TextureFactory.LoadTexture("Media\\dirtandgrass.jpg", "LandTexture", -1, -1, CONST_TV_COLORKEY.TV_COLORKEY_NO, true); TextureFactory.LoadTexture("Media\\dirtandgrass2.jpg", "LandTexture2", -1, -1, CONST_TV_COLORKEY.TV_COLORKEY_NO, true); //...The splatting texture... TextureFactory.LoadTexture("Media\\grass.dds", "SplattingTexture", -1, -1, CONST_TV_COLORKEY.TV_COLORKEY_NO, true); TextureFactory.LoadTexture("Media\\grassa.dds", "SplattingAlphaTexture", -1, -1, CONST_TV_COLORKEY.TV_COLORKEY_NO, true); // We assign a texture to that land. //Land.SetTexture(Globals.GetTex("LandTexture"), -1); //Land.SetTextureScale(3, 3, -1); // New : the sun. We have to place the sun in the world. Just like the // sky box, the sun is attached to the camera position vector. You will // never notice it until you start playing really badly with the // properties of the sun. Let's start by loading a texture for it. TextureFactory.LoadTexture("Media\\sun.jpg", "Sun", -1, -1, CONST_TV_COLORKEY.TV_COLORKEY_NO, true); // Then, initialize it by placing it via a vector. Atmos.Sun_SetTexture(Globals.GetTex("Sun")); Atmos.Sun_SetBillboardSize(1); Atmos.Sun_SetPosition(-1000f, 570f, 0f); Atmos.Sun_Enable(true); // New : To add extra visual effects, we add a lens flare effect. For // this, we have to load some cirles that will be used to simulate // the flare effect. TextureFactory.LoadTexture("Media\\flare1.jpg", "Flare1", -1, -1, CONST_TV_COLORKEY.TV_COLORKEY_NO, true); TextureFactory.LoadTexture("Media\\flare2.jpg", "Flare2", -1, -1, CONST_TV_COLORKEY.TV_COLORKEY_NO, true); TextureFactory.LoadTexture("Media\\flare3.jpg", "Flare3", -1, -1, CONST_TV_COLORKEY.TV_COLORKEY_NO, true); TextureFactory.LoadTexture("Media\\flare4.jpg", "Flare4", -1, -1, CONST_TV_COLORKEY.TV_COLORKEY_NO, true); // Initialize the lens flares. Atmos.LensFlare_SetLensNumber(4); Atmos.LensFlare_Enable(true); Atmos.LensFlare_SetLensParams(0, Globals.GetTex("Flare1"), 2 * 5f, 40, Globals.RGBA(1f, 1f, 1f, 0.5f), Globals.RGBA(1f, 1f, 1f, 0.5f)); Atmos.LensFlare_SetLensParams(1, Globals.GetTex("Flare2"), 2 * 1f, 18, Globals.RGBA(1f, 1f, 1f, 0.5f), Globals.RGBA(1f, 1f, 1f, 0.5f)); Atmos.LensFlare_SetLensParams(2, Globals.GetTex("Flare3"), 2 * 1.8f, 15, Globals.RGBA(1f, 1f, 1f, 0.5f), Globals.RGBA(0.7f, 1f, 1f, 0.5f)); Atmos.LensFlare_SetLensParams(3, Globals.GetTex("Flare4"), 2 * 1f, 6, Globals.RGBA(1f, 0.1f, 0f, 0.5f), Globals.RGBA(0.5f, 1f, 1f, 0.5f)); // New : also for fun, we add water. We start by loading the // water tetxure... sngWaterHeight = -1; //60 TextureFactory.LoadTexture("Media\\water.bmp", "Water"); WaterMesh = Scene.CreateMeshBuilder(); WaterMesh.AddFloor(Globals.GetTex("Water"), -700, 0, (8 * 256) - 700, 8 * 256, sngWaterHeight, 1, 1, false); RenderSurf1 = Scene.CreateRenderSurface(256, 256, true); RenderSurf2 = Scene.CreateRenderSurface(256, 256, true); WPlane.Dist = -sngWaterHeight; WPlane.Normal = new TV_3DVECTOR(0, 1, 0); RenderSurf1.SetBackgroundColor(355); GraphicFX.SetWaterReflection(WaterMesh, RenderSurf1, RenderSurf2, 0, WPlane); // New : for fun, we will also add some clouds, just over the water // to give a creepy fog effect. Let's start by loading the clouds textures. TextureFactory.LoadTexture("Media\\cloud1.dds", "Clouds", -1, -1, CONST_TV_COLORKEY.TV_COLORKEY_BLACK, true); // Then, set the land's clouds. Atmos.Clouds_Create(1, 1024, 1024); Atmos.Clouds_SetLayerParameters(0, 300, Globals.GetTex("Clouds")); Atmos.Clouds_SetLayerAnimation(0, true, 0.01f, 0.01f); // We set the camera vectors (position and look at) and angles. sngPositionX = 0f; sngPositionY = 20f; sngPositionZ = 0f; snglookatX = 0f; snglookatY = 20f; snglookatZ = 50f; sngAngleX = 0f; sngAngleY = 0f; // We set the initial values of movement sngWalk = 0f; sngStrafe = 0f; // Set the viewing distance Scene.SetViewFrustum(60f, 900f); //"random" values, TODO : Check for better ones ? //http://www.truevision3d.com/forums/tv3d_sdk_63/about_tilemap-t3865.0.html;prev_next=prev // We pop the form over everything else. //We create the world map WMap = new WorldMap(Scene); // We start the main loop. You can't create the MainLoop by using the // toolbox buttons, nor by clicking on the form "Form1" : you have to // create it by yourself. It's not as hard as it may sound... DoLoop = true; TV.EnableProfiler(true, false); Main_Loop(); }
public void Quit() { //first of all, we close the world map manager WMap.Quit(); // We want to quit the project, so we start by desroyng // the texture factory. TextureFactory = null; // We destroy the land and Atmos object. Land = null; Atmos = null; // Don't forget to destroy the inputengine object... InputEngine = null; // Dispose of the GFX effect class GraphicFX = null; // Then, we destroy the scene object. Scene = null; // Dispose the Globals Object Globals = null; // We finish the frenetic destroy with the TV object. TV = null; }
private void InitLandscape() { Land = scene.CreateLandscape("Land"); Land.SetAffineLevel(CONST_TV_LANDSCAPE_AFFINE.TV_AFFINE_LOW); int twidth = (64 * 8) / 256; int theight = (64 * 8) / 256; Land.GenerateTerrain(@"Heightmaps\heightmap.bmp", CONST_TV_LANDSCAPE_PRECISION.TV_PRECISION_HIGH, twidth/2, theight/2, 0, 0, 0, true); Land.SetTexture(globals.GetTex("Grass")); Land.SetMaterial(matLand); Land.SetTextureScale(0.3f, 0.3f); Land.SetPosition(-((twidth * 256) / 2) + 120, 0, -((theight * 256) / 2) + 120); pbLand = physics.CreateStaticTerrainBody(Land); }
public void Quit() { WMap.LoadThreadWork = false; WMap.LoadHeightmapsThreadWork = false; // We want to quit the project, so we start by desroyng // the texture factory. TextureFactory = null; // We destroy the land and Atmos object. Land = null; Atmos = null; // Don't forget to destroy the inputengine object... InputEngine = null; // Dispose of the GFX effect class GraphicFX = null; // Then, we destroy the scene object. Scene = null; // Dispose the Globals Object Globals = null; // We finish the frenetic destroy with the TV object. TV = null; }
public void Init() { //bool DebugToConsole = true; // We have to create the TV object before anything else. TV = new TVEngine(); // Set the search directory of the objects, textures, ... TV.SetSearchDirectory(Application.StartupPath); // We put the debug file in the app directory //TV.SetDebugFile(Application.StartupPath + "\\WorldEngine-Debug.txt"); //TV.SetDebugMode(true, true, DebugToConsole); TV.SetDebugMode(false, false, false, false); // We initialize TV in the picture box of the form. TV.Init3DWindowed(GameHandle); // We want to see the FPS. TV.DisplayFPS(true); // We create the TVGlobals object. Globals = new TVGlobals(); // We create the input object. InputEngine = new TVInputEngine(); InputEngine.Initialize(); // New : we create the graphic object so we can add some fog. GraphicFX = new TVGraphicEffect(); // We create the scene (the world). Scene = new TVScene(); //Scene.SetViewFrustum(45, 20000); //Scene.SetViewFrustum(45, 20); // We create the atmosphere class Atmos = new TVAtmosphere(); // As said above, we need to create a new object which will // hold all the textures needed for our land. TextureFactory = new TVTextureFactory(); // We load the sky texture. TextureFactory.LoadTexture("Media\\sky\\sunset\\up.jpg", "SkyTop", -1, -1); TextureFactory.LoadTexture("Media\\sky\\sunset\\down.jpg", "SkyBottom", -1, -1); TextureFactory.LoadTexture("Media\\sky\\sunset\\left.jpg", "SkyLeft", -1, -1); TextureFactory.LoadTexture("Media\\sky\\sunset\\right.jpg", "SkyRight", -1, -1); TextureFactory.LoadTexture("Media\\sky\\sunset\\front.jpg", "SkyFront", -1, -1); TextureFactory.LoadTexture("Media\\sky\\sunset\\back.jpg", "SkyBack", -1, -1); // We set the sky textures. Atmos.SkyBox_SetTexture(Globals.GetTex("SkyFront"), Globals.GetTex("SkyBack"), Globals.GetTex("SkyLeft"), Globals.GetTex("SkyRight"), Globals.GetTex("SkyTop"), Globals.GetTex("SkyBottom")); Atmos.SkyBox_Enable(true); // New : the land generation. This is so much fun because it's // so simple! You load a texture as a height map, the engine // does the rest. But before this, we create the land object. Land = new TVLandscape(); //Land = Scene.CreateLandscape("Land"); // Generate the height of the land from the grayscale of the image. //Land.GenerateTerrain("Media\\heightmap.jpg", CONST_TV_LANDSCAPE_PRECISION.TV_PRECISION_LOW, 8, 8, -1024, 0, -1024, true); //Land.CreateEmptyTerrain(CONST_TV_LANDSCAPE_PRECISION.TV_PRECISION_LOW, 1, 1, -128, 0, -128); // Because we don't want to have mountains with height that get to // the clouds, we adjust the height (Y) factor. //Land.SetScale(1, 0.7f, 1); // Then, we load the land texture. TextureFactory.LoadTexture("Media\\dirtandgrass.jpg", "LandTexture", -1, -1, CONST_TV_COLORKEY.TV_COLORKEY_NO, true); TextureFactory.LoadTexture("Media\\dirtandgrass2.jpg", "LandTexture2", -1, -1, CONST_TV_COLORKEY.TV_COLORKEY_NO, true); //...The splatting texture... TextureFactory.LoadTexture("Media\\grass.dds", "SplattingTexture", -1, -1, CONST_TV_COLORKEY.TV_COLORKEY_NO, true); TextureFactory.LoadTexture("Media\\grassa.dds", "SplattingAlphaTexture", -1, -1, CONST_TV_COLORKEY.TV_COLORKEY_NO, true); // We assign a texture to that land. //Land.SetTexture(Globals.GetTex("LandTexture"), -1); //Land.SetTextureScale(3, 3, -1); // New : the sun. We have to place the sun in the world. Just like the // sky box, the sun is attached to the camera position vector. You will // never notice it until you start playing really badly with the // properties of the sun. Let's start by loading a texture for it. TextureFactory.LoadTexture("Media\\sun.jpg", "Sun", -1, -1, CONST_TV_COLORKEY.TV_COLORKEY_NO, true); // Then, initialize it by placing it via a vector. Atmos.Sun_SetTexture(Globals.GetTex("Sun")); Atmos.Sun_SetBillboardSize(1); Atmos.Sun_SetPosition(-1000f, 570f, 0f); Atmos.Sun_Enable(true); // New : To add extra visual effects, we add a lens flare effect. For // this, we have to load some cirles that will be used to simulate // the flare effect. TextureFactory.LoadTexture("Media\\flare1.jpg", "Flare1", -1, -1, CONST_TV_COLORKEY.TV_COLORKEY_NO, true); TextureFactory.LoadTexture("Media\\flare2.jpg", "Flare2", -1, -1, CONST_TV_COLORKEY.TV_COLORKEY_NO, true); TextureFactory.LoadTexture("Media\\flare3.jpg", "Flare3", -1, -1, CONST_TV_COLORKEY.TV_COLORKEY_NO, true); TextureFactory.LoadTexture("Media\\flare4.jpg", "Flare4", -1, -1, CONST_TV_COLORKEY.TV_COLORKEY_NO, true); // Initialize the lens flares. Atmos.LensFlare_SetLensNumber(4); Atmos.LensFlare_Enable(true); Atmos.LensFlare_SetLensParams(0, Globals.GetTex("Flare1"), 2 * 5f, 40, Globals.RGBA(1f, 1f, 1f, 0.5f), Globals.RGBA(1f, 1f, 1f, 0.5f)); Atmos.LensFlare_SetLensParams(1, Globals.GetTex("Flare2"), 2 * 1f, 18, Globals.RGBA(1f, 1f, 1f, 0.5f), Globals.RGBA(1f, 1f, 1f, 0.5f)); Atmos.LensFlare_SetLensParams(2, Globals.GetTex("Flare3"), 2 * 1.8f, 15, Globals.RGBA(1f, 1f, 1f, 0.5f), Globals.RGBA(0.7f, 1f, 1f, 0.5f)); Atmos.LensFlare_SetLensParams(3, Globals.GetTex("Flare4"), 2 * 1f, 6, Globals.RGBA(1f, 0.1f, 0f, 0.5f), Globals.RGBA(0.5f, 1f, 1f, 0.5f)); // New : also for fun, we add water. We start by loading the // water tetxure... sngWaterHeight = -1; //60 TextureFactory.LoadTexture("Media\\water.bmp", "Water"); WaterMesh = Scene.CreateMeshBuilder(); WaterMesh.AddFloor(Globals.GetTex("Water"), -700, 0, (8 * 256) - 700, 8 * 256, sngWaterHeight, 1, 1, false); RenderSurf1 = Scene.CreateRenderSurface(256, 256, true); RenderSurf2 = Scene.CreateRenderSurface(256, 256, true); WPlane.Dist = -sngWaterHeight; WPlane.Normal = new TV_3DVECTOR(0, 1, 0); RenderSurf1.SetBackgroundColor(355); GraphicFX.SetWaterReflection(WaterMesh, RenderSurf1, RenderSurf2, 0, WPlane); // New : for fun, we will also add some clouds, just over the water // to give a creepy fog effect. Let's start by loading the clouds textures. TextureFactory.LoadTexture("Media\\cloud1.dds", "Clouds", -1, -1, CONST_TV_COLORKEY.TV_COLORKEY_BLACK, true); // Then, set the land's clouds. Atmos.Clouds_Create(1, 1024, 1024); Atmos.Clouds_SetLayerParameters(0, 300, Globals.GetTex("Clouds")); Atmos.Clouds_SetLayerAnimation(0, true, 0.01f, 0.01f); // We set the camera vectors (position and look at) and angles. sngPositionX = 0f; sngPositionY = 20f; sngPositionZ = 0f; snglookatX = 0f; snglookatY = 20f; snglookatZ = 50f; sngAngleX = 0f; sngAngleY = 0f; // We set the initial values of movement sngWalk = 0f; sngStrafe = 0f; // Set the viewing distance Scene.SetViewFrustum(60f, 900f); //"random" values, TODO : Check for better ones ? //http://www.truevision3d.com/forums/tv3d_sdk_63/about_tilemap-t3865.0.html;prev_next=prev // We pop the form over everything else. //We create the world map WMap = new WorldMap(Scene); // We start the main loop. You can't create the MainLoop by using the // toolbox buttons, nor by clicking on the form "Form1" : you have to // create it by yourself. It's not as hard as it may sound... DoLoop = true; TV.EnableProfiler(true, false); Main_Loop(); }
private void SetTexture() { if (!string.IsNullOrEmpty(landTexture)) { landTextureIdx = core.TextureFactory.LoadTexture(landTexture); LandTextureFileName = GetPath(landTexture); } if (!string.IsNullOrEmpty(heightTexture)) { heightTextureIdx = core.TextureFactory.LoadTexture(heightTexture); HeightTextureFileName = GetPath(heightTexture); } core.Scene.DestroyAllLandscapes(); land = core.Scene.CreateLandscape(); land.GenerateTerrain(heightTexture, CONST_TV_LANDSCAPE_PRECISION.TV_PRECISION_HIGH, 8, 8, 0, 0, 0); land.SetCullMode(CONST_TV_CULLING.TV_BACK_CULL); land.ExpandTexture(landTextureIdx, 0, 0, 8, 8); land.SetLightingMode(CONST_TV_LIGHTINGMODE.TV_LIGHTING_MANAGED); }