Browse Source

Engine: Run clang-format

master
Riyyi 2 years ago
parent
commit
b72da1278d
  1. 2
      src/inferno/assert.h
  2. 4
      src/inferno/component/luascriptcomponent.h
  3. 3
      src/inferno/component/nativescriptcomponent.h
  4. 4
      src/inferno/component/tagcomponent.h
  5. 8
      src/inferno/component/textareacomponent.h
  6. 2
      src/inferno/component/transformcomponent.cpp
  7. 7
      src/inferno/event/applicationevent.h
  8. 18
      src/inferno/event/joystickevent.h
  9. 24
      src/inferno/event/keyevent.h
  10. 32
      src/inferno/event/mouseevent.h
  11. 2
      src/inferno/io/input.cpp
  12. 26
      src/inferno/io/log.h
  13. 259
      src/inferno/render/buffer.cpp
  14. 2
      src/inferno/render/buffer.h
  15. 6
      src/inferno/render/context.cpp
  16. 3
      src/inferno/render/font.cpp
  17. 7
      src/inferno/render/renderer.cpp
  18. 10
      src/inferno/render/shader.cpp
  19. 8
      src/inferno/script/cameracontroller.cpp
  20. 19
      src/inferno/script/registration.cpp
  21. 12
      src/inferno/script/registration.h
  22. 3
      src/inferno/system/camerasystem.cpp
  23. 2
      src/inferno/time.cpp
  24. 5
      src/inferno/window.cpp

2
src/inferno/assert.h

@ -108,6 +108,6 @@ inline void __crash()
}
#endif
}
} // namespace Inferno
// https://github.com/scottt/debugbreak

4
src/inferno/component/luascriptcomponent.h

@ -14,6 +14,8 @@ namespace Inferno {
// Dont allow manually setting instance during construction
LuaScriptComponent() {}
LuaScriptComponent(const std::string& path)
: path(std::move(path)) {}
: path(std::move(path))
{
}
};
} // namespace Inferno

3
src/inferno/component/nativescriptcomponent.h

