Showing
5 changed files
with
17 additions
and
0 deletions
@@ -95,6 +95,11 @@ void DisplayObject::scale(float x, float y, float z, bool increment) { | @@ -95,6 +95,11 @@ void DisplayObject::scale(float x, float y, float z, bool increment) { | ||
95 | recomputeModelMatrix(); | 95 | recomputeModelMatrix(); |
96 | } | 96 | } |
97 | 97 | ||
98 | +void DOVertexes::clear() { | ||
99 | + vertices.clear(); | ||
100 | + setChanged(); | ||
101 | +} | ||
102 | + | ||
98 | int DOVertexes::addQuad( | 103 | int DOVertexes::addQuad( |
99 | float x1, float y1, float u1, float v1, | 104 | float x1, float y1, float u1, float v1, |
100 | float x2, float y2, float u2, float v2, | 105 | float x2, float y2, float u2, float v2, |
@@ -93,6 +93,8 @@ public: | @@ -93,6 +93,8 @@ public: | ||
93 | if (tex_lua_ref != LUA_NOREF && L) luaL_unref(L, LUA_REGISTRYINDEX, tex_lua_ref); | 93 | if (tex_lua_ref != LUA_NOREF && L) luaL_unref(L, LUA_REGISTRYINDEX, tex_lua_ref); |
94 | }; | 94 | }; |
95 | 95 | ||
96 | + void clear(); | ||
97 | + | ||
96 | int addQuad( | 98 | int addQuad( |
97 | float x1, float y1, float u1, float v1, | 99 | float x1, float y1, float u1, float v1, |
98 | float x2, float y2, float u2, float v2, | 100 | float x2, float y2, float u2, float v2, |
@@ -96,6 +96,7 @@ void DOText::parseText() { | @@ -96,6 +96,7 @@ void DOText::parseText() { | ||
96 | bool no_linefeed = lua_toboolean(L, 11); | 96 | bool no_linefeed = lua_toboolean(L, 11); |
97 | 97 | ||
98 | setTexture(f->atlas_tex, LUA_NOREF); | 98 | setTexture(f->atlas_tex, LUA_NOREF); |
99 | + clear(); | ||
99 | 100 | ||
100 | // Update VO size once, we are allocating a few more than neede in case of utf8 or control sequences, but we dont care | 101 | // Update VO size once, we are allocating a few more than neede in case of utf8 or control sequences, but we dont care |
101 | vertices.reserve(len * 4); | 102 | vertices.reserve(len * 4); |
@@ -162,6 +162,12 @@ void DORContainer::render(DORContainer *container, mat4 cur_model) { | @@ -162,6 +162,12 @@ void DORContainer::render(DORContainer *container, mat4 cur_model) { | ||
162 | resetChanged(); | 162 | resetChanged(); |
163 | } | 163 | } |
164 | 164 | ||
165 | +static bool zSorter(vertex i, vertex j) { | ||
166 | + return i.pos[z] < j.pos[z]; | ||
167 | + | ||
168 | + // ah but this wont work, we need to sort BEFORE display lists are made.. some kind of super big raw display list .. uh .. | ||
169 | +} | ||
170 | + | ||
165 | void RendererGL::update() { | 171 | void RendererGL::update() { |
166 | // Release currently owned display lists | 172 | // Release currently owned display lists |
167 | for (auto dl = displays.begin() ; dl != displays.end(); ++dl) { releaseDisplayList(*dl); } | 173 | for (auto dl = displays.begin() ; dl != displays.end(); ++dl) { releaseDisplayList(*dl); } |
@@ -105,12 +105,15 @@ private: | @@ -105,12 +105,15 @@ private: | ||
105 | GLuint *vbo_elements_data = NULL; | 105 | GLuint *vbo_elements_data = NULL; |
106 | GLuint vbo_elements = 0; | 106 | GLuint vbo_elements = 0; |
107 | int vbo_elements_nb = 0; | 107 | int vbo_elements_nb = 0; |
108 | + bool zsort = false; | ||
109 | + vector<vertex> zvertices; | ||
108 | 110 | ||
109 | public: | 111 | public: |
110 | RendererGL(); | 112 | RendererGL(); |
111 | RendererGL(int w, int h); | 113 | RendererGL(int w, int h); |
112 | virtual ~RendererGL(); | 114 | virtual ~RendererGL(); |
113 | 115 | ||
116 | + virtual void zSorting(bool sort) { zsort = sort; }; | ||
114 | virtual void update(); | 117 | virtual void update(); |
115 | virtual void toScreen(float x, float y, float r, float g, float b, float a); | 118 | virtual void toScreen(float x, float y, float r, float g, float b, float a); |
116 | }; | 119 | }; |
-
Please register or login to post a comment