From Farshid Laskari, addiition of FrontFace support to .ive

This commit is contained in:
Robert Osfield
2005-03-26 10:04:31 +00:00
parent 0123cdbe8f
commit e4580f2028
7 changed files with 96 additions and 4 deletions

View File

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

View 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()");
}

View File

@@ -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();

View 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.");
}
}

View 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

View File

@@ -32,6 +32,7 @@ CXXFILES =\
EllipsoidModel.cpp\
Exception.cpp\
FragmentProgram.cpp\
FrontFace.cpp\
Geode.cpp\
Geometry.cpp\
Group.cpp\

View File

@@ -63,6 +63,7 @@ namespace ive {
#define IVEVERTEXPROGRAM 0x0000012F
#define IVELIGHTMODEL 0x00001121
#define IVECLIPPLANE 0x00001122
#define IVEFRONTFACE 0x00001123
// Drawables
#define IVEDRAWABLE 0x00001000