示例#1
0
void Example1_CurvesIn()
{
    IArchive archive( Alembic::AbcCoreHDF5::ReadArchive(), "curves1.abc" );
    std::cout << "Reading: " << archive.getName() << std::endl;

    std::cout <<"constructing curves" << std::endl;
    ICurves myCurves( IObject( archive, kTop) , "reallly_long_curves_name");
    std::cout << "getting schema" << std::endl;
    ICurvesSchema &curves = myCurves.getSchema();
    std::cout << "done getting schema" << std::endl;

    // get the samples from the curves
    ICurvesSchema::Sample curvesSample;
    curves.get( curvesSample );

    // test the bounding box
    TESTING_ASSERT( curvesSample.getSelfBounds().min == V3d( -1.0, -1.0, -1.0 ) );
    std::cout << "bounds max " << curvesSample.getSelfBounds().max << std::endl;
    TESTING_ASSERT( curvesSample.getSelfBounds().max == V3d( 1.0, 1.0, 1.0 ) );

    // test other attributes
    TESTING_ASSERT( curvesSample.getPositions() -> size() == 12);

    IFloatGeomParam::Sample widthSample;
    curves.getWidthsParam().getExpanded( widthSample );
    TESTING_ASSERT( widthSample.getVals()->size() == 12);
    TESTING_ASSERT( curves.getWidthsParam().valid() );
    TESTING_ASSERT( widthSample.getScope() == kVertexScope );


}
示例#2
0
//-*****************************************************************************
void ICurvesDrw::setTime( chrono_t iSeconds )
{
    IObjectDrw::setTime( iSeconds );

    // Use nearest for now.
    ISampleSelector ss( iSeconds, ISampleSelector::kNearIndex );
    ICurvesSchema::Sample curvesSample;
    if ( m_curves.getSchema().getNumSamples() > 0 )
    { m_curves.getSchema().get( curvesSample, ss ); }
    else
    { return; }

    m_positions = curvesSample.getPositions();
    m_nCurves = curvesSample.getNumCurves();

    m_nVertices = curvesSample.getCurvesNumVertices();

    m_bounds.makeEmpty();

    m_bounds.extendBy( curvesSample.getSelfBounds() );
}
示例#3
0
void Example2_CurvesIn()
{
    IArchive archive( Alembic::AbcCoreOgawa::ReadArchive(), "curves2.abc" );

    ICurves myCurves( IObject( archive, kTop) , "nurbsCurve");
    ICurvesSchema &curves = myCurves.getSchema();

    // get the samples from the curves
    ICurvesSchema::Sample curvesSample;
    curves.get( curvesSample );

    // test the bounding box
    TESTING_ASSERT( curvesSample.getSelfBounds().min == V3d( -1.0, -1.0, -1.0 ) );
    TESTING_ASSERT( curvesSample.getSelfBounds().max == V3d( 1.0, 1.0, 1.0 ) );

    // test other attributes
    TESTING_ASSERT( curvesSample.getPositions() -> size() == 12);

    TESTING_ASSERT( curvesSample.getType() == kVariableOrder );
    TESTING_ASSERT( curvesSample.getWrap() == kNonPeriodic );
    TESTING_ASSERT( curvesSample.getBasis() == kBezierBasis );
    TESTING_ASSERT( ( *curvesSample.getOrders() )[0] == 4 );
    TESTING_ASSERT( ( *curvesSample.getOrders() )[1] == 2 );
    TESTING_ASSERT( curvesSample.getPositionWeights()->size() == 12 );
    TESTING_ASSERT( curvesSample.getKnots()->size() == 18 );

    IFloatGeomParam::Sample widthSample;
    curves.getWidthsParam().getExpanded( widthSample );
    TESTING_ASSERT( widthSample.getVals()->size() == 12);
    TESTING_ASSERT( curves.getWidthsParam().valid() );
    TESTING_ASSERT( widthSample.getScope() == kVertexScope );

    IFloatArrayProperty knotsProp = curves.getKnotsProperty();
    TESTING_ASSERT( knotsProp.getNumSamples() == 2 );
    ArraySampleKey keyA, keyB;
    knotsProp.getKey( keyA, 0 );
    knotsProp.getKey( keyB, 1 );
    TESTING_ASSERT( keyA == keyB );
}