Added a s/getState() to osgTerrain::DataSet to allow better integration with applications.
This commit is contained in:
parent
4cb43e0f6c
commit
26c911acf3
@ -31,6 +31,7 @@
|
||||
#include <osg/Image>
|
||||
#include <osg/Shape>
|
||||
#include <osg/CoordinateSystemNode>
|
||||
#include <osg/State>
|
||||
|
||||
#include <osgDB/Archive>
|
||||
|
||||
@ -1085,7 +1086,8 @@ class OSGTERRAIN_EXPORT DataSet : public osg::Referenced
|
||||
void _writeNodeFile(const osg::Node& node,const std::string& filename);
|
||||
void _writeImageFile(const osg::Image& image,const std::string& filename);
|
||||
|
||||
|
||||
void setState(osg::State* state) { _state = state; }
|
||||
osg::State* getState() { return _state.get(); }
|
||||
|
||||
protected:
|
||||
|
||||
@ -1152,6 +1154,8 @@ class OSGTERRAIN_EXPORT DataSet : public osg::Referenced
|
||||
bool _writeNodeBeforeSimplification;
|
||||
|
||||
osg::ref_ptr<osg::Node> _rootNode;
|
||||
osg::ref_ptr<osg::State> _state;
|
||||
|
||||
|
||||
};
|
||||
|
||||
|
@ -2264,14 +2264,12 @@ osg::StateSet* DataSet::DestinationTile::createStateSet()
|
||||
else
|
||||
texture->setInternalFormatMode(osg::Texture::USE_S3TC_DXT5_COMPRESSION);
|
||||
|
||||
osg::ref_ptr<osg::State> state = new osg::State;
|
||||
|
||||
// force the mip mapping off temporay if we intend the graphics hardware to do the mipmapping.
|
||||
if (_dataSet->getMipMappingMode()==DataSet::MIP_MAPPING_HARDWARE)
|
||||
texture->setFilter(osg::Texture::MIN_FILTER,osg::Texture::LINEAR);
|
||||
|
||||
// get OpenGL driver to create texture from image.
|
||||
texture->apply(*state);
|
||||
texture->apply(*(_dataSet->getState()));
|
||||
|
||||
image->readImageFromCurrentTexture(0,true);
|
||||
|
||||
@ -2304,7 +2302,7 @@ osg::StateSet* DataSet::DestinationTile::createStateSet()
|
||||
osg::ref_ptr<osg::State> state = new osg::State;
|
||||
|
||||
// get OpenGL driver to create texture from image.
|
||||
texture->apply(*state);
|
||||
texture->apply(*(_dataSet->getState()));
|
||||
|
||||
image->readImageFromCurrentTexture(0,true);
|
||||
|
||||
@ -4581,6 +4579,8 @@ osg::Node* DataSet::decorateWithMultiTextureControl(osg::Node* subgraph)
|
||||
|
||||
void DataSet::_buildDestination(bool writeToDisk)
|
||||
{
|
||||
if (!_state) _state = new osg::State;
|
||||
|
||||
osg::ref_ptr<osgDB::ReaderWriter::Options> previous_options = osgDB::Registry::instance()->getOptions();
|
||||
osgDB::Registry::instance()->setOptions(new osgDB::ReaderWriter::Options("precision 16"));
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user