示例#1
0
RtVoid
RiPointsPolygons(RtInt npolys, RtInt nverts[], RtInt verts[], ...)
{
    RtInt      n;
    va_list    args;
    RtToken   *tokens;
    RtPointer *params;

    va_start(args, verts);

    n = ri_util_paramlist_build(args, &tokens, &params);

    va_end(args);

    if (n == 0) return;

    RiPointsPolygonsV(npolys, nverts, verts, n, tokens, params);

    ri_util_paramlist_free(tokens, params);

    return;
}
示例#2
0
//-*****************************************************************************
void ProcessPolyMesh( IPolyMesh &polymesh, ProcArgs &args )
{
    IPolyMeshSchema &ps = polymesh.getSchema();

    TimeSamplingPtr ts = ps.getTimeSampling();

    SampleTimeSet sampleTimes;
    GetRelevantSampleTimes( args, ts, ps.getNumSamples(), sampleTimes );

    bool multiSample = sampleTimes.size() > 1;

    if ( multiSample ) { WriteMotionBegin( args, sampleTimes ); }


    for ( SampleTimeSet::iterator iter = sampleTimes.begin();
          iter != sampleTimes.end(); ++ iter )
    {

        ISampleSelector sampleSelector( *iter );

        IPolyMeshSchema::Sample sample = ps.getValue( sampleSelector );

        RtInt npolys = (RtInt) sample.getFaceCounts()->size();

        ParamListBuilder paramListBuilder;

        paramListBuilder.add( "P", (RtPointer)sample.getPositions()->get() );

        IV2fGeomParam uvParam = ps.getUVsParam();
        if ( uvParam.valid() )
        {
            ICompoundProperty parent = uvParam.getParent();
            
            
            if ( !args.flipv )
            {
                AddGeomParamToParamListBuilder<IV2fGeomParam>(
                    parent,
                    uvParam.getHeader(),
                    sampleSelector,
                    "float",
                    paramListBuilder,
                    2,
                    "st");
            }
            else if ( std::vector<float> * values =
                    AddGeomParamToParamListBuilderAsFloat<IV2fGeomParam, float>(
                        parent,
                        uvParam.getHeader(),
                        sampleSelector,
                        "float",
                        paramListBuilder,
                        "st") )
            {
                for ( size_t i = 1, e = values->size(); i < e; i += 2 )
                {
                    (*values)[i] = 1.0 - (*values)[i];
                }
            }
        }
        IN3fGeomParam nParam = ps.getNormalsParam();
        if ( nParam.valid() )
        {
            ICompoundProperty parent = nParam.getParent();
            
            AddGeomParamToParamListBuilder<IN3fGeomParam>(
                parent,
                nParam.getHeader(),
                sampleSelector,
                "normal",
                paramListBuilder);

        }



        ICompoundProperty arbGeomParams = ps.getArbGeomParams();
        AddArbitraryGeomParams( arbGeomParams,
                    sampleSelector, paramListBuilder );

        RiPointsPolygonsV(
            npolys,
            (RtInt*) sample.getFaceCounts()->get(),
            (RtInt*) sample.getFaceIndices()->get(),
            paramListBuilder.n(),
            paramListBuilder.nms(),
            paramListBuilder.vals() );
    }

    if (multiSample) RiMotionEnd();

}