Changeset View
Changeset View
Standalone View
Standalone View
source/renderer/OverlayRenderer.cpp
Show First 20 Lines • Show All 172 Lines • ▼ Show 20 Lines | void OverlayRendererInternals::Initialize() | ||||
quadIndices.SetNumVertices(MAX_QUAD_OVERLAYS * 6); | quadIndices.SetNumVertices(MAX_QUAD_OVERLAYS * 6); | ||||
quadIndices.Layout(); // allocate backing store | quadIndices.Layout(); // allocate backing store | ||||
// Since the quads in the vertex array are independent and always consist of exactly 4 vertices per quad, the | // Since the quads in the vertex array are independent and always consist of exactly 4 vertices per quad, the | ||||
// indices are always the same; we can therefore fill in all the indices once and pretty much forget about | // indices are always the same; we can therefore fill in all the indices once and pretty much forget about | ||||
// them. We then also no longer need its backing store, since we never change any indices afterwards. | // them. We then also no longer need its backing store, since we never change any indices afterwards. | ||||
VertexArrayIterator<u16> index = quadIndices.GetIterator(); | VertexArrayIterator<u16> index = quadIndices.GetIterator(); | ||||
for (size_t i = 0; i < MAX_QUAD_OVERLAYS; ++i) | for (u16 i = 0; i < static_cast<u16>(MAX_QUAD_OVERLAYS); ++i) | ||||
{ | { | ||||
*index++ = i*4 + 0; | *index++ = i * 4 + 0; | ||||
*index++ = i*4 + 1; | *index++ = i * 4 + 1; | ||||
*index++ = i*4 + 2; | *index++ = i * 4 + 2; | ||||
*index++ = i*4 + 2; | *index++ = i * 4 + 2; | ||||
*index++ = i*4 + 3; | *index++ = i * 4 + 3; | ||||
*index++ = i*4 + 0; | *index++ = i * 4 + 0; | ||||
} | } | ||||
quadIndices.Upload(); | quadIndices.Upload(); | ||||
quadIndices.FreeBackingStore(); | quadIndices.FreeBackingStore(); | ||||
} | } | ||||
OverlayRenderer::OverlayRenderer() | OverlayRenderer::OverlayRenderer() | ||||
{ | { | ||||
m = new OverlayRendererInternals(); | m = new OverlayRendererInternals(); | ||||
▲ Show 20 Lines • Show All 617 Lines • Show Last 20 Lines |
Wildfire Games · Phabricator