hi all,
i am kinda new to openSG stuff. I am coming from a quite intense month of
OpenGL develop so no i am doing some exp on this new library.
Here is my problem: I want to override the usual phong lighting stuff, with
my own shadowing tecnique (based on spherical harmonics theory). I have my
good triangled mesh with her material stuff (ambient, diffuse and specular).
Now in my opinion the best way is calculating all the lighing thing per
vertex, altering the vertex color property. ---> how can i do it? Leaving
the problem of specular reflections, I understand that the "base" color of
the mesh should be the one of the diffuse material. Ambient can be 0 since
i'll radiosity it before any rendering loop.
I tried to set the per vertex property in this way:
void rhrecursewrite(NodePtr root)
{
//////////////////////////////////////////////////////
////// RH! PROVA DI OUTPUT!!!
/// *********************************** ///////////
static int level=0;
for (int cicci=0; cicci<=root->getNChildren();++cicci)
{
if (root->getCore()->getType().isDerivedFrom( Geometry::getClassType()))
{
GeometryPtr geo=GeometryPtr::dcast(root->getCore());
for (TriangleIterator it= geo->beginTriangles();
it!=geo->endTriangles() ; ++it)
{
Color3f giallo;
giallo.setValuesRGB(1.0,1.0,0.0);
GeoColorsPtr geogiallo;
// HERE I'D LIKE TO SET UP MY CUSTON COLOR
// FOR EACH VERTEX OF THE MESH.
//beginEditCP(geogiallo , Geometry::ColorsFieldMask);
geogiallo->push_back(giallo);
// endEditCP (geogiallo, Geometry::ColorsFieldMask);
}
}
if ( cicci < root->getNChildren() )
rhrecursewrite(root->getChild(cicci));
}
}
Once i have the mesh triangles intercepted by the iterator how can i set the
color array (with the right indexing). The code i just posted hangs in the
geogiallo->push_back instruction...
Hope anyone can help me!!!!
bye the Gunslinger
_________________________________________________________________
Personalizza MSN Messenger con sfondi e fotografie!
http://www.ilovemessenger.msn.it/
-------------------------------------------------------
The SF.Net email is sponsored by EclipseCon 2004
Premiere Conference on Open Tools Development and Integration
See the breadth of Eclipse activity. February 3-5 in Anaheim, CA.
http://www.eclipsecon.org/osdn
_______________________________________________
Opensg-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/opensg-users