Privacy
An open-source, flexible 3D physical simulation framework
osg_terrain::MultiResHeightMapRenderer Class Reference

#include <MultiResHeightMapRenderer.h>

Public Member Functions

 MultiResHeightMapRenderer (int gridW, int gridH, double visualWidth, double visualHeight, double scaleZ, double texScaleX, double texScaleY, int depth, std::string imagefile)
 
 ~MultiResHeightMapRenderer ()
 
void initialize ()
 
void highInitialize ()
 
void render ()
 
void collideSphere (double xPos, double yPos, double zPos, double radius)
 
void setHeight (unsigned int gridX, unsigned int gridY, double height)
 
void setDrawSolid (bool drawSolid)
 
void setDrawWireframe (bool drawWireframe)
 
void setCameraPosition (double x, double y)
 
int getLowResVertexCntX () const
 
int getLowResVertexCntY () const
 
int getLowResCellCntX () const
 
int getLowResCellCntY () const
 
int getHighResVertexCntX () const
 
int getHighResVertexCntY () const
 
int getHighResCellCntX () const
 
int getHighResCellCntY () const
 
- Public Member Functions inherited from mars::utils::Thread
 Thread ()
 
virtual ~Thread ()
 
void start ()
 Starts the execution of this Thread. More...
 
void cancel (bool block=false)
 Tries to cancel the Thread. More...
 
void setCancellationPoint ()
 Adds a cancellation point to your run method. More...
 
bool wait ()
 stops execution until the thread has finished. More...
 
bool join ()
 
bool wait (unsigned long timeoutMilliseconds)
 puts the Thread to sleep for a specified amount of time. More...
 
bool isRunning () const
 returns true if the Thread is running. More...
 
bool isFinished () const
 
void setStackSize (std::size_t stackSize)
 
std::size_t getStackSize () const
 
bool isCurrentThread () const
 

Protected Member Functions

void clear ()
 
TilecreateSubTile (int x, int y, Tile *tile)
 
void fillSubTile (Tile *tile)
 
void cutTile (int x, int y, Tile *tile)
 
void cutHole (int x, int y, int x2, int y2, Tile *tile)
 
bool initPlane (bool highRes)
 
void recalcSteps ()
 
double getHeight (double x, double y)
 
void handleCamPos (double x, double y, Tile *tile)
 
void clearTile (Tile *tile)
 
void drawPatch (int x, int y, Tile *tile)
 
void moveTile (int indicesOffsetPos, int verticesOffsetPos, Tile *tile)
 
void run ()
 The simulator main loop. More...
 

Private Member Functions

void prepare ()
 
void getNormal (int x, int y, int mx, int my, double x_step, double y_step, double **height_data, float *normal, float *tangent, bool skipBorder)
 
void normalize (float *v)
 
double getHeight (int x, int y, Tile *tile)
 
void render (bool highRes)
 

Private Attributes

GLuint * vboIds
 
bool isInitialized
 
bool highIsInitialized
 
double targetWidth
 
double targetHeight
 
int width
 
int height
 
double scaleZ
 
double texScaleX
 
double texScaleY
 
TilemainTile
 
double camX
 
double camY
 
VertexDatavertices
 
GLuint * indices
 
VertexDatahighVertices
 
GLuint * highIndices
 
VertexDatavertexCopy
 
VertexDatahighVertexCopy
 
GLuint * indexCopy
 
GLuint * highIndexCopy
 
bool swapBuffer
 
bool swapBuffer2
 
bool finish
 
mars::utils::Mutex dataMutex
 
mars::utils::Mutex swapMutex
 
int numVertices
 
int numIndices
 
int highNumVertices
 
int highNumIndices
 
int indicesToDraw
 
int highIndicesToDraw
 
int highIndicesToDrawBuffer
 
double highStepX
 
double highStepY
 
int highWidth
 
int highHeight
 
int maxNumSubTiles
 
int numSubTiles
 
int depth
 
double newIndicesPos
 
double newVerticesPos
 
bool dirty
 
double minX
 
double minY
 
double minZ
 
double maxX
 
double maxY
 
double maxZ
 
bool wireframe
 
bool solid
 
bool highWireframe
 
bool highSolid
 
IplImage * img
 
std::map< int, Tile * > subTiles
 
std::vector< Tile * > listSubTiles
 

Additional Inherited Members

- Static Public Member Functions inherited from mars::utils::Thread
static ThreadgetCurrentThread ()
 
