Added glSissor suppor via new osg::Scissor class.
Added .osg support for osg::Scissor. Added .ive support for osg::Viewport and osg::Scissor.
This commit is contained in:
@@ -41,6 +41,8 @@
|
||||
#include "ProxyNode.h"
|
||||
#include "FrontFace.h"
|
||||
#include "Program.h"
|
||||
#include "Viewport.h"
|
||||
#include "Scissor.h"
|
||||
|
||||
#include "Group.h"
|
||||
#include "MatrixTransform.h"
|
||||
@@ -814,6 +816,14 @@ osg::StateAttribute* DataInputStream::readStateAttribute()
|
||||
attribute = new osg::BlendFunc();
|
||||
((ive::BlendFunc*)(attribute))->read(this);
|
||||
}
|
||||
else if(attributeID == IVEVIEWPORT){
|
||||
attribute = new osg::Viewport();
|
||||
((ive::Viewport*)(attribute))->read(this);
|
||||
}
|
||||
else if(attributeID == IVESCISSOR){
|
||||
attribute = new osg::Scissor();
|
||||
((ive::Scissor*)(attribute))->read(this);
|
||||
}
|
||||
else if(attributeID == IVEMATERIAL){
|
||||
attribute = new osg::Material();
|
||||
((ive::Material*)(attribute))->read(this);
|
||||
|
||||
@@ -44,6 +44,8 @@
|
||||
#include "Program.h"
|
||||
#include "Uniform.h"
|
||||
#include "Shader.h"
|
||||
#include "Viewport.h"
|
||||
#include "Scissor.h"
|
||||
|
||||
#include "Group.h"
|
||||
#include "MatrixTransform.h"
|
||||
@@ -638,6 +640,12 @@ void DataOutputStream::writeStateAttribute(const osg::StateAttribute* attribute)
|
||||
else if(dynamic_cast<const osg::BlendFunc*>(attribute)){
|
||||
((ive::BlendFunc*)(attribute))->write(this);
|
||||
}
|
||||
else if(dynamic_cast<const osg::Viewport*>(attribute)){
|
||||
((ive::Viewport*)(attribute))->write(this);
|
||||
}
|
||||
else if(dynamic_cast<const osg::Scissor*>(attribute)){
|
||||
((ive::Scissor*)(attribute))->write(this);
|
||||
}
|
||||
// This is a Material
|
||||
else if(dynamic_cast<const osg::Material*>(attribute)){
|
||||
((ive::Material*)(attribute))->write(this);
|
||||
|
||||
@@ -61,6 +61,7 @@ CXXFILES =\
|
||||
ProxyNode.cpp\
|
||||
ReaderWriterIVE.cpp\
|
||||
Sequence.cpp\
|
||||
Scissor.cpp\
|
||||
ShadeModel.cpp\
|
||||
Shader.cpp\
|
||||
Shape.cpp\
|
||||
@@ -81,6 +82,7 @@ CXXFILES =\
|
||||
Transform.cpp\
|
||||
Uniform.cpp\
|
||||
VertexProgram.cpp\
|
||||
Viewport.cpp\
|
||||
VisibilityGroup.cpp\
|
||||
|
||||
LIBS += -losgFX -losgSim -losgText $(OSG_LIBS) $(OTHER_LIBS)
|
||||
|
||||
@@ -67,6 +67,8 @@ namespace ive {
|
||||
#define IVEPROGRAM 0x00001124
|
||||
#define IVESHADER 0x00001125
|
||||
#define IVEUNIFORM 0x00001126
|
||||
#define IVEVIEWPORT 0x00001127
|
||||
#define IVESCISSOR 0x00001128
|
||||
|
||||
// Drawables
|
||||
#define IVEDRAWABLE 0x00001000
|
||||
|
||||
63
src/osgPlugins/ive/Scissor.cpp
Normal file
63
src/osgPlugins/ive/Scissor.cpp
Normal file
@@ -0,0 +1,63 @@
|
||||
/**********************************************************************
|
||||
*
|
||||
* FILE: Scissor.cpp
|
||||
*
|
||||
* DESCRIPTION: Read/Write osg::Scissor in binary format to disk.
|
||||
*
|
||||
* CREATED BY: Auto generated by iveGenerated
|
||||
* and later modified by Rune Schmidt Jensen.
|
||||
*
|
||||
* HISTORY: Created 21.3.2003
|
||||
*
|
||||
* Copyright 2003 VR-C
|
||||
**********************************************************************/
|
||||
|
||||
#include "Exception.h"
|
||||
#include "Scissor.h"
|
||||
#include "Object.h"
|
||||
|
||||
using namespace ive;
|
||||
|
||||
void Scissor::write(DataOutputStream* out){
|
||||
// Write Scissor's identification.
|
||||
out->writeInt(IVESCISSOR);
|
||||
// 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("Scissor::write(): Could not cast this osg::Scissor to an osg::Object.");
|
||||
// Write Scissor's properties.
|
||||
|
||||
out->writeInt(x());
|
||||
out->writeInt(y());
|
||||
out->writeInt(width());
|
||||
out->writeInt(height());
|
||||
}
|
||||
|
||||
void Scissor::read(DataInputStream* in){
|
||||
// Peek on Scissor's identification.
|
||||
int id = in->peekInt();
|
||||
if(id == IVESCISSOR){
|
||||
// Read Scissor'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("Scissor::read(): Could not cast this osg::Scissor to an osg::Object.");
|
||||
|
||||
// Read Scissor's properties
|
||||
x() = (GLenum)in->readInt();
|
||||
y() = (GLenum)in->readInt();
|
||||
width() = (GLenum)in->readInt();
|
||||
height() = (GLenum)in->readInt();
|
||||
|
||||
}
|
||||
else{
|
||||
throw Exception("Scissor::read(): Expected Scissor identification.");
|
||||
}
|
||||
}
|
||||
15
src/osgPlugins/ive/Scissor.h
Normal file
15
src/osgPlugins/ive/Scissor.h
Normal file
@@ -0,0 +1,15 @@
|
||||
#ifndef IVE_SCISSOR
|
||||
#define IVE_SCISSOR 1
|
||||
|
||||
#include <osg/Scissor>
|
||||
#include "ReadWrite.h"
|
||||
|
||||
namespace ive{
|
||||
class Scissor : public osg::Scissor, public ReadWrite {
|
||||
public:
|
||||
void write(DataOutputStream* out);
|
||||
void read(DataInputStream* in);
|
||||
};
|
||||
}
|
||||
|
||||
#endif
|
||||
63
src/osgPlugins/ive/Viewport.cpp
Normal file
63
src/osgPlugins/ive/Viewport.cpp
Normal file
@@ -0,0 +1,63 @@
|
||||
/**********************************************************************
|
||||
*
|
||||
* FILE: Viewport.cpp
|
||||
*
|
||||
* DESCRIPTION: Read/Write osg::Viewport in binary format to disk.
|
||||
*
|
||||
* CREATED BY: Auto generated by iveGenerated
|
||||
* and later modified by Rune Schmidt Jensen.
|
||||
*
|
||||
* HISTORY: Created 21.3.2003
|
||||
*
|
||||
* Copyright 2003 VR-C
|
||||
**********************************************************************/
|
||||
|
||||
#include "Exception.h"
|
||||
#include "Viewport.h"
|
||||
#include "Object.h"
|
||||
|
||||
using namespace ive;
|
||||
|
||||
void Viewport::write(DataOutputStream* out){
|
||||
// Write Viewport's identification.
|
||||
out->writeInt(IVEVIEWPORT);
|
||||
// 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("Viewport::write(): Could not cast this osg::Viewport to an osg::Object.");
|
||||
// Write Viewport's properties.
|
||||
|
||||
out->writeInt(x());
|
||||
out->writeInt(y());
|
||||
out->writeInt(width());
|
||||
out->writeInt(height());
|
||||
}
|
||||
|
||||
void Viewport::read(DataInputStream* in){
|
||||
// Peek on Viewport's identification.
|
||||
int id = in->peekInt();
|
||||
if(id == IVEVIEWPORT){
|
||||
// Read Viewport'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("Viewport::read(): Could not cast this osg::Viewport to an osg::Object.");
|
||||
|
||||
// Read Viewport's properties
|
||||
x() = (GLenum)in->readInt();
|
||||
y() = (GLenum)in->readInt();
|
||||
width() = (GLenum)in->readInt();
|
||||
height() = (GLenum)in->readInt();
|
||||
|
||||
}
|
||||
else{
|
||||
throw Exception("Viewport::read(): Expected Viewport identification.");
|
||||
}
|
||||
}
|
||||
15
src/osgPlugins/ive/Viewport.h
Normal file
15
src/osgPlugins/ive/Viewport.h
Normal file
@@ -0,0 +1,15 @@
|
||||
#ifndef IVE_VIEWPORT
|
||||
#define IVE_VIEWPORT 1
|
||||
|
||||
#include <osg/Viewport>
|
||||
#include "ReadWrite.h"
|
||||
|
||||
namespace ive{
|
||||
class Viewport : public osg::Viewport, public ReadWrite {
|
||||
public:
|
||||
void write(DataOutputStream* out);
|
||||
void read(DataInputStream* in);
|
||||
};
|
||||
}
|
||||
|
||||
#endif
|
||||
Reference in New Issue
Block a user