• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C++ TimeSamplingPtr类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C++中TimeSamplingPtr的典型用法代码示例。如果您正苦于以下问题:C++ TimeSamplingPtr类的具体用法?C++ TimeSamplingPtr怎么用?C++ TimeSamplingPtr使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



在下文中一共展示了TimeSamplingPtr类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: getSubDTimeSpan

void getSubDTimeSpan(ISubD iSub, chrono_t& first, chrono_t& last) {

	ISubDSchema mesh = iSub.getSchema();
	TimeSamplingPtr ts = mesh.getTimeSampling();
	first = std::min(first, ts->getSampleTime(0) );
	last = std::max(last, ts->getSampleTime(mesh.getNumSamples()-1) );
}
开发者ID:nrusch,项目名称:ABCNuke,代码行数:7,代码来源:ABCNuke_ArchiveHelper.cpp


示例2: getABCTimeSpan

//-*****************************************************************************
void getABCTimeSpan(IArchive archive, chrono_t& first, chrono_t& last)
{
	// TO DO: Is the childBounds property reliable to get the full archive's span?

	if (!archive.valid())
		return;

	IObject archiveTop = archive.getTop();
    if ( archiveTop.getProperties().getPropertyHeader( ".childBnds" ) != NULL ) { // Try to get timing from childBounds first

        IBox3dProperty childbnds = Alembic::Abc::IBox3dProperty( archive.getTop().getProperties(),
                                   ".childBnds", ErrorHandler::kQuietNoopPolicy); 
    	TimeSamplingPtr ts = childbnds.getTimeSampling();
		first = std::min(first, ts->getSampleTime(0) );
		last = std::max(last, ts->getSampleTime(childbnds.getNumSamples()-1) );
        return;
    }

	unsigned int numChildren = archiveTop.getNumChildren();

	for (unsigned i=0; i<numChildren; ++i)  // Visit every object to get its first and last sample
	{
		IObject obj( archiveTop.getChild( i ));
		getObjectTimeSpan(obj, first, last, true);

	}

}
开发者ID:ivanbusquets,项目名称:ABCNuke,代码行数:29,代码来源:ABCNuke_ArchiveHelper.cpp


示例3: getCameraTimeSpan

void getCameraTimeSpan(ICamera iCam, chrono_t& first, chrono_t& last) {

	ICameraSchema cam = iCam.getSchema();
	TimeSamplingPtr ts = cam.getTimeSampling();
	first = std::min(first, ts->getSampleTime(0) );
	last = std::max(last, ts->getSampleTime(cam.getNumSamples()-1) );
}
开发者ID:nrusch,项目名称:ABCNuke,代码行数:7,代码来源:ABCNuke_ArchiveHelper.cpp


示例4: IObjectDrw

//-*****************************************************************************
IPolyMeshDrw::IPolyMeshDrw( IPolyMesh &iPmesh, std::vector<std::string> path )
  : IObjectDrw( iPmesh, false, path )
  , m_polyMesh( iPmesh )
{
    // Get out if problems.
    if ( !m_polyMesh.valid() )
    {
        return;
    }

    if ( m_polyMesh.getSchema().getNumSamples() > 0 )
    {
        m_polyMesh.getSchema().get( m_samp );
    }

    m_boundsProp = m_polyMesh.getSchema().getSelfBoundsProperty();

    // The object has already set up the min time and max time of
    // all the children.
    // if we have a non-constant time sampling, we should get times
    // out of it.
    TimeSamplingPtr iTsmp = m_polyMesh.getSchema().getTimeSampling();
    if ( !m_polyMesh.getSchema().isConstant() )
    {
        size_t numSamps =  m_polyMesh.getSchema().getNumSamples();
        if ( numSamps > 0 )
        {
            chrono_t minTime = iTsmp->getSampleTime( 0 );
            m_minTime = std::min( m_minTime, minTime );
            chrono_t maxTime = iTsmp->getSampleTime( numSamps-1 );
            m_maxTime = std::max( m_maxTime, maxTime );
        }
    }
    m_drwHelper.setName(m_object.getFullName());
}
开发者ID:BlueBolt,项目名称:bb_alembicArchiveNode,代码行数:36,代码来源:IPolyMeshDrw.cpp


