本文整理汇总了C++中Anglef::setPitch方法的典型用法代码示例。如果您正苦于以下问题:C++ Anglef::setPitch方法的具体用法?C++ Anglef::setPitch怎么用?C++ Anglef::setPitch使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Anglef
的用法示例。
在下文中一共展示了Anglef::setPitch方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Render
void CRuneOfGuarding::Render()
{
Vec3f pos = eSrc + 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);
}
}
示例2: ARXDRAW_DrawEyeBall
void ARXDRAW_DrawEyeBall() {
if(eyeball.exist == 0 || !eyeballobj)
return;
float d;
if(eyeball.exist < 0) {
d = (float)(-eyeball.exist)*( 1.0f / 100 );
eyeball.exist++;
} else if(eyeball.exist > 2) {
d = (float)(eyeball.exist)*( 1.0f / 100 );
}
else
return;
Anglef angle = eyeball.angle;
angle.setPitch(MAKEANGLE(180.f - angle.getPitch()));
Vec3f pos = eyeball.pos;
pos.y += eyeball.floating;
Vec3f scale = Vec3f(d);
Color3f rgb = Color3f::gray(d);
RenderMaterial mat;
mat.setDepthTest(true);
mat.setBlendType(RenderMaterial::Additive);
Draw3DObject(eyeballobj, angle, pos, scale, rgb, mat);
}
示例3: 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;
}
示例4: Render
void CDisarmTrap::Render() {
float x = eSrc.x;
float y = eSrc.y;
float z = eSrc.z;
if(ulCurrentTime >= ulDuration)
return;
GRenderer->SetRenderState(Renderer::DepthWrite, false);
GRenderer->SetRenderState(Renderer::AlphaBlending, true);
// TODO why not just entities.player()->pos ?
for(size_t i = 0; i < entities.size(); i++) {
if(entities[i]) {
x = entities[i]->pos.x;
y = entities[i]->pos.y;
z = entities[i]->pos.z;
}
}
GRenderer->SetTexture(0, tex_p2);
GRenderer->SetRenderState(Renderer::AlphaBlending, true);
Anglef stiteangle = Anglef::ZERO;
Vec3f stitepos;
Vec3f stitescale;
Color3f stitecolor;
stiteangle.setPitch((float) ulCurrentTime * fOneOnDuration * 120);
stitepos.x = x;
stitepos.y = y;
stitepos.z = z;
stitecolor.r = 0.8f;
stitecolor.g = 0.1f;
stitecolor.b = 0.1f;
stitescale.z = 1.8f;
stitescale.y = 1.8f;
stitescale.x = 1.8f;
DrawEERIEObjEx(srune, &stiteangle, &stitepos, &stitescale, stitecolor);
}
示例5: 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;
}
示例6: Update
void IceFieldSpell::Update(float timeDelta) {
ARX_UNUSED(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(0.76f, 0.76f, 1.0f) + Color3f(0.f, 0.f, -rnd()*(1.0f/10));
el->duration = 600;
el->extras=0;
}
if(!VisibleSphere(Sphere(m_pos - Vec3f(0.f, 120.f, 0.f), 350.f)))
return;
RenderMaterial mat;
mat.setDepthTest(true);
mat.setBlendType(RenderMaterial::Additive);
for(int i = 0; i < iMax; i++) {
tSize[i] += Vec3f(0.1f);
tSize[i] = glm::min(tSize[i], tSizeMax[i]);
Anglef stiteangle = Anglef::ZERO;
Vec3f stitepos;
Vec3f stitescale;
Color3f stitecolor;
stiteangle.setPitch(glm::cos(glm::radians(tPos[i].x)) * 360);
stitepos.x = tPos[i].x;
stitepos.y = m_pos.y;
stitepos.z = tPos[i].z;
stitecolor.r = tSizeMax[i].y * 0.7f;
stitecolor.g = tSizeMax[i].y * 0.7f;
stitecolor.b = tSizeMax[i].y * 0.9f;
if(stitecolor.r > 1)
stitecolor.r = 1;
if(stitecolor.g > 1)
stitecolor.g = 1;
if(stitecolor.b > 1)
stitecolor.b = 1;
stitescale.z = tSize[i].x;
stitescale.y = tSize[i].y;
stitescale.x = tSize[i].z;
EERIE_3DOBJ * obj = (tType[i] == 0) ? smotte : stite;
Draw3DObject(obj, stiteangle, stitepos, stitescale, stitecolor, mat);
}
for(int i = 0; i < iMax * 0.5f; 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;
pd->tolive = Random::get(2000, 6000);
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;
pd->tolive = Random::get(2000, 6000);
pd->tc = tex_p1;
pd->special = FADE_IN_AND_OUT | ROTATING | MODULATE_ROTATION | DISSIPATING;
pd->fparam = 0.0000001f;
pd->rgb = Color3f(0.7f, 0.7f, 1.f);
}
}
}
}
示例7: ARX_INTERFACE_ManageOpenedBook_Finish
void ARX_INTERFACE_ManageOpenedBook_Finish()
{
Vec3f pos = Vec3f(0.f, 0.f, 2100.f);
Anglef angle = Anglef::ZERO;
EERIE_LIGHT * light = lightHandleGet(torchLightHandle);
EERIE_LIGHT tl = *light;
light->pos = Vec3f(500.f, -1960.f, 1590.f);
light->exist = 1;
light->rgb = Color3f(0.6f, 0.7f, 0.9f);
light->intensity = 1.8f;
light->fallstart=4520.f;
light->fallend = light->fallstart + 600.f;
RecalcLight(light);
EERIE_CAMERA * oldcam = ACTIVECAM;
PDL[0] = light;
TOTPDL=1;
Vec2i tmpPos = Vec2i_ZERO;
for(size_t i = 0; i < RUNE_COUNT; i++) {
if(!gui::necklace.runes[i])
continue;
EERIE_3DOBJ * rune = gui::necklace.runes[i];
bookcam.center.x = (382 + tmpPos.x * 45 + BOOKDEC.x) * g_sizeRatio.x;
bookcam.center.y = (100 + tmpPos.y * 64 + BOOKDEC.y) * g_sizeRatio.y;
SetActiveCamera(&bookcam);
PrepareCamera(&bookcam, g_size);
// First draw the lace
angle.setPitch(0.f);
if(player.hasRune((Rune)i)) {
TransformInfo t1(pos, glm::toQuat(toRotationMatrix(angle)));
DrawEERIEInter(gui::necklace.lacet, t1, NULL);
if(rune->angle.getPitch() != 0.f) {
if(rune->angle.getPitch() > 300.f)
rune->angle.setPitch(300.f);
angle.setPitch(std::sin(arxtime.get_updated() * (1.0f / 200)) * rune->angle.getPitch() * (1.0f / 40));
}
rune->angle.setPitch(rune->angle.getPitch() - framedelay * 0.2f);
if(rune->angle.getPitch() < 0.f)
rune->angle.setPitch(0.f);
GRenderer->SetRenderState(Renderer::DepthWrite, true);
GRenderer->SetRenderState(Renderer::AlphaBlending, false);
// Now draw the rune
TransformInfo t2(pos, glm::toQuat(toRotationMatrix(angle)));
DrawEERIEInter(rune, t2, NULL);
EERIE_2D_BBOX runeBox;
UpdateBbox2d(*rune, runeBox);
PopAllTriangleList();
tmpPos.x++;
if(tmpPos.x > 4) {
tmpPos.x = 0;
tmpPos.y++;
}
const Rect runeMouseTestRect(
runeBox.min.x,
runeBox.min.y,
runeBox.max.x,
runeBox.max.y
);
// Checks for Mouse floating over a rune...
if(runeMouseTestRect.contains(Vec2i(DANAEMouse))) {
long r=0;
for(size_t j = 0; j < rune->facelist.size(); j++) {
float n = PtIn2DPolyProj(rune, &rune->facelist[j], (float)DANAEMouse.x, (float)DANAEMouse.y);
if(n!=0.f) {
r=1;
break;
}
}
if(r) {
GRenderer->SetRenderState(Renderer::AlphaBlending, true);
GRenderer->SetBlendFunc(Renderer::BlendOne, Renderer::BlendOne);
//.........这里部分代码省略.........
示例8: 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;
}
}
示例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: 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;
}
示例11: 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;
}
示例12: 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();
}
}
示例13: Manage3DCursor
bool Manage3DCursor(Entity * io, bool simulate) {
arx_assert(io);
if(BLOCK_PLAYER_CONTROLS)
return false;
float ag = player.angle.getYaw();
if(ag > 180)
ag = ag - 360;
float drop_miny = (float)(g_size.center().y) - g_size.center().y * (ag * (1.f/70));
if(DANAEMouse.y < drop_miny)
return false;
Anglef temp = Anglef::ZERO;
if(io->ioflags & IO_INVERTED) {
temp.setYaw(180.f);
temp.setPitch(-MAKEANGLE(270.f - io->angle.getPitch() - (player.angle.getPitch() - STARTED_ANGLE)));
} else {
temp.setPitch(MAKEANGLE(270.f - io->angle.getPitch() - (player.angle.getPitch() - STARTED_ANGLE)));
}
EERIE_3D_BBOX bbox;
for(size_t i = 0; i < io->obj->vertexlist.size(); i++) {
bbox.add(io->obj->vertexlist[i].v);
}
Vec3f mvectx = angleToVectorXZ(player.angle.getPitch() - 90.f);
Vec2f mod = Vec2f(Vec2i(DANAEMouse) - g_size.center()) / Vec2f(g_size.center()) * Vec2f(160.f, 220.f);
mvectx *= mod.x;
Vec3f mvecty(0, mod.y, 0);
Vec3f orgn = player.pos;
orgn += angleToVector(player.angle) * 50.f;
orgn += mvectx;
orgn.y += mvecty.y;
Vec3f dest = player.pos;
dest += angleToVector(player.angle) * 10000.f;
dest += mvectx;
dest.y += mvecty.y * 5.f;
Vec3f pos = orgn;
Vec3f movev = glm::normalize(dest - orgn);
float lastanything = 0.f;
float height = -(bbox.max.y - bbox.min.y);
if(height > -30.f)
height = -30.f;
Vec3f objcenter = bbox.min + (bbox.max - bbox.min) * Vec3f(0.5f);
Vec3f collidpos = Vec3f_ZERO;
bool collidpos_ok = false;
{
float maxdist = 0.f;
for(size_t i = 0; i < io->obj->vertexlist.size(); i++) {
const EERIE_VERTEX & vert = io->obj->vertexlist[i];
float dist = glm::distance(Vec2f(objcenter.x, objcenter.z), Vec2f(vert.v.x, vert.v.z)) - 4.f;
maxdist = std::max(maxdist, dist);
}
if(io->obj->pbox) {
Vec2f tmpVert(io->obj->pbox->vert[0].initpos.x, io->obj->pbox->vert[0].initpos.z);
for(int i = 1; i < io->obj->pbox->nb_physvert; i++) {
const PHYSVERT & physVert = io->obj->pbox->vert[i];
float dist = glm::distance(tmpVert, Vec2f(physVert.initpos.x, physVert.initpos.z)) + 14.f;
maxdist = std::max(maxdist, dist);
}
}
Cylinder cyl2;
const float inc = 10.f;
long iterating = 40;
cyl2.height = std::min(-30.f, height);
cyl2.radius = glm::clamp(maxdist, 20.f, 150.f);
while(iterating > 0) {
cyl2.origin = pos + movev * inc + Vec3f(0.f, bbox.max.y, 0.f);
float anything = CheckAnythingInCylinder(cyl2, io, CFLAG_JUST_TEST | CFLAG_COLLIDE_NOCOL | CFLAG_NO_NPC_COLLIDE);
if(anything < 0.f) {
if(iterating == 40) {
CANNOT_PUT_IT_HERE = 1;
// TODO is this correct ?
return true;
//.........这里部分代码省略.........
示例14: 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);
}
示例15: 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);
//.........这里部分代码省略.........