22 #ifdef USE_VERTEX_BUFFER 25 #ifndef GL_GLEXT_PROTOTYPES 26 #define GL_GLEXT_PROTOTYPES 1 //for glGenBuffers, glBindBuffer, 30 #include "VertexBufferTerrain.h" 39 #include <mars/utils/misc.h> 47 setSupportsDisplayList(
false);
48 setUseDisplayList(
false);
50 mrhmr =
new MultiResHeightMapRenderer(1, 1, 1, 1, 1.0, 1.0, 1, 1.0, 1.0);
56 setSupportsDisplayList(
false);
58 mrhmr =
new MultiResHeightMapRenderer(ts->width, ts->height,
59 ts->targetWidth, ts->targetHeight,
60 1.0, 1.0, 1.0, ts->texScaleX,
62 double maxHeight = 0.0;
65 for(
int i=0; i<ts->height; ++i)
66 for(
int j=0; j<ts->width; ++j) {
67 if(i==0 || j==0 || i==ts->height-1 || j==ts->width-1) offset = -0.1;
69 mrhmr->
setHeight(j, i, offset+ts->scale*ts->pixelData[i*ts->width+j]);
70 if(ts->pixelData[i*ts->width+j]*ts->scale > maxHeight) {
71 maxHeight = ts->pixelData[i*ts->width+j]*ts->scale;
75 width = ts->targetWidth;
88 osg::State& state = *renderInfo.getState();
89 state.disableAllVertexArrays();
90 osg::ArrayDispatchers& arrayDispatchers = state.getArrayDispatchers();
92 arrayDispatchers.reset();
95 state.lazyDisablingOfVertexAttributes();
96 state.applyDisablingOfVertexAttributes();
102 fprintf(stderr,
"MultiResHeightMapRenderer: drawTime: %ld\n", drawTime);
107 double zPos,
double radius) {
virtual void drawImplementation(osg::RenderInfo &renderInfo) const
void setSelected(bool val)
void collideSphere(double xPos, double yPos, double zPos, double radius)
virtual ~VertexBufferTerrain()
void setDrawSolid(bool drawSolid)
virtual osg::BoundingBox computeBound() const
Copyright 2012, DFKI GmbH Robotics Innovation Center.
void collideSphere(double xPos, double yPos, double zPos, double radius)
MultiResHeightMapRenderer * mrhmr
void setDrawWireframe(bool drawWireframe)
void setHeight(unsigned int gridX, unsigned int gridY, double height)
long long getTimeDiff(long long start)
returns the time difference between now and a given reference.