x
Yes
No
Do you want to visit DriveHQ English website?
首页
产品服务
价格
免费试用
下载客户端
关于我们
云文件服务
|
云备份服务
|
FTP服务
|
企业邮箱服务
|
网站托管
|
客户端软件
云文件服务
云备份服务
FTP服务
企业级邮箱服务
网站托管
客户端软件
DataTypes.h - Hosted on DriveHQ Cloud IT Platform
返回上层目录
上传
下载
共享
发布
新建文件夹
新建文件
复制
剪切
删除
粘贴
评论
升级服务
路径: \\game3dprogramming\materials\GameFactory\GameFactoryDemo\GameFactory\DataTypes.h
旋转
特效
属性
历史版本
#pragma once #include "..\precompiled.h" #include
#include "NxExtended.h" using namespace std; using namespace stdext; namespace GameFactory{ #define toPVector3(vec3) {reinterpret_cast
(&(vec3))} #define fromPVector3(vector3) {reinterpret_cast
(&(vector3))} #define toPNxVec3(vec3) {reinterpret_cast
(&(vec3))} #define fromPNxVec3(nxvec3) {reinterpret_cast
(&(nxvec3))} struct less_str { bool operator()(String x, String y) const { //return (strcmp(x, y)>0); //differ return x.compare(y)>0;//differ } }; template
class MyIterator{ public: hash_map
::iterator iter; MyIterator(hash_map
::iterator iterator):iter(iterator){}; MyIterator(){hash_map
::iterator iterator;iter = hash_map
::iterator(iterator);}; void Next(){iter++;}; DataType* GetCurrent(){return (DataType*)iter->second;}; }; template
class MyHashTable{ private: hash_map
> mPool; public: DataType* Get(String key){ return (DataType*)(mPool.find(key)->second); }; void Put(const String& key, const DataType* value){ String localKey(key); //CLONE_STR(localKey,key); mPool.insert(pair
(localKey,(void*)value)); }; bool Exist(const String& key){return mPool.find(key)!=mPool.end();}; MyIterator
Begin(){ return MyIterator
(mPool.begin()); } bool IsEnd(MyIterator
iter){ return iter.iter==mPool.end(); } }; class MyListElement{ public: list
::iterator iter; }; //class MyList{//store in reversed order of pushing //private: // list
pool; //public: // inline void Put(MyListElement& value){ // pool.push_front(&value);//cannot use push_back because iter.end does not valid, see the line below // value.iter = pool.begin();//this iteration must be from the just added one // } // inline void Remove(MyListElement& value){//only remove, not delete the object // pool.erase(value.iter); // } // inline list
& GetPool(){return pool;} //}; template
//now support DataType! class MyList{//store in reversed order of pushing private: list
pool; public: inline void Put(DataType& value){ pool.push_front(&value);//cannot use push_back because iter.end does not valid, see the line below (static_cast
(&value))->iter = pool.begin();//this iteration must be from the just added one } inline void Remove(DataType& value){//only remove, not delete the object pool.erase((static_cast
(&value))->iter); } inline list
& GetPool(){return pool;} inline void Clear(){pool.clear();}; }; template
class MyListNonRemovable{ private: list
pool; public: inline void Put(DataType value){ pool.push_back(value);//to reserve the order of push and pop } inline list
& GetPool(){return pool;} inline void Clear(){ pool.clear(); } }; class Vec3: public Vector3{ public: //Real x,y,z; Vec3(){}; Vec3(Real x, Real y, Real z):Vector3(x,y,z){}; //OGRE specifics Vec3(const Vector3& s){ x=s.x;y=s.y;z=s.z; } //operator Vector3() const{ // return Vector3(x,y,z); //} //operator Vector3*(){ // return reinterpret_cast
(this); //} //PhysX specifics Vec3(const NxVec3& s){ x=s.x;y=s.y;z=s.z; } operator NxVec3() const{ return NxVec3(x,y,z); } operator NxVec3*(){ return reinterpret_cast
(this); } Vec3(const NxExtendedVec3& s){ x=s.x;y=s.y;z=s.z; } operator NxExtendedVec3() const{ return NxExtendedVec3(x,y,z); } }; class GFQuat: public Quaternion{ public: //Real x,y,z,w; GFQuat(){}; //OGRE specifics GFQuat(const Quaternion s){ x=s.x;y=s.y;z=s.z;w=s.w; } //operator Quaternion() const{ // return Quaternion(w,x,y,z); //} //PhysX specifics GFQuat(const NxQuat s){ x=s.x;y=s.y;z=s.z;w=s.w; } operator NxQuat() const{ return NxQuat(NxVec3(x,y,z),w); } }; }
DataTypes.h
网页地址
文件地址
上一页
14/55
下一页
下载
( 4 KB )
Comments
Total ratings:
0
Average rating:
无评论
of 10
Would you like to comment?
Join now
, or
Logon
if you are already a member.