示例5: IObjectDrw

//-*****************************************************************************
ISubDDrw::ISubDDrw( ISubD &iPmesh )
  : IObjectDrw( iPmesh, false )
  , m_subD( iPmesh )
{
    // Get out if problems.
    if ( !m_subD.valid() )
    {
        return;
    }


    // The object has already set up the min time and max time of
    // all the children.
    // if we have a non-constant time sampling, we should get times
    // out of it.
    TimeSamplingPtr iTsmp = m_subD.getSchema().getTimeSampling();
    if ( !m_subD.getSchema().isConstant() )
    {
        size_t numSamps =  m_subD.getSchema().getNumSamples();
        if ( numSamps > 0 )
        {
            chrono_t minTime = iTsmp->getSampleTime( 0 );
            m_minTime = std::min( m_minTime, minTime );
            chrono_t maxTime = iTsmp->getSampleTime( numSamps-1 );
            m_maxTime = std::max( m_maxTime, maxTime );
        }
    }
}
开发者ID:oyaGG,项目名称:helgemathee-alembic-softimage,代码行数:29,代码来源:ISubDDrw.cpp


示例6: getPolyMeshTimeSpan

void getPolyMeshTimeSpan(IPolyMesh iPoly, chrono_t& first, chrono_t& last) {

	IPolyMeshSchema mesh = iPoly.getSchema();
	TimeSamplingPtr ts = mesh.getTimeSampling();
	first = std::min(first, ts->getSampleTime(0) );
	last = std::max(last, ts->getSampleTime(mesh.getNumSamples()-1) );
}
开发者ID:nrusch,项目名称:ABCNuke,代码行数:7,代码来源:ABCNuke_ArchiveHelper.cpp


示例7: IObjectDrw

//-*****************************************************************************
INuPatchDrw::INuPatchDrw( INuPatch &iNuPatch )
  : IObjectDrw( iNuPatch, false )
  , m_nuPatch( iNuPatch )
{
    // create our nurb renderer.
    nurb = gluNewNurbsRenderer();

    gluNurbsProperty(nurb, GLU_SAMPLING_TOLERANCE, 25.0);
    gluNurbsProperty(nurb, GLU_DISPLAY_MODE, GLU_FILL);

    // Get out if problems.
    if ( !m_nuPatch.valid() )
    {
        return;
    }


    // The object has already set up the min time and max time of
    // all the children.
    // if we have a non-constant time sampling, we should get times
    // out of it.
    TimeSamplingPtr iTsmp = m_nuPatch.getSchema().getTimeSampling();
    if ( !m_nuPatch.getSchema().isConstant() )
    {
        size_t numSamps = m_nuPatch.getSchema().getNumSamples();
        if ( numSamps > 0 )
        {
            chrono_t minTime = iTsmp->getSampleTime( 0 );
            m_minTime = std::min( m_minTime, minTime );
            chrono_t maxTime = iTsmp->getSampleTime( numSamps-1 );
            m_maxTime = std::max( m_maxTime, maxTime );
        }
    }
}
开发者ID:AWhetter,项目名称:alembic,代码行数:35,代码来源:INuPatchDrw.cpp


示例8: init

/**
 * init
 */
bool UMAbcNurbsPatch::init(bool recursive)
{
	if (!is_valid()) return false;
	
	// // create our nurb renderer.
	// nurb = gluNewNurbsRenderer();

	// gluNurbsProperty(nurb, GLU_SAMPLING_TOLERANCE, 25.0);
	// gluNurbsProperty(nurb, GLU_DISPLAY_MODE, GLU_FILL);

	size_t num_samples = patch_.getSchema().getNumSamples();
	if (num_samples > 0)
	{
		// get constant sample
		patch_.getSchema().get(initial_sample_);
		
		// if not consistant, we get time
		if (!patch_.getSchema().isConstant())
		{
			TimeSamplingPtr time = patch_.getSchema().getTimeSampling();
			min_time_ = static_cast<unsigned long>(time->getSampleTime(0)*1000);
			max_time_ = static_cast<unsigned long>(time->getSampleTime(num_samples-1)*1000);
		}
	}

	return false;
}
开发者ID:uimac,项目名称:burger2,代码行数:30,代码来源:UMAbcNurbsPatch.cpp


