Merge pull request #1 from openscenegraph/master

merge new code from source
This commit is contained in:
Haojia Yu 2018-03-25 10:05:25 +08:00 committed by GitHub
commit 966bf6239d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
12 changed files with 194 additions and 41 deletions

View File

@ -1,6 +1,6 @@
OpenSceneGraph Library 3.5.11 OpenSceneGraph Library 3.7.0
569 Contributors: 568 Contributors:
Firstname Surname Firstname Surname
----------------- -----------------
@ -491,7 +491,6 @@ Hartmut Seichter
Gunter Huber Gunter Huber
Gregory Jaegy Gregory Jaegy
Graeme Harkness Graeme Harkness
Github It
Gian Lorenzetto Gian Lorenzetto
George Papagiannakis George Papagiannakis
Geoff Thu Geoff Thu

View File

@ -1,3 +1,72 @@
Sat, 24 Mar 2018 17:51:06 +0000
Author : Robert Osfield
Added new features in 3.6 to NEWS release
Sat, 24 Mar 2018 12:13:59 +0000
Author : Robert Osfield
First step for 3.6 stable release news
Sat, 24 Mar 2018 11:23:59 +0000
Author : Robert Osfield
Fixed read shader to safer ref version
Sat, 24 Mar 2018 10:59:15 +0000
Author : Robert Osfield
Fixed spotlight colour mixing
Fri, 23 Mar 2018 20:08:37 +0000
Author : OpenSceneGraph git repository
Merge pull request #502 from Haojia521/OutputStreamUseTargertSoVersionwrite binary file with a specific so version
Fri, 23 Mar 2018 19:54:33 +0000
Author : Robert Osfield
Removed serailizers that are now supplied by osg::Node
Fri, 23 Mar 2018 19:54:01 +0000
Author : Robert Osfield
Fixed member variable names to avoid conflicts with osg::Node
Fri, 23 Mar 2018 18:07:36 +0000
Author : Robert Osfield
Removed Drawable writing out of StateSet as this is now done by Node
Fri, 23 Mar 2018 18:07:07 +0300
Author : Michael Kapelko
Provide osgemscripten example CMake flags in a more stable way
Fri, 23 Mar 2018 12:55:00 +0000
Author : Robert Osfield
Changed the isBufferObjectSupported flag so that it's true when either VBO or PBO's are supported
Thu, 22 Mar 2018 17:35:13 +0000
Author : Paul Obermeier
Fixes for VS2008 and 2010 build
Thu, 22 Mar 2018 16:51:03 +0000
Author : Robert Osfield
Moved OPENGL_INCLUDE_DIR include into it's own INCLUDE_DIRECTORIES(SYSTEM ${OPENGL_INCLUDE_DIR}) entry to help with FreeBSD builds where a previous rev of the OSG has already been installed
Thu, 22 Mar 2018 09:04:47 +0000
Author : Robert Osfield
Removed typedef and used osg::GraphicsContext::Cameras explictly to avoid any hiding of type
Wed, 21 Mar 2018 19:44:25 +0300
Author : Victor
Fixed bug of determining availability of functions pthread_getconcurrency, pthread_setconcurrency, pthread_setaffinity_np in pthread libraryCMake cannot find 'pthread_getconcurrency, pthread_setconcurrency and pthread_setaffinity_np' functions in 'pthread' library because when linking internal cmake test didt specifed -l pthread.
Tue, 20 Mar 2018 09:20:59 +0000
Author : Robert Osfield
Removed -m message that was causing problems with branch creation
Tue, 20 Mar 2018 09:12:58 +0000
Author : Robert Osfield
Updated version numbers in prep for 3.6 branch
Tue, 20 Mar 2018 09:02:05 +0000
Author : Robert Osfield
Updated ChangeLog and AUTHORS file
Mon, 19 Mar 2018 14:27:18 +0000 Mon, 19 Mar 2018 14:27:18 +0000
Author : Robert Osfield Author : Robert Osfield
Updated ChangeLog and updated version to 3.5.11 Updated ChangeLog and updated version to 3.5.11

