本文整理汇总了C++中createParticle函数的典型用法代码示例。如果您正苦于以下问题:C++ createParticle函数的具体用法?C++ createParticle怎么用?C++ createParticle使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了createParticle函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: GetFreeDynLight
void FireFieldSpell::Update(float timeDelta) {
pPSStream.Update(timeDelta);
pPSStream1.Update(timeDelta);
if(!lightHandleIsValid(m_light))
m_light = GetFreeDynLight();
if(lightHandleIsValid(m_light)) {
EERIE_LIGHT * el = lightHandleGet(m_light);
el->pos = m_pos + Vec3f(0.f, -120.f, 0.f);
el->intensity = 4.6f;
el->fallstart = 150.f+rnd()*30.f;
el->fallend = 290.f+rnd()*30.f;
el->rgb = Color3f(1.f, 0.8f, 0.6f) - Color3f(rnd()*(1.0f/10), 0.f, 0.f);
el->duration = 600;
el->extras=0;
}
if(VisibleSphere(Sphere(m_pos - Vec3f(0.f, 120.f, 0.f), 350.f))) {
pPSStream.Render();
pPSStream1.Render();
float fDiff = timeDelta / 8.f;
int nTime = checked_range_cast<int>(fDiff);
for(long nn=0;nn<=nTime+1;nn++) {
PARTICLE_DEF * pd = createParticle();
if(!pd) {
break;
}
float t = rnd() * (PI * 2.f) - PI;
float ts = std::sin(t);
float tc = std::cos(t);
pd->ov = m_pos + Vec3f(120.f * ts, 15.f * ts, 120.f * tc) * randomVec();
pd->move = Vec3f(2.f, 1.f, 2.f) + Vec3f(-4.f, -8.f, -4.f) * Vec3f(rnd(), rnd(), rnd());
pd->siz = 7.f;
pd->tolive = Random::get(500, 1500);
pd->tc = fire2;
pd->special = ROTATING | MODULATE_ROTATION | FIRE_TO_SMOKE;
pd->fparam = 0.1f - rnd() * 0.2f;
pd->scale = Vec3f(-8.f);
PARTICLE_DEF * pd2 = createParticle();
if(!pd2) {
break;
}
*pd2 = *pd;
pd2->delay = Random::get(60, 210);
}
}
}
示例2: dynLightCreate
void FireFieldSpell::Update() {
pPSStream.Update(g_framedelay);
pPSStream1.Update(g_framedelay);
EERIE_LIGHT * el = dynLightCreate(m_light);
if(el) {
el->pos = m_pos + Vec3f(0.f, -120.f, 0.f);
el->intensity = 4.6f;
el->fallstart = Random::getf(150.f, 180.f);
el->fallend = Random::getf(290.f, 320.f);
el->rgb = Color3f(1.f, 0.8f, 0.6f) + Color3f(Random::getf(-0.1f, 0.f), 0.f, 0.f);
el->duration = ArxDurationMs(600);
el->extras=0;
}
if(VisibleSphere(Sphere(m_pos - Vec3f(0.f, 120.f, 0.f), 350.f))) {
pPSStream.Render();
pPSStream1.Render();
float fDiff = g_framedelay / 8.f;
int nTime = checked_range_cast<int>(fDiff);
for(long nn=0;nn<=nTime+1;nn++) {
PARTICLE_DEF * pd = createParticle();
if(!pd) {
break;
}
float t = Random::getf() * (glm::pi<float>() * 2.f) - glm::pi<float>();
float ts = std::sin(t);
float tc = std::cos(t);
pd->ov = m_pos + Vec3f(120.f * ts, 15.f * ts, 120.f * tc) * randomVec();
pd->move = Vec3f(2.f, 1.f, 2.f) + Vec3f(-4.f, -8.f, -4.f) * randomVec3f();
pd->siz = 7.f;
pd->tolive = Random::getu(500, 1500);
pd->tc = fire2;
pd->m_flags = ROTATING | FIRE_TO_SMOKE;
pd->m_rotation = Random::getf(-0.1f, 0.1f);
pd->scale = Vec3f(-8.f);
PARTICLE_DEF * pd2 = createParticle();
if(!pd2) {
break;
}
*pd2 = *pd;
pd2->delay = Random::getu(60, 210);
}
}
}
示例3: MagFX
void BookIconGui::MakeBookFX() {
static const float z = 0.00001f;
for(long i = 0; i < 12; i++) {
MagFX(Vec3f(m_rect.topLeft(), z), m_scale);
}
for(int i = 0; i < 5; i++) {
PARTICLE_DEF * pd = createParticle();
if(!pd) {
break;
}
float s = i * m_scale;
pd->ov = Vec3f(m_rect.topLeft() - Vec2f(s * 2, s * 2), z);
pd->move = Vec3f(s * -0.5f, s * -0.5f, 0.f);
pd->scale = Vec3f(s * 10, s * 10, 0.f);
pd->tolive = Random::getu(1200, 1600);
pd->tc = m_tex;
pd->rgb = Color3f(1.f - i * 0.1f, i * 0.1f, 0.5f - i * 0.1f);
pd->siz = m_rect.width() + s * 4.f;
pd->is2D = true;
}
NewSpell = 1;
}
示例4: while
void PoisonProjectileSpell::AddPoisonFog(const Vec3f & pos, float power) {
int iDiv = 4 - config.video.levelOfDetail;
float flDiv = static_cast<float>(1 << iDiv);
long count = std::max(1l, checked_range_cast<long>(g_framedelay / flDiv));
while(count--) {
if(Random::getf(0.f, 2000.f) >= power) {
continue;
}
PARTICLE_DEF * pd = createParticle();
if(!pd) {
return;
}
float speed = 1.f;
float fval = speed * 0.2f;
pd->m_flags = FADE_IN_AND_OUT | ROTATING | DISSIPATING;
pd->ov = pos + arx::randomVec(-100.f, 100.f);
pd->scale = Vec3f(8.f, 8.f, 10.f);
pd->move = Vec3f((speed - Random::getf()) * fval, (speed - speed * Random::getf()) * (1.f / 15),
(speed - Random::getf()) * fval);
pd->tolive = Random::getu(4500, 9000);
pd->tc = TC_smoke;
pd->siz = (80.f + Random::getf(0.f, 160.f)) * (1.f / 3);
pd->rgb = Color3f(Random::getf(0.f, 1.f / 3), 1.f, Random::getf(0.f, 0.1f));
pd->m_rotation = 0.001f;
}
}
示例5: Anglef
void CCurse::Render() {
RenderMaterial mat;
mat.setCulling(Renderer::CullCW);
mat.setDepthTest(true);
mat.setBlendType(RenderMaterial::Opaque);
Anglef stiteangle = Anglef(0, fRot, 0);
Vec3f stitepos = eTarget;
Vec3f stitescale = Vec3f_ONE;
Color3f stitecolor = Color3f::white;
Draw3DObject(svoodoo, stiteangle, stitepos, stitescale, stitecolor, mat);
for(int i = 0; i < 4; i++) {
PARTICLE_DEF * pd = createParticle();
if(!pd) {
break;
}
pd->ov = eTarget;
pd->move = Vec3f(2.f * frand2(), rnd() * -10.f - 10.f, 2.f * frand2());
pd->siz = 0.015f;
pd->tolive = Random::get(1000, 1600);
pd->tc = tex_p1;
pd->special = ROTATING | MODULATE_ROTATION | DISSIPATING | SUBSTRACT | GRAVITY;
pd->fparam = 0.0000001f;
}
}
示例6: srand
bool LiquidScene::init() {
if ( !Layer::init() ) {
return false;
}
srand((unsigned) time(NULL));
createPhysWorld();
createGround();
createParticle();
// デバック表示用
initDebugDraw();
initTouchEventListener();
Size window = Director::getInstance()->getWinSize();
drawBox2dSpriteAt(createBox2DSpriteData(SpriteType::Box), Point(window.width/2.0 + 33, 33));
drawBox2dSpriteAt(createBox2DSpriteData(SpriteType::Box), Point(window.width/2.0 - 33, 33));
drawBox2dSpriteAt(createBox2DSpriteData(SpriteType::Box), Point(window.width/2.0 + 33 + 66, 33));
drawBox2dSpriteAt(createBox2DSpriteData(SpriteType::Box), Point(window.width/2.0 - 33 - 66, 33));
drawBox2dSpriteAt(createBox2DSpriteData(SpriteType::Box), Point(window.width/2.0 + 33 + 66, 33 + 66));
drawBox2dSpriteAt(createBox2DSpriteData(SpriteType::Box), Point(window.width/2.0 - 33 - 66, 33 + 66));
drawBox2dSpriteAt(createBox2DSpriteData(SpriteType::Box), Point(window.width/2.0 + 33 + 66, 33 + 66 + 66));
drawBox2dSpriteAt(createBox2DSpriteData(SpriteType::Box), Point(window.width/2.0 - 33 - 66, 33 + 66 + 66));
scheduleUpdate();
return true;
}
示例7: createConstantEmissionCount
void ParticleEmitter::create(ParticleSystem *system, float time) {
int numParticles = createConstantEmissionCount(time);
Particle *p;
for(int i = 0; (i < numParticles) && (system->findEmptySlot(p)); i++) {
createParticle(p);
}
}
示例8: ARX_SOUND_PlaySFX
void FlyingEyeSpell::End() {
Entity * caster = entities.get(m_caster);
if(caster) {
ARX_SOUND_PlaySFX(g_snd.MAGIC_FIZZLE, &caster->pos);
}
static TextureContainer * tc4 = TextureContainer::Load("graph/particles/smoke");
ARX_SOUND_PlaySFX(g_snd.SPELL_EYEBALL_OUT);
eyeball.exist = -100;
for(long n = 0; n < 12; n++) {
PARTICLE_DEF * pd = createParticle();
if(!pd) {
break;
}
pd->ov = eyeball.pos + arx::randomVec(-5.f, 5.f);
pd->move = arx::randomVec(-2.f, 2.f);
pd->siz = 28.f;
pd->tolive = Random::getu(2000, 6000);
pd->scale = Vec3f(12.f);
pd->tc = tc4;
pd->m_flags = FADE_IN_AND_OUT | ROTATING | DISSIPATING;
pd->m_rotation = 0.0000001f;
pd->rgb = Color3f(0.7f, 0.7f, 1.f);
}
config.input.mouseLookToggle = bOldLookToggle;
lightHandleDestroy(m_light1);
lightHandleDestroy(m_light2);
}
示例9: while
void PoisonProjectileSpell::AddPoisonFog(const Vec3f & pos, float power) {
int iDiv = 4 - config.video.levelOfDetail;
float flDiv = static_cast<float>(1 << iDiv);
arxtime.update();
long count = std::max(1l, checked_range_cast<long>(framedelay / flDiv));
while(count--) {
if(rnd() * 2000.f >= power) {
continue;
}
PARTICLE_DEF * pd = createParticle();
if(!pd) {
return;
}
float speed = 1.f;
float fval = speed * 0.2f;
pd->special = FADE_IN_AND_OUT | ROTATING | MODULATE_ROTATION | DISSIPATING;
pd->ov = pos + randomVec(-100.f, 100.f);
pd->scale = Vec3f(8.f, 8.f, 10.f);
pd->move = Vec3f((speed - rnd()) * fval, (speed - speed * rnd()) * (1.f / 15),
(speed - rnd()) * fval);
pd->tolive = Random::get(4500, 9000);
pd->tc = TC_smoke;
pd->siz = (80.f + rnd() * 160.f) * (1.f / 3);
pd->rgb = Color3f(rnd() * (1.f / 3), 1.f, rnd() * 0.1f);
pd->fparam = 0.001f;
}
}
示例10: createParticle
void SplashManager::update(void)
{
for(int i = 0; i<400 ;i++)
{
particles[i].timer++;
if( particles[i].timer < particles[i].limit)
{
float perc = particles[i].timer / particles[i].limit;
particles[i].x += particles[i].direction[0];
particles[i].y += particles[i].direction[1];
particles[i].z += particles[i].direction[2];
particles[i].scale += 0.001f;
particles[i].color[0] = (1.0 -perc);
particles[i].color[1] = (1.0 -perc);
particles[i].color[2] = (1.0 -perc);
particles[i].color[3] = (1.0 -perc);
}
else
{
createParticle(i);
}
}
}
示例11: ARX_SOUND_PlaySFX
void FlyingEyeSpell::End()
{
ARX_SOUND_PlaySFX(SND_MAGIC_FIZZLE, &entities[m_caster]->pos);
static TextureContainer * tc4=TextureContainer::Load("graph/particles/smoke");
ARX_SOUND_PlaySFX(SND_SPELL_EYEBALL_OUT);
eyeball.exist = -100;
for(long n = 0; n < 12; n++) {
PARTICLE_DEF * pd = createParticle();
if(!pd) {
break;
}
pd->ov = eyeball.pos + randomVec(-5.f, 5.f);
pd->move = randomVec(-2.f, 2.f);
pd->siz = 28.f;
pd->tolive = Random::get(2000, 6000);
pd->scale = Vec3f(12.f);
pd->tc = tc4;
pd->special = FADE_IN_AND_OUT | ROTATING | MODULATE_ROTATION | DISSIPATING;
pd->fparam = 0.0000001f;
pd->rgb = Color3f(0.7f, 0.7f, 1.f);
}
config.input.mouseLookToggle = bOldLookToggle;
lightHandleDestroy(special[2]);
lightHandleDestroy(special[1]);
}
示例12: stopAllActions
void Bomb::bomb()
{
//CCLog("==============Bomb::bomb=======================");
stopAllActions();
setVisible(true);
RecordSprite* pBomb = new RecordSprite;
pBomb->initWithTexture(this->getTexture());
pBomb->autorelease();
pBomb->setPosition(ccp(this->getContentSize().width/2, this->getContentSize().height/2));
this->addChild(pBomb);
pBomb->runAction(CCSequence::create(
AnimatePacker::getInstance()->getAnimate("fullbomb"),
CCCallFuncN::create(this, callfuncN_selector(Bomb::bombEnd)),
NULL));
// if (bombAction != NULL)
// {
// runAction(bombAction);
// }else
// {
// CCLog("========>waring: current season have increct bomb pic !");
// }
par = NULL;
//安卓平台不需要这个粒子系统
if (CC_TARGET_PLATFORM != CC_PLATFORM_ANDROID)
{
par = createParticle();
getParent()->addChild(par, 10);
par->setPosition(getPosition());
}
}
示例13: QGLWidget
Viewer::Viewer(const QGLFormat& format, QWidget *parent)
: QGLWidget(format, parent),
MaxParticles(2000),
ParticlesCount(900)
#if (QT_VERSION >= QT_VERSION_CHECK(5, 1, 0))
, vbo(QOpenGLBuffer::VertexBuffer)
, matbo(QOpenGLBuffer::VertexBuffer)
, mVertexArrayObject(this)
#else
, vbo(QGLBuffer::VertexBuffer)
#endif
{
mTimer = new QTimer(this);
connect(mTimer, SIGNAL(timeout()), this, SLOT(update()));
mTimer->start(1000/30);
// Nothing to do here right now.
mStepTimer = new QTimer(this);
connect(mTimer, SIGNAL(timeout()), this, SLOT(step()));
mTimer->start(1000/500);
createTimer = new QTimer(this);
connect(createTimer, SIGNAL(timeout()), this, SLOT(createParticle()));
createTimer->start(1000/10);
}
示例14: FlyingEyeSpellUpdateHand
static void FlyingEyeSpellUpdateHand(const Vec3f & pos, LightHandle & light) {
EERIE_LIGHT * el = dynLightCreate(light);
if(el) {
el->intensity = 1.3f;
el->fallend = 180.f;
el->fallstart = 50.f;
el->rgb = Color3f(0.7f, 0.3f, 1.f);
el->pos = pos;
}
for(long kk = 0; kk < 2; kk++) {
PARTICLE_DEF * pd = createParticle();
if(!pd) {
break;
}
pd->ov = pos + randomVec(-1.f, 1.f);
pd->move = Vec3f(0.1f, 0.f, 0.1f) + Vec3f(-0.2f, -2.2f, -0.2f) * randomVec3f();
pd->siz = 5.f;
pd->tolive = Random::getu(1500, 3500);
pd->scale = Vec3f(0.2f);
pd->tc = TC_smoke;
pd->m_flags = FADE_IN_AND_OUT | ROTATING | DISSIPATING;
pd->sourceionum = EntityHandle_Player;
pd->m_rotation = 0.0000001f;
pd->rgb = Color3f(.7f, .3f, 1.f) + Color3f(-.1f, -.1f, -.1f) * randomColor3f();
}
}
示例15: normalize
Particle *ParticleSystemNode::emit(int count) {
nodeDirection = normalize(origin * vec3(0, 0, 1) - origin.getPos());
if (count == 1) {
Particle *p = createParticle();
particles.append(p);
return p;
}
for (int i=0; i<count; i++) {
Particle *p = createParticle();
particles.append(p);
}
return NULL;
}