Topic/drawable 2 (#1032)
More vertex attribute work Move drawables above existing layer rendering. Use context for the actual draw call. Fake the vertexes in the shader to get something actually showing up. Simplify shader state management
This commit is contained in:
committed by
Bart Louwers
parent
e2bc75289c
commit
aceb0394ba
@@ -12,10 +12,8 @@ gfx::DrawablePtr DrawableGLBuilder::createDrawable() const {
|
||||
|
||||
void DrawableGLBuilder::init() {
|
||||
const auto n = impl->vertices.elements();
|
||||
assert(n <= impl->indexes.elements());
|
||||
assert(n == impl->colors.size());
|
||||
|
||||
// temp
|
||||
const auto vertSize = sizeof(Impl::VT) + 4 * sizeof(float);
|
||||
std::vector<uint8_t> rawVert(n * vertSize);
|
||||
|
||||
@@ -28,7 +26,10 @@ void DrawableGLBuilder::init() {
|
||||
*(float*)p = impl->colors[i].a; p += sizeof(float);
|
||||
}
|
||||
|
||||
((DrawableGL*)currentDrawable.get())->setVertData(std::move(rawVert), impl->indexes.vector());
|
||||
auto& drawableGL = static_cast<DrawableGL&>(*currentDrawable);
|
||||
constexpr auto indexOffset = 0;
|
||||
const auto indexCount = impl->indexes.elements();
|
||||
drawableGL.setVertexData(std::move(rawVert), impl->indexes.vector(), indexOffset, indexCount);
|
||||
}
|
||||
|
||||
} // namespace gl
|
||||
|
||||
Reference in New Issue
Block a user