Added support for internalTextureMode
This commit is contained in:
parent
1cc89ba4fe
commit
e668acce27
@ -14,13 +14,12 @@
|
||||
#define VERSION_0004 4
|
||||
#define VERSION_0005 5
|
||||
#define VERSION_0006 6
|
||||
|
||||
/* Version 7 adds read/write of the DatabasePath to the
|
||||
PagedLOD node (OSG 0.9.8) */
|
||||
#define VERSION_0007 7
|
||||
|
||||
#define VERSION_0008 8
|
||||
|
||||
#define VERSION VERSION_0007
|
||||
|
||||
#define VERSION VERSION_0008
|
||||
|
||||
|
||||
/* The BYTE_SEX tag is used to check the endian
|
||||
|
@ -23,11 +23,13 @@ void Texture::write(DataOutputStream* out){
|
||||
out->writeInt(IVETEXTURE);
|
||||
// If the osg class is inherited by any other class we should also write this to file.
|
||||
osg::Object* obj = dynamic_cast<osg::Object*>(this);
|
||||
if(obj){
|
||||
if(obj)
|
||||
{
|
||||
((ive::Object*)(obj))->write(out);
|
||||
}
|
||||
else
|
||||
throw Exception("Texture::write(): Could not cast this osg::Texture to an osg::Object.");
|
||||
|
||||
// Write Texture's properties.
|
||||
out->writeInt(_wrap_s);
|
||||
out->writeInt(_wrap_t);
|
||||
@ -41,18 +43,24 @@ void Texture::write(DataOutputStream* out){
|
||||
|
||||
out->writeInt(_internalFormatMode);
|
||||
|
||||
// out->writeInt(_internalFormat);
|
||||
if ( out->getVersion() >= VERSION_0008 )
|
||||
{
|
||||
out->writeInt(_internalFormat);
|
||||
}
|
||||
}
|
||||
|
||||
void Texture::read(DataInputStream* in){
|
||||
void Texture::read(DataInputStream* in)
|
||||
{
|
||||
// Read Texture's identification.
|
||||
int id = in->peekInt();
|
||||
if(id == IVETEXTURE){
|
||||
if(id == IVETEXTURE)
|
||||
{
|
||||
// Read Texture's identification.
|
||||
id = in->readInt();
|
||||
// If the osg class is inherited by any other class we should also read this from file.
|
||||
osg::Object* obj = dynamic_cast<osg::Object*>(this);
|
||||
if(obj){
|
||||
if(obj)
|
||||
{
|
||||
((ive::Object*)(obj))->read(in);
|
||||
}
|
||||
else
|
||||
@ -60,20 +68,24 @@ void Texture::read(DataInputStream* in){
|
||||
|
||||
// Read properties
|
||||
_wrap_s = (osg::Texture::WrapMode)in->readInt();
|
||||
_wrap_t = (osg::Texture::WrapMode)in->readInt();;
|
||||
_wrap_r = (osg::Texture::WrapMode)in->readInt();;
|
||||
_wrap_t = (osg::Texture::WrapMode)in->readInt();
|
||||
_wrap_r = (osg::Texture::WrapMode)in->readInt();
|
||||
|
||||
_min_filter = (osg::Texture::FilterMode)in->readInt();;
|
||||
_mag_filter = (osg::Texture::FilterMode)in->readInt();;
|
||||
_maxAnisotropy = in->readFloat();;
|
||||
_min_filter = (osg::Texture::FilterMode)in->readInt();
|
||||
_mag_filter = (osg::Texture::FilterMode)in->readInt();
|
||||
_maxAnisotropy = in->readFloat();
|
||||
|
||||
_borderColor = in->readVec4();;
|
||||
_borderColor = in->readVec4();
|
||||
|
||||
_internalFormatMode = (osg::Texture::InternalFormatMode)in->readInt();;
|
||||
// _internalFormat = in->readInt();;
|
||||
_internalFormatMode = (osg::Texture::InternalFormatMode)in->readInt();
|
||||
if ( in->getVersion() >= VERSION_0008 )
|
||||
{
|
||||
_internalFormat = in->readInt();
|
||||
}
|
||||
|
||||
}
|
||||
else{
|
||||
else
|
||||
{
|
||||
throw Exception("Texture::read(): Expected Texture identification.");
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user