@ -21,7 +21,8 @@ namespace Inferno {
initialize = []() { return static_cast<NativeScript*>(new T()); };
}
void destroy() {
void destroy()
{
VERIFY(instance, "Attempting to destroy an uninitialized NativeScript");
delete instance;
instance = nullptr;

4
src/inferno/component/tagcomponent.h

@ -10,7 +10,9 @@ namespace Inferno {
TagComponent() = default;
TagComponent(const std::string& tag)
: tag(std::move(tag)) {}
: tag(std::move(tag))
{
}
operator const std::string&() const { return tag; }
};

8
src/inferno/component/textareacomponent.h

@ -18,7 +18,13 @@ namespace Inferno {
TextAreaComponent() {}
TextAreaComponent(const std::string& content, const std::string& font,
uint32_t fontSize, uint32_t width, uint32_t lines)
: content(std::move(content)), font(std::move(font)), fontSize(fontSize), width(width), lines(lines) {}
: content(std::move(content))
, font(std::move(font))
, fontSize(fontSize)
, width(width)
, lines(lines)
{
}
// booleans?
// glm::vec4 outlineColor { 1.0f, 1.0f, 1.0f, 1.0f };

2
src/inferno/component/transformcomponent.cpp

@ -44,4 +44,4 @@ namespace Inferno {
<< value.scale << " s";
}
}
} // namespace Inferno

7
src/inferno/event/applicationevent.h

@ -14,8 +14,11 @@ namespace Inferno {
class WindowResizeEvent : public Event {
public:
WindowResizeEvent(int width, int height) :
m_width(width), m_height(height) {}
WindowResizeEvent(int width, int height)
: m_width(width)
, m_height(height)
{
}
virtual std::string toString() const override
{

18
src/inferno/event/joystickevent.h

@ -13,8 +13,10 @@ namespace Inferno {
EVENT_CLASS_CATEGORY(InputEventCategory | JoystickEventCatergory)
protected:
JoystickEvent(int id) :
m_id(id) {}
JoystickEvent(int id)
: m_id(id)
{
}
private:
int m_id;
@ -22,8 +24,10 @@ namespace Inferno {
class JoystickConnectedEvent : public JoystickEvent {
public:
JoystickConnectedEvent(int id) :
JoystickEvent(id) {}
JoystickConnectedEvent(int id)
: JoystickEvent(id)
{
}
virtual std::string toString() const override
{
@ -37,8 +41,10 @@ namespace Inferno {
class JoystickDisconnectedEvent : public JoystickEvent {
public:
JoystickDisconnectedEvent(int id) :
JoystickEvent(id) {}
JoystickDisconnectedEvent(int id)
: JoystickEvent(id)
{
}
virtual std::string toString() const override
{

24
src/inferno/event/keyevent.h

@ -13,8 +13,10 @@ namespace Inferno {
EVENT_CLASS_CATEGORY(InputEventCategory | KeyEventCategory)
protected:
KeyEvent(int key) :
m_key(key) {}
KeyEvent(int key)
: m_key(key)
{
}
private:
int m_key;
@ -22,8 +24,10 @@ namespace Inferno {
class KeyPressEvent : public KeyEvent {
public:
KeyPressEvent(int key) :
KeyEvent(key) {}
KeyPressEvent(int key)
: KeyEvent(key)
{
}
virtual std::string toString() const override
{
@ -37,8 +41,10 @@ namespace Inferno {
class KeyReleaseEvent : public KeyEvent {
public:
KeyReleaseEvent(int key) :
KeyEvent(key) {}
KeyReleaseEvent(int key)
: KeyEvent(key)
{
}
virtual std::string toString() const override
{
@ -52,8 +58,10 @@ namespace Inferno {
class KeyRepeatEvent : public KeyEvent {
public:
KeyRepeatEvent(int key) :
KeyEvent(key) {}
KeyRepeatEvent(int key)
: KeyEvent(key)
{
}
virtual std::string toString() const override
{

32
src/inferno/event/mouseevent.h

@ -13,8 +13,10 @@ namespace Inferno {
EVENT_CLASS_CATEGORY(InputEventCategory | MouseEventCategory | MouseButtonEventCategory)
protected:
MouseButtonEvent(int button) :
m_button(button) {}
MouseButtonEvent(int button)
: m_button(button)
{
}
private:
int m_button;
@ -22,8 +24,10 @@ namespace Inferno {
class MouseButtonPressEvent : public MouseButtonEvent {
public:
MouseButtonPressEvent(int button) :
MouseButtonEvent(button) {}
MouseButtonPressEvent(int button)
: MouseButtonEvent(button)
{
}
virtual std::string toString() const override
{
@ -37,8 +41,10 @@ namespace Inferno {
class MouseButtonReleaseEvent : public MouseButtonEvent {
public:
MouseButtonReleaseEvent(int button) :
MouseButtonEvent(button) {}
MouseButtonReleaseEvent(int button)
: MouseButtonEvent(button)
{
}
virtual std::string toString() const override
{
@ -52,8 +58,11 @@ namespace Inferno {
class MousePositionEvent : public Event {
public:
MousePositionEvent(float xPos, float yPos) :
m_xPos(xPos), m_yPos(yPos) {}
MousePositionEvent(float xPos, float yPos)
: m_xPos(xPos)
, m_yPos(yPos)
{
}
virtual std::string toString() const override
{
@ -77,8 +86,11 @@ namespace Inferno {
class MouseScrollEvent : public Event {
public:
MouseScrollEvent(float xOffset, float yOffset) :
m_xOffset(xOffset), m_yOffset(yOffset) {}
MouseScrollEvent(float xOffset, float yOffset)
: m_xOffset(xOffset)
, m_yOffset(yOffset)
{
}
virtual std::string toString() const override
{

2
src/inferno/io/input.cpp

@ -89,4 +89,4 @@ namespace Inferno {
return glfwGetKeyScancode(key);
}
}
} // namespace Inferno

26
src/inferno/io/log.h

@ -85,13 +85,27 @@ namespace Inferno {
class DebugLogStream final : public BufferedLogStream {
public:
DebugLogStream()
: m_newline(true), m_type(Log::None) {}
: m_newline(true)
, m_type(Log::None)
{
}
DebugLogStream(bool newline)
: m_newline(newline), m_type(Log::None) {}
: m_newline(newline)
, m_type(Log::None)
{
}
DebugLogStream(Log type)
: m_newline(true), m_type(type) { color(); }
: m_newline(true)
, m_type(type)
{
color();
}
DebugLogStream(Log type, bool newline)
: m_newline(newline), m_type(type) { color(); }
: m_newline(newline)
, m_type(type)
{
color();
}
virtual ~DebugLogStream() override;
void color() const;
@ -106,7 +120,9 @@ namespace Inferno {
class StringLogStream final : public BufferedLogStream {
public:
StringLogStream(std::string* fill)
: m_fill(fill) {}
: m_fill(fill)
{
}
virtual ~StringLogStream() override;
private:

259
src/inferno/render/buffer.cpp

@ -1,19 +1,19 @@
#include "glad/glad.h"
#include "ruc/meta/assert.h"
#include "inferno/core.h"
#include "inferno/io/log.h"
#include "inferno/render/buffer.h"
#include "ruc/meta/assert.h"
namespace Inferno {
// -----------------------------------------
BufferElement::BufferElement(BufferElementType type, std::string name, bool normalized) :
m_type(type),
m_name(name),
m_size(BufferElement::getTypeSize(type)),
m_normalized(normalized)
BufferElement::BufferElement(BufferElementType type, std::string name, bool normalized)
: m_type(type)
, m_name(name)
, m_size(BufferElement::getTypeSize(type))
, m_normalized(normalized)
{
}
@ -35,33 +35,60 @@ namespace Inferno {
uint32_t BufferElement::getTypeSize(const BufferElementType type)
{
switch (type) {
case BufferElementType::None: return 0;
case BufferElementType::Bool: return sizeof(bool);
case BufferElementType::Bool2: return sizeof(bool) * 2;
case BufferElementType::Bool3: return sizeof(bool) * 3;
case BufferElementType::Bool4: return sizeof(bool) * 4;
case BufferElementType::Int: return sizeof(int32_t);
case BufferElementType::Int2: return sizeof(int32_t) * 2;
case BufferElementType::Int3: return sizeof(int32_t) * 3;
case BufferElementType::Int4: return sizeof(int32_t) * 4;
case BufferElementType::Uint: return sizeof(uint32_t);
case BufferElementType::Uint2: return sizeof(uint32_t) * 2;
case BufferElementType::Uint3: return sizeof(uint32_t) * 3;
case BufferElementType::Uint4: return sizeof(uint32_t) * 4;
case BufferElementType::Float: return sizeof(float);
case BufferElementType::Vec2: return sizeof(float) * 2;
case BufferElementType::Vec3: return sizeof(float) * 3;
case BufferElementType::Vec4: return sizeof(float) * 4;
case BufferElementType::Double: return sizeof(double);
case BufferElementType::Double2: return sizeof(double);
case BufferElementType::Double3: return sizeof(double);
case BufferElementType::Double4: return sizeof(double);
case BufferElementType::Mat2: return sizeof(float) * 2 * 2;
case BufferElementType::Mat3: return sizeof(float) * 3 * 3;
case BufferElementType::Mat4: return sizeof(float) * 4 * 4;
case BufferElementType::DoubleMat2: return sizeof(double) * 2 * 2;
case BufferElementType::DoubleMat3: return sizeof(double) * 3 * 3;
case BufferElementType::DoubleMat4: return sizeof(double) * 4 * 4;
case BufferElementType::None:
return 0;
case BufferElementType::Bool:
return sizeof(bool);
case BufferElementType::Bool2:
return sizeof(bool) * 2;
case BufferElementType::Bool3:
return sizeof(bool) * 3;
case BufferElementType::Bool4:
return sizeof(bool) * 4;
case BufferElementType::Int:
return sizeof(int32_t);
case BufferElementType::Int2:
return sizeof(int32_t) * 2;
case BufferElementType::Int3:
return sizeof(int32_t) * 3;
case BufferElementType::Int4:
return sizeof(int32_t) * 4;
case BufferElementType::Uint:
return sizeof(uint32_t);
case BufferElementType::Uint2:
return sizeof(uint32_t) * 2;
case BufferElementType::Uint3:
return sizeof(uint32_t) * 3;
case BufferElementType::Uint4:
return sizeof(uint32_t) * 4;
case BufferElementType::Float:
return sizeof(float);
case BufferElementType::Vec2:
return sizeof(float) * 2;
case BufferElementType::Vec3:
return sizeof(float) * 3;
case BufferElementType::Vec4:
return sizeof(float) * 4;
case BufferElementType::Double:
return sizeof(double);
case BufferElementType::Double2:
return sizeof(double);
case BufferElementType::Double3:
return sizeof(double);
case BufferElementType::Double4:
return sizeof(double);
case BufferElementType::Mat2:
return sizeof(float) * 2 * 2;
case BufferElementType::Mat3:
return sizeof(float) * 3 * 3;
case BufferElementType::Mat4:
return sizeof(float) * 4 * 4;
case BufferElementType::DoubleMat2:
return sizeof(double) * 2 * 2;
case BufferElementType::DoubleMat3:
return sizeof(double) * 3 * 3;
case BufferElementType::DoubleMat4:
return sizeof(double) * 4 * 4;
};
VERIFY(false, "BufferElement unknown BufferElementType size!");
@ -71,33 +98,60 @@ namespace Inferno {
uint32_t BufferElement::getTypeCount(const BufferElementType type)
{
switch (type) {
case BufferElementType::None: return 0;
case BufferElementType::Bool: return 1;
case BufferElementType::Bool2: return 2;
case BufferElementType::Bool3: return 3;
case BufferElementType::Bool4: return 4;
case BufferElementType::Int: return 1;
case BufferElementType::Int2: return 2;
case BufferElementType::Int3: return 3;
case BufferElementType::Int4: return 4;
case BufferElementType::Uint: return 1;
case BufferElementType::Uint2: return 2;
case BufferElementType::Uint3: return 3;
case BufferElementType::Uint4: return 4;
case BufferElementType::Float: return 1;
case BufferElementType::Vec2: return 2;
case BufferElementType::Vec3: return 3;
case BufferElementType::Vec4: return 4;
case BufferElementType::Double: return 1;
case BufferElementType::Double2: return 2;
case BufferElementType::Double3: return 3;
case BufferElementType::Double4: return 4;
case BufferElementType::Mat2: return 2 * 2;
case BufferElementType::Mat3: return 3 * 3;
case BufferElementType::Mat4: return 4 * 4;
case BufferElementType::DoubleMat2: return 2 * 2;
case BufferElementType::DoubleMat3: return 3 * 3;
case BufferElementType::DoubleMat4: return 4 * 4;
case BufferElementType::None:
return 0;
case BufferElementType::Bool:
return 1;
case BufferElementType::Bool2:
return 2;
case BufferElementType::Bool3:
return 3;
case BufferElementType::Bool4:
return 4;
case BufferElementType::Int:
return 1;
case BufferElementType::Int2:
return 2;
case BufferElementType::Int3:
return 3;
case BufferElementType::Int4:
return 4;
case BufferElementType::Uint:
return 1;
case BufferElementType::Uint2:
return 2;
case BufferElementType::Uint3:
return 3;
case BufferElementType::Uint4:
return 4;
case BufferElementType::Float:
return 1;
case BufferElementType::Vec2:
return 2;
case BufferElementType::Vec3:
return 3;
case BufferElementType::Vec4:
return 4;
case BufferElementType::Double:
return 1;
case BufferElementType::Double2:
return 2;
case BufferElementType::Double3:
return 3;
case BufferElementType::Double4:
return 4;
case BufferElementType::Mat2:
return 2 * 2;
case BufferElementType::Mat3:
return 3 * 3;
case BufferElementType::Mat4:
return 4 * 4;
case BufferElementType::DoubleMat2:
return 2 * 2;
case BufferElementType::DoubleMat3:
return 3 * 3;
case BufferElementType::DoubleMat4:
return 4 * 4;
};
VERIFY(false, "BufferElement unknown BufferElementType count!");
@ -107,33 +161,60 @@ namespace Inferno {
uint32_t BufferElement::getTypeGL(const BufferElementType type)
{
switch (type) {
case BufferElementType::None: return GL_NONE;
case BufferElementType::Bool: return GL_BOOL;
case BufferElementType::Bool2: return GL_BOOL;
case BufferElementType::Bool3: return GL_BOOL;
case BufferElementType::Bool4: return GL_BOOL;
case BufferElementType::Int: return GL_INT;
case BufferElementType::Int2: return GL_INT;
case BufferElementType::Int3: return GL_INT;
case BufferElementType::Int4: return GL_INT;
case BufferElementType::Uint: return GL_UNSIGNED_INT;
case BufferElementType::Uint2: return GL_UNSIGNED_INT;
case BufferElementType::Uint3: return GL_UNSIGNED_INT;
case BufferElementType::Uint4: return GL_UNSIGNED_INT;
case BufferElementType::Float: return GL_FLOAT;
case BufferElementType::Vec2: return GL_FLOAT;
case BufferElementType::Vec3: return GL_FLOAT;
case BufferElementType::Vec4: return GL_FLOAT;
case BufferElementType::Double: return GL_DOUBLE;
case BufferElementType::Double2: return GL_DOUBLE;
case BufferElementType::Double3: return GL_DOUBLE;
case BufferElementType::Double4: return GL_DOUBLE;
case BufferElementType::Mat2: return GL_FLOAT;
case BufferElementType::Mat3: return GL_FLOAT;
case BufferElementType::Mat4: return GL_FLOAT;
case BufferElementType::DoubleMat2: return GL_DOUBLE;
case BufferElementType::DoubleMat3: return GL_DOUBLE;
case BufferElementType::DoubleMat4: return GL_DOUBLE;
case BufferElementType::None:
return GL_NONE;
case BufferElementType::Bool:
return GL_BOOL;
case BufferElementType::Bool2:
return GL_BOOL;
case BufferElementType::Bool3:
return GL_BOOL;
case BufferElementType::Bool4:
return GL_BOOL;
case BufferElementType::Int:
return GL_INT;
case BufferElementType::Int2:
return GL_INT;
case BufferElementType::Int3:
return GL_INT;
case BufferElementType::Int4:
return GL_INT;
case BufferElementType::Uint:
return GL_UNSIGNED_INT;
case BufferElementType::Uint2:
return GL_UNSIGNED_INT;
case BufferElementType::Uint3:
return GL_UNSIGNED_INT;
case BufferElementType::Uint4:
return GL_UNSIGNED_INT;
case BufferElementType::Float:
return GL_FLOAT;
case BufferElementType::Vec2:
return GL_FLOAT;
case BufferElementType::Vec3:
return GL_FLOAT;
case BufferElementType::Vec4:
return GL_FLOAT;
case BufferElementType::Double:
return GL_DOUBLE;
case BufferElementType::Double2:
return GL_DOUBLE;
case BufferElementType::Double3:
return GL_DOUBLE;
case BufferElementType::Double4:
return GL_DOUBLE;
case BufferElementType::Mat2:
return GL_FLOAT;
case BufferElementType::Mat3:
return GL_FLOAT;
case BufferElementType::Mat4:
return GL_FLOAT;
case BufferElementType::DoubleMat2:
return GL_DOUBLE;
case BufferElementType::DoubleMat3:
return GL_DOUBLE;
case BufferElementType::DoubleMat4:
return GL_DOUBLE;
};
VERIFY(false, "BufferElement unknown BufferElementType GL!");
@ -208,8 +289,8 @@ namespace Inferno {
// -----------------------------------------
IndexBuffer::IndexBuffer(uint32_t* indices, size_t size) :
m_count(size / sizeof(uint32_t))
IndexBuffer::IndexBuffer(uint32_t* indices, size_t size)
: m_count(size / sizeof(uint32_t))
{
glCreateBuffers(1, &m_id);
bind();

2
src/inferno/render/buffer.h

@ -8,6 +8,7 @@
namespace Inferno {
// clang-format off
// https://www.khronos.org/opengl/wiki/Data_Type_(GLSL)
enum class BufferElementType {
None = 0,
@ -19,6 +20,7 @@ namespace Inferno {
Mat2, Mat3, Mat4, // mat
DoubleMat2, DoubleMat3, DoubleMat4, // dmat
};
// clang-format on
// -----------------------------------------

6
src/inferno/render/context.cpp

@ -1,5 +1,5 @@
#include "glad/glad.h"
#include "GLFW/glfw3.h"
#include "glad/glad.h"
#include "ruc/meta/assert.h"
#include "inferno/core.h"
@ -9,8 +9,8 @@
namespace Inferno {
Context::Context(GLFWwindow* window) :
m_window(window)
Context::Context(GLFWwindow* window)
: m_window(window)
{
VERIFY(window, "Context window is nullptr!");
}

3
src/inferno/render/font.cpp

@ -28,8 +28,7 @@ namespace Inferno {
std::istringstream iss(font);
for (std::string line; std::getline(iss, line);) {
if (findAction(line).compare("info") != 0 &&
findAction(line).compare("char") != 0) {
if (findAction(line).compare("info") != 0 && findAction(line).compare("char") != 0) {
continue;
}

7
src/inferno/render/renderer.cpp

@ -244,7 +244,10 @@ namespace Inferno {
}
constexpr glm::vec2 textureCoordinates[] = {
{ 0.0f, 0.0f }, { 1.0f, 0.0f }, { 1.0f, 1.0f }, { 0.0f, 1.0f }
{ 0.0f, 0.0f },
{ 1.0f, 0.0f },
{ 1.0f, 1.0f },
{ 0.0f, 1.0f }
};
uint32_t textureUnitIndex = addTextureUnit(texture);
@ -439,4 +442,4 @@ namespace Inferno {
startBatch();
}
}
} // namespace Inferno

10
src/inferno/render/shader.cpp

@ -13,8 +13,8 @@
namespace Inferno {
Shader::Shader(const std::string& name)
: m_name(std::move(name)),
m_id(0)
: m_name(std::move(name))
, m_id(0)
{
// Get file contents
std::string vertexSrc = File::read(name + ".vert");
@ -29,8 +29,10 @@ namespace Inferno {
m_id = linkShader(vertexID, fragmentID);
}
// Clear resources
else if (vertexID > 0) glDeleteShader(vertexID);
else if (fragmentID > 0) glDeleteShader(fragmentID);
else if (vertexID > 0)
glDeleteShader(vertexID);
else if (fragmentID > 0)
glDeleteShader(fragmentID);
}
Shader::~Shader()

8
src/inferno/script/cameracontroller.cpp

@ -73,8 +73,10 @@ namespace Inferno {
m_camera->pitch += yOffset;
// Prevent gimbal lock
if (m_camera->pitch > 89.0f) m_camera->pitch = 89.0f;
if (m_camera->pitch < -89.0f) m_camera->pitch = -89.0f;
if (m_camera->pitch > 89.0f)
m_camera->pitch = 89.0f;
if (m_camera->pitch < -89.0f)
m_camera->pitch = -89.0f;
// Update camera rotation, by calculating direction vector via yaw and pitch
@ -119,4 +121,4 @@ namespace Inferno {
transform->translate.y -= cameraSpeed;
}
}
}
} // namespace Inferno

19
src/inferno/script/registration.cpp

@ -1,7 +1,7 @@
#include "glm/ext/matrix_transform.hpp" // glm::radians
#include "glm/ext/vector_float2.hpp" // glm::vec2
#include "glm/ext/vector_float3.hpp" // glm::vec3
#include "glm/ext/vector_float4.hpp" // glm::vec4
#include "glm/ext/matrix_transform.hpp" // glm::radians
#include "inferno/component/cameracomponent.h"
#include "inferno/component/spritecomponent.h"
@ -34,8 +34,7 @@ namespace Inferno {
"__sub", subtraction<glm::vec2, float>(),
"__mul", multiplication<glm::vec2, float>(),
"__div", division<glm::vec2, float>(),
"__tostring", string<glm::vec2>
);
"__tostring", string<glm::vec2>);
auto vec3 = glm.new_usertype<glm::vec3>(
"vec3",
@ -47,8 +46,7 @@ namespace Inferno {
"__sub", subtraction<glm::vec3, float>(),
"__mul", multiplication<glm::vec3, float>(),
"__div", division<glm::vec3, float>(),
"__tostring", string<glm::vec3>
);
"__tostring", string<glm::vec3>);
auto vec4 = glm.new_usertype<glm::vec4>(
"vec4",
@ -60,21 +58,18 @@ namespace Inferno {
"__sub", subtraction<glm::vec4, float>(),
"__mul", multiplication<glm::vec4, float>(),
"__div", division<glm::vec4, float>(),
"__tostring", string<glm::vec4>
);
"__tostring", string<glm::vec4>);
glm.set_function("radians", sol::overload(
[](float v) { return glm::radians(v); },
[](const glm::vec2& v) { return glm::radians(v); },
[](const glm::vec3& v) { return glm::radians(v); },
[](const glm::vec4& v) { return glm::radians(v); }
));
[](const glm::vec4& v) { return glm::radians(v); }));
glm.set_function("normalize", sol::overload(
[](const glm::vec2& v) { return glm::normalize(v); },
[](const glm::vec3& v) { return glm::normalize(v); },
[](const glm::vec4& v) { return glm::normalize(v); }
));
[](const glm::vec4& v) { return glm::normalize(v); }));
glm.set_function("cross", [](const glm::vec3& x, const glm::vec3& y) { return glm::cross(x, y); });
}
@ -119,4 +114,4 @@ namespace Inferno {
input["getXOffset"] = &Input::getXOffset;
input["getYOffset"] = &Input::getYOffset;
}
}
} // namespace Inferno

12
src/inferno/script/registration.h

@ -22,8 +22,7 @@ namespace Inferno {
return sol::overload(
[](const T& lhs, const T& rhs) { return lhs + rhs; },
[](const T& lhs, const V& rhs) { return lhs + rhs; },
[](const V& lhs, const T& rhs) { return lhs + rhs; }
);
[](const V& lhs, const T& rhs) { return lhs + rhs; });
}
template<typename T, typename V>
@ -32,8 +31,7 @@ namespace Inferno {
return sol::overload(
[](const T& lhs, const T& rhs) { return lhs - rhs; },
[](const T& lhs, const V& rhs) { return lhs - rhs; },
[](const V& lhs, const T& rhs) { return lhs - rhs; }
);
[](const V& lhs, const T& rhs) { return lhs - rhs; });
}
template<typename T, typename V>
@ -42,8 +40,7 @@ namespace Inferno {
return sol::overload(
[](const T& lhs, const T& rhs) { return lhs * rhs; },
[](const T& lhs, const V& rhs) { return lhs * rhs; },
[](const V& lhs, const T& rhs) { return lhs * rhs; }
);
[](const V& lhs, const T& rhs) { return lhs * rhs; });
}
template<typename T, typename V>
@ -52,8 +49,7 @@ namespace Inferno {
return sol::overload(
[](const T& lhs, const T& rhs) { return lhs / rhs; },
[](const T& lhs, const V& rhs) { return lhs / rhs; },
[](const V& lhs, const T& rhs) { return lhs / rhs; }
);
[](const V& lhs, const T& rhs) { return lhs / rhs; });
}
template<typename T>

3
src/inferno/system/camerasystem.cpp

@ -58,8 +58,7 @@ namespace Inferno {
// World space -> View space: view matrix
transform.transform = {
glm::translate(glm::mat4(1.0f), transform.translate) *
glm::rotate(glm::mat4(1.0f), glm::radians(transform.rotate.z), camera.rotateAxis)
glm::translate(glm::mat4(1.0f), transform.translate) * glm::rotate(glm::mat4(1.0f), glm::radians(transform.rotate.z), camera.rotateAxis)
};
transform.transform = { glm::inverse(transform.transform) };

2
src/inferno/time.cpp

@ -9,4 +9,4 @@ namespace Inferno {
return static_cast<float>(glfwGetTime());
}
}
} // namespace Inferno

5
src/inferno/window.cpp

@ -254,8 +254,9 @@ namespace Inferno {
glfwSetWindowShouldClose(m_window, close ? GL_TRUE : GL_FALSE);
}
bool Window::shouldClose() const {
bool Window::shouldClose() const
{
return glfwWindowShouldClose(m_window);
}
}
} // namespace Inferno

Loading…
Cancel
Save