Skip to content

Commit

Permalink
[Misc] Removed dependency to std::array.
Browse files Browse the repository at this point in the history
  • Loading branch information
LukasBanana committed Dec 13, 2024
1 parent 2ff376b commit 17423d7
Show file tree
Hide file tree
Showing 8 changed files with 10 additions and 15 deletions.
8 changes: 4 additions & 4 deletions examples/Cpp/Animation/Example.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,8 @@ class Example_Animation : public ExampleBase

std::vector<Ball> balls;

const std::array<Gs::Vector2f, 15> gridPosFrames
{{
const Gs::Vector2f gridPosFrames[15]
{
Gs::Vector2f{ 0.0f, -3.0f },
Gs::Vector2f{ +1.0f, -3.0f },
Gs::Vector2f{ +2.0f, -3.0f },
Expand All @@ -73,7 +73,7 @@ class Example_Animation : public ExampleBase
Gs::Vector2f{ -3.0f, +2.0f },
Gs::Vector2f{ -3.0f, +1.0f },
Gs::Vector2f{ -3.0f, 0.0f }
}};
};

public:

Expand Down Expand Up @@ -206,7 +206,7 @@ class Example_Animation : public ExampleBase
ball.frameInterpolator -= 1.0f;
ball.frame++;

if (ball.frame + 1 >= gridPosFrames.size())
if (ball.frame + 1 >= sizeof(gridPosFrames)/sizeof(gridPosFrames[0]))
{
ball.position = GetGridPos(0);
ball.frame = 0;
Expand Down
5 changes: 3 additions & 2 deletions examples/Cpp/ExampleBase/PerlinNoise.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -195,9 +195,10 @@ void PerlinNoise::GeneratePermutations(std::uint32_t seed)

void PerlinNoise::GenerateGradients()
{
auto angleStep = Gs::pi * 2.0f / static_cast<float>(grads_.size());
constexpr std::size_t gradsSize = sizeof(grads_)/sizeof(grads_[0]);
auto angleStep = Gs::pi * 2.0f / static_cast<float>(gradsSize);

for (std::size_t i = 0; i < grads_.size(); ++i)
for (std::size_t i = 0; i < gradsSize; ++i)
{
auto a = static_cast<float>(i) * angleStep;
grads_[i] = Gs::Vector3f{ std::cos(a), std::sin(a), std::sin(a)*std::cos(a) };
Expand Down
5 changes: 2 additions & 3 deletions examples/Cpp/ExampleBase/PerlinNoise.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@

#include <cstddef>
#include <cstdint>
#include <array>
#include <vector>
#include <Gauss/Vector3.h>

Expand Down Expand Up @@ -60,8 +59,8 @@ class PerlinNoise

private:

std::array<std::uint32_t, 512> perm_;
std::array<Gs::Vector3f, 256> grads_;
std::uint32_t perm_[512];
Gs::Vector3f grads_[256];

};

Expand Down
3 changes: 1 addition & 2 deletions sources/Renderer/OpenGL/Ext/GLExtensionRegistry.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,13 @@
*/

#include "GLExtensionRegistry.h"
#include <array>


namespace LLGL
{


static std::array<bool, static_cast<std::size_t>(GLExt::Count)> g_registeredExtensions { { false } };
static bool g_registeredExtensions[static_cast<std::size_t>(GLExt::Count)] = {};

static void RegisterExtensionInternal(GLExt extension)
{
Expand Down
1 change: 0 additions & 1 deletion sources/Renderer/OpenGL/RenderState/GLStateManager.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
#include <LLGL/CommandBufferFlags.h>
#include "../OpenGL.h"
#include "../../../Core/Assertion.h"
#include <array>
#include <stack>
#include <cstdint>

Expand Down
1 change: 0 additions & 1 deletion sources/Renderer/OpenGL/Texture/GLTexImage.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
#include "../../../Core/Exception.h"
#include <LLGL/Utils/ColorRGBA.h>
#include <LLGL/Utils/ForRange.h>
#include <array>
#include <algorithm>


Expand Down
1 change: 0 additions & 1 deletion sources/Renderer/OpenGL/Texture/GLTexSubImage.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
#include "../Ext/GLExtensions.h"
#include "../Ext/GLExtensionRegistry.h"
#include "../../../Core/Assertion.h"
#include <array>
#include <algorithm>


Expand Down
1 change: 0 additions & 1 deletion sources/Renderer/OpenGL/Texture/GLTextureSubImage.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
#include "../GLTypes.h"
#include "../Ext/GLExtensions.h"
#include "../../../Core/Assertion.h"
#include <array>
#include <algorithm>


Expand Down

0 comments on commit 17423d7

Please sign in to comment.