Skip to content

Commit

Permalink
Merge pull request #117 from uPiscium/develop
Browse files Browse the repository at this point in the history
  • Loading branch information
uPiscium authored Jul 28, 2024
2 parents 3039dfb + b87cf37 commit 28b55a9
Show file tree
Hide file tree
Showing 35 changed files with 166 additions and 166 deletions.
2 changes: 1 addition & 1 deletion impls/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ endfunction()
function(Build)
add_library(
${PROJECT_NAME} STATIC
TerreateCore.cpp
TerreateGraphics.cpp
animation.cpp
buffer.cpp
event.cpp
Expand Down
12 changes: 6 additions & 6 deletions impls/TerreateCore.cpp → impls/TerreateGraphics.cpp
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
#include "../includes/TerreateCore.hpp"
#include "../includes/TerreateGraphics.hpp"

namespace TerreateCore::Defines {
namespace TerreateGraphics::Defines {
bool GLFW_INITIALIZED = false;
bool GLAD_INITIALIZED = false;
} // namespace TerreateCore::Defines
} // namespace TerreateGraphics::Defines

namespace TerreateCore::Core {
using namespace TerreateCore::Defines;
namespace TerreateGraphics::Core {
using namespace TerreateGraphics::Defines;

Bool Clock::IsElapsed(Float const &time) {
Float const now = glfwGetTime();
Expand Down Expand Up @@ -56,4 +56,4 @@ void Terminate() {

glfwTerminate();
}
} // namespace TerreateCore::Core
} // namespace TerreateGraphics::Core
6 changes: 3 additions & 3 deletions impls/animation.cpp
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#include "../includes/animation.hpp"

namespace TerreateCore::Animation {
using namespace TerreateCore::Defines;
namespace TerreateGraphics::Animation {
using namespace TerreateGraphics::Defines;
using namespace TerreateMath::Utils;

void Animation::AddKeyFrame(Transform const &keyFrame, Float const &time) {
Expand Down Expand Up @@ -60,4 +60,4 @@ mat4 Animation::TransformToMatrix(Transform const &transform) {
result = Translate(transform.position) * result;
return result;
}
} // namespace TerreateCore::Animation
} // namespace TerreateGraphics::Animation
6 changes: 3 additions & 3 deletions impls/buffer.cpp
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#include "../includes/buffer.hpp"

namespace TerreateCore::Core {
using namespace TerreateCore::Defines;
namespace TerreateGraphics::Core {
using namespace TerreateGraphics::Defines;

Attribute::Attribute(Ulong const &index, Ulong const &comps,
Ulong const &stride, Ulong const &offset)
Expand Down Expand Up @@ -166,4 +166,4 @@ void Buffer::DrawInstances(size_t const &numInstances,
numInstances);
glBindVertexArray(0);
}
} // namespace TerreateCore::Core
} // namespace TerreateGraphics::Core
6 changes: 3 additions & 3 deletions impls/event.cpp
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#include "../includes/event.hpp"

namespace TerreateCore::Event {
using namespace TerreateCore::Defines;
namespace TerreateGraphics::Event {
using namespace TerreateGraphics::Defines;

EventSystem::EventSystem() {
Logger::Trace(LOCATION(EventSystem));
Expand Down Expand Up @@ -62,4 +62,4 @@ void EventSystem::PublishEvent(Str const &event) {
LockGuard<Mutex> lock(mQueueMutex);
mEventQueue.push(event);
}
} // namespace TerreateCore::Event
} // namespace TerreateGraphics::Event
6 changes: 3 additions & 3 deletions impls/font.cpp
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#include "../includes/font.hpp"

namespace TerreateCore::Core {
using namespace TerreateCore::Defines;
namespace TerreateGraphics::Core {
using namespace TerreateGraphics::Defines;

void Font::LoadDummyCharacter() {
Logger::Trace(LOCATION(Font));
Expand Down Expand Up @@ -144,4 +144,4 @@ void Font::LoadText(WStr const &text) {
this->LoadCharacter(character);
}
}
} // namespace TerreateCore::Core
} // namespace TerreateGraphics::Core
6 changes: 3 additions & 3 deletions impls/job.cpp
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#include "../includes/job.hpp"

namespace TerreateCore::Job {
using namespace TerreateCore::Defines;
namespace TerreateGraphics::Job {
using namespace TerreateGraphics::Defines;

void JobBase::Run() {
try {
Expand Down Expand Up @@ -185,4 +185,4 @@ void JobSystem::WaitForAll() {
UniqueLock<Mutex> lock(mJobLock);
mComplete.wait(false);
}
} // namespace TerreateCore::Job
} // namespace TerreateGraphics::Job
6 changes: 3 additions & 3 deletions impls/logger.cpp
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#include "../includes/logger.hpp"

namespace TerreateCore::Logger {
using namespace TerreateCore::Defines;
namespace TerreateGraphics::Logger {
using namespace TerreateGraphics::Defines;

void Critical(Str const &msg) {
#if TC_LOG_CRITICAL
Expand Down Expand Up @@ -50,4 +50,4 @@ void Trace(Str const &msg) {
LoggerManager::Log(CONSTRUCT_LOG(TRACE_PREFIX, msg));
#endif
}
} // namespace TerreateCore::Logger
} // namespace TerreateGraphics::Logger
8 changes: 4 additions & 4 deletions impls/model.cpp
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
#include "../includes/model.hpp"
#include <memory>

namespace TerreateCore::Model {
using namespace TerreateCore::Defines;
using namespace TerreateCore::Core;
namespace TerreateGraphics::Model {
using namespace TerreateGraphics::Defines;
using namespace TerreateGraphics::Core;

void MaterialData::SetColorProperty(ColorProperty const &property,
vec4 const &value) {
Expand Down Expand Up @@ -212,4 +212,4 @@ Model &Model::operator=(Model const &other) {
mMeshes = other.mMeshes;
return *this;
}
} // namespace TerreateCore::Model
} // namespace TerreateGraphics::Model
8 changes: 4 additions & 4 deletions impls/object.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@

#include <iomanip>

namespace TerreateCore::Core {
using namespace TerreateCore::Defines;
namespace TerreateGraphics::Core {
using namespace TerreateGraphics::Defines;
std::mt19937 UUID::sRandomEngine = std::mt19937(std::random_device()());

void UUID::GenerateUUID() {
Expand All @@ -29,10 +29,10 @@ Str UUID::ToString() const {
}
return ss.str();
}
} // namespace TerreateCore::Core
} // namespace TerreateGraphics::Core

std::ostream &operator<<(std::ostream &stream,
TerreateCore::Core::UUID const &uuid) {
TerreateGraphics::Core::UUID const &uuid) {
stream << uuid.ToString();
return stream;
}
6 changes: 3 additions & 3 deletions impls/screen.cpp
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
#include "../includes/screen.hpp"
#include <memory>

namespace TerreateCore::Core {
using namespace TerreateCore::Defines;
namespace TerreateGraphics::Core {
using namespace TerreateGraphics::Defines;

void Screen::AddBuffer() {
Logger::Trace(LOCATION(Screen));
Expand Down Expand Up @@ -129,4 +129,4 @@ void Screen::Clear() const {
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT | GL_STENCIL_BUFFER_BIT);
this->Unbind();
}
} // namespace TerreateCore::Core
} // namespace TerreateGraphics::Core
6 changes: 3 additions & 3 deletions impls/shader.cpp
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#include "../includes/shader.hpp"

namespace TerreateCore::Core {
using namespace TerreateCore::Defines;
namespace TerreateGraphics::Core {
using namespace TerreateGraphics::Defines;

Str GetShaderLog(Uint const &id) {
Int status;
Expand Down Expand Up @@ -397,4 +397,4 @@ void Shader::Unuse() const {

glUseProgram(0);
}
} // namespace TerreateCore::Core
} // namespace TerreateGraphics::Core
6 changes: 3 additions & 3 deletions impls/skeleton.cpp
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#include "../includes/skeleton.hpp"

namespace TerreateCore::Animation {
using namespace TerreateCore::Defines;
namespace TerreateGraphics::Animation {
using namespace TerreateGraphics::Defines;
using namespace TerreateMath::Utils;

void Joint::Initialize(mat4 const &parentOffset) {
Expand Down Expand Up @@ -39,4 +39,4 @@ void Skeleton::ApplyTransforms(Vec<mat4> const &transforms) {
mRoot->Transform(Eye<Float>(4), transforms, mJointTransformMatrices);
}
}
} // namespace TerreateCore::Animation
} // namespace TerreateGraphics::Animation
6 changes: 3 additions & 3 deletions impls/text.cpp
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#include "../includes/text.hpp"

namespace TerreateCore::Core {
using namespace TerreateCore::Defines;
namespace TerreateGraphics::Core {
using namespace TerreateGraphics::Defines;
using namespace TerreateMath::Utils;

void Text::LoadText() {
Expand Down Expand Up @@ -115,4 +115,4 @@ void Text::Render(Float const &x, Float const &y, Float const &windowWidth,
mShader.Unuse();
}
}
} // namespace TerreateCore::Core
} // namespace TerreateGraphics::Core
6 changes: 3 additions & 3 deletions impls/texture.cpp
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#include "../includes/texture.hpp"

namespace TerreateCore::Core {
using namespace TerreateCore::Defines;
namespace TerreateGraphics::Core {
using namespace TerreateGraphics::Defines;

Texture::Texture() {
Logger::Trace(LOCATION(Texture));
Expand Down Expand Up @@ -224,4 +224,4 @@ void CubeTexture::LoadDatas(Vec<TextureData> const &datas) {
this->LoadData((CubeFace)((GLenum)CubeFace::RIGHT + i), datas[i]);
}
}
} // namespace TerreateCore::Core
} // namespace TerreateGraphics::Core
6 changes: 3 additions & 3 deletions impls/window.cpp
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
#include "../includes/window.hpp"
#include "GLFW/glfw3.h"

namespace TerreateCore::Core {
using namespace TerreateCore::Defines;
namespace TerreateGraphics::Core {
using namespace TerreateGraphics::Defines;

Icon::Icon() {
Logger::Trace(LOCATION(Icon));
Expand Down Expand Up @@ -548,4 +548,4 @@ void Window::Frame() {

mController->OnFrame(this);
}
} // namespace TerreateCore::Core
} // namespace TerreateGraphics::Core
12 changes: 6 additions & 6 deletions includes/TerreateCore.hpp → includes/TerreateGraphics.hpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#ifndef __TC_TERREATECORE_HPP__
#define __TC_TERREATECORE_HPP__
#ifndef __TERREATE_CORE_TERREATECORE_HPP__
#define __TERREATE_CORE_TERREATECORE_HPP__

#include "animation.hpp"
#include "buffer.hpp"
Expand All @@ -17,8 +17,8 @@
#include "texture.hpp"
#include "window.hpp"

namespace TerreateCore::Core {
using namespace TerreateCore::Defines;
namespace TerreateGraphics::Core {
using namespace TerreateGraphics::Defines;
class Clock : public Object {
private:
Float mLastTime = 0.0f;
Expand All @@ -38,5 +38,5 @@ class Clock : public Object {

void Initialize(Bool const &enableConsoleLog = false);
void Terminate();
} // namespace TerreateCore::Core
#endif // __TC_TERREATECORE_HPP__
} // namespace TerreateGraphics::Core
#endif // __TERREATE_CORE_TERREATECORE_HPP__
12 changes: 6 additions & 6 deletions includes/animation.hpp
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
#ifndef __TC_ANIMATION_HPP__
#define __TC_ANIMATION_HPP__
#ifndef __TERREATE_CORE_ANIMATION_HPP__
#define __TERREATE_CORE_ANIMATION_HPP__

#include "defines.hpp"
#include "object.hpp"

namespace TerreateCore::Animation {
using namespace TerreateCore::Defines;
namespace TerreateGraphics::Animation {
using namespace TerreateGraphics::Defines;

struct Transform {
vec3 scale;
Expand Down Expand Up @@ -71,6 +71,6 @@ class Animation : public Core::Object {
*/
static mat4 TransformToMatrix(Transform const &transform);
};
} // namespace TerreateCore::Animation
} // namespace TerreateGraphics::Animation

#endif // __TC_ANIMATION_HPP__
#endif // __TERREATE_CORE_ANIMATION_HPP__
18 changes: 9 additions & 9 deletions includes/bitflag.hpp
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
#ifndef __TC_BITFLAG_HPP__
#define __TC_BITFLAG_HPP__
#ifndef __TERREATE_CORE_BITFLAG_HPP__
#define __TERREATE_CORE_BITFLAG_HPP__

#include "defines.hpp"

namespace TerreateCore::Core {
using namespace TerreateCore::Defines;
namespace TerreateGraphics::Core {
using namespace TerreateGraphics::Defines;

template <enumtype T> class BitFlag {
public:
Expand Down Expand Up @@ -75,11 +75,11 @@ template <enumtype T> BitFlag<T> operator^(T const &lhs, BitFlag<T> const &rhs);
template <enumtype T> BitFlag<T> operator|(T const &lhs, T const &rhs);
template <enumtype T> BitFlag<T> operator&(T const &lhs, T const &rhs);
template <enumtype T> BitFlag<T> operator^(T const &lhs, T const &rhs);
} // namespace TerreateCore::Core
} // namespace TerreateGraphics::Core

// Implementation
namespace TerreateCore::Core {
using namespace TerreateCore::Defines;
namespace TerreateGraphics::Core {
using namespace TerreateGraphics::Defines;

template <enumtype T> BitFlag<T> &BitFlag<T>::operator=(T const &flag) {
mFlag = static_cast<Flag>(flag);
Expand Down Expand Up @@ -206,6 +206,6 @@ template <enumtype T> BitFlag<T> operator^(T const &lhs, T const &rhs) {
result ^= rhs;
return result;
}
} // namespace TerreateCore::Core
} // namespace TerreateGraphics::Core

#endif // __TC_BITFLAG_HPP__
#endif // __TERREATE_CORE_BITFLAG_HPP__
12 changes: 6 additions & 6 deletions includes/buffer.hpp
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
#ifndef __TC_BUFFER_HPP__
#define __TC_BUFFER_HPP__
#ifndef __TERREATE_CORE_BUFFER_HPP__
#define __TERREATE_CORE_BUFFER_HPP__

#include "defines.hpp"
#include "logger.hpp"
#include "object.hpp"

namespace TerreateCore::Core {
using namespace TerreateCore::Defines;
namespace TerreateGraphics::Core {
using namespace TerreateGraphics::Defines;

class Attribute {
private:
Expand Down Expand Up @@ -144,6 +144,6 @@ class Buffer final : public Object {

operator Bool() const override { return mVAO != 0 && mVBO != 0 && mIBO != 0; }
};
} // namespace TerreateCore::Core
} // namespace TerreateGraphics::Core

#endif // __TC_BUFFER_HPP__
#endif // __TERREATE_CORE_BUFFER_HPP__
Loading

0 comments on commit 28b55a9

Please sign in to comment.