Hello,

okay, I have the feeling my question is not quite new.
In case there has already been a thread in this
mailing list covering the topic, please send me simply
the subject of that thread.

How about using multiple materials in one NodeCore? Is
there a reason against it?

Currently I have an object which has to be drawn with
several materials. For each material, I'm building a
NodeCore derived from MaterialDrawable, which keeps a
list of the faces of my object to be drawn using that
material.
It would be much simpler to just have one NodeCore
with my object and a list of materials.

Is it possible to do something like this (altered from
OSGMaterialDrawable.cpp):

Action::ResultE MyNodeCore::renderActionHandler(Action
*action)
{
  RenderAction *a = dynamic_cast<RenderAction
*>(action);

  Material::DrawFunctor func;
  func = osgTypedMethodFunctor1ObjPtr(this,
MyNodeCore::drawPrimitives);

  for(<< each mat in getMFMaterials() >>)
    a->dropFunctor(func, mat.getCPtr());

  return Action::Continue;
}

Action::ResultE MyNodeCore::drawPrimitives(Action
*action)
{
  RenderAction *a = dynamic_cast<RenderAction
*>(action);
  Material *m=a->getMaterial();
  myObject.drawFacesOfThisMaterial(m);
}


Björn



        
                
___________________________________________________________ 
Gesendet von Yahoo! Mail - Jetzt mit 250MB Speicher kostenlos - Hier anmelden: 
http://mail.yahoo.de


-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users.
Discover which products truly live up to the hype. Start reading now.
http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click
_______________________________________________
Opensg-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/opensg-users

Reply via email to