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
DataTypes.h - 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\GameFactory\GameFactoryDemo\GameFactory\DataTypes.h
Girar
Efecto
Propiedad
Historial
#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
Dirección de la página
Dirección del archivo
Anterior
14/55
Siguiente
Descargar
( 4 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.