X-Git-Url: http://git.localhorst.tv/?a=blobdiff_plain;f=src%2Fshape.cpp;h=545a8e4712a57c0b998353eaeeaab111d86063fb;hb=35c09fc00094a3d390732fd533b2bd03413d90c7;hp=8111258be6f83d5b2f7d24baeca0a96c99757e3d;hpb=30d36f3d545617faef76f90c4121d6ed118ba272;p=blank.git diff --git a/src/shape.cpp b/src/shape.cpp index 8111258..545a8e4 100644 --- a/src/shape.cpp +++ b/src/shape.cpp @@ -6,16 +6,16 @@ namespace blank { void Shape::Vertices( Model::Positions &vertex, Model::Normals &normal, - Model::Indices &index, - const Model::Position &elem_offset, - Model::Index idx_offset + Model::Indices &index ) const { for (const auto &pos : vtx_pos) { - vertex.emplace_back(elem_offset + pos); + vertex.emplace_back(pos); + } + for (const auto &nrm : vtx_nrm) { + normal.emplace_back(nrm); } - normal.insert(normal.end(), vtx_nrm.begin(), vtx_nrm.end()); for (auto idx : vtx_idx) { - index.emplace_back(idx_offset + idx); + index.emplace_back(idx); } } @@ -37,6 +37,20 @@ void Shape::Vertices( } } +void Shape::Vertices( + BlockModel::Positions &vertex, + BlockModel::Indices &index, + const glm::mat4 &transform, + BlockModel::Index idx_offset +) const { + for (const auto &pos : vtx_pos) { + vertex.emplace_back(transform * glm::vec4(pos, 1.0f)); + } + for (auto idx : vtx_idx) { + index.emplace_back(idx_offset + idx); + } +} + void Shape::Outline( OutlineModel::Positions &vertex, OutlineModel::Indices &index,