示例9: getXformTimeSpan

void getXformTimeSpan(IXform iXf, chrono_t& first, chrono_t& last, bool inherits) {

	IXformSchema xf = iXf.getSchema();
	TimeSamplingPtr ts = xf.getTimeSampling();
	first = std::min(first, ts->getSampleTime(0) );
	if (xf.isConstant()) {
		last = first;
	}
	else {
		last = std::max(last, ts->getSampleTime(xf.getNumSamples()-1) );
	}
	if (inherits && xf.getInheritsXforms()) {
		IObject parent = iXf.getParent();

		// Once the Archive's Top Object is reached, IObject::getParent() will
		// return an invalid IObject, and that will evaluate to False.
		while ( parent )
		{
			if ( Alembic::AbcGeom::IXform::matches(parent.getHeader()) ) {
				IXform x( parent, kWrapExisting );
				getXformTimeSpan(x, first, last, inherits);
			}
		}

	}
}
开发者ID:ivanbusquets,项目名称:ABCNuke,代码行数:26,代码来源:ABCNuke_ArchiveHelper.cpp


示例10:

void ofxAlembic::IGeom::update_timestamp(T& object)
{
	TimeSamplingPtr iTsmp = object.getSchema().getTimeSampling();
	if (!object.getSchema().isConstant())
	{
		size_t numSamps =  object.getSchema().getNumSamples();
		if (numSamps > 0)
		{
			m_minTime = iTsmp->getSampleTime(0);
			m_maxTime = iTsmp->getSampleTime(numSamps - 1);
		}
	}
}
开发者ID:perfume-dev,项目名称:ofxAlembic,代码行数:13,代码来源:ofxAlembicReader.cpp


示例11: simpleTestIn

//-*****************************************************************************
void simpleTestIn( const std::string &iArchiveName )
{
    IArchive archive( Alembic::AbcCoreHDF5::ReadArchive(),
                      iArchiveName, ErrorHandler::kThrowPolicy );

    IObject archiveTop = archive.getTop();
    IObject c0( archiveTop, "c0" );
    ICompoundProperty c0Props = c0.getProperties();

    TimeSamplingPtr uts = c0Props.getPtr()->
        getScalarProperty( "uniformdoubleprop" )->getTimeSampling();

    TimeSamplingPtr ats = c0Props.getPtr()->
        getScalarProperty( "acyclicdoubleprop" )->getTimeSampling();

    //IDoubleProperty dp0( c0Props, "uniformdoubleprop" );
    //IDoubleProperty dp1( c0Props, "acyclicdoubleprop" );
    //size_t numReadDoubleSamps = dp0.getNumSamples();
    //TESTING_ASSERT( numReadDoubleSamps == g_numDoubleSamps );
    //TESTING_ASSERT( dp1.getNumSamples() == numReadDoubleSamps );


    //scramble_heap();

    //const TimeSamplingType &utst = uts.getTimeSamplingType();
    const TimeSamplingType utst = c0Props.getPtr()->getScalarProperty(
        "uniformdoubleprop" )->getTimeSampling()->getTimeSamplingType();

    for ( size_t j = 0 ; j < g_numDoubleSamps ; j++ )
    {
        chrono_t utime = uts->getSampleTime( j );
        chrono_t atime = ats->getSampleTime( j );

        chrono_t reftime = g_doubleStartTime + ( j * g_dt );

        std::cout << "reference time: " << reftime << std::endl;

        std::cout << "uniform sample time: " << utime << std::endl;

        std::cout << "acyclic sample time: " << atime << std::endl;

        chrono_t ABSERROR = 0.00001;

        TESTING_ASSERT( Imath::equalWithAbsError( utime, reftime, ABSERROR ) );
        TESTING_ASSERT( Imath::equalWithAbsError( atime, reftime, ABSERROR ) );
        TESTING_ASSERT( Imath::equalWithAbsError( atime, utime, ABSERROR ) );
    }
}
开发者ID:oyaGG,项目名称:helgemathee-alembic-softimage,代码行数:49,代码来源:OctessenceBug17.cpp


示例12: m_xform

ofxAlembic::IXform::IXform(Alembic::AbcGeom::IXform object) : ofxAlembic::IGeom(object), m_xform(object)
{
	TimeSamplingPtr iTsmp = m_xform.getSchema().getTimeSampling();
	if (!m_xform.getSchema().isConstant())
	{
		size_t numSamps =  m_xform.getSchema().getNumSamples();
		if (numSamps > 0)
		{
			chrono_t minTime = iTsmp->getSampleTime(0);
			m_minTime = std::min(m_minTime, minTime);
			chrono_t maxTime = iTsmp->getSampleTime(numSamps - 1);
			m_maxTime = std::max(m_maxTime, maxTime);
		}
	}
	
	type = XFORM;
}
开发者ID:KazuyoshiUeno,项目名称:ofxAlembic,代码行数:17,代码来源:ofxAlembicReader.cpp


示例13: m_polyMesh

ofxAlembic::IPolyMesh::IPolyMesh(Alembic::AbcGeom::IPolyMesh object) : ofxAlembic::IGeom(object), m_polyMesh(object)
{
	TimeSamplingPtr iTsmp = m_polyMesh.getSchema().getTimeSampling();
	if (!m_polyMesh.getSchema().isConstant())
	{
		size_t numSamps =  m_polyMesh.getSchema().getNumSamples();
		if (numSamps > 0)
		{
			chrono_t minTime = iTsmp->getSampleTime(0);
			m_minTime = std::min(m_minTime, minTime);
			chrono_t maxTime = iTsmp->getSampleTime(numSamps - 1);
			m_maxTime = std::max(m_maxTime, maxTime);
		}
	}

	type = POLYMESH;
}
开发者ID:KazuyoshiUeno,项目名称:ofxAlembic,代码行数:17,代码来源:ofxAlembicReader.cpp


示例14: m_curves

ofxAlembic::ICurves::ICurves(Alembic::AbcGeom::ICurves object) : ofxAlembic::IGeom(object), m_curves(object)
{

	TimeSamplingPtr iTsmp = m_curves.getSchema().getTimeSampling();
	if (!object.getSchema().isConstant())
	{
		size_t numSamps = object.getSchema().getNumSamples();
		if (numSamps > 0)
		{
			chrono_t minTime = iTsmp->getSampleTime(0);
			m_minTime = std::min(m_minTime, minTime);
			chrono_t maxTime = iTsmp->getSampleTime(numSamps - 1);
			m_maxTime = std::max(m_maxTime, maxTime);
		}
	}

	type = CURVES;
}
开发者ID:KazuyoshiUeno,项目名称:ofxAlembic,代码行数:18,代码来源:ofxAlembicReader.cpp


示例15: IObjectDrw

//-*****************************************************************************
IPointsDrw::IPointsDrw( IPoints &iPmesh )
    : IObjectDrw( iPmesh, false )
    , m_points( iPmesh )
{
    // Get out if problems.
    if ( !m_points.valid() )
    {
        return;
    }

    // Try to create colors, if possible.
    IPointsSchema &pointsSchema = m_points.getSchema();
    const PropertyHeader *phead = pointsSchema.getPropertyHeader( "Cs" );
    if ( phead && IC3fArrayProperty::matches( *phead ) )
    {
        m_colorProp = IC3fArrayProperty( pointsSchema, "Cs" );
    }

    phead = pointsSchema.getPropertyHeader( "N" );
    if ( phead && IN3fArrayProperty::matches( *phead ) )
    {
        m_normalProp = IN3fArrayProperty( pointsSchema, "N" );
    }

    // The object has already set up the min time and max time of
    // all the children.
    // if we have a non-constant time sampling, we should get times
    // out of it.
    TimeSamplingPtr iTsmp = m_points.getSchema().getTimeSampling();
    if ( !m_points.getSchema().isConstant() )
    {
        size_t numSamps =  m_points.getSchema().getNumSamples();
        if ( numSamps > 0 )
        {
            chrono_t minTime = iTsmp->getSampleTime( 0 );
            m_minTime = std::min( m_minTime, minTime );
            chrono_t maxTime = iTsmp->getSampleTime( numSamps-1 );
            m_maxTime = std::max( m_maxTime, maxTime );
        }
    }
}
开发者ID:AWhetter,项目名称:alembic,代码行数:42,代码来源:IPointsDrw.cpp


示例16: readV3fArrayProperty

void readV3fArrayProperty(const std::string &archiveName, bool useOgawa)
{
    // Open an existing archive for reading. Indicate that we want
    //   Alembic to throw exceptions on errors.
    std::cout  << "Reading " << archiveName << std::endl;
    AbcF::IFactory factory;
    factory.setPolicy(  ErrorHandler::kThrowPolicy );
    AbcF::IFactory::CoreType coreType;
    IArchive archive = factory.getArchive(archiveName, coreType);
    TESTING_ASSERT( (useOgawa && coreType == AbcF::IFactory::kOgawa) ||
                    (!useOgawa && coreType == AbcF::IFactory::kHDF5) );

    IObject archiveTop = archive.getTop();

    // Determine the number of (top level) children the archive has
    const unsigned int numChildren =  archiveTop.getNumChildren();
    ABCA_ASSERT( numChildren == 1, "Wrong number of children (expected 1)");
    std::cout << "The archive has " << numChildren << " children:"
              << std::endl;

    // Iterate through them, print out their names
    IObject child( archiveTop, archiveTop.getChildHeader(0).getName() );
    std::cout << "  named '" << child.getName() << "'";

    // Properties
    ICompoundProperty props = child.getProperties();
    size_t numProperties = props.getNumProperties();  // only top-level props
    ABCA_ASSERT( numProperties == 1,
                 "Expected 1 property, found " << numProperties);
    std::cout << " with one property";

    std::vector<std::string> propNames(1);
    propNames[0] = props.getPropertyHeader(0).getName();
    std::cout << " named '" << propNames[0] << "'" << std::endl;


    PropertyType pType = props.getPropertyHeader(0).getPropertyType();
    ABCA_ASSERT( pType == kArrayProperty,
                 "Expected an array property, but didn't find one" );

    std::cout << " which is an array property";

    DataType dType = props.getPropertyHeader(0).getDataType();
    ABCA_ASSERT( dType.getPod() == kFloat32POD,
                 "Expected an v3f property, but didn't find one" );


    // We know this is an array property (I'm eliding the if/else
    //  statements required to recognize and handle this properly)
    IV3fArrayProperty positions( props, propNames[0] );
    size_t numSamples = positions.getNumSamples();
    std::cout << ".. it has " << numSamples << " samples" << std::endl;
    ABCA_ASSERT( numSamples == 5, "Expected 5 samples, found " << numSamples );

    TimeSamplingPtr ts = positions.getTimeSampling();
    std::cout << "..with time/value pairs: " << std::endl;;
    for (unsigned int ss=0; ss<numSamples; ss++)
    {
        std::cout << "   ";
        ISampleSelector iss( (index_t) ss);
        std::cout << ts->getSampleTime( (index_t) ss ) << " / ";

        V3fArraySamplePtr samplePtr;
        positions.get( samplePtr, iss );
        std::cout << "[ ";
        size_t numPoints = samplePtr->size();
        for ( size_t jj=0 ; jj<numPoints ; jj++ )
            std::cout << (*samplePtr)[jj] << " ";
        std::cout << "]" << std::endl;

        if (ss == 2) // no entries in sample #2
        {
            ABCA_ASSERT( numPoints == 0,
                         "Expected an empty sample, but found " << numPoints
                         << " entries." );
        }
        else
        {
            for ( size_t jj=0 ; jj<numPoints ; jj++ )
                ABCA_ASSERT( (*samplePtr)[jj] == g_vectors[jj],
                             "Incorrect value read from archive." );
        }

    }
    ABCA_ASSERT(
        archive.getMaxNumSamplesForTimeSamplingIndex(1) == (index_t) numSamples,
        "Incorrect number of max samples in readV3fArrayProperty." );
    std::cout << std::endl;
    // Done - the archive closes itself

    double start, end;
    GetArchiveStartAndEndTime( archive, start, end );

    TESTING_ASSERT( almostEqual(start, 123.0) );
    TESTING_ASSERT( almostEqual(end, 123.0 + 4.0 / 24.0) );
}
开发者ID:BlackGinger,项目名称:ExocortexCrate,代码行数:96,代码来源:ArrayPropertyTest.cpp


