Added support for internalTextureMode

This commit is contained in:
Robert Osfield 2005-02-01 10:38:08 +00:00
parent 1cc89ba4fe
commit e668acce27
2 changed files with 67 additions and 56 deletions

View File

@ -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

View File

@ -1,15 +1,15 @@
/**********************************************************************
*
* FILE: Texture.cpp
* FILE: Texture.cpp
*
* DESCRIPTION: Read/Write osg::Texture in binary format to disk.
* DESCRIPTION: Read/Write osg::Texture in binary format to disk.
*
* CREATED BY: Auto generated by iveGenerated
* and later modified by Rune Schmidt Jensen.
* CREATED BY: Auto generated by iveGenerated
* and later modified by Rune Schmidt Jensen.
*
* HISTORY: Created 20.3.2003
* HISTORY: Created 20.3.2003
*
* Copyright 2003 VR-C
* Copyright 2003 VR-C
**********************************************************************/
#include "Exception.h"
@ -19,61 +19,73 @@
using namespace ive;
void Texture::write(DataOutputStream* out){
// Write Texture's identification.
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){
((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);
out->writeInt(_wrap_r);
// Write Texture's identification.
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)
{
((ive::Object*)(obj))->write(out);
}
else
throw Exception("Texture::write(): Could not cast this osg::Texture to an osg::Object.");
out->writeInt(_min_filter);
out->writeInt(_mag_filter);
out->writeFloat(_maxAnisotropy);
// Write Texture's properties.
out->writeInt(_wrap_s);
out->writeInt(_wrap_t);
out->writeInt(_wrap_r);
out->writeVec4(_borderColor);
out->writeInt(_min_filter);
out->writeInt(_mag_filter);
out->writeFloat(_maxAnisotropy);
out->writeInt(_internalFormatMode);
// out->writeInt(_internalFormat);
out->writeVec4(_borderColor);
out->writeInt(_internalFormatMode);
if ( out->getVersion() >= VERSION_0008 )
{
out->writeInt(_internalFormat);
}
}
void Texture::read(DataInputStream* in){
// Read Texture's identification.
int id = in->peekInt();
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){
((ive::Object*)(obj))->read(in);
}
else
throw Exception("Texture::read(): Could not cast this osg::Texture to an osg::Object.");
void Texture::read(DataInputStream* in)
{
// Read Texture's identification.
int id = in->peekInt();
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)
{
((ive::Object*)(obj))->read(in);
}
else
throw Exception("Texture::read(): Could not cast this osg::Texture to an osg::Object.");
// Read properties
// 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{
throw Exception("Texture::read(): Expected Texture identification.");
}
}
else
{
throw Exception("Texture::read(): Expected Texture identification.");
}
}