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


C++ Matrix4x4::GetUpVector方法代码示例

本文整理汇总了C++中Matrix4x4::GetUpVector方法的典型用法代码示例。如果您正苦于以下问题:C++ Matrix4x4::GetUpVector方法的具体用法?C++ Matrix4x4::GetUpVector怎么用?C++ Matrix4x4::GetUpVector使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Matrix4x4的用法示例。


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

示例1: CharacterMovement

void CCharacterController::CharacterMovement(btCollisionWorld* pCollisionWorld, btScalar deltaTime)
{
	// Grab the new player transform before doing movement steps in case the player has been moved,
	// such as by a platform or teleported. No need to do a physics trace for it, the penetration
	// functions should handle that.
	btTransform mCharacter;
	CPhysicsEntity* pPhysicsEntity = static_cast<CBulletPhysics*>(GamePhysics())->GetPhysicsEntity(m_hEntity);
	pPhysicsEntity->m_oMotionState.getWorldTransform(mCharacter);

#ifdef _DEBUG
	Matrix4x4 mTest;
	mCharacter.getOpenGLMatrix(mTest);
	TAssert(mTest.GetForwardVector().Cross(mTest.GetLeftVector()).Equals(mTest.GetUpVector(), 0.001f));

	TAssert(mTest.GetUpVector().Equals(m_hEntity->GetUpVector(), 0.001f));
#endif

	m_pGhostObject->setWorldTransform(mCharacter);

	PreStep(pCollisionWorld);

	if (m_hEntity->IsFlying())
		PlayerFly(pCollisionWorld, deltaTime);
	else if (!m_hEntity->GetGroundEntity())
		PlayerFall(pCollisionWorld, deltaTime);
	else
		PlayerWalk(pCollisionWorld, deltaTime);

	FindGround(pCollisionWorld);

	btVector3 vecOrigin = m_pGhostObject->getWorldTransform().getOrigin();

	TAssert(vecOrigin.x() < 999999);
	TAssert(vecOrigin.x() > -999999);
	TAssert(vecOrigin.y() < 999999);
	TAssert(vecOrigin.y() > -999999);
	TAssert(vecOrigin.z() < 999999);
	TAssert(vecOrigin.z() > -999999);

	if ((mCharacter.getOrigin() - vecOrigin).length2() > 0.0001f)
		pPhysicsEntity->m_oMotionState.setWorldTransform(m_pGhostObject->getWorldTransform());
}
开发者ID:BSVino,项目名称:Digitanks,代码行数:42,代码来源:character_controller.cpp

示例2: Render

void CChunkTrees::Render() const
{
	if (!m_bTreesGenerated)
		return;

	if (!m_avecOrigins.size())
		return;

	CreateTreeVBO();

	float flScale = (float)CScalableFloat::ConvertUnits(1, m_pManager->m_pPlanet->GetScale(), SCALE_METER);

	Matrix4x4 mTransform = m_mChunk;

	CRenderingContext r(GameServer()->GetRenderer(), true);

	r.UseMaterial("textures/tree.mat");
	r.SetUniform("vecColor", Vector4D(1, 1, 1, 1));

	size_t iTrees = m_avecOrigins.size();
	for (size_t i = 0; i < iTrees; i++)
	{
		if (!m_abActive[i])
			continue;

		DoubleVector vecTree = m_avecOrigins[i];

		DoubleVector vecToTree = vecTree - m_pManager->m_pPlanet->GetCharacterLocalOrigin();

		mTransform.SetRightVector(vecToTree.Cross(mTransform.GetUpVector()).Normalized());
		mTransform.SetTranslation(vecToTree*flScale - mTransform.GetUpVector());

		r.LoadTransform(mTransform);

		r.BeginRenderVertexArray(s_iTreeVBO);
			r.SetPositionBuffer(0u, 5*sizeof(float));
			r.SetTexCoordBuffer(3*sizeof(float), 5*sizeof(float), 0);
		r.EndRenderVertexArray(s_iTreeVBOSize);
	}
}
开发者ID:BSVino,项目名称:CodenameInfinite,代码行数:40,代码来源:trees.cpp


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