示例17: readProperty

void readProperty(const std::string &archiveName, bool useOgawa)
{
    // Open an existing archive for reading. Indicate that we want
    //   Alembic to throw exceptions on errors.
    std::cout  << "Reading " << archiveName << std::endl;
    AbcF::IFactory factory;
    factory.setPolicy(  ErrorHandler::kThrowPolicy );
    AbcF::IFactory::CoreType coreType;
    IArchive archive = factory.getArchive(archiveName, coreType);
    ABCA_ASSERT( (useOgawa && coreType == AbcF::IFactory::kOgawa) ||
                    (!useOgawa && coreType == AbcF::IFactory::kHDF5),
                  "File did not open as the expected type." );

    IObject archiveTop = archive.getTop();

    // Determine the number of (top level) children the archive has
    const unsigned int numChildren =  archiveTop.getNumChildren();
    ABCA_ASSERT( numChildren == 1, "Wrong number of children (expected 1)");
    std::cout << "The archive has " << numChildren << " children:"
              << std::endl;


    // Iterate through them, print out their names
    IObject child( archiveTop, archiveTop.getChildHeader( 0 ).getName() );
    std::cout << "  " << child.getName();


    // Properties
    ICompoundProperty props = child.getProperties();
    size_t numProperties = props.getNumProperties();  // only top-level props
    ABCA_ASSERT( numProperties == 1,
                 "Expected 1 property, found " << numProperties);
    std::cout << " with one property";


    std::vector<std::string> propNames(1);
    propNames[0] = props.getPropertyHeader(0).getName();
    std::cout << " named " << propNames[0] << std::endl;

    PropertyType pType = props.getPropertyHeader(0).getPropertyType();
    ABCA_ASSERT( pType == kScalarProperty,
                 "Expected a scalar property, but didn't find one" );

    std::cout << " which is a scalar property";



    DataType dType = props.getPropertyHeader(0).getDataType();
    ABCA_ASSERT( dType.getPod() == kFloat64POD,
                 "Expected a double (kFloat64POD) property, but didn't"
                 " find one" );

    // We know this is a scalar property (I'm eliding the if/else
    //  statements required to recognize this)
    IDoubleProperty mass( props, propNames[0] );

    size_t numSamples = mass.getNumSamples();
    std::cout << ".. it has " << numSamples << " samples" << std::endl;
    //ABCA_ASSERT( numSamples == 5, "Expected 5 samples, found " << numSamples );

    TimeSamplingPtr ts = mass.getTimeSampling();

    std::cout << "..with time/value pairs: ";
    for (unsigned int ss=0; ss<numSamples; ss++)
    {
        ISampleSelector iss( (index_t) ss);
        std::cout << ts->getSampleTime( (index_t) ss ) << "/";
        printSampleValue( mass, iss );
        std::cout << " ";

        double timeDiff = ts->getSampleTime( (index_t) ss ) -
            (g_startTime + (ss*(g_dt/3.0)));
        ABCA_ASSERT( fabs(timeDiff) < 1e-12, "Incorrect sample time read" );


        double massDiff = mass.getValue( iss ) - (1.0 + 0.1*ss);
        ABCA_ASSERT( fabs(massDiff) < 1e-12, "Incorrect sample value read" );
    }
    ABCA_ASSERT(
        archive.getMaxNumSamplesForTimeSamplingIndex(1) == (index_t) numSamples,
        "Incorrect number of max samples for Time Sampling ID 1.");
    std::cout << std::endl;

    // Done - the archive closes itself
}
开发者ID:AWhetter,项目名称:alembic,代码行数:85,代码来源:CyclicPropertyTest.cpp


