MCPcopy Create free account
hub / github.com/SFML/SFML / flatten

Function flatten

src/SFML/Graphics/Shader.cpp:125–137  ·  view source on GitHub ↗

Transforms an array of 2D vectors into a contiguous array of scalars

Source from the content-addressed store, hash-verified

123
124// Transforms an array of 2D vectors into a contiguous array of scalars
125std::vector<float> flatten(const sf::Vector2f* vectorArray, std::size_t length)
126{
127 const std::size_t vectorSize = 2;
128
129 std::vector<float> contiguous(vectorSize * length);
130 for (std::size_t i = 0; i < length; ++i)
131 {
132 contiguous[vectorSize * i] = vectorArray[i].x;
133 contiguous[vectorSize * i + 1] = vectorArray[i].y;
134 }
135
136 return contiguous;
137}
138
139// Transforms an array of 3D vectors into a contiguous array of scalars
140std::vector<float> flatten(const sf::Vector3f* vectorArray, std::size_t length)

Callers 1

setUniformArrayMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected