本文整理汇总了C++中cinderfx::Fluid2D::isBuoyancyEnabled方法的典型用法代码示例。如果您正苦于以下问题:C++ Fluid2D::isBuoyancyEnabled方法的具体用法?C++ Fluid2D::isBuoyancyEnabled怎么用?C++ Fluid2D::isBuoyancyEnabled使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类cinderfx::Fluid2D
的用法示例。
在下文中一共展示了Fluid2D::isBuoyancyEnabled方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Particle
void Fluid2DParticlesApp::touchesMoved( TouchEvent event )
{
float s = 10;
const std::vector<TouchEvent::Touch>& touches = event.getTouches();
for( std::vector<TouchEvent::Touch>::const_iterator cit = touches.begin(); cit != touches.end(); ++cit ) {
if( mTouchColors.find( cit->getId() ) == mTouchColors.end() )
continue;
vec2 prevPos = cit->getPrevPos();
vec2 pos = cit->getPos();
float x = (pos.x/(float)getWindowWidth())*mFluid2D.resX();
float y = (pos.y/(float)getWindowHeight())*mFluid2D.resY();
vec2 dv = pos - prevPos;
mFluid2D.splatVelocity( x, y, mVelScale*dv );
mFluid2D.splatRgb( x, y, mRgbScale*mTouchColors[cit->getId()] );
if( mFluid2D.isBuoyancyEnabled() ) {
mFluid2D.splatDensity( x, y, mDenScale );
}
for( int i = 0; i < 5; ++i ) {
vec2 partPos = pos + vec2( Rand::randFloat( -s, s ), Rand::randFloat( -s, s ) );
float life = Rand::randFloat( 3.0f, 6.0f );
mParticles.append( Particle( partPos, life, mTouchColors[cit->getId()] ) );
}
}
}
示例2:
void Fluid2DTextureApp::mouseDrag( MouseEvent event )
{
float x = (event.getX()/(float)getWindowWidth())*mFluid2D.resX();
float y = (event.getY()/(float)getWindowHeight())*mFluid2D.resY();
if( event.isLeftDown() ) {
vec2 dv = vec2( event.getPos() ) - mPrevPos;
mFluid2D.splatVelocity( x, y, mVelScale*dv );
if( mFluid2D.isBuoyancyEnabled() ) {
mFluid2D.splatDensity( x, y, mDenScale );
}
}
mPrevPos = event.getPos();
}
示例3:
void Fluid2DParticleSoupApp::mouseDrag( MouseEvent event )
{
float x = (event.getX()/(float)getWindowWidth())*mFluid2D.resX();
float y = (event.getY()/(float)getWindowHeight())*mFluid2D.resY();
if( event.isLeftDown() ) {
Vec2f dv = event.getPos() - mPrevPos;
mFluid2D.splatVelocity( x, y, mVelScale*dv );
mFluid2D.splatRgb( x, y, mRgbScale*mColor );
if( mFluid2D.isBuoyancyEnabled() ) {
mFluid2D.splatDensity( x, y, mDenScale );
}
}
mPrevPos = event.getPos();
}