Hilfe

TerrainDetail

B3D

Aufruf

TerrainDetail Terrain, Detail [,Morph]

Parameter

Terrain Identität eines Terrains
Detail Detail-Level des Terrains (Normal=2000)
Morph 0=Morphing aus (Standard)
1=Morphing ein (Empfohlen)


Rückgabewert

-


Beschreibung

Die Anweisung TerrainDetail setzt die Detailstufe eines Terrains. Ein Terrain ist ein spezielles Objekt, welches level-of-detail (LOD) benutzt. Dadurch sind theoretisch Terrains mit Millionen von Polygonen möglich. Dabei werden nahe Terrainstellen sehr detailliert gezeichnet, weite Terrainstellen haben dagegen geringe Details.
Mit TerrainDetail und dem Parameter "Detail" kann man die Anzahl der Dreiecke einstellen. Normaler Wert ist 2000.
Der optionale Parameter "Morph" kann PopUp's reduzieren und ist absolut zu empfehlen. Übergebe dazu den Wert 1.


Beispiel

Standardbeispiel:

Graphics3D 640, 480
SetBuffer BackBuffer()
camera = CreateCamera()
PositionEntity camera, 1, 1, 1
light = CreateLight()
RotateEntity light, 90, 0, 0
terrain = LoadTerrain("media/height_map.bmp")
ScaleEntity terrain, 1, 50, 1
grass_tex = LoadTexture("media/mossyground.bmp")
EntityTexture terrain, grass_tex, 0, 1
terra_detail = 4000
vertex_morph = True

While Not KeyDown(1)
   If KeyHit(57) = True Then vertex_morph = 1 - vertex_morph
   If KeyDown(2) Then terra_detail = terra_detail - 10
   If KeyDown(3) Then terra_detail = terra_detail + 10
   If KeyDown(203) = True Then x# = x# - 0.1
   If KeyDown(205) = True Then x# = x# + 0.1
   If KeyDown(208) = True Then y# = y# - 0.1
   If KeyDown(200) = True Then y# = y# + 0.1
   If KeyDown(44) = True Then z# = z# - 0.1
   If KeyDown(30) = True Then z# = z# + 0.1
   If KeyDown(205) = True Then TurnEntity camera, 0, - 1, 0
   If KeyDown(203) = True Then TurnEntity camera, 0, 1, 0
   If KeyDown(208) = True Then MoveEntity camera, 0, 0, - 0.1
   If KeyDown(200) = True Then MoveEntity camera, 0, 0, 0.1
   TerrainDetail terrain, terra_detail, vertex_morph
   x# = EntityX(camera)
   y# = EntityY(camera)
   z# = EntityZ(camera)
   terra_y# = TerrainY(terrain, x#, y#, z#) + 5
   PositionEntity camera, x#, terra_y#, z#
   RenderWorld
   Text 0, 0, "Mit Cursortasten verschieben"
   Text 0, 20, "Mit 1 oder 2 Detaillevel ändern"
   Text 0, 40, "Mit Leertaste Morphing ein/ausschalten"
   Text 0, 60, "Terrain Detail:" + terra_detail
   Text 0, 80, "Vertex Morphing:" + vertex_morph
   Flip
Wend
End

Übersicht 3D Grafik Terrain