Hi Gerrit,
I do have some more information. After loading of the root.osb model I only
see a ChunkMaterial instead of the original SimpleMaterial of the model.
I.e I did wrote the following scanner in 1.8 (enter function only shown)
which I run after model file load:
OSG::Action::ResultE enter(OSG::NodePtr& node)
{
using namespace OSG;
NodeCorePtr core = node->getCore();
MaterialGroupPtr mgrp = MaterialGroupPtr::dcast(core);
if (mgrp != NullFC)
{
MaterialPtr mat = mgrp->getMaterial();
SwitchMaterialPtr smat = SwitchMaterialPtr::dcast(mat);
if (smat) {
ChunkMaterialPtr chunkmat =
ChunkMaterialPtr::dcast((*smat->getMFMaterials())[0]);
SimpleMaterialPtr test =
SimpleMaterialPtr::dcast((*smat->getMFMaterials())[0]);
if (test == NullFC) {
....
}
}
}
return Action::Continue;
}
The scanner respects my root.osb graph layout.
MaterialNode - MaterialGroup - SwitchMaterial - 0 - SimpleMaterial -
TextureChunk, ...
|
GeometryNode - Geometry
Here the if(test == NullFC) block is correctly not executed since the chunk
material actualley is a SimpleMaterial.
Not so on the OpenSG 2.0 version. The very same test
OSG::Action::ResultE enter(OSG::Node* node)
{
using namespace OSG;
NodeCore* core = node->getCore();
MaterialGroup* mgrp = dynamic_cast<MaterialGroup*>(core);
if (mgrp)
{
Material* mat = mgrp->getMaterial();
SwitchMaterial* switchMat = dynamic_cast<SwitchMaterial*>(mat);
if (switchMat) {
ChunkMaterial* chunkmat =
dynamic_cast<ChunkMaterial*>((*switchMat->getMFMaterials())[0]);
SimpleMaterial* test =
dynamic_cast<SimpleMaterial*>((*switchMat->getMFMaterials())[0]);
if (!test) {
...
}
}
}
return Action::Continue;
}
does run into the if (!test) block. The chunk material is not a
SimpleMaterial anymore!? In both test the chunkmat object is valid an can be
used.
So my current question is why does the models SimpleMaterial transforms into
a ChunkMaterial?
Best,
Johannes
------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day
trial. Simplify your report design, integration and deployment - and focus on
what you do best, core application coding. Discover what's new with
Crystal Reports now. http://p.sf.net/sfu/bobj-july
_______________________________________________
Opensg-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/opensg-users