当前位置: 首页>>代码示例>>C++>>正文


C++ Anglef类代码示例

本文整理汇总了C++中Anglef的典型用法代码示例。如果您正苦于以下问题:C++ Anglef类的具体用法?C++ Anglef怎么用?C++ Anglef使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了Anglef类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: 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);
}
开发者ID:Drakesinger,项目名称:ArxLibertatis,代码行数:30,代码来源:FlyingEye.cpp

示例2: Create

void CMagicMissile::Create(const Vec3f & aeSrc, const Anglef & angles)
{
	SetDuration(ulDuration);
	
	eCurPos = eSrc = aeSrc;
	
	short i = 40.f;
	Vec3f e = eSrc;
	e += angleToVectorXZ(angles.getPitch()) * (50.f * i);
	e.y += std::sin(glm::radians(MAKEANGLE(angles.getYaw()))) * (50.f * i);
	
	pathways[0] = eSrc;
	pathways[5] = e;
	Split(pathways, 0, 5, 50, 0.5f);

	for(i = 0; i < 6; i++) {
		if(pathways[i].y >= eSrc.y + 150) {
			pathways[i].y = eSrc.y + 150;
		}
	}

	fTrail = 0;

	iLength = 50;
	iBezierPrecision = BEZIERPrecision;
	fOneOnBezierPrecision = 1.0f / (float) iBezierPrecision;
	bExplo = false;
	bMove = true;

	ARX_SOUND_PlaySFX(SND_SPELL_MM_CREATE, &eCurPos);
	ARX_SOUND_PlaySFX(SND_SPELL_MM_LAUNCH, &eCurPos);
	snd_loop = ARX_SOUND_PlaySFX(SND_SPELL_MM_LOOP, &eCurPos, 1.0F, ARX_SOUND_PLAY_LOOPED);
}
开发者ID:hulu1528,项目名称:ArxLibertatis,代码行数:33,代码来源:MagicMissile.cpp

示例3: angleToQuatForExtraRotation

glm::quat angleToQuatForExtraRotation(const Anglef & angle) {
	Anglef vt1;
	vt1.setYaw(angle.getRoll());
	vt1.setPitch(angle.getPitch());
	vt1.setRoll(angle.getYaw());
	
	return QuatFromAngles(vt1);
}
开发者ID:Gladius1,项目名称:ArxLibertatis,代码行数:8,代码来源:Math.cpp

示例4: toRotationMatrix

glm::mat4 toRotationMatrix(const Anglef & angle) {
	float yaw = glm::radians(angle.getYaw());
	float pitch = glm::radians(angle.getPitch());
	float roll = glm::radians(angle.getRoll());
	glm::mat4 rotateX = glm::eulerAngleX(yaw);
	glm::mat4 rotateY = glm::eulerAngleY(pitch);
	glm::mat4 rotateZ = glm::eulerAngleZ(-roll);
	return rotateZ * rotateX * rotateY;
}
开发者ID:Gladius1,项目名称:ArxLibertatis,代码行数:9,代码来源:Math.cpp

示例5: 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);
	}
}
开发者ID:carriercomm,项目名称:ArxLibertatis,代码行数:57,代码来源:Spells05.cpp

示例6: angleToVector

Vec3f angleToVector(const Anglef & angle) {
	Vec3f cam_vector = angleToVectorXZ(angle.getPitch());
	
	float yaw = glm::radians(angle.getYaw());
	cam_vector.x *= std::cos(yaw);
	cam_vector.y = std::sin(yaw);
	cam_vector.z *= std::cos(yaw);
	
	return cam_vector;
}
开发者ID:Gladius1,项目名称:ArxLibertatis,代码行数:10,代码来源:Math.cpp

示例7: GetApparentBodyYaw

// Accounts for ComfortTurn setting.
Anglef Player::GetApparentBodyYaw()
{
    Anglef yaw = BodyYaw;
    if ( ComfortTurnSnap > 0.0f )
    {
        float yawR = yaw.Get();
        yawR *= 1.0f / ComfortTurnSnap;
        yawR = floorf ( yawR + 0.5f );
        yawR *= ComfortTurnSnap;
        yaw.Set ( yawR );
    }
    return yaw;
}
开发者ID:PLUSToolkit,项目名称:OvrvisionPro,代码行数:14,代码来源:Player.cpp

示例8: 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;
}
开发者ID:BSzili,项目名称:ArxLibertatis,代码行数:13,代码来源:Camera.cpp

