Added support for osg::LineWidth into ive format

This commit is contained in:
Robert Osfield
2004-02-18 21:40:18 +00:00
parent dea22aeb8e
commit b050a9877b
7 changed files with 91 additions and 0 deletions

View File

@@ -238,6 +238,10 @@ SOURCE=..\..\..\src\osgPlugins\ive\Point.cpp
# End Source File
# Begin Source File
SOURCE=..\..\..\src\osgPlugins\ive\LineWidth.cpp
# End Source File
# Begin Source File
SOURCE=..\..\..\src\osgPlugins\ive\ReaderWriterIVE.cpp
# End Source File
# Begin Source File
@@ -490,6 +494,10 @@ SOURCE=..\..\..\src\osgPlugins\ive\Point.h
# End Source File
# Begin Source File
SOURCE=..\..\..\src\osgPlugins\ive\LineWidth.h
# End Source File
# Begin Source File
SOURCE=..\..\..\src\osgPlugins\ive\ShadeModel.h
# End Source File
# Begin Source File

View File

@@ -22,6 +22,7 @@
#include "PolygonOffset.h"
#include "ShadeModel.h"
#include "Point.h"
#include "LineWidth.h"
#include "Texture1D.h"
#include "Texture2D.h"
#include "TextureCubeMap.h"
@@ -630,6 +631,10 @@ osg::StateAttribute* DataInputStream::readStateAttribute()
attribute = new osg::Point();
((ive::Point*)(attribute))->read(this);
}
else if(attributeID == IVELINEWIDTH){
attribute = new osg::LineWidth();
((ive::LineWidth*)(attribute))->read(this);
}
else if(attributeID == IVETEXTURE1D){
attribute = new osg::Texture1D();
((ive::Texture1D*)(attribute))->read(this);

View File

@@ -24,6 +24,7 @@
#include "PolygonOffset.h"
#include "ShadeModel.h"
#include "Point.h"
#include "LineWidth.h"
#include "Texture1D.h"
#include "Texture2D.h"
#include "TextureCubeMap.h"
@@ -431,6 +432,12 @@ void DataOutputStream::writeStateAttribute(const osg::StateAttribute* attribute)
else if(dynamic_cast<const osg::Point*>(attribute)){
((ive::Point*)(attribute))->write(this);
}
else if(dynamic_cast<const osg::LineWidth*>(attribute)){
((ive::LineWidth*)(attribute))->write(this);
}
else if(dynamic_cast<const osg::LineWidth*>(attribute)){
((ive::LineWidth*)(attribute))->write(this);
}
// This is a Texture1D
else if(dynamic_cast<const osg::Texture1D*>(attribute)){
((ive::Texture1D*)(attribute))->write(this);

View File

@@ -33,6 +33,7 @@ CXXFILES =\
MatrixTransform.cpp\
MultiSwitch.cpp\
Node.cpp\
LineWidth.cpp\
Object.cpp\
OccluderNode.cpp\
PagedLOD.cpp\

View File

@@ -0,0 +1,54 @@
/**********************************************************************
*
* FILE: LineWidth.cpp
*
* DESCRIPTION: Read/Write osg::LineWidth in binary format to disk.
*
* CREATED BY: Auto generated by iveGenerator
* and later modified by Rune Schmidt Jensen.
*
* HISTORY: Created 27.3.2003
*
* Copyright 2003 VR-C
**********************************************************************/
#include "Exception.h"
#include "LineWidth.h"
#include "Object.h"
using namespace ive;
void LineWidth::write(DataOutputStream* out){
// Write CullFace's identification.
out->writeInt(IVELINEWIDTH);
// 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("LineWidth::write(): Could not cast this osg::LineWidth to an osg::Object.");
// Write LineWidth's properties.
out->writeFloat(getWidth());
}
void LineWidth::read(DataInputStream* in){
// Peek on LineWidth's identification.
int id = in->peekInt();
if(id == IVELINEWIDTH){
// Read LineWidth'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("LineWidth::read(): Could not cast this osg::LineWidth to an osg::Object.");
// Read LineWidth's properties
setWidth(in->readFloat());
}
else{
throw Exception("LineWidth::read(): Expected LineWidth identification.");
}
}

View File

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

View File

@@ -53,6 +53,7 @@ namespace ive {
#define IVESHADEMODEL 0x0000012A
#define IVEPOINT 0x0000012B
#define IVETEXMAT 0x0000012C
#define IVELINEWIDTH 0x0000012D
// Drawables
#define IVEDRAWABLE 0x00001000