Added support for osg::LineWidth into ive format
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -33,6 +33,7 @@ CXXFILES =\
|
||||
MatrixTransform.cpp\
|
||||
MultiSwitch.cpp\
|
||||
Node.cpp\
|
||||
LineWidth.cpp\
|
||||
Object.cpp\
|
||||
OccluderNode.cpp\
|
||||
PagedLOD.cpp\
|
||||
|
||||
54
src/osgPlugins/ive/LineWidth.cpp
Normal file
54
src/osgPlugins/ive/LineWidth.cpp
Normal 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.");
|
||||
}
|
||||
}
|
||||
15
src/osgPlugins/ive/LineWidth.h
Normal file
15
src/osgPlugins/ive/LineWidth.h
Normal 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
|
||||
@@ -53,6 +53,7 @@ namespace ive {
|
||||
#define IVESHADEMODEL 0x0000012A
|
||||
#define IVEPOINT 0x0000012B
|
||||
#define IVETEXMAT 0x0000012C
|
||||
#define IVELINEWIDTH 0x0000012D
|
||||
|
||||
// Drawables
|
||||
#define IVEDRAWABLE 0x00001000
|
||||
|
||||
Reference in New Issue
Block a user