Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
34 commits
Select commit Hold shift + click to select a range
138e202
feat: Video component + system
Sauterelle57 Sep 7, 2025
c12757f
feat: add example scenes
Sauterelle57 Sep 12, 2025
148e179
feat(keyframe-video): add video keyframe hendling with shortcuts
ThomasParenteau Sep 11, 2025
23d2938
fix(demo): init cpp scene
ThomasParenteau Sep 12, 2025
8745ab0
feat(demo): physics ball spawn by pressing L
Sauterelle57 Sep 12, 2025
3c2747a
fix(demo/scenes): code style + sonar / clang tidy errors and warnings…
Sauterelle57 Sep 16, 2025
1267ff6
fix(demo/scenes): code style + sonar / clang tidy errors and warnings…
Sauterelle57 Sep 17, 2025
397f67d
fix(demo/scenes): code style + sonar + doc + clang tidy errors and wa…
Sauterelle57 Sep 17, 2025
ac0abdd
fix(demo/scenes): clean files + code style + sonar errors + documenta…
Sauterelle57 Sep 17, 2025
fdbb83d
fix(demo/scenes): clean files + code style + sonar errors + documenta…
Sauterelle57 Sep 28, 2025
87784a2
fix(demo/scenes): clean files + code style + sonar errors + documenta…
Sauterelle57 Oct 3, 2025
8711ef5
chore(model-thumbnails): add cmake user presets to gitignore
iMeaNz Oct 4, 2025
eaf93d3
chore(asset-aab): add source files
iMeaNz Oct 5, 2025
1386572
feat(asset-aab): add utils func for aabb
iMeaNz Oct 5, 2025
b3b76f6
feat(asset-aabb): add simple box primitive with only 8 vertices
iMeaNz Oct 5, 2025
6feb36d
feat(asset-aab): add draw indexed for line primitive + set line width…
iMeaNz Oct 5, 2025
abf677f
feat(asset-aab): add debug box shader
iMeaNz Oct 5, 2025
27a5a99
feat(asset-aabb): add aabb debug system
iMeaNz Oct 5, 2025
fb5d66d
feat(asset-aab): draw commands now handle line primitive commands
iMeaNz Oct 5, 2025
14d5744
tests(asset-aabb): add source files to renderer test cmake
iMeaNz Oct 5, 2025
9f5d99e
feat(asset-aabb): add aabb and bsphere to model asset + fix: fix cond…
iMeaNz Oct 5, 2025
b861c8e
feat(asset-aab): init + call aabb debug system
iMeaNz Oct 5, 2025
8a707af
style(asset-aab): remove useless comment
iMeaNz Oct 5, 2025
3fafe9f
fix(asset-aabb): fix sonar errors
iMeaNz Oct 5, 2025
d2125ce
style(asset-aabb): add '*' to comment
iMeaNz Oct 5, 2025
8a96210
fix(asset-aabb): add check to setLineWidth + add util func to convert…
iMeaNz Oct 5, 2025
52287c4
fix(asset-aabb): add check to model aabb to make sure it is valid + a…
iMeaNz Oct 5, 2025
0251b10
feat(thumbnails): add utils func to convert a local bounding sphere t…
iMeaNz Oct 5, 2025
2e14af5
chore(thumbnails): commented bounding box rendering
iMeaNz Oct 5, 2025
d2829fd
fix(thumbnails): now use the generated bouding sphere of models to ge…
iMeaNz Oct 5, 2025
2bb27a3
fix(thumbnails): add header for windows
iMeaNz Oct 5, 2025
e6bde6c
fix(thumbnails): fix sonar error
iMeaNz Oct 5, 2025
7b37863
feat(texture-import): add texture importer parameters (not finished yet)
iMeaNz Oct 27, 2025
f8f69e8
tests(texture-import): fix tests
iMeaNz Feb 7, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,7 @@ fabric.properties
.cmake
CMakeCache.txt
cmake_install.cmake
CMakeUserPresets.json

B-CPP-500_rtype.pdf

