From: Goncalo Carvalho (G.Carvalho++at++staff.gsa.ac.uk)
Date: 09/13/2002 02:08:25
>
> The individual components of the color (ambient, difficuse, emissive &
> specular) only get compared when the side is set. This is not strictly
> correct but it must remain this way so as to ensure backward
> compatibility.
>
> To make this code work just add:
>
> mtl->setSide(PFMTL_FRONT);
> mtl2->setSide(PFMTL_FRONT);
>
> A+,
>
This is not entirely correct. Altering the program as you suggest does
not make a difference in the output.
Altering the program to the following:
#include <Performer/pf.h>
#include <Performer/pr/pfMaterial.h>
int main( )
{
pfInit( );
pfMultiprocess( PFMP_DEFAULT );
pfConfig( );
pfMaterial* mtl1 = new pfMaterial;
mtl1->setColor( PFMTL_AMBIENT, 0.0f, 0.0f, 0.0f );
mtl1->setColor( PFMTL_DIFFUSE, 0.0f, 0.0f, 0.0f );
mtl1->setColor( PFMTL_SPECULAR, 0.0f, 0.0f, 0.0f );
mtl1->setShininess( 0.0f );
mtl1->setAlpha( 0.0f );
//mtl1->setSide( PFMTL_FRONT );
pfMaterial* mtl2 = new pfMaterial;
mtl2->setColor( PFMTL_AMBIENT, 0.0f, 0.0f, 0.0f );
mtl2->setColor( PFMTL_DIFFUSE, 0.0f, 0.0f, 0.0f );
mtl2->setColor( PFMTL_SPECULAR, 0.0f, 0.0f, 1.0f );
mtl2->setShininess( 0.0f );
mtl2->setAlpha( 0.0f );
//mtl2->setSide( PFMTL_FRONT );
if( !mtl2->compare( mtl1 ) )
pfNotify( PFNFY_NOTICE, PFNFY_PRINT, "MTL1 equal to MTL2" );
else
pfNotify( PFNFY_NOTICE, PFNFY_PRINT, "MTL1 different of MTL2" );
pfExit( );
}
produces the result MTL1 different of MTL2. So the individual color
components must somehow being compared.
As for state sorting the visual effect of this two materials being
applied are different. They must not compare equal. Doesn't this make
pfdMakeShared to break? You will have two materials that produce
different visual results but pfdMakeShared would collapse them to a
single one, and the visual results would not be correct.
Goncalo
This archive was generated by hypermail 2b29 : Fri Sep 13 2002 - 02:31:35 PDT