… | |
… | |
52 | } |
52 | } |
53 | |
53 | |
54 | void v2f (float x, float y) |
54 | void v2f (float x, float y) |
55 | { |
55 | { |
56 | auto &vec = append<float[2]> (); |
56 | auto &vec = append<float[2]> (); |
57 | vec[0] = x; |
57 | vec[0] = x / 2; |
58 | vec[1] = y; |
58 | vec[1] = y / 2; |
59 | } |
59 | } |
60 | |
60 | |
61 | void t2f_v3f (float u, float v, float x, float y, float z) |
61 | void t2f_v3f (float u, float v, float x, float y, float z) |
62 | { |
62 | { |
63 | auto &vec = append<float[5]> (); |
63 | auto &vec = append<float[5]> (); |
… | |
… | |
82 | c.y = y + h; |
82 | c.y = y + h; |
83 | } |
83 | } |
84 | } |
84 | } |
85 | }; |
85 | }; |
86 | |
86 | |
|
|
87 | int drawcount = 0; |
87 | ska::flat_hash_map<rc_key_t, array_t> h; |
88 | ska::flat_hash_map<rc_key_t, array_t> h; |
88 | |
89 | |
89 | void clear () |
90 | void clear () |
90 | { |
91 | { |
|
|
92 | drawcount = 0; |
91 | h.clear (); |
93 | h.clear (); |
92 | } |
94 | } |
93 | |
95 | |
94 | array_t &array (const rc_key_t &k) |
96 | array_t &array (const rc_key_t &k) |
95 | { |
97 | { |
… | |
… | |
126 | //glUnlockArraysEXT (); |
128 | //glUnlockArraysEXT (); |
127 | } |
129 | } |
128 | else |
130 | else |
129 | { |
131 | { |
130 | // optimised character quad storage. slower but nice on memory. |
132 | // optimised character quad storage. slower but nice on memory. |
131 | // reduces storage requirements from 80 bytes/char to 6-8 |
133 | // reduces storage requirements from 80 bytes/char to 8 |
132 | auto *c = (glyph_data *) arr.data (); |
134 | auto *c = (glyph_data *) arr.data (); |
133 | auto *e = (glyph_data *)(arr.data () + arr.size ()); |
135 | auto *e = (glyph_data *)(arr.data () + arr.size ()); |
134 | |
136 | |
135 | glBegin (key.mode); // practically must be quads |
137 | glBegin (key.mode); // practically must be quads |
136 | |
138 | |
… | |
… | |
147 | glEnd (); |
149 | glEnd (); |
148 | } |
150 | } |
149 | } |
151 | } |
150 | |
152 | |
151 | glDisable (GL_TEXTURE_2D); |
153 | glDisable (GL_TEXTURE_2D); |
|
|
154 | |
|
|
155 | if (ecb_expect_false (++drawcount == 16)) |
|
|
156 | for (auto &&it = h.begin (); it != h.end (); ++it) |
|
|
157 | it->second.shrink_to_fit (); |
152 | } |
158 | } |
153 | }; |
159 | }; |
154 | |
160 | |