Expand Down
93 changes: 93 additions & 0 deletions common/math/Bounds.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,93 @@
//// Bounds.cpp ///////////////////////////////////////////////////
//
// ⢀⢀⢀⣤⣤⣤⡀⢀⢀⢀⢀⢀⢀⢠⣤⡄⢀⢀⢀⢀⣠⣤⣤⣤⣤⣤⣤⣤⣤⣤⡀⢀⢀⢀⢠⣤⣄⢀⢀⢀⢀⢀⢀⢀⣤⣤⢀⢀⢀⢀⢀⢀⢀⢀⣀⣄⢀⢀⢠⣄⣀⢀⢀⢀⢀⢀⢀⢀
// ⢀⢀⢀⣿⣿⣿⣷⡀⢀⢀⢀⢀⢀⢸⣿⡇⢀⢀⢀⢀⣿⣿⡟⡛⡛⡛⡛⡛⡛⡛⢁⢀⢀⢀⢀⢻⣿⣦⢀⢀⢀⢀⢠⣾⡿⢃⢀⢀⢀⢀⢀⣠⣾⣿⢿⡟⢀⢀⡙⢿⢿⣿⣦⡀⢀⢀⢀⢀
// ⢀⢀⢀⣿⣿⡛⣿⣷⡀⢀⢀⢀⢀⢸⣿⡇⢀⢀⢀⢀⣿⣿⡇⢀⢀⢀⢀⢀⢀⢀⢀⢀⢀⢀⢀⢀⡙⣿⡷⢀⢀⣰⣿⡟⢁⢀⢀⢀⢀⢀⣾⣿⡟⢁⢀⢀⢀⢀⢀⢀⢀⡙⢿⣿⡆⢀⢀⢀
// ⢀⢀⢀⣿⣿⢀⡈⢿⣷⡄⢀⢀⢀⢸⣿⡇⢀⢀⢀⢀⣿⣿⣇⣀⣀⣀⣀⣀⣀⣀⢀⢀⢀⢀⢀⢀⢀⡈⢀⢀⣼⣿⢏⢀⢀⢀⢀⢀⢀⣼⣿⡏⢀⢀⢀⢀⢀⢀⢀⢀⢀⢀⡘⣿⣿⢀⢀⢀
// ⢀⢀⢀⣿⣿⢀⢀⡈⢿⣿⡄⢀⢀⢸⣿⡇⢀⢀⢀⢀⣿⣿⣿⢿⢿⢿⢿⢿⢿⢿⢇⢀⢀⢀⢀⢀⢀⢀⢠⣾⣿⣧⡀⢀⢀⢀⢀⢀⢀⣿⣿⡇⢀⢀⢀⢀⢀⢀⢀⢀⢀⢀⢀⣿⣿⢀⢀⢀
// ⢀⢀⢀⣿⣿⢀⢀⢀⡈⢿⣿⢀⢀⢸⣿⡇⢀⢀⢀⢀⣿⣿⡇⢀⢀⢀⢀⢀⢀⢀⢀⢀⢀⢀⢀⣰⣿⡟⡛⣿⣷⡄⢀⢀⢀⢀⢀⢿⣿⣇⢀⢀⢀⢀⢀⢀⢀⢀⢀⢀⢀⣿⣿⢀⢀⢀
// ⢀⢀⢀⣿⣿⢀⢀⢀⢀⡈⢿⢀⢀⢸⣿⡇⢀⢀⢀⢀⡛⡟⢁⢀⢀⢀⢀⢀⢀⢀⢀⢀⢀⢀⣼⣿⡟⢀⢀⡈⢿⣿⣄⢀⢀⢀⢀⡘⣿⣿⣄⢀⢀⢀⢀⢀⢀⢀⢀⢀⣼⣿⢏⢀⢀⢀
// ⢀⢀⢀⣿⣿⢀⢀⢀⢀⢀⢀⢀⢀⢸⣿⡇⢀⢀⢀⢀⢀⣀⣀⣀⣀⣀⣀⣀⣀⣀⡀⢀⢀⢀⣠⣾⡿⢃⢀⢀⢀⢀⢀⢻⣿⣧⡀⢀⢀⢀⡈⢻⣿⣷⣦⣄⢀⢀⣠⣤⣶⣿⡿⢋⢀⢀⢀⢀
// ⢀⢀⢀⢿⢿⢀⢀⢀⢀⢀⢀⢀⢀⢸⢿⢃⢀⢀⢀⢀⢻⢿⢿⢿⢿⢿⢿⢿⢿⢿⢃⢀⢀⢀⢿⡟⢁⢀⢀⢀⢀⢀⢀⢀⡙⢿⡗⢀⢀⢀⢀⢀⡈⡉⡛⡛⢀⢀⢹⡛⢋⢁⢀⢀⢀⢀⢀⢀
//
// Author: Mehdy MORVAN
// Date: 05/10/2025
// Description: Source file for the bounds utils
//
///////////////////////////////////////////////////////////////////////////////

