diff --git a/VisualStudio/osgPlugins/ive/ive.dsp b/VisualStudio/osgPlugins/ive/ive.dsp index f67ef5cb7..13d77ef18 100755 --- a/VisualStudio/osgPlugins/ive/ive.dsp +++ b/VisualStudio/osgPlugins/ive/ive.dsp @@ -185,6 +185,10 @@ SOURCE=..\..\..\src\osgPlugins\ive\Billboard.cpp # End Source File # Begin Source File +SOURCE=..\..\..\src\osgPlugins\ive\BlendColor.cpp +# End Source File +# Begin Source File + SOURCE=..\..\..\src\osgPlugins\ive\BlendFunc.cpp # End Source File # Begin Source File @@ -545,6 +549,10 @@ SOURCE=..\..\..\src\osgPlugins\ive\Billboard.h # End Source File # Begin Source File +SOURCE=..\..\..\src\osgPlugins\ive\BlendColor.h +# End Source File +# Begin Source File + SOURCE=..\..\..\src\osgPlugins\ive\BlendFunc.h # End Source File # Begin Source File diff --git a/src/osgPlugins/ive/BlendColor.cpp b/src/osgPlugins/ive/BlendColor.cpp new file mode 100644 index 000000000..1c7d29db5 --- /dev/null +++ b/src/osgPlugins/ive/BlendColor.cpp @@ -0,0 +1,64 @@ +/********************************************************************** + * + * FILE: BlendColor.cpp + * + * DESCRIPTION: Read/Write osg::BlendColor in binary format to disk. + * + * CREATED BY: Auto generated by iveGenerated + * and later modified by Rune Schmidt Jensen. + * and then some more by Ulrich Hertlein + * + * HISTORY: Created 21.3.2003 + * + * Copyright 2003 VR-C + **********************************************************************/ + +#include "Exception.h" +#include "BlendColor.h" +#include "Object.h" + +#include +#include + +using namespace ive; + +void BlendColor::write(DataOutputStream* out) +{ + // Write BlendColor's identification. + out->writeInt(IVEBLENDCOLOR); + // If the osg class is inherited by any other class we should also write this to file. + osg::Object* obj = dynamic_cast(this); + if (obj) { + ((ive::Object*)(obj))->write(out); + } else { + throw Exception("BlendColor::write(): Could not cast this osg::BlendColor to an osg::Object."); + } + // Write BlendColor's properties. + + // Write constant color + out->writeVec4(getConstantColor()); +} + +void BlendColor::read(DataInputStream* in) +{ + // Peek on BlendColor's identification. + int id = in->peekInt(); + if (id == IVEBLENDCOLOR) { + // Read BlendColor'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(this); + if (obj) { + ((ive::Object*)(obj))->read(in); + } else { + throw Exception("BlendColor::read(): Could not cast this osg::BlendColor to an osg::Object."); + } + // Read BlendColor's properties + + // Read constant color + setConstantColor(in->readVec4()); + + } else { + throw Exception("BlendColor::read(): Expected BlendColor identification."); + } +} diff --git a/src/osgPlugins/ive/BlendColor.h b/src/osgPlugins/ive/BlendColor.h new file mode 100644 index 000000000..7315d01c9 --- /dev/null +++ b/src/osgPlugins/ive/BlendColor.h @@ -0,0 +1,15 @@ +#ifndef IVE_BLENDCOLOR +#define IVE_BLENDCOLOR 1 + +#include +#include "ReadWrite.h" + +namespace ive{ + class BlendColor : public osg::BlendColor, public ReadWrite { + public: + void write(DataOutputStream* out); + void read(DataInputStream* in); + }; +} + +#endif diff --git a/src/osgPlugins/ive/DataInputStream.cpp b/src/osgPlugins/ive/DataInputStream.cpp index f8e0c5943..9045e7992 100644 --- a/src/osgPlugins/ive/DataInputStream.cpp +++ b/src/osgPlugins/ive/DataInputStream.cpp @@ -18,6 +18,7 @@ #include "DataInputStream.h" #include "StateSet.h" #include "AlphaFunc.h" +#include "BlendColor.h" #include "BlendFunc.h" #include "Depth.h" #include "Material.h" @@ -967,6 +968,10 @@ osg::StateAttribute* DataInputStream::readStateAttribute() attribute = new osg::AlphaFunc(); ((ive::AlphaFunc*)(attribute))->read(this); } + else if(attributeID == IVEBLENDCOLOR){ + attribute = new osg::BlendColor(); + ((ive::BlendColor*)(attribute))->read(this); + } else if(attributeID == IVEBLENDFUNC || attributeID == IVEBLENDFUNCSEPARATE){ attribute = new osg::BlendFunc(); diff --git a/src/osgPlugins/ive/DataOutputStream.cpp b/src/osgPlugins/ive/DataOutputStream.cpp index 603529957..b9826dd71 100644 --- a/src/osgPlugins/ive/DataOutputStream.cpp +++ b/src/osgPlugins/ive/DataOutputStream.cpp @@ -9,7 +9,7 @@ * * HISTORY: Created 11.03.2003 * Updated for 1D textures - Don Burns 27.1.2004 - * Updated for light model - Stan Blinov at 25 august 7512 from World Creation (7.09.2004) + * Updated for light model - Stan Blinov at 25 august 7512 from World Creation (7.09.2004) * * Copyright 2003 VR-C **********************************************************************/ @@ -19,6 +19,7 @@ #include "StateSet.h" #include "AlphaFunc.h" +#include "BlendColor.h" #include "BlendFunc.h" #include "Material.h" #include "CullFace.h" @@ -654,6 +655,9 @@ void DataOutputStream::writeStateAttribute(const osg::StateAttribute* attribute) if(dynamic_cast(attribute)){ ((ive::AlphaFunc*)(attribute))->write(this); } + else if(dynamic_cast(attribute)){ + ((ive::BlendColor*)(attribute))->write(this); + } else if(dynamic_cast(attribute)){ ((ive::BlendFunc*)(attribute))->write(this); } diff --git a/src/osgPlugins/ive/GNUmakefile b/src/osgPlugins/ive/GNUmakefile index 9f6338092..393699cc6 100644 --- a/src/osgPlugins/ive/GNUmakefile +++ b/src/osgPlugins/ive/GNUmakefile @@ -10,6 +10,7 @@ CXXFILES =\ AutoTransform.cpp\ Billboard.cpp\ BlendFunc.cpp\ + BlendColor.cpp\ BlinkSequence.cpp\ ClipNode.cpp\ ClipPlane.cpp\ diff --git a/src/osgPlugins/ive/ReadWrite.h b/src/osgPlugins/ive/ReadWrite.h index 9a7e14386..876aefb95 100644 --- a/src/osgPlugins/ive/ReadWrite.h +++ b/src/osgPlugins/ive/ReadWrite.h @@ -48,6 +48,7 @@ namespace ive { #define IVEALPHAFUNC 0x00000101 #define IVEBLENDFUNC 0x00000102 #define IVEBLENDFUNCSEPARATE 0x00000103 +#define IVEBLENDCOLOR 0x00000105 #define IVEMATERIAL 0x00000110 #define IVETEXTURE 0x00000120 #define IVETEXTURE1D 0x00000121