Hi Simon,

Simon Haegler wrote:

there is no nice way, but you can do something like this. For the first render frame walk through all materials und call activate and deactivate on each TextureChunk.


(newbie alert)

i tried to use the traversal function to do this, but i see no change (only wild tumbling solves the problem):

...
traverse(scene, osgTypedFunctionFunctor1CPtrRef<Action::ResultE,
  NodePtr>(wakeupTextures));
...

and

Action::ResultE wakeupTextures(NodePtr& node)
{
if(node->getCore()->getType().isDerivedFrom(Geometry::getClassType())) {
MaterialPtr matPtr = GeometryPtr::dcast(node->getCore())->getMaterial();
    ChunkMaterialPtr chunkMatPtr =
      ChunkMaterialPtr::dcast(matPtr);
    if ((chunkMatPtr != NullFC) &&
        (!chunkMatPtr->getChunks().empty())) {
      StateChunkPtr chunkPtr = chunkMatPtr->getChunks(0);
      TextureChunkPtr::dcast(chunkPtr)->deactivate(renderAction);
      TextureChunkPtr::dcast(chunkPtr)->activate(renderAction);
    }
  }
  return Action::Continue;
}

is this the way to do it? ;-)

Not bad, but not complete. ;) It assumes that there are no MaterialGroups, and (that's more serious) that your materials only have one texture, which is in Chunk 0. You should go through all the chunks, and it would be safer to not use the Chunks list, but to update the actual state, as some Chunks might be hidden inside the Material.

Hope it helps

   Dirk



-------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
Opensg-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/opensg-users

Reply via email to