当前位置: 首页>>代码示例>>C++>>正文


C++ TimeSamplingPtr::getSampleTime方法代码示例

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


在下文中一共展示了TimeSamplingPtr::getSampleTime方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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

//-*****************************************************************************
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

示例5: 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

示例6: 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

示例7: 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

示例8: 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

示例9: 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

示例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:

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: 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

示例14: 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

示例15: 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


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