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:
Tim Sylvester
2023-04-18 12:31:41 -07:00
committed by Bart Louwers
parent e2bc75289c
commit aceb0394ba
13 changed files with 111 additions and 78 deletions

View File

@@ -16,25 +16,35 @@ void DrawableGL::draw(const PaintParameters &parameters) const
impl->draw(parameters);
}
void DrawableGL::setVertData(std::vector<std::uint8_t> vertexData_,
std::vector<std::uint16_t> indexes_) {
impl->vertData = std::move(vertexData_);
impl->indexes = std::move(indexes_);
void DrawableGL::setVertexData(std::vector<std::uint8_t> vertexData,
std::vector<std::uint16_t> indexes,
const std::size_t indexOffset,
const std::size_t indexLength) {
impl->vertData = std::move(vertexData);
impl->indexes = std::move(indexes);
impl->indexOffset = indexOffset;
impl->indexLength = indexLength;
}
std::vector<std::uint16_t>& DrawableGL::getIndexData() const {
return impl->indexes;
}
std::vector<std::uint8_t>& DrawableGL::getVertexData() const {
return impl->vertData;
}
const gl::VertexArray& DrawableGL::getVertexArray() const {
return impl->vertexArray;
}
void DrawableGL::setVertexArray(gl::VertexArray&& vertexArray_,
gfx::UniqueVertexBufferResource&& attributeBuffer_,
gfx::IndexBuffer&& indexBuffer_) {
gfx::IndexBuffer&& indexBuffer_,
std::size_t attrOffset) {
impl->vertexArray = std::move(vertexArray_);
impl->attributeBuffer = std::move(attributeBuffer_);
impl->attributeOffset = attrOffset;
impl->indexBuffer = std::move(indexBuffer_);
}