#include <algorithm>
#include <cmath>

#include "Bounds.hpp"

namespace nexo::math {
bool AABB::empty() const
{
return min.x > max.x || min.y > max.y || min.z > max.z;
}

AABB aabbUnion(const AABB& a, const AABB& b)
{
if (a.empty())
return b;
if (b.empty())
return a;

AABB o;
o.min = glm::min(a.min, b.min);
o.max = glm::max(a.max, b.max);
return o;
}

BSphere sphereFromAABB(const AABB& b)
{
BSphere s{};
if (b.empty())
return s;
s.c = 0.5f * (b.min + b.max);
const glm::vec3 e = 0.5f * (b.max - b.min);
s.r = glm::length(e);
return s;
}

AABB aabbTransform(const AABB& local, const glm::mat4& M)
{
if (local.empty())
return {};
const glm::vec3 lc = 0.5f * (local.min + local.max);
const glm::vec3 le = 0.5f * (local.max - local.min);

const glm::vec3 t = { M[3][0], M[3][1], M[3][2] };
// upper-left 3x3
const auto L = glm::mat3(M);

// world center
const glm::vec3 wc = L * lc + t;
const auto A = glm::mat3( glm::abs(L[0][0]), glm::abs(L[0][1]), glm::abs(L[0][2]),
glm::abs(L[1][0]), glm::abs(L[1][1]), glm::abs(L[1][2]),
glm::abs(L[2][0]), glm::abs(L[2][1]), glm::abs(L[2][2]) );
const glm::vec3 we = A * le;

AABB out;
out.min = wc - we;
out.max = wc + we;
return out;
}

static float maxAxisScale(const glm::mat4& M)
{
const float sx = glm::length(glm::vec3(M[0])); // column 0
const float sy = glm::length(glm::vec3(M[1])); // column 1
const float sz = glm::length(glm::vec3(M[2])); // column 2
return std::max(sx, std::max(sy, sz));
}

BSphere sphereTransform(const BSphere& s, const glm::mat4& M)
{
BSphere out;
out.c = glm::vec3(M * glm::vec4(s.c, 1.0f));
out.r = s.r * maxAxisScale(M); // conservative under non-uniform scale
return out;
}
}
104 changes: 104 additions & 0 deletions common/math/Bounds.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,104 @@
//// Bounds.hpp ///////////////////////////////////////////////////////////////
//
// ⢀⢀⢀⣤⣤⣤⡀⢀⢀⢀⢀⢀⢀⢠⣤⡄⢀⢀⢀⢀⣠⣤⣤⣤⣤⣤⣤⣤⣤⣤⡀⢀⢀⢀⢠⣤⣄⢀⢀⢀⢀⢀⢀⢀⣤⣤⢀⢀⢀⢀⢀⢀⢀⢀⣀⣄⢀⢀⢠⣄⣀⢀⢀⢀⢀⢀⢀⢀
// ⢀⢀⢀⣿⣿⣿⣷⡀⢀⢀⢀⢀⢀⢸⣿⡇⢀⢀⢀⢀⣿⣿⡟⡛⡛⡛⡛⡛⡛⡛⢁⢀⢀⢀⢀⢻⣿⣦⢀⢀⢀⢀⢠⣾⡿⢃⢀⢀⢀⢀⢀⣠⣾⣿⢿⡟⢀⢀⡙⢿⢿⣿⣦⡀⢀⢀⢀⢀
// ⢀⢀⢀⣿⣿⡛⣿⣷⡀⢀⢀⢀⢀⢸⣿⡇⢀⢀⢀⢀⣿⣿⡇⢀⢀⢀⢀⢀⢀⢀⢀⢀⢀⢀⢀⢀⡙⣿⡷⢀⢀⣰⣿⡟⢁⢀⢀⢀⢀⢀⣾⣿⡟⢁⢀⢀⢀⢀⢀⢀⢀⡙⢿⣿⡆⢀⢀⢀
// ⢀⢀⢀⣿⣿⢀⡈⢿⣷⡄⢀⢀⢀⢸⣿⡇⢀⢀⢀⢀⣿⣿⣇⣀⣀⣀⣀⣀⣀⣀⢀⢀⢀⢀⢀⢀⢀⡈⢀⢀⣼⣿⢏⢀⢀⢀⢀⢀⢀⣼⣿⡏⢀⢀⢀⢀⢀⢀⢀⢀⢀⢀⡘⣿⣿⢀⢀⢀
// ⢀⢀⢀⣿⣿⢀⢀⡈⢿⣿⡄⢀⢀⢸⣿⡇⢀⢀⢀⢀⣿⣿⣿⢿⢿⢿⢿⢿⢿⢿⢇⢀⢀⢀⢀⢀⢀⢀⢠⣾⣿⣧⡀⢀⢀⢀⢀⢀⢀⣿⣿⡇⢀⢀⢀⢀⢀⢀⢀⢀⢀⢀⢀⣿⣿⢀⢀⢀
// ⢀⢀⢀⣿⣿⢀⢀⢀⡈⢿⣿⢀⢀⢸⣿⡇⢀⢀⢀⢀⣿⣿⡇⢀⢀⢀⢀⢀⢀⢀⢀⢀⢀⢀⢀⣰⣿⡟⡛⣿⣷⡄⢀⢀⢀⢀⢀⢿⣿⣇⢀⢀⢀⢀⢀⢀⢀⢀⢀⢀⢀⣿⣿⢀⢀⢀
// ⢀⢀⢀⣿⣿⢀⢀⢀⢀⡈⢿⢀⢀⢸⣿⡇⢀⢀⢀⢀⡛⡟⢁⢀⢀⢀⢀⢀⢀⢀⢀⢀⢀⢀⣼⣿⡟⢀⢀⡈⢿⣿⣄⢀⢀⢀⢀⡘⣿⣿⣄⢀⢀⢀⢀⢀⢀⢀⢀⢀⣼⣿⢏⢀⢀⢀
// ⢀⢀⢀⣿⣿⢀⢀⢀⢀⢀⢀⢀⢀⢸⣿⡇⢀⢀⢀⢀⢀⣀⣀⣀⣀⣀⣀⣀⣀⣀⡀⢀⢀⢀⣠⣾⡿⢃⢀⢀⢀⢀⢀⢻⣿⣧⡀⢀⢀⢀⡈⢻⣿⣷⣦⣄⢀⢀⣠⣤⣶⣿⡿⢋⢀⢀⢀⢀
// ⢀⢀⢀⢿⢿⢀⢀⢀⢀⢀⢀⢀⢀⢸⢿⢃⢀⢀⢀⢀⢻⢿⢿⢿⢿⢿⢿⢿⢿⢿⢃⢀⢀⢀⢿⡟⢁⢀⢀⢀⢀⢀⢀⢀⡙⢿⡗⢀⢀⢀⢀⢀⡈⡉⡛⡛⢀⢀⢹⡛⢋⢁⢀⢀⢀⢀⢀⢀
//
// Author: Mehdy MORVAN
// Date: 04/10/2025
// Description: Header file for the bounds utils
//
///////////////////////////////////////////////////////////////////////////////

