diff --git a/Runtime/blitz3d/CMakeLists.txt b/Runtime/blitz3d/CMakeLists.txt index f8b25de..deed9b6 100644 --- a/Runtime/blitz3d/CMakeLists.txt +++ b/Runtime/blitz3d/CMakeLists.txt @@ -5,7 +5,6 @@ add_library(${PROJECT_NAME} STATIC "animation.hpp" "animator.cpp" "animator.hpp" - "blitz3d.hpp" "brush.cpp" "brush.hpp" "cachedtexture.cpp" @@ -61,8 +60,6 @@ add_library(${PROJECT_NAME} STATIC "rendercontext.hpp" "sprite.cpp" "sprite.hpp" - "std.cpp" - "std.hpp" "surface.cpp" "surface.hpp" "terrain.cpp" @@ -76,11 +73,9 @@ add_library(${PROJECT_NAME} STATIC ) target_link_libraries(${PROJECT_NAME} - PRIVATE - config - gxruntime - stdutil - PUBLIC + config + runtime_gfx + stdutil ) target_include_directories(${PROJECT_NAME} diff --git a/Runtime/blitz3d/animation.cpp b/Runtime/blitz3d/animation.cpp index 8e4d5ca..85c7ba0 100644 --- a/Runtime/blitz3d/animation.cpp +++ b/Runtime/blitz3d/animation.cpp @@ -1,11 +1,10 @@ - #include "animation.hpp" -#include "std.hpp" +#include struct Animation::Rep { int ref_cnt; - typedef map KeyList; + typedef std::map KeyList; KeyList scale_anim, rot_anim, pos_anim; diff --git a/Runtime/blitz3d/animation.hpp b/Runtime/blitz3d/animation.hpp index 3793776..2e6d49b 100644 --- a/Runtime/blitz3d/animation.hpp +++ b/Runtime/blitz3d/animation.hpp @@ -1,9 +1,4 @@ - -#ifndef ANIMATION_H -#define ANIMATION_H - -#include - +#pragma once #include "geom.hpp" class Animation { @@ -33,5 +28,3 @@ class Animation { Rep* write(); }; - -#endif \ No newline at end of file diff --git a/Runtime/blitz3d/animator.cpp b/Runtime/blitz3d/animator.cpp index 7240518..22b5523 100644 --- a/Runtime/blitz3d/animator.cpp +++ b/Runtime/blitz3d/animator.cpp @@ -1,7 +1,5 @@ - #include "animator.hpp" #include "object.hpp" -#include "std.hpp" Animator::Animator(Animator* t) : _seqs(t->_seqs) { @@ -24,7 +22,7 @@ Animator::Animator(Object* obj, int frames) reset(); } -Animator::Animator(const vector& objs, int frames) : _objs(objs) +Animator::Animator(const std::vector& objs, int frames) : _objs(objs) { _anims.resize(_objs.size()); addSeq(frames); diff --git a/Runtime/blitz3d/animator.hpp b/Runtime/blitz3d/animator.hpp index b2f2694..4652d92 100644 --- a/Runtime/blitz3d/animator.hpp +++ b/Runtime/blitz3d/animator.hpp @@ -1,7 +1,5 @@ - -#ifndef ANIMATOR_H -#define ANIMATOR_H - +#pragma once +#include #include "animation.hpp" class Object; @@ -14,7 +12,7 @@ class Animator { Animator(Object* tree, int frames); - Animator(const vector& objs, int frames); + Animator(const std::vector& objs, int frames); void addSeq(int frames); @@ -28,28 +26,28 @@ class Animator { void update(float elapsed); - int animSeq() const + inline int animSeq() const { return _seq; } - int animLen() const + inline int animLen() const { return _seq_len; } - float animTime() const + inline float animTime() const { return _time; } - bool animating() const + inline bool animating() const { return !!_mode; } - int numSeqs() const + inline int numSeqs() const { return _seqs.size(); } - const vector& getObjects() const + inline const std::vector& getObjects() const { return _objs; } @@ -61,7 +59,7 @@ class Animator { struct Anim { //anim keys - vector keys; + std::vector keys; //for transitions... bool pos, scl, rot; Vector src_pos, dest_pos; @@ -70,10 +68,10 @@ class Animator { Anim() : pos(false), scl(false), rot(false) {} }; - vector _seqs; + std::vector _seqs; - vector _anims; - vector _objs; + std::vector _anims; + std::vector _objs; int _seq, _mode, _seq_len; float _time, _speed, _trans_time, _trans_speed; @@ -84,5 +82,3 @@ class Animator { void beginTrans(); void updateTrans(); }; - -#endif \ No newline at end of file diff --git a/Runtime/blitz3d/blitz3d.hpp b/Runtime/blitz3d/blitz3d.hpp deleted file mode 100644 index 2aa24bc..0000000 --- a/Runtime/blitz3d/blitz3d.hpp +++ /dev/null @@ -1,5 +0,0 @@ - -#ifndef BLITZ3D_H -#define BLITZ3D_H - -#endif \ No newline at end of file diff --git a/Runtime/blitz3d/brush.cpp b/Runtime/blitz3d/brush.cpp index 589e940..4973943 100644 --- a/Runtime/blitz3d/brush.cpp +++ b/Runtime/blitz3d/brush.cpp @@ -1,8 +1,8 @@ - #include "brush.hpp" -#include "std.hpp" -#include "../gxruntime/gxgraphics.hpp" +#include +#include +#include struct Brush::Rep { union { diff --git a/Runtime/blitz3d/brush.hpp b/Runtime/blitz3d/brush.hpp index 29d0b0e..09e7399 100644 --- a/Runtime/blitz3d/brush.hpp +++ b/Runtime/blitz3d/brush.hpp @@ -1,10 +1,9 @@ - -#ifndef BRUSH_H -#define BRUSH_H - +#pragma once #include "geom.hpp" #include "texture.hpp" +#include + class Brush { public: Brush(); @@ -38,5 +37,3 @@ class Brush { Rep* write() const; }; - -#endif diff --git a/Runtime/blitz3d/cachedtexture.cpp b/Runtime/blitz3d/cachedtexture.cpp index c0efc41..d8dbe76 100644 --- a/Runtime/blitz3d/cachedtexture.cpp +++ b/Runtime/blitz3d/cachedtexture.cpp @@ -1,23 +1,25 @@ - #include "cachedtexture.hpp" -#include "std.hpp" + +#include +#include +#include int active_texs; extern gxRuntime* gx_runtime; extern gxGraphics* gx_graphics; -set CachedTextureFactory::rep_set; +std::set CachedTexture::rep_set; -static string path; +static std::string path; -struct CachedTextureFactory::CachedTexture { +struct CachedTexture::CTInstance { int ref_cnt; - string file; + std::string file; int flags, w, h, first; - vector frames; + std::vector frames; - CachedTexture(int w, int h, int flags, int cnt) : ref_cnt(1), flags(flags), w(w), h(h), first(0) + CTInstance(int w, int h, int flags, int cnt) : ref_cnt(1), flags(flags), w(w), h(h), first(0) { ++active_texs; while (cnt-- > 0) { @@ -28,7 +30,7 @@ struct CachedTextureFactory::CachedTexture { } } - CachedTexture(const string& f, int flags, int w, int h, int first, int cnt) + CTInstance(const std::string& f, int flags, int w, int h, int first, int cnt) : ref_cnt(1), file(f), flags(flags), w(w), h(h), first(first) { ++active_texs; @@ -94,7 +96,7 @@ struct CachedTextureFactory::CachedTexture { gx_graphics->freeCanvas(t); } - ~CachedTexture() + ~CTInstance() { --active_texs; for (int k = 0; k < frames.size(); ++k) @@ -102,12 +104,11 @@ struct CachedTextureFactory::CachedTexture { } }; -CachedTextureFactory::CachedTexture* CachedTextureFactory::findRep(const string& f, int flags, int w, int h, int first, - int cnt) +CachedTexture::CTInstance* CachedTexture::findRep(const std::string& f, int flags, int w, int h, int first, int cnt) { - set::const_iterator it; + std::set::const_iterator it; for (it = rep_set.begin(); it != rep_set.end(); ++it) { - CachedTexture* rep = *it; + CTInstance* rep = *it; if (rep->file == f && rep->flags == flags && rep->w == w && rep->h == h && rep->first == first && rep->frames.size() == cnt) { ++rep->ref_cnt; @@ -117,38 +118,37 @@ CachedTextureFactory::CachedTexture* CachedTextureFactory::findRep(const string& return 0; } -CachedTextureFactory::CachedTextureFactory(int w, int h, int flags, int cnt) : rep(new CachedTexture(w, h, flags, cnt)) -{} +CachedTexture::CachedTexture(int w, int h, int flags, int cnt) : rep(new CTInstance(w, h, flags, cnt)) {} -CachedTextureFactory::CachedTextureFactory(const string& f_, int flags, int w, int h, int first, int cnt) +CachedTexture::CachedTexture(const std::string& f_, int flags, int w, int h, int first, int cnt) { - string f = f_; + std::string f = f_; if (f.substr(0, 2) == ".\\") f = f.substr(2); if (path.size()) { - string t = path + tolower(filenamefile(f)); + std::string t = path + tolower(filenamefile(f)); if (rep = findRep(t, flags, w, h, first, cnt)) return; - rep = new CachedTexture(t, flags, w, h, first, cnt); + rep = new CTInstance(t, flags, w, h, first, cnt); if (rep->frames.size()) { rep_set.insert(rep); return; } delete rep; } - string t = tolower(fullfilename(f)); + std::string t = tolower(fullfilename(f)); if (rep = findRep(t, flags, w, h, first, cnt)) return; - rep = new CachedTexture(t, flags, w, h, first, cnt); + rep = new CTInstance(t, flags, w, h, first, cnt); rep_set.insert(rep); } -CachedTextureFactory::CachedTextureFactory(const CachedTextureFactory& t) : rep(t.rep) +CachedTexture::CachedTexture(const CachedTexture& t) : rep(t.rep) { ++rep->ref_cnt; } -CachedTextureFactory::~CachedTextureFactory() +CachedTexture::~CachedTexture() { if (!--rep->ref_cnt) { rep_set.erase(rep); @@ -156,7 +156,7 @@ CachedTextureFactory::~CachedTextureFactory() } } -CachedTextureFactory& CachedTextureFactory::operator=(const CachedTextureFactory& t) +CachedTexture& CachedTexture::operator=(const CachedTexture& t) { ++t.rep->ref_cnt; if (!--rep->ref_cnt) { @@ -167,17 +167,17 @@ CachedTextureFactory& CachedTextureFactory::operator=(const CachedTextureFactory return *this; } -string CachedTextureFactory::getName() const +std::string CachedTexture::getName() const { return rep->file; } -const vector& CachedTextureFactory::getFrames() const +const std::vector& CachedTexture::getFrames() const { return rep->frames; } -void CachedTextureFactory::setPath(const string& t) +void CachedTexture::setPath(const std::string& t) { path = tolower(t); if (int sz = path.size()) { diff --git a/Runtime/blitz3d/cachedtexture.hpp b/Runtime/blitz3d/cachedtexture.hpp index bbd5cb7..f5e8d55 100644 --- a/Runtime/blitz3d/cachedtexture.hpp +++ b/Runtime/blitz3d/cachedtexture.hpp @@ -1,36 +1,35 @@ +#pragma once +#include +#include +#include -#ifndef CACHEDTEXTURE_H -#define CACHEDTEXTURE_H +class gxCanvas; -#include "gxcanvas.hpp" - -class CachedTextureFactory { +class CachedTexture { public: - CachedTextureFactory(int w, int h, int flags, int cnt); - CachedTextureFactory(const string& f, int flags, int w, int h, int first, int cnt); - CachedTextureFactory(const CachedTextureFactory& t); - ~CachedTextureFactory(); + CachedTexture(int w, int h, int flags, int cnt); + CachedTexture(const std::string& f, int flags, int w, int h, int first, int cnt); + CachedTexture(const CachedTexture& t); + ~CachedTexture(); - CachedTextureFactory& operator=(const CachedTextureFactory& t); + CachedTexture& operator=(const CachedTexture& t); - string getName() const; + std::string getName() const; - const vector& getFrames() const; + const std::vector& getFrames() const; - bool operator<(const CachedTextureFactory& t) const + bool operator<(const CachedTexture& t) const { return rep < t.rep; } - static void setPath(const string& t); + static void setPath(const std::string& t); private: - struct CachedTexture; - CachedTexture* rep; + struct CTInstance; + CTInstance* rep; - CachedTexture* findRep(const string& f, int flags, int w, int h, int first, int cnt); + CTInstance* findRep(const std::string& f, int flags, int w, int h, int first, int cnt); - static set rep_set; + static std::set rep_set; }; - -#endif diff --git a/Runtime/blitz3d/camera.cpp b/Runtime/blitz3d/camera.cpp index e52c267..9b32219 100644 --- a/Runtime/blitz3d/camera.cpp +++ b/Runtime/blitz3d/camera.cpp @@ -1,6 +1,6 @@ - #include "camera.hpp" -#include "std.hpp" + +#include extern gxScene* gx_scene; diff --git a/Runtime/blitz3d/camera.hpp b/Runtime/blitz3d/camera.hpp index b21428c..a453846 100644 --- a/Runtime/blitz3d/camera.hpp +++ b/Runtime/blitz3d/camera.hpp @@ -1,7 +1,4 @@ - -#ifndef CAMERA_H -#define CAMERA_H - +#pragma once #include "frustum.hpp" #include "mirror.hpp" #include "model.hpp" @@ -56,5 +53,3 @@ class Camera : public Object { mutable Frustum local_frustum; mutable bool local_valid; }; - -#endif diff --git a/Runtime/blitz3d/collision.cpp b/Runtime/blitz3d/collision.cpp index eb8e079..52090ec 100644 --- a/Runtime/blitz3d/collision.cpp +++ b/Runtime/blitz3d/collision.cpp @@ -1,6 +1,6 @@ - #include "collision.hpp" -#include "std.hpp" + +#include const float COLLISION_FLT_EPSILON = .001f; diff --git a/Runtime/blitz3d/collision.hpp b/Runtime/blitz3d/collision.hpp index 0f7f769..0a744fe 100644 --- a/Runtime/blitz3d/collision.hpp +++ b/Runtime/blitz3d/collision.hpp @@ -1,7 +1,4 @@ - -#ifndef COLLISION_H -#define COLLISION_H - +#pragma once #include "geom.hpp" extern const float COLLISION_FLT_EPSILON; @@ -23,5 +20,3 @@ struct Collision { bool boxCollide(const Line& src_line, float src_radius, const Box& box); }; - -#endif \ No newline at end of file diff --git a/Runtime/blitz3d/entity.cpp b/Runtime/blitz3d/entity.cpp index f3ee3e9..5ed9434 100644 --- a/Runtime/blitz3d/entity.cpp +++ b/Runtime/blitz3d/entity.cpp @@ -1,8 +1,4 @@ - #include "entity.hpp" -#include "std.hpp" - -//#include "stats.hpp" Entity *Entity::_orphans, *Entity::_last_orphan; @@ -119,7 +115,7 @@ void Entity::SetParent(Entity* p) InvalidateWorldTransform(); } -void Entity::SetName(const string& t) +void Entity::SetName(const std::string& t) { m_name = t; } diff --git a/Runtime/blitz3d/entity.hpp b/Runtime/blitz3d/entity.hpp index 02cb8d8..9408efe 100644 --- a/Runtime/blitz3d/entity.hpp +++ b/Runtime/blitz3d/entity.hpp @@ -1,9 +1,5 @@ - -#ifndef ENTITY_H -#define ENTITY_H - +#pragma once #include - #include "geom.hpp" class Entity; @@ -132,5 +128,3 @@ class Entity { void invalidateLocal(); void InvalidateWorldTransform(); }; - -#endif diff --git a/Runtime/blitz3d/frustum.cpp b/Runtime/blitz3d/frustum.cpp index 367efc9..6797fbd 100644 --- a/Runtime/blitz3d/frustum.cpp +++ b/Runtime/blitz3d/frustum.cpp @@ -1,6 +1,4 @@ - #include "frustum.hpp" -#include "std.hpp" Frustum::Frustum() {} diff --git a/Runtime/blitz3d/frustum.hpp b/Runtime/blitz3d/frustum.hpp index b4c1d7d..af495db 100644 --- a/Runtime/blitz3d/frustum.hpp +++ b/Runtime/blitz3d/frustum.hpp @@ -1,7 +1,4 @@ - -#ifndef FRUSTUM_H -#define FRUSTUM_H - +#pragma once #include "geom.hpp" class Frustum { @@ -39,5 +36,3 @@ class Frustum { Vector verts[9]; void makePlanes(); }; - -#endif \ No newline at end of file diff --git a/Runtime/blitz3d/geom.cpp b/Runtime/blitz3d/geom.cpp index 33e16ef..29ff30f 100644 --- a/Runtime/blitz3d/geom.cpp +++ b/Runtime/blitz3d/geom.cpp @@ -1,6 +1,4 @@ - #include "geom.hpp" -#include "std.hpp" Matrix Matrix::tmps[64]; Transform Transform::tmps[64]; diff --git a/Runtime/blitz3d/geom.hpp b/Runtime/blitz3d/geom.hpp index b1f71ba..1896b0c 100644 --- a/Runtime/blitz3d/geom.hpp +++ b/Runtime/blitz3d/geom.hpp @@ -1,8 +1,6 @@ - -#ifndef GEOM_H -#define GEOM_H - -#include +#pragma once +#include +#include class Vector; class Line; @@ -738,5 +736,3 @@ inline Quat matrixQuat(const Matrix& p) } return Quat(w, Vector(x, y, z)); } - -#endif \ No newline at end of file diff --git a/Runtime/blitz3d/light.cpp b/Runtime/blitz3d/light.cpp index 5fcb9a7..0d6d5fd 100644 --- a/Runtime/blitz3d/light.cpp +++ b/Runtime/blitz3d/light.cpp @@ -1,7 +1,7 @@ - #include "light.hpp" -#include "../gxruntime/gxscene.hpp" -#include "std.hpp" + +#include +#include extern gxScene* gx_scene; diff --git a/Runtime/blitz3d/light.hpp b/Runtime/blitz3d/light.hpp index e48910a..a18ea64 100644 --- a/Runtime/blitz3d/light.hpp +++ b/Runtime/blitz3d/light.hpp @@ -1,12 +1,9 @@ - -#ifndef LIGHT_H -#define LIGHT_H - +#pragma once #include "geom.hpp" -#include "gxlight.hpp" #include "object.hpp" class World; +class gxLight; class Light : public Object { public: @@ -33,5 +30,3 @@ class Light : public Object { friend class World; gxLight* light; }; - -#endif \ No newline at end of file diff --git a/Runtime/blitz3d/listener.cpp b/Runtime/blitz3d/listener.cpp index 6cfb7c2..c87b1ff 100644 --- a/Runtime/blitz3d/listener.cpp +++ b/Runtime/blitz3d/listener.cpp @@ -1,6 +1,6 @@ - #include "listener.hpp" -#include "std.hpp" + +#include extern gxAudio* gx_audio; diff --git a/Runtime/blitz3d/listener.hpp b/Runtime/blitz3d/listener.hpp index cee6779..154fdfa 100644 --- a/Runtime/blitz3d/listener.hpp +++ b/Runtime/blitz3d/listener.hpp @@ -1,7 +1,4 @@ - -#ifndef LISTENER_H -#define LISTENER_H - +#pragma once #include "object.hpp" class Listener : public Object { @@ -25,5 +22,3 @@ class Listener : public Object { private: }; - -#endif \ No newline at end of file diff --git a/Runtime/blitz3d/loader_3ds.cpp b/Runtime/blitz3d/loader_3ds.cpp index e122dae..47b09f5 100644 --- a/Runtime/blitz3d/loader_3ds.cpp +++ b/Runtime/blitz3d/loader_3ds.cpp @@ -1,8 +1,10 @@ - #include "loader_3ds.hpp" #include "animation.hpp" #include "meshmodel.hpp" -#include "std.hpp" +#include "animator.hpp" +#include + +#include extern gxRuntime* gx_runtime; @@ -14,9 +16,9 @@ extern gxRuntime* gx_runtime; class Box; -static filebuf in; +static std::filebuf in; static int chunk_end; -static vector parent_end; +static std::vector parent_end; static unsigned short anim_len; static bool conv, flip_tris; @@ -28,30 +30,30 @@ struct Face3DS { Brush brush; }; -static vector faces; +static std::vector faces; //static vector vertices; -static map materials_map; -static map name_map; -static map id_map; +static std::map materials_map; +static std::map name_map; +static std::map id_map; static int nextChunk() { - in.pubseekoff(chunk_end, ios_base::beg); + in.pubseekoff(chunk_end, std::ios_base::beg); if (chunk_end == parent_end.back()) return 0; unsigned short id; int len; in.sgetn((char*)&id, 2); in.sgetn((char*)&len, 4); - chunk_end = (int)in.pubseekoff(0, ios_base::cur) + len - 6; + chunk_end = (int)in.pubseekoff(0, std::ios_base::cur) + len - 6; return id; } static void enterChunk() { parent_end.push_back(chunk_end); - chunk_end = (int)in.pubseekoff(0, ios_base::cur); + chunk_end = (int)in.pubseekoff(0, std::ios_base::cur); } static void leaveChunk() @@ -60,9 +62,9 @@ static void leaveChunk() parent_end.pop_back(); } -static string parseString() +static std::string parseString() { - string t; + std::string t; while (int c = in.sbumpc()) t += char(c); return t; @@ -137,7 +139,7 @@ static void parseVertList() static void parseFaceMat() { - string name = parseString(); + std::string name = parseString(); _log("FaceMat: " + name); Brush mat = materials_map[name]; unsigned short cnt; @@ -256,7 +258,7 @@ static void parseTriMesh(MeshModel* mesh) static void parseObject(MeshModel* root) { //skip name - string name = parseString(); + std::string name = parseString(); _log("Object:" + name); MeshModel* mesh = 0; @@ -279,7 +281,7 @@ static void parseMaterial() { _log("Material"); Brush mat; - string name, tex_name; + std::string name, tex_name; enterChunk(); while (int id = nextChunk()) { switch (id) { @@ -339,9 +341,9 @@ static void parseAnimKeys(Animation* anim, int type) int cnt = 0; short t_flags; in.sgetn((char*)&t_flags, 2); - in.pubseekoff(8, ios_base::cur); + in.pubseekoff(8, std::ios_base::cur); in.sgetn((char*)&cnt, 2); - in.pubseekoff(2, ios_base::cur); + in.pubseekoff(2, std::ios_base::cur); _log("ANIM_TRACK: frames=" + itoa(cnt)); Vector pos, axis, scale; float angle; @@ -403,7 +405,7 @@ static void parseMeshInfo(MeshModel* root, float curr_time) { _log("OBJECT_NODE_TAG"); enterChunk(); - string name, inst; + std::string name, inst; Vector pivot; Animation anim; unsigned short id = 65535, parent = 65535, flags1, flags2; @@ -453,7 +455,7 @@ static void parseMeshInfo(MeshModel* root, float curr_time) MeshModel* p = root; if (parent != 65535) { - map::const_iterator it = id_map.find(parent); + std::map::const_iterator it = id_map.find(parent); if (it == id_map.end()) return; p = it->second; @@ -464,7 +466,7 @@ static void parseMeshInfo(MeshModel* root, float curr_time) mesh->SetName(inst); mesh->SetParent(p); } else { - map::const_iterator it = name_map.find(name); + std::map::const_iterator it = name_map.find(name); if (it == name_map.end()) return; mesh = it->second; @@ -487,7 +489,7 @@ static void parseKeyFramer(MeshModel* root) { _log("KeyFramer"); enterChunk(); - string file_3ds; + std::string file_3ds; unsigned short rev, curr_time = 0; while (int id = nextChunk()) { switch (id) { @@ -522,7 +524,7 @@ static MeshModel* parseFile() in.sgetn((char*)&len, 4); if (id != CHUNK_MAIN) return 0; - chunk_end = (int)in.pubseekoff(0, ios_base::cur) + len - 6; + chunk_end = (int)in.pubseekoff(0, std::ios_base::cur) + len - 6; enterChunk(); MeshModel* root = new MeshModel(); @@ -540,7 +542,7 @@ static MeshModel* parseFile() return root; } -MeshModel* Loader_3DS::load(const string& filename, const Transform& t, int hint) +MeshModel* Loader_3DS::load(const std::string& filename, const Transform& t, int hint) { conv_tform = t; conv = flip_tris = false; @@ -553,7 +555,7 @@ MeshModel* Loader_3DS::load(const string& filename, const Transform& t, int hint collapse = !!(hint & MeshLoader::HINT_COLLAPSE); animonly = !!(hint & MeshLoader::HINT_ANIMONLY); - if (!in.open(filename.c_str(), ios_base::in | ios_base::binary)) { + if (!in.open(filename.c_str(), std::ios_base::in | std::ios_base::binary)) { return 0; } diff --git a/Runtime/blitz3d/loader_3ds.hpp b/Runtime/blitz3d/loader_3ds.hpp index a066c22..e76128d 100644 --- a/Runtime/blitz3d/loader_3ds.hpp +++ b/Runtime/blitz3d/loader_3ds.hpp @@ -1,12 +1,7 @@ - -#ifndef LOADER_3DS_H -#define LOADER_3DS_H - +#pragma once #include "meshloader.hpp" class Loader_3DS : public MeshLoader { public: - MeshModel* load(const string& f, const Transform& conv, int hint); + MeshModel* load(const std::string& f, const Transform& conv, int hint); }; - -#endif \ No newline at end of file diff --git a/Runtime/blitz3d/loader_b3d.cpp b/Runtime/blitz3d/loader_b3d.cpp index fc3767d..ce263ad 100644 --- a/Runtime/blitz3d/loader_b3d.cpp +++ b/Runtime/blitz3d/loader_b3d.cpp @@ -1,17 +1,16 @@ - #include "loader_b3d.hpp" #include "meshmodel.hpp" #include "meshutil.hpp" #include "pivot.hpp" -#include "std.hpp" +#include "animator.hpp" //#define SHOW_BONES static FILE* in; -static vector chunk_stack; -static vector textures; -static vector brushes; -static vector bones; +static std::vector chunk_stack; +static std::vector textures; +static std::vector brushes; +static std::vector bones; static bool collapse; static bool animonly; @@ -108,9 +107,9 @@ static void readColor(unsigned* t) *t = (int(a * 255) << 24) | (int(r * 255) << 16) | (int(g * 255) << 8) | int(b * 255); } -static string readString() +static std::string readString() { - string t; + std::string t; for (;;) { char c; read(&c, 1); @@ -123,7 +122,7 @@ static string readString() static void readTextures() { while (chunkSize()) { - string name = readString(); + std::string name = readString(); int flags = readInt(); int blend = readInt(); float pos[2], scl[2]; @@ -156,7 +155,7 @@ static void readBrushes() int tex_id[8] = {-1, -1, -1, -1, -1, -1, -1, -1}; while (chunkSize()) { - string name = readString(); + std::string name = readString(); float col[4]; readFloatArray(col, 4); float shi = readFloat(); @@ -291,7 +290,7 @@ static Object* readObject(Object* parent) { Object* obj = 0; - string name = readString(); + std::string name = readString(); float pos[3], scl[3], rot[4]; readFloatArray(pos, 3); readFloatArray(scl, 3); @@ -362,7 +361,7 @@ static Object* readObject(Object* parent) return obj; } -MeshModel* Loader_B3D::load(const string& f, const Transform& conv, int hint) +MeshModel* Loader_B3D::load(const std::string& f, const Transform& conv, int hint) { collapse = !!(hint & MeshLoader::HINT_COLLAPSE); animonly = !!(hint & MeshLoader::HINT_ANIMONLY); diff --git a/Runtime/blitz3d/loader_b3d.hpp b/Runtime/blitz3d/loader_b3d.hpp index 696f82c..9974fb1 100644 --- a/Runtime/blitz3d/loader_b3d.hpp +++ b/Runtime/blitz3d/loader_b3d.hpp @@ -1,12 +1,8 @@ - -#ifndef LOADER_B3D_H -#define LOADER_B3D_H - +#pragma once #include "meshloader.hpp" +#include class Loader_B3D : public MeshLoader { public: - MeshModel* load(const string& f, const Transform& conv, int hint); + MeshModel* load(const std::string& f, const Transform& conv, int hint); }; - -#endif diff --git a/Runtime/blitz3d/md2model.cpp b/Runtime/blitz3d/md2model.cpp index b0159bb..3e8f00e 100644 --- a/Runtime/blitz3d/md2model.cpp +++ b/Runtime/blitz3d/md2model.cpp @@ -1,15 +1,14 @@ - #include "md2model.hpp" #include "md2rep.hpp" -#include "std.hpp" +#include "animator.hpp" struct MD2Model::Rep : public MD2Rep { int ref_cnt; - Rep(const string& f) : MD2Rep(f), ref_cnt(1) {} + Rep(const std::string& f) : MD2Rep(f), ref_cnt(1) {} }; -MD2Model::MD2Model(const string& f) +MD2Model::MD2Model(const std::string& f) : rep(new Rep(f)), anim_mode(0), anim_time(0), render_a(0), render_b(0), render_t(0), trans_verts(0) {} diff --git a/Runtime/blitz3d/md2model.hpp b/Runtime/blitz3d/md2model.hpp index 90e13d1..31a491a 100644 --- a/Runtime/blitz3d/md2model.hpp +++ b/Runtime/blitz3d/md2model.hpp @@ -1,13 +1,11 @@ - -#ifndef MD2MODEL_H -#define MD2MODEL_H - +#pragma once #include "md2rep.hpp" #include "model.hpp" +#include class MD2Model : public Model { public: - MD2Model(const string& filename); + MD2Model(const std::string& filename); MD2Model(const MD2Model& t); ~MD2Model(); @@ -59,5 +57,3 @@ class MD2Model : public Model { //Unimplemented MD2Model& operator=(const MD2Model&); }; - -#endif \ No newline at end of file diff --git a/Runtime/blitz3d/md2norms.cpp b/Runtime/blitz3d/md2norms.cpp index 5430ece..8ffa73f 100644 --- a/Runtime/blitz3d/md2norms.cpp +++ b/Runtime/blitz3d/md2norms.cpp @@ -1,6 +1,4 @@ - #include "md2norms.hpp" -#include "std.hpp" float md2norms[162][3] = { {-0.525731f, 0.000000f, 0.850651f}, {-0.442863f, 0.238856f, 0.864188f}, {-0.295242f, 0.000000f, 0.955423f}, diff --git a/Runtime/blitz3d/md2norms.hpp b/Runtime/blitz3d/md2norms.hpp index 6fcda21..1955b31 100644 --- a/Runtime/blitz3d/md2norms.hpp +++ b/Runtime/blitz3d/md2norms.hpp @@ -1,7 +1,2 @@ - -#ifndef MD2NORMS_H -#define MD2NORMS_H - +#pragma once extern float md2norms[162][3]; - -#endif \ No newline at end of file diff --git a/Runtime/blitz3d/md2rep.cpp b/Runtime/blitz3d/md2rep.cpp index 839bde1..836ffd8 100644 --- a/Runtime/blitz3d/md2rep.cpp +++ b/Runtime/blitz3d/md2rep.cpp @@ -1,7 +1,9 @@ - #include "md2rep.hpp" #include "md2norms.hpp" -#include "std.hpp" +#include + +#include +#include extern gxRuntime* gx_runtime; extern gxGraphics* gx_graphics; @@ -57,12 +59,12 @@ struct t_tri { unsigned short verts[3]; }; -MD2Rep::MD2Rep(const string& f) : mesh(0), n_verts(0), n_tris(0), n_frames(0) +MD2Rep::MD2Rep(const std::string& f) : mesh(0), n_verts(0), n_tris(0), n_frames(0) { - filebuf in; + std::filebuf in; md2_header header; - if (!in.open(f.c_str(), ios_base::in | ios_base::binary)) + if (!in.open(f.c_str(), std::ios_base::in | std::ios_base::binary)) return; if (in.sgetn((char*)&header, sizeof(header)) != sizeof(header)) return; @@ -73,20 +75,20 @@ MD2Rep::MD2Rep(const string& f) : mesh(0), n_verts(0), n_tris(0), n_frames(0) n_tris = header.numTriangles; //read in tex coords - vector md2_uvs; + std::vector md2_uvs; md2_uvs.resize(header.numTexCoords); in.pubseekpos(header.offsetTexCoords); in.sgetn((char*)(&md2_uvs.begin()[0]), header.numTexCoords * sizeof(md2_uv)); //read in triangles - vector md2_tris; + std::vector md2_tris; md2_tris.resize(n_tris); in.pubseekpos(header.offsetTriangles); in.sgetn((char*)(&md2_tris.begin()[0]), n_tris * sizeof(md2_tri)); - vector t_tris; - vector t_verts; - map t_map; + std::vector t_tris; + std::vector t_verts; + std::map t_map; int k; for (k = 0; k < n_tris; ++k) { @@ -95,7 +97,7 @@ MD2Rep::MD2Rep(const string& f) : mesh(0), n_verts(0), n_tris(0), n_frames(0) t_vert t; t.i = md2_tris[k].verts[j]; t.uv = md2_tris[k].uvs[j]; - map::iterator it = t_map.find(t); + std::map::iterator it = t_map.find(t); if (it == t_map.end()) { //create new vert tr.verts[j] = t_map[t] = t_verts.size(); @@ -117,7 +119,7 @@ MD2Rep::MD2Rep(const string& f) : mesh(0), n_verts(0), n_tris(0), n_frames(0) frames.resize(n_frames); in.pubseekpos(header.offsetFrames); - vector md2_verts; + std::vector md2_verts; md2_verts.resize(header.numVertices); //read in frames diff --git a/Runtime/blitz3d/md2rep.hpp b/Runtime/blitz3d/md2rep.hpp index 8f20be0..3d7bd43 100644 --- a/Runtime/blitz3d/md2rep.hpp +++ b/Runtime/blitz3d/md2rep.hpp @@ -1,8 +1,7 @@ - -#ifndef MD2REP_H -#define MD2REP_H - +#pragma once #include "model.hpp" +#include +#include class MD2Rep { public: @@ -10,7 +9,7 @@ class MD2Rep { Vector coords, normal; }; - MD2Rep(const string& f); + MD2Rep(const std::string& f); virtual ~MD2Rep(); void render(Vert* verts, int frame); @@ -46,15 +45,13 @@ class MD2Rep { struct Frame { Vector scale, trans; - vector verts; + std::vector verts; }; Box box; gxMesh* mesh; int n_frames; int n_verts, n_tris; - vector frames; - vector uvs; + std::vector frames; + std::vector uvs; }; - -#endif \ No newline at end of file diff --git a/Runtime/blitz3d/meshcollider.cpp b/Runtime/blitz3d/meshcollider.cpp index b4a201d..a91385d 100644 --- a/Runtime/blitz3d/meshcollider.cpp +++ b/Runtime/blitz3d/meshcollider.cpp @@ -1,9 +1,10 @@ - #include "meshcollider.hpp" -#include "std.hpp" +#include + +#include static const int MAX_COLL_TRIS = 16; -static vector tri_centres; +static std::vector tri_centres; extern float stats3d[10]; @@ -47,9 +48,10 @@ static bool trisIntersect(const Vector a[3], const Vector b[3]) return triTest(a, b) || triTest(b, a); } -MeshCollider::MeshCollider(const vector& verts, const vector& tris) : vertices(verts), triangles(tris) +MeshCollider::MeshCollider(const std::vector& verts, const std::vector& tris) + : vertices(verts), triangles(tris) { - vector ts; + std::vector ts; tri_centres.clear(); for (int k = 0; k < triangles.size(); ++k) { const MeshCollider::Triangle& t = triangles[k]; @@ -122,7 +124,7 @@ bool MeshCollider::collide(const Box& line_box, const Line& line, float radius, return hit; } -Box MeshCollider::nodeBox(const vector& tris) +Box MeshCollider::nodeBox(const std::vector& tris) { Box box; for (int k = 0; k < tris.size(); ++k) { @@ -133,7 +135,7 @@ Box MeshCollider::nodeBox(const vector& tris) return box; } -MeshCollider::Node* MeshCollider::createLeaf(const vector& tris) +MeshCollider::Node* MeshCollider::createLeaf(const std::vector& tris) { Node* c = new Node; c->box = nodeBox(tris); @@ -142,7 +144,7 @@ MeshCollider::Node* MeshCollider::createLeaf(const vector& tris) return c; } -MeshCollider::Node* MeshCollider::createNode(const vector& tris) +MeshCollider::Node* MeshCollider::createNode(const std::vector& tris) { if (tris.size() <= MAX_COLL_TRIS) return createLeaf(tris); @@ -166,16 +168,16 @@ MeshCollider::Node* MeshCollider::createNode(const vector& tris) //sort by axis // int k; - multimap axis_map; + std::multimap axis_map; for (k = 0; k < tris.size(); ++k) { - pair p(tri_centres[tris[k]][axis], tris[k]); + std::pair p(tri_centres[tris[k]][axis], tris[k]); axis_map.insert(p); } //generate left node // - vector new_tris; - multimap::iterator it = axis_map.begin(); + std::vector new_tris; + std::multimap::iterator it = axis_map.begin(); for (k = axis_map.size() / 2; k--; ++it) { new_tris.push_back(it->second); } diff --git a/Runtime/blitz3d/meshcollider.hpp b/Runtime/blitz3d/meshcollider.hpp index 71406fc..d34a402 100644 --- a/Runtime/blitz3d/meshcollider.hpp +++ b/Runtime/blitz3d/meshcollider.hpp @@ -1,7 +1,5 @@ - -#ifndef MESHCOLLIDER_H -#define MESHCOLLIDER_H - +#pragma once +#include #include "collision.hpp" class MeshCollider { @@ -13,7 +11,7 @@ class MeshCollider { void* surface; int verts[3], index; }; - MeshCollider(const vector& verts, const vector& tris); + MeshCollider(const std::vector& verts, const std::vector& tris); ~MeshCollider(); //sphere collision @@ -22,13 +20,13 @@ class MeshCollider { bool intersects(const MeshCollider& c, const Transform& t) const; private: - vector vertices; - vector triangles; + std::vector vertices; + std::vector triangles; struct Node { Box box; Node * left, *right; - vector triangles; + std::vector triangles; Node() : left(0), right(0) {} ~Node() { @@ -38,13 +36,11 @@ class MeshCollider { }; Node* tree; - vector leaves; + std::vector leaves; - Box nodeBox(const vector& tris); - Node* createLeaf(const vector& tris); - Node* createNode(const vector& tris); + Box nodeBox(const std::vector& tris); + Node* createLeaf(const std::vector& tris); + Node* createNode(const std::vector& tris); bool collide(const Box& box, const Line& line, float radius, const Transform& tform, Collision* curr_coll, Node* node); }; - -#endif \ No newline at end of file diff --git a/Runtime/blitz3d/meshloader.cpp b/Runtime/blitz3d/meshloader.cpp index cc8e826..765e92e 100644 --- a/Runtime/blitz3d/meshloader.cpp +++ b/Runtime/blitz3d/meshloader.cpp @@ -1,25 +1,23 @@ - #include "meshloader.hpp" #include "meshmodel.hpp" -#include "std.hpp" struct Tri { int verts[3]; }; struct Surf { - vector tris; + std::vector tris; }; struct MLMesh { - map brush_map; - vector verts; + std::map brush_map; + std::vector verts; MLMesh() {} ~MLMesh() { - map::const_iterator it; + std::map::const_iterator it; for (it = brush_map.begin(); it != brush_map.end(); ++it) { delete it->second; } @@ -27,7 +25,7 @@ struct MLMesh { }; static MLMesh* ml_mesh; -static vector mesh_stack; +static std::vector mesh_stack; void MeshLoader::beginMesh() { @@ -77,12 +75,12 @@ void MeshLoader::addTriangle(int v0, int v1, int v2, const Brush& b) { //find surface Surf* surf; - map::const_iterator it = ml_mesh->brush_map.find(b); + std::map::const_iterator it = ml_mesh->brush_map.find(b); if (it != ml_mesh->brush_map.end()) surf = it->second; else { surf = new Surf; - ml_mesh->brush_map.insert(make_pair(b, surf)); + ml_mesh->brush_map.insert(std::make_pair(b, surf)); } Tri tri; @@ -115,8 +113,8 @@ void MeshLoader::endMesh(MeshModel* mesh) v.bone_weights[j] *= t; } } - map vert_map; - map::iterator it; + std::map vert_map; + std::map::iterator it; for (it = ml_mesh->brush_map.begin(); it != ml_mesh->brush_map.end(); ++it) { vert_map.clear(); Brush b = it->first; @@ -128,13 +126,13 @@ void MeshLoader::endMesh(MeshModel* mesh) Surface::Triangle tri; for (int j = 0; j < 3; ++j) { int n = t->tris[k].verts[j], id; - map::const_iterator it = vert_map.find(n); + std::map::const_iterator it = vert_map.find(n); if (it != vert_map.end()) id = it->second; else { id = surf->numVertices(); surf->addVertex(ml_mesh->verts[n]); - vert_map.insert(make_pair(n, id)); + vert_map.insert(std::make_pair(n, id)); } tri.verts[j] = id; } diff --git a/Runtime/blitz3d/meshloader.hpp b/Runtime/blitz3d/meshloader.hpp index 2f951c3..dc39732 100644 --- a/Runtime/blitz3d/meshloader.hpp +++ b/Runtime/blitz3d/meshloader.hpp @@ -1,15 +1,14 @@ - -#ifndef MESHLOADER_H -#define MESHLOADER_H - -#include "model.hpp" +#pragma once +#include "brush.hpp" #include "surface.hpp" +class MeshModel; + class MeshLoader { public: enum { HINT_COLLAPSE = 1, HINT_ANIMONLY = 2 }; - virtual MeshModel* load(const string& f, const Transform& conv, int hint) = 0; + virtual MeshModel* load(const std::string& f, const Transform& conv, int hint) = 0; //clear static void beginMesh(); @@ -35,5 +34,3 @@ class MeshLoader { //finally, update the mesh... static void endMesh(MeshModel* mesh); }; - -#endif \ No newline at end of file diff --git a/Runtime/blitz3d/meshmodel.cpp b/Runtime/blitz3d/meshmodel.cpp index 34acfd9..ecd5479 100644 --- a/Runtime/blitz3d/meshmodel.cpp +++ b/Runtime/blitz3d/meshmodel.cpp @@ -1,7 +1,8 @@ - #include "meshmodel.hpp" #include "meshcollider.hpp" -#include "std.hpp" +#include "surface.hpp" +#include +#include "animator.hpp" extern gxGraphics* gx_graphics; @@ -12,7 +13,7 @@ struct MeshModel::Rep : public Surface::Monitor { mutable int box_valid, coll_valid, norms_valid; SurfaceList surfaces; - vector bone_tforms; + std::vector bone_tforms; Rep() : ref_cnt(1), collider(0), box_valid(-1), coll_valid(-1), norms_valid(-1) { @@ -147,8 +148,8 @@ struct MeshModel::Rep : public Surface::Monitor { { if (coll_valid != geom_changes) { delete collider; - vector verts; - vector tris; + std::vector verts; + std::vector tris; for (int k = 0; k < surfaces.size(); ++k) { Surface* s = surfaces[k]; int j; @@ -215,7 +216,7 @@ void MeshModel::setRenderBrush(const Brush& b) void MeshModel::createBones() { setRenderSpace(RENDER_SPACE_WORLD); - const vector& bones = getAnimator()->getObjects(); + const std::vector& bones = getAnimator()->getObjects(); surf_bones.resize(bones.size()); @@ -257,7 +258,7 @@ bool MeshModel::render(const RenderContext& rc) } //OK, its boned! - const vector& bones = getAnimator()->getObjects(); + const std::vector& bones = getAnimator()->getObjects(); int k; for (k = 0; k < bones.size(); ++k) { diff --git a/Runtime/blitz3d/meshmodel.hpp b/Runtime/blitz3d/meshmodel.hpp index 8ff5644..48a6c68 100644 --- a/Runtime/blitz3d/meshmodel.hpp +++ b/Runtime/blitz3d/meshmodel.hpp @@ -1,15 +1,14 @@ - -#ifndef MESHMODEL_H -#define MESHMODEL_H - +#pragma once +#include #include "model.hpp" #include "surface.hpp" class MeshCollider; +class Collision; class MeshModel : public Model { public: - typedef vector SurfaceList; + typedef std::vector SurfaceList; MeshModel(); MeshModel(const MeshModel& t); @@ -59,11 +58,9 @@ class MeshModel : public Model { Rep* rep; int brush_changes; Brush render_brush; - vector brushes; + std::vector brushes; - vector surf_bones; + std::vector surf_bones; MeshModel& operator=(const MeshModel&); }; - -#endif diff --git a/Runtime/blitz3d/meshutil.cpp b/Runtime/blitz3d/meshutil.cpp index b019b5f..2063548 100644 --- a/Runtime/blitz3d/meshutil.cpp +++ b/Runtime/blitz3d/meshutil.cpp @@ -1,6 +1,5 @@ - #include "meshutil.hpp" -#include "std.hpp" +#include "surface.hpp" MeshModel* MeshUtil::createCube(const Brush& b) { diff --git a/Runtime/blitz3d/meshutil.hpp b/Runtime/blitz3d/meshutil.hpp index 4f949e0..4dfe7f3 100644 --- a/Runtime/blitz3d/meshutil.hpp +++ b/Runtime/blitz3d/meshutil.hpp @@ -1,7 +1,4 @@ - -#ifndef MESHUTIL_H -#define MESHUTIL_H - +#pragma once #include "meshmodel.hpp" struct MeshUtil { @@ -25,5 +22,3 @@ struct MeshUtil { static Mesh createCylinder( const Brush &b,int segs ); */ }; - -#endif \ No newline at end of file diff --git a/Runtime/blitz3d/mirror.cpp b/Runtime/blitz3d/mirror.cpp index 0e25d0e..0202dee 100644 --- a/Runtime/blitz3d/mirror.cpp +++ b/Runtime/blitz3d/mirror.cpp @@ -1,9 +1,7 @@ - #include "mirror.hpp" -#include "std.hpp" Mirror::Mirror() {} Mirror::Mirror(const Mirror& t) : Object(t) {} -Mirror::~Mirror() {} \ No newline at end of file +Mirror::~Mirror() {} diff --git a/Runtime/blitz3d/mirror.hpp b/Runtime/blitz3d/mirror.hpp index e2dcb75..6f2f65a 100644 --- a/Runtime/blitz3d/mirror.hpp +++ b/Runtime/blitz3d/mirror.hpp @@ -1,7 +1,4 @@ - -#ifndef MIRROR_H -#define MIRROR_H - +#pragma once #include "object.hpp" class Mirror : public Object { @@ -20,5 +17,3 @@ class Mirror : public Object { return this; } }; - -#endif \ No newline at end of file diff --git a/Runtime/blitz3d/model.cpp b/Runtime/blitz3d/model.cpp index 52186ed..f914a12 100644 --- a/Runtime/blitz3d/model.cpp +++ b/Runtime/blitz3d/model.cpp @@ -1,6 +1,4 @@ - #include "model.hpp" -#include "std.hpp" extern gxScene* gx_scene; @@ -132,7 +130,7 @@ void Model::enqueue(gxMesh* mesh, int fv, int vc, int ft, int tc, const Brush& b void Model::renderQueue(int type) { - vector* que = &queues[type]; + std::vector* que = &queues[type]; for (; que->size(); que->pop_back()) { MeshQueue* q = que->back(); q->render(); diff --git a/Runtime/blitz3d/model.hpp b/Runtime/blitz3d/model.hpp index 9c4209b..95e4499 100644 --- a/Runtime/blitz3d/model.hpp +++ b/Runtime/blitz3d/model.hpp @@ -1,10 +1,8 @@ - -#ifndef MODEL_H -#define MODEL_H - +#pragma once #include "brush.hpp" #include "object.hpp" #include "rendercontext.hpp" +#include "gxmesh.hpp" class Sprite; class Terrain; @@ -147,9 +145,7 @@ class Model : public Object { bool auto_fade; float auto_fade_nr, auto_fade_fr; - vector queues[2]; + std::vector queues[2]; void enqueue(MeshQueue* q); }; - -#endif \ No newline at end of file diff --git a/Runtime/blitz3d/object.cpp b/Runtime/blitz3d/object.cpp index 8e3d715..3a666f3 100644 --- a/Runtime/blitz3d/object.cpp +++ b/Runtime/blitz3d/object.cpp @@ -1,6 +1,9 @@ - #include "object.hpp" -#include "std.hpp" +#include "animator.hpp" + +#include +#include +#include extern gxRuntime* gx_runtime; diff --git a/Runtime/blitz3d/object.hpp b/Runtime/blitz3d/object.hpp index 0f1bb4e..079d6d3 100644 --- a/Runtime/blitz3d/object.hpp +++ b/Runtime/blitz3d/object.hpp @@ -1,14 +1,12 @@ - -#ifndef OBJECT_H -#define OBJECT_H - +#pragma once #include - -#include "animator.hpp" +#include "animation.hpp" #include "collision.hpp" #include "entity.hpp" class gxSound; +class gxChannel; +class Animator; struct ObjCollision { Object* with; @@ -121,7 +119,7 @@ class Object : public Entity { bool obscurer; float elapsed; Vector velocity; - vector channels; + std::vector channels; Vector capt_pos, capt_scl; Quat capt_rot; mutable Object* last_copy; @@ -136,5 +134,3 @@ class Object : public Entity { void updateSounds(); }; - -#endif diff --git a/Runtime/blitz3d/pivot.cpp b/Runtime/blitz3d/pivot.cpp index de6a007..fac4757 100644 --- a/Runtime/blitz3d/pivot.cpp +++ b/Runtime/blitz3d/pivot.cpp @@ -1,6 +1,4 @@ - #include "pivot.hpp" -#include "std.hpp" Pivot::Pivot() {} diff --git a/Runtime/blitz3d/pivot.hpp b/Runtime/blitz3d/pivot.hpp index 37aee18..e3b54ff 100644 --- a/Runtime/blitz3d/pivot.hpp +++ b/Runtime/blitz3d/pivot.hpp @@ -1,7 +1,4 @@ - -#ifndef PIVOT_H -#define PIVOT_H - +#pragma once #include "object.hpp" class Pivot : public Object { @@ -15,5 +12,3 @@ class Pivot : public Object { return new Pivot(*this); } }; - -#endif \ No newline at end of file diff --git a/Runtime/blitz3d/planemodel.cpp b/Runtime/blitz3d/planemodel.cpp index b69de49..198f1ff 100644 --- a/Runtime/blitz3d/planemodel.cpp +++ b/Runtime/blitz3d/planemodel.cpp @@ -1,8 +1,8 @@ - #include "planemodel.hpp" #include "camera.hpp" #include "frustum.hpp" -#include "std.hpp" + +#include static Vector vts[17][17]; diff --git a/Runtime/blitz3d/planemodel.hpp b/Runtime/blitz3d/planemodel.hpp index b1e7a1a..0292706 100644 --- a/Runtime/blitz3d/planemodel.hpp +++ b/Runtime/blitz3d/planemodel.hpp @@ -1,7 +1,4 @@ - -#ifndef PLANEMODEL_H -#define PLANEMODEL_H - +#pragma once #include "brush.hpp" #include "model.hpp" @@ -33,5 +30,3 @@ class PlaneModel : public Model { return this; } }; - -#endif \ No newline at end of file diff --git a/Runtime/blitz3d/q3bspmodel.cpp b/Runtime/blitz3d/q3bspmodel.cpp index 08d187a..1f2e0f7 100644 --- a/Runtime/blitz3d/q3bspmodel.cpp +++ b/Runtime/blitz3d/q3bspmodel.cpp @@ -1,15 +1,13 @@ - #include "q3bspmodel.hpp" #include "q3bsprep.hpp" -#include "std.hpp" struct Q3BSPModel::Rep : public Q3BSPRep { int ref_cnt; - Rep(const string& f, float gam) : Q3BSPRep(f, gam), ref_cnt(1) {} + Rep(const std::string& f, float gam) : Q3BSPRep(f, gam), ref_cnt(1) {} }; -Q3BSPModel::Q3BSPModel(const string& f, float gam) : rep(new Rep(f, gam)) {} +Q3BSPModel::Q3BSPModel(const std::string& f, float gam) : rep(new Rep(f, gam)) {} Q3BSPModel::Q3BSPModel(const Q3BSPModel& t) : Model(t), rep(t.rep) { @@ -46,4 +44,4 @@ void Q3BSPModel::setLighting(bool l) bool Q3BSPModel::isValid() const { return rep->isValid(); -} \ No newline at end of file +} diff --git a/Runtime/blitz3d/q3bspmodel.hpp b/Runtime/blitz3d/q3bspmodel.hpp index bef5a9a..1b6e2f0 100644 --- a/Runtime/blitz3d/q3bspmodel.hpp +++ b/Runtime/blitz3d/q3bspmodel.hpp @@ -1,12 +1,9 @@ - -#ifndef Q3BSPMODEL_H -#define Q3BSPMODEL_H - +#pragma once #include "model.hpp" class Q3BSPModel : public Model { public: - Q3BSPModel(const string& f, float gamma_adj); + Q3BSPModel(const std::string& f, float gamma_adj); Q3BSPModel(const Q3BSPModel& m); ~Q3BSPModel(); @@ -36,5 +33,3 @@ class Q3BSPModel : public Model { struct Rep; Rep* rep; }; - -#endif \ No newline at end of file diff --git a/Runtime/blitz3d/q3bsprep.cpp b/Runtime/blitz3d/q3bsprep.cpp index ed32f37..0626152 100644 --- a/Runtime/blitz3d/q3bsprep.cpp +++ b/Runtime/blitz3d/q3bsprep.cpp @@ -1,6 +1,8 @@ - #include "q3bsprep.hpp" -#include "std.hpp" + +#include +#include +#include /* Quake3 File format types */ @@ -89,7 +91,7 @@ struct q3_header { struct Surf { Q3BSPSurf* surf; int texture, lm_index; - vector verts, tris; + std::vector verts, tris; }; struct FaceCmp { @@ -105,7 +107,7 @@ struct FaceCmp { } }; -typedef map FaceMap; +typedef std::map FaceMap; /* render reps */ @@ -114,7 +116,7 @@ struct Q3BSPFace; struct Q3BSPSurf { Brush brush; gxMesh* mesh; - vector r_faces; + std::vector r_faces; int texture, lm_index; }; @@ -127,13 +129,13 @@ struct Q3BSPFace { }; struct Q3BSPBrush { - vector planes; + std::vector planes; }; struct Q3BSPLeaf { int cluster; Box box; - vector faces; + std::vector faces; }; struct Q3BSPNode { @@ -153,10 +155,10 @@ struct Q3BSPNode { static q3_header header; static FaceMap face_map; -static vector t_surfs; -static vector p_verts; //patch vertices -static vector p_coll_verts; -static vector coll_tris; +static std::vector t_surfs; +static std::vector p_verts; //patch vertices +static std::vector p_coll_verts; +static std::vector coll_tris; static float gamma_adj; @@ -164,7 +166,7 @@ static Vector r_eye; static int r_cluster; static Frustum r_frustum; static Vector r_frustedges[12]; -static map q3face_map; +static std::map q3face_map; extern gxScene* gx_scene; extern gxRuntime* gx_runtime; @@ -182,7 +184,7 @@ static void debuglog(const string& t) gx_runtime->debugLog(t.c_str()); } #else -static void debuglog(const string& t) {} +static void debuglog(const std::string& t) {} #endif static Surf* findSurf(q3_face* f) @@ -193,7 +195,7 @@ static Surf* findSurf(q3_face* f) Surf* s = new Surf; s->texture = f->texture; s->lm_index = f->lm_index; - face_map.insert(make_pair(f, s)); + face_map.insert(std::make_pair(f, s)); t_surfs.push_back(s); return s; } @@ -203,7 +205,7 @@ void Q3BSPRep::createTextures() int n_texs = header.dir[1].length / sizeof(q3_tex); q3_tex* q3tex = (q3_tex*)header.dir[1].lump; for (int k = 0; k < n_texs; ++k) { - string t = string(q3tex->name); + std::string t = std::string(q3tex->name); char fl[32], co[32]; _itoa(q3tex->flags, fl, 16); _itoa(q3tex->contents, co, 16); @@ -264,7 +266,7 @@ void Q3BSPRep::createVis() void Q3BSPRep::createCollider() { - vector coll_verts; + std::vector coll_verts; int n_verts = header.dir[10].length / sizeof(q3_vertex); q3_vertex* t = (q3_vertex*)header.dir[10].lump; MeshCollider::Vertex cv; @@ -350,7 +352,7 @@ static void average(const q3_vertex& a, const q3_vertex& b, q3_vertex* c) } } -static void subdivide(vector& verts, int level, int index, int step) +static void subdivide(std::vector& verts, int level, int index, int step) { if (!level) { q3_vertex t1, t2; @@ -369,7 +371,7 @@ static void subdivide(vector& verts, int level, int index, int step) static void patchFace(Q3BSPFace* face, q3_face* q3face, bool draw, bool solid, int level) { int k, x, y; - vector verts; + std::vector verts; if (draw) { int step = 1 << level; @@ -422,7 +424,7 @@ static void patchFace(Q3BSPFace* face, q3_face* q3face, bool draw, bool solid, i } if (solid) { - vector verts; + std::vector verts; int step = 1; int size_x = q3face->patch_size[0]; int size_y = q3face->patch_size[1]; @@ -472,7 +474,7 @@ static void patchFace(Q3BSPFace* face, q3_face* q3face, bool draw, bool solid, i static void meshFace(Q3BSPFace* face, q3_face* q3face, bool draw, bool solid) { - static map vert_map; + static std::map vert_map; vert_map.clear(); int* meshverts = (int*)header.dir[11].lump + q3face->meshvert; MeshCollider::Triangle ct; @@ -529,7 +531,7 @@ Q3BSPLeaf* Q3BSPRep::createLeaf(int n) for (int k = 0; k < q3leaf->n_leaffaces; ++k) { int face_n = leaffaces[k]; - map::const_iterator it = q3face_map.find(face_n); + std::map::const_iterator it = q3face_map.find(face_n); if (it != q3face_map.end()) { if (it->second) leaf->faces.push_back(it->second); @@ -567,7 +569,7 @@ Q3BSPLeaf* Q3BSPRep::createLeaf(int n) face->n_verts = face->n_tris = 0; leaf->faces.push_back(face); faces.push_back(face); - q3face_map.insert(make_pair(face_n, face)); + q3face_map.insert(std::make_pair(face_n, face)); } if (q3face->type == 2) { @@ -608,7 +610,7 @@ Q3BSPNode* Q3BSPRep::createNode(int n) return node; } -Q3BSPRep::Q3BSPRep(const string& f, float gam) : root_node(0), vis_sz(0), vis_data(0), use_lmap(true) +Q3BSPRep::Q3BSPRep(const std::string& f, float gam) : root_node(0), vis_sz(0), vis_data(0), use_lmap(true) { gamma_adj = 1 - gam; diff --git a/Runtime/blitz3d/q3bsprep.hpp b/Runtime/blitz3d/q3bsprep.hpp index 3837bd7..c5d48a6 100644 --- a/Runtime/blitz3d/q3bsprep.hpp +++ b/Runtime/blitz3d/q3bsprep.hpp @@ -1,7 +1,6 @@ - -#ifndef Q3BSPREP_H -#define Q3BSPREP_H - +#pragma once +#include +#include #include "meshcollider.hpp" #include "model.hpp" @@ -13,7 +12,7 @@ struct Q3BSPNode; class Q3BSPRep { public: //constructor - Q3BSPRep(const string& f, float gamma_adj); + Q3BSPRep(const std::string& f, float gamma_adj); ~Q3BSPRep(); void render(Model* model, const RenderContext& rc); @@ -32,9 +31,9 @@ class Q3BSPRep { Vector ambient; - vector faces; - vector surfs, r_surfs; - vector textures, light_maps; + std::vector faces; + std::vector surfs, r_surfs; + std::vector textures, light_maps; int vis_sz; char* vis_data; @@ -55,5 +54,3 @@ class Q3BSPRep { void render(Q3BSPLeaf* l, int clip); void render(Q3BSPNode* n, int clip); }; - -#endif \ No newline at end of file diff --git a/Runtime/blitz3d/rendercontext.hpp b/Runtime/blitz3d/rendercontext.hpp index 4e9d1ec..7ae7c34 100644 --- a/Runtime/blitz3d/rendercontext.hpp +++ b/Runtime/blitz3d/rendercontext.hpp @@ -1,7 +1,4 @@ - -#ifndef RENDERCONTEXT_H -#define RENDERCONTEXT_H - +#pragma once #include "frustum.hpp" class RenderContext { @@ -33,5 +30,3 @@ class RenderContext { Frustum world_frustum, camera_frustum; bool ref; }; - -#endif \ No newline at end of file diff --git a/Runtime/blitz3d/sprite.cpp b/Runtime/blitz3d/sprite.cpp index cf73670..fa865cd 100644 --- a/Runtime/blitz3d/sprite.cpp +++ b/Runtime/blitz3d/sprite.cpp @@ -1,6 +1,7 @@ - #include "sprite.hpp" -#include "std.hpp" + +#include +#include extern float stats3d[]; @@ -16,7 +17,7 @@ extern gxGraphics* gx_graphics; static gxMesh* mesh; static int mesh_size; -static vector mesh_indices; +static std::vector mesh_indices; static int allocIndex() { diff --git a/Runtime/blitz3d/sprite.hpp b/Runtime/blitz3d/sprite.hpp index da26997..8c85d96 100644 --- a/Runtime/blitz3d/sprite.hpp +++ b/Runtime/blitz3d/sprite.hpp @@ -1,7 +1,4 @@ - -#ifndef SPRITE_H -#define SPRITE_H - +#pragma once #include "brush.hpp" #include "gxmesh.hpp" #include "model.hpp" @@ -46,5 +43,3 @@ class Sprite : public Model { int view_mode, mesh_index; bool captured; }; - -#endif \ No newline at end of file diff --git a/Runtime/blitz3d/std.cpp b/Runtime/blitz3d/std.cpp deleted file mode 100644 index d5f561b..0000000 --- a/Runtime/blitz3d/std.cpp +++ /dev/null @@ -1,2 +0,0 @@ - -#include "std.hpp" diff --git a/Runtime/blitz3d/std.hpp b/Runtime/blitz3d/std.hpp deleted file mode 100644 index 1fa9af2..0000000 --- a/Runtime/blitz3d/std.hpp +++ /dev/null @@ -1,20 +0,0 @@ - -#ifndef STD_H -#define STD_H - -#pragma warning(disable : 4786) - -#include "config.hpp" -#include "gxruntime.hpp" -#include "stdutil.hpp" - -#include -#include -#include -#include -#include -#include - -using namespace std; - -#endif \ No newline at end of file diff --git a/Runtime/blitz3d/surface.cpp b/Runtime/blitz3d/surface.cpp index 2ca6465..1fd36e5 100644 --- a/Runtime/blitz3d/surface.cpp +++ b/Runtime/blitz3d/surface.cpp @@ -1,6 +1,6 @@ - #include "surface.hpp" -#include "std.hpp" + +#include extern gxGraphics* gx_graphics; @@ -22,7 +22,7 @@ void Surface::setBrush(const Brush& b) ++mon->brush_changes; } -void Surface::setName(const string& n) +void Surface::setName(const std::string& n) { name = n; } @@ -40,7 +40,7 @@ void Surface::clear(bool verts, bool tris) ++mon->geom_changes; } -void Surface::addVertices(const vector& verts) +void Surface::addVertices(const std::vector& verts) { vertices.insert(vertices.end(), verts.begin(), verts.end()); ++mon->geom_changes; @@ -79,7 +79,7 @@ Vector Surface::getColor(int n) const return Vector(r / 255.0f, g / 255.0f, b / 255.0f); } -void Surface::addTriangles(const vector& tris) +void Surface::addTriangles(const std::vector& tris) { triangles.insert(triangles.end(), tris.begin(), tris.end()); } @@ -87,7 +87,7 @@ void Surface::addTriangles(const vector& tris) void Surface::updateNormals() { int k; - map norm_map; + std::map norm_map; for (k = 0; k < triangles.size(); ++k) { const Triangle& t = triangles[k]; const Vector& v0 = vertices[t.verts[0]].coords; @@ -141,7 +141,7 @@ gxMesh* Surface::getMesh() return mesh; } -gxMesh* Surface::getMesh(const vector& bones) +gxMesh* Surface::getMesh(const std::vector& bones) { valid_vs = valid_ts = 0; diff --git a/Runtime/blitz3d/surface.hpp b/Runtime/blitz3d/surface.hpp index d3bb5bc..7bec7cc 100644 --- a/Runtime/blitz3d/surface.hpp +++ b/Runtime/blitz3d/surface.hpp @@ -1,8 +1,8 @@ - -#ifndef SURFACE_H -#define SURFACE_H - +#pragma once #include "model.hpp" +#include "geom.hpp" +#include "gxmesh.hpp" +#include #define MAX_SURFACE_BONES 4 @@ -45,7 +45,7 @@ class Surface { Surface(Monitor* mon); ~Surface(); - void setName(const string& t); + void setName(const std::string& t); void setBrush(const Brush& b); void clear(bool verts, bool tris); @@ -103,15 +103,15 @@ class Surface { Vector getColor(int index) const; void setColor(int index, const Vector& v); - void addVertices(const vector& verts); - void addTriangles(const vector& tris); + void addVertices(const std::vector& verts); + void addTriangles(const std::vector& tris); void updateNormals(); gxMesh* getMesh(); - gxMesh* getMesh(const vector& bones); + gxMesh* getMesh(const std::vector& bones); - string getName() const + std::string getName() const { return name; } @@ -138,13 +138,11 @@ class Surface { private: Brush brush; - string name; + std::string name; gxMesh* mesh; - vector vertices; - vector triangles; + std::vector vertices; + std::vector triangles; int mesh_vs, mesh_ts; int valid_vs, valid_ts; Monitor* mon; }; - -#endif \ No newline at end of file diff --git a/Runtime/blitz3d/terrain.cpp b/Runtime/blitz3d/terrain.cpp index 2fd3eec..b445534 100644 --- a/Runtime/blitz3d/terrain.cpp +++ b/Runtime/blitz3d/terrain.cpp @@ -1,6 +1,4 @@ - #include "terrain.hpp" -#include "std.hpp" #include "terrainrep.hpp" Terrain::Terrain(int size_shift) : rep(new TerrainRep(size_shift)) {} diff --git a/Runtime/blitz3d/terrain.hpp b/Runtime/blitz3d/terrain.hpp index 509cee9..3f54853 100644 --- a/Runtime/blitz3d/terrain.hpp +++ b/Runtime/blitz3d/terrain.hpp @@ -1,7 +1,4 @@ - -#ifndef TERRAIN_H -#define TERRAIN_H - +#pragma once #include "model.hpp" struct TerrainRep; @@ -32,5 +29,3 @@ class Terrain : public Model { private: TerrainRep* rep; }; - -#endif \ No newline at end of file diff --git a/Runtime/blitz3d/terrainrep.cpp b/Runtime/blitz3d/terrainrep.cpp index 9afb3cd..2d0da65 100644 --- a/Runtime/blitz3d/terrainrep.cpp +++ b/Runtime/blitz3d/terrainrep.cpp @@ -1,19 +1,24 @@ - #include "terrainrep.hpp" #include -#include "std.hpp" + +#include +#include extern gxRuntime* gx_runtime; extern gxGraphics* gx_graphics; extern float stats3d[10]; -static Vector eye_vec; -static Plane eye_plane; -static const Vector up_normal(0, 1, 0); -static TerrainRep::Tri* tri_pool; -static const TerrainRep* curr; -static Frustum frustum; -static int out_cnt, proc_cnt, clip_cnt; +static Vector eye_vec; +static Plane eye_plane; +static const Vector up_normal(0, 1, 0); +static TerrainRep::Tri* tri_pool; +static const TerrainRep* curr; +static Frustum frustum; +static int out_cnt, proc_cnt, clip_cnt; +static std::vector tris; + +static int vert_cnt, max_verts; +static TerrainRep::Vert *verts, *next_vert; static float proj_epsilon = FLT_EPSILON; //.01f; @@ -48,9 +53,6 @@ struct TerrainRep::Vert { Vert(int x, int z, float sy) : x(x), z(z), v((float)x, curr->getHeight(x, z), (float)z), src_y(sy) {} }; -static int vert_cnt, max_verts; -static TerrainRep::Vert *verts, *next_vert; - struct TerrainRep::Tri { int id; short clip, v0, v1, v2; @@ -66,20 +68,20 @@ struct TerrainRep::Tri { { static const int GROW = 64; if (!tri_pool) { - tri_pool = new Tri[GROW]; + tri_pool = new TerrainRep::Tri[GROW]; for (int k = 0; k < GROW - 1; ++k) tri_pool[k].e0 = &tri_pool[k + 1]; tri_pool[GROW - 1].e0 = 0; } - Tri* t = tri_pool; - tri_pool = t->e0; + TerrainRep::Tri* t = tri_pool; + tri_pool = t->e0; return t; } void operator delete(void* q) { - Tri* t = (Tri*)q; - t->e0 = tri_pool; - tri_pool = t; + TerrainRep::Tri* t = (TerrainRep::Tri*)q; + t->e0 = tri_pool; + tri_pool = t; } void unlink() { @@ -117,19 +119,18 @@ struct TriComp { } }; -struct TriQue : public priority_queue, TriComp> { - vector& getVector() +struct TriQue : public std::priority_queue, TriComp> { + std::vector& getVector() { return c; } - const vector& getVector() const + const std::vector& getVector() const { return c; } }; -static TriQue tri_que; -static vector tris; +static TriQue tri_que; static bool clip(const Line& l, const Box& box) { @@ -497,8 +498,8 @@ void TerrainRep::render(Model* model, const RenderContext& rc) delete t; } - int k; - const vector& q_tris = tri_que.getVector(); + int k; + const std::vector& q_tris = tri_que.getVector(); if (!mesh) out_cnt = 0; diff --git a/Runtime/blitz3d/terrainrep.hpp b/Runtime/blitz3d/terrainrep.hpp index 4ab7a29..37c25a0 100644 --- a/Runtime/blitz3d/terrainrep.hpp +++ b/Runtime/blitz3d/terrainrep.hpp @@ -1,9 +1,4 @@ - -#ifndef TERRAINREP_H -#define TERRAINREP_H - -#include - +#pragma once #include "model.hpp" struct TerrainRep { @@ -53,5 +48,3 @@ struct TerrainRep { bool collide(const Line& line, float radius, Collision* curr_coll, const Transform& tform, int id, const Vert& v0, const Vert& v1, const Vert& v2, const Box& box) const; }; - -#endif \ No newline at end of file diff --git a/Runtime/blitz3d/texture.cpp b/Runtime/blitz3d/texture.cpp index 9cb76b3..41640d8 100644 --- a/Runtime/blitz3d/texture.cpp +++ b/Runtime/blitz3d/texture.cpp @@ -1,28 +1,28 @@ - #include "texture.hpp" #include "cachedtexture.hpp" #include "geom.hpp" -#include "std.hpp" -#include "../gxruntime/gxgraphics.hpp" +#include +#include +#include extern gxScene* gx_scene; extern gxGraphics* gx_graphics; struct Filter { - string t; - int flags; - Filter(const string& t, int flags) : t(t), flags(flags) {} + std::string t; + int flags; + Filter(const std::string& t, int flags) : t(t), flags(flags) {} }; -static vector filters; +static std::vector filters; -static int filterFile(const string& t, int flags) +static int filterFile(const std::string& t, int flags) { //check filters... - string l = tolower(t); + std::string l = tolower(t); for (size_t k = 0; k < filters.size(); ++k) { - if (l.find(filters[k].t) != string::npos) { + if (l.find(filters[k].t) != std::string::npos) { flags |= filters[k].flags; } } @@ -30,9 +30,9 @@ static int filterFile(const string& t, int flags) } struct Texture::Rep { - int ref_cnt; - CachedTextureFactory cached_tex; - vector tex_frames; + int ref_cnt; + CachedTexture cached_tex; + std::vector tex_frames; int tex_blend, tex_flags; bool transparent; @@ -50,7 +50,7 @@ struct Texture::Rep { memset(&matrix, 0, sizeof(matrix)); } - Rep(const string& f, int flags, int w, int h, int first, int cnt) + Rep(const std::string& f, int flags, int w, int h, int first, int cnt) : ref_cnt(1), cached_tex(f, flags, w, h, first, cnt), tex_blend(gxScene::BLEND_MULTIPLY), tex_flags(0), sx(1), sy(1), tx(0), ty(0), rot(0), mat_used(false) { @@ -68,7 +68,7 @@ struct Texture::Rep { Texture::Texture() : rep(0) {} -Texture::Texture(const string& f, int flags) +Texture::Texture(const std::string& f, int flags) { flags = filterFile(f, flags) | gxCanvas::CANVAS_TEXTURE; if (flags & gxCanvas::CANVAS_TEX_MASK) @@ -76,7 +76,7 @@ Texture::Texture(const string& f, int flags) rep = new Rep(f, flags, 0, 0, 0, 1); } -Texture::Texture(const string& f, int flags, int w, int h, int first, int cnt) +Texture::Texture(const std::string& f, int flags, int w, int h, int first, int cnt) { flags = filterFile(f, flags) | gxCanvas::CANVAS_TEXTURE; if (flags & gxCanvas::CANVAS_TEX_MASK) @@ -172,7 +172,7 @@ int Texture::getCanvasFlags() const return rep && rep->tex_frames.size() ? rep->tex_frames[0]->getFlags() : 0; } -CachedTextureFactory* Texture::getCachedTexture() const +CachedTexture* Texture::getCachedTexture() const { return rep ? &rep->cached_tex : 0; } @@ -216,7 +216,7 @@ void Texture::clearFilters() filters.clear(); } -void Texture::addFilter(const string& t, int flags) +void Texture::addFilter(const std::string& t, int flags) { filters.push_back(Filter(tolower(t), flags)); } diff --git a/Runtime/blitz3d/texture.hpp b/Runtime/blitz3d/texture.hpp index a6f09f6..12a9ba3 100644 --- a/Runtime/blitz3d/texture.hpp +++ b/Runtime/blitz3d/texture.hpp @@ -1,12 +1,10 @@ - -#ifndef TEXTURE_H -#define TEXTURE_H - +#pragma once #include - #include "cachedtexture.hpp" -#include "gxcanvas.hpp" +#include + +class gxCanvas; class Texture { public: @@ -30,7 +28,7 @@ class Texture { const gxScene::Matrix* getMatrix() const; int getBlend() const; int getFlags() const; - CachedTextureFactory* getCachedTexture() const; + CachedTexture* getCachedTexture() const; bool isTransparent() const; bool operator<(const Texture& t) const; @@ -42,5 +40,3 @@ class Texture { struct Rep; Rep* rep; }; - -#endif \ No newline at end of file diff --git a/Runtime/blitz3d/world.cpp b/Runtime/blitz3d/world.cpp index 474f6a8..9fee924 100644 --- a/Runtime/blitz3d/world.cpp +++ b/Runtime/blitz3d/world.cpp @@ -1,7 +1,6 @@ - #include "world.hpp" #include -#include "std.hpp" +#include "gxruntime.hpp" //0=tris compared for collision //1=max proj err of terrain @@ -30,9 +29,9 @@ static void StaticEnumerateVisible() /******************************* Update *******************************/ -static vector _objsByType[1000]; +static std::vector _objsByType[1000]; -static vector free_colls, used_colls; +static std::vector free_colls, used_colls; static ObjCollision* allocObjColl(Object* with, const Vector& coords, const Collision& coll) { @@ -73,7 +72,7 @@ void World::clearCollisions() void World::addCollision(int src_type, int dst_type, int method, int response) { - vector& info = _collInfo[src_type]; + std::vector& info = _collInfo[src_type]; for (size_t k = 0; k < info.size(); ++k) { const CollInfo& t = info[k]; if (dst_type == t.dst_type) @@ -183,13 +182,13 @@ void World::collide(Object* src) float td = coll_line.d.length(); float td_xz = Vector(coll_line.d.x, 0, coll_line.d.z).length(); - const vector& collinfos = _collInfo[src->getCollisionType()]; + const std::vector& collinfos = _collInfo[src->getCollisionType()]; int hits = 0; for (;;) { - Collision coll; - Object* coll_obj = 0; - vector::const_iterator coll_it, coll_info; + Collision coll; + Object* coll_obj = 0; + std::vector::const_iterator coll_it, coll_info; for (coll_it = collinfos.begin(); coll_it != collinfos.end(); ++coll_it) { // const std::list &dst_objs = _objsByType[coll_it->dst_type]; @@ -501,9 +500,9 @@ void World::update(float elapsed) static Transform cam_tform; //current camera transform -static vector _lights; -static vector _mirrors; -static vector _listeners; +static std::vector _lights; +static std::vector _mirrors; +static std::vector _listeners; struct OrderComp { bool operator()(Object* a, Object* b) @@ -519,13 +518,13 @@ struct TransComp { } }; -static vector ord_mods, unord_mods; +static std::vector ord_mods, unord_mods; -static priority_queue, OrderComp> ord_que; +static std::priority_queue, OrderComp> ord_que; -static priority_queue, OrderComp> cam_que; +static std::priority_queue, OrderComp> cam_que; -static priority_queue, TransComp> transparents; +static std::priority_queue, TransComp> transparents; void World::capture() { @@ -583,7 +582,7 @@ void World::render(float tween) if (!cam->beginRenderFrame()) continue; - vector::const_iterator mir_it; + std::vector::const_iterator mir_it; for (mir_it = _mirrors.begin(); mir_it != _mirrors.end(); ++mir_it) { render(cam, *mir_it); } @@ -595,7 +594,7 @@ void World::render(float tween) // gx_runtime->debugLog( "End RenderWorld" ); - vector::const_iterator lis_it; + std::vector::const_iterator lis_it; for (lis_it = _listeners.begin(); lis_it != _listeners.end(); ++lis_it) { (*lis_it)->renderListener(); } diff --git a/Runtime/blitz3d/world.hpp b/Runtime/blitz3d/world.hpp index ffed910..56156fb 100644 --- a/Runtime/blitz3d/world.hpp +++ b/Runtime/blitz3d/world.hpp @@ -1,9 +1,5 @@ - -#ifndef WORLD_H -#define WORLD_H - +#pragma once #include - #include "camera.hpp" #include "light.hpp" #include "listener.hpp" @@ -42,7 +38,7 @@ class World { int dst_type, method, response; }; - vector _collInfo[WORLD_COLLISION_TYPES]; + std::vector _collInfo[WORLD_COLLISION_TYPES]; std::list _objsByType[WORLD_COLLISION_TYPES]; std::list _objsByTypeSwappable[WORLD_COLLISION_TYPES]; @@ -51,5 +47,3 @@ class World { void render(Model* m, const RenderContext& rc); void flushTransparent(); }; - -#endif