From Nikolaus Hanekamp, added support for osg::Multisample
This commit is contained in:
@@ -55,6 +55,7 @@ Material.cpp
|
||||
MatrixTransform.cpp
|
||||
MultiSwitch.cpp
|
||||
MultiTextureControl.cpp
|
||||
Multisample.cpp
|
||||
Node.cpp
|
||||
Object.cpp
|
||||
OccluderNode.cpp
|
||||
|
||||
@@ -50,6 +50,8 @@
|
||||
#include "Scissor.h"
|
||||
#include "Image.h"
|
||||
#include "PointSprite.h"
|
||||
#include "Multisample.h"
|
||||
|
||||
|
||||
#include "Group.h"
|
||||
#include "MatrixTransform.h"
|
||||
@@ -1087,6 +1089,10 @@ osg::StateAttribute* DataInputStream::readStateAttribute()
|
||||
attribute = new osg::PointSprite();
|
||||
((ive::PointSprite*)(attribute))->read(this);
|
||||
}
|
||||
else if(attributeID == IVEMULTISAMPLE){
|
||||
attribute = new osg::Multisample();
|
||||
((ive::Multisample*)(attribute))->read(this);
|
||||
}
|
||||
else if(attributeID == IVESTENCIL){
|
||||
attribute = new osg::Stencil();
|
||||
((ive::Stencil*)(attribute))->read(this);
|
||||
|
||||
@@ -53,6 +53,7 @@
|
||||
#include "Scissor.h"
|
||||
#include "Image.h"
|
||||
#include "PointSprite.h"
|
||||
#include "Multisample.h"
|
||||
|
||||
#include "Group.h"
|
||||
#include "MatrixTransform.h"
|
||||
@@ -771,6 +772,10 @@ void DataOutputStream::writeStateAttribute(const osg::StateAttribute* attribute)
|
||||
else if(dynamic_cast<const osg::PointSprite*>(attribute)){
|
||||
((ive::PointSprite*)(attribute))->write(this);
|
||||
}
|
||||
// This is a Multisample
|
||||
else if(dynamic_cast<const osg::Multisample*>(attribute)){
|
||||
((ive::Multisample*)(attribute))->write(this);
|
||||
}
|
||||
|
||||
else{
|
||||
std::string className = attribute->className();
|
||||
|
||||
57
src/osgPlugins/ive/Multisample.cpp
Normal file
57
src/osgPlugins/ive/Multisample.cpp
Normal file
@@ -0,0 +1,57 @@
|
||||
/**********************************************************************
|
||||
*
|
||||
* FILE: Multisample.cpp
|
||||
*
|
||||
* DESCRIPTION: Read/Write osg::Multisample in binary format to disk.
|
||||
*
|
||||
* CREATED BY: Nikolaus Hanekamp
|
||||
*
|
||||
*
|
||||
* HISTORY: Created 15.06.2007
|
||||
*
|
||||
**********************************************************************/
|
||||
|
||||
#include "Exception.h"
|
||||
#include "Multisample.h"
|
||||
#include "Object.h"
|
||||
|
||||
using namespace ive;
|
||||
|
||||
void Multisample::write(DataOutputStream* out){
|
||||
// Write CullFace's identification.
|
||||
out->writeInt(IVEMULTISAMPLE);
|
||||
// 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("Multisample::write(): Could not cast this osg::Multisample to an osg::Object.");
|
||||
// Write Multisample's properties.
|
||||
out->writeFloat(getCoverage());
|
||||
out->writeBool(getInvert());
|
||||
out->writeInt(getHint());
|
||||
}
|
||||
|
||||
void Multisample::read(DataInputStream* in){
|
||||
// Peek on Multisample's identification.
|
||||
int id = in->peekInt();
|
||||
if(id == IVEMULTISAMPLE){
|
||||
// Read Multisample'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("Multisample::read(): Could not cast this osg::Multisample to an osg::Object.");
|
||||
// Read Multisample's properties
|
||||
setCoverage(in->readFloat());
|
||||
setInvert(in->readBool());
|
||||
setHint((Mode) in->readInt());
|
||||
}
|
||||
else{
|
||||
throw Exception("Multisample::read(): Expected Multisample identification.");
|
||||
}
|
||||
}
|
||||
15
src/osgPlugins/ive/Multisample.h
Normal file
15
src/osgPlugins/ive/Multisample.h
Normal file
@@ -0,0 +1,15 @@
|
||||
#ifndef IVE_MULTISAMPLE
|
||||
#define IVE_MULTISAMPLE 1
|
||||
|
||||
#include <osg/Multisample>
|
||||
#include "ReadWrite.h"
|
||||
|
||||
namespace ive{
|
||||
class Multisample : public osg::Multisample, public ReadWrite {
|
||||
public:
|
||||
void write(DataOutputStream* out);
|
||||
void read(DataInputStream* in);
|
||||
};
|
||||
}
|
||||
|
||||
#endif // IVE_VERTEX_PROGRAM
|
||||
@@ -81,6 +81,7 @@ namespace ive {
|
||||
#define IVEPOLYGONMODE 0x00001129
|
||||
#define IVETEXTURERECTANGLE 0x00001130
|
||||
#define IVEPOINTSPRITE 0x00001131
|
||||
#define IVEMULTISAMPLE 0x00001132
|
||||
|
||||
// Drawables
|
||||
#define IVEDRAWABLE 0x00001000
|
||||
|
||||
Reference in New Issue
Block a user