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


C++ Channel32f::getWidth方法代码示例

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


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

示例1: update

void Particle::update( const Channel32f &channel,  const ci::Channel32f &rChan, const ci::Channel32f &gChan, const ci::Channel32f &bChan, const ci::Vec2i &mouseLoc )
{
	
    //calculate the vector that points from the particl to the mouse.
    mDirToCursor = mouseLoc - mLoc;
    mDirToCursor.safeNormalize(); //normalize it so it gives us a unit vector.
    
    
    Vec2f newLoc = mLoc + mDirToCursor * 100.f;
    newLoc.x = constrain( newLoc.x, 0.0f, channel.getWidth() - 1.0f );
    newLoc.y = constrain( newLoc.y, 0.0f, channel.getHeight() - 1.0f );
    
    
    
    //mRadius = channel.getValue( mLoc ) * mScale;
    mRadius = channel.getValue( newLoc ) * mScale;
    
    Vec2i mLoci = (Vec2i) mLoc;
        
    r = rChan.getValue( newLoc );
    g = gChan.getValue( newLoc );
    b = bChan.getValue( newLoc );    
    
    //console() << r << ", " << g << ", " << b << std::endl;
    //console() << channel.getValue(mLoc) << std::endl;
    //console() << "hello" << std::endl;
    
}
开发者ID:milesmeow,项目名称:cinder_projects,代码行数:28,代码来源:Particle.cpp

示例2: mObj

Texture::Texture( const Channel32f &channel, Format format )
	: mObj( shared_ptr<Obj>( new Obj( channel.getWidth(), channel.getHeight() ) ) )
{
#if defined( CINDER_MAC )
	bool supportsTextureFloat = gl::isExtensionAvailable( "GL_ARB_texture_float" );
#elif defined( CINDER_MSW )
	bool supportsTextureFloat = GLEE_ARB_texture_float != 0;
#endif

	if( format.mInternalFormat < 0 ) {
#if ! defined( CINDER_GLES )
		if( supportsTextureFloat )
			format.mInternalFormat = GL_LUMINANCE32F_ARB;
		else
			format.mInternalFormat = GL_LUMINANCE;
#else
		format.mInternalFormat = GL_LUMINANCE;
#endif	
	}

	mObj->mInternalFormat = format.mInternalFormat;
	mObj->mTarget = format.mTarget;

	// if the data is not already contiguous, we'll need to create a block of memory that is
	if( ( channel.getIncrement() != 1 ) || ( channel.getRowBytes() != channel.getWidth() * sizeof(float) ) ) {
		shared_ptr<float> data( new float[channel.getWidth() * channel.getHeight()], checked_array_deleter<float>() );
		float *dest = data.get();
		const int8_t inc = channel.getIncrement();
		const int32_t width = channel.getWidth();
		for( int y = 0; y < channel.getHeight(); ++y ) {
			const float *src = channel.getData( 0, y );
			for( int x = 0; x < width; ++x ) {
				*dest++ = *src;
				src += inc;
			}
		}
	
		init( data.get(), GL_LUMINANCE, format );
	}
	else
		init( channel.getData(), GL_LUMINANCE, format );
}
开发者ID:,项目名称:,代码行数:42,代码来源:

示例3: update

void DirVector::update(const Channel32f &channel, const Vec2f &windDirection){
	//console() << "Update1: << " << mDir << ", " << mRotationVector << endl;
	
	//mDir = Vec2f(1.0f, 0.0f);
	
	mDir = mRotationVector; //mouseLoc - mLoc;
	mDir.safeNormalize();
	//mDir.normalize();
    
	Vec2f newLoc = mLoc + mDir * 100.f;
	newLoc.x = constrain(newLoc.x, 0.f, channel.getWidth() - 1.f);
	newLoc.x = constrain(newLoc.x, 0.f, channel.getHeight() - 1.f);
	
	mRadius = channel.getValue(newLoc) * 7.0f;
	//console() << "Update2: << " << mDir << endl;
}
开发者ID:chalmersgit,项目名称:godComplexMAC,代码行数:16,代码来源:DirVector.cpp

示例4: update

void Particle::update( const Channel32f &channel, const Vec2i &mouseLoc )
{
	mDirToCursor		= mouseLoc - mLoc;
    
	float distToCursor	= mDirToCursor.length();
	float time			= app::getElapsedSeconds();
	float dist			= distToCursor * 0.025f;
	float sinOffset		= sin( dist - time ) + 1.0f;
	
	mDirToCursor.normalize();
	mDirToCursor		*= sinOffset * 100.0f;
	
    Rectf rect( mLoc.x, mLoc.y, mLoc.x + mRadius, mLoc.y + mRadius );
    gl::drawSolidRect( rect );
    
	Vec2f newLoc		= mLoc + mDirToCursor;
	newLoc.x			= constrain( newLoc.x, 0.0f, channel.getWidth() - 1.0f );
	newLoc.y			= constrain( newLoc.y, 0.0f, channel.getHeight() - 1.0f );
	
	mRadius				= channel.getValue( newLoc ) * mScale;
}
开发者ID:ppdany,项目名称:ICP_TellThatToMyCamera,代码行数:21,代码来源:Particle.cpp

示例5: update

void Circle::update(const Vec2i &mouseLoc, const Channel32f &channel)
{
    mMouseLoc           = mouseLoc;
    mDirToCursor        = mMouseLoc-mLoc;
    
    float distToCursor  = mDirToCursor.length();
    float time          = app::getElapsedSeconds();
    float dist          = distToCursor * 0.025f;
    float sinOffset     = sin(dist-time)+1.0f;
    
    mDirToCursor.normalize();
    mDirToCursor        *= sinOffset * 100.0f;
    
    Vec2f newLoc        = mLoc+mDirToCursor;
    newLoc.x            = constrain(newLoc.x, 0.0f, channel.getWidth()-1.0f);
    newLoc.y            = constrain(newLoc.y, 0.0f, channel.getHeight() - 1.0f);
    
    mRadius             = channel.getValue(newLoc)*mScale+2.0f;
    
    float gray=channel.getValue(mLoc);
    mColor=Color(gray,gray,gray);
}
开发者ID:adamriggs,项目名称:cinder,代码行数:22,代码来源:Circle.cpp


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