DDS-TC: Add origin to CanvasImage loadImage
Method loadImage should set the canvas origin to allow the DDS texture cache to act appropriately (i.e. not include anything from Canvas)
This commit is contained in:
parent
6685143d70
commit
62216e1e23
@ -35,6 +35,7 @@
|
|||||||
#include <osg/PrimitiveSet>
|
#include <osg/PrimitiveSet>
|
||||||
#include <osgDB/Registry>
|
#include <osgDB/Registry>
|
||||||
#include <osg/Version>
|
#include <osg/Version>
|
||||||
|
#include <simgear/scene/util/SGReaderWriterOptions.hxx>
|
||||||
|
|
||||||
namespace simgear
|
namespace simgear
|
||||||
{
|
{
|
||||||
@ -824,8 +825,12 @@ namespace canvas
|
|||||||
{
|
{
|
||||||
SG_LOG(SG_IO, SG_DEBUG, "use image reader detected by " << type);
|
SG_LOG(SG_IO, SG_DEBUG, "use image reader detected by " << type);
|
||||||
|
|
||||||
|
osg::ref_ptr<SGReaderWriterOptions> opt;
|
||||||
|
opt = SGReaderWriterOptions::copyOrCreate(osgDB::Registry::instance()->getOptions());
|
||||||
|
opt->setLoadOriginHint(SGReaderWriterOptions::LoadOriginHint::ORIGIN_CANVAS);
|
||||||
|
|
||||||
std::istringstream data_strm(data);
|
std::istringstream data_strm(data);
|
||||||
osgDB::ReaderWriter::ReadResult result = reader.readImage(data_strm);
|
osgDB::ReaderWriter::ReadResult result = reader.readImage(data_strm, opt);
|
||||||
if( result.success() )
|
if( result.success() )
|
||||||
{
|
{
|
||||||
setImage( result.takeImage() );
|
setImage( result.takeImage() );
|
||||||
|
Loading…
Reference in New Issue
Block a user