Converted code dependant on osg::Texture across to its replacement osg::Texture2D.
This commit is contained in:
parent
61ff1c7b0a
commit
8e75f531e3
@ -11,6 +11,7 @@
|
||||
#define OSG_TEXTURE 1
|
||||
|
||||
#include <osg/TextureBase>
|
||||
|
||||
namespace osg {
|
||||
|
||||
/** Texture state class which encapsulates OpenGl texture functionality.*/
|
||||
@ -202,6 +203,7 @@ class SG_EXPORT Texture : public TextureBase
|
||||
|
||||
#else // USE_DEPRECATED_API
|
||||
|
||||
#ifdef USE_DEPRECATED_API
|
||||
#include <osg/Texture2D>
|
||||
|
||||
namespace osg {
|
||||
@ -210,4 +212,6 @@ namespace osg {
|
||||
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
#endif // USE_DEPRECATED_API
|
||||
|
@ -2,7 +2,7 @@
|
||||
#include <osg/Geometry>
|
||||
#include <osg/Notify>
|
||||
#include <osg/MatrixTransform>
|
||||
#include <osg/Texture>
|
||||
#include <osg/Texture2D>
|
||||
#include <osg/Billboard>
|
||||
#include <osg/LineWidth>
|
||||
|
||||
@ -59,7 +59,7 @@ osg::Drawable* createSquare(const osg::Vec3& corner,const osg::Vec3& width,const
|
||||
if (image)
|
||||
{
|
||||
osg::StateSet* stateset = new osg::StateSet;
|
||||
osg::Texture* texture = new osg::Texture;
|
||||
osg::Texture2D* texture = new osg::Texture2D;
|
||||
texture->setImage(image);
|
||||
stateset->setTextureAttributeAndModes(0,texture,osg::StateAttribute::ON);
|
||||
geom->setStateSet(stateset);
|
||||
|
@ -3,7 +3,7 @@
|
||||
#include <osg/Geode>
|
||||
#include <osg/Group>
|
||||
#include <osg/Notify>
|
||||
#include <osg/Texture>
|
||||
#include <osg/TextureBase>
|
||||
|
||||
#include <osgDB/Registry>
|
||||
#include <osgDB/ReadFile>
|
||||
|
@ -3,7 +3,7 @@
|
||||
#include <osg/Material>
|
||||
#include <osg/Vec3>
|
||||
#include <osg/MatrixTransform>
|
||||
#include <osg/Texture>
|
||||
#include <osg/Texture2D>
|
||||
|
||||
#include <osgDB/ReadFile>
|
||||
|
||||
@ -601,11 +601,11 @@ osg::Node* createBackground()
|
||||
polyGeom->addPrimitive(new osg::UShortDrawElements(osg::Primitive::QUADS,numIndices,myIndices));
|
||||
|
||||
// new we need to add the texture to the Drawable, we do so by creating a
|
||||
// StateSet to contain the Texture StateAttribute.
|
||||
// StateSet to contain the Texture2D StateAttribute.
|
||||
osg::StateSet* stateset = new osg::StateSet;
|
||||
|
||||
// set up the texture.
|
||||
osg::Texture* texture = new osg::Texture;
|
||||
osg::Texture2D* texture = new osg::Texture2D;
|
||||
texture->setImage(image);
|
||||
|
||||
stateset->setTextureAttributeAndModes(0, texture,osg::StateAttribute::ON);
|
||||
|
@ -2,7 +2,7 @@
|
||||
|
||||
#include <osg/Geode>
|
||||
#include <osg/Geometry>
|
||||
#include <osg/Texture>
|
||||
#include <osg/Texture2D>
|
||||
#include <osg/TexEnv>
|
||||
#include <osg/Depth>
|
||||
#include <osg/StateSet>
|
||||
@ -48,11 +48,11 @@ Node *makeBase( void )
|
||||
|
||||
geom->addPrimitive( new DrawArrays(Primitive::TRIANGLE_FAN,0,19) );
|
||||
|
||||
Texture *tex = new Texture;
|
||||
Texture2D *tex = new Texture2D;
|
||||
|
||||
tex->setImage(osgDB::readImageFile("Images/water.rgb"));
|
||||
tex->setWrap( Texture::WRAP_S, Texture::REPEAT );
|
||||
tex->setWrap( Texture::WRAP_T, Texture::REPEAT );
|
||||
tex->setWrap( Texture2D::WRAP_S, Texture2D::REPEAT );
|
||||
tex->setWrap( Texture2D::WRAP_T, Texture2D::REPEAT );
|
||||
|
||||
StateSet *dstate = new StateSet;
|
||||
dstate->setMode( GL_LIGHTING, StateAttribute::OFF );
|
||||
|
@ -2,7 +2,7 @@
|
||||
|
||||
#include <osg/Geode>
|
||||
#include <osg/Geometry>
|
||||
#include <osg/Texture>
|
||||
#include <osg/Texture2D>
|
||||
#include <osg/TexEnv>
|
||||
#include <osg/Depth>
|
||||
#include <osg/StateSet>
|
||||
@ -94,7 +94,7 @@ Node *makeSky( void )
|
||||
geom->setColorBinding( Geometry::BIND_PER_VERTEX );
|
||||
|
||||
|
||||
Texture *tex = new Texture;
|
||||
Texture2D *tex = new Texture2D;
|
||||
tex->setImage(osgDB::readImageFile("Images/white.rgb"));
|
||||
|
||||
StateSet *dstate = new StateSet;
|
||||
|
@ -4,7 +4,7 @@
|
||||
#include <osg/Group>
|
||||
#include <osg/Geode>
|
||||
#include <osg/Geometry>
|
||||
#include <osg/Texture>
|
||||
#include <osg/Texture2D>
|
||||
#include <osg/TexEnv>
|
||||
#include <osg/StateSet>
|
||||
#include <osg/Matrix>
|
||||
@ -149,10 +149,10 @@ Node *makeTank( void )
|
||||
|
||||
|
||||
|
||||
Texture *tex = new Texture;
|
||||
Texture2D *tex = new Texture2D;
|
||||
|
||||
tex->setWrap( Texture::WRAP_S, Texture::REPEAT );
|
||||
tex->setWrap( Texture::WRAP_T, Texture::REPEAT );
|
||||
tex->setWrap( Texture2D::WRAP_S, Texture2D::REPEAT );
|
||||
tex->setWrap( Texture2D::WRAP_T, Texture2D::REPEAT );
|
||||
tex->setImage(osgDB::readImageFile("Images/tank.rgb"));
|
||||
|
||||
StateSet *dstate = new StateSet;
|
||||
|
@ -2,7 +2,7 @@
|
||||
|
||||
#include <osg/Geode>
|
||||
#include <osg/Geometry>
|
||||
#include <osg/Texture>
|
||||
#include <osg/Texture2D>
|
||||
#include <osg/TexEnv>
|
||||
#include <osg/StateSet>
|
||||
|
||||
@ -110,7 +110,7 @@ Node *makeTerrain( void )
|
||||
}
|
||||
|
||||
|
||||
Texture *tex = new Texture;
|
||||
Texture2D *tex = new Texture2D;
|
||||
|
||||
tex->setImage(osgDB::readImageFile("Images/lz.rgb"));
|
||||
|
||||
|
@ -4,7 +4,7 @@
|
||||
#include <osg/Group>
|
||||
#include <osg/Geode>
|
||||
#include <osg/Geometry>
|
||||
#include <osg/Texture>
|
||||
#include <osg/Texture2D>
|
||||
#include <osg/TexEnv>
|
||||
#include <osg/BlendFunc>
|
||||
#include <osg/AlphaFunc>
|
||||
@ -216,7 +216,7 @@ Node *makeTrees( void )
|
||||
getDatabaseCenterRadius( dbcenter, &dbradius );
|
||||
struct _tree *t;
|
||||
|
||||
Texture *tex = new Texture;
|
||||
Texture2D *tex = new Texture2D;
|
||||
tex->setImage(osgDB::readImageFile("Images/tree0.rgba"));
|
||||
|
||||
StateSet *dstate = new StateSet;
|
||||
|
@ -4,7 +4,7 @@
|
||||
|
||||
#include <osg/Notify>
|
||||
|
||||
#include <osg/Texture>
|
||||
#include <osg/Texture2D>
|
||||
#include <osg/TexEnv>
|
||||
#include <osg/TexGen>
|
||||
|
||||
@ -90,7 +90,7 @@ int main( int argc, char **argv )
|
||||
osg::Image* image = osgDB::readImageFile("Images/reflect.rgb");
|
||||
if (image)
|
||||
{
|
||||
osg::Texture* texture = new osg::Texture;
|
||||
osg::Texture2D* texture = new osg::Texture2D;
|
||||
texture->setImage(image);
|
||||
|
||||
osg::TexGen* texgen = new osg::TexGen;
|
||||
|
@ -3,7 +3,7 @@
|
||||
#include <osg/Geometry>
|
||||
#include <osg/Notify>
|
||||
#include <osg/MatrixTransform>
|
||||
#include <osg/Texture>
|
||||
#include <osg/Texture2D>
|
||||
#include <osg/Stencil>
|
||||
#include <osg/ColorMask>
|
||||
#include <osg/Depth>
|
||||
|
@ -2,7 +2,7 @@
|
||||
#include <osg/Geometry>
|
||||
#include <osg/Notify>
|
||||
#include <osg/MatrixTransform>
|
||||
#include <osg/Texture>
|
||||
#include <osg/Texture2D>
|
||||
#include <osg/BlendFunc>
|
||||
#include <osg/Stencil>
|
||||
#include <osg/ColorMask>
|
||||
@ -51,7 +51,7 @@ osg::StateSet* createMirrorTexturedState(const std::string& filename)
|
||||
osg::Image* image = osgDB::readImageFile(filename.c_str());
|
||||
if (image)
|
||||
{
|
||||
osg::Texture* texture = new osg::Texture;
|
||||
osg::Texture2D* texture = new osg::Texture2D;
|
||||
texture->setImage(image);
|
||||
dstate->setTextureAttributeAndModes(0,texture,osg::StateAttribute::ON|osg::StateAttribute::PROTECTED);
|
||||
}
|
||||
|
@ -1,7 +1,6 @@
|
||||
#include <osg/Node>
|
||||
#include <osg/Notify>
|
||||
#include <osg/MatrixTransform>
|
||||
#include <osg/Texture>
|
||||
|
||||
#include <osgGA/TrackballManipulator>
|
||||
#include <osgGA/FlightManipulator>
|
||||
|
@ -2,7 +2,6 @@
|
||||
#include <osg/Node>
|
||||
#include <osg/StateSet>
|
||||
#include <osg/TextureBase>
|
||||
#include <osg/Texture>
|
||||
#include <osg/Drawable>
|
||||
#include <osg/Array>
|
||||
#include <osg/Primitive>
|
||||
|
@ -12,10 +12,11 @@
|
||||
#include <osg/BlendFunc>
|
||||
#include <osg/Depth>
|
||||
|
||||
#include <osg/TextureBase>
|
||||
#include <osg/TextureCubeMap>
|
||||
|
||||
#include <set>
|
||||
|
||||
#include <osg/Texture>
|
||||
#include <osg/TextureCubeMap>
|
||||
|
||||
using namespace osg;
|
||||
|
||||
|
@ -1,12 +1,7 @@
|
||||
#if defined(_MSC_VER)
|
||||
#pragma warning( disable : 4786 )
|
||||
#endif
|
||||
|
||||
#include <osg/GLExtensions>
|
||||
#include <osg/ref_ptr>
|
||||
#include <osg/Image>
|
||||
#include <osg/State>
|
||||
#include <osg/Texture>
|
||||
#include <osg/TextureCubeMap>
|
||||
|
||||
#include <osg/GLU>
|
||||
|
@ -30,7 +30,7 @@
|
||||
#include <osg/NodeVisitor>
|
||||
#include <osg/LineSegment>
|
||||
#include <osg/PolygonMode>
|
||||
#include <osg/Texture>
|
||||
#include <osg/Texture2D>
|
||||
#include <osg/LightModel>
|
||||
#include <osg/ShadeModel>
|
||||
#include <osg/Notify>
|
||||
@ -1034,7 +1034,7 @@ void Viewer::keyboard(unsigned char key, int x, int y)
|
||||
// thus causing them to all use the same texture attribute, hence
|
||||
// preventing a state attribute change due to unused textures.
|
||||
globalStateSet->setTextureMode(0,GL_TEXTURE_2D,osg::StateAttribute::OVERRIDE|osg::StateAttribute::OFF);
|
||||
// static osg::ref_ptr<osg::Texture> blank_texture = osgNew osg::Texture;
|
||||
// static osg::ref_ptr<osg::Texture> blank_texture = osgNew osg::Texture2D;
|
||||
// globalStateSet->setTextureAttribute(0,blank_texture.get());
|
||||
}
|
||||
break;
|
||||
|
@ -8,7 +8,7 @@
|
||||
#include <osg/Matrix>
|
||||
#include <osg/GL>
|
||||
#include <osg/StateSet>
|
||||
#include <osg/Texture>
|
||||
#include <osg/Texture2D>
|
||||
#include <osg/BlendFunc>
|
||||
#include <osg/TexEnv>
|
||||
#include <osg/Material>
|
||||
@ -137,10 +137,10 @@ void osgParticle::ParticleSystem::setDefaultAttributes(const std::string &textur
|
||||
stateset->setAttributeAndModes(material, osg::StateAttribute::ON);
|
||||
|
||||
if (!texturefile.empty()) {
|
||||
osg::Texture *texture = osgNew osg::Texture;
|
||||
osg::Texture2D *texture = osgNew osg::Texture2D;
|
||||
texture->setImage(osgDB::readImageFile(texturefile));
|
||||
texture->setFilter(osg::Texture::MIN_FILTER, osg::Texture::LINEAR);
|
||||
texture->setFilter(osg::Texture::MAG_FILTER, osg::Texture::LINEAR);
|
||||
texture->setFilter(osg::Texture2D::MIN_FILTER, osg::Texture2D::LINEAR);
|
||||
texture->setFilter(osg::Texture2D::MAG_FILTER, osg::Texture2D::LINEAR);
|
||||
stateset->setTextureAttributeAndModes(texture_unit, texture, osg::StateAttribute::ON);
|
||||
|
||||
osg::TexEnv *texenv = osgNew osg::TexEnv;
|
||||
|
@ -16,7 +16,7 @@
|
||||
#include <osg/Light>
|
||||
#include <osg/LightSource>
|
||||
#include <osg/Material>
|
||||
#include <osg/Texture>
|
||||
#include <osg/Texture2D>
|
||||
#include <osg/TexEnv>
|
||||
#include <osg/StateSet>
|
||||
#include <osg/Notify>
|
||||
@ -57,10 +57,10 @@ public:
|
||||
//ctx=osgDB::readImageFile(nm);
|
||||
if (ctx) {
|
||||
ctx->setFileName(fname);
|
||||
tx=new Texture;
|
||||
tx=new Texture2D;
|
||||
tx->setImage(ctx);
|
||||
tx->setWrap(Texture::WRAP_S, Texture::REPEAT);
|
||||
tx->setWrap(Texture::WRAP_T, Texture::REPEAT);
|
||||
tx->setWrap(Texture2D::WRAP_S, Texture2D::REPEAT);
|
||||
tx->setWrap(Texture2D::WRAP_T, Texture2D::REPEAT);
|
||||
}
|
||||
osg::TexEnv* texenv = new osg::TexEnv;
|
||||
texenv->setMode(osg::TexEnv::MODULATE);
|
||||
@ -176,7 +176,7 @@ private:
|
||||
enum atten {NONE, INVERSE_DIST, INVERSE_SQUARE} atyp;
|
||||
float bright,halfIn,halfOut,falloff; // light brightness
|
||||
Image *ctx;
|
||||
Texture *tx;
|
||||
Texture2D *tx;
|
||||
int _lightnum;
|
||||
StateSet *dstate; // used to represent the dw material in OSG
|
||||
};
|
||||
|
@ -104,7 +104,7 @@
|
||||
#include <osg/StateAttribute>
|
||||
#include <osg/StateSet>
|
||||
#include <osg/Material>
|
||||
#include <osg/Texture>
|
||||
#include <osg/Texture2D>
|
||||
#include <osg/TexEnv>
|
||||
#include <osg/CullFace>
|
||||
#include <osg/Billboard>
|
||||
@ -427,8 +427,8 @@ class MyStateSet
|
||||
|
||||
// TEXTURE / TEXTURE_0
|
||||
const osg::Image *image;
|
||||
osg::Texture::WrapMode wrap_s, wrap_t;
|
||||
osg::Texture::FilterMode min_filter, mag_filter;
|
||||
osg::Texture2D::WrapMode wrap_s, wrap_t;
|
||||
osg::Texture2D::FilterMode min_filter, mag_filter;
|
||||
|
||||
// TEXENV
|
||||
osg::TexEnv::Mode texture_func;
|
||||
@ -1999,12 +1999,13 @@ void MyStateSet::Query( const osg::StateSet &sset )
|
||||
shininess_f_and_b = mat.getShininessFrontAndBack();
|
||||
}
|
||||
|
||||
// TEXTURE / TEXTURE_0
|
||||
attr = sset.getTextureAttribute(0, osg::StateAttribute::TEXTURE );
|
||||
// TEXTURE / TEXTURE_0
|
||||
// ( and only for 2D textures right now... RO August 2002)
|
||||
attr = dynamic_cast<const osg::Texture2D*>(sset.getTextureAttribute(0, osg::StateAttribute::TEXTURE ));
|
||||
if ( attr &&
|
||||
( sset.getTextureMode(0, GL_TEXTURE_2D ) & osg::StateAttribute::ON )) {
|
||||
|
||||
const osg::Texture &texture = (const osg::Texture &) (*attr);
|
||||
const osg::Texture2D &texture = (const osg::Texture2D &) (*attr);
|
||||
|
||||
// NOTE: If OSG failed to load the texture, we'll get a NULL right here
|
||||
image = texture.getImage();
|
||||
@ -2032,13 +2033,13 @@ void MyStateSet::Query( const osg::StateSet &sset )
|
||||
// attribute "texture function" string ["decal"|"replace"|"modulate"
|
||||
// "blend"]
|
||||
|
||||
wrap_s = texture.getWrap( osg::Texture::WRAP_S );
|
||||
wrap_t = texture.getWrap( osg::Texture::WRAP_T );
|
||||
min_filter = texture.getFilter( osg::Texture::MIN_FILTER );
|
||||
mag_filter = texture.getFilter( osg::Texture::MAG_FILTER );
|
||||
wrap_s = texture.getWrap( osg::Texture2D::WRAP_S );
|
||||
wrap_t = texture.getWrap( osg::Texture2D::WRAP_T );
|
||||
min_filter = texture.getFilter( osg::Texture2D::MIN_FILTER );
|
||||
mag_filter = texture.getFilter( osg::Texture2D::MAG_FILTER );
|
||||
|
||||
if ( texture.getInternalFormatMode() !=
|
||||
osg::Texture::USE_IMAGE_DATA_FORMAT ) {
|
||||
osg::Texture2D::USE_IMAGE_DATA_FORMAT ) {
|
||||
// FIXME: When we generalize this, remove the static hack
|
||||
static int been_here = 0;
|
||||
if ( !been_here ) {
|
||||
|
@ -16,7 +16,7 @@
|
||||
#include <osg/Geode>
|
||||
#include <osg/StateSet>
|
||||
#include <osg/Material>
|
||||
#include <osg/Texture>
|
||||
#include <osg/Texture2D>
|
||||
#include <osg/TexEnv>
|
||||
#include <osg/CullFace>
|
||||
#include <osg/PolygonOffset>
|
||||
|
@ -5,7 +5,6 @@
|
||||
#endif
|
||||
|
||||
#include <osg/Vec4>
|
||||
#include <osg/Texture>
|
||||
|
||||
#include "MaterialPaletteRecord.h"
|
||||
#include "OldMaterialPaletteRecord.h"
|
||||
|
@ -6,7 +6,6 @@
|
||||
#include <osg/ref_ptr>
|
||||
#include <osg/Referenced>
|
||||
#include <osg/Vec4>
|
||||
#include <osg/Texture>
|
||||
#include <osg/Material>
|
||||
#include <osg/StateSet>
|
||||
#include <osg/Group>
|
||||
|
@ -32,7 +32,7 @@
|
||||
|
||||
#include <osg/Notify>
|
||||
#include <osg/TexEnv>
|
||||
#include <osg/Texture>
|
||||
#include <osg/Texture2D>
|
||||
#include <osg/StateSet>
|
||||
#include <osg/GL>
|
||||
|
||||
@ -573,18 +573,18 @@ StateSet* Attr::createOsgStateSet()
|
||||
{
|
||||
StateSet* osgStateSet = new StateSet;
|
||||
TexEnv* osgTexEnv = new TexEnv;
|
||||
Texture* osgTexture = new Texture;
|
||||
Texture2D* osgTexture = new Texture2D;
|
||||
|
||||
if ((wrapMode_u != WRAP_CLAMP) && ((wrapMode_u != WRAP_REPEAT)))
|
||||
wrapMode_u = wrapMode;
|
||||
if ((wrapMode_v != WRAP_CLAMP) && ((wrapMode_v != WRAP_REPEAT)))
|
||||
wrapMode_v = wrapMode;
|
||||
|
||||
if (wrapMode_u == WRAP_CLAMP) osgTexture->setWrap(Texture::WRAP_S,Texture::CLAMP);
|
||||
else osgTexture->setWrap(Texture::WRAP_S,Texture::REPEAT);
|
||||
if (wrapMode_u == WRAP_CLAMP) osgTexture->setWrap(Texture2D::WRAP_S,Texture2D::CLAMP);
|
||||
else osgTexture->setWrap(Texture2D::WRAP_S,Texture2D::REPEAT);
|
||||
|
||||
if (wrapMode_v == WRAP_CLAMP) osgTexture->setWrap(Texture::WRAP_T,Texture::CLAMP);
|
||||
else osgTexture->setWrap(Texture::WRAP_T,Texture::REPEAT);
|
||||
if (wrapMode_v == WRAP_CLAMP) osgTexture->setWrap(Texture2D::WRAP_T,Texture2D::CLAMP);
|
||||
else osgTexture->setWrap(Texture2D::WRAP_T,Texture2D::REPEAT);
|
||||
|
||||
|
||||
switch (texEnvMode)
|
||||
@ -610,16 +610,16 @@ StateSet* Attr::createOsgStateSet()
|
||||
switch (minFilterMode)
|
||||
{
|
||||
case MIN_FILTER_MIPMAP_POINT:
|
||||
osgTexture->setFilter(osg::Texture::MIN_FILTER, Texture::LINEAR_MIPMAP_NEAREST);
|
||||
osgTexture->setFilter(osg::Texture2D::MIN_FILTER, Texture2D::LINEAR_MIPMAP_NEAREST);
|
||||
break;
|
||||
case MIN_FILTER_MIPMAP_LINEAR:
|
||||
osgTexture->setFilter(osg::Texture::MIN_FILTER, Texture::NEAREST_MIPMAP_LINEAR);
|
||||
osgTexture->setFilter(osg::Texture2D::MIN_FILTER, Texture2D::NEAREST_MIPMAP_LINEAR);
|
||||
break;
|
||||
case MIN_FILTER_MIPMAP_BILINEAR:
|
||||
osgTexture->setFilter(osg::Texture::MIN_FILTER, Texture::LINEAR_MIPMAP_NEAREST);
|
||||
osgTexture->setFilter(osg::Texture2D::MIN_FILTER, Texture2D::LINEAR_MIPMAP_NEAREST);
|
||||
break;
|
||||
case MIN_FILTER_MIPMAP_TRILINEAR:
|
||||
osgTexture->setFilter(osg::Texture::MIN_FILTER, Texture::LINEAR_MIPMAP_LINEAR);
|
||||
osgTexture->setFilter(osg::Texture2D::MIN_FILTER, Texture2D::LINEAR_MIPMAP_LINEAR);
|
||||
break;
|
||||
case MIN_FILTER_POINT:
|
||||
case MIN_FILTER_BILINEAR:
|
||||
@ -629,7 +629,7 @@ StateSet* Attr::createOsgStateSet()
|
||||
case MIN_FILTER_BICUBIC_GEQUAL:
|
||||
case MIN_FILTER_BICUBIC_LEQUAL:
|
||||
default:
|
||||
osgTexture->setFilter(osg::Texture::MIN_FILTER, Texture::LINEAR_MIPMAP_LINEAR);
|
||||
osgTexture->setFilter(osg::Texture2D::MIN_FILTER, Texture2D::LINEAR_MIPMAP_LINEAR);
|
||||
break;
|
||||
}
|
||||
|
||||
@ -641,24 +641,24 @@ StateSet* Attr::createOsgStateSet()
|
||||
switch (magFilterMode)
|
||||
{
|
||||
case MAG_FILTER_POINT:
|
||||
osgTexture->setFilter(osg::Texture::MAG_FILTER, Texture::NEAREST);
|
||||
osgTexture->setFilter(osg::Texture2D::MAG_FILTER, Texture2D::NEAREST);
|
||||
break;
|
||||
case MAG_FILTER_BILINEAR:
|
||||
case MAG_FILTER_BILINEAR_GEQUAL:
|
||||
case MAG_FILTER_BILINEAR_LEQUAL:
|
||||
case MAG_FILTER_SHARPEN:
|
||||
osgTexture->setFilter(osg::Texture::MAG_FILTER, Texture::LINEAR);
|
||||
osgTexture->setFilter(osg::Texture2D::MAG_FILTER, Texture2D::LINEAR);
|
||||
break;
|
||||
case MAG_FILTER_BICUBIC:
|
||||
case MAG_FILTER_BICUBIC_GEQUAL:
|
||||
case MAG_FILTER_BICUBIC_LEQUAL:
|
||||
osgTexture->setFilter(osg::Texture::MAG_FILTER, Texture::LINEAR);
|
||||
osgTexture->setFilter(osg::Texture2D::MAG_FILTER, Texture2D::LINEAR);
|
||||
osgTexture->setMaxAnisotropy(2.0f);
|
||||
break;
|
||||
|
||||
// case MAG_FILTER_ADD_DETAIL:
|
||||
// case MAG_FILTER_MODULATE_DETAIL:
|
||||
// osgTexture->setFilter(osg::Texture::MAG_FILTER, Texture::LINEAR);
|
||||
// osgTexture->setFilter(osg::Texture2D::MAG_FILTER, Texture2D::LINEAR);
|
||||
// break;
|
||||
}
|
||||
|
||||
|
@ -19,7 +19,7 @@
|
||||
#include <osg/Vec3>
|
||||
#include <osg/Vec4>
|
||||
#include <osg/Billboard>
|
||||
#include <osg/Texture>
|
||||
#include <osg/Texture2D>
|
||||
#include <osg/Image>
|
||||
#include <osg/Notify>
|
||||
|
||||
@ -511,9 +511,9 @@ void ConvertFromFLT::visitTexturePalette(osg::Group& , TexturePaletteRecord* rec
|
||||
{
|
||||
osgStateSet = new osg::StateSet;
|
||||
|
||||
osg::Texture* osgTexture = new osg::Texture;
|
||||
osgTexture->setWrap(osg::Texture::WRAP_S,osg::Texture::REPEAT);
|
||||
osgTexture->setWrap(osg::Texture::WRAP_T,osg::Texture::REPEAT);
|
||||
osg::Texture2D* osgTexture = new osg::Texture2D;
|
||||
osgTexture->setWrap(osg::Texture2D::WRAP_S,osg::Texture2D::REPEAT);
|
||||
osgTexture->setWrap(osg::Texture2D::WRAP_T,osg::Texture2D::REPEAT);
|
||||
osgStateSet->setTextureAttributeAndModes( unit, osgTexture,osg::StateAttribute::ON);
|
||||
|
||||
osg::TexEnv* osgTexEnv = new osg::TexEnv;
|
||||
@ -521,10 +521,10 @@ void ConvertFromFLT::visitTexturePalette(osg::Group& , TexturePaletteRecord* rec
|
||||
osgStateSet->setTextureAttribute( unit, osgTexEnv );
|
||||
}
|
||||
|
||||
osg::Texture *osgTexture = dynamic_cast<osg::Texture*>(osgStateSet->getTextureAttribute( unit, osg::StateAttribute::TEXTURE));
|
||||
osg::Texture2D *osgTexture = dynamic_cast<osg::Texture2D*>(osgStateSet->getTextureAttribute( unit, osg::StateAttribute::TEXTURE));
|
||||
if (osgTexture == NULL)
|
||||
{
|
||||
osgTexture = new osg::Texture;
|
||||
osgTexture = new osg::Texture2D;
|
||||
osgStateSet->setTextureAttributeAndModes( unit, osgTexture,osg::StateAttribute::ON);
|
||||
}
|
||||
|
||||
@ -1160,7 +1160,7 @@ void ConvertFromFLT::setTexture ( FaceRecord *rec, SFace *pSFace, osg::StateSet
|
||||
osgStateSet->merge(*textureStateSet);
|
||||
|
||||
// Alpha channel in texture?
|
||||
osg::Texture *osgTexture = dynamic_cast<osg::Texture*>(textureStateSet->getTextureAttribute( 0, osg::StateAttribute::TEXTURE));
|
||||
osg::Texture2D *osgTexture = dynamic_cast<osg::Texture2D*>(textureStateSet->getTextureAttribute( 0, osg::StateAttribute::TEXTURE));
|
||||
if (osgTexture)
|
||||
{
|
||||
osg::Image* osgImage = osgTexture->getImage();
|
||||
|
@ -35,7 +35,7 @@
|
||||
#include <osg/GeoSet>
|
||||
#include <osg/StateSet>
|
||||
#include <osg/Material>
|
||||
#include <osg/Texture>
|
||||
#include <osg/Texture2D>
|
||||
#include <osg/MatrixTransform>
|
||||
#include <osg/BlendFunc>
|
||||
#include <osg/CullFace>
|
||||
@ -59,7 +59,7 @@
|
||||
|
||||
class ObjectCache {
|
||||
typedef std::map<osg::ref_ptr<Material>, osg::ref_ptr<osg::Material> > MaterialMap;
|
||||
typedef std::map<const char*, osg::ref_ptr<osg::Texture>, ltstr> TextureMap;
|
||||
typedef std::map<const char*, osg::ref_ptr<osg::Texture2D>, ltstr> TextureMap;
|
||||
typedef std::map<osg::ref_ptr<MyNode>, osg::ref_ptr<osg::Node> > NodeMap;
|
||||
|
||||
static MaterialMap materials;
|
||||
@ -90,12 +90,12 @@ public:
|
||||
return materials[_material].get();
|
||||
}
|
||||
|
||||
static osg::Texture* getTextura(const char* _texture) {
|
||||
static osg::Texture2D* getTextura(const char* _texture) {
|
||||
if (textures.find(_texture) == textures.end()) {
|
||||
osg::Texture *texture=new osg::Texture();
|
||||
osg::Texture2D *texture=new osg::Texture2D();
|
||||
texture->setImage(osgDB::readImageFile(_texture));
|
||||
texture->setWrap(osg::Texture::WRAP_S,osg::Texture::REPEAT);
|
||||
texture->setWrap(osg::Texture::WRAP_T,osg::Texture::REPEAT);
|
||||
texture->setWrap(osg::Texture2D::WRAP_S,osg::Texture2D::REPEAT);
|
||||
texture->setWrap(osg::Texture2D::WRAP_T,osg::Texture2D::REPEAT);
|
||||
osg::notify(osg::INFO) << "Loading texture " << _texture << std::endl;
|
||||
textures[_texture]=texture;
|
||||
}
|
||||
@ -246,7 +246,7 @@ void OSGVisitor::makeGeode(osg::Geode *geode, osg::Geometry *geometry, bool twoS
|
||||
if (texture_active!=0) {
|
||||
AtrString *filename=(AtrString*)texture_active->getAttribute("filename");
|
||||
if (filename) {
|
||||
osg::Texture *texture=ObjectCache::getTextura(filename->getValue());
|
||||
osg::Texture2D *texture=ObjectCache::getTextura(filename->getValue());
|
||||
state->setTextureAttributeAndModes(0,texture,osg::StateAttribute::ON);
|
||||
}
|
||||
}
|
||||
|
@ -2,7 +2,7 @@
|
||||
#include <osg/Group>
|
||||
#include <osg/Geode>
|
||||
#include <osg/Geometry>
|
||||
#include <osg/Texture>
|
||||
#include <osg/Texture2D>
|
||||
#include <osg/Material>
|
||||
#include <osg/TexEnv>
|
||||
#include <osg/ref_ptr>
|
||||
@ -93,7 +93,7 @@ class ReaderWriter3DS : public osgDB::ReaderWriter
|
||||
|
||||
protected:
|
||||
|
||||
osg::Texture* createTexture(Lib3dsTextureMap *texture,const char* label,bool& transparancy);
|
||||
osg::Texture2D* createTexture(Lib3dsTextureMap *texture,const char* label,bool& transparancy);
|
||||
osg::StateSet* createStateSet(Lib3dsMaterial *materials);
|
||||
osg::Drawable* createDrawable(Lib3dsMesh *meshes,FaceList& faceList, Lib3dsMatrix* matrix);
|
||||
|
||||
@ -609,7 +609,7 @@ osg::Drawable* ReaderWriter3DS::createDrawable(Lib3dsMesh *m,FaceList& faceLis
|
||||
}
|
||||
|
||||
|
||||
osg::Texture* ReaderWriter3DS::createTexture(Lib3dsTextureMap *texture,const char* label,bool& transparancy)
|
||||
osg::Texture2D* ReaderWriter3DS::createTexture(Lib3dsTextureMap *texture,const char* label,bool& transparancy)
|
||||
{
|
||||
if (texture && *(texture->name))
|
||||
{
|
||||
@ -641,20 +641,20 @@ osg::Texture* ReaderWriter3DS::createTexture(Lib3dsTextureMap *texture,const ch
|
||||
return NULL;
|
||||
}
|
||||
|
||||
osg::Texture* osg_texture = new osg::Texture;
|
||||
osg::Texture2D* osg_texture = new osg::Texture2D;
|
||||
osg_texture->setImage(osg_image);
|
||||
|
||||
// does the texture support transparancy?
|
||||
transparancy = ((texture->flags)&LIB3DS_ALPHA_SOURCE)!=0;
|
||||
|
||||
// what is the wrap mode of the texture.
|
||||
osg::Texture::WrapMode wm = ((texture->flags)&LIB3DS_NO_TILE) ?
|
||||
osg::Texture::CLAMP : wm=osg::Texture::REPEAT;
|
||||
osg_texture->setWrap(osg::Texture::WRAP_S,wm);
|
||||
osg_texture->setWrap(osg::Texture::WRAP_T,wm);
|
||||
osg_texture->setWrap(osg::Texture::WRAP_R,wm);
|
||||
osg::Texture2D::WrapMode wm = ((texture->flags)&LIB3DS_NO_TILE) ?
|
||||
osg::Texture2D::CLAMP : wm=osg::Texture2D::REPEAT;
|
||||
osg_texture->setWrap(osg::Texture2D::WRAP_S,wm);
|
||||
osg_texture->setWrap(osg::Texture2D::WRAP_T,wm);
|
||||
osg_texture->setWrap(osg::Texture2D::WRAP_R,wm);
|
||||
// bilinear.
|
||||
osg_texture->setFilter(osg::Texture::MIN_FILTER,osg::Texture::LINEAR_MIPMAP_NEAREST);
|
||||
osg_texture->setFilter(osg::Texture2D::MIN_FILTER,osg::Texture2D::LINEAR_MIPMAP_NEAREST);
|
||||
|
||||
return osg_texture;
|
||||
}
|
||||
@ -689,7 +689,7 @@ osg::StateSet* ReaderWriter3DS::createStateSet(Lib3dsMaterial *mat)
|
||||
|
||||
bool decal = true;
|
||||
bool textureTransparancy=false;
|
||||
osg::Texture* texture1_map = createTexture(&(mat->texture1_map),"texture1_map",textureTransparancy);
|
||||
osg::Texture2D* texture1_map = createTexture(&(mat->texture1_map),"texture1_map",textureTransparancy);
|
||||
if (texture1_map)
|
||||
{
|
||||
stateset->setTextureAttributeAndModes(0,texture1_map,osg::StateAttribute::ON);
|
||||
|
@ -26,7 +26,7 @@
|
||||
#include <osg/Notify>
|
||||
#include <osg/Geode>
|
||||
#include <osg/Group>
|
||||
#include <osg/Texture>
|
||||
#include <osg/Texture2D>
|
||||
#include <osg/Material>
|
||||
#include <osg/CullFace>
|
||||
|
||||
@ -655,7 +655,7 @@ Lwo2::_generate_statesets_from_surfaces()
|
||||
notify(DEBUG_INFO) << "\tresult - " << image << endl;
|
||||
if (image)
|
||||
{
|
||||
Texture* texture = new osg::Texture;
|
||||
Texture2D* texture = new osg::Texture2D;
|
||||
texture->setImage(image);
|
||||
state_set->setTextureAttributeAndModes(0, texture, StateAttribute::ON);
|
||||
}
|
||||
|
@ -22,7 +22,7 @@
|
||||
#include <osg/Group>
|
||||
#include <osg/Geode>
|
||||
#include <osg/Group>
|
||||
#include <osg/Texture>
|
||||
#include <osg/Texture2D>
|
||||
#include <osg/Geometry>
|
||||
#include <osg/StateSet>
|
||||
|
||||
@ -173,7 +173,7 @@ osgDB::ReaderWriter::ReadResult ReaderWriterLWO::readNode_LWO1(const std::string
|
||||
// create state
|
||||
osg::StateSet* stateset = new osg::StateSet;
|
||||
|
||||
osg::Texture* texture = new osg::Texture;
|
||||
osg::Texture2D* texture = new osg::Texture2D;
|
||||
texture->setImage(image);
|
||||
|
||||
stateset->setTextureAttributeAndModes(0,texture,osg::StateAttribute::ON);
|
||||
|
@ -27,7 +27,7 @@
|
||||
#include <osg/Geometry>
|
||||
#include <osg/StateSet>
|
||||
#include <osg/Material>
|
||||
#include <osg/Texture>
|
||||
#include <osg/Texture2D>
|
||||
#include <osg/TexGen>
|
||||
|
||||
#include <osgDB/Registry>
|
||||
@ -130,7 +130,7 @@ osgDB::ReaderWriter::ReadResult ReaderWriterOBJ::readNode(const std::string& fil
|
||||
osg::Image* osg_image = osgDB::readImageFile(fileName.c_str());
|
||||
if (osg_image)
|
||||
{
|
||||
osg::Texture* osg_texture = new osg::Texture;
|
||||
osg::Texture2D* osg_texture = new osg::Texture2D;
|
||||
osg_texture->setImage(osg_image);
|
||||
stateset->setTextureAttributeAndModes(0,osg_texture,osg::StateAttribute::ON);
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
#include <osg/StateSet>
|
||||
#include <osg/Texture>
|
||||
#include <osg/Texture2D>
|
||||
#include <osg/TextureCubeMap>
|
||||
|
||||
#include <osgDB/Registry>
|
||||
|
@ -8,7 +8,7 @@
|
||||
#include <osg/Switch>
|
||||
#include <osg/Geode>
|
||||
#include <osg/Billboard>
|
||||
#include <osg/Texture>
|
||||
#include <osg/Texture2D>
|
||||
#include <osg/Image>
|
||||
#include <osg/CullFace>
|
||||
#include <osg/TexGen>
|
||||
@ -1125,19 +1125,19 @@ osg::Material* ConvertFromPerformer::visitMaterial(osg::StateSet* osgStateSet,pf
|
||||
}
|
||||
|
||||
|
||||
static osg::Texture::FilterMode getTexfilter(int filter, int pftype)
|
||||
static osg:::Texture2D::FilterMode getTexfilter(int filter, int pftype)
|
||||
{
|
||||
if (filter == PFTEX_MINFILTER)
|
||||
{
|
||||
|
||||
if (pftype & PFTEX_LINEAR)
|
||||
return osg::Texture::NEAREST_MIPMAP_LINEAR;
|
||||
return osg:::Texture2D::NEAREST_MIPMAP_LINEAR;
|
||||
else if (pftype & PFTEX_BILINEAR)
|
||||
return osg::Texture::LINEAR_MIPMAP_NEAREST;
|
||||
return osg:::Texture2D::LINEAR_MIPMAP_NEAREST;
|
||||
else if (pftype & PFTEX_TRILINEAR)
|
||||
return osg::Texture::LINEAR_MIPMAP_LINEAR;
|
||||
return osg:::Texture2D::LINEAR_MIPMAP_LINEAR;
|
||||
|
||||
return osg::Texture::NEAREST_MIPMAP_LINEAR;
|
||||
return osg:::Texture2D::NEAREST_MIPMAP_LINEAR;
|
||||
|
||||
}
|
||||
else
|
||||
@ -1147,22 +1147,22 @@ static osg::Texture::FilterMode getTexfilter(int filter, int pftype)
|
||||
// not quite sure what is supposed to be interpret the Peformer
|
||||
// filter modes here so will simple go with OpenGL default.
|
||||
|
||||
return osg::Texture::LINEAR;
|
||||
return osg:::Texture2D::LINEAR;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
osg::Texture* ConvertFromPerformer::visitTexture(osg::StateSet* osgStateSet,pfTexture* tex)
|
||||
osg::Texture2D* ConvertFromPerformer::visitTexture(osg::StateSet* osgStateSet,pfTexture* tex)
|
||||
{
|
||||
if (tex==NULL) return NULL;
|
||||
|
||||
osg::Texture* osgTexture = dynamic_cast<osg::Texture*>(getOsgObject(tex));
|
||||
osg::Texture2D* osgTexture = dynamic_cast<osg::Texture2D*>(getOsgObject(tex));
|
||||
if (osgTexture) {
|
||||
if (osgStateSet) osgStateSet->setTextureAttribute(0,osgTexture);
|
||||
return osgTexture;
|
||||
}
|
||||
|
||||
osgTexture = new osg::Texture;
|
||||
osgTexture = new osg::Texture2D;
|
||||
registerPfObjectForOsgObject(tex, osgTexture);
|
||||
//_pfToOsgMap[tex] = osgTexture;
|
||||
|
||||
@ -1173,26 +1173,26 @@ osg::Texture* ConvertFromPerformer::visitTexture(osg::StateSet* osgStateSet,pfTe
|
||||
int repeat_t = tex->getRepeat(PFTEX_WRAP_T);
|
||||
|
||||
if (repeat_r==PFTEX_CLAMP)
|
||||
osgTexture->setWrap(osg::Texture::WRAP_R,osg::Texture::CLAMP);
|
||||
osgTexture->setWrap(osg:::Texture2D::WRAP_R,osg:::Texture2D::CLAMP);
|
||||
else
|
||||
osgTexture->setWrap(osg::Texture::WRAP_R,osg::Texture::REPEAT);
|
||||
osgTexture->setWrap(osg:::Texture2D::WRAP_R,osg:::Texture2D::REPEAT);
|
||||
|
||||
if (repeat_s==PFTEX_CLAMP)
|
||||
osgTexture->setWrap(osg::Texture::WRAP_S,osg::Texture::CLAMP);
|
||||
osgTexture->setWrap(osg:::Texture2D::WRAP_S,osg:::Texture2D::CLAMP);
|
||||
else
|
||||
osgTexture->setWrap(osg::Texture::WRAP_S,osg::Texture::REPEAT);
|
||||
osgTexture->setWrap(osg:::Texture2D::WRAP_S,osg:::Texture2D::REPEAT);
|
||||
|
||||
if (repeat_t==PFTEX_CLAMP)
|
||||
osgTexture->setWrap(osg::Texture::WRAP_T,osg::Texture::CLAMP);
|
||||
osgTexture->setWrap(osg:::Texture2D::WRAP_T,osg:::Texture2D::CLAMP);
|
||||
else
|
||||
osgTexture->setWrap(osg::Texture::WRAP_T,osg::Texture::REPEAT);
|
||||
osgTexture->setWrap(osg:::Texture2D::WRAP_T,osg:::Texture2D::REPEAT);
|
||||
|
||||
// filter
|
||||
#if 1
|
||||
osgTexture->setFilter(osg::Texture::MIN_FILTER,
|
||||
osgTexture->setFilter(osg:::Texture2D::MIN_FILTER,
|
||||
getTexfilter(PFTEX_MINFILTER,
|
||||
tex->getFilter(PFTEX_MINFILTER)));
|
||||
osgTexture->setFilter(osg::Texture::MAG_FILTER,
|
||||
osgTexture->setFilter(osg:::Texture2D::MAG_FILTER,
|
||||
getTexfilter(PFTEX_MAGFILTER,
|
||||
tex->getFilter(PFTEX_MAGFILTER)));
|
||||
#endif
|
||||
|
@ -12,7 +12,7 @@
|
||||
#include <osg/Group>
|
||||
#include <osg/GeoSet>
|
||||
#include <osg/StateSet>
|
||||
#include <osg/Texture>
|
||||
#include <osg/Texture2D>
|
||||
#include <osg/Material>
|
||||
|
||||
// Performer includes.
|
||||
@ -50,7 +50,7 @@ class ConvertFromPerformer {
|
||||
osg::Drawable* visitGeoSet(osg::Geode* osgParent,pfGeoSet* geoset);
|
||||
osg::StateSet* visitGeoState(osg::Drawable* osgDrawble,pfGeoState* geostate);
|
||||
osg::Material* visitMaterial(osg::StateSet* osgStateSet,pfMaterial* front_mat,pfMaterial* back_mat);
|
||||
osg::Texture* visitTexture(osg::StateSet* osgStateSet,pfTexture* tex);
|
||||
osg::Texture2D* visitTexture(osg::StateSet* osgStateSet,pfTexture* tex);
|
||||
|
||||
typedef std::map<int,osg::GeoSet::PrimitiveType> GSetPrimitiveMap;
|
||||
typedef std::map<int,osg::GeoSet::BindingType> GSetBindingMap;
|
||||
|
@ -5,7 +5,6 @@
|
||||
#include <osg/Switch>
|
||||
#include <osg/Geode>
|
||||
#include <osg/Billboard>
|
||||
#include <osg/Texture>
|
||||
#include <osg/Image>
|
||||
#include <osg/Notify>
|
||||
|
||||
@ -509,7 +508,7 @@ pfGeoState* ConvertToPerformer::visitStateSet(osg::StateSet* stateset)
|
||||
case(osg::StateAttribute::INHERIT): break;
|
||||
}
|
||||
|
||||
const osg::Texture *tex = dynamic_cast<const osg::Texture *>(stateset->getAttribute( osg::StateAttribute::TEXTURE));
|
||||
const osg::Texture2D *tex = dynamic_cast<const osg::Texture2D *>(stateset->getAttribute( osg::StateAttribute::TEXTURE));
|
||||
|
||||
if( tex != NULL )
|
||||
{
|
||||
@ -547,7 +546,7 @@ pfMaterial* ConvertToPerformer::visitMaterial(osg::Material* material)
|
||||
}
|
||||
|
||||
|
||||
pfTexture* ConvertToPerformer::visitTexture(osg::Texture* tex)
|
||||
pfTexture* ConvertToPerformer::visitTexture(osg::Texture2D* tex)
|
||||
{
|
||||
if (tex==NULL) return NULL;
|
||||
|
||||
|
@ -13,7 +13,7 @@
|
||||
#include <osg/GeoSet>
|
||||
#include <osg/StateSet>
|
||||
#include <osg/Material>
|
||||
#include <osg/Texture>
|
||||
#include <osg/Texture2D>
|
||||
|
||||
// Performer includes.
|
||||
#include <Performer/pf/pfNode.h>
|
||||
@ -48,7 +48,7 @@ class ConvertToPerformer : protected osg::NodeVisitor {
|
||||
pfGeoSet* visitGeoSet(osg::GeoSet* geoset);
|
||||
pfGeoState* visitStateSet(osg::StateSet* geostate);
|
||||
pfMaterial* visitMaterial(osg::Material* material);
|
||||
pfTexture* visitTexture(osg::Texture* tex);
|
||||
pfTexture* visitTexture(osg::Texture2D* tex);
|
||||
|
||||
|
||||
typedef std::map<osg::Object*,pfObject*> OsgObjectToPfObjectMap;
|
||||
|
@ -2,7 +2,6 @@
|
||||
#include "osg/Notify"
|
||||
|
||||
#include <osg/Geode>
|
||||
#include <osg/Texture>
|
||||
|
||||
#include "osg/GL"
|
||||
|
||||
|
@ -2,7 +2,6 @@
|
||||
#include "osg/Notify"
|
||||
|
||||
#include <osg/Geode>
|
||||
#include <osg/Texture>
|
||||
|
||||
#include "osg/GL"
|
||||
|
||||
|
@ -4,7 +4,7 @@
|
||||
#include <osg/AlphaFunc>
|
||||
#include <osg/Group>
|
||||
#include <osg/Image>
|
||||
#include <osg/Texture>
|
||||
#include <osg/Texture2D>
|
||||
#include <osg/Material>
|
||||
#include <osg/TexEnv>
|
||||
#include <osg/CullFace>
|
||||
@ -111,7 +111,7 @@ void TrPageArchive::LoadMaterials()
|
||||
char texName[1024]; texName[0] = 0;
|
||||
tex->GetName(texName,1023);
|
||||
// Create a texture by name.
|
||||
ref_ptr<Texture> osg_texture = new Texture();
|
||||
ref_ptr<Texture2D> osg_texture = new Texture2D();
|
||||
|
||||
// Load Texture and Create Texture State
|
||||
std::string filename = osgDB::getSimpleFileName(texName);
|
||||
@ -138,14 +138,14 @@ void TrPageArchive::LoadMaterials()
|
||||
}
|
||||
else if( mode == trpgTexture::Local )
|
||||
{
|
||||
ref_ptr<Texture> osg_texture = GetLocalTexture(image_helper,0, tex);
|
||||
ref_ptr<Texture2D> osg_texture = GetLocalTexture(image_helper,0, tex);
|
||||
osg_texture->ref();
|
||||
m_textures[i] = osg_texture;
|
||||
// delete [] data;
|
||||
}
|
||||
else if( mode == trpgTexture::Template )
|
||||
{
|
||||
ref_ptr<Texture> osg_texture = GetLocalTexture(image_helper,0, tex);
|
||||
ref_ptr<Texture2D> osg_texture = GetLocalTexture(image_helper,0, tex);
|
||||
if (osg_texture.valid()) osg_texture->ref();
|
||||
m_textures[i] = osg_texture;
|
||||
// delete [] data;
|
||||
@ -251,11 +251,11 @@ void TrPageArchive::LoadMaterials()
|
||||
int wrap_s, wrap_t;
|
||||
texEnv.GetWrap(wrap_s, wrap_t);
|
||||
|
||||
Texture* osg_texture = m_textures[texId].get();
|
||||
Texture2D* osg_texture = m_textures[texId].get();
|
||||
if(osg_texture)
|
||||
{
|
||||
osg_texture->setWrap(Texture::WRAP_S, wrap_s == trpgTextureEnv::Repeat ? Texture::REPEAT: Texture::CLAMP );
|
||||
osg_texture->setWrap(Texture::WRAP_T, wrap_t == trpgTextureEnv::Repeat ? Texture::REPEAT: Texture::CLAMP );
|
||||
osg_texture->setWrap(Texture2D::WRAP_S, wrap_s == trpgTextureEnv::Repeat ? Texture2D::REPEAT: Texture2D::CLAMP );
|
||||
osg_texture->setWrap(Texture2D::WRAP_T, wrap_t == trpgTextureEnv::Repeat ? Texture2D::REPEAT: Texture2D::CLAMP );
|
||||
osg_state_set->setTextureAttributeAndModes(ntex,osg_texture, StateAttribute::ON);
|
||||
|
||||
if(osg_texture->getImage())
|
||||
|
@ -77,7 +77,7 @@ namespace txp
|
||||
/// This class does most of the actual parsing.
|
||||
std::auto_ptr<TrPageParser> parse;
|
||||
// Texture, material, and model lists.
|
||||
std::vector< osg::ref_ptr<osg::Texture> > m_textures;
|
||||
std::vector< osg::ref_ptr<osg::Texture2D> > m_textures;
|
||||
std::vector< osg::ref_ptr<osg::StateSet> > m_gstates;
|
||||
std::vector< osg::ref_ptr<osg::Node> > m_models;
|
||||
std::string m_alternate_path;
|
||||
|
@ -23,7 +23,6 @@
|
||||
#include <osg/AlphaFunc>
|
||||
#include <osg/Group>
|
||||
#include <osg/Material>
|
||||
#include <osg/Texture>
|
||||
#include <osg/TexEnv>
|
||||
#include <osg/LOD>
|
||||
#include <osg/Geode>
|
||||
@ -50,9 +49,9 @@ using namespace osg;
|
||||
using std::vector;
|
||||
using std::string;
|
||||
|
||||
Texture* txp::GetLocalTexture(trpgrImageHelper& image_helper, trpgLocalMaterial* locmat, const trpgTexture* tex)
|
||||
Texture2D* txp::GetLocalTexture(trpgrImageHelper& image_helper, trpgLocalMaterial* locmat, const trpgTexture* tex)
|
||||
{
|
||||
Texture* osg_texture= 0L;
|
||||
Texture2D* osg_texture= 0L;
|
||||
|
||||
trpg2iPoint s;
|
||||
tex->GetImageSize(s);
|
||||
@ -61,7 +60,7 @@ Texture* txp::GetLocalTexture(trpgrImageHelper& image_helper, trpgLocalMaterial*
|
||||
trpgTexture::ImageType type;
|
||||
tex->GetImageType(type);
|
||||
|
||||
Texture::InternalFormatMode internalFormat = Texture::USE_IMAGE_DATA_FORMAT;
|
||||
Texture2D::InternalFormatMode internalFormat = Texture2D::USE_IMAGE_DATA_FORMAT;
|
||||
|
||||
GLenum gltype = (GLenum)-1;
|
||||
switch(type)
|
||||
@ -93,7 +92,7 @@ Texture* txp::GetLocalTexture(trpgrImageHelper& image_helper, trpgLocalMaterial*
|
||||
{
|
||||
gltype = GL_RGBA;
|
||||
}
|
||||
internalFormat = Texture::USE_S3TC_DXT1_COMPRESSION;
|
||||
internalFormat = Texture2D::USE_S3TC_DXT1_COMPRESSION;
|
||||
break;
|
||||
case trpgTexture::trpg_DXT3:
|
||||
if(depth == 3)
|
||||
@ -104,7 +103,7 @@ Texture* txp::GetLocalTexture(trpgrImageHelper& image_helper, trpgLocalMaterial*
|
||||
{
|
||||
gltype = GL_RGBA;
|
||||
}
|
||||
internalFormat = Texture::USE_S3TC_DXT3_COMPRESSION;
|
||||
internalFormat = Texture2D::USE_S3TC_DXT3_COMPRESSION;
|
||||
break;
|
||||
case trpgTexture::trpg_DXT5:
|
||||
if(depth == 3)
|
||||
@ -115,13 +114,13 @@ Texture* txp::GetLocalTexture(trpgrImageHelper& image_helper, trpgLocalMaterial*
|
||||
{
|
||||
gltype = GL_RGBA;
|
||||
}
|
||||
internalFormat = Texture::USE_S3TC_DXT5_COMPRESSION;
|
||||
internalFormat = Texture2D::USE_S3TC_DXT5_COMPRESSION;
|
||||
break;
|
||||
}
|
||||
|
||||
if(gltype!=(GLenum)-1)
|
||||
{
|
||||
osg_texture = new Texture();
|
||||
osg_texture = new Texture2D();
|
||||
osg_texture->setInternalFormatMode(internalFormat);
|
||||
|
||||
Image* image = new Image;
|
||||
@ -683,7 +682,7 @@ void TrPageParser::LoadLocalMaterials()
|
||||
|
||||
osg_state_set->setTextureAttribute(0,osg_texenv);
|
||||
|
||||
Texture* osg_texture = GetLocalTexture(image_helper,&locmat, tex);
|
||||
Texture2D* osg_texture = GetLocalTexture(image_helper,&locmat, tex);
|
||||
|
||||
if(osg_texture)
|
||||
{
|
||||
@ -700,8 +699,8 @@ void TrPageParser::LoadLocalMaterials()
|
||||
|
||||
int wrap_s, wrap_t;
|
||||
texEnv.GetWrap(wrap_s, wrap_t);
|
||||
osg_texture->setWrap(Texture::WRAP_S, wrap_s == trpgTextureEnv::Repeat ? Texture::REPEAT: Texture::CLAMP );
|
||||
osg_texture->setWrap(Texture::WRAP_T, wrap_t == trpgTextureEnv::Repeat ? Texture::REPEAT: Texture::CLAMP );
|
||||
osg_texture->setWrap(Texture2D::WRAP_S, wrap_s == trpgTextureEnv::Repeat ? Texture2D::REPEAT: Texture2D::CLAMP );
|
||||
osg_texture->setWrap(Texture2D::WRAP_T, wrap_t == trpgTextureEnv::Repeat ? Texture2D::REPEAT: Texture2D::CLAMP );
|
||||
}
|
||||
|
||||
Material *osg_material = new Material;
|
||||
|
@ -27,7 +27,7 @@
|
||||
#include <osg/Vec2>
|
||||
#include <osg/StateSet>
|
||||
#include <osg/ref_ptr>
|
||||
#include <osg/Texture>
|
||||
#include <osg/Texture2D>
|
||||
#include <osg/Group>
|
||||
#include <osg/StateSet>
|
||||
#include <vector>
|
||||
@ -92,7 +92,7 @@ namespace txp
|
||||
std::vector<osg::ref_ptr<osg::Node> >* models;
|
||||
};
|
||||
|
||||
osg::Texture* GetLocalTexture(trpgrImageHelper& image_helper, trpgLocalMaterial* locmat, const trpgTexture* tex);
|
||||
osg::Texture2D* GetLocalTexture(trpgrImageHelper& image_helper, trpgLocalMaterial* locmat, const trpgTexture* tex);
|
||||
|
||||
//! callback functions for various scene graph elements
|
||||
class geomRead : public trpgr_Callback {
|
||||
|
@ -3,7 +3,7 @@
|
||||
#include <osgUtil/DisplayListVisitor>
|
||||
|
||||
#include <osg/Notify>
|
||||
#include <osg/Texture>
|
||||
#include <osg/TextureBase>
|
||||
#include <osg/AlphaFunc>
|
||||
#include <osg/TexEnv>
|
||||
#include <osg/ColorMatrix>
|
||||
@ -615,7 +615,7 @@ void SceneView::drawStage(osgUtil::RenderStage* renderStage)
|
||||
// context for when the object were originally created. Here we know what
|
||||
// context we are in so can flush the appropriate caches.
|
||||
osg::Drawable::flushDeletedDisplayLists(_state->getContextID());
|
||||
osg::Texture::flushDeletedTextureObjects(_state->getContextID());
|
||||
osg::TextureBase::flushDeletedTextureObjects(_state->getContextID());
|
||||
|
||||
RenderLeaf* previous = NULL;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user