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:
Richard Harrison
2022-03-17 11:43:46 +01:00
parent 9e0ab6e268
commit 3cc7b9a17b

View File

@@ -35,6 +35,7 @@
#include <osg/PrimitiveSet>
#include <osgDB/Registry>
#include <osg/Version>
#include <simgear/scene/util/SGReaderWriterOptions.hxx>
namespace simgear
{
@@ -818,8 +819,12 @@ namespace canvas
{
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);
osgDB::ReaderWriter::ReadResult result = reader.readImage(data_strm);
osgDB::ReaderWriter::ReadResult result = reader.readImage(data_strm, opt);
if( result.success() )
{
setImage( result.takeImage() );