View File

@ -1,6 +1,54 @@
OSG News OSG News
======== ========
OpenSceneGraph 3.6 release
PERTHSHIRE, Scotland - 24th March 2018 - OpenSceneGraph Professional Services announces the release of OpenSceneGraph 3.6, the industry's leading open-source scene graph technology, designed to accelerate application development and improve 3D graphics performance. OpenSceneGraph 3.6 written entirely in Standard C++ and built upon OpenGL, offers developers working in the visual simulation, game development, virtual reality, scientific visualization and modeling markets - a real-time visualization tool which eclipses commercial scene graph toolkits in functionality, stability and performance. OpenSceneGraph 3.6 runs on all Microsoft Windows platforms, Apple OS/X, IOS, GNU/Linux, Android, IRIX, Solaris, HP-UX, AIX and FreeBSD operating systems.
Updates include:
* CoverityScan testing introduced, fixes bring defect density to 0.0.
* Support for Codedoc automated documentation
* Support for Travis automated build system
* OpenThreads::Affinity & DatabasePager::setProcessorAffinity
* Improvements to osgAnimation
* Improvements to gles plugin to provide better Sketchfab support
* NodeVisit ValueMap for storing values that can be stored and accessed across frames
* Improvements to FBX and COLLADA loaders
* osg::MultiDrawArrays
* osgText rewritten to improve visual quality, add signed distance field support and full GLES2/3 and GL3/4 supprt
* osgderred example that illustrates how to implement deferred rendering
* Vertex Array Object support
* ShadpeDrawable implemented as an osg::Geometry to improve performance and flexibility
* New OpenCASCADE plugin
* New STEP (.stp) plugin
* KdTree support added for PolytopeIntersector, and ability to work with points, lines and polygons
* osgQt has been moved out to it's own dedicated
* Added osgemscripten example
* Moved ComputeDispatch control out of osg::Program into a dedicated osg::ComputeDispatch class to improve flexibility of compute shaders
* CMake build support for iOS bitcode builds
* Added MultiDrawIndirect support
Downloads and Licensing:
OpenSceneGraph is open-source, so full source code is provided, and can be copied, modified and used free of charge for commercial and non-commercial use. Access to the source allows end users greater flexibility in how they develop, debug and deploy their applications. They gain productivity and freedom by being able to leverage the tool chain in accordance with their own release cycles. Downloads of binaries and source can be found in the Downloads section of the openscenegraph.org website.
OpenSceneGraph is released under the OpenSceneGraph Public License, which is based on the Lesser GNU Public License (LGPL), permitting the software to be used free of charge across the full spectrum of commercial and open-source applications. Furthermore, it allows both static and dynamic linking of the OpenSceneGraph libraries without restricting the licensing of the user's software.
Professional support and services
OpenSceneGraph project is backed up with professional services by OpenSceneGraph Professional Services, based in Scotland, and a range of Contractors from around the world. Services available include:
Confidential Professional Support
Bespoke development
Consultancy
Training
Community support and contributions:
The diverse and growing community of over 5000 developers is centred around the public osg-users mailing list/forum, where members discuss how best to use OpenSceneGraph, provide mutual support, and coordinate development of new features and bug fixes. Members of this community come from many different countries with backgrounds ranging from some of the world's largest aerospace companies, game companies, and visual simulation specialists to university researchers, students and hobbyists.
The OpenSceneGraph project owes a great deal to the community for its development and support, in particular we wish to thank the 569 individuals from around the world that have directly contributed to the development and refinement of the OpenSceneGraph code base.
OpenSceneGraph 3.4 release introduces shader composition, new osgUI library, displacement mapping, volume rendering, lua scripting support and much more OpenSceneGraph 3.4 release introduces shader composition, new osgUI library, displacement mapping, volume rendering, lua scripting support and much more
PERTHSHIRE, Scotland - 12th August 2015 - OpenSceneGraph Professional Services announces the release of OpenSceneGraph 3.4, the industry's leading open-source scene graph technology, designed to accelerate application development and improve 3D graphics performance. OpenSceneGraph 3.4 written entirely in Standard C++ and built upon OpenGL, offers developers working in the visual simulation, game development, virtual reality, scientific visualization and modeling markets - a real-time visualization tool which eclipses commercial scene graph toolkits in functionality, stability and performance. OpenSceneGraph 3.4 runs on all Microsoft Windows platforms, Apple OS/X, IOS, GNU/Linux, Android, IRIX, Solaris, HP-UX, AIX and FreeBSD operating systems. PERTHSHIRE, Scotland - 12th August 2015 - OpenSceneGraph Professional Services announces the release of OpenSceneGraph 3.4, the industry's leading open-source scene graph technology, designed to accelerate application development and improve 3D graphics performance. OpenSceneGraph 3.4 written entirely in Standard C++ and built upon OpenGL, offers developers working in the visual simulation, game development, virtual reality, scientific visualization and modeling markets - a real-time visualization tool which eclipses commercial scene graph toolkits in functionality, stability and performance. OpenSceneGraph 3.4 runs on all Microsoft Windows platforms, Apple OS/X, IOS, GNU/Linux, Android, IRIX, Solaris, HP-UX, AIX and FreeBSD operating systems.
Updates include: Updates include:

