x
Yes
No
Do you want to visit DriveHQ English website?
Inicio
Características
Precios
Prueba gratuita
Software cliente
Acerca de nosotros
Servidor de archivos
|
Solución de copias de seguridad
|
Servidor FTP
|
Servidor de correo electrónico
|
Alojamiento web
|
Software cliente
Servidor de archivos
Solución de copia de seguridad
Servidor FTP
Servidor de correo electrónico
Alojamiento web
Software cliente
Game3DInstance.cpp - Hosted on DriveHQ Cloud IT Platform
Arriba
Subir
Descargar
Compartir
Publicar
Nueva carpeta
Nuevo archivo
Copiar
Cortar
Eliminar
Pegar
Clasificación
Actualizar
Ruta de la carpeta: \\game3dprogramming\materials\DarkPuzzle\GameEngine\Game3DInstance.cpp
Girar
Efecto
Propiedad
Historial
#pragma once //#include "DXUT.h" #include "DarkPuzzle.h" #include "Game3DInstance.h" #include "GameLevel.h" namespace DarkBattle{ MyHashTable
Game3DInstance::pool; Game3DInstance::Game3DInstance(Game3DObject* pObjectResource, btRigidBody* pRigidBody){ this->pObjectResource = pObjectResource; assert(this->pObjectResource!=NULL); this->pRigidBody = pRigidBody; assert(this->pRigidBody!=NULL); assert(pRigidBody->getUserPointer()==NULL); pRigidBody->setUserPointer((void*)this); } D3DXMATRIX Game3DInstance::GetTransformMatrix() const{ D3DXMATRIX ret; //if (pRigidBody->getMotionState()) //{ // btDefaultMotionState* myMotionState = (btDefaultMotionState*)pRigidBody->getMotionState(); // myMotionState->m_graphicsWorldTrans.getOpenGLMatrix((btScalar*)&ret); //} else //{ pRigidBody->getWorldTransform().getOpenGLMatrix((btScalar*)&ret); //} return ret; } float Game3DInstance::GetAngle() const{ //D3DXMATRIX mat = GetTransformMatrix(); D3DXQUATERNION quat; //D3DXQuaternionRotationMatrix(&quat,&mat); D3DXVECTOR3 axis; float angle; btQuaternion btQuad = pRigidBody->getOrientation(); quat = D3DXQUATERNION(btQuad.x(),btQuad.y(),btQuad.z(),btQuad.w()); D3DXQuaternionToAxisAngle(&quat,&axis,&angle); return (axis.z>0)?angle:-angle; //return (float)pRigidBody->getOrientation().getAngle(); } void Game3DInstance::CreateReference(Game3DObject* pObjectResource, btRigidBody* pRigidBody,char* name){ Game3DInstance* pInstance = new Game3DInstance(pObjectResource,pRigidBody); pool.Put(name,pInstance); } void Game3DInstance::GetReference(char* name, Game3DObject **ppObjectResource, btRigidBody **ppRigidBody){ assert(ppObjectResource!=NULL); assert(ppRigidBody!=NULL); Game3DInstance* instance = pool.Get(name); *ppObjectResource = instance->pObjectResource; *ppRigidBody = btRigidBody::Clone(instance->pRigidBody); (*ppRigidBody)->setCollisionFlags(0); } void Game3DInstance::InitAllReferences(){ for (MyIterator
iter = pool.Begin();!pool.IsEnd(iter);iter.Next()){ Game3DInstance* pInstance = iter.GetCurrent(); GameLevel::GetInstance()->RemoveRigidBody(pInstance->pRigidBody); } } }
Game3DInstance.cpp
Dirección de la página
Dirección del archivo
Anterior
25/65
Siguiente
Descargar
( 2 KB )
Comments
Total ratings:
0
Average rating:
No clasificado
of 10
Would you like to comment?
Join now
, or
Logon
if you are already a member.