Added .ive support for BlendEquation

This commit is contained in:
Robert Osfield 2008-08-18 15:06:41 +00:00
parent 4adb68c802
commit 8303f03b24
6 changed files with 87 additions and 0 deletions

View File

@ -0,0 +1,61 @@
/**********************************************************************
*
* FILE: BlendEquation.cpp
*
* DESCRIPTION: Read/Write osg::BlendEquation 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 "BlendEquation.h"
#include "Object.h"
using namespace ive;
void BlendEquation::write(DataOutputStream* out){
// Write BlendEquation's identification.
out->writeInt(IVEBLENDEQUATION);
// 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("BlendEquation::write(): Could not cast this osg::BlendEquation to an osg::Object.");
// Write BlendEquation's properties.
// Write source
out->writeInt(getEquation());
}
void BlendEquation::read(DataInputStream* in){
// Peek on BlendEquation's identification.
int id = in->peekInt();
if(id == IVEBLENDEQUATION){
// Read BlendEquation'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("BlendEquation::read(): Could not cast this osg::BlendEquation to an osg::Object.");
// Read BlendEquation's properties
// Read source
setEquation(osg::BlendEquation::Equation(in->readInt()));
}
else{
throw Exception("BlendEquation::read(): Expected BlendEquation identification.");
}
}

View File

@ -0,0 +1,15 @@
#ifndef IVE_BLENDEQUATION
#define IVE_BLENDEQUATION 1
#include <osg/BlendEquation>
#include "ReadWrite.h"
namespace ive{
class BlendEquation : public osg::BlendEquation, public ReadWrite {
public:
void write(DataOutputStream* out);
void read(DataInputStream* in);
};
}
#endif

View File

@ -10,6 +10,7 @@ SET(TARGET_SRC
AzimSector.cpp
Billboard.cpp
BlendColor.cpp
BlendEquation.cpp
BlendFunc.cpp
BlinkSequence.cpp
Camera.cpp

View File

@ -21,6 +21,7 @@
#include "BlendColor.h"
#include "Stencil.h"
#include "BlendFunc.h"
#include "BlendEquation.h"
#include "Depth.h"
#include "Material.h"
#include "CullFace.h"
@ -1097,6 +1098,10 @@ osg::StateAttribute* DataInputStream::readStateAttribute()
attribute = new osg::BlendFunc();
((ive::BlendFunc*)(attribute))->read(this);
}
else if(attributeID == IVEBLENDEQUATION){
attribute = new osg::BlendEquation();
((ive::BlendEquation*)(attribute))->read(this);
}
else if(attributeID == IVEDEPTH){
attribute = new osg::Depth();
((ive::Depth*)(attribute))->read(this);

View File

@ -22,6 +22,7 @@
#include "BlendColor.h"
#include "Stencil.h"
#include "BlendFunc.h"
#include "BlendEquation.h"
#include "Material.h"
#include "CullFace.h"
#include "ColorMask.h"
@ -723,6 +724,9 @@ void DataOutputStream::writeStateAttribute(const osg::StateAttribute* attribute)
else if(dynamic_cast<const osg::BlendFunc*>(attribute)){
((ive::BlendFunc*)(attribute))->write(this);
}
else if(dynamic_cast<const osg::BlendEquation*>(attribute)){
((ive::BlendEquation*)(attribute))->write(this);
}
else if(dynamic_cast<const osg::Depth*>(attribute)){
((ive::Depth*)(attribute))->write(this);
}

View File

@ -72,6 +72,7 @@ namespace ive {
#define IVESTENCIL 0x00000131
#define IVESTENCILTWOSIDED 0x00000132
#define IVECOLORMASK 0x00000133
#define IVEBLENDEQUATION 0x00000134
#define IVELIGHTMODEL 0x00001121
#define IVECLIPPLANE 0x00001122
#define IVEFRONTFACE 0x00001123