dungeon_crawler
annotate prototype/src/tile.h @ 75:b05ab29cd17d
color grading done
author | John Tsiombikas <nuclear@member.fsf.org> |
---|---|
date | Mon, 22 Oct 2012 03:55:00 +0300 |
parents | d57df51f6b50 |
children |
rev | line source |
---|---|
nuclear@1 | 1 #ifndef TILE_H_ |
nuclear@1 | 2 #define TILE_H_ |
nuclear@1 | 3 |
nuclear@2 | 4 #include <vector> |
nuclear@7 | 5 #include <map> |
nuclear@7 | 6 #include <assimp/scene.h> |
nuclear@66 | 7 #include "psys/psys.h" |
nuclear@2 | 8 #include "mesh.h" |
nuclear@4 | 9 #include "light.h" |
nuclear@48 | 10 #include "audio/sample.h" |
nuclear@49 | 11 #include "audio/source.h" |
nuclear@2 | 12 |
nuclear@3 | 13 enum { |
nuclear@3 | 14 TILE_NORTH = 1, |
nuclear@3 | 15 TILE_SOUTH = 2, |
nuclear@3 | 16 TILE_EAST = 4, |
nuclear@3 | 17 TILE_WEST = 8, |
nuclear@7 | 18 TILE_ALL = 0xffff |
nuclear@3 | 19 }; |
nuclear@3 | 20 |
nuclear@48 | 21 enum { |
nuclear@48 | 22 TILE_SAMPLE_WALK, |
nuclear@48 | 23 TILE_SAMPLE_RUN, |
nuclear@48 | 24 |
nuclear@48 | 25 MAX_TILE_SAMPLES |
nuclear@48 | 26 }; |
nuclear@48 | 27 |
nuclear@11 | 28 class TileSet; |
nuclear@11 | 29 |
nuclear@1 | 30 class Tile { |
nuclear@49 | 31 public: |
nuclear@49 | 32 struct AudioSourceDesc { |
nuclear@50 | 33 unsigned int dirmask; |
nuclear@49 | 34 Vector3 pos; |
nuclear@49 | 35 AudioSample *sample; |
nuclear@51 | 36 float volume; |
nuclear@51 | 37 float ref_dist; |
nuclear@49 | 38 }; |
nuclear@49 | 39 |
nuclear@2 | 40 private: |
nuclear@11 | 41 TileSet *tset; |
nuclear@11 | 42 |
nuclear@48 | 43 AudioSample *samples[MAX_TILE_SAMPLES]; |
nuclear@48 | 44 |
nuclear@2 | 45 std::vector<Mesh*> meshes; |
nuclear@46 | 46 std::vector<unsigned int> mesh_side, light_side, psys_side; |
nuclear@3 | 47 std::vector<Light*> lights; |
nuclear@45 | 48 // attributes for gridcell-unique particle systems |
nuclear@38 | 49 std::vector<struct psys_attributes*> psattr; |
nuclear@45 | 50 // global particle systems (simulated once, drawn for each tile instance). |
nuclear@45 | 51 std::vector<struct psys_emitter*> psys_global; |
nuclear@46 | 52 long last_upd; |
nuclear@2 | 53 |
nuclear@49 | 54 // audio sources |
nuclear@49 | 55 std::vector<AudioSourceDesc> ausrc; |
nuclear@49 | 56 |
nuclear@4 | 57 int load_lights(const aiScene *scn); |
nuclear@7 | 58 int load_meshes(const aiScene *scn, const std::map<aiMesh*, aiNode*> &nmap); |
nuclear@4 | 59 |
nuclear@1 | 60 public: |
nuclear@11 | 61 Tile(TileSet *tileset = 0); |
nuclear@38 | 62 ~Tile(); |
nuclear@11 | 63 |
nuclear@48 | 64 AudioSample *get_sample(int sidx) const; |
nuclear@48 | 65 |
nuclear@49 | 66 int get_audio_source_count() const; |
nuclear@49 | 67 const AudioSourceDesc &get_audio_source(int idx) const; |
nuclear@49 | 68 |
nuclear@45 | 69 int get_unique_psys_count() const; |
nuclear@49 | 70 struct psys_attributes *get_unique_psys(int idx); |
nuclear@49 | 71 const struct psys_attributes *get_unique_psys(int idx) const; |
nuclear@45 | 72 |
nuclear@1 | 73 bool load(const char *fname); |
nuclear@1 | 74 |
nuclear@38 | 75 void update(unsigned long msec, float dt); |
nuclear@38 | 76 |
nuclear@3 | 77 void draw(unsigned int drawmask) const; |
nuclear@23 | 78 void draw_lights(unsigned int drawmask) const; |
nuclear@46 | 79 void draw_post(unsigned int drawmask) const; |
nuclear@1 | 80 }; |
nuclear@1 | 81 |
nuclear@5 | 82 |
nuclear@1 | 83 #endif // TILE_H_ |