Added support for TexMat to .ive plugin
This commit is contained in:
@@ -270,6 +270,10 @@ SOURCE=..\..\..\src\osgPlugins\ive\TexGen.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\..\src\osgPlugins\ive\TexMat.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\..\src\osgPlugins\ive\Texture.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
@@ -498,6 +502,10 @@ SOURCE=..\..\..\src\osgPlugins\ive\TexGen.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\..\src\osgPlugins\ive\TexMat.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\..\src\osgPlugins\ive\Texture.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
@@ -25,6 +25,7 @@
|
||||
#include "TexEnv.h"
|
||||
#include "TexEnvCombine.h"
|
||||
#include "TexGen.h"
|
||||
#include "TexMat.h"
|
||||
|
||||
#include "Group.h"
|
||||
#include "MatrixTransform.h"
|
||||
@@ -570,6 +571,10 @@ osg::StateAttribute* DataInputStream::readStateAttribute()
|
||||
attribute = new osg::TexGen();
|
||||
((ive::TexGen*)(attribute))->read(this);
|
||||
}
|
||||
else if(attributeID == IVETEXMAT){
|
||||
attribute = new osg::TexMat();
|
||||
((ive::TexMat*)(attribute))->read(this);
|
||||
}
|
||||
else{
|
||||
throw Exception("Unkown StateAttribute in StateSet::read()");
|
||||
}
|
||||
|
||||
@@ -27,6 +27,7 @@
|
||||
#include "TexEnv.h"
|
||||
#include "TexEnvCombine.h"
|
||||
#include "TexGen.h"
|
||||
#include "TexMat.h"
|
||||
|
||||
#include "Group.h"
|
||||
#include "MatrixTransform.h"
|
||||
@@ -440,6 +441,10 @@ void DataOutputStream::writeStateAttribute(const osg::StateAttribute* attribute)
|
||||
else if(dynamic_cast<const osg::TexGen*>(attribute)){
|
||||
((ive::TexGen*)(attribute))->write(this);
|
||||
}
|
||||
// This is a TexMat
|
||||
else if(dynamic_cast<const osg::TexMat*>(attribute)){
|
||||
((ive::TexMat*)(attribute))->write(this);
|
||||
}
|
||||
else{
|
||||
std::string className = attribute->className();
|
||||
throw Exception(std::string("StateSet::write(): Unknown StateAttribute: ").append(className));
|
||||
|
||||
@@ -45,6 +45,7 @@ CXXFILES =\
|
||||
TexEnv.cpp\
|
||||
TexEnvCombine.cpp\
|
||||
TexGen.cpp\
|
||||
TexMat.cpp\
|
||||
Texture.cpp\
|
||||
Texture2D.cpp\
|
||||
TextureCubeMap.cpp\
|
||||
|
||||
@@ -39,19 +39,20 @@ namespace ive {
|
||||
#define IVESTATEATTRIBUTE 0x00000100
|
||||
#define IVEALPHAFUNC 0x00000101
|
||||
#define IVEBLENDFUNC 0x00000102
|
||||
#define IVEMATERIAL 0x00000110
|
||||
#define IVETEXTURE 0x00000120
|
||||
#define IVEMATERIAL 0x00000110
|
||||
#define IVETEXTURE 0x00000120
|
||||
#define IVETEXTURE1D 0x00000121
|
||||
#define IVETEXTURE2D 0x00000122
|
||||
#define IVETEXTURE3D 0x00000123
|
||||
#define IVETEXTURECUBEMAP 0x00000124
|
||||
#define IVETEXENV 0x00000125
|
||||
#define IVETEXENV 0x00000125
|
||||
#define IVETEXENVCOMBINE 0x00000126
|
||||
#define IVETEXGEN 0x00000127
|
||||
#define IVECULLFACE 0x00000128
|
||||
#define IVETEXGEN 0x00000127
|
||||
#define IVECULLFACE 0x00000128
|
||||
#define IVEPOLYGONOFFSET 0x00000129
|
||||
#define IVESHADEMODEL 0x0000012A
|
||||
#define IVEPOINT 0x0000012B
|
||||
#define IVEPOINT 0x0000012B
|
||||
#define IVETEXMAT 0x0000012C
|
||||
|
||||
// Drawables
|
||||
#define IVEDRAWABLE 0x00001000
|
||||
|
||||
59
src/osgPlugins/ive/TexMat.cpp
Normal file
59
src/osgPlugins/ive/TexMat.cpp
Normal file
@@ -0,0 +1,59 @@
|
||||
/**********************************************************************
|
||||
*
|
||||
* FILE: TexMat.cpp
|
||||
*
|
||||
* DESCRIPTION: Read/Write osg::TexMat in binary format to disk.
|
||||
*
|
||||
* CREATED BY: Auto generated by iveGenerated
|
||||
* and later modified by Rune Schmidt Jensen.
|
||||
*
|
||||
* HISTORY: Created 21.3.2003
|
||||
*
|
||||
* Copyright 2003 VR-C
|
||||
**********************************************************************/
|
||||
|
||||
#include "Exception.h"
|
||||
#include "TexMat.h"
|
||||
#include "Object.h"
|
||||
|
||||
using namespace ive;
|
||||
|
||||
void TexMat::write(DataOutputStream* out){
|
||||
// Write TexMat's identification.
|
||||
out->writeInt(IVETEXMAT);
|
||||
// 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("TexMat::write(): Could not cast this osg::TexMat to an osg::Object.");
|
||||
// Write TexMat's properties.
|
||||
|
||||
// Write mode
|
||||
out->writeMatrix(getMatrix());
|
||||
}
|
||||
|
||||
void TexMat::read(DataInputStream* in){
|
||||
// Peek on TexMat's identification.
|
||||
int id = in->peekInt();
|
||||
if(id == IVETEXMAT){
|
||||
// Read TexMat'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("TexMat::read(): Could not cast this osg::TexMat to an osg::Object.");
|
||||
// Read TexMat's properties
|
||||
|
||||
// Read matrix
|
||||
setMatrix(in->readMatrix());
|
||||
|
||||
}
|
||||
else{
|
||||
throw Exception("TexMat::read(): Expected TexMat identification.");
|
||||
}
|
||||
}
|
||||
15
src/osgPlugins/ive/TexMat.h
Normal file
15
src/osgPlugins/ive/TexMat.h
Normal file
@@ -0,0 +1,15 @@
|
||||
#ifndef IVE_TEXMAT
|
||||
#define IVE_TEXMAT 1
|
||||
|
||||
#include <osg/TexMat>
|
||||
#include "ReadWrite.h"
|
||||
|
||||
namespace ive{
|
||||
class TexMat : public osg::TexMat, public ReadWrite {
|
||||
public:
|
||||
void write(DataOutputStream* out);
|
||||
void read(DataInputStream* in);
|
||||
};
|
||||
}
|
||||
|
||||
#endif
|
||||
Reference in New Issue
Block a user