Compare commits

..

8 Commits

Author SHA1 Message Date
NaifBanana
36945a8a9d Huge graphics overhaul 2026-07-18 16:38:24 -05:00
NaifBanana
73fa5efc47 Forgot to actually compile the shader :P 2026-07-18 16:38:24 -05:00
NaifBanana
e838d789e8 Change invalid buffer binding to warning instead of error 2026-07-18 16:38:24 -05:00
NaifBanana
616611a290 Added vertex buffers/data handling and shader/program handling 2026-07-18 16:38:24 -05:00
NaifBanana
6ac965ec0e Mild updates to Window and other pieces to match the rest 2026-07-18 16:38:24 -05:00
NaifBanana
596fbb64ee Make VertexAttributePointer store index instead of buffer pointer 2026-07-18 16:38:23 -05:00
NaifBanana
31f5b47df9 Made buildable now 2026-07-18 16:38:23 -05:00
NaifBanana
8187f01add Large OpenGL Object handling overhaul 2026-07-18 16:38:23 -05:00
52 changed files with 137 additions and 272 deletions

View File

@ -7,9 +7,6 @@ set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON) set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_EXTENSIONS OFF) set(CMAKE_CXX_EXTENSIONS OFF)
include(GNUInstallDirs)
include(CMakePackageConfigHelpers)
function(toAbsolutePath SETVAR PATHS) function(toAbsolutePath SETVAR PATHS)
set(PATHS ${PATHS} ${ARGN}) set(PATHS ${PATHS} ${ARGN})
set(RET_VAL "") set(RET_VAL "")
@ -34,7 +31,6 @@ elseif(CMAKE_BUILD_TYPE STREQUAL "Debug")
set(NB_LOGGING ON) set(NB_LOGGING ON)
set(NB_BUILD_TESTS ON) set(NB_BUILD_TESTS ON)
set(NB_BUILD_DOCS ON) set(NB_BUILD_DOCS ON)
set(NBENGINE_INSTALL ON)
add_compile_definitions(_NB_BUILD_DEBUG) add_compile_definitions(_NB_BUILD_DEBUG)
endif() endif()
@ -59,6 +55,7 @@ if(NB_BUILD_TESTS)
FetchContent_MakeAvailable(gtest) FetchContent_MakeAvailable(gtest)
endif() endif()
set(GTEST_COLOR ON) set(GTEST_COLOR ON)
set(GLFW_BUILD_TESTS ON CACHE BOOL "" FORCE)
endif() endif()
if (NB_LOGGING) if (NB_LOGGING)
@ -73,7 +70,13 @@ elseif (NB_TARGET_LINUX)
add_compile_definitions(_NB_TARGET_LINUX) add_compile_definitions(_NB_TARGET_LINUX)
endif() endif()
get_filename_component(NBENGINE_ROOT ./ ABSOLUTE) # External Dep paths
set(GLFW_PATH ../glfw/)
set(GLAD_PATH ../glad/)
set(STBIMAGE_PATH ../stbi_image)
get_filename_component(GLFW_PATH ${GLFW_PATH} ABSOLUTE)
get_filename_component(GLAD_PATH ${GLAD_PATH} ABSOLUTE)
get_filename_component(STBIMAGE_PATH ${STBIMAGE_PATH} ABSOLUTE)
add_subdirectory(./engine) add_subdirectory(./engine)
@ -83,23 +86,3 @@ set(NB_REBUILD_DOCS)
if (NB_BUILD_DOCS) if (NB_BUILD_DOCS)
add_subdirectory(./docs) add_subdirectory(./docs)
endif() endif()
if (NBENGINE_INSTALL)
include(GNUInstallDirs)
include(CMakePackageConfigHelpers)
configure_package_config_file(
"NBEngineConfig.cmake.in"
"NBEngineConfig.cmake"
INSTALL_DESTINATION ${CMAKE_INSTALL_PREFIX}/cmake
PATH_VARS CMAKE_INSTALL_LIBDIR
)
write_basic_package_version_file(
"${CMAKE_CURRENT_BINARY_DIR}/NBEngineConfigVersion.cmake"
COMPATIBILITY AnyNewerVersion
)
install(FILES
"${CMAKE_CURRENT_BINARY_DIR}/NBEngineConfig.cmake"
"${CMAKE_CURRENT_BINARY_DIR}/NBEngineConfigVersion.cmake"
DESTINATION "${CMAKE_INSTALL_PREFIX}/cmake"
)
endif()

