本文整理汇总了C++中Globals::getV0_x方法的典型用法代码示例。如果您正苦于以下问题:C++ Globals::getV0_x方法的具体用法?C++ Globals::getV0_x怎么用?C++ Globals::getV0_x使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Globals
的用法示例。
在下文中一共展示了Globals::getV0_x方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: update
void Particle::update() {
// Use either ofNoise() in case you want to use oF internal Perlin Noise
// or per.noise() in case you want to use Chris Little's implementation
//Comment or Uncomment depending on your needs
// Option 1a, Chris direct ::::
//Perlin per;
//noiseFloat = per.noise(pos.x * 0.0025, pos.y * 0.0025, glob.getElapsedFrames() * 0.001);
// Option 1b, Chris via Globals.h ::::
noiseFloat = glob.getPerlinNoise(pos.x * 0.0025, pos.y * 0.0025, glob.getElapsedFrames() * 0.001);
// Option 2, openFrameworks internal ::::
//noiseFloat = ofNoise(pos.x * 0.0025, pos.y * 0.0025, glob.getElapsedFrames() * 0.001);
noiseVec.modX((float)(cos(((noiseFloat - 0.3) * (M_PI*2)) * 10)));
noiseVec.modY((float)(sin(((noiseFloat - 0.3) * (M_PI*2)) * 10)));
vel.add(noiseVec);
vel.div(glob.getParSpeedRedFactor());
pos.add(vel);
if(1.0-(age/lifeTime) == 0) {
isDead = true;
}
//if we have the lines, respect the space for them
if (glob.getLinesMode()) {
if(pos.x < glob.getV0_x() || pos.x > glob.getWid() - glob.getV0_x() || pos.y < 0 || pos.y > glob.getHei()) {
isDead = true;
age = lifeTime;
}
} else { //else grab the whole screen as limit to kill the particles
if(pos.x < 0 || pos.x > glob.getWid() || pos.y < 0 || pos.y > glob.getHei()) {
isDead = true;
age = lifeTime;
}
}
if(1.0-(age/lifeTime) != 0) {
age++;
}
}