Converted osg::HeightField across to using a osg::FloatArray internally to enable
it to be assigned as a vertex attribute array to an osg::Geometry. Removed the osgTerrain::ArrayLayer as its no longer required thanks to the above change which makes the osgTerrain::HeightFieldLayer more flexible. Updated wrappers
This commit is contained in:
@@ -19,6 +19,31 @@ Shape::~Shape()
|
||||
{
|
||||
}
|
||||
|
||||
HeightField::HeightField():
|
||||
_columns(0),
|
||||
_rows(0),
|
||||
_origin(0.0f,0.0f,0.0f),
|
||||
_dx(1.0f),
|
||||
_dy(1.0f),
|
||||
_skirtHeight(0.0f),
|
||||
_borderWidth(0)
|
||||
{
|
||||
_heights = new osg::FloatArray;
|
||||
}
|
||||
|
||||
HeightField::HeightField(const HeightField& mesh,const CopyOp& copyop):
|
||||
Shape(mesh,copyop),
|
||||
_columns(mesh._columns),
|
||||
_rows(mesh._rows),
|
||||
_origin(mesh._origin),
|
||||
_dx(mesh._dx),
|
||||
_dy(mesh._dy),
|
||||
_skirtHeight(mesh._skirtHeight),
|
||||
_borderWidth(mesh._borderWidth),
|
||||
_heights(new osg::FloatArray(*mesh._heights))
|
||||
{
|
||||
}
|
||||
|
||||
HeightField::~HeightField()
|
||||
{
|
||||
}
|
||||
@@ -28,7 +53,7 @@ void HeightField::allocate(unsigned int numColumns,unsigned int numRows)
|
||||
{
|
||||
if (_columns!=numColumns || _rows!=numRows)
|
||||
{
|
||||
_heights.resize(numColumns*numRows);
|
||||
_heights->resize(numColumns*numRows);
|
||||
}
|
||||
_columns=numColumns;
|
||||
_rows=numRows;
|
||||
|
||||
@@ -12,6 +12,7 @@
|
||||
*/
|
||||
|
||||
#include <osgTerrain/Layer>
|
||||
#include <osg/Notify>
|
||||
|
||||
using namespace osgTerrain;
|
||||
|
||||
@@ -78,6 +79,30 @@ void ImageLayer::setImage(osg::Image* image)
|
||||
}
|
||||
|
||||
|
||||
bool ImageLayer::getValue(unsigned int i, unsigned int j, float& value) const
|
||||
{
|
||||
osg::notify(osg::NOTICE)<<"Not implemented yet"<<std::endl;
|
||||
return false;
|
||||
}
|
||||
|
||||
bool ImageLayer::getValue(unsigned int i, unsigned int j, osg::Vec2& value) const
|
||||
{
|
||||
osg::notify(osg::NOTICE)<<"Not implemented yet"<<std::endl;
|
||||
return false;
|
||||
}
|
||||
|
||||
bool ImageLayer::getValue(unsigned int i, unsigned int j, osg::Vec3& value) const
|
||||
{
|
||||
osg::notify(osg::NOTICE)<<"Not implemented yet"<<std::endl;
|
||||
return false;
|
||||
}
|
||||
|
||||
bool ImageLayer::getValue(unsigned int i, unsigned int j, osg::Vec4& value) const
|
||||
{
|
||||
osg::notify(osg::NOTICE)<<"Not implemented yet"<<std::endl;
|
||||
return false;
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// HieghtFieldLayer
|
||||
@@ -98,21 +123,27 @@ void HeightFieldLayer::setHeightField(osg::HeightField* hf)
|
||||
_heightField = hf;
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// ImageLayer
|
||||
//
|
||||
ArrayLayer::ArrayLayer()
|
||||
|
||||
bool HeightFieldLayer::getValue(unsigned int i, unsigned int j, float& value) const
|
||||
{
|
||||
osg::notify(osg::NOTICE)<<"Not implemented yet"<<std::endl;
|
||||
return false;
|
||||
}
|
||||
|
||||
ArrayLayer::ArrayLayer(const ArrayLayer& arrayLayer,const osg::CopyOp& copyop):
|
||||
Layer(arrayLayer,copyop),
|
||||
_array(arrayLayer._array)
|
||||
bool HeightFieldLayer::getValue(unsigned int i, unsigned int j, osg::Vec2& value) const
|
||||
{
|
||||
osg::notify(osg::NOTICE)<<"Not implemented yet"<<std::endl;
|
||||
return false;
|
||||
}
|
||||
|
||||
void ArrayLayer::setArray(osg::Array* array)
|
||||
bool HeightFieldLayer::getValue(unsigned int i, unsigned int j, osg::Vec3& value) const
|
||||
{
|
||||
_array = array;
|
||||
osg::notify(osg::NOTICE)<<"Not implemented yet"<<std::endl;
|
||||
return false;
|
||||
}
|
||||
|
||||
bool HeightFieldLayer::getValue(unsigned int i, unsigned int j, osg::Vec4& value) const
|
||||
{
|
||||
osg::notify(osg::NOTICE)<<"Not implemented yet"<<std::endl;
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -818,6 +818,26 @@ BEGIN_OBJECT_REFLECTOR(osg::HeightField)
|
||||
__float__getYInterval,
|
||||
"",
|
||||
"");
|
||||
I_Method0(osg::FloatArray *, getFloatArray,
|
||||
Properties::NON_VIRTUAL,
|
||||
__osg_FloatArray_P1__getFloatArray,
|
||||
"Get the FloatArray height data. ",
|
||||
"");
|
||||
I_Method0(const osg::FloatArray *, getFloatArray,
|
||||
Properties::NON_VIRTUAL,
|
||||
__C5_osg_FloatArray_P1__getFloatArray,
|
||||
"Get the const sFloatArray height data. ",
|
||||
"");
|
||||
I_Method0(osg::HeightField::HeightList &, getHeightList,
|
||||
Properties::NON_VIRTUAL,
|
||||
__HeightList_R1__getHeightList,
|
||||
"",
|
||||
"");
|
||||
I_Method0(const osg::HeightField::HeightList &, getHeightList,
|
||||
Properties::NON_VIRTUAL,
|
||||
__C5_HeightList_R1__getHeightList,
|
||||
"",
|
||||
"");
|
||||
I_Method1(void, setSkirtHeight, IN, float, skirtHeight,
|
||||
Properties::NON_VIRTUAL,
|
||||
__void__setSkirtHeight__float,
|
||||
@@ -873,16 +893,6 @@ BEGIN_OBJECT_REFLECTOR(osg::HeightField)
|
||||
__float__getHeight__unsigned_int__unsigned_int,
|
||||
"",
|
||||
"");
|
||||
I_Method0(osg::HeightField::HeightList &, getHeightList,
|
||||
Properties::NON_VIRTUAL,
|
||||
__HeightList_R1__getHeightList,
|
||||
"",
|
||||
"");
|
||||
I_Method0(const osg::HeightField::HeightList &, getHeightList,
|
||||
Properties::NON_VIRTUAL,
|
||||
__C5_HeightList_R1__getHeightList,
|
||||
"",
|
||||
"");
|
||||
I_Method2(osg::Vec3, getVertex, IN, unsigned int, c, IN, unsigned int, r,
|
||||
Properties::NON_VIRTUAL,
|
||||
__Vec3__getVertex__unsigned_int__unsigned_int,
|
||||
@@ -901,6 +911,9 @@ BEGIN_OBJECT_REFLECTOR(osg::HeightField)
|
||||
I_SimpleProperty(unsigned int, BorderWidth,
|
||||
__unsigned_int__getBorderWidth,
|
||||
__void__setBorderWidth__unsigned_int);
|
||||
I_SimpleProperty(osg::FloatArray *, FloatArray,
|
||||
__osg_FloatArray_P1__getFloatArray,
|
||||
0);
|
||||
I_IndexedProperty(float, Height,
|
||||
__float__getHeight__unsigned_int__unsigned_int,
|
||||
__void__setHeight__unsigned_int__unsigned_int__float,
|
||||
|
||||
@@ -10,12 +10,14 @@
|
||||
#include <osgIntrospection/StaticMethodInfo>
|
||||
#include <osgIntrospection/Attributes>
|
||||
|
||||
#include <osg/Array>
|
||||
#include <osg/BoundingSphere>
|
||||
#include <osg/CopyOp>
|
||||
#include <osg/Image>
|
||||
#include <osg/Object>
|
||||
#include <osg/Shape>
|
||||
#include <osg/Vec2>
|
||||
#include <osg/Vec3>
|
||||
#include <osg/Vec4>
|
||||
#include <osgTerrain/Layer>
|
||||
#include <osgTerrain/Locator>
|
||||
|
||||
@@ -27,35 +29,6 @@
|
||||
#undef OUT
|
||||
#endif
|
||||
|
||||
BEGIN_OBJECT_REFLECTOR(osgTerrain::ArrayLayer)
|
||||
I_BaseType(osgTerrain::Layer);
|
||||
I_Constructor0(____ArrayLayer,
|
||||
"",
|
||||
"");
|
||||
I_ConstructorWithDefaults2(IN, const osgTerrain::ArrayLayer &, x, , IN, const osg::CopyOp &, copyop, osg::CopyOp::SHALLOW_COPY,
|
||||
____ArrayLayer__C5_ArrayLayer_R1__C5_osg_CopyOp_R1,
|
||||
"Copy constructor using CopyOp to manage deep vs shallow copy. ",
|
||||
"");
|
||||
I_Method1(void, setArray, IN, osg::Array *, array,
|
||||
Properties::NON_VIRTUAL,
|
||||
__void__setArray__osg_Array_P1,
|
||||
"",
|
||||
"");
|
||||
I_Method0(osg::Array *, getArray,
|
||||
Properties::NON_VIRTUAL,
|
||||
__osg_Array_P1__getArray,
|
||||
"",
|
||||
"");
|
||||
I_Method0(const osg::Array *, getArray,
|
||||
Properties::NON_VIRTUAL,
|
||||
__C5_osg_Array_P1__getArray,
|
||||
"",
|
||||
"");
|
||||
I_SimpleProperty(osg::Array *, Array,
|
||||
__osg_Array_P1__getArray,
|
||||
__void__setArray__osg_Array_P1);
|
||||
END_REFLECTOR
|
||||
|
||||
BEGIN_OBJECT_REFLECTOR(osgTerrain::HeightFieldLayer)
|
||||
I_BaseType(osgTerrain::Layer);
|
||||
I_Constructor0(____HeightFieldLayer,
|
||||
@@ -80,6 +53,36 @@ BEGIN_OBJECT_REFLECTOR(osgTerrain::HeightFieldLayer)
|
||||
__C5_osg_HeightField_P1__getHeightField,
|
||||
"",
|
||||
"");
|
||||
I_Method0(unsigned int, getNumColumns,
|
||||
Properties::VIRTUAL,
|
||||
__unsigned_int__getNumColumns,
|
||||
"",
|
||||
"");
|
||||
I_Method0(unsigned int, getNumRows,
|
||||
Properties::VIRTUAL,
|
||||
__unsigned_int__getNumRows,
|
||||
"",
|
||||
"");
|
||||
I_Method3(bool, getValue, IN, unsigned int, i, IN, unsigned int, j, IN, float &, value,
|
||||
Properties::VIRTUAL,
|
||||
__bool__getValue__unsigned_int__unsigned_int__float_R1,
|
||||
"",
|
||||
"");
|
||||
I_Method3(bool, getValue, IN, unsigned int, i, IN, unsigned int, j, IN, osg::Vec2 &, value,
|
||||
Properties::VIRTUAL,
|
||||
__bool__getValue__unsigned_int__unsigned_int__osg_Vec2_R1,
|
||||
"",
|
||||
"");
|
||||
I_Method3(bool, getValue, IN, unsigned int, i, IN, unsigned int, j, IN, osg::Vec3 &, value,
|
||||
Properties::VIRTUAL,
|
||||
__bool__getValue__unsigned_int__unsigned_int__osg_Vec3_R1,
|
||||
"",
|
||||
"");
|
||||
I_Method3(bool, getValue, IN, unsigned int, i, IN, unsigned int, j, IN, osg::Vec4 &, value,
|
||||
Properties::VIRTUAL,
|
||||
__bool__getValue__unsigned_int__unsigned_int__osg_Vec4_R1,
|
||||
"",
|
||||
"");
|
||||
I_SimpleProperty(osg::HeightField *, HeightField,
|
||||
__osg_HeightField_P1__getHeightField,
|
||||
__void__setHeightField__osg_HeightField_P1);
|
||||
@@ -109,6 +112,36 @@ BEGIN_OBJECT_REFLECTOR(osgTerrain::ImageLayer)
|
||||
__C5_osg_Image_P1__getImage,
|
||||
"",
|
||||
"");
|
||||
I_Method0(unsigned int, getNumColumns,
|
||||
Properties::VIRTUAL,
|
||||
__unsigned_int__getNumColumns,
|
||||
"",
|
||||
"");
|
||||
I_Method0(unsigned int, getNumRows,
|
||||
Properties::VIRTUAL,
|
||||
__unsigned_int__getNumRows,
|
||||
"",
|
||||
"");
|
||||
I_Method3(bool, getValue, IN, unsigned int, i, IN, unsigned int, j, IN, float &, value,
|
||||
Properties::VIRTUAL,
|
||||
__bool__getValue__unsigned_int__unsigned_int__float_R1,
|
||||
"",
|
||||
"");
|
||||
I_Method3(bool, getValue, IN, unsigned int, i, IN, unsigned int, j, IN, osg::Vec2 &, value,
|
||||
Properties::VIRTUAL,
|
||||
__bool__getValue__unsigned_int__unsigned_int__osg_Vec2_R1,
|
||||
"",
|
||||
"");
|
||||
I_Method3(bool, getValue, IN, unsigned int, i, IN, unsigned int, j, IN, osg::Vec3 &, value,
|
||||
Properties::VIRTUAL,
|
||||
__bool__getValue__unsigned_int__unsigned_int__osg_Vec3_R1,
|
||||
"",
|
||||
"");
|
||||
I_Method3(bool, getValue, IN, unsigned int, i, IN, unsigned int, j, IN, osg::Vec4 &, value,
|
||||
Properties::VIRTUAL,
|
||||
__bool__getValue__unsigned_int__unsigned_int__osg_Vec4_R1,
|
||||
"",
|
||||
"");
|
||||
I_SimpleProperty(osg::Image *, Image,
|
||||
__osg_Image_P1__getImage,
|
||||
__void__setImage__osg_Image_P1);
|
||||
@@ -163,6 +196,46 @@ BEGIN_OBJECT_REFLECTOR(osgTerrain::Layer)
|
||||
__C5_Locator_P1__getLocator,
|
||||
"",
|
||||
"");
|
||||
I_Method0(unsigned int, getNumColumns,
|
||||
Properties::VIRTUAL,
|
||||
__unsigned_int__getNumColumns,
|
||||
"",
|
||||
"");
|
||||
I_Method0(unsigned int, getNumRows,
|
||||
Properties::VIRTUAL,
|
||||
__unsigned_int__getNumRows,
|
||||
"",
|
||||
"");
|
||||
I_Method3(bool, getValue, IN, unsigned, int, IN, unsigned, int, IN, float &, x,
|
||||
Properties::VIRTUAL,
|
||||
__bool__getValue__unsigned__unsigned__float_R1,
|
||||
"",
|
||||
"");
|
||||
I_Method3(bool, getValue, IN, unsigned, int, IN, unsigned, int, IN, osg::Vec2 &, x,
|
||||
Properties::VIRTUAL,
|
||||
__bool__getValue__unsigned__unsigned__osg_Vec2_R1,
|
||||
"",
|
||||
"");
|
||||
I_Method3(bool, getValue, IN, unsigned, int, IN, unsigned, int, IN, osg::Vec3 &, x,
|
||||
Properties::VIRTUAL,
|
||||
__bool__getValue__unsigned__unsigned__osg_Vec3_R1,
|
||||
"",
|
||||
"");
|
||||
I_Method3(bool, getValue, IN, unsigned, int, IN, unsigned, int, IN, osg::Vec4 &, x,
|
||||
Properties::VIRTUAL,
|
||||
__bool__getValue__unsigned__unsigned__osg_Vec4_R1,
|
||||
"",
|
||||
"");
|
||||
I_Method6(void, computeIndices, IN, double, ndc_x, IN, double, ndc_y, IN, unsigned int &, i, IN, unsigned int &, j, IN, double &, ir, IN, double &, jr,
|
||||
Properties::NON_VIRTUAL,
|
||||
__void__computeIndices__double__double__unsigned_int_R1__unsigned_int_R1__double_R1__double_R1,
|
||||
"",
|
||||
"");
|
||||
I_Method3(bool, getInterpolatedValue, IN, double, ndc_x, IN, double, ndc_y, IN, float &, value,
|
||||
Properties::NON_VIRTUAL,
|
||||
__bool__getInterpolatedValue__double__double__float_R1,
|
||||
"",
|
||||
"");
|
||||
I_Method0(osg::BoundingSphere, computeBound,
|
||||
Properties::VIRTUAL,
|
||||
__osg_BoundingSphere__computeBound,
|
||||
|
||||
Reference in New Issue
Block a user