#pragma once
#include <glm/glm.hpp>
#include <glm/gtc/matrix_transform.hpp>

namespace nexo::math {
/**
* @struct AABB
* @brief Axis-aligned bounding box defined by min/max corners.
*
* Default-constructed boxes are "empty" (min > max) so they can be
* safely adopted by the first union/merge operation.
*
* Members:
* - glm::vec3 min — minimum corner (x/y/z).
* - glm::vec3 max — maximum corner (x/y/z).
*/
struct AABB {
glm::vec3 min{ +FLT_MAX, +FLT_MAX, +FLT_MAX };
glm::vec3 max{ -FLT_MAX, -FLT_MAX, -FLT_MAX };

/**
* @brief Whether this AABB currently represents no valid volume.
*
* An AABB is considered empty if any component of min is greater
* than the corresponding component of max.
*
* @return true if empty (e.g., before any points/boxes were merged), false otherwise.
*/
bool empty() const;
};

/**
* @struct BSphere
* @brief Bounding sphere (center + radius).
*
* Members:
* - glm::vec3 c — sphere center.
* - float r — non-negative radius.
*/
struct BSphere {
glm::vec3 c{0.0f};
float r{0.0f};
};

/**
* @brief Component-wise union of two AABBs.
*
* If one input is empty, the other is returned. If both are empty,
* an empty AABB is returned.
*
* @param a First AABB.
* @param b Second AABB.
* @return AABB that minimally encloses both @p a and @p b.
*/
AABB aabbUnion(const AABB& a, const AABB& b);

/**
* @brief Construct a conservative bounding sphere from an AABB.
*
* The sphere center is the AABB center. The radius equals the length
* of the half-extents (distance to a farthest corner). Suitable for
* quick frustum/broad-phase rejects.
*
* @param b Source AABB (may be empty).
* @return BSphere enclosing @p b. For an empty AABB, returns {c=(0,0,0), r=0}.
*/
BSphere sphereFromAABB(const AABB& b);

/**
* @brief Transform a local-space AABB by a 4×4 matrix and return a world-space AABB.
*
* Interprets the local AABB as an oriented box (center + half-extents) and applies:
* world_center = L * local_center + t
* world_half_extents = |L| * local_half_extents
* where L is the upper-left 3×3 of @p M and t is the translation. Using the
* absolute value of L yields a conservative axis-aligned enclosure under rotation
* and non-uniform scale.
*
* @param local Local-space AABB.
* @param M Transform from local to world space.
* @return World-space AABB that encloses the transformed local box.
*/
AABB aabbTransform(const AABB& local, const glm::mat4& M);

BSphere sphereTransform(const BSphere& s, const glm::mat4& M);
}
Original file line number Diff line number Diff line change
Expand Up @@ -168,6 +168,7 @@ namespace nexo::editor {
void deleteAssetPopup();
void deleteUsedAssetPopup();
void assetDetailsPopup();
void textureImporterPopup();

template<typename T>
static void drawErrorMessageInPopup(T& actionState);
Expand All @@ -189,7 +190,7 @@ namespace nexo::editor {
void handleFolderDrag(const std::string& folderPath, const std::string& folderName) const;
void handleAssetDrop(const std::string& path);
void handleFolderDrop(const std::string& folderPath);
void importDroppedFile(const std::string& filePath) const;
void importDroppedFile(const std::string& filePath);

// search functionality
void drawSearchBar();
Expand Down Expand Up @@ -233,6 +234,8 @@ namespace nexo::editor {
assets::AssetRef<assets::Texture> m_folderIcon;

std::vector<std::string> m_pendingDroppedFiles;
assets::GenericAssetRef m_pendingImportedAsset = assets::GenericAssetRef::null();
std::string m_pendingImportedAssetPath = "";

FolderManager m_folderManager;
};
Expand Down
Loading
Loading