示例9: Vec3f

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);
	}
}
开发者ID:carriercomm,项目名称:ArxLibertatis,代码行数:49,代码来源:Spells05.cpp

示例10: angleToQuatForArrow

glm::quat angleToQuatForArrow(const Anglef & angle) {
	float aa = angle.getYaw();
	float ab = 90 - angle.getPitch();
	
	Vec3f front(0,0,1);
	Vec3f up(0,-1,0);
	
	front = VRotateZ(front, aa);
	front = VRotateY(front, ab);
	up = VRotateZ(up, aa);
	up = VRotateY(up, ab);
	
	glm::mat4x4 tmat;
	MatrixSetByVectors(tmat, front, up);
	return glm::toQuat(tmat);
}
开发者ID:Gladius1,项目名称:ArxLibertatis,代码行数:16,代码来源:Math.cpp

示例11: 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);
}
开发者ID:EstrangedGames,项目名称:ArxLibertatis,代码行数:42,代码来源:Spells06.cpp

示例12: QuatFromAngles

//*************************************************************************************
// Converts euler angles to a unit quaternion.
//*************************************************************************************
glm::quat QuatFromAngles(const Anglef & angle) {
	float A, B;
	A = glm::radians(angle.getYaw()) * ( 1.0f / 2 );
	B = glm::radians(angle.getPitch()) * ( 1.0f / 2 );

	float fSinYaw   = glm::sin(A);
	float fCosYaw   = glm::cos(A);
	float fSinPitch = glm::sin(B);
	float fCosPitch = glm::cos(B);
	A = glm::radians(angle.getRoll()) * ( 1.0f / 2 );
	float fSinRoll  = glm::sin(A);
	float fCosRoll  = glm::cos(A);
	A = fCosRoll * fCosPitch;
	B = fSinRoll * fSinPitch;
	
	glm::quat q;
	q.x = fSinRoll * fCosPitch * fCosYaw - fCosRoll * fSinPitch * fSinYaw;
	q.y = fCosRoll * fSinPitch * fCosYaw + fSinRoll * fCosPitch * fSinYaw;
	q.z = A * fSinYaw - B * fCosYaw;
	q.w = A * fCosYaw + B * fSinYaw;
	return q;
}
开发者ID:Gladius1,项目名称:ArxLibertatis,代码行数:25,代码来源:Math.cpp

示例13: Create

void CMagicMissile::Create(const Vec3f & aeSrc, const Anglef & angles)
{
	SetDuration(ulDuration);
	SetAngle(angles.getPitch());

	this->angles = angles;
	eCurPos = eSrc = aeSrc;

	Vec3f e = eSrc;

	int i = 40;
	e.x -= fBetaRadSin * 50 * i;
	e.y += sin(radians(MAKEANGLE(this->angles.getYaw()))) * 50 * i;
	e.z += fBetaRadCos * 50 * i;

	pathways[0].p = eSrc;
	pathways[5].p = e;
	Split(pathways, 0, 5, 50, 0.5f);

	for(i = 0; i < 6; i++) {
		if(pathways[i].p.y >= eSrc.y + 150) {
			pathways[i].p.y = eSrc.y + 150;
		}
	}

	fTrail = 0;

	iLength = 50;
	iBezierPrecision = BEZIERPrecision;
	fOneOnBezierPrecision = 1.0f / (float) iBezierPrecision;
	bExplo = false;
	bMove = true;

	ARX_SOUND_PlaySFX(SND_SPELL_MM_CREATE, &eCurPos);
	ARX_SOUND_PlaySFX(SND_SPELL_MM_LAUNCH, &eCurPos);
	snd_loop = ARX_SOUND_PlaySFX(SND_SPELL_MM_LOOP, &eCurPos, 1.0F, ARX_SOUND_PLAY_LOOPED);
}
开发者ID:zhaozw,项目名称:ArxLibertatis,代码行数:37,代码来源:Spells01.cpp

示例14: Draw3DLineTexNew


//.........这里部分代码省略.........
	
	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);
}
开发者ID:hulu1528,项目名称:ArxLibertatis,代码行数:101,代码来源:MagicMissile.cpp

示例15: 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;
//.........这里部分代码省略.........
开发者ID:Drakesinger,项目名称:ArxLibertatis,代码行数:101,代码来源:Cursor.cpp


注:本文中的Anglef类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。