Added support for PagedLOD node into .ive format and added support for
Enabled texture object reuse by setting an expiry delay in the TextureObjectManager of 10 seconds - done for both osgDB::DatabasePager and TXP plugin.
This commit is contained in:
@@ -33,6 +33,7 @@
|
||||
#include "Billboard.h"
|
||||
#include "Sequence.h"
|
||||
#include "LOD.h"
|
||||
#include "PagedLOD.h"
|
||||
//#include "ViewPoint.h"
|
||||
#include "PositionAttitudeTransform.h"
|
||||
#include "Transform.h"
|
||||
@@ -556,6 +557,10 @@ osg::Node* DataInputStream::readNode()
|
||||
node = new osg::LOD();
|
||||
((ive::LOD*)(node))->read(this);
|
||||
}
|
||||
else if(nodeTypeID== IVEPAGEDLOD){
|
||||
node = new osg::PagedLOD();
|
||||
((ive::PagedLOD*)(node))->read(this);
|
||||
}
|
||||
else if(nodeTypeID== IVESWITCH){
|
||||
node = new osg::Switch();
|
||||
((ive::Switch*)(node))->read(this);
|
||||
|
||||
@@ -35,6 +35,7 @@
|
||||
#include "Billboard.h"
|
||||
#include "Sequence.h"
|
||||
#include "LOD.h"
|
||||
#include "PagedLOD.h"
|
||||
//#include "ViewPoint.h"
|
||||
#include "PositionAttitudeTransform.h"
|
||||
#include "Transform.h"
|
||||
@@ -421,6 +422,9 @@ void DataOutputStream::writeNode(osg::Node* node)
|
||||
else if(dynamic_cast<osg::Impostor*>(node)){
|
||||
((ive::Impostor*)(node))->write(this);
|
||||
}
|
||||
else if(dynamic_cast<osg::PagedLOD*>(node)){
|
||||
((ive::PagedLOD*)(node))->write(this);
|
||||
}
|
||||
else if(dynamic_cast<osg::LOD*>(node)){
|
||||
((ive::LOD*)(node))->write(this);
|
||||
}
|
||||
|
||||
@@ -30,6 +30,7 @@ CXXFILES =\
|
||||
Node.cpp\
|
||||
Object.cpp\
|
||||
OccluderNode.cpp\
|
||||
PagedLOD.cpp\
|
||||
PositionAttitudeTransform.cpp\
|
||||
PolygonOffset.cpp\
|
||||
Point.cpp\
|
||||
|
||||
120
src/osgPlugins/ive/PagedLOD.cpp
Normal file
120
src/osgPlugins/ive/PagedLOD.cpp
Normal file
@@ -0,0 +1,120 @@
|
||||
/**********************************************************************
|
||||
*
|
||||
* FILE: LOD.cpp
|
||||
*
|
||||
* DESCRIPTION: Read/Write osg::LOD in binary format to disk.
|
||||
*
|
||||
* CREATED BY: Auto generated by iveGenerate
|
||||
* and later modified by Rune Schmidt Jensen.
|
||||
*
|
||||
* HISTORY: Created 24.3.2003
|
||||
*
|
||||
* Copyright 2003 VR-C
|
||||
**********************************************************************/
|
||||
|
||||
#include "Exception.h"
|
||||
#include "PagedLOD.h"
|
||||
#include "Node.h"
|
||||
|
||||
using namespace ive;
|
||||
|
||||
void PagedLOD::write(DataOutputStream* out){
|
||||
// Write LOD's identification.
|
||||
out->writeInt(IVEPAGEDLOD);
|
||||
// If the osg class is inherited by any other class we should also write this to file.
|
||||
|
||||
osg::Node* node = dynamic_cast<osg::Node*>(this);
|
||||
if(node){
|
||||
static_cast<ive::Node*>(node)->write(out);
|
||||
}
|
||||
else
|
||||
throw Exception("PagedLOD::write(): Could not cast this osg::PagedLOD to an osg::LOD.");
|
||||
|
||||
unsigned int numChildrenToWriteOut = 0;
|
||||
|
||||
int i;
|
||||
for(i=0; i<(int)getNumFileNames();++i)
|
||||
{
|
||||
if (getFileName(i).empty())
|
||||
{
|
||||
++numChildrenToWriteOut;
|
||||
}
|
||||
}
|
||||
|
||||
// Write Group's properties.
|
||||
// Write number of children.
|
||||
out->writeInt(numChildrenToWriteOut);
|
||||
// Write children.
|
||||
for(i=0; i<(int)getNumChildren(); i++){
|
||||
if (getFileName(i).empty())
|
||||
{
|
||||
osg::Node* child = getChild(i);
|
||||
out->writeNode(child);
|
||||
}
|
||||
}
|
||||
|
||||
// LOD properties
|
||||
// Write centermode
|
||||
out->writeInt(getCenterMode());
|
||||
out->writeVec3(getCenter());
|
||||
// Write rangelist
|
||||
int size = getNumRanges();
|
||||
out->writeInt(size);
|
||||
for(i=0;i<size;i++){
|
||||
out->writeFloat(getMinRange(i));
|
||||
out->writeFloat(getMaxRange(i));
|
||||
}
|
||||
|
||||
|
||||
// PagedLOD properties
|
||||
size = getNumFileNames();
|
||||
out->writeInt(size);
|
||||
for(i=0;i<size;i++){
|
||||
out->writeString(getFileName(i));
|
||||
}
|
||||
}
|
||||
|
||||
void PagedLOD::read(DataInputStream* in){
|
||||
// Peek on LOD's identification.
|
||||
int id = in->peekInt();
|
||||
if(id == IVEPAGEDLOD){
|
||||
// Read LOD's identification.
|
||||
id = in->readInt();
|
||||
// If the osg 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("Group::read(): Could not cast this osg::Group to an osg::Node.");
|
||||
|
||||
|
||||
// Read groups properties.
|
||||
// Read number of children.
|
||||
int size = in->readInt();
|
||||
// Read children.
|
||||
for(int i=0; i<size; i++)
|
||||
{
|
||||
addChild(in->readNode());
|
||||
}
|
||||
|
||||
// Read centermode
|
||||
setCenterMode((osg::LOD::CenterMode)in->readInt());
|
||||
setCenter(in->readVec3());
|
||||
// Read rangelist
|
||||
size = in->readInt();
|
||||
for(int i=0;i<size;i++){
|
||||
float min = in->readFloat();
|
||||
float max = in->readFloat();
|
||||
setRange(i, min, max);
|
||||
}
|
||||
|
||||
size = in->readInt();
|
||||
for(int i=0;i<size;i++){
|
||||
setFileName(i, in->readString());
|
||||
}
|
||||
}
|
||||
else{
|
||||
throw Exception("LOD::read(): Expected LOD identification.");
|
||||
}
|
||||
}
|
||||
15
src/osgPlugins/ive/PagedLOD.h
Normal file
15
src/osgPlugins/ive/PagedLOD.h
Normal file
@@ -0,0 +1,15 @@
|
||||
#ifndef IVE_PAGEDLOD
|
||||
#define IVE_PAGEDLOD 1
|
||||
|
||||
#include <osg/PagedLOD>
|
||||
#include "ReadWrite.h"
|
||||
|
||||
namespace ive{
|
||||
class PagedLOD : public osg::PagedLOD, public ReadWrite {
|
||||
public:
|
||||
void write(DataOutputStream* out);
|
||||
void read(DataInputStream* in);
|
||||
};
|
||||
}
|
||||
|
||||
#endif
|
||||
@@ -27,6 +27,7 @@ namespace ive {
|
||||
#define IVEIMPOSTOR 0x00000018
|
||||
#define IVECONVEXPLANAROCCLUDER 0x00000019
|
||||
#define IVECONVEXPLANARPOLYGON 0x00000020
|
||||
#define IVEPAGEDLOD 0x00000021
|
||||
|
||||
// Node callbacks
|
||||
#define IVENODECALLBACK 0x00000050
|
||||
|
||||
Reference in New Issue
Block a user