From Ulrich Hertlein, added support for osg::BlendColor to .ive format.
This commit is contained in:
@@ -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
|
||||
|
||||
64
src/osgPlugins/ive/BlendColor.cpp
Normal file
64
src/osgPlugins/ive/BlendColor.cpp
Normal file
@@ -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 <osg/Notify>
|
||||
#include <iostream>
|
||||
|
||||
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<osg::Object*>(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<osg::Object*>(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.");
|
||||
}
|
||||
}
|
||||
15
src/osgPlugins/ive/BlendColor.h
Normal file
15
src/osgPlugins/ive/BlendColor.h
Normal file
@@ -0,0 +1,15 @@
|
||||
#ifndef IVE_BLENDCOLOR
|
||||
#define IVE_BLENDCOLOR 1
|
||||
|
||||
#include <osg/BlendColor>
|
||||
#include "ReadWrite.h"
|
||||
|
||||
namespace ive{
|
||||
class BlendColor : public osg::BlendColor, public ReadWrite {
|
||||
public:
|
||||
void write(DataOutputStream* out);
|
||||
void read(DataInputStream* in);
|
||||
};
|
||||
}
|
||||
|
||||
#endif
|
||||
@@ -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();
|
||||
|
||||
@@ -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<const osg::AlphaFunc*>(attribute)){
|
||||
((ive::AlphaFunc*)(attribute))->write(this);
|
||||
}
|
||||
else if(dynamic_cast<const osg::BlendColor*>(attribute)){
|
||||
((ive::BlendColor*)(attribute))->write(this);
|
||||
}
|
||||
else if(dynamic_cast<const osg::BlendFunc*>(attribute)){
|
||||
((ive::BlendFunc*)(attribute))->write(this);
|
||||
}
|
||||
|
||||
@@ -10,6 +10,7 @@ CXXFILES =\
|
||||
AutoTransform.cpp\
|
||||
Billboard.cpp\
|
||||
BlendFunc.cpp\
|
||||
BlendColor.cpp\
|
||||
BlinkSequence.cpp\
|
||||
ClipNode.cpp\
|
||||
ClipPlane.cpp\
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user