| 6226 | } |
| 6227 | |
| 6228 | void DrawDecal(const olc::DecalInstance& decal) override |
| 6229 | { |
| 6230 | glDisable(GL_CULL_FACE); |
| 6231 | SetDecalMode(decal.mode); |
| 6232 | if (decal.decal == nullptr) |
| 6233 | glBindTexture(GL_TEXTURE_2D, rendBlankQuad.Decal()->id); |
| 6234 | else |
| 6235 | glBindTexture(GL_TEXTURE_2D, decal.decal->id); |
| 6236 | |
| 6237 | locBindBuffer(0x8892, m_vbQuad); |
| 6238 | |
| 6239 | for (uint32_t i = 0; i < decal.points; i++) |
| 6240 | pVertexMem[i] = { { decal.pos[i].x, decal.pos[i].y, decal.w[i], 0.0 }, { decal.uv[i].x, decal.uv[i].y }, decal.tint[i] }; |
| 6241 | |
| 6242 | locBufferData(0x8892, sizeof(locVertex) * decal.points, pVertexMem, 0x88E0); |
| 6243 | locUniform1i(m_uniIs3D, 0); |
| 6244 | |
| 6245 | float f[4] = { 1.0f, 1.0f, 1.0f, 1.0f }; |
| 6246 | locUniform4fv(m_uniTint, 1, f); |
| 6247 | |
| 6248 | if (nDecalMode == DecalMode::WIREFRAME) |
| 6249 | glDrawArrays(GL_LINE_LOOP, 0, decal.points); |
| 6250 | else |
| 6251 | { |
| 6252 | if (decal.structure == olc::DecalStructure::FAN) |
| 6253 | glDrawArrays(GL_TRIANGLE_FAN, 0, decal.points); |
| 6254 | else if (decal.structure == olc::DecalStructure::STRIP) |
| 6255 | glDrawArrays(GL_TRIANGLE_STRIP, 0, decal.points); |
| 6256 | else if (decal.structure == olc::DecalStructure::LIST) |
| 6257 | glDrawArrays(GL_TRIANGLES, 0, decal.points); |
| 6258 | else if (decal.structure == olc::DecalStructure::LINE) |
| 6259 | glDrawArrays(GL_LINES, 0, decal.points); |
| 6260 | } |
| 6261 | } |
| 6262 | |
| 6263 | uint32_t CreateTexture(const uint32_t width, const uint32_t height, const bool filtered, const bool clamp) override |
| 6264 | { |