static void cancelAll (bool block=false)
 
- Static Protected Member Functions inherited from mars::utils::Thread
static void msleep (unsigned long msec)
 causes the current thread to sleep for More...
 

Detailed Description

Definition at line 82 of file MultiResHeightMapRenderer.h.

Constructor & Destructor Documentation

◆ MultiResHeightMapRenderer()

osg_terrain::MultiResHeightMapRenderer::MultiResHeightMapRenderer ( int  gridW,
int  gridH,
double  visualWidth,
double  visualHeight,
double  scaleZ,
double  texScaleX,
double  texScaleY,
int  depth,
std::string  imagefile 
)

Definition at line 47 of file MultiResHeightMapRenderer.cpp.

◆ ~MultiResHeightMapRenderer()

osg_terrain::MultiResHeightMapRenderer::~MultiResHeightMapRenderer ( )

Definition at line 79 of file MultiResHeightMapRenderer.cpp.

Member Function Documentation

◆ clear()

void osg_terrain::MultiResHeightMapRenderer::clear ( )
protected

Definition at line 163 of file MultiResHeightMapRenderer.cpp.

◆ clearTile()

void osg_terrain::MultiResHeightMapRenderer::clearTile ( Tile tile)
protected

Definition at line 427 of file MultiResHeightMapRenderer.cpp.

◆ collideSphere()

void osg_terrain::MultiResHeightMapRenderer::collideSphere ( double  xPos,
double  yPos,
double  zPos,
double  radius 
)

◆ createSubTile()

Tile * osg_terrain::MultiResHeightMapRenderer::createSubTile ( int  x,
int  y,
Tile tile 
)
protected

Definition at line 628 of file MultiResHeightMapRenderer.cpp.

◆ cutHole()

void osg_terrain::MultiResHeightMapRenderer::cutHole ( int  x,
int  y,
int  x2,
int  y2,
Tile tile 
)
protected

Definition at line 688 of file MultiResHeightMapRenderer.cpp.

◆ cutTile()

void osg_terrain::MultiResHeightMapRenderer::cutTile ( int  x,
int  y,
Tile tile 
)
protected

Definition at line 682 of file MultiResHeightMapRenderer.cpp.

◆ drawPatch()

void osg_terrain::MultiResHeightMapRenderer::drawPatch ( int  x,
int  y,
Tile tile 
)
protected

Definition at line 703 of file MultiResHeightMapRenderer.cpp.

◆ fillSubTile()

void osg_terrain::MultiResHeightMapRenderer::fillSubTile ( Tile tile)
protected

Definition at line 728 of file MultiResHeightMapRenderer.cpp.

◆ getHeight() [1/2]

double osg_terrain::MultiResHeightMapRenderer::getHeight ( double  x,
double  y 
)
protected

Definition at line 557 of file MultiResHeightMapRenderer.cpp.

◆ getHeight() [2/2]

double osg_terrain::MultiResHeightMapRenderer::getHeight ( int  x,
int  y,
Tile tile 
)
private

Definition at line 909 of file MultiResHeightMapRenderer.cpp.

◆ getHighResCellCntX()

int osg_terrain::MultiResHeightMapRenderer::getHighResCellCntX ( ) const
inline

Definition at line 117 of file MultiResHeightMapRenderer.h.

◆ getHighResCellCntY()

int osg_terrain::MultiResHeightMapRenderer::getHighResCellCntY ( ) const
inline

Definition at line 119 of file MultiResHeightMapRenderer.h.

◆ getHighResVertexCntX()

int osg_terrain::MultiResHeightMapRenderer::getHighResVertexCntX ( ) const
inline

Definition at line 113 of file MultiResHeightMapRenderer.h.

◆ getHighResVertexCntY()

int osg_terrain::MultiResHeightMapRenderer::getHighResVertexCntY ( ) const
inline

Definition at line 115 of file MultiResHeightMapRenderer.h.

◆ getLowResCellCntX()

int osg_terrain::MultiResHeightMapRenderer::getLowResCellCntX ( ) const
inline

Definition at line 109 of file MultiResHeightMapRenderer.h.

◆ getLowResCellCntY()

int osg_terrain::MultiResHeightMapRenderer::getLowResCellCntY ( ) const
inline

Definition at line 111 of file MultiResHeightMapRenderer.h.

◆ getLowResVertexCntX()

