x
Yes
No
Do you want to visit DriveHQ English website?
首页
产品服务
价格
免费试用
下载客户端
关于我们
云文件服务
|
云备份服务
|
FTP服务
|
企业邮箱服务
|
网站托管
|
客户端软件
云文件服务
云备份服务
FTP服务
企业级邮箱服务
网站托管
客户端软件
Game3DInstance.cpp - Hosted on DriveHQ Cloud IT Platform
返回上层目录
上传
下载
共享
发布
新建文件夹
新建文件
复制
剪切
删除
粘贴
评论
升级服务
路径: \\game3dprogramming\materials\DarkPuzzle\GameEngine\Game3DInstance.cpp
旋转
特效
属性
历史版本
#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
网页地址
文件地址
上一页
25/65
下一页
下载
( 2 KB )
Comments
Total ratings:
0
Average rating:
无评论
of 10
Would you like to comment?
Join now
, or
Logon
if you are already a member.