Added TextureUnit entry to osg::TransferFunction and osgTerrain::Layer
This commit is contained in:
parent
c1a1f742c3
commit
6516bf4910
@ -31,6 +31,13 @@ class OSG_EXPORT TransferFunction : public osg::Referenced
|
|||||||
|
|
||||||
TransferFunction();
|
TransferFunction();
|
||||||
|
|
||||||
|
/** Set the texture unit to assign layer to if required.
|
||||||
|
* Negative values signifies that no texture unit has been assigned. */
|
||||||
|
void setTextureUnit(int textureUnit) { _textureUnit = textureUnit; }
|
||||||
|
|
||||||
|
/** Get the texture unit to assign layer to if required.*/
|
||||||
|
int getTextureUnit() const { return _textureUnit; }
|
||||||
|
|
||||||
osg::Image* getImage() { return _image.get(); }
|
osg::Image* getImage() { return _image.get(); }
|
||||||
const osg::Image* getImage() const { return _image.get(); }
|
const osg::Image* getImage() const { return _image.get(); }
|
||||||
|
|
||||||
@ -45,7 +52,9 @@ class OSG_EXPORT TransferFunction : public osg::Referenced
|
|||||||
virtual ~TransferFunction();
|
virtual ~TransferFunction();
|
||||||
|
|
||||||
typedef std::vector<osg::Vec4> Colors;
|
typedef std::vector<osg::Vec4> Colors;
|
||||||
Colors _colors;
|
|
||||||
|
int _textureUnit;
|
||||||
|
Colors _colors;
|
||||||
osg::ref_ptr<osg::Image> _image;
|
osg::ref_ptr<osg::Image> _image;
|
||||||
osg::ref_ptr<osg::Texture> _texture;
|
osg::ref_ptr<osg::Texture> _texture;
|
||||||
osg::ref_ptr<osg::Shader> _shader;
|
osg::ref_ptr<osg::Shader> _shader;
|
||||||
|
@ -36,9 +36,20 @@ class OSGTERRAIN_EXPORT Layer : public osg::Object
|
|||||||
|
|
||||||
META_Object(osgTerrain, Layer);
|
META_Object(osgTerrain, Layer);
|
||||||
|
|
||||||
|
/** Set the file name of the data associated with this layer. */
|
||||||
virtual void setFileName(const std::string& filename) { _filename = filename; }
|
virtual void setFileName(const std::string& filename) { _filename = filename; }
|
||||||
|
|
||||||
|
/** Get the file name of the layer. */
|
||||||
virtual const std::string& getFileName() const { return _filename; }
|
virtual const std::string& getFileName() const { return _filename; }
|
||||||
|
|
||||||
|
/** Set the texture unit to assign layer to if required.
|
||||||
|
* Negative values signifies that no texture unit has been assigned. */
|
||||||
|
void setTextureUnit(int textureUnit) { _textureUnit = textureUnit; }
|
||||||
|
|
||||||
|
/** Get the texture unit to assign layer to if required.*/
|
||||||
|
int getTextureUnit() const { return _textureUnit; }
|
||||||
|
|
||||||
|
|
||||||
void setLocator(Locator* locator) { _locator = locator; }
|
void setLocator(Locator* locator) { _locator = locator; }
|
||||||
Locator* getLocator() { return _locator.get(); }
|
Locator* getLocator() { return _locator.get(); }
|
||||||
const Locator* getLocator() const { return _locator.get(); }
|
const Locator* getLocator() const { return _locator.get(); }
|
||||||
@ -167,6 +178,7 @@ class OSGTERRAIN_EXPORT Layer : public osg::Object
|
|||||||
virtual ~Layer();
|
virtual ~Layer();
|
||||||
|
|
||||||
std::string _filename;
|
std::string _filename;
|
||||||
|
int _textureUnit;
|
||||||
osg::ref_ptr<Locator> _locator;
|
osg::ref_ptr<Locator> _locator;
|
||||||
unsigned int _minLevel;
|
unsigned int _minLevel;
|
||||||
unsigned int _maxLevel;
|
unsigned int _maxLevel;
|
||||||
|
@ -19,7 +19,8 @@ using namespace osg;
|
|||||||
//
|
//
|
||||||
// TransferFunction base class
|
// TransferFunction base class
|
||||||
//
|
//
|
||||||
TransferFunction::TransferFunction()
|
TransferFunction::TransferFunction():
|
||||||
|
_textureUnit(-1)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -31,8 +31,9 @@
|
|||||||
#define VERSION_0020 20
|
#define VERSION_0020 20
|
||||||
#define VERSION_0021 21
|
#define VERSION_0021 21
|
||||||
#define VERSION_0022 22
|
#define VERSION_0022 22
|
||||||
|
#define VERSION_0023 23
|
||||||
|
|
||||||
#define VERSION VERSION_0022
|
#define VERSION VERSION_0023
|
||||||
|
|
||||||
/* The BYTE_SEX tag is used to check the endian
|
/* The BYTE_SEX tag is used to check the endian
|
||||||
of the IVE file being read in. The IVE format
|
of the IVE file being read in. The IVE format
|
||||||
|
@ -39,6 +39,11 @@ void Layer::write(DataOutputStream* out)
|
|||||||
LayerHelper helper;
|
LayerHelper helper;
|
||||||
helper.writeLocator(out, getLocator());
|
helper.writeLocator(out, getLocator());
|
||||||
|
|
||||||
|
if (out->getVersion() >= VERSION_0023)
|
||||||
|
{
|
||||||
|
out->writeInt(getTextureUnit());
|
||||||
|
}
|
||||||
|
|
||||||
out->writeUInt(getMinLevel());
|
out->writeUInt(getMinLevel());
|
||||||
out->writeUInt(getMaxLevel());
|
out->writeUInt(getMaxLevel());
|
||||||
}
|
}
|
||||||
@ -63,6 +68,11 @@ void Layer::read(DataInputStream* in)
|
|||||||
LayerHelper helper;
|
LayerHelper helper;
|
||||||
setLocator(helper.readLocator(in));
|
setLocator(helper.readLocator(in));
|
||||||
|
|
||||||
|
if (in->getVersion() >= VERSION_0023)
|
||||||
|
{
|
||||||
|
setTextureUnit(in->readInt());
|
||||||
|
}
|
||||||
|
|
||||||
setMinLevel(in->readUInt());
|
setMinLevel(in->readUInt());
|
||||||
setMaxLevel(in->readUInt());
|
setMaxLevel(in->readUInt());
|
||||||
|
|
||||||
|
@ -35,6 +35,13 @@ bool Layer_readLocalData(osg::Object& obj, osgDB::Input &fr)
|
|||||||
osgTerrain::Locator* locator = dynamic_cast<osgTerrain::Locator*>(readObject.get());
|
osgTerrain::Locator* locator = dynamic_cast<osgTerrain::Locator*>(readObject.get());
|
||||||
if (locator) layer.setLocator(locator);
|
if (locator) layer.setLocator(locator);
|
||||||
|
|
||||||
|
int textureUnit=-1;
|
||||||
|
if (fr.read("TextureUnit",textureUnit))
|
||||||
|
{
|
||||||
|
itrAdvanced = true;
|
||||||
|
layer.setTextureUnit(textureUnit);
|
||||||
|
}
|
||||||
|
|
||||||
unsigned int minLevel=0;
|
unsigned int minLevel=0;
|
||||||
if (fr.read("MinLevel",minLevel))
|
if (fr.read("MinLevel",minLevel))
|
||||||
{
|
{
|
||||||
@ -61,6 +68,11 @@ bool Layer_writeLocalData(const osg::Object& obj, osgDB::Output& fw)
|
|||||||
fw.writeObject(*layer.getLocator());
|
fw.writeObject(*layer.getLocator());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (layer.getTextureUnit()>=0)
|
||||||
|
{
|
||||||
|
fw.indent()<<"TextureUnit "<<layer.getTextureUnit()<<std::endl;
|
||||||
|
}
|
||||||
|
|
||||||
if (layer.getMinLevel()!=0)
|
if (layer.getMinLevel()!=0)
|
||||||
{
|
{
|
||||||
fw.indent()<<"MinLevel "<<layer.getMinLevel()<<std::endl;
|
fw.indent()<<"MinLevel "<<layer.getMinLevel()<<std::endl;
|
||||||
|
@ -255,14 +255,14 @@ void GeometryTechnique::generateGeometry(Locator* masterLocator, const osg::Vec3
|
|||||||
unsigned int numVertices = numVerticesInBody+numVerticesInSkirt;
|
unsigned int numVertices = numVerticesInBody+numVerticesInSkirt;
|
||||||
|
|
||||||
// allocate and assign vertices
|
// allocate and assign vertices
|
||||||
osg::ref_ptr<osg::Vec3Array> _vertices = new osg::Vec3Array;
|
osg::ref_ptr<osg::Vec3Array> vertices = new osg::Vec3Array;
|
||||||
if (buffer._geometry.valid()) buffer._geometry->setVertexArray(_vertices.get());
|
if (buffer._geometry.valid()) buffer._geometry->setVertexArray(vertices.get());
|
||||||
|
|
||||||
// allocate and assign normals
|
// allocate and assign normals
|
||||||
osg::ref_ptr<osg::Vec3Array> _normals = new osg::Vec3Array;
|
osg::ref_ptr<osg::Vec3Array> normals = new osg::Vec3Array;
|
||||||
if (buffer._geometry.valid())
|
if (buffer._geometry.valid())
|
||||||
{
|
{
|
||||||
buffer._geometry->setNormalArray(_normals.get());
|
buffer._geometry->setNormalArray(normals.get());
|
||||||
buffer._geometry->setNormalBinding(osg::Geometry::BIND_PER_VERTEX);
|
buffer._geometry->setNormalBinding(osg::Geometry::BIND_PER_VERTEX);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -274,18 +274,18 @@ void GeometryTechnique::generateGeometry(Locator* masterLocator, const osg::Vec3
|
|||||||
float scaleHeight = 1.0;
|
float scaleHeight = 1.0;
|
||||||
|
|
||||||
// allocate and assign tex coords
|
// allocate and assign tex coords
|
||||||
osg::ref_ptr<osg::Vec2Array> _texcoords;
|
osg::ref_ptr<osg::Vec2Array> texcoords;
|
||||||
if (colorLayer)
|
if (colorLayer)
|
||||||
{
|
{
|
||||||
color_index = texcoord_index;
|
color_index = texcoord_index;
|
||||||
++texcoord_index;
|
++texcoord_index;
|
||||||
|
|
||||||
_texcoords = new osg::Vec2Array;
|
texcoords = new osg::Vec2Array;
|
||||||
|
|
||||||
if (buffer._geometry.valid()) buffer._geometry->setTexCoordArray(color_index, _texcoords.get());
|
if (buffer._geometry.valid()) buffer._geometry->setTexCoordArray(color_index, texcoords.get());
|
||||||
}
|
}
|
||||||
|
|
||||||
osg::ref_ptr<osg::FloatArray> _elevations = new osg::FloatArray;
|
osg::ref_ptr<osg::FloatArray> elevations = new osg::FloatArray;
|
||||||
osg::TransferFunction1D* tf = dynamic_cast<osg::TransferFunction1D*>(colorTF);
|
osg::TransferFunction1D* tf = dynamic_cast<osg::TransferFunction1D*>(colorTF);
|
||||||
if (tf)
|
if (tf)
|
||||||
{
|
{
|
||||||
@ -294,26 +294,26 @@ void GeometryTechnique::generateGeometry(Locator* masterLocator, const osg::Vec3
|
|||||||
|
|
||||||
if (!colorLayer)
|
if (!colorLayer)
|
||||||
{
|
{
|
||||||
// _elevations = new osg::FloatArray(numVertices);
|
// elevations = new osg::FloatArray(numVertices);
|
||||||
if (buffer._geometry.valid()) buffer._geometry->setTexCoordArray(tf_index, _elevations.get());
|
if (buffer._geometry.valid()) buffer._geometry->setTexCoordArray(tf_index, elevations.get());
|
||||||
|
|
||||||
minHeight = tf->getMinimum();
|
minHeight = tf->getMinimum();
|
||||||
scaleHeight = 1.0f/(tf->getMaximum()-tf->getMinimum());
|
scaleHeight = 1.0f/(tf->getMaximum()-tf->getMinimum());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (_vertices.valid()) _vertices->reserve(numVertices);
|
if (vertices.valid()) vertices->reserve(numVertices);
|
||||||
if (_texcoords.valid()) _texcoords->reserve(numVertices);
|
if (texcoords.valid()) texcoords->reserve(numVertices);
|
||||||
if (_elevations.valid()) _elevations->reserve(numVertices);
|
if (elevations.valid()) elevations->reserve(numVertices);
|
||||||
if (_normals.valid()) _normals->reserve(numVertices);
|
if (normals.valid()) normals->reserve(numVertices);
|
||||||
|
|
||||||
// allocate and assign color
|
// allocate and assign color
|
||||||
osg::ref_ptr<osg::Vec4Array> _colors = new osg::Vec4Array(1);
|
osg::ref_ptr<osg::Vec4Array> colors = new osg::Vec4Array(1);
|
||||||
(*_colors)[0].set(1.0f,1.0f,1.0f,1.0f);
|
(*colors)[0].set(1.0f,1.0f,1.0f,1.0f);
|
||||||
|
|
||||||
if (buffer._geometry.valid())
|
if (buffer._geometry.valid())
|
||||||
{
|
{
|
||||||
buffer._geometry->setColorArray(_colors.get());
|
buffer._geometry->setColorArray(colors.get());
|
||||||
buffer._geometry->setColorBinding(osg::Geometry::BIND_OVERALL);
|
buffer._geometry->setColorBinding(osg::Geometry::BIND_OVERALL);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -343,12 +343,12 @@ void GeometryTechnique::generateGeometry(Locator* masterLocator, const osg::Vec3
|
|||||||
|
|
||||||
if (validValue)
|
if (validValue)
|
||||||
{
|
{
|
||||||
indices[iv] = _vertices->size();
|
indices[iv] = vertices->size();
|
||||||
|
|
||||||
osg::Vec3d model;
|
osg::Vec3d model;
|
||||||
masterLocator->convertLocalToModel(ndc, model);
|
masterLocator->convertLocalToModel(ndc, model);
|
||||||
|
|
||||||
(*_vertices).push_back(model - centerModel);
|
(*vertices).push_back(model - centerModel);
|
||||||
|
|
||||||
if (colorLayer)
|
if (colorLayer)
|
||||||
{
|
{
|
||||||
@ -356,18 +356,18 @@ void GeometryTechnique::generateGeometry(Locator* masterLocator, const osg::Vec3
|
|||||||
{
|
{
|
||||||
osg::Vec3d color_ndc;
|
osg::Vec3d color_ndc;
|
||||||
Locator::convertLocalCoordBetween(*masterLocator, ndc, *colorLocator, color_ndc);
|
Locator::convertLocalCoordBetween(*masterLocator, ndc, *colorLocator, color_ndc);
|
||||||
(*_texcoords).push_back(osg::Vec2(color_ndc.x(), color_ndc.y()));
|
(*texcoords).push_back(osg::Vec2(color_ndc.x(), color_ndc.y()));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
(*_texcoords).push_back(osg::Vec2(ndc.x(), ndc.y()));
|
(*texcoords).push_back(osg::Vec2(ndc.x(), ndc.y()));
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (_elevations.valid())
|
if (elevations.valid())
|
||||||
{
|
{
|
||||||
(*_elevations).push_back((ndc.z()-minHeight)*scaleHeight);
|
(*elevations).push_back((ndc.z()-minHeight)*scaleHeight);
|
||||||
}
|
}
|
||||||
|
|
||||||
// compute the local normal
|
// compute the local normal
|
||||||
@ -376,7 +376,7 @@ void GeometryTechnique::generateGeometry(Locator* masterLocator, const osg::Vec3
|
|||||||
masterLocator->convertLocalToModel(ndc_one, model_one);
|
masterLocator->convertLocalToModel(ndc_one, model_one);
|
||||||
model_one = model_one - model;
|
model_one = model_one - model;
|
||||||
model_one.normalize();
|
model_one.normalize();
|
||||||
(*_normals).push_back(model_one);
|
(*normals).push_back(model_one);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -386,7 +386,7 @@ void GeometryTechnique::generateGeometry(Locator* masterLocator, const osg::Vec3
|
|||||||
}
|
}
|
||||||
|
|
||||||
// populate primitive sets
|
// populate primitive sets
|
||||||
// bool optimizeOrientations = _elevations!=0;
|
// bool optimizeOrientations = elevations!=0;
|
||||||
bool swapOrientation = !(masterLocator->orientationOpenGL());
|
bool swapOrientation = !(masterLocator->orientationOpenGL());
|
||||||
|
|
||||||
osg::ref_ptr<osg::DrawElementsUInt> elements = new osg::DrawElementsUInt(GL_TRIANGLES);
|
osg::ref_ptr<osg::DrawElementsUInt> elements = new osg::DrawElementsUInt(GL_TRIANGLES);
|
||||||
@ -428,10 +428,10 @@ void GeometryTechnique::generateGeometry(Locator* masterLocator, const osg::Vec3
|
|||||||
|
|
||||||
if (numValid==4)
|
if (numValid==4)
|
||||||
{
|
{
|
||||||
float e00 = (*_elevations)[i00];
|
float e00 = (*elevations)[i00];
|
||||||
float e10 = (*_elevations)[i10];
|
float e10 = (*elevations)[i10];
|
||||||
float e01 = (*_elevations)[i01];
|
float e01 = (*elevations)[i01];
|
||||||
float e11 = (*_elevations)[i11];
|
float e11 = (*elevations)[i11];
|
||||||
|
|
||||||
if (fabsf(e00-e11)<fabsf(e01-e10))
|
if (fabsf(e00-e11)<fabsf(e01-e10))
|
||||||
{
|
{
|
||||||
@ -465,15 +465,15 @@ void GeometryTechnique::generateGeometry(Locator* masterLocator, const osg::Vec3
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
osg::ref_ptr<osg::Vec3Array> skirtVectors = new osg::Vec3Array((*_normals));
|
osg::ref_ptr<osg::Vec3Array> skirtVectors = new osg::Vec3Array((*normals));
|
||||||
|
|
||||||
if (elevationLayer)
|
if (elevationLayer)
|
||||||
{
|
{
|
||||||
smoothGeometry();
|
smoothGeometry();
|
||||||
|
|
||||||
_normals = dynamic_cast<osg::Vec3Array*>(buffer._geometry->getNormalArray());
|
normals = dynamic_cast<osg::Vec3Array*>(buffer._geometry->getNormalArray());
|
||||||
|
|
||||||
if (!_normals) createSkirt = false;
|
if (!normals) createSkirt = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (createSkirt)
|
if (createSkirt)
|
||||||
@ -488,11 +488,11 @@ void GeometryTechnique::generateGeometry(Locator* masterLocator, const osg::Vec3
|
|||||||
int orig_i = indices[(r)*numColumns+c]; // index of original vertex of grid
|
int orig_i = indices[(r)*numColumns+c]; // index of original vertex of grid
|
||||||
if (orig_i>=0)
|
if (orig_i>=0)
|
||||||
{
|
{
|
||||||
unsigned int new_i = _vertices->size(); // index of new index of added skirt point
|
unsigned int new_i = vertices->size(); // index of new index of added skirt point
|
||||||
osg::Vec3 new_v = (*_vertices)[orig_i] - ((*skirtVectors)[orig_i])*skirtHeight;
|
osg::Vec3 new_v = (*vertices)[orig_i] - ((*skirtVectors)[orig_i])*skirtHeight;
|
||||||
(*_vertices).push_back(new_v);
|
(*vertices).push_back(new_v);
|
||||||
if (_normals.valid()) (*_normals).push_back((*_normals)[orig_i]);
|
if (normals.valid()) (*normals).push_back((*normals)[orig_i]);
|
||||||
if (_texcoords.valid()) (*_texcoords).push_back((*_texcoords)[orig_i]);
|
if (texcoords.valid()) (*texcoords).push_back((*texcoords)[orig_i]);
|
||||||
|
|
||||||
skirtDrawElements->push_back(orig_i);
|
skirtDrawElements->push_back(orig_i);
|
||||||
skirtDrawElements->push_back(new_i);
|
skirtDrawElements->push_back(new_i);
|
||||||
@ -521,11 +521,11 @@ void GeometryTechnique::generateGeometry(Locator* masterLocator, const osg::Vec3
|
|||||||
int orig_i = indices[(r)*numColumns+c]; // index of original vertex of grid
|
int orig_i = indices[(r)*numColumns+c]; // index of original vertex of grid
|
||||||
if (orig_i>=0)
|
if (orig_i>=0)
|
||||||
{
|
{
|
||||||
unsigned int new_i = _vertices->size(); // index of new index of added skirt point
|
unsigned int new_i = vertices->size(); // index of new index of added skirt point
|
||||||
osg::Vec3 new_v = (*_vertices)[orig_i] - ((*skirtVectors)[orig_i])*skirtHeight;
|
osg::Vec3 new_v = (*vertices)[orig_i] - ((*skirtVectors)[orig_i])*skirtHeight;
|
||||||
(*_vertices).push_back(new_v);
|
(*vertices).push_back(new_v);
|
||||||
if (_normals.valid()) (*_normals).push_back((*_normals)[orig_i]);
|
if (normals.valid()) (*normals).push_back((*normals)[orig_i]);
|
||||||
if (_texcoords.valid()) (*_texcoords).push_back((*_texcoords)[orig_i]);
|
if (texcoords.valid()) (*texcoords).push_back((*texcoords)[orig_i]);
|
||||||
|
|
||||||
skirtDrawElements->push_back(orig_i);
|
skirtDrawElements->push_back(orig_i);
|
||||||
skirtDrawElements->push_back(new_i);
|
skirtDrawElements->push_back(new_i);
|
||||||
@ -554,11 +554,11 @@ void GeometryTechnique::generateGeometry(Locator* masterLocator, const osg::Vec3
|
|||||||
int orig_i = indices[(r)*numColumns+c]; // index of original vertex of grid
|
int orig_i = indices[(r)*numColumns+c]; // index of original vertex of grid
|
||||||
if (orig_i>=0)
|
if (orig_i>=0)
|
||||||
{
|
{
|
||||||
unsigned int new_i = _vertices->size(); // index of new index of added skirt point
|
unsigned int new_i = vertices->size(); // index of new index of added skirt point
|
||||||
osg::Vec3 new_v = (*_vertices)[orig_i] - ((*skirtVectors)[orig_i])*skirtHeight;
|
osg::Vec3 new_v = (*vertices)[orig_i] - ((*skirtVectors)[orig_i])*skirtHeight;
|
||||||
(*_vertices).push_back(new_v);
|
(*vertices).push_back(new_v);
|
||||||
if (_normals.valid()) (*_normals).push_back((*_normals)[orig_i]);
|
if (normals.valid()) (*normals).push_back((*normals)[orig_i]);
|
||||||
if (_texcoords.valid()) (*_texcoords).push_back((*_texcoords)[orig_i]);
|
if (texcoords.valid()) (*texcoords).push_back((*texcoords)[orig_i]);
|
||||||
|
|
||||||
skirtDrawElements->push_back(orig_i);
|
skirtDrawElements->push_back(orig_i);
|
||||||
skirtDrawElements->push_back(new_i);
|
skirtDrawElements->push_back(new_i);
|
||||||
@ -587,11 +587,11 @@ void GeometryTechnique::generateGeometry(Locator* masterLocator, const osg::Vec3
|
|||||||
int orig_i = indices[(r)*numColumns+c]; // index of original vertex of grid
|
int orig_i = indices[(r)*numColumns+c]; // index of original vertex of grid
|
||||||
if (orig_i>=0)
|
if (orig_i>=0)
|
||||||
{
|
{
|
||||||
unsigned int new_i = _vertices->size(); // index of new index of added skirt point
|
unsigned int new_i = vertices->size(); // index of new index of added skirt point
|
||||||
osg::Vec3 new_v = (*_vertices)[orig_i] - ((*skirtVectors)[orig_i])*skirtHeight;
|
osg::Vec3 new_v = (*vertices)[orig_i] - ((*skirtVectors)[orig_i])*skirtHeight;
|
||||||
(*_vertices).push_back(new_v);
|
(*vertices).push_back(new_v);
|
||||||
if (_normals.valid()) (*_normals).push_back((*_normals)[orig_i]);
|
if (normals.valid()) (*normals).push_back((*normals)[orig_i]);
|
||||||
if (_texcoords.valid()) (*_texcoords).push_back((*_texcoords)[orig_i]);
|
if (texcoords.valid()) (*texcoords).push_back((*texcoords)[orig_i]);
|
||||||
|
|
||||||
skirtDrawElements->push_back(orig_i);
|
skirtDrawElements->push_back(orig_i);
|
||||||
skirtDrawElements->push_back(new_i);
|
skirtDrawElements->push_back(new_i);
|
||||||
|
@ -17,6 +17,7 @@
|
|||||||
using namespace osgTerrain;
|
using namespace osgTerrain;
|
||||||
|
|
||||||
Layer::Layer():
|
Layer::Layer():
|
||||||
|
_textureUnit(-1),
|
||||||
_minLevel(0),
|
_minLevel(0),
|
||||||
_maxLevel(MAXIMUM_NUMBER_OF_LEVELS)
|
_maxLevel(MAXIMUM_NUMBER_OF_LEVELS)
|
||||||
{
|
{
|
||||||
@ -25,6 +26,7 @@ Layer::Layer():
|
|||||||
Layer::Layer(const Layer& layer,const osg::CopyOp& copyop):
|
Layer::Layer(const Layer& layer,const osg::CopyOp& copyop):
|
||||||
osg::Object(layer,copyop),
|
osg::Object(layer,copyop),
|
||||||
_filename(layer._filename),
|
_filename(layer._filename),
|
||||||
|
_textureUnit(layer._textureUnit),
|
||||||
_minLevel(layer._minLevel),
|
_minLevel(layer._minLevel),
|
||||||
_maxLevel(layer._maxLevel)
|
_maxLevel(layer._maxLevel)
|
||||||
{
|
{
|
||||||
|
@ -30,6 +30,16 @@ BEGIN_OBJECT_REFLECTOR(osg::TransferFunction)
|
|||||||
I_Constructor0(____TransferFunction,
|
I_Constructor0(____TransferFunction,
|
||||||
"",
|
"",
|
||||||
"");
|
"");
|
||||||
|
I_Method1(void, setTextureUnit, IN, int, textureUnit,
|
||||||
|
Properties::NON_VIRTUAL,
|
||||||
|
__void__setTextureUnit__int,
|
||||||
|
"Set the texture unit to assign layer to if required. ",
|
||||||
|
"Negative values signifies that no texture unit has been assigned. ");
|
||||||
|
I_Method0(int, getTextureUnit,
|
||||||
|
Properties::NON_VIRTUAL,
|
||||||
|
__int__getTextureUnit,
|
||||||
|
"Get the texture unit to assign layer to if required. ",
|
||||||
|
"");
|
||||||
I_Method0(osg::Image *, getImage,
|
I_Method0(osg::Image *, getImage,
|
||||||
Properties::NON_VIRTUAL,
|
Properties::NON_VIRTUAL,
|
||||||
__osg_Image_P1__getImage,
|
__osg_Image_P1__getImage,
|
||||||
@ -69,6 +79,9 @@ BEGIN_OBJECT_REFLECTOR(osg::TransferFunction)
|
|||||||
I_SimpleProperty(osg::Texture *, Texture,
|
I_SimpleProperty(osg::Texture *, Texture,
|
||||||
__osg_Texture_P1__getTexture,
|
__osg_Texture_P1__getTexture,
|
||||||
0);
|
0);
|
||||||
|
I_SimpleProperty(int, TextureUnit,
|
||||||
|
__int__getTextureUnit,
|
||||||
|
__void__setTextureUnit__int);
|
||||||
END_REFLECTOR
|
END_REFLECTOR
|
||||||
|
|
||||||
BEGIN_OBJECT_REFLECTOR(osg::TransferFunction1D)
|
BEGIN_OBJECT_REFLECTOR(osg::TransferFunction1D)
|
||||||
|
@ -166,12 +166,12 @@ BEGIN_OBJECT_REFLECTOR(osgTerrain::HeightFieldLayer)
|
|||||||
I_Method1(void, setFileName, IN, const std::string &, filename,
|
I_Method1(void, setFileName, IN, const std::string &, filename,
|
||||||
Properties::VIRTUAL,
|
Properties::VIRTUAL,
|
||||||
__void__setFileName__C5_std_string_R1,
|
__void__setFileName__C5_std_string_R1,
|
||||||
"",
|
"Set the file name of the data associated with this layer. ",
|
||||||
"");
|
"");
|
||||||
I_Method0(const std::string &, getFileName,
|
I_Method0(const std::string &, getFileName,
|
||||||
Properties::VIRTUAL,
|
Properties::VIRTUAL,
|
||||||
__C5_std_string_R1__getFileName,
|
__C5_std_string_R1__getFileName,
|
||||||
"",
|
"Get the file name of the layer. ",
|
||||||
"");
|
"");
|
||||||
I_Method2(bool, transform, IN, float, offset, IN, float, scale,
|
I_Method2(bool, transform, IN, float, offset, IN, float, scale,
|
||||||
Properties::VIRTUAL,
|
Properties::VIRTUAL,
|
||||||
@ -287,12 +287,12 @@ BEGIN_OBJECT_REFLECTOR(osgTerrain::ImageLayer)
|
|||||||
I_Method1(void, setFileName, IN, const std::string &, filename,
|
I_Method1(void, setFileName, IN, const std::string &, filename,
|
||||||
Properties::VIRTUAL,
|
Properties::VIRTUAL,
|
||||||
__void__setFileName__C5_std_string_R1,
|
__void__setFileName__C5_std_string_R1,
|
||||||
"",
|
"Set the file name of the data associated with this layer. ",
|
||||||
"");
|
"");
|
||||||
I_Method0(const std::string &, getFileName,
|
I_Method0(const std::string &, getFileName,
|
||||||
Properties::VIRTUAL,
|
Properties::VIRTUAL,
|
||||||
__C5_std_string_R1__getFileName,
|
__C5_std_string_R1__getFileName,
|
||||||
"",
|
"Get the file name of the layer. ",
|
||||||
"");
|
"");
|
||||||
I_Method2(bool, transform, IN, float, offset, IN, float, scale,
|
I_Method2(bool, transform, IN, float, offset, IN, float, scale,
|
||||||
Properties::VIRTUAL,
|
Properties::VIRTUAL,
|
||||||
@ -408,12 +408,22 @@ BEGIN_OBJECT_REFLECTOR(osgTerrain::Layer)
|
|||||||
I_Method1(void, setFileName, IN, const std::string &, filename,
|
I_Method1(void, setFileName, IN, const std::string &, filename,
|
||||||
Properties::VIRTUAL,
|
Properties::VIRTUAL,
|
||||||
__void__setFileName__C5_std_string_R1,
|
__void__setFileName__C5_std_string_R1,
|
||||||
"",
|
"Set the file name of the data associated with this layer. ",
|
||||||
"");
|
"");
|
||||||
I_Method0(const std::string &, getFileName,
|
I_Method0(const std::string &, getFileName,
|
||||||
Properties::VIRTUAL,
|
Properties::VIRTUAL,
|
||||||
__C5_std_string_R1__getFileName,
|
__C5_std_string_R1__getFileName,
|
||||||
"",
|
"Get the file name of the layer. ",
|
||||||
|
"");
|
||||||
|
I_Method1(void, setTextureUnit, IN, int, textureUnit,
|
||||||
|
Properties::NON_VIRTUAL,
|
||||||
|
__void__setTextureUnit__int,
|
||||||
|
"Set the texture unit to assign layer to if required. ",
|
||||||
|
"Negative values signifies that no texture unit has been assigned. ");
|
||||||
|
I_Method0(int, getTextureUnit,
|
||||||
|
Properties::NON_VIRTUAL,
|
||||||
|
__int__getTextureUnit,
|
||||||
|
"Get the texture unit to assign layer to if required. ",
|
||||||
"");
|
"");
|
||||||
I_Method1(void, setLocator, IN, osgTerrain::Locator *, locator,
|
I_Method1(void, setLocator, IN, osgTerrain::Locator *, locator,
|
||||||
Properties::NON_VIRTUAL,
|
Properties::NON_VIRTUAL,
|
||||||
@ -578,6 +588,9 @@ BEGIN_OBJECT_REFLECTOR(osgTerrain::Layer)
|
|||||||
I_SimpleProperty(unsigned, ModifiedCount,
|
I_SimpleProperty(unsigned, ModifiedCount,
|
||||||
0,
|
0,
|
||||||
__void__setModifiedCount__unsigned);
|
__void__setModifiedCount__unsigned);
|
||||||
|
I_SimpleProperty(int, TextureUnit,
|
||||||
|
__int__getTextureUnit,
|
||||||
|
__void__setTextureUnit__int);
|
||||||
I_SimpleProperty(osgTerrain::ValidDataOperator *, ValidDataOperator,
|
I_SimpleProperty(osgTerrain::ValidDataOperator *, ValidDataOperator,
|
||||||
__ValidDataOperator_P1__getValidDataOperator,
|
__ValidDataOperator_P1__getValidDataOperator,
|
||||||
__void__setValidDataOperator__ValidDataOperator_P1);
|
__void__setValidDataOperator__ValidDataOperator_P1);
|
||||||
@ -636,12 +649,12 @@ BEGIN_OBJECT_REFLECTOR(osgTerrain::ProxyLayer)
|
|||||||
I_Method1(void, setFileName, IN, const std::string &, filename,
|
I_Method1(void, setFileName, IN, const std::string &, filename,
|
||||||
Properties::VIRTUAL,
|
Properties::VIRTUAL,
|
||||||
__void__setFileName__C5_std_string_R1,
|
__void__setFileName__C5_std_string_R1,
|
||||||
"",
|
"Set the file name of the data associated with this layer. ",
|
||||||
"");
|
"");
|
||||||
I_Method0(const std::string &, getFileName,
|
I_Method0(const std::string &, getFileName,
|
||||||
Properties::VIRTUAL,
|
Properties::VIRTUAL,
|
||||||
__C5_std_string_R1__getFileName,
|
__C5_std_string_R1__getFileName,
|
||||||
"",
|
"Get the file name of the layer. ",
|
||||||
"");
|
"");
|
||||||
I_Method0(unsigned int, getNumColumns,
|
I_Method0(unsigned int, getNumColumns,
|
||||||
Properties::VIRTUAL,
|
Properties::VIRTUAL,
|
||||||
|
Loading…
Reference in New Issue
Block a user