Kaydet (Commit) 3830059b authored tarafından David Tardon's avatar David Tardon

get vertices count without jumping through hoops

Change-Id: I0cab6b2f9fffc8cf9fc5059b8dc48fa9407e42b5
üst 8ca055f5
...@@ -1998,9 +1998,8 @@ void GlitterTransition::prepareTransition( sal_Int32 glLeavingSlideTex, sal_Int3 ...@@ -1998,9 +1998,8 @@ void GlitterTransition::prepareTransition( sal_Int32 glLeavingSlideTex, sal_Int3
// Upload the center of each hexagon. // Upload the center of each hexagon.
const Primitive& primitive = getScene().getLeavingSlide()[0]; const Primitive& primitive = getScene().getLeavingSlide()[0];
int nbVertices = primitive.getVerticesByteSize() / sizeof(Vertex);
std::vector<ThreeFloats> vertices; std::vector<ThreeFloats> vertices;
for (int i = 2; i < nbVertices; i += 18) { for (int i = 2; i < primitive.getVerticesCount(); i += 18) {
const glm::vec3& center = primitive.getVertex(i); const glm::vec3& center = primitive.getVertex(i);
for (int j = 0; j < 18; ++j) for (int j = 0; j < 18; ++j)
vertices.push_back({center.x, center.y, center.z}); vertices.push_back({center.x, center.y, center.z});
......
...@@ -33,6 +33,7 @@ ...@@ -33,6 +33,7 @@
#include <GL/glew.h> #include <GL/glew.h>
#include <limits>
#include <memory> #include <memory>
#include <vector> #include <vector>
...@@ -335,6 +336,12 @@ public: ...@@ -335,6 +336,12 @@ public:
*/ */
const glm::vec3& getVertex(int n) const {return Vertices[n].position;} const glm::vec3& getVertex(int n) const {return Vertices[n].position;}
int getVerticesCount() const
{
assert(Vertices.size() < std::numeric_limits<int>::max());
return int(unsigned(Vertices.size()));
}
/** accessor for the size of the vertices data /** accessor for the size of the vertices data
@return @return
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment