Added ImageSequence IO support in Texture classes
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
#include "osg/TextureCubeMap"
|
||||
#include "osg/ImageSequence"
|
||||
|
||||
#include "osgDB/Registry"
|
||||
#include "osgDB/Input"
|
||||
@@ -27,7 +28,13 @@ RegisterDotOsgWrapperProxy g_TextureCubeMapProxy
|
||||
matched = false;\
|
||||
if (fr[1].matchWord(#FACE)) \
|
||||
{\
|
||||
if (fr[2].isString())\
|
||||
if (fr[2].matchWord("ImageSequence") || fr[2].matchWord("Image")) \
|
||||
{ \
|
||||
osg::Image* image = fr.readImage(); \
|
||||
if (image) texture.setImage(osg::TextureCubeMap::FACE,image); \
|
||||
\
|
||||
} \
|
||||
else if (fr[2].isString())\
|
||||
{ \
|
||||
Image* image = fr.readImage(fr[2].getStr());\
|
||||
if (image) texture.setImage(osg::TextureCubeMap::FACE,image);\
|
||||
@@ -63,20 +70,28 @@ bool TextureCubeMap_readLocalData(Object& obj, Input& fr)
|
||||
const osg::Image* image = texture.getImage(osg::TextureCubeMap::FACE);\
|
||||
if (image)\
|
||||
{\
|
||||
std::string fileName = image->getFileName();\
|
||||
if (fw.getOutputTextureFiles())\
|
||||
{\
|
||||
if (fileName.empty())\
|
||||
const osg::ImageSequence* is = dynamic_cast<const osg::ImageSequence*>(image); \
|
||||
if (is) \
|
||||
{ \
|
||||
fw.writeObject(*is); \
|
||||
} \
|
||||
else \
|
||||
{ \
|
||||
std::string fileName = image->getFileName();\
|
||||
if (fw.getOutputTextureFiles())\
|
||||
{\
|
||||
fileName = fw.getTextureFileNameForOutput();\
|
||||
if (fileName.empty())\
|
||||
{\
|
||||
fileName = fw.getTextureFileNameForOutput();\
|
||||
}\
|
||||
osgDB::writeImageFile(*image, fileName);\
|
||||
}\
|
||||
if (!fileName.empty())\
|
||||
{\
|
||||
fw.indent() << "image "<<#FACE<<" "<<fw.wrapString(fw.getFileNameForOutput(fileName))<< std::endl;\
|
||||
}\
|
||||
osgDB::writeImageFile(*image, fileName);\
|
||||
}\
|
||||
if (!fileName.empty())\
|
||||
{\
|
||||
fw.indent() << "image "<<#FACE<<" "<<fw.wrapString(fw.getFileNameForOutput(fileName))<< std::endl;\
|
||||
}\
|
||||
}\
|
||||
} \
|
||||
}
|
||||
|
||||
bool TextureCubeMap_writeLocalData(const Object& obj, Output& fw)
|
||||
|
||||
Reference in New Issue
Block a user