int osg_terrain::MultiResHeightMapRenderer::getLowResVertexCntX ( ) const
inline

Definition at line 105 of file MultiResHeightMapRenderer.h.

◆ getLowResVertexCntY()

int osg_terrain::MultiResHeightMapRenderer::getLowResVertexCntY ( ) const
inline

Definition at line 107 of file MultiResHeightMapRenderer.h.

◆ getNormal()

void osg_terrain::MultiResHeightMapRenderer::getNormal ( int  x,
int  y,
int  mx,
int  my,
double  x_step,
double  y_step,
double **  height_data,
float *  normal,
float *  tangent,
bool  skipBorder 
)
private

Definition at line 805 of file MultiResHeightMapRenderer.cpp.

◆ handleCamPos()

void osg_terrain::MultiResHeightMapRenderer::handleCamPos ( double  x,
double  y,
Tile tile 
)
protected

Definition at line 321 of file MultiResHeightMapRenderer.cpp.

◆ highInitialize()

void osg_terrain::MultiResHeightMapRenderer::highInitialize ( )

Definition at line 105 of file MultiResHeightMapRenderer.cpp.

◆ initialize()

void osg_terrain::MultiResHeightMapRenderer::initialize ( )

Definition at line 85 of file MultiResHeightMapRenderer.cpp.

◆ initPlane()

bool osg_terrain::MultiResHeightMapRenderer::initPlane ( bool  highRes)
protected

Definition at line 465 of file MultiResHeightMapRenderer.cpp.

◆ moveTile()

void osg_terrain::MultiResHeightMapRenderer::moveTile ( int  indicesOffsetPos,
int  verticesOffsetPos,
Tile tile 
)
protected

Definition at line 991 of file MultiResHeightMapRenderer.cpp.

◆ normalize()

void osg_terrain::MultiResHeightMapRenderer::normalize ( float *  v)
private

Definition at line 900 of file MultiResHeightMapRenderer.cpp.

◆ prepare()

void osg_terrain::MultiResHeightMapRenderer::prepare ( )
private

Definition at line 119 of file MultiResHeightMapRenderer.cpp.

◆ recalcSteps()

void osg_terrain::MultiResHeightMapRenderer::recalcSteps ( )
protected

Definition at line 211 of file MultiResHeightMapRenderer.cpp.

◆ render() [1/2]

void osg_terrain::MultiResHeightMapRenderer::render ( )

Definition at line 220 of file MultiResHeightMapRenderer.cpp.

◆ render() [2/2]

void osg_terrain::MultiResHeightMapRenderer::render ( bool  highRes)
private

Definition at line 917 of file MultiResHeightMapRenderer.cpp.

◆ run()

void osg_terrain::MultiResHeightMapRenderer::run ( void  )
protectedvirtual

The simulator main loop.

Implements mars::utils::Thread.

Definition at line 1028 of file MultiResHeightMapRenderer.cpp.

◆ setCameraPosition()

void osg_terrain::MultiResHeightMapRenderer::setCameraPosition ( double  x,
double  y 
)
inline

Definition at line 100 of file MultiResHeightMapRenderer.h.

◆ setDrawSolid()

void osg_terrain::MultiResHeightMapRenderer::setDrawSolid ( bool  drawSolid)

Definition at line 983 of file MultiResHeightMapRenderer.cpp.

◆ setDrawWireframe()

void osg_terrain::MultiResHeightMapRenderer::setDrawWireframe ( bool  drawWireframe)

Definition at line 987 of file MultiResHeightMapRenderer.cpp.

◆ setHeight()

void osg_terrain::MultiResHeightMapRenderer::setHeight ( unsigned int  gridX,
unsigned int  gridY,
double  height 
)

Definition at line 791 of file MultiResHeightMapRenderer.cpp.

Member Data Documentation

◆ camX

double osg_terrain::MultiResHeightMapRenderer::camX
private

Definition at line 158 of file MultiResHeightMapRenderer.h.

◆ camY

double osg_terrain::MultiResHeightMapRenderer::camY
private

Definition at line 158 of file MultiResHeightMapRenderer.h.

◆ dataMutex

mars::utils::Mutex osg_terrain::MultiResHeightMapRenderer::dataMutex
private

Definition at line 168 of file MultiResHeightMapRenderer.h.

◆ depth

int osg_terrain::MultiResHeightMapRenderer::depth
private

Definition at line 176 of file MultiResHeightMapRenderer.h.

