| @@ -32,7 +32,7 @@ varying vec2 pass_TexCoord; | |||||
| void main() | void main() | ||||
| { | { | ||||
| vec4 col = texture2D(in_Texture, pass_TexCoord); | vec4 col = texture2D(in_Texture, pass_TexCoord); | ||||
| gl_FragColor = col; | |||||
| gl_FragColor = mix(col, vec4(1.0, 1.0, 0.0, 1.0), 0.5); | |||||
| } | } | ||||
| [vert.hlsl] | [vert.hlsl] | ||||
| @@ -160,6 +160,8 @@ void Scene::Reset() | |||||
| void Scene::AddTile(TileSet *tileset, int id, vec3 pos, int o, vec2 scale) | void Scene::AddTile(TileSet *tileset, int id, vec3 pos, int o, vec2 scale) | ||||
| { | { | ||||
| ASSERT(id < tileset->GetTileCount()); | |||||
| Tile t; | Tile t; | ||||
| /* FIXME: this sorting only works for a 45-degree camera */ | /* FIXME: this sorting only works for a 45-degree camera */ | ||||
| t.prio = -pos.y - 2 * 32 * pos.z + (o ? 0 : 32); | t.prio = -pos.y - 2 * 32 * pos.z + (o ? 0 : 32); | ||||
| @@ -54,6 +54,20 @@ TileSet *Tiler::Register(char const *path, ivec2 size, ivec2 count) | |||||
| return tileset; | return tileset; | ||||
| } | } | ||||
| TileSet *Tiler::Register(char const *path) | |||||
| { | |||||
| int id = data->tilesets.MakeSlot(path); | |||||
| TileSet *tileset = (TileSet *)data->tilesets.GetEntity(id); | |||||
| if (!tileset) | |||||
| { | |||||
| tileset = new TileSet(path); | |||||
| data->tilesets.SetEntity(id, tileset); | |||||
| } | |||||
| return tileset; | |||||
| } | |||||
| void Tiler::Deregister(TileSet *tileset) | void Tiler::Deregister(TileSet *tileset) | ||||
| { | { | ||||
| data->tilesets.RemoveSlot(tileset); | data->tilesets.RemoveSlot(tileset); | ||||
| @@ -28,6 +28,7 @@ class Tiler | |||||
| { | { | ||||
| public: | public: | ||||
| static TileSet *Register(char const *path, ivec2 size, ivec2 count); | static TileSet *Register(char const *path, ivec2 size, ivec2 count); | ||||
| static TileSet *Register(char const *path); | |||||
| static void Deregister(TileSet *); | static void Deregister(TileSet *); | ||||
| private: | private: | ||||
| @@ -44,8 +44,10 @@ protected: | |||||
| public: | public: | ||||
| /* New methods */ | /* New methods */ | ||||
| int AddTile(ibox2 rect); | |||||
| int GetTileCount() const; | int GetTileCount() const; | ||||
| ivec2 GetTileSize(int tileid) const; | ivec2 GetTileSize(int tileid) const; | ||||
| ivec2 GetTextureSize() const; | ivec2 GetTextureSize() const; | ||||
| ShaderTexture GetTexture() const; | ShaderTexture GetTexture() const; | ||||
| void Bind(); | void Bind(); | ||||
| @@ -55,7 +57,6 @@ public: | |||||
| private: | private: | ||||
| void Init(char const *path); | void Init(char const *path); | ||||
| int AddTile(ibox2 rect); | |||||
| TileSetData *m_data; | TileSetData *m_data; | ||||
| }; | }; | ||||