本文整理汇总了C++中Anglef::setRoll方法的典型用法代码示例。如果您正苦于以下问题:C++ Anglef::setRoll方法的具体用法?C++ Anglef::setRoll怎么用?C++ Anglef::setRoll使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Anglef
的用法示例。
在下文中一共展示了Anglef::setRoll方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Render
void CRepelUndead::Render() {
if(ulCurrentTime >= ulDuration)
return;
RenderMaterial mat;
mat.setDepthTest(true);
mat.setBlendType(RenderMaterial::Additive);
Anglef eObjAngle;
eObjAngle.setPitch(m_yaw);
eObjAngle.setYaw(0);
eObjAngle.setRoll(0);
float vv = 1.f + (std::sin(arxtime.get_updated() * ( 1.0f / 1000 )));
vv *= ( 1.0f / 2 );
vv += 1.1f;
Draw3DObject(ssol, eObjAngle, eSrc + Vec3f(0.f, -5.f, 0.f), Vec3f(vv), Color3f(0.6f, 0.6f, 0.8f), mat);
vv *= 100.f;
for(int n = 0; n < 4; n++) {
PARTICLE_DEF * pd = createParticle();
if(!pd) {
break;
}
float dx = -std::sin(frand2() * 360.f) * vv;
float dz = std::cos(frand2() * 360.f) * vv;
pd->ov = eSrc + Vec3f(dx, 0.f, dz);
pd->move = Vec3f(0.8f * frand2(), -4.f * rnd(), 0.8f * frand2());
pd->scale = Vec3f(-0.1f);
pd->tolive = Random::get(2600, 3200);
pd->tc = tex_p2;
pd->siz = 0.3f;
pd->rgb = Color3f(.4f, .4f, .6f);
}
if(!lightHandleIsValid(lLightId)) {
lLightId = GetFreeDynLight();
}
if(lightHandleIsValid(lLightId)) {
EERIE_LIGHT * light = lightHandleGet(lLightId);
light->intensity = 2.3f;
light->fallend = 350.f;
light->fallstart = 150.f;
light->rgb = Color3f(0.8f, 0.8f, 1.f);
light->pos = eSrc + Vec3f(0.f, -50.f, 0.f);
light->duration = 200;
light->time_creation = (unsigned long)(arxtime);
}
}
示例2: getLookAtAngle
Anglef Camera::getLookAtAngle(const Vec3f & origin, const Vec3f & target) {
Anglef angle = Anglef::ZERO;
if(origin != target) {
float targetz = origin.z + glm::distance(Vec2f(origin.x, origin.z), Vec2f(target.x, target.z));
angle.setPitch(MAKEANGLE(-glm::degrees(getAngle(origin.y, origin.z, target.y, targetz))));
angle.setYaw(MAKEANGLE(glm::degrees(getAngle(origin.x, origin.z, target.x, target.z))));
angle.setRoll(0.f);
}
return angle;
}
示例3: Render
//.........这里部分代码省略.........
newpos = lastpos = pathways[0];
for(int i = 0; i < 5; i++) {
int kp = i;
int kpprec = (i > 0) ? kp - 1 : kp ;
int kpsuiv = kp + 1 ;
int kpsuivsuiv = (i < (5 - 2)) ? kpsuiv + 1 : kpsuiv;
for(int toto = 1; toto < iBezierPrecision; toto++) {
if(fTrail < i * iBezierPrecision + toto)
break;
float t = toto * fOneOnBezierPrecision;
float t1 = t;
float t2 = t1 * t1 ;
float t3 = t2 * t1 ;
float f0 = 2.f * t3 - 3.f * t2 + 1.f ;
float f1 = -2.f * t3 + 3.f * t2 ;
float f2 = t3 - 2.f * t2 + t1 ;
float f3 = t3 - t2 ;
float val = pathways[kpsuiv].x;
float p0 = 0.5f * (val - pathways[kpprec].x) ;
float p1 = 0.5f * (pathways[kpsuivsuiv].x - pathways[kp].x) ;
v.x = f0 * pathways[kp].x + f1 * val + f2 * p0 + f3 * p1 ;
val = pathways[kpsuiv].y ;
p0 = 0.5f * (val - pathways[kpprec].y) ;
p1 = 0.5f * (pathways[kpsuivsuiv].y - pathways[kp].y) ;
v.y = f0 * pathways[kp].y + f1 * val + f2 * p0 + f3 * p1 ;
val = pathways[kpsuiv].z ;
p0 = 0.5f * (val - pathways[kpprec].z) ;
p1 = 0.5f * (pathways[kpsuivsuiv].z - pathways[kp].z) ;
v.z = f0 * pathways[kp].z + f1 * val + f2 * p0 + f3 * p1 ;
newpos = v;
if(!((fTrail - (i * iBezierPrecision + toto)) > iLength)) {
float c;
if(fTrail < iLength) {
c = 1.0f - ((fTrail - (i * iBezierPrecision + toto)) / fTrail);
} else {
c = 1.0f - ((fTrail - (i * iBezierPrecision + toto)) / (float)iLength);
}
float fsize = c;
float alpha = c - 0.2f;
if(alpha < 0.2f)
alpha = 0.2f;
c += Random::getf(-0.1f, 0.1f);
c = glm::clamp(c, 0.f, 1.f);
Color color = (m_trailColor * (c * alpha)).to<u8>();
if(fsize < 0.5f)
fsize = fsize * 2 * 3;
else
fsize = (1.0f - fsize + 0.5f) * 2 * (3 * 0.5f);
float fs = fsize * 6 + Random::getf(0.f, 0.3f);
float fe = fsize * 6 + Random::getf(0.f, 0.3f);
Draw3DLineTexNew(mat, lastpos, newpos, color, color, fs, fe);
}
Vec3f temp_vector = lastpos;
lastpos = newpos;
newpos = temp_vector;
}
}
Vec3f av = newpos - lastpos;
float bubu = getAngle(av.x, av.z, 0, 0);
float bubu1 = getAngle(av.x, av.y, 0, 0);
eCurPos = lastpos;
Anglef stiteangle;
stiteangle.setPitch(-glm::degrees(bubu));
stiteangle.setYaw(0);
stiteangle.setRoll(-(glm::degrees(bubu1)));
if(av.x < 0)
stiteangle.setRoll(stiteangle.getRoll() - 90);
if(av.x > 0)
stiteangle.setRoll(stiteangle.getRoll() + 90);
if(stiteangle.getRoll() < 0)
stiteangle.setRoll(stiteangle.getRoll() + 360.0f);
Draw3DObject(smissile, stiteangle, eCurPos, Vec3f_ONE, m_projectileColor, mat);
}
示例4: ManageCombatModeAnimations
//.........这里部分代码省略.........
// Waiting and Receiving Strike Impulse
if(layer1.cur_anim == alist[ANIM_MISSILE_WAIT]) {
AimTime = (unsigned long)(arxtime);
if(eeMousePressed1() && Player_Arrow_Count() > 0) {
changeAnimation(io, 1, alist[ANIM_MISSILE_STRIKE_PART_1]);
io->isHit = false;
}
}
if(layer1.cur_anim == alist[ANIM_MISSILE_STRIKE_PART_1] && (layer1.flags & EA_ANIMEND)) {
AimTime = 0;
changeAnimation(io, 1, alist[ANIM_MISSILE_STRIKE_PART_2]);
EERIE_LINKEDOBJ_LinkObjectToObject(io->obj, arrowobj, "left_attach", "attach", NULL);
}
// Now go for strike cycle...
if(layer1.cur_anim == alist[ANIM_MISSILE_STRIKE_PART_2] && (layer1.flags & EA_ANIMEND)) {
changeAnimation(io, 1, alist[ANIM_MISSILE_STRIKE_CYCLE], EA_LOOP);
AimTime = (unsigned long)(arxtime);
} else if(layer1.cur_anim == alist[ANIM_MISSILE_STRIKE_CYCLE] && !eeMousePressed1()) {
EERIE_LINKEDOBJ_UnLinkObjectFromObject(io->obj, arrowobj);
changeAnimation(io, 1, alist[ANIM_MISSILE_STRIKE]);
SendIOScriptEvent(io, SM_STRIKE, "bow");
StrikeAimtime();
STRIKE_AIMTIME = (float)(BOW_FOCAL)/710.f;
Entity * quiver = Player_Arrow_Count_Decrease();
float poisonous = 0.f;
if(quiver) {
poisonous = quiver->poisonous;
if(quiver->poisonous_count > 0) {
quiver->poisonous_count--;
if(quiver->poisonous_count <= 0)
quiver->poisonous = 0;
}
ARX_DAMAGES_DurabilityLoss(quiver, 1.f);
// TODO is this needed ?, quivers seem to self destruct via script, but maybe not all
if(ValidIOAddress(quiver) && quiver->durability <= 0.f) {
ARX_INTERACTIVE_DestroyIOdelayed(quiver);
}
}
float aimratio = STRIKE_AIMTIME;
if(sp_max && poisonous < 3.f)
poisonous = 3.f;
Vec3f orgPos = player.pos + Vec3f(0.f, 40.f, 0.f);
if(io->obj->fastaccess.left_attach >= 0) {
orgPos = io->obj->vertexlist3[io->obj->fastaccess.left_attach].v;
}
Anglef orgAngle = player.angle;
PlayerLaunchArrow_Test(aimratio, poisonous, orgPos, orgAngle);
if(sp_max) {
Anglef angle;
Vec3f pos = player.pos + Vec3f(0.f, 40.f, 0.f);
angle.setYaw(player.angle.getYaw());
angle.setPitch(player.angle.getPitch() + 8);
angle.setRoll(player.angle.getRoll());
PlayerLaunchArrow_Test(aimratio, poisonous, pos, angle);
angle.setYaw(player.angle.getYaw());
angle.setPitch(player.angle.getPitch() - 8);
PlayerLaunchArrow_Test(aimratio, poisonous, pos, angle);
angle.setYaw(player.angle.getYaw());
angle.setPitch(player.angle.getPitch() + 4.f);
PlayerLaunchArrow_Test(aimratio, poisonous, pos, angle);
angle.setYaw(player.angle.getYaw());
angle.setPitch(player.angle.getPitch() - 4.f);
PlayerLaunchArrow_Test(aimratio, poisonous, pos, angle);
}
AimTime = 0;
} else if(layer1.cur_anim == alist[ANIM_MISSILE_STRIKE]) {
BOW_FOCAL -= Original_framedelay;
if(BOW_FOCAL < 0)
BOW_FOCAL = 0;
if(layer1.flags & EA_ANIMEND) {
BOW_FOCAL = 0;
changeAnimation(io, 1, alist[ANIM_MISSILE_WAIT], EA_LOOP);
AimTime = 0;
PlayerWeaponBlocked = -1;
EERIE_LINKEDOBJ_UnLinkObjectFromObject(io->obj, arrowobj);
}
}
break;
}
LAST_WEAPON_TYPE = weapontype;
}
示例5: Update
void RuneOfGuardingSpell::Update(float timeDelta) {
ulCurrentTime += timeDelta;
if(lightHandleIsValid(m_light)) {
EERIE_LIGHT * light = lightHandleGet(m_light);
float fa = 1.0f - rnd() * 0.15f;
light->intensity = 0.7f + 2.3f * fa;
light->fallend = 350.f;
light->fallstart = 150.f;
light->rgb = Color3f(1.0f, 0.2f, 0.2f);
light->time_creation = (unsigned long)(arxtime);
light->duration = 200;
}
Vec3f pos = m_pos + Vec3f(0.f, -20.f, 0.f);
RenderMaterial mat;
mat.setDepthTest(true);
mat.setBlendType(RenderMaterial::Additive);
Anglef stiteangle;
Color3f stitecolor;
float stiteangleb = float(ulCurrentTime) * 0.01f;
stiteangle.setYaw(0);
stiteangle.setRoll(0);
stiteangle.setPitch(stiteangleb * 0.1f);
stitecolor = Color3f(0.4f, 0.4f, 0.6f);
float scale = std::sin(ulCurrentTime * 0.015f);
Vec3f stitescale = Vec3f(1.f, -0.1f, 1.f);
Draw3DObject(slight, stiteangle, pos, stitescale, stitecolor, mat);
stiteangle.setPitch(stiteangleb);
stitecolor = Color3f(0.6f, 0.f, 0.f);
stitescale = Vec3f(2.f) * (1.f + 0.01f * scale);
Draw3DObject(ssol, stiteangle, pos, stitescale, stitecolor, mat);
stitecolor = Color3f(0.6f, 0.3f, 0.45f);
stitescale = Vec3f(1.8f) * (1.f + 0.02f * scale);
Draw3DObject(srune, stiteangle, pos, stitescale, stitecolor, mat);
for(int n = 0; n < 4; n++) {
PARTICLE_DEF * pd = createParticle();
if(!pd) {
break;
}
pd->ov = pos + (Vec3f(40.f, 0.f, 40.f) * Vec3f(frand2(), 0.f, frand2()));
pd->move = Vec3f(0.8f, -4.f, 0.8f) * Vec3f(frand2(), rnd(), frand2());
pd->scale = Vec3f(-0.1f);
pd->tolive = Random::get(2600, 3200);
pd->tc = tex_p2;
pd->siz = 0.3f;
pd->rgb = Color3f(.4f, .4f, .6f);
}
Sphere sphere = Sphere(m_pos, std::max(m_level * 15.f, 50.f));
if(CheckAnythingInSphere(sphere, m_caster, CAS_NO_SAME_GROUP | CAS_NO_BACKGROUND_COL | CAS_NO_ITEM_COL| CAS_NO_FIX_COL | CAS_NO_DEAD_COL)) {
ARX_BOOMS_Add(m_pos);
LaunchFireballBoom(m_pos, (float)m_level);
DoSphericDamage(Sphere(m_pos, 30.f * m_level), 4.f * m_level, DAMAGE_AREA, DAMAGE_TYPE_FIRE | DAMAGE_TYPE_MAGICAL, m_caster);
ARX_SOUND_PlaySFX(SND_SPELL_RUNE_OF_GUARDING_END, &m_pos);
m_duration = 0;
}
}
示例6: ManageCombatModeAnimations
//.........这里部分代码省略.........
if(layer1.cur_anim == alist[ANIM_MISSILE_WAIT]) {
player.m_aimTime = PlatformDuration::ofRaw(1);
if(eeMousePressed1() && Player_Arrow_Count() > 0) {
changeAnimation(io, 1, alist[ANIM_MISSILE_STRIKE_PART_1]);
io->isHit = false;
}
}
if(layer1.cur_anim == alist[ANIM_MISSILE_STRIKE_PART_1] && (layer1.flags & EA_ANIMEND)) {
player.m_aimTime = 0;
changeAnimation(io, 1, alist[ANIM_MISSILE_STRIKE_PART_2]);
EERIE_LINKEDOBJ_LinkObjectToObject(io->obj, arrowobj, "left_attach", "attach", NULL);
}
// Now go for strike cycle...
if(layer1.cur_anim == alist[ANIM_MISSILE_STRIKE_PART_2] && (layer1.flags & EA_ANIMEND)) {
changeAnimation(io, 1, alist[ANIM_MISSILE_STRIKE_CYCLE], EA_LOOP);
player.m_aimTime = PlatformDuration::ofRaw(1);
} else if(layer1.cur_anim == alist[ANIM_MISSILE_STRIKE_CYCLE] && !eeMousePressed1()) {
EERIE_LINKEDOBJ_UnLinkObjectFromObject(io->obj, arrowobj);
changeAnimation(io, 1, alist[ANIM_MISSILE_STRIKE]);
SendIOScriptEvent(NULL, io, SM_STRIKE, "bow");
StrikeAimtime();
player.m_strikeAimRatio = player.m_bowAimRatio;
Entity * quiver = Player_Arrow_Count_Decrease();
float poisonous = 0.f;
if(quiver) {
poisonous = quiver->poisonous;
if(quiver->poisonous_count > 0) {
quiver->poisonous_count--;
if(quiver->poisonous_count <= 0)
quiver->poisonous = 0;
}
ARX_DAMAGES_DurabilityLoss(quiver, 1.f);
// TODO is this needed ?, quivers seem to self destruct via script, but maybe not all
if(ValidIOAddress(quiver) && quiver->durability <= 0.f) {
ARX_INTERACTIVE_DestroyIOdelayed(quiver);
}
}
float aimratio = player.m_strikeAimRatio;
if(sp_max && poisonous < 3.f)
poisonous = 3.f;
Vec3f orgPos = player.pos + Vec3f(0.f, 40.f, 0.f);
if(io->obj->fastaccess.left_attach != ActionPoint()) {
orgPos = actionPointPosition(io->obj, io->obj->fastaccess.left_attach);
}
Anglef orgAngle = player.angle;
PlayerLaunchArrow_Test(aimratio, poisonous, orgPos, orgAngle);
if(sp_max) {
Anglef angle;
Vec3f pos = player.pos + Vec3f(0.f, 40.f, 0.f);
angle.setPitch(player.angle.getPitch());
angle.setYaw(player.angle.getYaw() + 8);
angle.setRoll(player.angle.getRoll());
PlayerLaunchArrow_Test(aimratio, poisonous, pos, angle);
angle.setPitch(player.angle.getPitch());
angle.setYaw(player.angle.getYaw() - 8);
PlayerLaunchArrow_Test(aimratio, poisonous, pos, angle);
angle.setPitch(player.angle.getPitch());
angle.setYaw(player.angle.getYaw() + 4.f);
PlayerLaunchArrow_Test(aimratio, poisonous, pos, angle);
angle.setPitch(player.angle.getPitch());
angle.setYaw(player.angle.getYaw() - 4.f);
PlayerLaunchArrow_Test(aimratio, poisonous, pos, angle);
}
player.m_aimTime = 0;
} else if(layer1.cur_anim == alist[ANIM_MISSILE_STRIKE]) {
player.m_bowAimRatio -= bowZoomFromDuration(toMs(g_platformTime.lastFrameDuration()));
if(player.m_bowAimRatio < 0)
player.m_bowAimRatio = 0;
if(layer1.flags & EA_ANIMEND) {
player.m_bowAimRatio = 0;
changeAnimation(io, 1, alist[ANIM_MISSILE_WAIT], EA_LOOP);
player.m_aimTime = 0;
player.m_weaponBlocked = AnimationDuration::ofRaw(-1);
EERIE_LINKEDOBJ_UnLinkObjectFromObject(io->obj, arrowobj);
}
}
break;
}
}
LAST_WEAPON_TYPE = weapontype;
}
示例7: Render
//.........这里部分代码省略.........
float t3 = t2 * t1 ;
float f0 = 2.f * t3 - 3.f * t2 + 1.f ;
float f1 = -2.f * t3 + 3.f * t2 ;
float f2 = t3 - 2.f * t2 + t1 ;
float f3 = t3 - t2 ;
float val = pathways[kpsuiv].p.x;
float p0 = 0.5f * (val - pathways[kpprec].p.x) ;
float p1 = 0.5f * (pathways[kpsuivsuiv].p.x - pathways[kp].p.x) ;
v.x = f0 * pathways[kp].p.x + f1 * val + f2 * p0 + f3 * p1 ;
val = pathways[kpsuiv].p.y ;
p0 = 0.5f * (val - pathways[kpprec].p.y) ;
p1 = 0.5f * (pathways[kpsuivsuiv].p.y - pathways[kp].p.y) ;
v.y = f0 * pathways[kp].p.y + f1 * val + f2 * p0 + f3 * p1 ;
val = pathways[kpsuiv].p.z ;
p0 = 0.5f * (val - pathways[kpprec].p.z) ;
p1 = 0.5f * (pathways[kpsuivsuiv].p.z - pathways[kp].p.z) ;
v.z = f0 * pathways[kp].p.z + f1 * val + f2 * p0 + f3 * p1 ;
newpos = v;
if(!((fTrail - (i * iBezierPrecision + toto)) > iLength)) {
float c;
if(fTrail < iLength) {
c = 1.0f - ((fTrail - (i * iBezierPrecision + toto)) / fTrail);
} else {
c = 1.0f - ((fTrail - (i * iBezierPrecision + toto)) / (float)iLength);
}
float fsize = c;
float alpha = c - 0.2f;
if(alpha < 0.2f)
alpha = 0.2f;
c += frand2() * 0.1f;
if (c < 0) c = 0;
else if (c > 1) c = 1;
Color color = (fColor * (c * alpha)).to<u8>();
if(fsize < 0.5f)
fsize = fsize * 2 * 3;
else
fsize = (1.0f - fsize + 0.5f) * 2 * (3 * 0.5f);
float fs = fsize * 6 + rnd() * 0.3f;
float fe = fsize * 6 + rnd() * 0.3f;
Draw3DLineTex(lastpos, newpos, color, fs, fe);
}
Vec3f temp_vector = lastpos;
lastpos = newpos;
newpos = temp_vector;
}
}
Vec3f av = newpos - lastpos;
float bubu = getAngle(av.x, av.z, 0, 0);
float bubu1 = getAngle(av.x, av.y, 0, 0);
Vec3f stitepos = lastpos;
Anglef stiteangle;
stiteangle.setPitch(-degrees(bubu));
stiteangle.setYaw(0);
stiteangle.setRoll(-(degrees(bubu1)));
if(av.x < 0)
stiteangle.setRoll(stiteangle.getRoll() - 90);
if(av.x > 0)
stiteangle.setRoll(stiteangle.getRoll() + 90);
if(stiteangle.getRoll() < 0)
stiteangle.setRoll(stiteangle.getRoll() + 360.0f);
Color3f stitecolor;
if(spells[spellinstance].caster == 0 && cur_mr == 3) {
stitecolor.r = 1.f;
stitecolor.g = 0.f;
stitecolor.b = 0.2f;
} else {
stitecolor.r = 0.3f;
stitecolor.g = 0.3f;
stitecolor.b = 0.5f;
}
Vec3f stitescale = Vec3f_ONE;
if(smissile)
DrawEERIEObjEx(smissile, &stiteangle, &stitepos, &stitescale, stitecolor);
eCurPos = lastpos;
}
示例8: Update
void RuneOfGuardingSpell::Update() {
EERIE_LIGHT * light = lightHandleGet(m_light);
if(light) {
float fa = Random::getf(0.85f, 1.0f);
light->intensity = 0.7f + 2.3f * fa;
light->fallend = 350.f;
light->fallstart = 150.f;
light->rgb = Color3f(1.0f, 0.2f, 0.2f);
light->creationTime = g_gameTime.now();
light->duration = GameDurationMs(200);
}
Vec3f pos = m_pos + Vec3f(0.f, -20.f, 0.f);
RenderMaterial mat;
mat.setDepthTest(true);
mat.setBlendType(RenderMaterial::Additive);
Anglef stiteangle;
Color3f stitecolor;
float stiteangleb = m_elapsed / GameDurationMs(100);
stiteangle.setPitch(0);
stiteangle.setRoll(0);
stiteangle.setYaw(stiteangleb * 0.1f);
stitecolor = Color3f(0.4f, 0.4f, 0.6f);
float scale = std::sin(m_elapsed / GameDurationMsf(66.6666666f));
Vec3f stitescale = Vec3f(1.f, -0.1f, 1.f);
Draw3DObject(slight, stiteangle, pos, stitescale, stitecolor, mat);
stiteangle.setYaw(stiteangleb);
stitecolor = Color3f(0.6f, 0.f, 0.f);
stitescale = Vec3f(2.f) * (1.f + 0.01f * scale);
Draw3DObject(ssol, stiteangle, pos, stitescale, stitecolor, mat);
stitecolor = Color3f(0.6f, 0.3f, 0.45f);
stitescale = Vec3f(1.8f) * (1.f + 0.02f * scale);
Draw3DObject(srune, stiteangle, pos, stitescale, stitecolor, mat);
for(int n = 0; n < 4; n++) {
PARTICLE_DEF * pd = createParticle();
if(!pd) {
break;
}
pd->ov = pos + arx::randomOffsetXZ(40.f);
pd->move = arx::linearRand(Vec3f(-0.8f, -4.f, -0.8f), Vec3f(0.8f, 0.f, 0.8f));
pd->scale = Vec3f(-0.1f);
pd->tolive = Random::getu(2600, 3200);
pd->tc = tex_p2;
pd->siz = 0.3f;
pd->rgb = Color3f(.4f, .4f, .6f);
}
Sphere sphere = Sphere(m_pos, std::max(m_level * 15.f, 50.f));
if(CheckAnythingInSphere(sphere, m_caster, CAS_NO_SAME_GROUP | CAS_NO_BACKGROUND_COL | CAS_NO_ITEM_COL
| CAS_NO_FIX_COL | CAS_NO_DEAD_COL)) {
spawnFireHitParticle(m_pos, 0);
PolyBoomAddScorch(m_pos);
LaunchFireballBoom(m_pos, m_level);
DoSphericDamage(Sphere(m_pos, 30.f * m_level), 4.f * m_level,
DAMAGE_AREA, DAMAGE_TYPE_FIRE | DAMAGE_TYPE_MAGICAL, m_caster);
ARX_SOUND_PlaySFX(g_snd.SPELL_RUNE_OF_GUARDING_END, &m_pos);
requestEnd();
}
}
示例9: Render
void CMagicMissile::Render()
{
Vec3f lastpos, newpos;
Vec3f v;
if(ulCurrentTime >= ulDuration)
return;
RenderMaterial mat;
mat.setCulling(CullNone);
mat.setDepthTest(true);
mat.setBlendType(RenderMaterial::Additive);
if(tex_mm)
mat.setTexture(tex_mm);
if(bMove) {
float fOneOnDuration = 1.f / (float)(ulDuration);
fTrail = (ulCurrentTime * fOneOnDuration) * (iBezierPrecision + 2) * 5;
}
newpos = lastpos = pathways[0];
for(int i = 0; i < 5; i++) {
const Vec3f v1 = pathways[std::max(0, i - 1)];
const Vec3f v2 = pathways[i];
const Vec3f v3 = pathways[i + 1];
const Vec3f v4 = pathways[std::min(5, i + 2)];
for(int toto = 1; toto < iBezierPrecision; toto++) {
if(fTrail < i * iBezierPrecision + toto)
break;
float t = toto * (1.0f / iBezierPrecision);
v = glm::catmullRom(v1, v2, v3, v4, t);
newpos = v;
if(!((fTrail - (i * iBezierPrecision + toto)) > iLength)) {
float c;
if(fTrail < iLength) {
c = 1.0f - ((fTrail - (i * iBezierPrecision + toto)) / fTrail);
} else {
c = 1.0f - ((fTrail - (i * iBezierPrecision + toto)) / (float)iLength);
}
float fsize = c;
float alpha = c - 0.2f;
if(alpha < 0.2f)
alpha = 0.2f;
c += Random::getf(-0.1f, 0.1f);
c = glm::clamp(c, 0.f, 1.f);
Color color = (m_trailColor * (c * alpha)).to<u8>();
if(fsize < 0.5f)
fsize = fsize * 2 * 3;
else
fsize = (1.0f - fsize + 0.5f) * 2 * (3 * 0.5f);
float fs = fsize * 6 + Random::getf(0.f, 0.3f);
float fe = fsize * 6 + Random::getf(0.f, 0.3f);
Draw3DLineTexNew(mat, lastpos, newpos, color, color, fs, fe);
}
Vec3f temp_vector = lastpos;
lastpos = newpos;
newpos = temp_vector;
}
}
Vec3f av = newpos - lastpos;
float bubu = getAngle(av.x, av.z, 0, 0);
float bubu1 = getAngle(av.x, av.y, 0, 0);
eCurPos = lastpos;
Anglef stiteangle;
stiteangle.setPitch(-glm::degrees(bubu));
stiteangle.setYaw(0);
stiteangle.setRoll(-(glm::degrees(bubu1)));
if(av.x < 0)
stiteangle.setRoll(stiteangle.getRoll() - 90);
if(av.x > 0)
stiteangle.setRoll(stiteangle.getRoll() + 90);
if(stiteangle.getRoll() < 0)
stiteangle.setRoll(stiteangle.getRoll() + 360.0f);
Draw3DObject(smissile, stiteangle, eCurPos, Vec3f_ONE, m_projectileColor, mat);
}
示例10: Render
void CIceProjectile::Render()
{
int i = 0;
if(ulCurrentTime >= ulDuration)
return;
GRenderer->SetCulling(Renderer::CullCW);
GRenderer->SetRenderState(Renderer::DepthWrite, false);
GRenderer->SetBlendFunc(Renderer::BlendInvDstColor, Renderer::BlendOne);
GRenderer->SetRenderState(Renderer::AlphaBlending, true);
iMax = (int)((iNumber * 2) * fOneOnDuration * ulCurrentTime);
if(iMax > iNumber)
iMax = iNumber;
for(i = 0; i < iMax; i++) {
if(tSize[i].x < tSizeMax[i].x)
tSize[i].x += 0.1f;
if(tSize[i].x > tSizeMax[i].x)
tSize[i].x = tSizeMax[i].x;
if(tSize[i].y < tSizeMax[i].y)
tSize[i].y += 0.1f;
if(tSize[i].y < 0)
tSize[i].y = 0;
if(tSize[i].y > tSizeMax[i].y)
tSize[i].y = tSizeMax[i].y;
if(tSize[i].z < tSizeMax[i].z)
tSize[i].z += 0.1f;
if(tSize[i].z > tSizeMax[i].z)
tSize[i].z = tSizeMax[i].z;
Anglef stiteangle;
Vec3f stitepos;
Vec3f stitescale;
Color3f stitecolor;
stiteangle.setPitch((float) cos(radians(tPos[i].x)) * 360);
stiteangle.setYaw(0);
stiteangle.setRoll(0);
stitepos = tPos[i];
float tt;
tt = tSizeMax[i].y * fColor;
stitecolor.g = stitecolor.r = tt * 0.7f;
stitecolor.b = tt * 0.9f;
if(stitecolor.r > 1)
stitecolor.r = 1;
if(stitecolor.g > 1)
stitecolor.g = 1;
if(stitecolor.b > 1)
stitecolor.b = 1;
stitescale = tSize[i];
if(tType[i] == 0)
DrawEERIEObjEx(smotte, &stiteangle, &stitepos, &stitescale, stitecolor);
else
DrawEERIEObjEx(stite, &stiteangle, &stitepos, &stitescale, stitecolor);
}
for(i = 0; i < min(iNumber, iMax + 1); i++) {
float t = rnd();
if(t < 0.01f) {
PARTICLE_DEF * pd = createParticle();
if(pd) {
pd->ov = tPos[i] + randomVec(-5.f, 5.f);
pd->move = randomVec(-2.f, 2.f);
pd->siz = 20.f;
float t = min(2000.f + rnd() * 2000.f,
ulDuration - ulCurrentTime + 500.0f * rnd());
pd->tolive = checked_range_cast<unsigned long>(t);
pd->tc = tex_p2;
pd->special = FADE_IN_AND_OUT | ROTATING | MODULATE_ROTATION | DISSIPATING;
pd->fparam = 0.0000001f;
pd->rgb = Color3f(0.7f, 0.7f, 1.f);
}
} else if(t > 0.095f) {
PARTICLE_DEF * pd = createParticle();
if(pd) {
pd->ov = tPos[i] + randomVec(-5.f, 5.f) - Vec3f(0.f, 50.f, 0.f);
pd->move = Vec3f(0.f, 2.f - 4.f * rnd(), 0.f);
pd->siz = 0.5f;
float t = min(2000.f + rnd() * 1000.f,
ulDuration - ulCurrentTime + 500.0f * rnd());
pd->tolive = checked_range_cast<unsigned long>(t);
//.........这里部分代码省略.........