◆ dirty

bool osg_terrain::MultiResHeightMapRenderer::dirty
private

Definition at line 178 of file MultiResHeightMapRenderer.h.

◆ finish

bool osg_terrain::MultiResHeightMapRenderer::finish
private

Definition at line 167 of file MultiResHeightMapRenderer.h.

◆ height

int osg_terrain::MultiResHeightMapRenderer::height
private

Definition at line 154 of file MultiResHeightMapRenderer.h.

◆ highHeight

int osg_terrain::MultiResHeightMapRenderer::highHeight
private

Definition at line 175 of file MultiResHeightMapRenderer.h.

◆ highIndexCopy

GLuint * osg_terrain::MultiResHeightMapRenderer::highIndexCopy
private

Definition at line 166 of file MultiResHeightMapRenderer.h.

◆ highIndices

GLuint* osg_terrain::MultiResHeightMapRenderer::highIndices
private

Definition at line 162 of file MultiResHeightMapRenderer.h.

◆ highIndicesToDraw

int osg_terrain::MultiResHeightMapRenderer::highIndicesToDraw
private

Definition at line 172 of file MultiResHeightMapRenderer.h.

◆ highIndicesToDrawBuffer

int osg_terrain::MultiResHeightMapRenderer::highIndicesToDrawBuffer
private

Definition at line 172 of file MultiResHeightMapRenderer.h.

◆ highIsInitialized

bool osg_terrain::MultiResHeightMapRenderer::highIsInitialized
private

Definition at line 152 of file MultiResHeightMapRenderer.h.

◆ highNumIndices

int osg_terrain::MultiResHeightMapRenderer::highNumIndices
private

Definition at line 171 of file MultiResHeightMapRenderer.h.

◆ highNumVertices

int osg_terrain::MultiResHeightMapRenderer::highNumVertices
private

Definition at line 171 of file MultiResHeightMapRenderer.h.

◆ highSolid

bool osg_terrain::MultiResHeightMapRenderer::highSolid
private

Definition at line 180 of file MultiResHeightMapRenderer.h.

◆ highStepX

double osg_terrain::MultiResHeightMapRenderer::highStepX
private

Definition at line 174 of file MultiResHeightMapRenderer.h.

◆ highStepY

double osg_terrain::MultiResHeightMapRenderer::highStepY
private

Definition at line 174 of file MultiResHeightMapRenderer.h.

◆ highVertexCopy

VertexData * osg_terrain::MultiResHeightMapRenderer::highVertexCopy
private

Definition at line 165 of file MultiResHeightMapRenderer.h.

◆ highVertices

VertexData* osg_terrain::MultiResHeightMapRenderer::highVertices
private

Definition at line 161 of file MultiResHeightMapRenderer.h.

◆ highWidth

int osg_terrain::MultiResHeightMapRenderer::highWidth
private

Definition at line 175 of file MultiResHeightMapRenderer.h.

◆ highWireframe

bool osg_terrain::MultiResHeightMapRenderer::highWireframe
private

Definition at line 180 of file MultiResHeightMapRenderer.h.

◆ img

IplImage* osg_terrain::MultiResHeightMapRenderer::img
private

Definition at line 181 of file MultiResHeightMapRenderer.h.

◆ indexCopy

GLuint* osg_terrain::MultiResHeightMapRenderer::indexCopy
private

Definition at line 166 of file MultiResHeightMapRenderer.h.

◆ indices

GLuint* osg_terrain::MultiResHeightMapRenderer::indices
private

Definition at line 160 of file MultiResHeightMapRenderer.h.

◆ indicesToDraw

int osg_terrain::MultiResHeightMapRenderer::indicesToDraw
private

Definition at line 172 of file MultiResHeightMapRenderer.h.

◆ isInitialized

bool osg_terrain::MultiResHeightMapRenderer::isInitialized
private

Definition at line 152 of file MultiResHeightMapRenderer.h.

◆ listSubTiles

std::vector<Tile*> osg_terrain::MultiResHeightMapRenderer::listSubTiles
private

Definition at line 184 of file MultiResHeightMapRenderer.h.

◆ mainTile

Tile* osg_terrain::MultiResHeightMapRenderer::mainTile
private

Definition at line 157 of file MultiResHeightMapRenderer.h.

◆ maxNumSubTiles

int osg_terrain::MultiResHeightMapRenderer::maxNumSubTiles
private

