Creating the Landscape in Truevision
  • Open up your languague of choice. (Code here is for VB .NET but should be easily understandable if you use another language)
  • I’m not going into details about instancing the engine and the objects, you probably know how to do this. We need to instantiate a TVEngine, TVTextureFactory, TVScene a TVLandscape and a TVInputEngine if you want dynamic movement on your landscape.
  • Use these setting for your Scene :
          Scene.SetViewFrustum(60, 5000);
          Scene.SetTextureFilter(CONST_TV_TEXTUREFILTER.TV_FILTER_TRILINEAR);
  • Now load the final texture you created in L3DT like this :
          Texture.LoadTexture("texture map from L3DT", "land", 2048, 2048);
  • And now we will create the landscape from our heightmap :
          Land.GenerateTerrain("height map from L3DT", CONST_TV_LANDSCAPE_PRECISION.TV_PRECISION_BEST, 8, 8, 0, 0, 0);
          Land.SetCullMode(CONST_TV_CULLING.TV_FRONT_CULL);
          Land.ExpandTexture(Globals.GetTex("land"), 0, 0, 8, 8);
  • TV_PRECISION_BEST can hurt your FPS but it’s required if you made some steep mountains or plateaus in L3DT, otherwise you can use TV_PRECISION_HIGH or even TV_PRECISION_AVERAGE.
  • Now just add the main loop and render your landscape.
  • If you want an overview of what you just made just use these setting for the camera :
          Scene.SetCamera(0, 1000, 0, 1024, 0, 1024)
  • By now if you run your application you should see something similar to this :

  • You can add a detail texture to the landscape to add even more realism.
  • Write some movement code.
  • Happy landscaping :)

’’The Code for the c#-guys (For 6.5 Beta) looks like this:

          TVTextureFactory Texture = new TVTextureFactory();
          Texture.LoadTexture("C:\\text.bmp", "land", 2048, 2048);
          TVLandscape Land;
          Land = Scene1.CreateLandscape("land");
          Land.GenerateTerrain("C:\\height.bmp",CONST_TV_LANDSCAPE_PRECISION.TV_PRECISION_HIGH,8,8,0,0,0);
          Land.SetCullMode(CONST_TV_CULLING.TV_BACK_CULL);
          Land.ExpandTexture(Global1.GetTex("land"), 0, 0, 8, 8);
          Scene1.SetCamera(0, 1000, 0, 1024, 0, 1024);
 
tutorialsarticlesandexamples/create_a_landscape_in_l3dt3.txt · Last modified: 2013/11/22 13:32