mirror of
https://github.com/SFML/SFML.git
synced 2024-12-01 07:41:05 +08:00
Remove templates where not necessary
This commit is contained in:
parent
962e6ed972
commit
6d3c8d0786
@ -120,12 +120,11 @@ bool getStreamContents(sf::InputStream& stream, std::vector<char>& buffer)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Transforms an array of 2D vectors into a contiguous array of scalars
|
// Transforms an array of 2D vectors into a contiguous array of scalars
|
||||||
template <typename T>
|
std::vector<float> flatten(const sf::Vector2f* vectorArray, std::size_t length)
|
||||||
std::vector<T> flatten(const sf::Vector2<T>* vectorArray, std::size_t length)
|
|
||||||
{
|
{
|
||||||
const std::size_t vectorSize = 2;
|
const std::size_t vectorSize = 2;
|
||||||
|
|
||||||
std::vector<T> contiguous(vectorSize * length);
|
std::vector<float> contiguous(vectorSize * length);
|
||||||
for (std::size_t i = 0; i < length; ++i)
|
for (std::size_t i = 0; i < length; ++i)
|
||||||
{
|
{
|
||||||
contiguous[vectorSize * i] = vectorArray[i].x;
|
contiguous[vectorSize * i] = vectorArray[i].x;
|
||||||
@ -136,12 +135,11 @@ std::vector<T> flatten(const sf::Vector2<T>* vectorArray, std::size_t length)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Transforms an array of 3D vectors into a contiguous array of scalars
|
// Transforms an array of 3D vectors into a contiguous array of scalars
|
||||||
template <typename T>
|
std::vector<float> flatten(const sf::Vector3f* vectorArray, std::size_t length)
|
||||||
std::vector<T> flatten(const sf::Vector3<T>* vectorArray, std::size_t length)
|
|
||||||
{
|
{
|
||||||
const std::size_t vectorSize = 3;
|
const std::size_t vectorSize = 3;
|
||||||
|
|
||||||
std::vector<T> contiguous(vectorSize * length);
|
std::vector<float> contiguous(vectorSize * length);
|
||||||
for (std::size_t i = 0; i < length; ++i)
|
for (std::size_t i = 0; i < length; ++i)
|
||||||
{
|
{
|
||||||
contiguous[vectorSize * i] = vectorArray[i].x;
|
contiguous[vectorSize * i] = vectorArray[i].x;
|
||||||
@ -153,12 +151,11 @@ std::vector<T> flatten(const sf::Vector3<T>* vectorArray, std::size_t length)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Transforms an array of 4D vectors into a contiguous array of scalars
|
// Transforms an array of 4D vectors into a contiguous array of scalars
|
||||||
template <typename T>
|
std::vector<float> flatten(const sf::Glsl::Vec4* vectorArray, std::size_t length)
|
||||||
std::vector<T> flatten(const sf::priv::Vector4<T>* vectorArray, std::size_t length)
|
|
||||||
{
|
{
|
||||||
const std::size_t vectorSize = 4;
|
const std::size_t vectorSize = 4;
|
||||||
|
|
||||||
std::vector<T> contiguous(vectorSize * length);
|
std::vector<float> contiguous(vectorSize * length);
|
||||||
for (std::size_t i = 0; i < length; ++i)
|
for (std::size_t i = 0; i < length; ++i)
|
||||||
{
|
{
|
||||||
contiguous[vectorSize * i] = vectorArray[i].x;
|
contiguous[vectorSize * i] = vectorArray[i].x;
|
||||||
|
Loading…
Reference in New Issue
Block a user