View File

@ -281,7 +281,10 @@ const char* invalidNames[] =
"OpenGL", "OpenGL",
"FindLIBLAS", "FindLIBLAS",
"PissedCapslock", "PissedCapslock",
"MinGW" "MinGW",
"Haojia521",
"Github",
"It"
}; };

View File

@ -14,12 +14,12 @@ SET(DYNAMIC_OPENTHREADS OFF CACHE BOOL "Link OpenThreads statically")
SET(DYNAMIC_OPENSCENEGRAPH OFF CACHE BOOL "Link OpenSceneGraph statically") SET(DYNAMIC_OPENSCENEGRAPH OFF CACHE BOOL "Link OpenSceneGraph statically")
# Prevent CMake configuration error. # Prevent CMake configuration error.
SET(_OPENTHREADS_ATOMIC_USE_GCC_BUILTINS_EXITCODE "0" CACHE STRING "Prevent cfg error") SET(_OPENTHREADS_ATOMIC_USE_GCC_BUILTINS_EXITCODE "0" CACHE STRING "Prevent cfg error")
# Reference SDL2 during build process.
# We use SDL2 to do the following: # Set special build flags:
# * OpenGL functions' address retrieval # * -O3: make compact binary, critical for web
# * OpenGL graphics context creation # * -s USE_SDL=2: provide SDL2
SET(USE_SDL2 "-s USE_SDL=2") SET(BUILD_FLAGS "-O3 -s USE_SDL=2")
SET(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} ${USE_SDL2}" CACHE STRING "Use SDL2" FORCE) ADD_DEFINITIONS(${BUILD_FLAGS})
# Reference OpenSceneGraph includes and libraries. # Reference OpenSceneGraph includes and libraries.
SET(OSG_SOURCE_DIR "${OSG_DIR}") SET(OSG_SOURCE_DIR "${OSG_DIR}")
@ -42,7 +42,7 @@ ADD_EXECUTABLE(osgemscripten osgemscripten.cpp)
# Make Emscripten generate ready-to-open HTML page. # Make Emscripten generate ready-to-open HTML page.
SET(CMAKE_EXECUTABLE_SUFFIX ".html") SET(CMAKE_EXECUTABLE_SUFFIX ".html")
# Make Emscripten preload the resource. # Make Emscripten preload the resource.
SET_TARGET_PROPERTIES(osgemscripten PROPERTIES LINK_FLAGS "--preload-file box.osgt") SET_TARGET_PROPERTIES(osgemscripten PROPERTIES LINK_FLAGS "--preload-file box.osgt ${BUILD_FLAGS}")
# Copy the resource to the build directory. # Copy the resource to the build directory.
CONFIGURE_FILE(box.osgt box.osgt COPYONLY) CONFIGURE_FILE(box.osgt box.osgt COPYONLY)
# Libraries must be linked in the specified order. # Libraries must be linked in the specified order.

