Removed deprecated code from the distribution.

Added .osg support for Texture1D and Texture3D.
This commit is contained in:
Robert Osfield
2002-08-28 15:28:11 +00:00
parent 951b6e9f3f
commit 8353fc0ed6
41 changed files with 911 additions and 1823 deletions

View File

@@ -12,7 +12,7 @@
#include <osg/Object>
#include <osg/LOD>
#include <osg/Transparency>
#include <osg/BlendFunc>
#include <osg/Geode>
#include <osg/StateSet>
#include <osg/Material>

View File

@@ -49,8 +49,9 @@ CXXFILES =\
TexGen.cpp\
TexMat.cpp\
Texture.cpp\
TextureBase.cpp\
Texture1D.cpp\
Texture2D.cpp\
Texture3D.cpp\
TextureCubeMap.cpp\
Transform.cpp\

View File

@@ -1,11 +1,8 @@
#include "osg/Texture"
#include <osg/Texture>
#ifdef TEXTURE_USE_DEPRECATED_API
#include "osgDB/Registry"
#include "osgDB/Input"
#include "osgDB/Output"
#include <osgDB/Registry>
#include <osgDB/Input>
#include <osgDB/Output>
using namespace osg;
using namespace osgDB;
@@ -20,17 +17,15 @@ bool Texture_matchFilterStr(const char* str,Texture::FilterMode& filter);
const char* Texture_getFilterStr(Texture::FilterMode filter);
bool Texture_matchInternalFormatModeStr(const char* str,Texture::InternalFormatMode& mode);
const char* Texture_getInternalFormatModeStr(Texture::InternalFormatMode mode);
bool Texture_matchInternalFormatValueStr(const char* str,int& value);
const char* Texture_getInternalFormatValueStr(int value);
bool Texture_matchSubloadModeStr(const char* str, Texture::SubloadMode& value);
const char* Texture_getSubloadModeStr(Texture::SubloadMode value);
bool Texture_matchInternalFormatStr(const char* str,int& value);
const char* Texture_getInternalFormatStr(int value);
// register the read and write functions with the osgDB::Registry.
RegisterDotOsgWrapperProxy g_TextureProxy
(
osgNew osg::Texture,
"Texture",
"Object StateAttribute Texture TextureBase",
0,
"TextureBase",
"Object StateAttribute TextureBase",
&Texture_readLocalData,
&Texture_writeLocalData
);
@@ -42,87 +37,67 @@ bool Texture_readLocalData(Object& obj, Input& fr)
Texture& texture = static_cast<Texture&>(obj);
if (fr[0].matchWord("file") && fr[1].isString())
Texture::WrapMode wrap;
if (fr[0].matchWord("wrap_s") && Texture_matchWrapStr(fr[1].getStr(),wrap))
{
std::string filename = fr[1].getStr();
Image* image = fr.readImage(filename.c_str());
if (image)
{
// name will have already been set by the image plugin,
// but it will have absolute path, so will override it
// here to keep the original name intact.
//image->setFileName(filename);
texture.setImage(image);
}
fr += 2;
texture.setWrap(Texture::WRAP_S,wrap);
fr+=2;
iteratorAdvanced = true;
}
Texture::SubloadMode submode;
if (fr[0].matchWord("subloadMode") && Texture_matchSubloadModeStr(fr[1].getStr(),submode))
if (fr[0].matchWord("wrap_t") && Texture_matchWrapStr(fr[1].getStr(),wrap))
{
texture.setSubloadMode(submode);
fr += 2;
texture.setWrap(Texture::WRAP_T,wrap);
fr+=2;
iteratorAdvanced = true;
}
if (fr[0].matchWord("subloadOffset"))
if (fr[0].matchWord("wrap_r") && Texture_matchWrapStr(fr[1].getStr(),wrap))
{
int x, y;
if (fr[1].getInt(x) && fr[2].getInt(y))
{
texture.setSubloadTextureOffset(x, y);
fr += 3;
iteratorAdvanced = true;
}
texture.setWrap(Texture::WRAP_R,wrap);
fr+=2;
iteratorAdvanced = true;
}
if (fr[0].matchWord("subloadSize"))
Texture::FilterMode filter;
if (fr[0].matchWord("min_filter") && Texture_matchFilterStr(fr[1].getStr(),filter))
{
int width, height;
if (fr[1].getInt(width) && fr[2].getInt(height))
{
texture.setSubloadImageSize(width, height);
fr += 3;
iteratorAdvanced = true;
}
texture.setFilter(Texture::MIN_FILTER,filter);
fr+=2;
iteratorAdvanced = true;
}
if (fr[0].matchWord("subloadTextureOffset"))
if (fr[0].matchWord("mag_filter") && Texture_matchFilterStr(fr[1].getStr(),filter))
{
int x, y;
if (fr[1].getInt(x) && fr[2].getInt(y))
{
texture.setSubloadTextureOffset(x, y);
fr += 3;
iteratorAdvanced = true;
}
texture.setFilter(Texture::MAG_FILTER,filter);
fr+=2;
iteratorAdvanced = true;
}
if (fr[0].matchWord("subloadTextureSize"))
if (fr.matchSequence("maxAnisotropy %f"))
{
int width, height;
if (fr[1].getInt(width) && fr[2].getInt(height))
{
texture.setSubloadTextureSize(width, height);
fr += 3;
iteratorAdvanced = true;
}
float anis=1.0f;
fr[1].getFloat(anis);
texture.setMaxAnisotropy(anis);
fr +=2 ;
iteratorAdvanced = true;
}
if (fr[0].matchWord("subloadImageOffset"))
Texture::InternalFormatMode mode;
if (fr[0].matchWord("internalFormatMode") && Texture_matchInternalFormatModeStr(fr[1].getStr(),mode))
{
int x, y;
if (fr[1].getInt(x) && fr[2].getInt(y))
{
texture.setSubloadImageOffset(x, y);
fr += 3;
iteratorAdvanced = true;
}
texture.setInternalFormatMode(mode);
fr+=2;
iteratorAdvanced = true;
}
if (fr[0].matchWord("subloadImageSize"))
if (fr[0].matchWord("internalFormatValue"))
{
int width, height;
if (fr[1].getInt(width) && fr[2].getInt(height))
int value;
if (Texture_matchInternalFormatStr(fr[1].getStr(),value) || fr[1].getInt(value))
{
texture.setSubloadImageSize(width, height);
fr += 3;
texture.setInternalFormat(value);
fr+=2;
iteratorAdvanced = true;
}
}
@@ -135,28 +110,21 @@ bool Texture_writeLocalData(const Object& obj, Output& fw)
{
const Texture& texture = static_cast<const Texture&>(obj);
if (texture.getImage() && !(texture.getImage()->getFileName().empty()))
fw.indent() << "wrap_s " << Texture_getWrapStr(texture.getWrap(Texture::WRAP_S)) << std::endl;
fw.indent() << "wrap_t " << Texture_getWrapStr(texture.getWrap(Texture::WRAP_T)) << std::endl;
fw.indent() << "wrap_r " << Texture_getWrapStr(texture.getWrap(Texture::WRAP_R)) << std::endl;
fw.indent() << "min_filter " << Texture_getFilterStr(texture.getFilter(Texture::MIN_FILTER)) << std::endl;
fw.indent() << "mag_filter " << Texture_getFilterStr(texture.getFilter(Texture::MAG_FILTER)) << std::endl;
fw.indent() << "maxAnisotropy " << texture.getMaxAnisotropy() << std::endl;
fw.indent() << "internalFormatMode " << Texture_getInternalFormatModeStr(texture.getInternalFormatMode()) << std::endl;
if (texture.getInternalFormatMode()==Texture::USE_USER_DEFINED_FORMAT)
{
fw.indent() << "file \""<<fw.getFileNameForOutput(texture.getImage()->getFileName())<<"\""<< std::endl;
}
fw.indent() << "subloadMode " << Texture_getSubloadModeStr(texture.getSubloadMode()) << std::endl;
if (texture.getSubloadMode()!=Texture::OFF)
{
int x, y;
texture.getSubloadTextureOffset(x, y);
fw.indent() << "subloadTextureOffset " << x << " " << y << std::endl;
int width, height;
texture.getSubloadTextureSize(width, height);
fw.indent() << "subloadTextureSize " << width << " " << height << std::endl;
texture.getSubloadImageOffset(x, y);
fw.indent() << "subloadImageOffset " << x << " " << y << std::endl;
texture.getSubloadImageSize(width, height);
fw.indent() << "subloadImageSize " << width << " " << height << std::endl;
const char* str = Texture_getInternalFormatStr(texture.getInternalFormat());
if (str) fw.indent() << "internalFormat " << str << std::endl;
else fw.indent() << "internalFormat " << texture.getInternalFormat() << std::endl;
}
return true;
@@ -245,7 +213,7 @@ const char* Texture_getInternalFormatModeStr(Texture::InternalFormatMode mode)
}
bool Texture_matchInternalFormatValueStr(const char* str,int& value)
bool Texture_matchInternalFormatStr(const char* str,int& value)
{
if ( strcmp(str,"GL_INTENSITY")==0) value = GL_INTENSITY;
@@ -269,7 +237,7 @@ bool Texture_matchInternalFormatValueStr(const char* str,int& value)
}
const char* Texture_getInternalFormatValueStr(int value)
const char* Texture_getInternalFormatStr(int value)
{
switch(value)
{
@@ -293,29 +261,3 @@ const char* Texture_getInternalFormatValueStr(int value)
return NULL;
}
bool Texture_matchSubloadModeStr(const char* str,Texture::SubloadMode& value)
{
if (strcmp(str, "OFF") == 0)
value = Texture::OFF;
else if (strcmp(str, "AUTO") == 0)
value = Texture::AUTO;
else if (strcmp(str, "IF_DIRTY") == 0)
value = Texture::IF_DIRTY;
else
return false;
return true;
}
const char* Texture_getSubloadModeStr(Texture::SubloadMode value)
{
switch (value)
{
case Texture::OFF: return "OFF";
case Texture::AUTO: return "AUTO";
case Texture::IF_DIRTY: return "IF_DIRTY";
}
return NULL;
}
#endif

View File

@@ -0,0 +1,70 @@
#include "osg/Texture1D"
#include "osgDB/Registry"
#include "osgDB/Input"
#include "osgDB/Output"
using namespace osg;
using namespace osgDB;
// forward declare functions to use later.
bool Texture1D_readLocalData(Object& obj, Input& fr);
bool Texture1D_writeLocalData(const Object& obj, Output& fw);
bool Texture1D_matchWrapStr(const char* str,Texture1D::WrapMode& wrap);
const char* Texture1D_getWrapStr(Texture1D::WrapMode wrap);
bool Texture1D_matchFilterStr(const char* str,Texture1D::FilterMode& filter);
const char* Texture1D_getFilterStr(Texture1D::FilterMode filter);
bool Texture1D_matchInternalFormatModeStr(const char* str,Texture1D::InternalFormatMode& mode);
const char* Texture1D_getInternalFormatModeStr(Texture1D::InternalFormatMode mode);
bool Texture1D_matchInternalFormatStr(const char* str,int& value);
const char* Texture1D_getInternalFormatStr(int value);
// register the read and write functions with the osgDB::Registry.
RegisterDotOsgWrapperProxy g_Texture1DProxy
(
osgNew osg::Texture1D,
"Texture1D",
"Object StateAttribute Texture1D TextureBase",
&Texture1D_readLocalData,
&Texture1D_writeLocalData
);
bool Texture1D_readLocalData(Object& obj, Input& fr)
{
bool iteratorAdvanced = false;
Texture1D& texture = static_cast<Texture1D&>(obj);
if (fr[0].matchWord("file") && fr[1].isString())
{
std::string filename = fr[1].getStr();
Image* image = fr.readImage(filename.c_str());
if (image)
{
// name will have already been set by the image plugin,
// but it will have absolute path, so will override it
// here to keep the original name intact.
//image->setFileName(filename);
texture.setImage(image);
}
fr += 2;
iteratorAdvanced = true;
}
return iteratorAdvanced;
}
bool Texture1D_writeLocalData(const Object& obj, Output& fw)
{
const Texture1D& texture = static_cast<const Texture1D&>(obj);
if (texture.getImage() && !(texture.getImage()->getFileName().empty()))
{
fw.indent() << "file \""<<fw.getFileNameForOutput(texture.getImage()->getFileName())<<"\""<< std::endl;
}
return true;
}

View File

@@ -20,11 +20,7 @@ const char* Texture2D_getInternalFormatModeStr(Texture2D::InternalFormatMode mod
bool Texture2D_matchInternalFormatStr(const char* str,int& value);
const char* Texture2D_getInternalFormatStr(int value);
#include "osg/Texture"
#ifndef TEXTURE_USE_DEPRECATED_API
RegisterDotOsgWrapperProxy g_TextureProxy
RegisterDotOsgWrapperProxy g_OldTextureProxy
(
osgNew osg::Texture2D,
"Texture",
@@ -32,7 +28,6 @@ RegisterDotOsgWrapperProxy g_TextureProxy
0,
0
);
#endif
// register the read and write functions with the osgDB::Registry.
RegisterDotOsgWrapperProxy g_Texture2DProxy

View File

@@ -0,0 +1,70 @@
#include "osg/Texture3D"
#include "osgDB/Registry"
#include "osgDB/Input"
#include "osgDB/Output"
using namespace osg;
using namespace osgDB;
// forward declare functions to use later.
bool Texture3D_readLocalData(Object& obj, Input& fr);
bool Texture3D_writeLocalData(const Object& obj, Output& fw);
bool Texture3D_matchWrapStr(const char* str,Texture3D::WrapMode& wrap);
const char* Texture3D_getWrapStr(Texture3D::WrapMode wrap);
bool Texture3D_matchFilterStr(const char* str,Texture3D::FilterMode& filter);
const char* Texture3D_getFilterStr(Texture3D::FilterMode filter);
bool Texture3D_matchInternalFormatModeStr(const char* str,Texture3D::InternalFormatMode& mode);
const char* Texture3D_getInternalFormatModeStr(Texture3D::InternalFormatMode mode);
bool Texture3D_matchInternalFormatStr(const char* str,int& value);
const char* Texture3D_getInternalFormatStr(int value);
// register the read and write functions with the osgDB::Registry.
RegisterDotOsgWrapperProxy g_Texture3DProxy
(
osgNew osg::Texture3D,
"Texture3D",
"Object StateAttribute Texture3D TextureBase",
&Texture3D_readLocalData,
&Texture3D_writeLocalData
);
bool Texture3D_readLocalData(Object& obj, Input& fr)
{
bool iteratorAdvanced = false;
Texture3D& texture = static_cast<Texture3D&>(obj);
if (fr[0].matchWord("file") && fr[1].isString())
{
std::string filename = fr[1].getStr();
Image* image = fr.readImage(filename.c_str());
if (image)
{
// name will have already been set by the image plugin,
// but it will have absolute path, so will override it
// here to keep the original name intact.
//image->setFileName(filename);
texture.setImage(image);
}
fr += 2;
iteratorAdvanced = true;
}
return iteratorAdvanced;
}
bool Texture3D_writeLocalData(const Object& obj, Output& fw)
{
const Texture3D& texture = static_cast<const Texture3D&>(obj);
if (texture.getImage() && !(texture.getImage()->getFileName().empty()))
{
fw.indent() << "file \""<<fw.getFileNameForOutput(texture.getImage()->getFileName())<<"\""<< std::endl;
}
return true;
}

View File

@@ -1,263 +0,0 @@
#include <osg/TextureBase>
#include <osgDB/Registry>
#include <osgDB/Input>
#include <osgDB/Output>
using namespace osg;
using namespace osgDB;
// forward declare functions to use later.
bool TextureBase_readLocalData(Object& obj, Input& fr);
bool TextureBase_writeLocalData(const Object& obj, Output& fw);
bool TextureBase_matchWrapStr(const char* str,TextureBase::WrapMode& wrap);
const char* TextureBase_getWrapStr(TextureBase::WrapMode wrap);
bool TextureBase_matchFilterStr(const char* str,TextureBase::FilterMode& filter);
const char* TextureBase_getFilterStr(TextureBase::FilterMode filter);
bool TextureBase_matchInternalFormatModeStr(const char* str,TextureBase::InternalFormatMode& mode);
const char* TextureBase_getInternalFormatModeStr(TextureBase::InternalFormatMode mode);
bool TextureBase_matchInternalFormatStr(const char* str,int& value);
const char* TextureBase_getInternalFormatStr(int value);
// register the read and write functions with the osgDB::Registry.
RegisterDotOsgWrapperProxy g_TextureBaseProxy
(
0,
"TextureBase",
"Object StateAttribute TextureBase",
&TextureBase_readLocalData,
&TextureBase_writeLocalData
);
bool TextureBase_readLocalData(Object& obj, Input& fr)
{
bool iteratorAdvanced = false;
TextureBase& texture = static_cast<TextureBase&>(obj);
TextureBase::WrapMode wrap;
if (fr[0].matchWord("wrap_s") && TextureBase_matchWrapStr(fr[1].getStr(),wrap))
{
texture.setWrap(TextureBase::WRAP_S,wrap);
fr+=2;
iteratorAdvanced = true;
}
if (fr[0].matchWord("wrap_t") && TextureBase_matchWrapStr(fr[1].getStr(),wrap))
{
texture.setWrap(TextureBase::WRAP_T,wrap);
fr+=2;
iteratorAdvanced = true;
}
if (fr[0].matchWord("wrap_r") && TextureBase_matchWrapStr(fr[1].getStr(),wrap))
{
texture.setWrap(TextureBase::WRAP_R,wrap);
fr+=2;
iteratorAdvanced = true;
}
TextureBase::FilterMode filter;
if (fr[0].matchWord("min_filter") && TextureBase_matchFilterStr(fr[1].getStr(),filter))
{
texture.setFilter(TextureBase::MIN_FILTER,filter);
fr+=2;
iteratorAdvanced = true;
}
if (fr[0].matchWord("mag_filter") && TextureBase_matchFilterStr(fr[1].getStr(),filter))
{
texture.setFilter(TextureBase::MAG_FILTER,filter);
fr+=2;
iteratorAdvanced = true;
}
if (fr.matchSequence("maxAnisotropy %f"))
{
float anis=1.0f;
fr[1].getFloat(anis);
texture.setMaxAnisotropy(anis);
fr +=2 ;
iteratorAdvanced = true;
}
TextureBase::InternalFormatMode mode;
if (fr[0].matchWord("internalFormatMode") && TextureBase_matchInternalFormatModeStr(fr[1].getStr(),mode))
{
texture.setInternalFormatMode(mode);
fr+=2;
iteratorAdvanced = true;
}
if (fr[0].matchWord("internalFormatValue"))
{
int value;
if (TextureBase_matchInternalFormatStr(fr[1].getStr(),value) || fr[1].getInt(value))
{
texture.setInternalFormat(value);
fr+=2;
iteratorAdvanced = true;
}
}
return iteratorAdvanced;
}
bool TextureBase_writeLocalData(const Object& obj, Output& fw)
{
const TextureBase& texture = static_cast<const TextureBase&>(obj);
fw.indent() << "wrap_s " << TextureBase_getWrapStr(texture.getWrap(TextureBase::WRAP_S)) << std::endl;
fw.indent() << "wrap_t " << TextureBase_getWrapStr(texture.getWrap(TextureBase::WRAP_T)) << std::endl;
fw.indent() << "wrap_r " << TextureBase_getWrapStr(texture.getWrap(TextureBase::WRAP_R)) << std::endl;
fw.indent() << "min_filter " << TextureBase_getFilterStr(texture.getFilter(TextureBase::MIN_FILTER)) << std::endl;
fw.indent() << "mag_filter " << TextureBase_getFilterStr(texture.getFilter(TextureBase::MAG_FILTER)) << std::endl;
fw.indent() << "maxAnisotropy " << texture.getMaxAnisotropy() << std::endl;
fw.indent() << "internalFormatMode " << TextureBase_getInternalFormatModeStr(texture.getInternalFormatMode()) << std::endl;
if (texture.getInternalFormatMode()==TextureBase::USE_USER_DEFINED_FORMAT)
{
const char* str = TextureBase_getInternalFormatStr(texture.getInternalFormat());
if (str) fw.indent() << "internalFormat " << str << std::endl;
else fw.indent() << "internalFormat " << texture.getInternalFormat() << std::endl;
}
return true;
}
bool TextureBase_matchWrapStr(const char* str,TextureBase::WrapMode& wrap)
{
if (strcmp(str,"CLAMP")==0) wrap = TextureBase::CLAMP;
else if (strcmp(str,"CLAMP_TO_EDGE")==0) wrap = TextureBase::CLAMP_TO_EDGE;
else if (strcmp(str,"CLAMP_TO_BORDER")==0) wrap = TextureBase::CLAMP_TO_BORDER;
else if (strcmp(str,"REPEAT")==0) wrap = TextureBase::REPEAT;
else if (strcmp(str,"MIRROR")==0) wrap = TextureBase::MIRROR;
else return false;
return true;
}
const char* TextureBase_getWrapStr(TextureBase::WrapMode wrap)
{
switch(wrap)
{
case(TextureBase::CLAMP): return "CLAMP";
case(TextureBase::CLAMP_TO_EDGE): return "CLAMP_TO_EDGE";
case(TextureBase::CLAMP_TO_BORDER): return "CLAMP_TO_BORDER";
case(TextureBase::REPEAT): return "REPEAT";
case(TextureBase::MIRROR): return "MIRROR";
}
return "";
}
bool TextureBase_matchFilterStr(const char* str,TextureBase::FilterMode& filter)
{
if (strcmp(str,"NEAREST")==0) filter = TextureBase::NEAREST;
else if (strcmp(str,"LINEAR")==0) filter = TextureBase::LINEAR;
else if (strcmp(str,"NEAREST_MIPMAP_NEAREST")==0) filter = TextureBase::NEAREST_MIPMAP_NEAREST;
else if (strcmp(str,"LINEAR_MIPMAP_NEAREST")==0) filter = TextureBase::LINEAR_MIPMAP_NEAREST;
else if (strcmp(str,"NEAREST_MIPMAP_LINEAR")==0) filter = TextureBase::NEAREST_MIPMAP_LINEAR;
else if (strcmp(str,"LINEAR_MIPMAP_LINEAR")==0) filter = TextureBase::LINEAR_MIPMAP_LINEAR;
else if (strcmp(str,"ANISOTROPIC")==0) filter = TextureBase::LINEAR;
else return false;
return true;
}
const char* TextureBase_getFilterStr(TextureBase::FilterMode filter)
{
switch(filter)
{
case(TextureBase::NEAREST): return "NEAREST";
case(TextureBase::LINEAR): return "LINEAR";
case(TextureBase::NEAREST_MIPMAP_NEAREST): return "NEAREST_MIPMAP_NEAREST";
case(TextureBase::LINEAR_MIPMAP_NEAREST): return "LINEAR_MIPMAP_NEAREST";
case(TextureBase::NEAREST_MIPMAP_LINEAR): return "NEAREST_MIPMAP_LINEAR";
case(TextureBase::LINEAR_MIPMAP_LINEAR): return "LINEAR_MIPMAP_LINEAR";
}
return "";
}
bool TextureBase_matchInternalFormatModeStr(const char* str,TextureBase::InternalFormatMode& mode)
{
if (strcmp(str,"USE_IMAGE_DATA_FORMAT")==0) mode = TextureBase::USE_IMAGE_DATA_FORMAT;
else if (strcmp(str,"USE_USER_DEFINED_FORMAT")==0) mode = TextureBase::USE_USER_DEFINED_FORMAT;
else if (strcmp(str,"USE_ARB_COMPRESSION")==0) mode = TextureBase::USE_ARB_COMPRESSION;
else if (strcmp(str,"USE_S3TC_DXT1_COMPRESSION")==0) mode = TextureBase::USE_S3TC_DXT1_COMPRESSION;
else if (strcmp(str,"USE_S3TC_DXT3_COMPRESSION")==0) mode = TextureBase::USE_S3TC_DXT3_COMPRESSION;
else if (strcmp(str,"USE_S3TC_DXT5_COMPRESSION")==0) mode = TextureBase::USE_S3TC_DXT5_COMPRESSION;
else return false;
return true;
}
const char* TextureBase_getInternalFormatModeStr(TextureBase::InternalFormatMode mode)
{
switch(mode)
{
case(TextureBase::USE_IMAGE_DATA_FORMAT): return "USE_IMAGE_DATA_FORMAT";
case(TextureBase::USE_USER_DEFINED_FORMAT): return "USE_USER_DEFINED_FORMAT";
case(TextureBase::USE_ARB_COMPRESSION): return "USE_ARB_COMPRESSION";
case(TextureBase::USE_S3TC_DXT1_COMPRESSION): return "USE_S3TC_DXT1_COMPRESSION";
case(TextureBase::USE_S3TC_DXT3_COMPRESSION): return "USE_S3TC_DXT3_COMPRESSION";
case(TextureBase::USE_S3TC_DXT5_COMPRESSION): return "USE_S3TC_DXT5_COMPRESSION";
}
return "";
}
bool TextureBase_matchInternalFormatStr(const char* str,int& value)
{
if ( strcmp(str,"GL_INTENSITY")==0) value = GL_INTENSITY;
else if (strcmp(str,"GL_LUMINANCE")==0) value = GL_LUMINANCE;
else if (strcmp(str,"GL_ALPHA")==0) value = GL_ALPHA;
else if (strcmp(str,"GL_LUMINANCE_ALPHA")==0) value = GL_LUMINANCE_ALPHA;
else if (strcmp(str,"GL_RGB")==0) value = GL_RGB;
else if (strcmp(str,"GL_RGBA")==0) value = GL_RGBA;
else if (strcmp(str,"GL_COMPRESSED_ALPHA_ARB")==0) value = GL_COMPRESSED_ALPHA_ARB;
else if (strcmp(str,"GL_COMPRESSED_LUMINANCE_ARB")==0) value = GL_COMPRESSED_LUMINANCE_ARB;
else if (strcmp(str,"GL_COMPRESSED_INTENSITY_ARB")==0) value = GL_COMPRESSED_INTENSITY_ARB;
else if (strcmp(str,"GL_COMPRESSED_LUMINANCE_ALPHA_ARB")==0) value = GL_COMPRESSED_LUMINANCE_ALPHA_ARB;
else if (strcmp(str,"GL_COMPRESSED_RGB_ARB")==0) value = GL_COMPRESSED_RGB_ARB;
else if (strcmp(str,"GL_COMPRESSED_RGBA_ARB")==0) value = GL_COMPRESSED_RGBA_ARB;
else if (strcmp(str,"GL_COMPRESSED_RGB_S3TC_DXT1_EXT")==0) value = GL_COMPRESSED_RGB_S3TC_DXT1_EXT;
else if (strcmp(str,"GL_COMPRESSED_RGBA_S3TC_DXT1_EXT")==0) value = GL_COMPRESSED_RGBA_S3TC_DXT1_EXT;
else if (strcmp(str,"GL_COMPRESSED_RGBA_S3TC_DXT3_EXT")==0) value = GL_COMPRESSED_RGBA_S3TC_DXT3_EXT;
else if (strcmp(str,"GL_COMPRESSED_RGBA_S3TC_DXT5_EXT")==0) value = GL_COMPRESSED_RGBA_S3TC_DXT5_EXT;
else return false;
return true;
}
const char* TextureBase_getInternalFormatStr(int value)
{
switch(value)
{
case(GL_INTENSITY): return "GL_INTENSITY";
case(GL_LUMINANCE): return "GL_LUMINANCE";
case(GL_ALPHA): return "GL_ALPHA";
case(GL_LUMINANCE_ALPHA): return "GL_LUMINANCE_ALPHA";
case(GL_RGB): return "GL_RGB";
case(GL_RGBA): return "GL_RGBA";
case(GL_COMPRESSED_ALPHA_ARB): return "GL_COMPRESSED_ALPHA_ARB";
case(GL_COMPRESSED_LUMINANCE_ARB): return "GL_COMPRESSED_LUMINANCE_ARB";
case(GL_COMPRESSED_INTENSITY_ARB): return "GL_COMPRESSED_INTENSITY_ARB";
case(GL_COMPRESSED_LUMINANCE_ALPHA_ARB): return "GL_COMPRESSED_LUMINANCE_ALPHA_ARB";
case(GL_COMPRESSED_RGB_ARB): return "GL_COMPRESSED_RGB_ARB";
case(GL_COMPRESSED_RGBA_ARB): return "GL_COMPRESSED_RGBA_ARB";
case(GL_COMPRESSED_RGB_S3TC_DXT1_EXT): return "GL_COMPRESSED_RGB_S3TC_DXT1_EXT";
case(GL_COMPRESSED_RGBA_S3TC_DXT1_EXT): return "GL_COMPRESSED_RGBA_S3TC_DXT1_EXT";
case(GL_COMPRESSED_RGBA_S3TC_DXT3_EXT): return "GL_COMPRESSED_RGBA_S3TC_DXT3_EXT";
case(GL_COMPRESSED_RGBA_S3TC_DXT5_EXT): return "GL_COMPRESSED_RGBA_S3TC_DXT5_EXT";
}
return NULL;
}

View File

@@ -49,21 +49,6 @@ bool Transform_readLocalData(Object& obj, Input& fr)
}
#ifdef USE_DEPRECATED_API
if (!dynamic_cast<MatrixTransform*>(&obj))
{
static Matrix s_matrix;
if (Matrix* tmpMatrix = static_cast<Matrix*>(fr.readObjectOfType(s_matrix)))
{
transform.setMatrix(*tmpMatrix);
osgDelete tmpMatrix;
iteratorAdvanced = true;
}
}
#endif
if (fr[0].matchWord("referenceFrame")) {
if (fr[1].matchWord("RELATIVE_TO_ABSOLUTE")) {
transform.setReferenceFrame(Transform::RELATIVE_TO_ABSOLUTE);
@@ -85,13 +70,6 @@ bool Transform_writeLocalData(const Object& obj, Output& fw)
{
const Transform& transform = static_cast<const Transform&>(obj);
#ifdef USE_DEPRECATED_API
if (!dynamic_cast<const MatrixTransform*>(&obj))
{
fw.writeObject(transform.getMatrix());
}
#endif
fw.indent() << "referenceFrame ";
switch (transform.getReferenceFrame()) {
case Transform::RELATIVE_TO_ABSOLUTE: