Marco Crocetta (onyx++at++datamat.it)
Mon, 13 Mar 95 19:04:21 MET
I'm still working at my trasparency problem.
What Angus suggested works very well (thanks!) but the problem
is that my goal is to change ONLY the alpha value of the
material(s) belonging to a certain model.
In other words I want an exact copy of a models but
with a different Alpha value for the material.
A call to pfApplyMtl(), unfortunately, take effect over
the whole rgba values of my materials.
So I tried a different way: there are in libpfutil some traverser
utilities that I tried to modify.
I have modified the cbPrintNodeInfo() so that, when a pfGeode is
detected the function tries to change the pfGeoState connected
with all the pfGSet under the Geode:
mycbPrintNodeInfo(pfuTraverser *trav)
{
pfMaterial *material;
pfGeoState *state;
.......
switch (pfGetType(node))
{
case PFTYPE_GEODE:
{
long nGSets = pfGetNumGSets((pfGeode *)node);
long i;
for (i = 0 ; i < nGSets ; i++)
{
.....standard things ....
/*Get State*/
state=pfGetGSetGState((pfGeoSet *)gd);
/*Get Material*/
material = pfGetGStateAttr(state, PFSTATE_FRONTMTL);
/*Change Material*/
pfMtlAlpha(material,0.4);
pfGStateAttr(state,PFSTATE_FRONTMTL,material);
pfMtlColorMode(material, PFMTL_BOTH, PFMTL_CMODE_COLOR);
pfGSetGState(gd,state);
}
}
}
}
Then I have two shared instances of the same model under two different
groups belonging to the same scene, and I apply my traverse function
to one of them...The result is that both models are transparent because
they share the same pfGSet...
So there is no way to set ONLY a material alpha on certain
nodes???
Thanks in advance
------------------------------
Marco Crocetta
DATAMAT SpA, Rome
e-mail onyx++at++datamat.it
------------------------------
This archive was generated by hypermail 2.0b2 on Mon Aug 10 1998 - 17:51:04 PDT