View File

@ -116,7 +116,7 @@ int main(int argc, char** argv)
std::string shaderFilename; std::string shaderFilename;
while(arguments.read("--shader", shaderFilename)) while(arguments.read("--shader", shaderFilename))
{ {
osg::ref_ptr<osg::Shader> shader = osgDB::readShaderFile(shaderFilename); osg::ref_ptr<osg::Shader> shader = osgDB::readRefShaderFile(shaderFilename);
if (shader.valid()) uberProgram->addShader(shader.get()); if (shader.valid()) uberProgram->addShader(shader.get());
} }

View File

@ -56,7 +56,7 @@ osg::Image* createSpotLightImage(const osg::Vec4& centerColour, const osg::Vec4&
float dy = (float(r) - mid)*div; float dy = (float(r) - mid)*div;
float pr = powf(1.0f-sqrtf(dx*dx+dy*dy),power); float pr = powf(1.0f-sqrtf(dx*dx+dy*dy),power);
if (pr<0.0f) pr=0.0f; if (pr<0.0f) pr=0.0f;
osg::Vec4 color = centerColour*r+backgroudColour*(1.0f-pr); osg::Vec4 color = centerColour*pr+backgroudColour*(1.0f-pr);
*ptr++ = (unsigned char)((color[0])*255.0f); *ptr++ = (unsigned char)((color[0])*255.0f);
*ptr++ = (unsigned char)((color[1])*255.0f); *ptr++ = (unsigned char)((color[1])*255.0f);
*ptr++ = (unsigned char)((color[2])*255.0f); *ptr++ = (unsigned char)((color[2])*255.0f);

View File

@ -113,10 +113,10 @@ class OSG_EXPORT Drawable : public Node
/** Set the initial bounding volume to use when computing the overall bounding volume.*/ /** Set the initial bounding volume to use when computing the overall bounding volume.*/
void setInitialBound(const osg::BoundingBox& bbox) { _initialBound = bbox; dirtyBound(); } void setInitialBound(const osg::BoundingBox& bbox) { _initialBoundingBox = bbox; dirtyBound(); }
/** Set the initial bounding volume to use when computing the overall bounding volume.*/ /** Set the initial bounding volume to use when computing the overall bounding volume.*/
const BoundingBox& getInitialBound() const { return _initialBound; } const BoundingBox& getInitialBound() const { return _initialBoundingBox; }
inline const BoundingSphere& getBound() const inline const BoundingSphere& getBound() const
{ {
@ -131,10 +131,10 @@ class OSG_EXPORT Drawable : public Node
{ {
if(!_boundingSphereComputed) if(!_boundingSphereComputed)
{ {
_boundingBox = _initialBound; _boundingBox = _initialBoundingBox;
if (_computeBoundCallback.valid()) if (_computeBoundingBoxCallback.valid())
_boundingBox.expandBy(_computeBoundCallback->computeBound(*this)); _boundingBox.expandBy(_computeBoundingBoxCallback->computeBound(*this));
else else
_boundingBox.expandBy(computeBoundingBox()); _boundingBox.expandBy(computeBoundingBox());
@ -171,13 +171,13 @@ class OSG_EXPORT Drawable : public Node
}; };
/** Set the compute bound callback to override the default computeBound.*/ /** Set the compute bound callback to override the default computeBound.*/
void setComputeBoundingBoxCallback(ComputeBoundingBoxCallback* callback) { _computeBoundCallback = callback; } void setComputeBoundingBoxCallback(ComputeBoundingBoxCallback* callback) { _computeBoundingBoxCallback = callback; }
/** Get the compute bound callback.*/ /** Get the compute bound callback.*/
ComputeBoundingBoxCallback* getComputeBoundingBoxCallback() { return _computeBoundCallback.get(); } ComputeBoundingBoxCallback* getComputeBoundingBoxCallback() { return _computeBoundingBoxCallback.get(); }
/** Get the const compute bound callback.*/ /** Get the const compute bound callback.*/
const ComputeBoundingBoxCallback* getComputeBoundingBoxCallback() const { return _computeBoundCallback.get(); } const ComputeBoundingBoxCallback* getComputeBoundingBoxCallback() const { return _computeBoundingBoxCallback.get(); }
/** Set the Shape of the \c Drawable. The shape can be used to /** Set the Shape of the \c Drawable. The shape can be used to
@ -524,8 +524,8 @@ class OSG_EXPORT Drawable : public Node
friend class Geode; friend class Geode;
friend class StateSet; friend class StateSet;
BoundingBox _initialBound; BoundingBox _initialBoundingBox;
ref_ptr<ComputeBoundingBoxCallback> _computeBoundCallback; ref_ptr<ComputeBoundingBoxCallback> _computeBoundingBoxCallback;
mutable BoundingBox _boundingBox; mutable BoundingBox _boundingBox;
ref_ptr<Shape> _shape; ref_ptr<Shape> _shape;

View File

@ -79,7 +79,7 @@ public:
OutputStream( const osgDB::Options* options ); OutputStream( const osgDB::Options* options );
virtual ~OutputStream(); virtual ~OutputStream();
void setFileVersion( const std::string& d, int v ) { _domainVersionMap[d] = v; } void setFileVersion( const std::string& d, int v );
int getFileVersion( const std::string& d=std::string() ) const; int getFileVersion( const std::string& d=std::string() ) const;
bool isBinary() const { return _out->isBinary(); } bool isBinary() const { return _out->isBinary(); }
@ -147,13 +147,13 @@ public:
OutputStream& operator<<( const osg::BoundingSphered& bb ); OutputStream& operator<<( const osg::BoundingSphered& bb );
OutputStream& operator<<( const osg::Image* img ) { writeImage(img); return *this; } OutputStream& operator<<( const osg::Image* img ) { writeImage(img); return *this; }
OutputStream& operator<<( const osg::Array* a ) { writeObject(a); return *this; } OutputStream& operator<<( const osg::Array* a ) { if (_targetFileVersion >= 112) writeObject(a); else writeArray(a); return *this; }
OutputStream& operator<<( const osg::PrimitiveSet* p ) { writeObject(p); return *this; } OutputStream& operator<<( const osg::PrimitiveSet* p ) { if (_targetFileVersion >= 112) writeObject(p); else writePrimitiveSet(p); return *this; }
OutputStream& operator<<( const osg::Object* obj ) { writeObject(obj); return *this; } OutputStream& operator<<( const osg::Object* obj ) { writeObject(obj); return *this; }
OutputStream& operator<<( const osg::ref_ptr<osg::Image>& ptr ) { writeImage(ptr.get()); return *this; } OutputStream& operator<<( const osg::ref_ptr<osg::Image>& ptr ) { writeImage(ptr.get()); return *this; }
OutputStream& operator<<( const osg::ref_ptr<osg::Array>& ptr ) { writeObject(ptr.get()); return *this; } OutputStream& operator<<( const osg::ref_ptr<osg::Array>& ptr ) { if (_targetFileVersion >= 112) writeObject(ptr.get()); else writeArray(ptr.get()); return *this; }
OutputStream& operator<<( const osg::ref_ptr<osg::PrimitiveSet>& ptr ) { writeObject(ptr.get()); return *this; } OutputStream& operator<<( const osg::ref_ptr<osg::PrimitiveSet>& ptr ) { if (_targetFileVersion >= 112) writeObject(ptr.get()); else writePrimitiveSet(ptr.get()); return *this; }
template<typename T> OutputStream& operator<<( const osg::ref_ptr<T>& ptr ) { writeObject(ptr.get()); return *this; } template<typename T> OutputStream& operator<<( const osg::ref_ptr<T>& ptr ) { writeObject(ptr.get()); return *this; }
@ -218,6 +218,8 @@ protected:
osg::ref_ptr<OutputIterator> _out; osg::ref_ptr<OutputIterator> _out;
osg::ref_ptr<OutputException> _exception; osg::ref_ptr<OutputException> _exception;
osg::ref_ptr<const osgDB::Options> _options; osg::ref_ptr<const osgDB::Options> _options;
int _targetFileVersion;
}; };
void OutputStream::throwException( const std::string& msg ) void OutputStream::throwException( const std::string& msg )

View File

@ -240,8 +240,8 @@ Drawable::Drawable()
Drawable::Drawable(const Drawable& drawable,const CopyOp& copyop): Drawable::Drawable(const Drawable& drawable,const CopyOp& copyop):
Node(drawable,copyop), Node(drawable,copyop),
_initialBound(drawable._initialBound), _initialBoundingBox(drawable._initialBoundingBox),
_computeBoundCallback(drawable._computeBoundCallback), _computeBoundingBoxCallback(drawable._computeBoundingBoxCallback),
_boundingBox(drawable._boundingBox), _boundingBox(drawable._boundingBox),
_shape(copyop(drawable._shape.get())), _shape(copyop(drawable._shape.get())),
_supportsDisplayList(drawable._supportsDisplayList), _supportsDisplayList(drawable._supportsDisplayList),
@ -252,7 +252,6 @@ Drawable::Drawable(const Drawable& drawable,const CopyOp& copyop):
_drawCallback(drawable._drawCallback), _drawCallback(drawable._drawCallback),
_createVertexArrayStateCallback(drawable._createVertexArrayStateCallback) _createVertexArrayStateCallback(drawable._createVertexArrayStateCallback)
{ {
setStateSet(copyop(drawable._stateset.get()));
} }
Drawable::~Drawable() Drawable::~Drawable()

View File

@ -25,7 +25,7 @@
using namespace osgDB; using namespace osgDB;
OutputStream::OutputStream( const osgDB::Options* options ) OutputStream::OutputStream( const osgDB::Options* options )
: _writeImageHint(WRITE_USE_IMAGE_HINT), _useSchemaData(false), _useRobustBinaryFormat(true) : _writeImageHint(WRITE_USE_IMAGE_HINT), _useSchemaData(false), _useRobustBinaryFormat(true), _targetFileVersion(OPENSCENEGRAPH_SOVERSION)
{ {
BEGIN_BRACKET.set( "{", +INDENT_VALUE ); BEGIN_BRACKET.set( "{", +INDENT_VALUE );
END_BRACKET.set( "}", -INDENT_VALUE ); END_BRACKET.set( "}", -INDENT_VALUE );
@ -61,15 +61,31 @@ OutputStream::OutputStream( const osgDB::Options* options )
_domainVersionMap[keyAndValue.front()] = atoi(keyAndValue.back().c_str()); _domainVersionMap[keyAndValue.front()] = atoi(keyAndValue.back().c_str());
} }
} }
if (!options->getPluginStringData("TargetFileVersion").empty())
{
std::string strVersion = options->getPluginStringData("TargetFileVersion");
int version = atoi(strVersion.c_str());
if (version > 0 && version <= OPENSCENEGRAPH_SOVERSION)
_targetFileVersion = version;
}
if (_targetFileVersion < 99) _useRobustBinaryFormat = false;
} }
OutputStream::~OutputStream() OutputStream::~OutputStream()
{ {
} }
void OutputStream::setFileVersion( const std::string& d, int v )
{
if (d.empty()) _targetFileVersion = v;
else _domainVersionMap[d] = v;
}
int OutputStream::getFileVersion( const std::string& d ) const int OutputStream::getFileVersion( const std::string& d ) const
{ {
if ( d.empty() ) return OPENSCENEGRAPH_SOVERSION; if ( d.empty() ) return _targetFileVersion;
VersionMap::const_iterator itr = _domainVersionMap.find(d); VersionMap::const_iterator itr = _domainVersionMap.find(d);
return itr==_domainVersionMap.end() ? 0 : itr->second; return itr==_domainVersionMap.end() ? 0 : itr->second;
} }
@ -389,15 +405,18 @@ void OutputStream::writePrimitiveSet( const osg::PrimitiveSet* p )
*this << MAPPEE(PrimitiveType, ID_DRAWARRAYS); *this << MAPPEE(PrimitiveType, ID_DRAWARRAYS);
{ {
const osg::DrawArrays* da = static_cast<const osg::DrawArrays*>(p); const osg::DrawArrays* da = static_cast<const osg::DrawArrays*>(p);
*this << MAPPEE(PrimitiveType, da->getMode()) << da->getNumInstances() *this << MAPPEE(PrimitiveType, da->getMode());
<< da->getFirst() << da->getCount() << std::endl; if (_targetFileVersion > 96) *this << da->getNumInstances();
*this << da->getFirst() << da->getCount() << std::endl;
} }
break; break;
case osg::PrimitiveSet::DrawArrayLengthsPrimitiveType: case osg::PrimitiveSet::DrawArrayLengthsPrimitiveType:
*this << MAPPEE(PrimitiveType, ID_DRAWARRAY_LENGTH); *this << MAPPEE(PrimitiveType, ID_DRAWARRAY_LENGTH);
{ {
const osg::DrawArrayLengths* dl = static_cast<const osg::DrawArrayLengths*>(p); const osg::DrawArrayLengths* dl = static_cast<const osg::DrawArrayLengths*>(p);
*this << MAPPEE(PrimitiveType, dl->getMode()) << dl->getNumInstances() << dl->getFirst(); *this << MAPPEE(PrimitiveType, dl->getMode());
if (_targetFileVersion > 96) *this << dl->getNumInstances();
*this << dl->getFirst();
writeArrayImplementation( dl, dl->size(), 4 ); writeArrayImplementation( dl, dl->size(), 4 );
} }
break; break;
@ -405,7 +424,8 @@ void OutputStream::writePrimitiveSet( const osg::PrimitiveSet* p )
*this << MAPPEE(PrimitiveType, ID_DRAWELEMENTS_UBYTE); *this << MAPPEE(PrimitiveType, ID_DRAWELEMENTS_UBYTE);
{ {
const osg::DrawElementsUByte* de = static_cast<const osg::DrawElementsUByte*>(p); const osg::DrawElementsUByte* de = static_cast<const osg::DrawElementsUByte*>(p);
*this << MAPPEE(PrimitiveType, de->getMode()) << de->getNumInstances(); *this << MAPPEE(PrimitiveType, de->getMode());
if (_targetFileVersion > 96) *this << de->getNumInstances();
writeArrayImplementation( de, de->size(), 4 ); writeArrayImplementation( de, de->size(), 4 );
} }
break; break;
@ -413,7 +433,8 @@ void OutputStream::writePrimitiveSet( const osg::PrimitiveSet* p )
*this << MAPPEE(PrimitiveType, ID_DRAWELEMENTS_USHORT); *this << MAPPEE(PrimitiveType, ID_DRAWELEMENTS_USHORT);
{ {
const osg::DrawElementsUShort* de = static_cast<const osg::DrawElementsUShort*>(p); const osg::DrawElementsUShort* de = static_cast<const osg::DrawElementsUShort*>(p);
*this << MAPPEE(PrimitiveType, de->getMode()) << de->getNumInstances(); *this << MAPPEE(PrimitiveType, de->getMode());
if (_targetFileVersion > 96) *this << de->getNumInstances();
writeArrayImplementation( de, de->size(), 4 ); writeArrayImplementation( de, de->size(), 4 );
} }
break; break;
@ -421,7 +442,8 @@ void OutputStream::writePrimitiveSet( const osg::PrimitiveSet* p )
*this << MAPPEE(PrimitiveType, ID_DRAWELEMENTS_UINT); *this << MAPPEE(PrimitiveType, ID_DRAWELEMENTS_UINT);
{ {
const osg::DrawElementsUInt* de = static_cast<const osg::DrawElementsUInt*>(p); const osg::DrawElementsUInt* de = static_cast<const osg::DrawElementsUInt*>(p);
*this << MAPPEE(PrimitiveType, de->getMode()) << de->getNumInstances(); *this << MAPPEE(PrimitiveType, de->getMode());
if (_targetFileVersion > 96) *this << de->getNumInstances();
writeArrayImplementation( de, de->size(), 4 ); writeArrayImplementation( de, de->size(), 4 );
} }
break; break;
@ -440,7 +462,8 @@ void OutputStream::writeImage( const osg::Image* img )
bool newID = false; bool newID = false;
unsigned int id = findOrCreateObjectID( img, newID ); unsigned int id = findOrCreateObjectID( img, newID );
*this << PROPERTY("ClassName") << name << std::endl; // Write object name if (_targetFileVersion > 94) *this << PROPERTY("ClassName") << name << std::endl; // Write object name
*this << PROPERTY("UniqueID") << id << std::endl; // Write image ID *this << PROPERTY("UniqueID") << id << std::endl; // Write image ID
if ( getException() ) return; if ( getException() ) return;
@ -710,7 +733,7 @@ void OutputStream::start( OutputIterator* outIterator, OutputStream::WriteType t
if ( isBinary() ) if ( isBinary() )
{ {
*this << (unsigned int)type << (unsigned int)OPENSCENEGRAPH_SOVERSION; *this << (unsigned int)type << (unsigned int)_targetFileVersion;
bool useCompressSource = false; bool useCompressSource = false;
unsigned int attributes = 0; unsigned int attributes = 0;

View File

@ -39,6 +39,7 @@ REGISTER_OBJECT_WRAPPER( Drawable,
UPDATE_TO_VERSION_SCOPED( 154 ) UPDATE_TO_VERSION_SCOPED( 154 )
ADDED_ASSOCIATE("osg::Node") ADDED_ASSOCIATE("osg::Node")
} }
ADD_OBJECT_SERIALIZER( StateSet, osg::StateSet, NULL ); // _stateset ADD_OBJECT_SERIALIZER( StateSet, osg::StateSet, NULL ); // _stateset
ADD_USER_SERIALIZER( InitialBound ); // _initialBound ADD_USER_SERIALIZER( InitialBound ); // _initialBound
ADD_OBJECT_SERIALIZER( ComputeBoundingBoxCallback, ADD_OBJECT_SERIALIZER( ComputeBoundingBoxCallback,
@ -51,6 +52,15 @@ REGISTER_OBJECT_WRAPPER( Drawable,
ADD_OBJECT_SERIALIZER( EventCallback, osg::Callback, NULL ); // _eventCallback ADD_OBJECT_SERIALIZER( EventCallback, osg::Callback, NULL ); // _eventCallback
ADD_OBJECT_SERIALIZER( CullCallback, osg::Callback, NULL ); // _cullCallback ADD_OBJECT_SERIALIZER( CullCallback, osg::Callback, NULL ); // _cullCallback
ADD_OBJECT_SERIALIZER( DrawCallback, osg::Drawable::DrawCallback, NULL ); // _drawCallback ADD_OBJECT_SERIALIZER( DrawCallback, osg::Drawable::DrawCallback, NULL ); // _drawCallback
{
//now provided by Node's serialization
UPDATE_TO_VERSION_SCOPED( 156 )
REMOVE_SERIALIZER( StateSet )
REMOVE_SERIALIZER( UpdateCallback )
REMOVE_SERIALIZER( EventCallback )
REMOVE_SERIALIZER( CullCallback )
REMOVE_SERIALIZER( DrawCallback )
}
{ {
UPDATE_TO_VERSION_SCOPED( 142 ) UPDATE_TO_VERSION_SCOPED( 142 )