Compare commits

..

No commits in common. "fae7f601c9bf3bcd4530b9a130e95c1e8029b93a" and "b7e1b1ff62c6b3b34267809da5efc40c82f6432b" have entirely different histories.

38 changed files with 168 additions and 594 deletions

View File

@ -4,15 +4,9 @@ project(fennec)
set(CMAKE_CXX_STANDARD 26)
set(CMAKE_C_STANDARD 26)
# find dependencies
find_package(Doxygen)
# any necessary include directories
include_directories(include)
# Metaprogramming is a dependency for generating various type info before compilation of the engine.
add_subdirectory(metaprogramming)
add_library(fennec STATIC
# CORE =================================================================================================================
@ -44,7 +38,7 @@ add_library(fennec STATIC
# MEMORY ===============================================================================================================
include/fennec/memory/allocator.h
include/fennec/lang/bits.h
include/fennec/memory/bits.h
include/fennec/memory/memory.h
include/fennec/memory/new.h source/memory/new.cpp
include/fennec/memory/pointers.h
@ -80,12 +74,10 @@ add_library(fennec STATIC
include/fennec/lang/lang.h
)
add_subdirectory(metaprogramming)
# add metaprogramming templates as a dependency and also force documentation to be generated when fennec is compiled
if(DOXYGEN_FOUND)
add_dependencies(fennec fennecdocs metaprogramming)
else()
add_dependencies(fennec metaprogramming)
endif()
add_dependencies(fennec fennecdocs metaprogramming)
# Compiler Warning Flags
if(MSVC)
@ -111,6 +103,8 @@ add_subdirectory(test)
file(COPY logo DESTINATION docs/logo)
find_package(Doxygen)
if(DOXYGEN_FOUND)
set(DOXY_OUTPUT_DIR "${PROJECT_SOURCE_DIR}/docs")
get_filename_component(DOXYGEN_PROJECT_NAME ${PROJECT_SOURCE_DIR} NAME) # Set Doxy Project name to the name of the root dir

View File

@ -1,203 +0,0 @@
# Planning Documentation for fennec
## Table of Contents
1. [Introduction](#introduction)
2. [C++ Language](#c-language)
3. [Math Library](#math-library)
## Introduction
This file serves as a general planning document for engine structure, systems, pipelines, and implementation.
Implementations of core engine systems should strive to be `O(1)` in implementations,
both in terms of runtime and memory performance. This is obviously not a realistic goal,
so rather than the entire engine striving to be `O(1)` we should more specifically look
at achieving `O(1)` performance on hot paths.
Functions should be highly verbose, and in debug mode any bugprone or erroneous behaviour should throw
assertions. **DO NOT USE EXCEPTIONS**.
System implementations should be independent of architecture or platforms. i.e. the code of the graphics system should
not care if OpenGL or Vulkan is used and should not use any direct calls to OpenGL or Vulkan.
## C++ Language Library (`lang`)
Implement header files for standard functions relating to the C++ Language.
So far this is implemented on an as-needed basis.
## Math Library (`math`)
Implement math functions according to the [OpenGL 4.6 Shading Language Specification](https://registry.khronos.org/OpenGL/specs/gl/GLSLangSpec.4.60.pdf).
Additional extensions should be implemented to provide standard definitions for functions predominantly related
to Linear Algebra, Mathematical Analysis, and Discrete Analysis. Additional extensions will be implemented on a
as-needed basis.
## Memory Library (`memory`)
Implement headers related to memory allocation in C++.
* Smart Pointers
- Memory Allocation
## Language Processing (`proclang`)
Pronounced [ˈɒkh,læŋ](https://itinerarium.github.io/phoneme-synthesis/?w=pɹˈɒkh,læŋ)
No, this won't include Machine Learning, it will mostly include tools for processing human-readable files.
fennec should be able to use Doxygen and LaTeX externally. Consider including binaries with releases.
* String Analysis (`proclang/strings`)
* Search
* Manipulation
* Delimiting
* Regex
- File Formats (`proclang/formats`)
- Serialization
- JSON
- HTML
- XML
- YAML
- Configuration
- INI
- TOML
- Documents
- ODF
- Markdown
- PDF
- Spreadsheets & Tables
- ODS
- CSV
**MAYBE**
* Compilation (`proclang/code`)
* Lexical Analysis
* Syntax Analysis
* Semantic Analysis
* Intermediate Code Generation
* Optimization
* Target Code Generation
## Core (`core`)
This will be the core of the engine.
- Event System
- Core Engine Loop
- System Manager
The priority sequence of the main systems is as follows:
**3D Systems will apply *before* their 2D Variants**
- **Update**
- Scripts
- AI
- **Physics**
- Newtonian Commit
- Apply Forces (Updates Acceleration and Torque)
- Apply Torque & Acceleration (Updates Velocities)
- Apply Velocities (Updates Position and Rotation)
- Constraint Resolution
- Collision Detection
- Collision Resolution (Adjust for Clipping)
- Soft Bodies resolve before Rigid Bodies
- Collision Response
- Calculate Forces
-
- **Graphics**
## 3D Scene (`scene3d`)
* In-Array Directed Tree
* Elegant method for providing `O(1)` insertions and `O(log(n))` deletions.
* Bounding Volume Hierarchy
* Octree
## 3D Graphics (`gfx3d`)
Links:
- https://en.wikipedia.org/wiki/Octree
- https://www.adriancourreges.com/blog/2015/11/02/gta-v-graphics-study/
- https://learnopengl.com/PBR/Lighting
- https://learnopengl.com/PBR/IBL/Diffuse-irradiance
- https://en.wikipedia.org/wiki/Schlick%27s_approximation
- https://pixelandpoly.com/ior.html
- https://developer.download.nvidia.com/SDK/10/opengl/screenshots/samples/dual_depth_peeling.html
**DirectX will never have official support.** If you would like to make a fork, have at it, but know I will hold a deep disdain for you.
This is the set of stages for the graphics pipeline that runs every frame:
- LOD Selection
- Visibility Buffer & Culling
* G-Buffer Pass
* Depth - Stencil
* 24-Bit Depth Buffer
* 8-Bit Stencil Buffer, used to represent the lighting model.
* Diffuse - RGB8
* Emission - RGB8
* Normal - RGB8
* Specular - RGB8
* R → Roughness
* G → Specularity (sometimes called metallicism)
* B → Index of Refraction (IOR)
- Lighting Buffer - RGB16
- Lighting Pass
- Generate Dynamic Shadows
- Generate Dynamic Reflections (Optional)
- SSAO (Optional)
- Apply Lighting Model
* Forward Pass
* Translucent Materials
* Materials with Forward Shading enabled.
- Post Processing
- Depth of Field (Optional)
- Bloom (Optional)
- Tonemapping (Optional)
- HDR Correction
## 3D Physics `(physics3d)`
Links:
- https://www.researchgate.net/publication/264839743_Simulating_Ocean_Water
- https://arxiv.org/pdf/2109.00104
- https://www.youtube.com/watch?v=rSKMYc1CQHE
Systems
* Rigid Body System
- Particle Physics
* Soft Body Physics
* Elastics → Finite Element Simulation
* Cloth → Position-Based Dynamics
* Water
* Oceans → iWave
* Reasoning: iWave provides interactive lightweight fluid dynamics suitable for flat planes of water.
<br><br>
* 3D Fluid Dynamics &rarr; Smoothed-Particle Hydrodynamics
* Reasoning: This is the simplest method for simulating 3D bodies of water. This should exclusively be
used for small scale simulations where self-interactive fluids are necessary. I.E. pouring water into
a glass.
<br><br>
* 2D Fluid Dynamics &rarr; Force-Based Dynamics
* Reasoning: This model, like iWave, provides lightweight interactive fluid dynamics, but is more easily
adapted to flowing surfaces such as streams and rivers.

View File

@ -11,13 +11,12 @@
## Table of Contents
1. [Introduction](#introduction)
1. [Coding Standards](#coding-standards)
2. [Building from Source](#building-from-source)
1. [Building from Terminal](#building-from-terminal)
2. [Building on Windows](#building-on-windows)
3. [Running the Test Suite](#running-the-test-suite)
4. [Usage](#usage)
5. [Contribution](#contribution)
3. [Usage](#usage)
4. [Contribution](#contribution)
<br>
<br>
@ -27,44 +26,22 @@
## Introduction
fennec is designed to be a general purpose, educational game engine.
fennec may be used through the provided editor application, or as a standalone
library to link against your application.
<br>
<a id="coding-standards"></a>
### Coding Standards
Interfacing with the API in C++ follows the [GNU Coding Standards](https://www.gnu.org/prep/standards/html_node/index.html).
Some main areas where the engine strays from the GNU standard includes the following:
fennec may be used both through the provided editor application, or as a standalone
library link against your application. Some main areas where the engine strays from
the GNU standard includes the following:
* [Section 4.7, Standards for Graphical Interfaces](https://www.gnu.org/prep/standards/html_node/Graphical-Interfaces.html).
- [Section 4.7, Standards for Graphical Interfaces](https://www.gnu.org/prep/standards/html_node/Graphical-Interfaces.html).
fennec provides an implementation for X11, however it does not use the GTK toolkit.
- [Section 6.1, GNU Manuals](https://www.gnu.org/prep/standards/html_node/GNU-Manuals.html)
fennec does not use Texinfo and instead uses Doxygen. Otherwise, it follows the other standards of this section.
* [Section 7, The Release Process](https://www.gnu.org/prep/standards/html_node/Managing-Releases.html)
- [Section 7, The Release Process](https://www.gnu.org/prep/standards/html_node/Managing-Releases.html)
fennec follows most of the conventions in this section, however the build system used is CMake and not
Makefile. CMake, although overwhelming at first, is much more friendly to those who are learning build systems for the first time.
<br>
fennec Standards:
* As per the GNU standard, macros should be `SCREAMING_SNAKE_CASE`. Additionally, Macros should be preceded by `<APP_NAME>_`.
Macros that wrap C-Style functions may use normal `snake_case`.
- Header Guards should be implemented using `#ifndef`, `#define`, and `#endif` for portability.
The naming convention for Header Guards is as follows: `<APP_NAME>_<DIRECTORY_PATH>_<FILE_NAME>_H`.
I.E. the engine file `fennec/lang/utility.h` has the Header Guard `FENNEC_LANG_UTILITY_H`.
* Helper Functions, in the case of classes, should be private.
In the case of global functions, helpers should be placed in a similarly named file in a subdirectory and namespace called `detail`.
Helper functions should be documented with C-Style comments, however it is not necessary to provide Doxygen documentation.
- **DO NOT USE C++ EXCEPTIONS** they will not be supported because they are shit. No, I won't elaborate.
<br>
The C++ stdlib is reimplemented in the fennec engine.
There are a few reasons for this:
@ -81,13 +58,9 @@ There are a few reasons for this:
<a id="building-from-source"></a>
## Building from Source
fennec uses the CMake build manager. The CMake build script provides several
fennec uses the CMake build system. The CMake build script provides several
targets for building parts of the engine.
Using an IDE will streamline the build process for you and add additional configuration
options. Eclipse, Visual Studio, and CLion provide built-in support for CMake. VSCode
is also a viable IDE but involves some extra setup.
| Target | Description |
|------------------------|----------------------------------------------------------------------------------------|
| fennec | The main engine target. |
@ -96,16 +69,11 @@ is also a viable IDE but involves some extra setup.
| fennecdocs-clean | Cleans the generated html documentation files. |
| fennec-test | Test suite for verifying engine functionality. |
<a id="dependencies"></a>
<br>
| Dependency | Notes |
|-------------------|----------------------------------------------------------------------------------------------------------|
| C/C++ Compiler | GCC/G++ is the compiler that fennec is designed around, however, Clang, MSVC, and MinGW may also be used |
| CMake | The build manager used by the engine |
| A build system | Any build system will work, however, `build.sh` uses Ninja by default. |
| A memory debugger | Any memory debugger will work, however, `test.sh` uses Valgrind by default. |
| Doxygen | Doxygen is required for building the documentation for fennec. This is an optional dependency |
| Graphviz | Graphviz is a required dependency for Doxygen |
Using an IDE will streamline the build process for you and add additional configuration
options. Eclipse, Visual Studio, and CLion provide built-in support for CMake. VSCode
is also a viable IDE but involves some extra setup.
<br>
@ -116,19 +84,22 @@ is also a viable IDE but involves some extra setup.
for more info.
By default, the CMake generator
used is Ninja, which requires Ninja to be installed.
You can modify the build scripts to use another build manager, see the [CMake documentation for available generators](https://cmake.org/cmake/help/latest/manual/cmake-generators.7.html).
used is Ninja, which requires Ninja to be installed. You can modify the
build scripts to use another build manager, see the [CMake documentation
for available generators](https://cmake.org/cmake/help/latest/manual/cmake-generators.7.html).
<br>
<a id="building-on-windows"></a>
### Building on Windows
The bash script can be run natively on Windows when WSL is enabled.
You do not need to run the script in WSL, simply use the "bash" command in Command Prompt or PowerShell.
The script will require the build [dependencies](#dependencies) installed and configured to be available on the `PATH` environment variable.
The bash script can be run natively on Windows when WSL is enabled. You do not
need to run the script in WSL, simply use the "bash" command in Command Prompt
or PowerShell. It requires CMake and a C/C++ compiler to be installed and
configured in the PATH environment variable.
Fore more details, [see this blog post](https://blogs.windows.com/windows-insider/2016/04/06/announcing-windows-10-insider-preview-build-14316/) for Windows Build 14316.
Fore more details, [see this blog post](https://blogs.windows.com/windows-insider/2016/04/06/announcing-windows-10-insider-preview-build-14316/)
for Windows Build 14316.
Otherwise, follow the sequence of commands provided in the bash script.
@ -188,4 +159,4 @@ whether the information displayed is correct.
There are some principles to keep in mind when contributing to fennec.
1. You must follow the style guide provided by the [GNU Coding Standard](https://www.gnu.org/prep/standards/html_node/Writing-C.html).
2. Any changes must allow all projects to be forward compatible with newer engine verisons.
2. Any changes must allow all projects to be forward compatible with newer engine verisons.

BIN
doxy/.Doxyfile.in.swp Normal file

Binary file not shown.

View File

@ -784,7 +784,7 @@ SHOW_USED_FILES = YES
# (if specified).
# The default value is: YES.
SHOW_FILES = NO
SHOW_FILES = YES
# Set the SHOW_NAMESPACES tag to NO to disable the generation of the Namespaces
# page. This will remove the Namespaces entry from the Quick Index and from the
@ -1306,7 +1306,7 @@ CLANG_DATABASE_PATH =
# classes, structs, unions or interfaces.
# The default value is: YES.
ALPHABETICAL_INDEX = NO
ALPHABETICAL_INDEX = YES
# The IGNORE_PREFIX tag can be used to specify a prefix (or a list of prefixes)
# that should be ignored while generating the index headers. The IGNORE_PREFIX

View File

@ -784,7 +784,7 @@ SHOW_USED_FILES = YES
# (if specified).
# The default value is: YES.
SHOW_FILES = NO
SHOW_FILES = YES
# Set the SHOW_NAMESPACES tag to NO to disable the generation of the Namespaces
# page. This will remove the Namespaces entry from the Quick Index and from the
@ -1306,7 +1306,7 @@ CLANG_DATABASE_PATH =
# classes, structs, unions or interfaces.
# The default value is: YES.
ALPHABETICAL_INDEX = NO
ALPHABETICAL_INDEX = YES
# The IGNORE_PREFIX tag can be used to specify a prefix (or a list of prefixes)
# that should be ignored while generating the index headers. The IGNORE_PREFIX

View File

@ -38,21 +38,21 @@
namespace fennec
{
template<class TypeT, class Alloc>
template<class T, class Alloc>
class dynarray
{
public:
using element_t = TypeT;
using element_t = T;
using alloc_t = Alloc;
///
/// \brief Default Constructor, initializes an empty allocation.
dynarray() : _alloc(8), _size(0) {}
dynarray() : _alloc(), _size(0) {}
///
/// \breif Alloc Constructor, initalize empty allocation with allocator instance.
/// \param alloc An allocator object to copy, for instances where the allocator needs to be initialized with some data.
dynarray(const alloc_t& alloc) : _alloc(8, alloc), _size(0) {}
dynarray(const alloc_t& alloc) : _alloc(alloc), _size(0) {}
///
/// \brief Create an allocation with a size of `n` elements. All elements are initialized with the default constructor.
@ -62,16 +62,10 @@ public:
for(; n > 0; --n, ++addr) { fennec::construct(addr); }
}
dynarray(size_t n, const alloc_t& alloc) : _alloc(n, alloc), _size(n)
{
element_t* addr = _alloc.data();
for(; n > 0; --n, ++addr) { fennec::construct(addr); }
}
///
/// \brief Create an allocation of size `n`, with each element constructed using the copy constructor
/// \brief n the number of elements
dynarray(size_t n, const TypeT& val)
dynarray(size_t n, const element_t& val)
{
element_t* addr = _alloc.data();
for(; n > 0; --n, ++addr) { fennec::construct(addr, val); }
@ -90,73 +84,7 @@ public:
for(; n > 0; --n, ++addr) { fennec::destruct(addr); }
}
size_t size() const { return _size; }
size_t capacity() const { return _alloc.capacity(); }
TypeT& operator[](size_t i) { return _alloc.data()[i]; }
const TypeT& operator[](size_t i) const { return _alloc.data()[i]; }
void insert(size_t i, const TypeT& val)
{
// Grow if the size has reached the capacity of the allocation
if(_size == capacity()) _grow();
// Move the data if we are not inserting at the end of the array
if((i = fennec::min(i, _size) < _size) {
fennec::memmove(
_alloc.data() + i
, _alloc.data() + i + 1
, (_size - i) * sizeof(TypeT));
}
// Insert the element
fennec::construct(_alloc.data() + i, val);
}
void insert(size_t i, TypeT&& val)
{
// Grow if the size has reached the capacity of the allocation
if(_size == capacity()) _grow();
// Move the data if we are not inserting at the end of the array
if((i = fennec::min(i, _size) < _size) {
fennec::memmove(
_alloc.data() + i
, _alloc.data() + i + 1
, (_size - i) * sizeof(TypeT));
}
// Insert the element
fennec::construct(_alloc.data() + i, fennec::forward(val));
}
template<typename...ArgsT>
void emplace(size_t i, ArgsT...args)
{
// Grow if the size has reached the capacity of the allocation
if(_size == capacity()) _grow();
// Move the data if we are not inserting at the end of the array
if((i = fennec::min(i, _size) < _size) {
fennec::memmove(
_alloc.data() + i
, _alloc.data() + i + 1
, (_size - i) * sizeof(TypeT));
}
// Insert the element
fennec::construct(_alloc.data() + i, fennec::forward<ArgsT>(args)...);
}
void push_back(const TypeT& val) { insert(_size, val); }
void push_back(TypeT&& val) { insert(_size, fennec::forward(val)); }
template<typename...ArgsT> void emplace_back(ArgsT...args) { emplace(_size, fennec::forward<ArgsT>(args)...); }
private:
void _grow() const { _alloc.reallocate(_alloc.capacity() * 2); }
allocation<element_t, alloc_t> _alloc;
size_t _size;
};

View File

@ -31,30 +31,23 @@
///
/// \page page_fennec_documentation Documentation
///
/// \section page_fennec_documentation_pages Pages
/// \section page_documentation_contents Main Page
/// 1. \ref introduction "Introduction"
/// 1. \ref coding-standards "Coding Standards"
/// 2. \ref building-from-source "Building from Source"
/// 1. \ref building-from-terminal "Building from Terminal"
/// 2. \ref building-on-windows "Building on Windows"
/// 3. \ref running-the-test-suite "Running the Test Suite"
/// 4. \ref usage "Usage"
/// 5. \ref contribution "Contribution"
/// 6. \subpage page_fennec_libraries
/// 1. \ref page_fennec_lang "C++ Language Library"
/// 2. \ref page_fennec_math "Math Library"
/// 2. \ref introduction "Building from Source"
/// 1. \ref building-from-source "Building from Source"
/// 2. \ref building-from-terminal "Building from Terminal"
/// 3. \ref running-the-test-suite "Running the Test Suite"
/// 3. \ref usage "Usage"
/// 4. \ref contribution "Contribution"
///
/// \section Libraries
/// \anchor libraries
/// - \subpage page_fennec_lang
/// - \subpage page_fennec_math
///
/// \copyright Copyright © 2025 Medusa Slockbower ([GPLv3](https://www.gnu.org/licenses/gpl-3.0.en.html))
///
///
/// \page page_fennec_libraries Libraries
///
/// | Library | Brief |
/// | :------------------------ | :------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
/// | \subpage page_fennec_lang | Implementation for functions and classes related to the C++ Language, including base types, common utility functions, and metaprogramming templates |
/// | \subpage page_fennec_math | Implementation of math functions according to the [OpenGL 4.6 Shading Language Specification](https://registry.khronos.org/OpenGL/specs/gl/GLSLangSpec.4.60.pdf). Additional extensions are provided for other common math functions. |
#ifndef FENNEC_CORE_ENGINE_H
#define FENNEC_CORE_ENGINE_H

View File

@ -29,8 +29,8 @@
///
#ifndef FENNEC_LANG_CONDITIONAL_TYPES_H
#define FENNEC_LANG_CONDITIONAL_TYPES_H
#ifndef CONDITIONAL_TYPES_H
#define CONDITIONAL_TYPES_H
#include <fennec/lang/type_transforms.h>
#include <fennec/lang/types.h>
@ -106,4 +106,4 @@ using detect_t
}
#endif // FENNEC_LANG_CONDITIONAL_TYPES_H
#endif //CONDITIONAL_TYPES_H

View File

@ -29,6 +29,7 @@ namespace detail
{
// Nothing interesting to note here
template<typename> struct __is_void : false_type {};
template<> struct __is_void<void> : true_type {};

View File

@ -27,10 +27,7 @@
///
///
#ifndef FENNEC_LANG_FLOAT_H
#define FENNEC_LANG_FLOAT_H
#include <bits.h>
#include <fennec/memory/bits.h>
#define FLT_HAS_INFINITY 1
#define FLT_HAS_QUIET_NAN 1
@ -83,5 +80,3 @@
#define DBL_SIGNALING_NAN fennec::bit_cast<double>(0x7ff4000000000000l)
#define DBL_DENORM_MIN fennec::bit_cast<double>(0x1l)
#define DBL_ROUND_ERR fennec::bit_cast<double>(0x3fe0000000000000l)
#endif // FENNEC_LANG_FLOAT_H

View File

@ -28,8 +28,8 @@
///
///
#ifndef FENNEC_LANG_H
#define FENNEC_LANG_H
#ifndef LANG_H
#define LANG_H
///
/// \page page_fennec_lang C++ Language Library
@ -38,4 +38,4 @@
///
///
#endif // FENNEC_LANG_H
#endif //LANG_H

View File

@ -28,8 +28,8 @@
///
///
#ifndef FENNEC_LANG_UTILITY_H
#define FENNEC_LANG_UTILITY_H
#ifndef UTILITY_H
#define UTILITY_H
#include <fennec/lang/type_transforms.h>
@ -78,4 +78,4 @@ template<typename T> constexpr const remove_reference_t<T>& copy(T&& x) noexcept
}
#endif // FENNEC_LANG_UTILITY_H
#endif //UTILITY_H

View File

@ -276,7 +276,7 @@
#include <cmath>
#include <fennec/math/vector.h>
#include <../lang/bits.h>
#include <fennec/memory/bits.h>
namespace fennec
{

View File

@ -16,8 +16,8 @@
// along with this program. If not, see <https://www.gnu.org/licenses/>.
// =====================================================================================================================
#ifndef FENNEC_MATH_DETAIL_FWD_H
#define FENNEC_MATH_DETAIL_FWD_H
#ifndef FWD_H
#define FWD_H
#include <fennec/math/detail/__types.h>
@ -36,4 +36,4 @@ template<typename ScalarT, size_t RowsV, size_t ColsV> using mat
}
#endif // FENNEC_MATH_DETAIL_FWD_H
#endif //FWD_H

View File

@ -37,8 +37,8 @@
///
///
#ifndef FENNEC_MATH_MATRIX_H
#define FENNEC_MATH_MATRIX_H
#ifndef MATRIX_H
#define MATRIX_H
#include <fennec/math/detail/__fwd.h>
@ -378,4 +378,4 @@ private:
}
#endif // FENNEC_MATH_MATRIX_H
#endif //MATRIX_H

View File

@ -30,7 +30,6 @@
#ifndef FENNEC_MATH_RELATIONAL_H
#define FENNEC_MATH_RELATIONAL_H
#include <fennec/lang/types.h>
// TODO: Document

View File

@ -67,4 +67,4 @@ using uint = unsigned int;
}
#endif // FENNEC_MATH_SCALAR_H
#endif //TYPES_H

View File

@ -28,8 +28,8 @@
///
///
#ifndef FENNEC_MATH_SWIZZLE_H
#define FENNEC_MATH_SWIZZLE_H
#ifndef SWIZZLE_H
#define SWIZZLE_H
#include <fennec/lang/sequences.h>
#include <fennec/math/swizzle_storage.h>
@ -82,4 +82,4 @@ private:
}
#endif // FENNEC_MATH_SWIZZLE_H
#endif //SWIZZLE_H

View File

@ -17,8 +17,8 @@
// =====================================================================================================================
#ifndef FENNEC_MATH_SWIZZLE_STORAGE_H
#define FENNEC_MATH_SWIZZLE_STORAGE_H
#ifndef SWIZZLE_STORAGE_H
#define SWIZZLE_STORAGE_H
namespace fennec
{
@ -54,4 +54,4 @@ struct swizzle_storage
}
#endif // FENNEC_MATH_SWIZZLE_STORAGE_H
#endif //SWIZZLE_STORAGE_H

View File

@ -17,8 +17,8 @@
// =====================================================================================================================
#ifndef FENNEC_MATH_VECTOR_BASE_H
#define FENNEC_MATH_VECTOR_BASE_H
#ifndef VECTOR_BASE_H
#define VECTOR_BASE_H
#include <fennec/math/detail/__fwd.h>
@ -95,4 +95,4 @@ using vector_base_type = typename vector_base_type_helper<ScalarT, SizeV>::Stora
}
#endif // FENNEC_MATH_VECTOR_BASE_H
#endif //VECTOR_BASE_H

View File

@ -17,8 +17,8 @@
// =====================================================================================================================
#ifndef FENNEC_MATH_VECTOR_STORAGE_H
#define FENNEC_MATH_VECTOR_STORAGE_H
#ifndef VECTOR_STORAGE_H
#define VECTOR_STORAGE_H
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wpedantic"
@ -633,4 +633,4 @@ struct vector_storage<4, SwizzleGenT, DataT>
#pragma GCC diagnostic pop
#endif // FENNEC_MATH_VECTOR_STORAGE_H
#endif //VECTOR_STORAGE_H

View File

@ -17,8 +17,8 @@
// =====================================================================================================================
#ifndef FENNEC_LANG_BITS_H
#define FENNEC_LANG_BITS_H
#ifndef FENNEC_MEMORY_BITS_H
#define FENNEC_MEMORY_BITS_H
#include <fennec/lang/intrinsics.h>
#include <fennec/memory/memory.h>
@ -48,4 +48,4 @@ constexpr ToT bit_cast(const FromT& from)
}
#endif // FENNEC_LANG_BITS_H
#endif // FENNEC_MEMORY_BITS_H

View File

@ -40,12 +40,6 @@ struct nothrow_t { explicit nothrow_t() noexcept { } };
template<typename TypeT> void construct(TypeT* ptr)
{ ptr->TypeT(); }
template<typename TypeT> void construct(TypeT* ptr, const TypeT& val)
{ ptr->TypeT(val); }
template<typename TypeT> void construct(TypeT* ptr, TypeT&& val)
{ ptr->TypeT(fennec::forward(val)); }
template<typename TypeT, typename...ArgsT> void construct(TypeT* ptr, ArgsT...args)
{ ptr->TypeT(fennec::forward(args)...); }

View File

@ -16,8 +16,8 @@
// along with this program. If not, see <https://www.gnu.org/licenses/>.
// =====================================================================================================================
#ifndef FENNEC_MEMORY_POINTERS_H
#define FENNEC_MEMORY_POINTERS_H
#ifndef FENNEC_LANG_POINTERS_H
#define FENNEC_LANG_POINTERS_H
#include <fennec/lang/type_traits.h>
@ -132,4 +132,4 @@ private:
}
#endif // FENNEC_MEMORY_POINTERS_H
#endif // FENNEC_LANG_POINTERS_H

View File

@ -55,18 +55,9 @@ int main(int, const char**)
flt << "///" << std::endl;
flt << "" << std::endl;
flt << "#ifndef FENNEC_LANG_FLOAT_H" << std::endl;
flt << "#define FENNEC_LANG_FLOAT_H" << std::endl;
flt << "" << std::endl;
flt << "#include <fennec/memory/bits.h>" << std::endl;
flt << "" << std::endl;
// TODO: Fix this to generate info without using the c++stdlib for platforms without this available.
flt << "#define FLT_HAS_INFINITY " << std::dec << std::numeric_limits<float>::has_infinity << std::endl;
flt << "#define FLT_HAS_QUIET_NAN " << std::dec << std::numeric_limits<float>::has_quiet_NaN << std::endl;
flt << "#define FLT_HAS_SIGNALING_NAN " << std::dec << std::numeric_limits<float>::has_signaling_NaN << std::endl;
@ -123,10 +114,6 @@ int main(int, const char**)
flt << "#define DBL_DENORM_MIN " << "fennec::bit_cast<double>(0x" << std::hex << std::bit_cast<long long>(std::numeric_limits<double>::denorm_min() ) << "l)" << std::endl;
flt << "#define DBL_ROUND_ERR " << "fennec::bit_cast<double>(0x" << std::hex << std::bit_cast<long long>(std::numeric_limits<double>::round_error() ) << "l)" << std::endl;
flt << "" << std::endl;
flt << "#endif // FENNEC_LANG_FLOAT_H" << std::endl;
flt.close();
return 0;

View File

@ -41,7 +41,7 @@ Debug()
cd ./build/debug
cmake -G Ninja -DCMAKE_BUILD_TYPE=Debug -S ../.. -B .
cmake --build . --target fennec-test
valgrind --leak-check=full --show-leak-kinds=all --track-origins=yes --verbose --log-file=valgrind.txt ./test/fennec-test
./test/fennec-test
cd ../..
}
@ -51,7 +51,7 @@ Release()
cd ./build/release
cmake -G Ninja -DCMAKE_BUILD_TYPE=Release -S ../.. -B .
cmake --build . --target fennec-test
valgrind --leak-check=full --show-leak-kinds=all --track-origins=yes --verbose --log-file=valgrind.txt ./test/fennec-test
./test/fennec-test
cd ../..
}
@ -61,7 +61,7 @@ RelWithDebInfo()
cd ./build/relwithdebinfo
cmake -G Ninja -DCMAKE_BUILD_TYPE=RelWithDebInfo -S ../.. -B .
cmake --build . --target fennec-test
valgrind --leak-check=full --show-leak-kinds=all --track-origins=yes --verbose --log-file=valgrind.txt ./test/fennec-test
./test/fennec-test
cd ../..
}
@ -71,7 +71,7 @@ MinSizeRel()
cd ./build/minsizerel
cmake -G Ninja -DCMAKE_BUILD_TYPE=MinSizeRel -S ../.. -B .
cmake --build . --target fennec-test
valgrind --leak-check=full --show-leak-kinds=all --track-origins=yes --verbose --log-file=valgrind.txt ./test/fennec-test
./test/fennec-test
cd ../..
}

View File

@ -12,7 +12,6 @@ add_executable(fennec-test main.cpp
tests/test_memory.h
tests/test_math.h
tests/test_lang.h
tests/lang/conditional_types.h
)
target_link_libraries(fennec-test PRIVATE

View File

@ -18,23 +18,51 @@
#include <iostream>
#include "test.h"
#include "tests/test_scalar.h"
#include "tests/test_vector.h"
#include "tests/test_geometric.h"
#include "tests/math/test_matrix.h"
#include "tests/test_lang.h"
#include "tests/test_math.h"
#include "tests/test_memory.h"
#include <fennec/memory/bits.h>
int main(int, char **)
{
fennec_test_header("fennec-test, a program to execute unit tests for fennec");
fennec_test_spacer(1);
fennec_test_section("fennec-test, a program to execute unit tests for fennec");
fennec_test_spacer(2);
fennec_test_header("math library");
fennec_test_section(scalar tests =================================================================================);
fennec_test_spacer(2);
fennec::test::fennec_test_math();
fennec::test::fennec_test_scalar();
fennec_test_spacer(3);
fennec_test_section(vector tests =================================================================================);
fennec_test_spacer(2);
fennec::test::fennec_test_vector();
fennec_test_spacer(3);
fennec_test_section(geometric tests ==============================================================================);
fennec_test_spacer(2);
fennec::test::fennec_test_geometric();
fennec_test_spacer(3);
fennec_test_section(matrix tests =================================================================================);
fennec_test_spacer(2);
fennec::test::fennec_test_matrix();
return 0;
}

View File

@ -23,7 +23,6 @@
#include <ostream>
#include <string>
#include <cassert>
#include <fennec/lang/limits.h>
#include <fennec/math/common.h>
#include <fennec/math/relational.h>
@ -91,14 +90,7 @@ inline void __fennec_test_run(const std::string& expression, ResultT result, Res
}
#define fennec_test_run(Expression, Expected) __fennec_test_run(#Expression, Expression, Expected)
#define fennec_test_header(Header) std::cout << std::string(80, '=') << std::endl \
<< (Header) << std::endl \
<< std::string(80, '=') << std::endl
#define fennec_test_subheader(Header) std::cout << (Header) << ' ' << std::string(80 - sizeof(Header), '=') << std::endl
#define fennec_test_section(Section) std::cout << (Section) << ' ' << std::string(80 - sizeof(Section), '-') << std::endl
#define fennec_test_section(Section) std::cout << #Section << std::endl
#define fennec_test_spacer(Count) std::cout << std::string(Count, std::cout.widen('\n'))
#endif // FENNEC_TEST_H

View File

@ -1,24 +0,0 @@
// =====================================================================================================================
// fennec-test, a program to execute unit tests for fennec
// Copyright © 2025 Medusa Slockbower
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <https://www.gnu.org/licenses/>.
// =====================================================================================================================
#ifndef FENNEC_TEST_LANG_CONDITIONAL_TYPES_H
#define FENNEC_TEST_LANG_CONDITIONAL_TYPES_H
#endif // FENNEC_TEST_LANG_CONDITIONAL_TYPES_H

View File

@ -1,6 +1,6 @@
// =====================================================================================================================
// fennec-test, a program to execute unit tests for fennec
// Copyright © 2025 Medusa Slockbower
// fennec, a free and open source game engine
// Copyright (C) 2025 Medusa Slockbower
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
@ -17,8 +17,8 @@
// =====================================================================================================================
#ifndef FENNEC_TEST_GEOMETRIC_H
#define FENNEC_TEST_GEOMETRIC_H
#ifndef TEST_GEOMETRIC_H
#define TEST_GEOMETRIC_H
#include <fennec/math/geometric.h>
#include <fennec/math/trigonometric.h>
@ -31,8 +31,10 @@ namespace fennec
namespace test
{
inline void fennec_test_math_geometric()
inline void fennec_test_geometric()
{
fennec_test_section(geometric functions);
fennec_test_spacer(1);
fennec_test_run(fennec::dot(vec2(1, 2), vec2(1, 2)), 5.0f);
@ -75,4 +77,4 @@ inline void fennec_test_math_geometric()
}
#endif // FENNEC_TEST_GEOMETRIC_H
#endif // TEST_GEOMETRIC_H

View File

@ -1,6 +1,6 @@
// =====================================================================================================================
// fennec-test, a program to execute unit tests for fennec
// Copyright © 2025 Medusa Slockbower
// fennec, a free and open source game engine
// Copyright (C) 2025 Medusa Slockbower
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
@ -32,7 +32,7 @@ namespace fennec
namespace test
{
inline void fennec_test_math_matrix()
inline void fennec_test_matrix()
{

View File

@ -1,6 +1,6 @@
// =====================================================================================================================
// fennec-test, a program to execute unit tests for fennec
// Copyright © 2025 Medusa Slockbower
// fennec, a free and open source game engine
// Copyright (C) 2025 Medusa Slockbower
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
@ -17,8 +17,8 @@
// =====================================================================================================================
#ifndef FENNEC_TEST_SCALAR_H
#define FENNEC_TEST_SCALAR_H
#ifndef TEST_SCALAR_H
#define TEST_SCALAR_H
#include <fennec/math/vector_traits.h>
@ -30,9 +30,9 @@ namespace fennec
namespace test
{
inline void fennec_test_math_scalar()
inline void fennec_test_scalar()
{
fennec_test_section("component_count");
fennec_test_section(component_count);
fennec_test_spacer(1);
@ -71,4 +71,4 @@ inline void fennec_test_math_scalar()
}
#endif // FENNEC_TEST_SCALAR_H
#endif //TEST_SCALAR_H

View File

@ -1,5 +1,5 @@
// =====================================================================================================================
// fennec-test, a program to execute unit tests for fennec
// fennec, a free and open source game engine
// Copyright © 2025 Medusa Slockbower
//
// This program is free software: you can redistribute it and/or modify
@ -17,8 +17,8 @@
// =====================================================================================================================
#ifndef FENNEC_TEST_VECTOR_H
#define FENNEC_TEST_VECTOR_H
#ifndef TEST_VECTOR_H
#define TEST_VECTOR_H
#include <iostream>
@ -33,9 +33,9 @@ namespace fennec
namespace test
{
inline void fennec_test_math_vector()
inline void fennec_test_vector()
{
fennec_test_section("component_count");
fennec_test_section(component_count);
fennec_test_spacer(1);
@ -146,7 +146,7 @@ inline void fennec_test_math_vector()
fennec_test_spacer(2);
fennec_test_section("vec2 constructors");
fennec_test_section(vec2 constructors);
fennec_test_spacer(1);
@ -161,7 +161,7 @@ inline void fennec_test_math_vector()
fennec_test_spacer(2);
fennec_test_section("vec2 swizzles");
fennec_test_section(vec2 swizzles);
fennec_test_spacer(1);
@ -172,7 +172,7 @@ inline void fennec_test_math_vector()
fennec_test_spacer(2);
fennec_test_section("vec3 constructors");
fennec_test_section(vec3 constructors);
fennec_test_spacer(1);
@ -187,7 +187,7 @@ inline void fennec_test_math_vector()
fennec_test_spacer(2);
fennec_test_section("vec3 swizzles");
fennec_test_section(vec3 swizzles);
fennec_test_spacer(1);
@ -233,7 +233,7 @@ inline void fennec_test_math_vector()
fennec_test_spacer(2);
fennec_test_section("scalar-vector operations");
fennec_test_section(scalar-vector operations);
fennec_test_spacer(1);
@ -249,7 +249,7 @@ inline void fennec_test_math_vector()
fennec_test_spacer(2);
fennec_test_section("vector-vector operations");
fennec_test_section(vector-vector operations);
fennec_test_spacer(1);
@ -288,4 +288,4 @@ inline void fennec_test_math_vector()
}
#endif // FENNEC_TEST_VECTOR_H
#endif //TEST_VECTOR_H

View File

@ -1,22 +1,8 @@
// =====================================================================================================================
// fennec-test, a program to execute unit tests for fennec
// Copyright © 2025 Medusa Slockbower
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
// Created by medusa on 6/8/25.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <https://www.gnu.org/licenses/>.
// =====================================================================================================================
#ifndef FENNEC_TEST_LANG_H
#define FENNEC_TEST_LANG_H
#ifndef TEST_LANG_H
#define TEST_LANG_H
#endif // FENNEC_TEST_LANG_H
#endif //TEST_LANG_H

View File

@ -1,62 +1,8 @@
// =====================================================================================================================
// fennec-test, a program to execute unit tests for fennec
// Copyright © 2025 Medusa Slockbower
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
// Created by medusa on 6/8/25.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <https://www.gnu.org/licenses/>.
// =====================================================================================================================
#ifndef FENNEC_TEST_MATH_H
#define FENNEC_TEST_MATH_H
#ifndef TEST_MATH_H
#define TEST_MATH_H
#include "math/test_scalar.h"
#include "math/test_vector.h"
#include "math/test_matrix.h"
#include "math/test_geometric.h"
namespace fennec
{
namespace test
{
inline void fennec_test_math()
{
fennec_test_subheader("scalar tests");
fennec_test_spacer(2);
fennec_test_math_scalar();
fennec_test_spacer(3);
fennec_test_subheader("vector tests");
fennec_test_spacer(2);
fennec_test_math_vector();
fennec_test_spacer(3);
fennec_test_subheader("matrix tests");
fennec_test_spacer(2);
fennec_test_math_matrix();
fennec_test_spacer(3);
fennec_test_subheader("geometric tests");
fennec_test_spacer(2);
fennec_test_math_geometric();
fennec_test_spacer(3);
}
}
}
#endif // FENNEC_TEST_MATH_H
#endif //TEST_MATH_H

View File

@ -1,22 +1,8 @@
// =====================================================================================================================
// fennec-test, a program to execute unit tests for fennec
// Copyright © 2025 Medusa Slockbower
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
// Created by medusa on 6/8/25.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <https://www.gnu.org/licenses/>.
// =====================================================================================================================
#ifndef FENNEC_TEST_MEMORY_H
#define FENNEC_TEST_MEMORY_H
#ifndef TEST_MEMORY_H
#define TEST_MEMORY_H
#endif // FENNEC_TEST_MEMORY_H
#endif //TEST_MEMORY_H