View File

@ -1,8 +0,0 @@
@PACKAGE_INIT@
set(NBENGINE_PACKAGES
NBCore
NBGraphics
)
foreach(NBENGINE_LIB ${NBENGINE_PACKAGES})
include("${CMAKE_CURRENT_LIST_DIR}/${NBENGINE_LIB}Config.cmake")
endforeach()

Binary file not shown.

Before

Width:  |  Height:  |  Size: 58 KiB

View File

@ -1,8 +1,6 @@
include_directories(./.)
add_subdirectory(./NBCore) add_subdirectory(./NBCore)
get_target_property(NBCORE_INTERFACE_INCLUDES NBCore INTERFACE_INCLUDE_DIRECTORIES)
include_directories(${NBCORE_INTERFACE_INCLUDES})
add_subdirectory(./NBEvents) add_subdirectory(./NBEvents)
add_subdirectory(./NBGraphics) add_subdirectory(./NBGraphics)
@ -12,6 +10,7 @@ if (NB_CORE_SOURCE OR NB_EVENTS_SOURCE OR NB_GRAPHICS_SOURCE)
set(NB_SOURCE_FILES ${NB_SOURCE_FILES} PARENT_SCOPE) set(NB_SOURCE_FILES ${NB_SOURCE_FILES} PARENT_SCOPE)
endif() endif()
if (NB_CORE_INCLUDE OR NB_EVENTS_INCLUDE OR NB_GRAPHICS_INCLUDE) if (NB_CORE_INCLUDE OR NB_EVENTS_INCLUDE OR NB_GRAPHICS_INCLUDE)
set(NB_INCLUDE_FILES "") set(NB_INCLUDE_FILES "")
list(APPEND NB_INCLUDE_FILES ${NB_CORE_INCLUDE} ${NB_GRAPHICS_INCLUDE} ${NB_EVENTS_INCLUDE}) list(APPEND NB_INCLUDE_FILES ${NB_CORE_INCLUDE} ${NB_GRAPHICS_INCLUDE} ${NB_EVENTS_INCLUDE})

View File

@ -1,6 +1,3 @@
cmake_minimum_required(VERSION 3.10)
project(NBCore VERSION 0.1)
toAbsolutePath(NB_CORE_SOURCE toAbsolutePath(NB_CORE_SOURCE
./src/ErrorsImpl.cpp ./src/ErrorsImpl.cpp
./src/Logger.cpp ./src/Logger.cpp
@ -8,64 +5,27 @@ toAbsolutePath(NB_CORE_SOURCE
./src/StringUtils.cpp ./src/StringUtils.cpp
./src/Utils.cpp ./src/Utils.cpp
) )
toAbsolutePath(NB_CORE_INCLUDE toAbsolutePath(NB_CORE_INCLUDE
./include/NBCore/ANSITerm.hpp ./ANSITerm.hpp
./include/NBCore/DataSink.hpp ./DataSink.hpp
./include/NBCore/Errors.hpp ./Errors.hpp
./include/NBCore/ErrorsImpl.hpp ./ErrorsImpl.hpp
./include/NBCore/Logger.hpp ./Logger.hpp
./include/NBCore/Processes.hpp ./Processes.hpp
./include/NBCore/StringUtils.hpp ./StringUtils.hpp
./include/NBCore/ThreadsafeQueue.hpp ./ThreadsafeQueue.hpp
./include/NBCore/Types.hpp ./Types.hpp
./include/NBCore/TypeTraits.hpp ./TypeTraits.hpp
./include/NBCore/Utils.hpp ./Utils.hpp
) )
set(NB_CORE_SOURCE ${NB_CORE_SOURCE} PARENT_SCOPE) set(NB_CORE_SOURCE ${NB_CORE_SOURCE} PARENT_SCOPE)
set(NB_CORE_INCLUDE ${NB_CORE_INCLUDE} PARENT_SCOPE) set(NB_CORE_INCLUDE ${NB_CORE_INCLUDE} PARENT_SCOPE)
add_library(NBCore ${NB_CORE_SOURCE}) add_library(NBCore ${NB_CORE_SOURCE})
add_library(NBEngine::Core ALIAS NBCore)
target_include_directories(NBCore
PUBLIC "$<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}/include>"
PUBLIC "$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>"
)
if (NBENGINE_INSTALL) target_include_directories(NBCore PUBLIC ./.)
message("Installing NBCore to ${CMAKE_INSTALL_PREFIX}")
include(GNUInstallDirs)
include(CMakePackageConfigHelpers)
install(
TARGETS NBCore
EXPORT NBCoreTargets
)
install(
DIRECTORY "${PROJECT_SOURCE_DIR}/include/NBCore"
DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}"
FILES_MATCHING PATTERN "*.h" PATTERN "*.hpp"
)
install(
EXPORT NBCoreTargets
DESTINATION ${CMAKE_INSTALL_PREFIX}/cmake
NAMESPACE NBEngine::
)
configure_package_config_file(
"NBCoreConfig.cmake.in"
"NBCoreConfig.cmake"
INSTALL_DESTINATION ${CMAKE_INSTALL_PREFIX}/cmake
PATH_VARS CMAKE_INSTALL_LIBDIR
)
write_basic_package_version_file(
"${CMAKE_CURRENT_BINARY_DIR}/NBCoreConfigVersion.cmake"
COMPATIBILITY AnyNewerVersion
)
install(FILES
"${CMAKE_CURRENT_BINARY_DIR}/NBCoreConfig.cmake"
"${CMAKE_CURRENT_BINARY_DIR}/NBCoreConfigVersion.cmake"
DESTINATION "${CMAKE_INSTALL_PREFIX}/cmake"
)
endif()
if (NB_BUILD_TESTS) if (NB_BUILD_TESTS)
add_subdirectory(./tests) add_subdirectory(./tests)

