summaryrefslogtreecommitdiff
path: root/src/3d/object.h
diff options
context:
space:
mode:
authorskal <pascal.massimino@gmail.com>2026-02-08 14:25:34 +0100
committerskal <pascal.massimino@gmail.com>2026-02-08 14:25:34 +0100
commitc68817059b882506bacc09694b0ac58dbe6c13a6 (patch)
treee7989a3df7aa5769169ffa3477769db140688a2f /src/3d/object.h
parent50edd9f0e0565be643dda467bc240d9281277a8c (diff)
feat: Integrate plane_distance into renderer and scene loader
This commit integrates the plane_distance functionality by: - Adding shared_user_data to Object3D for storing type-specific data. - Modifying SceneLoader to read and store plane_distance in shared_user_data for PLANE objects. - Updating ObjectData struct in renderer.h to use params.x for object type and params.y for plane_distance. - Modifying Renderer3D::update_uniforms to populate ObjectData::params.y with plane_distance for PLANE objects. - Adjusting blender_export.py to correctly export plane_distance and reorder quaternion components. A manual step is required to update WGSL shaders to utilize ObjectData.params.y for plane distance calculations.
Diffstat (limited to 'src/3d/object.h')
-rw-r--r--src/3d/object.h3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/3d/object.h b/src/3d/object.h
index dcd96e3..b5cab88 100644
--- a/src/3d/object.h
+++ b/src/3d/object.h
@@ -42,12 +42,13 @@ class Object3D {
AssetId mesh_asset_id;
vec3 local_extent; // Half-extents for AABB (used by meshes for shadows)
void* user_data; // For tool-specific data, not for general use
+ std::shared_ptr<void> shared_user_data; // For tool-specific data managed with shared ownership
Object3D(ObjectType t = ObjectType::CUBE)
: position(0, 0, 0), rotation(0, 0, 0, 1), scale(1, 1, 1), type(t),
color(1, 1, 1, 1), velocity(0, 0, 0), mass(1.0f), restitution(0.5f),
is_static(false), mesh_asset_id((AssetId)0), local_extent(1, 1, 1),
- user_data(nullptr) {
+ user_data(nullptr), shared_user_data(nullptr) {
}
mat4 get_model_matrix() const {