arsa  2.7
ITerrainSceneNode.h
Go to the documentation of this file.
1 // Copyright (C) 2002-2012 Nikolaus Gebhardt
2 // This file is part of the "Irrlicht Engine".
3 // For conditions of distribution and use, see copyright notice in irrlicht.h
4 
5 // The code for the TerrainSceneNode is based on the terrain renderer by
6 // Soconne and the GeoMipMapSceneNode developed by Spintz. They made their
7 // code available for Irrlicht and allowed it to be distributed under this
8 // licence. I only modified some parts. A lot of thanks go to them.
9 
10 #ifndef __I_TERRAIN_SCENE_NODE_H__
11 #define __I_TERRAIN_SCENE_NODE_H__
12 
13 #include "ETerrainElements.h"
14 #include "ISceneNode.h"
15 #include "IDynamicMeshBuffer.h"
16 #include "irrArray.h"
17 
18 namespace irr
19 {
20 namespace io
21 {
22  class IReadFile;
23 } // end namespace io
24 namespace scene
25 {
26  class IMesh;
27 
29 
50  {
51  public:
54  const core::vector3df& position = core::vector3df(0.0f, 0.0f, 0.0f),
55  const core::vector3df& rotation = core::vector3df(0.0f, 0.0f, 0.0f),
56  const core::vector3df& scale = core::vector3df(1.0f, 1.0f, 1.0f) )
57  : ISceneNode (parent, mgr, id, position, rotation, scale) {}
58 
60 
61  virtual const core::aabbox3d<f32>& getBoundingBox() const =0;
62 
64 
65  virtual const core::aabbox3d<f32>& getBoundingBox(s32 patchX, s32 patchZ) const =0;
66 
68 
69  virtual u32 getIndexCount() const =0;
70 
72 
73  virtual IMesh* getMesh() =0;
74 
76  virtual IMeshBuffer* getRenderBuffer() =0;
77 
78 
80 
82  virtual void getMeshBufferForLOD(IDynamicMeshBuffer& mb, s32 LOD=0) const =0;
83 
85 
94  s32 patchX, s32 patchZ, s32 LOD=0) =0;
95 
97 
100  virtual s32 getCurrentLODOfPatches(core::array<s32>& LODs) const =0;
101 
103 
108  virtual void setLODOfPatch(s32 patchX, s32 patchZ, s32 LOD=0) =0;
109 
111  virtual const core::vector3df& getTerrainCenter() const =0;
112 
114  virtual f32 getHeight(f32 x, f32 y) const =0;
115 
117 
119  virtual void setCameraMovementDelta(f32 delta) =0;
120 
122 
124  virtual void setCameraRotationDelta(f32 delta) =0;
125 
127 
128  virtual void setDynamicSelectorUpdate(bool bVal) =0;
129 
131 
137  virtual bool overrideLODDistance(s32 LOD, f64 newDistance) =0;
138 
140 
149  virtual void scaleTexture(f32 scale = 1.0f, f32 scale2=0.0f) =0;
150 
152 
157  virtual bool loadHeightMap(io::IReadFile* file,
158  video::SColor vertexColor=video::SColor(255,255,255,255),
159  s32 smoothFactor=0) =0;
160 
162 
172  virtual bool loadHeightMapRAW(io::IReadFile* file, s32 bitsPerPixel=16,
173  bool signedData=false, bool floatVals=false, s32 width=0,
174  video::SColor vertexColor=video::SColor(255,255,255,255),
175  s32 smoothFactor=0) =0;
176 
178 
181  virtual void setFixedBorderLOD(irr::s32 borderLOD=0) = 0;
182 
183  };
184 
185 } // end namespace scene
186 } // end namespace irr
187 
188 
189 #endif // __I_TERRAIN_SCENE_NODE_H__
190 
GLenum GLenum GLenum GLenum GLenum scale
GLuint id
Interface providing read access to a file.
Definition: IReadFile.h:18
virtual IMesh * getMesh()=0
Get pointer to the mesh.
float f32
32 bit floating point variable.
Definition: irrTypes.h:108
GLint GLint GLsizei width
Definition: SDL_opengl.h:1572
virtual u32 getIndexCount() const =0
Get the number of indices currently in the meshbuffer.
GLuint GLuint GLsizei GLenum const GLvoid * indices
Definition: SDL_opengl.h:1571
Scene node interface.
Definition: ISceneNode.h:40
virtual const core::aabbox3d< f32 > & getBoundingBox() const =0
Get the bounding box of the terrain.
virtual bool loadHeightMapRAW(io::IReadFile *file, s32 bitsPerPixel=16, bool signedData=false, bool floatVals=false, s32 width=0, video::SColor vertexColor=video::SColor(255, 255, 255, 255), s32 smoothFactor=0)=0
Initializes the terrain data. Loads the vertices from the heightMapFile.
virtual void setFixedBorderLOD(irr::s32 borderLOD=0)=0
Force node to use a fixed LOD level at the borders of the terrain.
virtual void setLODOfPatch(s32 patchX, s32 patchZ, s32 LOD=0)=0
Manually sets the LOD of a patch.
Everything in the Irrlicht Engine can be found in this namespace.
Definition: CARSADPad.h:6
virtual void scaleTexture(f32 scale=1.0f, f32 scale2=0.0f)=0
Scales the base texture, similar to makePlanarTextureMapping.
double f64
64 bit floating point variable.
Definition: irrTypes.h:112
Class which holds the geometry of an object.
Definition: IMesh.h:71
virtual s32 getCurrentLODOfPatches(core::array< s32 > &LODs) const =0
Populates an array with the CurrentLOD of each patch.
virtual void setCameraRotationDelta(f32 delta)=0
Sets the rotation camera threshold.
signed int s32
32 bit signed variable.
Definition: irrTypes.h:70
Struct for holding a mesh with a single material.
Definition: IMeshBuffer.h:39
virtual void setDynamicSelectorUpdate(bool bVal)=0
Sets whether or not the node should dynamically update its associated selector when the geomipmap dat...
GLfloat f
unsigned int u32
32 bit unsigned variable.
Definition: irrTypes.h:62
GLint GLint GLint GLint GLint GLint y
Definition: SDL_opengl.h:1574
virtual IMeshBuffer * getRenderBuffer()=0
Get pointer to the buffer used by the terrain (most users will not need this)
Class representing a 32 bit ARGB color.
Definition: SColor.h:316
A scene node for displaying terrain using the geo mip map algorithm.
ITerrainSceneNode(ISceneNode *parent, ISceneManager *mgr, s32 id, const core::vector3df &position=core::vector3df(0.0f, 0.0f, 0.0f), const core::vector3df &rotation=core::vector3df(0.0f, 0.0f, 0.0f), const core::vector3df &scale=core::vector3df(1.0f, 1.0f, 1.0f))
Constructor.
The Scene Manager manages scene nodes, mesh resources, cameras and all the other stuff.
GLint GLint GLint GLint GLint x
Definition: SDL_opengl.h:1574
virtual void getMeshBufferForLOD(IDynamicMeshBuffer &mb, s32 LOD=0) const =0
Gets the meshbuffer data based on a specified level of detail.
virtual s32 getIndicesForPatch(core::array< u32 > &indices, s32 patchX, s32 patchZ, s32 LOD=0)=0
Gets the indices for a specified patch at a specified Level of Detail.
virtual void setCameraMovementDelta(f32 delta)=0
Sets the movement camera threshold.
virtual f32 getHeight(f32 x, f32 y) const =0
Get height of a point of the terrain.
virtual bool loadHeightMap(io::IReadFile *file, video::SColor vertexColor=video::SColor(255, 255, 255, 255), s32 smoothFactor=0)=0
Initializes the terrain data. Loads the vertices from the heightMapFile.
virtual bool overrideLODDistance(s32 LOD, f64 newDistance)=0
Override the default generation of distance thresholds.
virtual const core::vector3df & getTerrainCenter() const =0
Get center of terrain.