Definition at line 176 of file MultiResHeightMapRenderer.h.

◆ maxX

double osg_terrain::MultiResHeightMapRenderer::maxX
private

Definition at line 179 of file MultiResHeightMapRenderer.h.

◆ maxY

double osg_terrain::MultiResHeightMapRenderer::maxY
private

Definition at line 179 of file MultiResHeightMapRenderer.h.

◆ maxZ

double osg_terrain::MultiResHeightMapRenderer::maxZ
private

Definition at line 179 of file MultiResHeightMapRenderer.h.

◆ minX

double osg_terrain::MultiResHeightMapRenderer::minX
private

Definition at line 179 of file MultiResHeightMapRenderer.h.

◆ minY

double osg_terrain::MultiResHeightMapRenderer::minY
private

Definition at line 179 of file MultiResHeightMapRenderer.h.

◆ minZ

double osg_terrain::MultiResHeightMapRenderer::minZ
private

Definition at line 179 of file MultiResHeightMapRenderer.h.

◆ newIndicesPos

double osg_terrain::MultiResHeightMapRenderer::newIndicesPos
private

Definition at line 177 of file MultiResHeightMapRenderer.h.

◆ newVerticesPos

double osg_terrain::MultiResHeightMapRenderer::newVerticesPos
private

Definition at line 177 of file MultiResHeightMapRenderer.h.

◆ numIndices

int osg_terrain::MultiResHeightMapRenderer::numIndices
private

Definition at line 170 of file MultiResHeightMapRenderer.h.

◆ numSubTiles

int osg_terrain::MultiResHeightMapRenderer::numSubTiles
private

Definition at line 176 of file MultiResHeightMapRenderer.h.

◆ numVertices

int osg_terrain::MultiResHeightMapRenderer::numVertices
private

Definition at line 170 of file MultiResHeightMapRenderer.h.

◆ scaleZ

double osg_terrain::MultiResHeightMapRenderer::scaleZ
private

Definition at line 155 of file MultiResHeightMapRenderer.h.

◆ solid

bool osg_terrain::MultiResHeightMapRenderer::solid
private

Definition at line 180 of file MultiResHeightMapRenderer.h.

◆ subTiles

std::map<int, Tile*> osg_terrain::MultiResHeightMapRenderer::subTiles
private

Definition at line 183 of file MultiResHeightMapRenderer.h.

◆ swapBuffer

bool osg_terrain::MultiResHeightMapRenderer::swapBuffer
private

Definition at line 167 of file MultiResHeightMapRenderer.h.

◆ swapBuffer2

bool osg_terrain::MultiResHeightMapRenderer::swapBuffer2
private

Definition at line 167 of file MultiResHeightMapRenderer.h.

◆ swapMutex

mars::utils::Mutex osg_terrain::MultiResHeightMapRenderer::swapMutex
private

Definition at line 168 of file MultiResHeightMapRenderer.h.

◆ targetHeight

double osg_terrain::MultiResHeightMapRenderer::targetHeight
private

Definition at line 153 of file MultiResHeightMapRenderer.h.

◆ targetWidth

double osg_terrain::MultiResHeightMapRenderer::targetWidth
private

Definition at line 153 of file MultiResHeightMapRenderer.h.

◆ texScaleX

double osg_terrain::MultiResHeightMapRenderer::texScaleX
private

Definition at line 156 of file MultiResHeightMapRenderer.h.

◆ texScaleY

double osg_terrain::MultiResHeightMapRenderer::texScaleY
private

Definition at line 156 of file MultiResHeightMapRenderer.h.

◆ vboIds

GLuint* osg_terrain::MultiResHeightMapRenderer::vboIds
private

Definition at line 151 of file MultiResHeightMapRenderer.h.

◆ vertexCopy

VertexData* osg_terrain::MultiResHeightMapRenderer::vertexCopy
private

Definition at line 165 of file MultiResHeightMapRenderer.h.

◆ vertices

VertexData* osg_terrain::MultiResHeightMapRenderer::vertices
private

Definition at line 159 of file MultiResHeightMapRenderer.h.

◆ width

int osg_terrain::MultiResHeightMapRenderer::width
private

Definition at line 154 of file MultiResHeightMapRenderer.h.

◆ wireframe

bool osg_terrain::MultiResHeightMapRenderer::wireframe
private

Definition at line 180 of file MultiResHeightMapRenderer.h.


The documentation for this class was generated from the following files: