From Farshid Laskari, addiition of FrontFace support to .ive
This commit is contained in:
@@ -216,6 +216,10 @@ SOURCE=..\..\..\src\osgPlugins\ive\FragmentProgram.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\..\src\osgPlugins\ive\FrontFace.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\..\src\osgPlugins\ive\Geode.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
@@ -524,6 +528,10 @@ SOURCE=..\..\..\src\osgPlugins\ive\FragmentProgram.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\..\src\osgPlugins\ive\FrontFace.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\..\src\osgPlugins\ive\Geode.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
@@ -38,6 +38,7 @@
|
||||
#include "VertexProgram.h"
|
||||
#include "LightModel.h"
|
||||
#include "ProxyNode.h"
|
||||
#include "FrontFace.h"
|
||||
|
||||
#include "Group.h"
|
||||
#include "MatrixTransform.h"
|
||||
@@ -745,12 +746,14 @@ osg::StateAttribute* DataInputStream::readStateAttribute()
|
||||
attribute = new osg::VertexProgram();
|
||||
((ive::VertexProgram*)(attribute))->read(this);
|
||||
}
|
||||
|
||||
else if(attributeID == IVELIGHTMODEL){
|
||||
attribute = new osg::LightModel();
|
||||
((ive::LightModel*)(attribute))->read(this);
|
||||
}
|
||||
|
||||
else if(attributeID == IVEFRONTFACE){
|
||||
attribute = new osg::FrontFace();
|
||||
((ive::FrontFace*)(attribute))->read(this);
|
||||
}
|
||||
else{
|
||||
throw Exception("Unknown StateAttribute in StateSet::read()");
|
||||
}
|
||||
|
||||
@@ -39,7 +39,7 @@
|
||||
#include "VertexProgram.h"
|
||||
#include "LightModel.h"
|
||||
#include "ProxyNode.h"
|
||||
|
||||
#include "FrontFace.h"
|
||||
|
||||
#include "Group.h"
|
||||
#include "MatrixTransform.h"
|
||||
@@ -561,11 +561,14 @@ void DataOutputStream::writeStateAttribute(const osg::StateAttribute* attribute)
|
||||
else if(dynamic_cast<const osg::VertexProgram*>(attribute)){
|
||||
((ive::VertexProgram*)(attribute))->write(this);
|
||||
}
|
||||
|
||||
// This is a LightModel
|
||||
else if(dynamic_cast<const osg::LightModel*>(attribute)){
|
||||
((ive::LightModel*)(attribute))->write(this);
|
||||
}
|
||||
// This is a FrontFace
|
||||
else if(dynamic_cast<const osg::FrontFace*>(attribute)){
|
||||
((ive::FrontFace*)(attribute))->write(this);
|
||||
}
|
||||
|
||||
else{
|
||||
std::string className = attribute->className();
|
||||
|
||||
60
src/osgPlugins/ive/FrontFace.cpp
Normal file
60
src/osgPlugins/ive/FrontFace.cpp
Normal file
@@ -0,0 +1,60 @@
|
||||
/**********************************************************************
|
||||
*
|
||||
* FILE: FrontFace.cpp
|
||||
*
|
||||
* DESCRIPTION: Read/Write osg::FrontFace 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 "FrontFace.h"
|
||||
#include "Object.h"
|
||||
|
||||
using namespace ive;
|
||||
|
||||
void FrontFace::write(DataOutputStream* out){
|
||||
// Write FrontFace's identification.
|
||||
out->writeInt(IVEFRONTFACE);
|
||||
// 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("FrontFace::write(): Could not cast this osg::FrontFace to an osg::Object.");
|
||||
// Write FrontFace's properties.
|
||||
|
||||
// Write mode
|
||||
out->writeInt(getMode());
|
||||
}
|
||||
|
||||
void FrontFace::read(DataInputStream* in){
|
||||
// Peek on FrontFace's identification.
|
||||
int id = in->peekInt();
|
||||
if(id == IVEFRONTFACE){
|
||||
// Read FrontFace'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("FrontFace::read(): Could not cast this osg::FrontFace to an osg::Object.");
|
||||
// Read FrontFace's properties
|
||||
|
||||
// Read mode
|
||||
setMode((osg::FrontFace::Mode)in->readInt());
|
||||
|
||||
}
|
||||
else{
|
||||
throw Exception("FrontFace::read(): Expected FrontFace identification.");
|
||||
}
|
||||
}
|
||||
|
||||
16
src/osgPlugins/ive/FrontFace.h
Normal file
16
src/osgPlugins/ive/FrontFace.h
Normal file
@@ -0,0 +1,16 @@
|
||||
#ifndef IVE_FRONTFACE
|
||||
#define IVE_FRONTFACE 1
|
||||
|
||||
#include <osg/FrontFace>
|
||||
#include "ReadWrite.h"
|
||||
|
||||
namespace ive{
|
||||
class FrontFace : public osg::FrontFace, public ReadWrite {
|
||||
public:
|
||||
void write(DataOutputStream* out);
|
||||
void read(DataInputStream* in);
|
||||
};
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
@@ -32,6 +32,7 @@ CXXFILES =\
|
||||
EllipsoidModel.cpp\
|
||||
Exception.cpp\
|
||||
FragmentProgram.cpp\
|
||||
FrontFace.cpp\
|
||||
Geode.cpp\
|
||||
Geometry.cpp\
|
||||
Group.cpp\
|
||||
|
||||
@@ -63,6 +63,7 @@ namespace ive {
|
||||
#define IVEVERTEXPROGRAM 0x0000012F
|
||||
#define IVELIGHTMODEL 0x00001121
|
||||
#define IVECLIPPLANE 0x00001122
|
||||
#define IVEFRONTFACE 0x00001123
|
||||
|
||||
// Drawables
|
||||
#define IVEDRAWABLE 0x00001000
|
||||
|
||||
Reference in New Issue
Block a user