View File

@ -5,7 +5,7 @@
#include <atomic> #include <atomic>
#include <thread> #include <thread>
#include <NBCore/ThreadSafeQueue.hpp> #include "ThreadSafeQueue.hpp"
namespace nb { namespace nb {

View File

@ -2,8 +2,8 @@
#ifndef _NB_ERROR #ifndef _NB_ERROR
#define _NB_ERROR #define _NB_ERROR
#include <NBCore/ErrorsImpl.hpp> #include "ErrorsImpl.hpp"
#include <NBCore/Logger.hpp> #include "Logger.hpp"
namespace nb { namespace nb {

View File

@ -8,7 +8,7 @@
#include <type_traits> #include <type_traits>
#include <unordered_map> #include <unordered_map>
#include <NBCore/StringUtils.hpp> #include "StringUtils.hpp"
namespace nb { namespace nb {
@ -25,15 +25,14 @@ class ErrorBase {
ErrorBase(const ErrorBase&) = default; ErrorBase(const ErrorBase&) = default;
ErrorBase(const std::exception&) noexcept; ErrorBase(const std::exception&) noexcept;
ErrorBase(const std::string&) noexcept;
virtual std::string what() const noexcept { virtual std::string what() const noexcept {
std::string ret = msg; std::string ret = msg;
if (trace) { if (trace) {
std::string trace_msg = msg; std::string trace_msg = msg;
ret += NEWLINE + indent_strblock( ret += nb::NEWLINE + indent_strblock(
trace_msg, trace_msg,
TABOVER, nb::TABOVER,
TABOVER+"Trace: " nb::TABOVER+"Trace: "
); );
} }
return ret; return ret;
@ -53,7 +52,7 @@ class ErrorBase {
{} {}
}; };
template <class ErrorType=NoneType> template <class ErrorType>
class Error : public ErrorBase { class Error : public ErrorBase {
private: private:
void inline check_asserts() { void inline check_asserts() {
@ -133,43 +132,39 @@ class Error : public ErrorBase {
using ErrorBase::type; using ErrorBase::type;
}; };
template<> class NBError : public Error<NBError> {
class Error<NoneType> : public Error<Error<NoneType>> {
protected: protected:
using Base = Error<Error<NoneType>>; using Base = Error<NBError>;
public: public:
using Base::what;
using Base::code;
using Base::trace;
enum Codes : unsigned int { enum Codes : unsigned int {
STANDARD, UNDEFINED, INDEX_ERROR STANDARD, UNDEFINED, INDEX_ERROR
}; };
inline static const std::string type = "nb::Error";
inline static const ErrorCodeMap ErrorMessages = {
{STANDARD, "std::exception"},
{UNDEFINED, "Error"},
{INDEX_ERROR, "Indexing error"}
};
Error(unsigned int code_=1) noexcept : Base(code_) {} NBError(unsigned int code_=1) noexcept : Base(code_) {}
Error(const std::exception& err) : Base( NBError(const std::exception& err) : Base(
STANDARD, STANDARD,
std::string(err.what()), std::string(err.what()),
"std::exception", "std::exception",
nullptr nullptr
) {} ) {}
Error(const std::string& msg_) noexcept : Base( // fix
NBError(std::string msg_) noexcept : Base(
Codes::UNDEFINED, Codes::UNDEFINED,
msg_, msg_
type,
nullptr
) {} ) {}
inline static const std::string type = "nb::Error";
inline static const ErrorCodeMap ErrorMessages = {
{STANDARD, "std::exception"},
{UNDEFINED, "Error"},
{INDEX_ERROR, "Indexing error"}
};
}; };
template<typename... Args> // template<typename... Args>
Error(Args...) -> Error<NoneType>; // Error(Args...) -> Error<NoneType>;
} // namespace nb } // namespace nb

View File

@ -8,11 +8,11 @@
#include <unordered_map> #include <unordered_map>
#include <vector> #include <vector>
#include <NBCore/DataSink.hpp> #include "DataSink.hpp"
#include <NBCore/ErrorsImpl.hpp> #include "ErrorsImpl.hpp"
#include <NBCore/Processes.hpp> #include "Processes.hpp"
#include <NBCore/ThreadSafeQueue.hpp> #include "ThreadSafeQueue.hpp"
#include <NBCore/TypeTraits.hpp> #include "TypeTraits.hpp"
namespace nb { namespace nb {
@ -99,14 +99,6 @@ public:
static_cast<LoggerType*>(this)->write_message(val, 0xFF, file, line); static_cast<LoggerType*>(this)->write_message(val, 0xFF, file, line);
static_cast<LoggerType*>(this)->flush(); static_cast<LoggerType*>(this)->flush();
} }
void error(
const std::string& val,
std::string file="",
unsigned int line=0
) {
static_cast<LoggerType*>(this)->write_message(Error(val), 0xFF, file, line);
static_cast<LoggerType*>(this)->flush();
}
protected: protected:
std::vector<std::ostream*> _ostream; std::vector<std::ostream*> _ostream;

View File

@ -1,2 +0,0 @@
@PACKAGE_INIT@
include("${CMAKE_CURRENT_LIST_DIR}/NBCoreTargets.cmake")

View File

@ -6,17 +6,17 @@
#include <string> #include <string>
#include <string_view> #include <string_view>
#include <NBCore/TypeTraits.hpp> #include "TypeTraits.hpp"
namespace nb { namespace nb {
#ifdef _NB_TARGET_WINDOWS #ifdef _NB_TARGET_WINDOWS
inline static const std::string NEWLINE = "\n"; const std::string NEWLINE = "\n";
inline static const std::wstring WNEWLINE = L"\n"; const std::wstring WNEWLINE = L"\n";
#endif // _NB_TARGET_WINDOWS #endif // _NB_TARGET_WINDOWS
#ifdef _NB_TARGET_LINUX #ifdef _NB_TARGET_LINUX
inline const std::string NEWLINE = "\n"; const std::string NEWLINE = "\n";
inline const std::wstring WNEWLINE = L"\n"; const std::wstring WNEWLINE = L"\n";
#endif // _NB_TARGET_LINUX #endif // _NB_TARGET_LINUX
const std::string TABOVER = " "; const std::string TABOVER = " ";
@ -34,7 +34,7 @@ void stream(const Stream& s, Args&&... args) {
} }
template<typename... Args> template<typename... Args>
void term(Args&&... args) { stream(std::cout, args..., NEWLINE); } void term(Args&&... args) { stream(std::cout, args..., nb::NEWLINE); }
template<typename... Args> template<typename... Args>
void wterm(Args&&... args) { stream(std::wcout, args..., nb::WNEWLINE); } void wterm(Args&&... args) { stream(std::wcout, args..., nb::WNEWLINE); }

View File

@ -5,7 +5,7 @@
#include <mutex> #include <mutex>
#include <vector> #include <vector>
#include <NBCore/Errors.hpp> #include "Errors.hpp"
namespace nb { namespace nb {

View File

@ -1,10 +1,10 @@
#include <NBCore/ErrorsImpl.hpp> #include "ErrorsImpl.hpp"
namespace nb { namespace nb {
//ErrorBase:: //ErrorBase::
ErrorBase::ErrorBase(const std::exception& exception_) noexcept ErrorBase::ErrorBase(const std::exception& exception_) noexcept
: ErrorBase(Error(exception_)) {} : ErrorBase(NBError(exception_)) {}
} // namespace nb } // namespace nb

View File

@ -1,7 +1,7 @@
#include <iostream> #include <iostream>
#include <NBCore/Logger.hpp> #include "Logger.hpp"
#include <NBCore/StringUtils.hpp> #include "StringUtils.hpp"
namespace nb { namespace nb {

View File

@ -6,7 +6,7 @@
#include <unistd.h> #include <unistd.h>
#endif // _NB_TARGET_LINUX #endif // _NB_TARGET_LINUX
#include <NBCore/Processes.hpp> #include "Processes.hpp"
namespace nb { namespace nb {

View File

@ -1,4 +1,4 @@
#include <NBCore/StringUtils.hpp> #include "StringUtils.hpp"
/* std::string nb::wstr_to_str(std::wstring in) { /* std::string nb::wstr_to_str(std::wstring in) {
std::size_t wstrlen = in.length(); std::size_t wstrlen = in.length();

View File

@ -1,4 +1,4 @@
#include <NBCore/Utils.hpp> #include "Utils.hpp"
namespace nb { namespace nb {

View File

@ -1,9 +1,9 @@
#define CODE_ERROR_LOCATIONS #define CODE_ERROR_LOCATIONS
#include <gtest/gtest.h> #include <gtest/gtest.h>
#include <string>
#include <NBCore/Errors.hpp> #include "Errors.hpp"
#include <string>
using namespace nb; using namespace nb;

View File

@ -1,7 +1,7 @@
#include <exception> #include <exception>
#include <NBCore/Errors.hpp> #include "Errors.hpp"
#include <NBCore/Logger.hpp> #include "Logger.hpp"
class TestError : public nb::Error<TestError> { class TestError : public nb::Error<TestError> {
using Base = Error<TestError>; using Base = Error<TestError>;

View File

@ -1,7 +1,7 @@
#define CODE_ERROR_LOCATIONS #define CODE_ERROR_LOCATIONS
#include <gtest/gtest.h> #include <gtest/gtest.h>
#include <NBCore/Processes.hpp> #include "Processes.hpp"
#include <Windows.h> #include <Windows.h>
TEST(ProcessesTest, GetPID) { TEST(ProcessesTest, GetPID) {

View File

@ -3,8 +3,8 @@
#include <gtest/gtest.h> #include <gtest/gtest.h>
#include <string> #include <string>
#include <NBCore/TypeTraits.hpp> #include "TypeTraits.hpp"
#include <NBCore/StringUtils.hpp> #include "StringUtils.hpp"
namespace nb { namespace nb {

View File

@ -1,4 +1,4 @@
#include <NBCore/Events.hpp> #include "Events.hpp"
namespace NB { namespace NB {

View File

@ -2,7 +2,7 @@
#ifndef _NB_BUFFER #ifndef _NB_BUFFER
#define _NB_BUFFER #define _NB_BUFFER
#include <NBGraphics/GLLoad.hpp> #include "GLLoad.hpp"
#include <string> #include <string>
@ -10,7 +10,7 @@
#include <NBCore/Logger.hpp> #include <NBCore/Logger.hpp>
#include <NBCore/Utils.hpp> #include <NBCore/Utils.hpp>
#include <NBGraphics/OGLObjects.hpp> #include "OGLObjects.hpp"
namespace nb { namespace nb {

View File

@ -1,24 +1,14 @@
cmake_minimum_required(VERSION 3.10) find_package(OpenGL)
project(NBGraphics VERSION 0.1) add_subdirectory(${GLFW_PATH} ${GLFW_PATH}/build)
set(GLAD_PATH ${NBENGINE_ROOT}/../glad/) include_directories(
set(STBIMAGE_PATH ${NBENGINE_ROOT}/../stbi_image) ${GLFW_PATH}/include
get_filename_component(GLAD_PATH ${GLAD_PATH} ABSOLUTE) ${GLAD_PATH}/include
get_filename_component(STBIMAGE_PATH ${STBIMAGE_PATH} ABSOLUTE) ${STBIMAGE_PATH}
set(CMAKE_PREFIX_PATH
"${CMAKE_PREFIX_PATH}"
"C:/Program Files (x86)/GLFW/lib/cmake/glfw3/"
) )
find_package(OpenGL REQUIRED)
find_package(glfw3 REQUIRED)
set(GLFW_BUILD_DOCS OFF CACHE BOOL "" FORCE) set(GLFW_BUILD_DOCS OFF CACHE BOOL "" FORCE)
if (NB_BUILD_TESTS)
set(GLFW_BUILD_TESTS ON CACHE BOOL "" FORCE)
else()
set(GLFW_BUILD_TESTS OFF CACHE BOOL "" FORCE) set(GLFW_BUILD_TESTS OFF CACHE BOOL "" FORCE)
endif()
set(GLFW_BUILD_EXAMPLES OFF CACHE BOOL "" FORCE) set(GLFW_BUILD_EXAMPLES OFF CACHE BOOL "" FORCE)
toAbsolutePath(NB_GRAPHICS_SOURCE toAbsolutePath(NB_GRAPHICS_SOURCE
@ -31,18 +21,19 @@ toAbsolutePath(NB_GRAPHICS_SOURCE
./src/VertexArray.cpp ./src/VertexArray.cpp
./src/Window.cpp ./src/Window.cpp
) )
toAbsolutePath(NB_GRAPHICS_INCLUDE toAbsolutePath(NB_GRAPHICS_INCLUDE
./include/NBGraphics/Buffers.hpp ./Buffers.hpp
./include/NBGraphics/Camera.hpp ./Camera.hpp
./include/NBGraphics/Draw.hpp ./Draw.hpp
./include/NBGraphics/FrameBuffers.hpp ./FrameBuffers.hpp
./include/NBGraphics/GLLoad.hpp ./GLLoad.hpp
./include/NBGraphics/Image.hpp ./Image.hpp
./include/NBGraphics/OGLObjects.hpp ./OGLObjects.hpp
./include/NBGraphics/ProgramPipeline.hpp ./ProgramPipeline.hpp
./include/NBGraphics/Textures.hpp ./Textures.hpp
./include/NBGraphics/VertexArray.hpp ./VertexArray.hpp
./include/NBGraphics/Window.hpp ./Window.hpp
) )
set(NB_GRAPHICS_SOURCE ${NB_GRAPHICS_SOURCE} PARENT_SCOPE) set(NB_GRAPHICS_SOURCE ${NB_GRAPHICS_SOURCE} PARENT_SCOPE)
@ -52,54 +43,9 @@ add_library(NBGraphics
${NB_GRAPHICS_SOURCE} ${NB_GRAPHICS_SOURCE}
${GLAD_PATH}/src/glad.c ${GLAD_PATH}/src/glad.c
) )
add_library(NBEngine::Graphics ALIAS NBGraphics) target_link_libraries(NBGraphics glfw)
target_link_libraries(NBGraphics
PUBLIC glfw
PUBLIC NBCore
)
get_target_property(GLFW_INTERFACE_INCLUDES glfw INTERFACE_INCLUDE_DIRECTORIES)
#include_directories(${GLFW_INTERFACE_INCLUDES})
target_include_directories(NBGraphics
PUBLIC "$<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}/include>"
PUBLIC "$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>"
PUBLIC "${STBIMAGE_PATH}"
PUBLIC "${GLAD_PATH}/include"
)
if (NBENGINE_INSTALL) target_include_directories(NBGraphics PUBLIC ./.)
message("Installing NBGraphics to ${CMAKE_INSTALL_PREFIX}")
include(GNUInstallDirs)
include(CMakePackageConfigHelpers)
install(
TARGETS NBGraphics
EXPORT NBGraphicsTargets
)
install(
DIRECTORY "${PROJECT_SOURCE_DIR}/include/NBGraphics"
DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}"
FILES_MATCHING PATTERN "*.h" PATTERN "*.hpp"
)
install(
EXPORT NBGraphicsTargets
DESTINATION ${CMAKE_INSTALL_PREFIX}/cmake
NAMESPACE NBEngine::
)
configure_package_config_file(
"NBGraphicsConfig.cmake.in"
"NBGraphicsConfig.cmake"
INSTALL_DESTINATION ${CMAKE_INSTALL_PREFIX}/cmake
PATH_VARS CMAKE_INSTALL_LIBDIR
)
write_basic_package_version_file(
"${CMAKE_CURRENT_BINARY_DIR}/NBGraphicsConfigVersion.cmake"
COMPATIBILITY AnyNewerVersion
)
install(FILES
"${CMAKE_CURRENT_BINARY_DIR}/NBGraphicsConfig.cmake"
"${CMAKE_CURRENT_BINARY_DIR}/NBGraphicsConfigVersion.cmake"
DESTINATION "${CMAKE_INSTALL_PREFIX}/cmake"
)
endif()
if (NB_BUILD_TESTS) if (NB_BUILD_TESTS)
add_subdirectory(./tests) add_subdirectory(./tests)

View File

@ -2,7 +2,7 @@
#ifndef _NB_CAMERA #ifndef _NB_CAMERA
#define _NB_CAMERA #define _NB_CAMERA
#include <NBGraphics/GLLoad.hpp> #include "GLLoad.hpp"
#include <glm/glm.hpp> #include <glm/glm.hpp>
#include <glm/gtc/matrix_inverse.hpp> #include <glm/gtc/matrix_inverse.hpp>

View File

@ -2,16 +2,16 @@
#ifndef _NB_DRAW #ifndef _NB_DRAW
#define _NB_DRAW #define _NB_DRAW
#include <NBGraphics/GLLoad.hpp> #include <GLLoad.h>
#include <exception> #include <exception>
#include <map> #include <map>
#include <string> #include <string>
#include <vector> #include <vector>
#include <NBGraphics/Buffers.h> #include "Buffers.h"
#include <NBGraphics/Shader.h> #include "Shader.h"
#include <NBGraphics/VAOManager.hpp> #include "VAOManager.hpp"
#define THROW_DRAW_ERROR(msg) throw DrawError(msg, __FILE__, __LINE__); #define THROW_DRAW_ERROR(msg) throw DrawError(msg, __FILE__, __LINE__);

View File

@ -2,13 +2,13 @@
#ifndef _NB_FRAMEBUFFER #ifndef _NB_FRAMEBUFFER
#define _NB_FRAMEBUFFER #define _NB_FRAMEBUFFER
#include <NBGraphics/GLLoad.hpp> #include "GLLoad.hpp"
#include <NBCore/Errors.hpp> #include <NBCore/Errors.hpp>
#include <NBGraphics/Image.hpp> #include "Image.hpp"
#include <NBGraphics/OGLObjects.hpp> #include "OGLObjects.hpp"
#include <NBGraphics/Textures.hpp> #include "Textures.hpp"
namespace nb { namespace nb {

View File

@ -1,2 +0,0 @@
@PACKAGE_INIT@
include("${CMAKE_CURRENT_LIST_DIR}/NBGraphicsTargets.cmake")

View File

@ -2,7 +2,7 @@
#ifndef _NB_OGL_OBJECTS #ifndef _NB_OGL_OBJECTS
#define _NB_OGL_OBJECTS #define _NB_OGL_OBJECTS
#include <NBGraphics/GLLoad.hpp> #include "GLLoad.hpp"
#include <NBCore/Errors.hpp> #include <NBCore/Errors.hpp>

View File

@ -2,14 +2,14 @@
#ifndef _NB_SHADER #ifndef _NB_SHADER
#define _NB_SHADER #define _NB_SHADER
#include <NBGraphics/GLLoad.hpp> #include "GLLoad.hpp"
#include <string> #include <string>
#include <NBCore/Errors.hpp> #include <NBCore/Errors.hpp>
#include <NBCore/Utils.hpp> #include <NBCore/Utils.hpp>
#include <NBGraphics/OGLObjects.hpp> #include "OGLObjects.hpp"
namespace nb { namespace nb {

View File

@ -2,9 +2,9 @@
#ifndef _NB_TEXTURES #ifndef _NB_TEXTURES
#define _NB_TEXTURES #define _NB_TEXTURES
#include <NBGraphics/Buffers.hpp> #include "Buffers.hpp"
#include <NBGraphics/Image.hpp> #include "Image.hpp"
#include <NBGraphics/OGLObjects.hpp> #include "OGLObjects.hpp"
namespace nb { namespace nb {

View File

@ -2,12 +2,12 @@
#ifndef _NB_VERTEX_ARRAY #ifndef _NB_VERTEX_ARRAY
#define _NB_VERTEX_ARRAY #define _NB_VERTEX_ARRAY
#include <NBGraphics/GLLoad.hpp> #include "GLLoad.hpp"
#include <NBCore/Errors.hpp> #include <NBCore/Errors.hpp>
#include <NBGraphics/Buffers.hpp> #include "Buffers.hpp"
#include <NBGraphics/OGLObjects.hpp> #include "OGLObjects.hpp"
namespace nb { namespace nb {

View File

@ -2,10 +2,11 @@
#ifndef _NB_WINDOW #ifndef _NB_WINDOW
#define _NB_WINDOW #define _NB_WINDOW
#include <NBGraphics/GLLoad.hpp> #include "GLLoad.hpp"
#include <array> #include <array>
#include <map> #include <map>
#include <stdexcept>
#include <string> #include <string>
#include <NBCore/Errors.hpp> #include <NBCore/Errors.hpp>

View File

@ -1,4 +1,4 @@
#include <NBGraphics/Buffers.hpp> #include "Buffers.hpp"
namespace nb { namespace nb {

View File

@ -1,4 +1,4 @@
#include <NBGraphics/Camera.hpp> #include "Camera.hpp"
namespace nb { namespace nb {

View File

@ -1,4 +1,4 @@
#include <NBGraphics/Draw.hpp> #include "Draw.h"
namespace NB{ namespace NB{

View File

@ -1,4 +1,4 @@
#include <NBGraphics/FrameBuffers.hpp> #include "FrameBuffers.hpp"
namespace nb { namespace nb {

View File

@ -1,4 +1,4 @@
#include <NBGraphics/Image.hpp> #include "Image.hpp"
using ImageErrorCodes = nb::ImageError::Codes; using ImageErrorCodes = nb::ImageError::Codes;
const std::string nb::ImageError::type = "nb::ImageError"; const std::string nb::ImageError::type = "nb::ImageError";

View File

@ -1,4 +1,4 @@
#include <NBGraphics/OGLObjects.hpp> #include "OGLObjects.hpp"
namespace nb { namespace nb {

View File

@ -1,4 +1,4 @@
#include <NBGraphics/ProgramPipeline.hpp> #include "ProgramPipeline.hpp"
namespace nb{ namespace nb{

View File

@ -1,4 +1,4 @@
#include <NBGraphics/Textures.hpp> #include "Textures.hpp"
namespace nb { namespace nb {

View File

@ -1,4 +1,4 @@
#include <NBGraphics/VertexArray.hpp> #include "VertexArray.hpp"
namespace nb { namespace nb {
@ -177,7 +177,7 @@ VertexDataVec VertexGroup::dropBuffers() {
VertexData VertexGroup::dropBuffer(size_t idx) { VertexData VertexGroup::dropBuffer(size_t idx) {
if (idx >= _vertex_data.size()) { if (idx >= _vertex_data.size()) {
THROW(Error(Error<>::INDEX_ERROR)); THROW(NBError(NBError::INDEX_ERROR));
} }
VertexDataVec tmp; VertexDataVec tmp;
VertexData ret; VertexData ret;

View File

@ -1,4 +1,4 @@
#include <NBGraphics/Window.hpp> #include "Window.hpp"
namespace nb { namespace nb {

View File

@ -8,6 +8,7 @@ if (NB_BUILD_TESTS)
./TestWindow.cpp ./TestWindow.cpp
) )
target_link_libraries(TestWindow target_link_libraries(TestWindow
NBCore
NBGraphics NBGraphics
) )

View File

@ -1,12 +1,12 @@
#include <NBGraphics/GLLoad.hpp> #include "GLLoad.hpp"
#define STB_IMAGE_IMPLEMENTATION #define STB_IMAGE_IMPLEMENTATION
#include "stb_image.h" #include "stb_image.h"
#include <NBGraphics/Image.hpp> #include "Image.hpp"
#include <NBGraphics/ProgramPipeline.hpp> #include "ProgramPipeline.hpp"
#include <NBGraphics/VertexArray.hpp> #include "VertexArray.hpp"
#include <NBGraphics/Window.hpp> #include "Window.hpp"
#include <NBGraphics/Textures.hpp> #include "Textures.hpp"
int main() { int main() {
nb::logger.log("Howdy!"); nb::logger.log("Howdy!");

View File

@ -5,7 +5,7 @@
#define STB_IMAGE_IMPLEMENTATION #define STB_IMAGE_IMPLEMENTATION
#include "stb_image.h" #include "stb_image.h"
#include <NBGraphics/Image.hpp> #include "Image.hpp"
TEST(TestImage, SinglePixel) { TEST(TestImage, SinglePixel) {
using RGB = nb::Pixel<uint8_t, nb::Red, nb::Green, nb::Blue>; using RGB = nb::Pixel<uint8_t, nb::Red, nb::Green, nb::Blue>;