Forom yne Schmidt Jansen, added support for osgSim into ive plugin.
This commit is contained in:
parent
a54537558c
commit
81fbb26d62
@ -272,6 +272,34 @@ SOURCE=..\..\..\src\osgPlugins\ive\TextureCubeMap.cpp
|
||||
|
||||
SOURCE=..\..\..\src\osgPlugins\ive\Transform.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\..\src\osgPlugins\ive\AzimElevationSector.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\..\src\osgPlugins\ive\AzimSector.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\..\src\osgPlugins\ive\BlinkSequence.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\..\src\osgPlugins\ive\ConeSector.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\..\src\osgPlugins\ive\ElevationSector.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\..\src\osgPlugins\ive\LightPoint.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\..\src\osgPlugins\ive\LightPointNode.cpp
|
||||
# End Source File
|
||||
# End Group
|
||||
# Begin Group "Header Files"
|
||||
|
||||
@ -460,6 +488,34 @@ SOURCE=..\..\..\src\osgPlugins\ive\TextureCubeMap.h
|
||||
|
||||
SOURCE=..\..\..\src\osgPlugins\ive\Transform.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\..\src\osgPlugins\ive\AzimElevationSector.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\..\src\osgPlugins\ive\AzimSector.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\..\src\osgPlugins\ive\BlinkSequence.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\..\src\osgPlugins\ive\ConeSector.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\..\src\osgPlugins\ive\ElevationSector.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\..\src\osgPlugins\ive\LightPoint.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\..\src\osgPlugins\ive\LightPointNode.h
|
||||
# End Source File
|
||||
# End Group
|
||||
# Begin Group "Resource Files"
|
||||
|
||||
|
54
src/osgPlugins/ive/AzimElevationSector.cpp
Normal file
54
src/osgPlugins/ive/AzimElevationSector.cpp
Normal file
@ -0,0 +1,54 @@
|
||||
/**********************************************************************
|
||||
*
|
||||
* FILE: AzimElevationSector.cpp
|
||||
*
|
||||
* DESCRIPTION: Read/Write osgSim::AzimElevationSector in binary format to disk.
|
||||
*
|
||||
* CREATED BY: Auto generated by iveGenerator.exe
|
||||
* and later modified by Rune Schmidt Jensen.
|
||||
*
|
||||
* HISTORY: Created 9.9.2003
|
||||
*
|
||||
**********************************************************************/
|
||||
|
||||
#include "Exception.h"
|
||||
#include "AzimElevationSector.h"
|
||||
|
||||
using namespace ive;
|
||||
|
||||
void AzimElevationSector::write(DataOutputStream* out){
|
||||
// Write AzimElevationSector's identification.
|
||||
out->writeInt(IVEAZIMELEVATIONSECTOR);
|
||||
// Write AzimElevationSector's properties.
|
||||
out->writeFloat(getMinElevation());
|
||||
out->writeFloat(getMaxElevation());
|
||||
out->writeFloat(getFadeAngle());
|
||||
|
||||
float minAzimuth, maxAzimuth, fadeAngle;
|
||||
getAzimuthRange(minAzimuth, maxAzimuth, fadeAngle);
|
||||
out->writeFloat(minAzimuth);
|
||||
out->writeFloat(maxAzimuth);
|
||||
out->writeFloat(fadeAngle);
|
||||
}
|
||||
|
||||
void AzimElevationSector::read(DataInputStream* in){
|
||||
// Peek on AzimElevationSector's identification.
|
||||
int id = in->peekInt();
|
||||
if(id == IVEAZIMELEVATIONSECTOR){
|
||||
// Read AzimElevationSector's identification.
|
||||
id = in->readInt();
|
||||
// Read AzimElevationSector's properties
|
||||
float minElevation = in->readFloat();
|
||||
float maxElevation = in->readFloat();
|
||||
float fadeAngle = in->readFloat();
|
||||
setElevationRange(minElevation, maxElevation, fadeAngle);
|
||||
|
||||
float minAzimuth = in->readFloat();
|
||||
float maxAzimuth = in->readFloat();
|
||||
fadeAngle = in->readFloat();
|
||||
setAzimuthRange(minAzimuth, maxAzimuth, fadeAngle);
|
||||
}
|
||||
else{
|
||||
throw Exception("AzimElevationSector::read(): Expected AzimElevationSector identification.");
|
||||
}
|
||||
}
|
15
src/osgPlugins/ive/AzimElevationSector.h
Normal file
15
src/osgPlugins/ive/AzimElevationSector.h
Normal file
@ -0,0 +1,15 @@
|
||||
#ifndef IVE_AZIMELEVATIONSECTOR
|
||||
#define IVE_AZIMELEVATIONSECTOR 1
|
||||
|
||||
#include <osgSim/Sector>
|
||||
#include "ReadWrite.h"
|
||||
|
||||
namespace ive{
|
||||
class AzimElevationSector : public osgSim::AzimElevationSector, public ReadWrite {
|
||||
public:
|
||||
void write(DataOutputStream* out);
|
||||
void read(DataInputStream* in);
|
||||
};
|
||||
}
|
||||
|
||||
#endif
|
45
src/osgPlugins/ive/AzimSector.cpp
Normal file
45
src/osgPlugins/ive/AzimSector.cpp
Normal file
@ -0,0 +1,45 @@
|
||||
/**********************************************************************
|
||||
*
|
||||
* FILE: AzimSector.cpp
|
||||
*
|
||||
* DESCRIPTION: Read/Write osgSim::AzimSector in binary format to disk.
|
||||
*
|
||||
* CREATED BY: Auto generated by iveGenerator.exe
|
||||
* and later modified by Rune Schmidt Jensen.
|
||||
*
|
||||
* HISTORY: Created 9.9.2003
|
||||
*
|
||||
**********************************************************************/
|
||||
|
||||
#include "Exception.h"
|
||||
#include "AzimSector.h"
|
||||
|
||||
using namespace ive;
|
||||
|
||||
void AzimSector::write(DataOutputStream* out){
|
||||
// Write AzimSector's identification.
|
||||
out->writeInt(IVEAZIMSECTOR);
|
||||
// Write AzimSector's properties.
|
||||
float minAzimuth, maxAzimuth, fadeAngle;
|
||||
getAzimuthRange(minAzimuth, maxAzimuth, fadeAngle);
|
||||
out->writeFloat(minAzimuth);
|
||||
out->writeFloat(maxAzimuth);
|
||||
out->writeFloat(fadeAngle);
|
||||
}
|
||||
|
||||
void AzimSector::read(DataInputStream* in){
|
||||
// Peek on AzimSector's identification.
|
||||
int id = in->peekInt();
|
||||
if(id == IVEAZIMSECTOR){
|
||||
// Read AzimSector's identification.
|
||||
id = in->readInt();
|
||||
// Read AzimSector's properties
|
||||
float minAzimuth = in->readFloat();
|
||||
float maxAzimuth = in->readFloat();
|
||||
float fadeAngle = in->readFloat();
|
||||
setAzimuthRange(minAzimuth, maxAzimuth, fadeAngle);
|
||||
}
|
||||
else{
|
||||
throw Exception("AzimSector::read(): Expected AzimSector identification.");
|
||||
}
|
||||
}
|
15
src/osgPlugins/ive/AzimSector.h
Normal file
15
src/osgPlugins/ive/AzimSector.h
Normal file
@ -0,0 +1,15 @@
|
||||
#ifndef IVE_AZIMSECTOR
|
||||
#define IVE_AZIMSECTOR 1
|
||||
|
||||
#include <osgSim/Sector>
|
||||
#include "ReadWrite.h"
|
||||
|
||||
namespace ive{
|
||||
class AzimSector : public osgSim::AzimSector, public ReadWrite {
|
||||
public:
|
||||
void write(DataOutputStream* out);
|
||||
void read(DataInputStream* in);
|
||||
};
|
||||
}
|
||||
|
||||
#endif
|
81
src/osgPlugins/ive/BlinkSequence.cpp
Normal file
81
src/osgPlugins/ive/BlinkSequence.cpp
Normal file
@ -0,0 +1,81 @@
|
||||
/**********************************************************************
|
||||
*
|
||||
* FILE: BlinkSequence.cpp
|
||||
*
|
||||
* DESCRIPTION: Read/Write osgSim::BlinkSequence in binary format to disk.
|
||||
*
|
||||
* CREATED BY: Auto generated by iveGenerator
|
||||
* and later modified by Rune Schmidt Jensen.
|
||||
*
|
||||
* HISTORY: Created 5.9.2003
|
||||
*
|
||||
**********************************************************************/
|
||||
|
||||
#include "Exception.h"
|
||||
#include "BlinkSequence.h"
|
||||
#include "Object.h"
|
||||
|
||||
using namespace ive;
|
||||
|
||||
void BlinkSequence::write(DataOutputStream* out){
|
||||
// Write BlinkSequence's identification.
|
||||
out->writeInt(IVEBLINKSEQUENCE);
|
||||
// If the osgSim 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("BlinkSequence::write(): Could not cast this osgSim::BlinkSequence to an osg::Object.");
|
||||
|
||||
// Write BlinkSequence's properties.
|
||||
|
||||
// Write out pulse data.
|
||||
unsigned int size = getNumPulses();
|
||||
out->writeInt(size);
|
||||
for(unsigned int i=0; i<size; i++){
|
||||
double length;
|
||||
osg::Vec4 color;
|
||||
getPulse(i, length, color);
|
||||
out->writeDouble(length);
|
||||
out->writeVec4(color);
|
||||
}
|
||||
// Write out phase shift.
|
||||
out->writeDouble(getPhaseShift());
|
||||
// Write out SequenceGroup.
|
||||
out->writeDouble(getSequenceGroup()->_baseTime);
|
||||
|
||||
}
|
||||
|
||||
void BlinkSequence::read(DataInputStream* in){
|
||||
// Peek on BlinkSequence's identification.
|
||||
int id = in->peekInt();
|
||||
if(id == IVEBLINKSEQUENCE){
|
||||
// Read BlinkSequence's identification.
|
||||
id = in->readInt();
|
||||
// If the osgSim 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("BlinkSequence::read(): Could not cast this osgSim::BlinkSequence to an osg::Object.");
|
||||
// Read BlinkSequence's properties
|
||||
|
||||
// Read in pulse data.
|
||||
unsigned int size = in->readInt();
|
||||
for(unsigned int i=0; i<size; i++){
|
||||
double length = in->readDouble();
|
||||
osg::Vec4 color = in->readVec4();
|
||||
addPulse(length,color);
|
||||
}
|
||||
// Read in phase shift.
|
||||
setPhaseShift(in->readDouble());
|
||||
// Read in SequenceGroup
|
||||
setSequenceGroup(new SequenceGroup(in->readDouble()));
|
||||
|
||||
}
|
||||
else{
|
||||
throw Exception("BlinkSequence::read(): Expected BlinkSequence identification.");
|
||||
}
|
||||
}
|
15
src/osgPlugins/ive/BlinkSequence.h
Normal file
15
src/osgPlugins/ive/BlinkSequence.h
Normal file
@ -0,0 +1,15 @@
|
||||
#ifndef IVE_BLINKSEQUENCE
|
||||
#define IVE_BLINKSEQUENCE 1
|
||||
|
||||
#include <osgSim/BlinkSequence>
|
||||
#include "ReadWrite.h"
|
||||
|
||||
namespace ive{
|
||||
class BlinkSequence : public osgSim::BlinkSequence, public ReadWrite {
|
||||
public:
|
||||
void write(DataOutputStream* out);
|
||||
void read(DataInputStream* in);
|
||||
};
|
||||
}
|
||||
|
||||
#endif
|
43
src/osgPlugins/ive/ConeSector.cpp
Normal file
43
src/osgPlugins/ive/ConeSector.cpp
Normal file
@ -0,0 +1,43 @@
|
||||
/**********************************************************************
|
||||
*
|
||||
* FILE: ConeSector.cpp
|
||||
*
|
||||
* DESCRIPTION: Read/Write osgSim::ConeSector in binary format to disk.
|
||||
*
|
||||
* CREATED BY: Auto generated by iveGenerator.exe
|
||||
* and later modified by Rune Schmidt Jensen.
|
||||
*
|
||||
* HISTORY: Created 9.9.2003
|
||||
*
|
||||
**********************************************************************/
|
||||
|
||||
#include "Exception.h"
|
||||
#include "ConeSector.h"
|
||||
|
||||
using namespace ive;
|
||||
|
||||
void ConeSector::write(DataOutputStream* out){
|
||||
// Write ConeSector's identification.
|
||||
out->writeInt(IVECONESECTOR);
|
||||
// Write ConeSector's properties.
|
||||
out->writeVec3(getAxis());
|
||||
out->writeFloat(getAngle());
|
||||
out->writeFloat(getFadeAngle());
|
||||
}
|
||||
|
||||
void ConeSector::read(DataInputStream* in){
|
||||
// Peek on ConeSector's identification.
|
||||
int id = in->peekInt();
|
||||
if(id == IVECONESECTOR){
|
||||
// Read ConeSector's identification.
|
||||
id = in->readInt();
|
||||
// Read ConeSector's properties
|
||||
setAxis(in->readVec3());
|
||||
float angle = in->readFloat();
|
||||
float fadeangle = in->readFloat();;
|
||||
setAngle(angle, fadeangle);
|
||||
}
|
||||
else{
|
||||
throw Exception("ConeSector::read(): Expected ConeSector identification.");
|
||||
}
|
||||
}
|
15
src/osgPlugins/ive/ConeSector.h
Normal file
15
src/osgPlugins/ive/ConeSector.h
Normal file
@ -0,0 +1,15 @@
|
||||
#ifndef IVE_CONESECTOR
|
||||
#define IVE_CONESECTOR 1
|
||||
|
||||
#include <osgSim/Sector>
|
||||
#include "ReadWrite.h"
|
||||
|
||||
namespace ive{
|
||||
class ConeSector : public osgSim::ConeSector, public ReadWrite {
|
||||
public:
|
||||
void write(DataOutputStream* out);
|
||||
void read(DataInputStream* in);
|
||||
};
|
||||
}
|
||||
|
||||
#endif
|
@ -34,12 +34,12 @@
|
||||
#include "Sequence.h"
|
||||
#include "LOD.h"
|
||||
#include "PagedLOD.h"
|
||||
//#include "ViewPoint.h"
|
||||
#include "PositionAttitudeTransform.h"
|
||||
#include "Transform.h"
|
||||
#include "Switch.h"
|
||||
#include "OccluderNode.h"
|
||||
#include "Impostor.h"
|
||||
#include "LightPointNode.h"
|
||||
|
||||
#include "Geometry.h"
|
||||
|
||||
@ -604,10 +604,6 @@ osg::Node* DataInputStream::readNode()
|
||||
node = new osg::MatrixTransform();
|
||||
((ive::MatrixTransform*)(node))->read(this);
|
||||
}
|
||||
// else if(nodeTypeID== IVEVIEWPOINT){
|
||||
// node = new osgfIVE::ViewPoint();
|
||||
// ((ive::ViewPoint*)(node))->read(this);
|
||||
// }
|
||||
else if(nodeTypeID== IVEPOSITIONATTITUDETRANSFORM){
|
||||
node = new osg::PositionAttitudeTransform();
|
||||
((ive::PositionAttitudeTransform*)(node))->read(this);
|
||||
@ -656,11 +652,15 @@ osg::Node* DataInputStream::readNode()
|
||||
node = new osg::Geode();
|
||||
((ive::Geode*)(node))->read(this);
|
||||
}
|
||||
else if(nodeTypeID== IVELIGHTPOINTNODE){
|
||||
node = new osgSim::LightPointNode();
|
||||
((ive::LightPointNode*)(node))->read(this);
|
||||
}
|
||||
else{
|
||||
throw Exception("Unknown node identification in DataInputStream::readNode()");
|
||||
}
|
||||
|
||||
// and add it to the stateattribute map,
|
||||
// and add it to the node map,
|
||||
_nodeMap[id] = node;
|
||||
|
||||
|
||||
|
@ -1,11 +1,11 @@
|
||||
/**********************************************************************
|
||||
*
|
||||
* FILE: DataOutputStream.cpp
|
||||
* FILE: DataOutputStream.cpp
|
||||
*
|
||||
* DESCRIPTION: Implements methods to write simpel datatypes to an
|
||||
* output stream.
|
||||
*
|
||||
* CREATED BY: Rune Schmidt Jensen
|
||||
* CREATED BY: Rune Schmidt Jensen
|
||||
*
|
||||
* HISTORY: Created 11.03.2003
|
||||
*
|
||||
@ -36,12 +36,12 @@
|
||||
#include "Sequence.h"
|
||||
#include "LOD.h"
|
||||
#include "PagedLOD.h"
|
||||
//#include "ViewPoint.h"
|
||||
#include "PositionAttitudeTransform.h"
|
||||
#include "Transform.h"
|
||||
#include "Switch.h"
|
||||
#include "OccluderNode.h"
|
||||
#include "Impostor.h"
|
||||
#include "LightPointNode.h"
|
||||
|
||||
#include "Geometry.h"
|
||||
|
||||
@ -491,9 +491,6 @@ void DataOutputStream::writeNode(const osg::Node* node)
|
||||
if(dynamic_cast<const osg::MatrixTransform*>(node)){
|
||||
((ive::MatrixTransform*)(node))->write(this);
|
||||
}
|
||||
// else if(dynamic_cast<osgfIVE::ViewPoint*>(node)){
|
||||
// ((ive::ViewPoint*)(node))->write(this);
|
||||
// }
|
||||
else if(dynamic_cast<const osg::PositionAttitudeTransform*>(node)){
|
||||
((ive::PositionAttitudeTransform*)(node))->write(this);
|
||||
}
|
||||
@ -530,6 +527,9 @@ void DataOutputStream::writeNode(const osg::Node* node)
|
||||
else if(dynamic_cast<const osg::Geode*>(node)){
|
||||
((ive::Geode*)(node))->write(this);
|
||||
}
|
||||
else if(dynamic_cast<const osgSim::LightPointNode*>(node)){
|
||||
((ive::LightPointNode*)(node))->write(this);
|
||||
}
|
||||
else
|
||||
throw Exception("Unknown node in Group::write()");
|
||||
|
||||
|
43
src/osgPlugins/ive/ElevationSector.cpp
Normal file
43
src/osgPlugins/ive/ElevationSector.cpp
Normal file
@ -0,0 +1,43 @@
|
||||
/**********************************************************************
|
||||
*
|
||||
* FILE: ElevationSector.cpp
|
||||
*
|
||||
* DESCRIPTION: Read/Write osgSim::ElevationSector in binary format to disk.
|
||||
*
|
||||
* CREATED BY: Auto generated by iveGenerator.exe
|
||||
* and later modified by Rune Schmidt Jensen.
|
||||
*
|
||||
* HISTORY: Created 9.9.2003
|
||||
*
|
||||
**********************************************************************/
|
||||
|
||||
#include "Exception.h"
|
||||
#include "ElevationSector.h"
|
||||
|
||||
using namespace ive;
|
||||
|
||||
void ElevationSector::write(DataOutputStream* out){
|
||||
// Write ElevationSector's identification.
|
||||
out->writeInt(IVEELEVATIONSECTOR);
|
||||
// Write ElevationSector's properties.
|
||||
out->writeFloat(getMinElevation());
|
||||
out->writeFloat(getMaxElevation());
|
||||
out->writeFloat(getFadeAngle());
|
||||
}
|
||||
|
||||
void ElevationSector::read(DataInputStream* in){
|
||||
// Peek on ElevationSector's identification.
|
||||
int id = in->peekInt();
|
||||
if(id == IVEELEVATIONSECTOR){
|
||||
// Read ElevationSector's identification.
|
||||
id = in->readInt();
|
||||
// Read ElevationSector's properties
|
||||
float minElevation = in->readFloat();
|
||||
float maxElevation = in->readFloat();
|
||||
float fadeAngle = in->readFloat();
|
||||
setElevationRange(minElevation, maxElevation, fadeAngle);
|
||||
}
|
||||
else{
|
||||
throw Exception("ElevationSector::read(): Expected ElevationSector identification.");
|
||||
}
|
||||
}
|
15
src/osgPlugins/ive/ElevationSector.h
Normal file
15
src/osgPlugins/ive/ElevationSector.h
Normal file
@ -0,0 +1,15 @@
|
||||
#ifndef IVE_ELEVATIONSECTOR
|
||||
#define IVE_ELEVATIONSECTOR 1
|
||||
|
||||
#include <osgSim/Sector>
|
||||
#include "ReadWrite.h"
|
||||
|
||||
namespace ive{
|
||||
class ElevationSector : public osgSim::ElevationSector, public ReadWrite {
|
||||
public:
|
||||
void write(DataOutputStream* out);
|
||||
void read(DataInputStream* in);
|
||||
};
|
||||
}
|
||||
|
||||
#endif
|
@ -47,8 +47,15 @@ CXXFILES =\
|
||||
TextureCubeMap.cpp\
|
||||
Transform.cpp\
|
||||
ReaderWriterIVE.cpp\
|
||||
AzimElevationSector.cpp\
|
||||
AzimSector.cpp\
|
||||
BlinkSequence.cpp\
|
||||
ConeSector.cpp\
|
||||
ElevationSector.cpp\
|
||||
LightPoint.cpp\
|
||||
LightPointNode.cpp\
|
||||
|
||||
LIBS += $(OSG_LIBS) $(OTHER_LIBS)
|
||||
LIBS += -losgSim -losgText $(OSG_LIBS) $(OTHER_LIBS)
|
||||
|
||||
TARGET_BASENAME = ive
|
||||
include $(TOPDIR)/Make/cygwin_plugin_def
|
||||
|
119
src/osgPlugins/ive/LightPoint.cpp
Normal file
119
src/osgPlugins/ive/LightPoint.cpp
Normal file
@ -0,0 +1,119 @@
|
||||
/**********************************************************************
|
||||
*
|
||||
* FILE: LightPoint.cpp
|
||||
*
|
||||
* DESCRIPTION: Read/Write osgSim::LightPoint in binary format to disk.
|
||||
*
|
||||
* CREATED BY: Auto generated by iveGenerator
|
||||
* and later modified by Rune Schmidt Jensen.
|
||||
*
|
||||
* HISTORY: Created 5.9.2003
|
||||
*
|
||||
**********************************************************************/
|
||||
|
||||
#include "Exception.h"
|
||||
#include "LightPoint.h"
|
||||
#include "BlinkSequence.h"
|
||||
#include "AzimElevationSector.h"
|
||||
#include "ElevationSector.h"
|
||||
#include "AzimSector.h"
|
||||
#include "ConeSector.h"
|
||||
|
||||
using namespace ive;
|
||||
|
||||
void LightPoint::write(DataOutputStream* out){
|
||||
// Write LightPoint's identification.
|
||||
out->writeInt(IVELIGHTPOINT);
|
||||
|
||||
// Write LightPoint's properties.
|
||||
out->writeBool(_on);
|
||||
out->writeVec3(_position);
|
||||
out->writeVec4(_color);
|
||||
out->writeFloat(_intensity);
|
||||
out->writeFloat(_radius);
|
||||
|
||||
// Write out osgSim::sector.
|
||||
out->writeBool(_sector.valid());
|
||||
if(_sector.valid()){
|
||||
if(dynamic_cast<osgSim::AzimElevationSector*>(_sector.get())){
|
||||
((ive::AzimElevationSector*)(_sector.get()))->write(out);
|
||||
}
|
||||
else if(dynamic_cast<osgSim::ElevationSector*>(_sector.get())){
|
||||
((ive::ElevationSector*)(_sector.get()))->write(out);
|
||||
}
|
||||
else if(dynamic_cast<osgSim::AzimSector*>(_sector.get())){
|
||||
((ive::AzimSector*)(_sector.get()))->write(out);
|
||||
}
|
||||
else if(dynamic_cast<osgSim::ConeSector*>(_sector.get())){
|
||||
((ive::ConeSector*)(_sector.get()))->write(out);
|
||||
}
|
||||
else
|
||||
throw Exception("Unknown sector in LightPoint::write()");
|
||||
}
|
||||
|
||||
// Write out osgSim::BlinkSequence.
|
||||
out->writeBool(_blinkSequence.valid());
|
||||
if(_blinkSequence.valid()){
|
||||
((ive::BlinkSequence*)(_blinkSequence.get()))->write(out);
|
||||
}
|
||||
|
||||
// Write out blendingMode.
|
||||
out->writeInt(_blendingMode);
|
||||
}
|
||||
|
||||
void LightPoint::read(DataInputStream* in){
|
||||
// Peek on LightPoint's identification.
|
||||
int id = in->peekInt();
|
||||
if(id == IVELIGHTPOINT){
|
||||
// Read LightPoint's identification.
|
||||
id = in->readInt();
|
||||
|
||||
// Read LightPoint's properties
|
||||
_on = in->readBool();
|
||||
_position = in->readVec3();
|
||||
_color = in->readVec4();
|
||||
_intensity = in->readFloat();
|
||||
_radius = in->readFloat();
|
||||
|
||||
// read in osgSim::sector.
|
||||
if(in->readBool()){
|
||||
osgSim::Sector* sector;
|
||||
int attributeID = in->peekInt();
|
||||
if(attributeID == IVEAZIMELEVATIONSECTOR){
|
||||
sector = new osgSim::AzimElevationSector();
|
||||
((ive::AzimElevationSector*)(sector))->read(in);
|
||||
_sector = sector;
|
||||
}
|
||||
else if(attributeID == IVEELEVATIONSECTOR){
|
||||
sector = new osgSim::ElevationSector();
|
||||
((ive::ElevationSector*)(sector))->read(in);
|
||||
_sector = sector;
|
||||
}
|
||||
else if(attributeID == IVEAZIMSECTOR){
|
||||
sector = new osgSim::AzimSector();
|
||||
((ive::AzimSector*)(sector))->read(in);
|
||||
_sector = sector;
|
||||
}
|
||||
else if(attributeID == IVECONESECTOR){
|
||||
sector = new osgSim::ConeSector();
|
||||
((ive::ConeSector*)(sector))->read(in);
|
||||
_sector = sector;
|
||||
}
|
||||
else
|
||||
throw Exception("Unknown sector in LightPoint::read()");
|
||||
}
|
||||
|
||||
// Read in osgSim::BlinkSequence.
|
||||
if(in->readBool()){
|
||||
osgSim::BlinkSequence* blinkSequence = new osgSim::BlinkSequence();
|
||||
((ive::BlinkSequence*)(blinkSequence))->read(in);
|
||||
_blinkSequence = blinkSequence;
|
||||
}
|
||||
|
||||
// Read in blendingMode.
|
||||
_blendingMode = (osgSim::LightPoint::BlendingMode)in->readInt();
|
||||
}
|
||||
else{
|
||||
throw Exception("LightPoint::read(): Expected LightPoint identification.");
|
||||
}
|
||||
}
|
15
src/osgPlugins/ive/LightPoint.h
Normal file
15
src/osgPlugins/ive/LightPoint.h
Normal file
@ -0,0 +1,15 @@
|
||||
#ifndef IVE_LIGHTPOINT
|
||||
#define IVE_LIGHTPOINT 1
|
||||
|
||||
#include <osgSim/LightPoint>
|
||||
#include "ReadWrite.h"
|
||||
|
||||
namespace ive{
|
||||
class LightPoint : public osgSim::LightPoint, public ReadWrite {
|
||||
public:
|
||||
void write(DataOutputStream* out);
|
||||
void read(DataInputStream* in);
|
||||
};
|
||||
}
|
||||
|
||||
#endif
|
74
src/osgPlugins/ive/LightPointNode.cpp
Normal file
74
src/osgPlugins/ive/LightPointNode.cpp
Normal file
@ -0,0 +1,74 @@
|
||||
/**********************************************************************
|
||||
*
|
||||
* FILE: LightPointNode.cpp
|
||||
*
|
||||
* DESCRIPTION: Read/Write osgSim::LightPointNode in binary format to disk.
|
||||
*
|
||||
* CREATED BY: Auto generated by iveGenerator.exe
|
||||
* and later modified by Rune Schmidt Jensen.
|
||||
*
|
||||
* HISTORY: Created 14.9.2003
|
||||
*
|
||||
**********************************************************************/
|
||||
|
||||
#include "Exception.h"
|
||||
#include "LightPointNode.h"
|
||||
#include "LightPoint.h"
|
||||
#include "Node.h"
|
||||
|
||||
using namespace ive;
|
||||
|
||||
void LightPointNode::write(DataOutputStream* out){
|
||||
// Write LightPointNode's identification.
|
||||
out->writeInt(IVELIGHTPOINTNODE);
|
||||
// If the osgSim class is inherited by any other class we should also write this to file.
|
||||
osg::Node* node = dynamic_cast<osg::Node*>(this);
|
||||
if(node){
|
||||
((ive::Node*)(node))->write(out);
|
||||
}
|
||||
else
|
||||
throw Exception("LightPointNode::write(): Could not cast this osgSim::LightPointNode to an osg::Node.");
|
||||
|
||||
// Write LightPointNode's properties.
|
||||
out->writeFloat(getMinPixelSize());
|
||||
out->writeFloat(getMaxPixelSize());
|
||||
out->writeFloat(getMaxVisibleDistance2());
|
||||
|
||||
// Write out LightPoints.
|
||||
unsigned int size = getNumLightPoints();
|
||||
out->writeUInt(size);
|
||||
for(unsigned int i=0; i<size; i++){
|
||||
((ive::LightPoint*)(&getLightPoint(i)))->write(out);
|
||||
}
|
||||
}
|
||||
|
||||
void LightPointNode::read(DataInputStream* in){
|
||||
// Peek on LightPointNode's identification.
|
||||
int id = in->peekInt();
|
||||
if(id == IVELIGHTPOINTNODE){
|
||||
// Read LightPointNode's identification.
|
||||
id = in->readInt();
|
||||
// If the osgSim class is inherited by any other class we should also read this from file.
|
||||
osg::Node* node = dynamic_cast<osg::Node*>(this);
|
||||
if(node){
|
||||
((ive::Node*)(node))->read(in);
|
||||
}
|
||||
else
|
||||
throw Exception("LightPointNode::read(): Could not cast this osgSim::LightPointNode to an osg::Object.");
|
||||
// Read LightPointNode's properties
|
||||
setMinPixelSize(in->readFloat());
|
||||
setMaxPixelSize(in->readFloat());
|
||||
setMaxVisibleDistance2(in->readFloat());
|
||||
|
||||
// Read in lightpoints.
|
||||
unsigned int size = in->readUInt();
|
||||
for(unsigned int i=0; i<size; i++ ){
|
||||
osgSim::LightPoint* lightPoint = new osgSim::LightPoint();
|
||||
((ive::LightPoint*)(lightPoint))->read(in);
|
||||
addLightPoint(*lightPoint);
|
||||
}
|
||||
}
|
||||
else{
|
||||
throw Exception("LightPointNode::read(): Expected LightPointNode identification.");
|
||||
}
|
||||
}
|
15
src/osgPlugins/ive/LightPointNode.h
Normal file
15
src/osgPlugins/ive/LightPointNode.h
Normal file
@ -0,0 +1,15 @@
|
||||
#ifndef IVE_LIGHTPOINTNODE
|
||||
#define IVE_LIGHTPOINTNODE 1
|
||||
|
||||
#include <osgSim/LightPointNode>
|
||||
#include "ReadWrite.h"
|
||||
|
||||
namespace ive{
|
||||
class LightPointNode : public osgSim::LightPointNode, public ReadWrite {
|
||||
public:
|
||||
void write(DataOutputStream* out);
|
||||
void read(DataInputStream* in);
|
||||
};
|
||||
}
|
||||
|
||||
#endif
|
@ -1,8 +1,8 @@
|
||||
/**********************************************************************
|
||||
*
|
||||
* FILE: LOD.cpp
|
||||
* FILE: PagedLOD.cpp
|
||||
*
|
||||
* DESCRIPTION: Read/Write osg::LOD in binary format to disk.
|
||||
* DESCRIPTION: Read/Write osg::PagedLOD in binary format to disk.
|
||||
*
|
||||
* CREATED BY: Auto generated by iveGenerate
|
||||
* and later modified by Rune Schmidt Jensen.
|
||||
|
@ -34,36 +34,43 @@ namespace ive {
|
||||
#define IVEANIMATIONPATHCALLBACK 0x00000051
|
||||
|
||||
// State attributes.
|
||||
#define IVESTATEATTRIBUTE 0x00000100
|
||||
#define IVEALPHAFUNC 0x00000101
|
||||
#define IVEBLENDFUNC 0x00000102
|
||||
#define IVEMATERIAL 0x00000110
|
||||
#define IVETEXTURE 0x00000120
|
||||
#define IVETEXTURE1D 0x00000121
|
||||
#define IVETEXTURE2D 0x00000122
|
||||
#define IVETEXTURE3D 0x00000123
|
||||
#define IVETEXTURECUBEMAP 0x00000124
|
||||
#define IVETEXENV 0x00000125
|
||||
#define IVETEXENVCOMBINE 0x00000126
|
||||
#define IVETEXGEN 0x00000127
|
||||
#define IVECULLFACE 0x00000128
|
||||
#define IVEPOLYGONOFFSET 0x00000129
|
||||
#define IVESHADEMODEL 0x0000012A
|
||||
#define IVEPOINT 0x0000012B
|
||||
#define IVESTATEATTRIBUTE 0x00000100
|
||||
#define IVEALPHAFUNC 0x00000101
|
||||
#define IVEBLENDFUNC 0x00000102
|
||||
#define IVEMATERIAL 0x00000110
|
||||
#define IVETEXTURE 0x00000120
|
||||
#define IVETEXTURE1D 0x00000121
|
||||
#define IVETEXTURE2D 0x00000122
|
||||
#define IVETEXTURE3D 0x00000123
|
||||
#define IVETEXTURECUBEMAP 0x00000124
|
||||
#define IVETEXENV 0x00000125
|
||||
#define IVETEXENVCOMBINE 0x00000126
|
||||
#define IVETEXGEN 0x00000127
|
||||
#define IVECULLFACE 0x00000128
|
||||
#define IVEPOLYGONOFFSET 0x00000129
|
||||
#define IVESHADEMODEL 0x0000012A
|
||||
#define IVEPOINT 0x0000012B
|
||||
|
||||
// Drawables
|
||||
#define IVEDRAWABLE 0x00001000
|
||||
#define IVEGEOMETRY 0x00001001
|
||||
#define IVEDRAWABLE 0x00001000
|
||||
#define IVEGEOMETRY 0x00001001
|
||||
|
||||
// Primitive set
|
||||
#define IVEPRIMITIVESET 0x00010000
|
||||
#define IVEDRAWARRAYS 0x00010001
|
||||
#define IVEDRAWARRAYLENGTHS 0x00010002
|
||||
#define IVEDRAWELEMENTSUSHORT 0x00010003
|
||||
#define IVEDRAWELEMENTSUINT 0x00010004
|
||||
#define IVEPRIMITIVESET 0x00010000
|
||||
#define IVEDRAWARRAYS 0x00010001
|
||||
#define IVEDRAWARRAYLENGTHS 0x00010002
|
||||
#define IVEDRAWELEMENTSUSHORT 0x00010003
|
||||
#define IVEDRAWELEMENTSUINT 0x00010004
|
||||
|
||||
// osgSim classes
|
||||
#define IVEBLINKSEQUENCE 0x00100001
|
||||
#define IVEAZIMELEVATIONSECTOR 0x00100002
|
||||
#define IVEELEVATIONSECTOR 0x00100003
|
||||
#define IVEAZIMSECTOR 0x00100004
|
||||
#define IVECONESECTOR 0x00100005
|
||||
#define IVELIGHTPOINT 0x00100006
|
||||
#define IVELIGHTPOINTNODE 0x00100007
|
||||
|
||||
// Our own classes
|
||||
#define IVEVIEWPOINT 0x00100001
|
||||
|
||||
class ReadWrite{
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user