[info-performer] pfGeoSet::getPrimLengths()

Date view Thread view Subject view Author view

From: faculaganymede (faculaganymede++at++yahoo.com)
Date: 10/28/2003 16:38:14


pfExperts,

Doesn't gset->getPrimLengths() return the correct
number of vertices for a primitive regardless of the
primitive type?

I am looking at some code used to count the number of
vertices for primitives in a pfGeoSet as follow:

-------------------------------------------------
         num_primitives = gset->getNumPrims();
    num_vertices = 0;

    switch( gset->getPrimType() )
    {
        case PFGS_POINTS :
            num_vertices = num_primitives;
            break;

        case PFGS_LINES :
            num_vertices = 2 * num_primitives;
            break;

        case PFGS_TRIS :
            num_vertices = 3 * num_primitives;
            break;

        case PFGS_QUADS :
            num_vertices = 4 * num_primitives;
            break;

        case PFGS_TRISTRIPS :
        case PFGS_FLAT_TRISTRIPS :
        case PFGS_POLYS :
        case PFGS_LINESTRIPS :
        case PFGS_FLAT_LINESTRIPS :
        case PFGS_FLAT_TRISTRIPS :
        case PFGS_FLAT_TRIFANS :

            lens = gset->getPrimLengths();
            for( i = 0; i < num_primitives; i++ )
                num_vertices += lens[i];
            break;
    }
-------------------------------------------------
?
?
? For the following primitive types, it offsets the
? num_vertices count. Is this necessary? Doesn't
? gset->getPrimLengths() return the correct number of
? vertices for a primitive regardless of the primitive
? type?
?
?
-------------------------------------------------

    int flat_shaded_offset=0;
    if (primitive_type == PFGS_FLAT_LINESTRIPS)
flat_shaded_offset=num_primitives;
    else if (primitive_type == PFGS_FLAT_TRISTRIPS)
flat_shaded_offset=2*num_primitives;
    else if (primitive_type == PFGS_FLAT_TRIFANS)
flat_shaded_offset=2*num_primitives;
    
    num_vertices = num_vertices - flat_shaded_offset
    
-------------------------------------------------

=====
Thanks,
faculaganymede

__________________________________
Do you Yahoo!?
Exclusive Video Premiere - Britney Spears
http://launch.yahoo.com/promos/britneyspears/


Date view Thread view Subject view Author view

This archive was generated by hypermail 2b29 : Tue Oct 28 2003 - 16:41:19 PST