Added support for primitive functor into the new osg::ProceduralGeometry class
This commit is contained in:
@@ -3,45 +3,6 @@
|
||||
|
||||
using namespace osg;
|
||||
|
||||
Grid::Grid()
|
||||
{
|
||||
}
|
||||
|
||||
Grid::Grid(const Grid& mesh,const CopyOp& copyop):
|
||||
HeightField(mesh,copyop)
|
||||
{
|
||||
_heights = mesh._heights;
|
||||
}
|
||||
|
||||
Grid::~Grid()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
void Grid::allocGrid(unsigned int numColumns,unsigned int numRows, float value)
|
||||
{
|
||||
if (_columns!=numColumns || _rows!=numRows)
|
||||
{
|
||||
_heights.resize(numColumns*numRows);
|
||||
}
|
||||
_columns=numColumns;
|
||||
_rows=numRows;
|
||||
//_heights.fill(value);
|
||||
}
|
||||
|
||||
void Grid::populateGrid(float minValue,float maxValue)
|
||||
{
|
||||
float offset=minValue;
|
||||
float gain=(maxValue-minValue)/(float)RAND_MAX;
|
||||
for(unsigned int row=0;row<_rows;++row)
|
||||
{
|
||||
for(unsigned int col=0;col<_columns;++col)
|
||||
{
|
||||
setHeight(col,row,rand()*gain+offset);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Vec3 HeightField::getNormal(unsigned int c,unsigned int r) const
|
||||
{
|
||||
// four point normal generation.
|
||||
@@ -79,3 +40,28 @@ Vec3 HeightField::getNormal(unsigned int c,unsigned int r) const
|
||||
|
||||
return normal;
|
||||
}
|
||||
|
||||
Grid::Grid()
|
||||
{
|
||||
}
|
||||
|
||||
Grid::Grid(const Grid& mesh,const CopyOp& copyop):
|
||||
HeightField(mesh,copyop)
|
||||
{
|
||||
_heights = mesh._heights;
|
||||
}
|
||||
|
||||
Grid::~Grid()
|
||||
{
|
||||
}
|
||||
|
||||
void Grid::allocateGrid(unsigned int numColumns,unsigned int numRows)
|
||||
{
|
||||
if (_columns!=numColumns || _rows!=numRows)
|
||||
{
|
||||
_heights.resize(numColumns*numRows);
|
||||
}
|
||||
_columns=numColumns;
|
||||
_rows=numRows;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user