From Roland Smeenk, "Overview of the Collada/dae plugin changes
New features +Read and write of osg::LOD, osg::Switch, osgSim::Sequence, osgim::MultiSwitch and osgSim::DOFTransform data in <extra> +Read and write of osg::Node description data in <extra> +Plugin option "NoExtras" to prevent writing of <extra> data and only traverse the active children when saving Changes/additions +instanced_geometry and instanced_controller are now loaded in a single Geode with multiple Geometries instead of multiple geodes with a single Geometry +Changed all calls to the deprecated createAndPlace() to the new add() methods +All transformation elements <scale>, <rotate>, <translate>, <lookat>, <matrix>, <skew> are now concatenated properly in to a single MatrixTransform. Previously this was not done in order as required by Collada and and not all elements were included. +Complete skew matrix creation +Automatically add GL_RESCALE_NORMAL if scale is non-identity +Blinn shininess remapping to [0,128] when in range [0,1] +Changes to CMake file to make it compile on Windows +Coding style and code documentation Bug fixes +Transparent texture writing fixed +Fixed bug in using osg node name as collada node ID +Fixed usage of double sided faces in GOOGLEEARTH extra +Not adding blendfunc and blendcolor when opaque TODO/Wishlist -solve differences in drawables, DAE reader should place multiple collation elements into multiple primitivesets in a single geometry where possible (only when same material) -solve differences in matrices -multitexture support -skinned mesh and generic animations using osgAnimation -profile_GLSL based on COLLADA OpenGL Effects Viewer http://ati.amd.com/developer/rendermonkey/downloads.html -handling more <extra> to more closely mimic the intended lighting"
This commit is contained in:
@@ -14,6 +14,7 @@
|
||||
#include <memory>
|
||||
|
||||
#include <osg/Notify>
|
||||
#include <osg/NodeVisitor>
|
||||
#include <osgDB/ReaderWriter>
|
||||
#include <osgDB/FileNameUtils>
|
||||
#include <osgDB/Registry>
|
||||
@@ -40,7 +41,7 @@ ReaderWriterDAE::readNode(const std::string& fname,
|
||||
DAE* pDAE = NULL;
|
||||
|
||||
if ( options )
|
||||
pDAE = (DAE*) options->getPluginData("DAE");
|
||||
pDAE = (DAE*)options->getPluginData("DAE");
|
||||
|
||||
std::string ext( osgDB::getLowerCaseFileExtension(fname) );
|
||||
if( ! acceptsExtension(ext) ) return ReadResult::FILE_NOT_HANDLED;
|
||||
@@ -103,31 +104,32 @@ ReaderWriterDAE::writeNode( const osg::Node& node,
|
||||
if( ! acceptsExtension(ext) ) return WriteResult::FILE_NOT_HANDLED;
|
||||
|
||||
// Process options
|
||||
bool usePolygon(false);
|
||||
bool GoogleMode(false);
|
||||
bool usePolygon(false); // Use plugin option "polygon" to enable
|
||||
bool GoogleMode(false); // Use plugin option "GoogleMode" to enable
|
||||
bool writeExtras(true); // Use plugin option "NoExtras" to disable
|
||||
if( options )
|
||||
{
|
||||
pDAE = (DAE*) options->getPluginData("DAE");
|
||||
pDAE = (DAE*)options->getPluginData("DAE");
|
||||
std::istringstream iss( options->getOptionString() );
|
||||
std::string opt;
|
||||
|
||||
while( std::getline( iss, opt, ',' ) )
|
||||
{
|
||||
if( opt == "polygon") usePolygon = true;
|
||||
else if (opt == "GoogleMode") GoogleMode = true;
|
||||
else
|
||||
while( std::getline( iss, opt, ',' ) )
|
||||
{
|
||||
osg::notify(osg::WARN)
|
||||
<< "\n" "COLLADA dae plugin: unrecognized option \"" << opt << "\"\n"
|
||||
<< "comma-delimited options:\n"
|
||||
<< "\tpolygon = use polygons instead of polylists for element\n"
|
||||
<< "\tGoogleMode = write files suitable for use by Google products\n"
|
||||
<< "example: osgviewer -O polygon bar.dae" "\n"
|
||||
<< std::endl;
|
||||
if( opt == "polygon") usePolygon = true;
|
||||
else if (opt == "GoogleMode") GoogleMode = true;
|
||||
else if (opt == "NoExtras") writeExtras = false;
|
||||
else
|
||||
{
|
||||
osg::notify(osg::WARN)
|
||||
<< std::endl << "COLLADA dae plugin: unrecognized option \"" << opt << std::endl
|
||||
<< "comma-delimited options:" << std::endl << std::endl
|
||||
<< "\tpolygon = use polygons instead of polylists for element" << std::endl
|
||||
<< "\tGoogleMode = write files suitable for use by Google products" << std::endl
|
||||
<< "example: osgviewer -O polygon bar.dae" << std::endl << std::endl;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (NULL == pDAE)
|
||||
{
|
||||
bOwnDAE = true;
|
||||
@@ -137,7 +139,9 @@ ReaderWriterDAE::writeNode( const osg::Node& node,
|
||||
// Convert file name to URI
|
||||
std::string fileURI = ConvertFilePathToColladaCompatibleURI(fname);
|
||||
|
||||
osgdae::daeWriter daeWriter(pDAE, fileURI, usePolygon, GoogleMode );
|
||||
osg::NodeVisitor::TraversalMode traversalMode = writeExtras ? osg::NodeVisitor::TRAVERSE_ALL_CHILDREN : osg::NodeVisitor::TRAVERSE_ACTIVE_CHILDREN;
|
||||
|
||||
osgdae::daeWriter daeWriter(pDAE, fileURI, usePolygon, GoogleMode, traversalMode, writeExtras);
|
||||
daeWriter.setRootNode( node );
|
||||
const_cast<osg::Node*>(&node)->accept( daeWriter );
|
||||
|
||||
|
||||
Reference in New Issue
Block a user