示例18: readSimpleProperties


//.........这里部分代码省略.........
                    break;
                case kInt32POD:
                    std::cout << "int" << std::endl;
                    break;

                // Long/ULong
                case kUint64POD:
                    std::cout << "unsigned long int" << std::endl;
                    break;
                case kInt64POD:
                    std::cout << "long int" << std::endl;
                    break;

                // Half/Float/Double
                case kFloat16POD:
                    std::cout << "half" << std::endl;
                    break;
                case kFloat32POD:
                    std::cout << "float" << std::endl;
                    break;
                case kFloat64POD:
                    std::cout << "double" << std::endl;
                    break;

                case kStringPOD:
                    std::cout << "string" << std::endl;
                    break;

                case kUnknownPOD:
                default:
                    std::cout << " Unknown! (this is bad)" << std::endl;
            };

            TimeSamplingPtr ts =
                GetCompoundPropertyReaderPtr(props)->
                getScalarProperty( propNames[jj] )->getTimeSampling();

            int numSamples = ts->getNumStoredTimes();


            std::cout << "    ..and "
                      << ts->getTimeSamplingType() << std::endl
                      << "    ..and " << numSamples << " samples at times: ";

            if (numSamples > 0)
            {
                std::cout << " ( ";
                for (int ss=0; ss<numSamples; ss++)
                    std::cout << ts->getSampleTime(ss) << " ";
                std::cout << ")";
            }
            std::cout << std::endl;

            std::cout << "    ..and values: ";
            if (numSamples > 0)
            {
                for (int ss=0; ss<numSamples; ss++)
                {
                    ISampleSelector iss( (index_t) ss);
                    switch (dType.getPod())
                    {
                        // Boolean
                        case  kBooleanPOD:
                        {
                            IBoolProperty prop( props,  propNames[jj] );
                            printSampleValue( prop, iss );
开发者ID:BlackGinger,项目名称:ExocortexCrate,代码行数:67,代码来源:PropertyTests.cpp


示例19: GetRelevantSampleTimes

//-*****************************************************************************
void GetRelevantSampleTimes( ProcArgs &args, TimeSamplingPtr timeSampling,
                            size_t numSamples, SampleTimeSet &output )
{
    if ( numSamples < 2 )
    {
        output.insert( 0.0 );
        return;
    }

    chrono_t frameTime = args.frame / args.fps;

    chrono_t shutterOpenTime = ( args.frame + args.shutterOpen ) / args.fps;

    chrono_t shutterCloseTime = ( args.frame + args.shutterClose ) / args.fps;

    std::pair<index_t, chrono_t> shutterOpenFloor =
        timeSampling->getFloorIndex( shutterOpenTime, numSamples );

    std::pair<index_t, chrono_t> shutterCloseCeil =
        timeSampling->getCeilIndex( shutterCloseTime, numSamples );

    //TODO, what's a reasonable episilon?
    static const chrono_t epsilon = 1.0 / 10000.0;

    //check to see if our second sample is really the
    //floor that we want due to floating point slop
    //first make sure that we have at least two samples to work with
    if ( shutterOpenFloor.first < shutterCloseCeil.first )
    {
        //if our open sample is less than open time,
        //look at the next index time
        if ( shutterOpenFloor.second < shutterOpenTime )
        {
            chrono_t nextSampleTime =
                     timeSampling->getSampleTime( shutterOpenFloor.first + 1 );

            if ( fabs( nextSampleTime - shutterOpenTime ) < epsilon )
            {
                shutterOpenFloor.first += 1;
                shutterOpenFloor.second = nextSampleTime;
            }
        }
    }


    for ( index_t i = shutterOpenFloor.first; i < shutterCloseCeil.first; ++i )
    {
        output.insert( timeSampling->getSampleTime( i ) );
    }

    //no samples above? put frame time in there and get out
    if ( output.size() == 0 )
    {
        output.insert( frameTime );
        return;
    }

    chrono_t lastSample = *(output.rbegin() );

    //determine whether we need the extra sample at the end
    if ( ( fabs( lastSample - shutterCloseTime ) > epsilon )
         && lastSample < shutterCloseTime )
    {
        output.insert( shutterCloseCeil.second );
    }
}
开发者ID:oyaGG,项目名称:helgemathee-alembic-softimage,代码行数:67,代码来源:SampleUtil.cpp


示例20: ProcessPointsBase

AtNode * ProcessPointsBase(
        IPoints & prim, ProcArgs & args,
        SampleTimeSet & sampleTimes,
        std::vector<AtPoint> & vidxs,
		std::vector<float> & radius,
		MatrixSampleMap * xformSamples )
{
    if ( !prim.valid() )
    {
        return NULL;
    }
    
    Alembic::AbcGeom::IPointsSchema  &ps = prim.getSchema();
    TimeSamplingPtr ts = ps.getTimeSampling();
    
	sampleTimes.insert( ts->getFloorIndex(args.frame / args.fps, ps.getNumSamples()).second );
    
    std::string name = args.nameprefix + prim.getFullName();
    
    AtNode * instanceNode = NULL;
    
    std::string cacheId;
    
    SampleTimeSet singleSampleTimes;
    singleSampleTimes.insert( ts->getFloorIndex(args.frame / args.fps, ps.getNumSamples()).second );

	ICompoundProperty arbGeomParams = ps.getArbGeomParams();
	ISampleSelector frameSelector( *singleSampleTimes.begin() );
	std::vector<std::string> tags;

	//get tags
	if ( arbGeomParams != NULL && arbGeomParams.valid() )
	{
		if (arbGeomParams.getPropertyHeader("mtoa_constant_tags") != NULL)
		{
			const PropertyHeader * tagsHeader = arbGeomParams.getPropertyHeader("mtoa_constant_tags");
			if (IStringGeomParam::matches( *tagsHeader ))
			{
				IStringGeomParam param( arbGeomParams,  "mtoa_constant_tags" );
				if ( param.valid() )
				{
					IStringGeomParam::prop_type::sample_ptr_type valueSample =
									param.getExpandedValue( frameSelector ).getVals();

					if ( param.getScope() == kConstantScope || param.getScope() == kUnknownScope)
					{
						Json::Value jtags;
						Json::Reader reader;
						if(reader.parse(valueSample->get()[0], jtags))
							for( Json::ValueIterator itr = jtags.begin() ; itr != jtags.end() ; itr++ )
							{
								tags.push_back(jtags[itr.key().asUInt()].asString());
							}
					}
				}
			}
		}
	}

    if ( args.makeInstance )
    {
        std::ostringstream buffer;
        AbcA::ArraySampleKey sampleKey;
        
        
        for ( SampleTimeSet::iterator I = sampleTimes.begin();
                I != sampleTimes.end(); ++I )
        {
            ISampleSelector sampleSelector( *I );
            ps.getPositionsProperty().getKey(sampleKey, sampleSelector);
            
            buffer << GetRelativeSampleTime( args, (*I) ) << ":";
            sampleKey.digest.print(buffer);
            buffer << ":";
        }
        
        cacheId = buffer.str();
        
        instanceNode = AiNode( "ginstance" );
        AiNodeSetStr( instanceNode, "name", name.c_str() );
		args.createdNodes.push_back(instanceNode);

        if ( args.proceduralNode )
        {
            AiNodeSetByte( instanceNode, "visibility",
                    AiNodeGetByte( args.proceduralNode, "visibility" ) );
        
        }
        else
        {
            AiNodeSetByte( instanceNode, "visibility", AI_RAY_ALL );
        }

		ApplyTransformation( instanceNode, xformSamples, args );

		NodeCache::iterator I = g_meshCache.find(cacheId);

		// parameters overrides
		if(args.linkOverride)
			ApplyOverrides(name, instanceNode, tags, args);
//.........这里部分代码省略.........
开发者ID:wildparky,项目名称:bb_arnoldAlembicProcedural,代码行数:101,代码来源:WritePoint.cpp



注:本文中的TimeSamplingPtr类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ TimeSeries类代码示例发布时间:2022-05-31
下一篇:
C++ TimeRanges类代码示例发布时间:2022-05-31
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap