mirror of
https://github.com/Heretek-AI/GDevelop-Heretek.git
synced 2026-10-12 02:02:42 +00:00
16-reviewer audit of ae815f489 (103 findings) remediated in six groups.
1. Lazy THREE init (runtimeobject.ts): scratch Box3/Matrix4/Euler allocated on
first use, so a 2D-only export (never loads three.js) boots.
2. Culling correctness: computeAABB uses |size|/2 half-extents and places the box
at the true rotation pivot C' = P + R*(C-P); custom-object children union
conservative boxes; the frustum is rebuilt in the boxes' space (right-multiply
_threeGroup.matrixWorld) with a numeric cache incl. camera-Z; hide/cull route
through setCullingVisible/applyRenderVisibility (no detached-carrier writes);
custom-object children and nested tile maps no longer cull with a wrong window.
3. Studio pipeline wedge (Utils.js + Studio/*): lock release over all calls,
working marks only editor calls, spawn failures reach the model, plan merge on
objects (JSON.parse bug), one persistent LoopGuard with real call_id +
re-arming + recordSuccess, RequestWriteGate self-retry + supersede-rejects,
UseStudioRuntime fire-and-forget gate write + recomputed plan + sent check,
FinalizeSubAgents terminal-'error' + executed-but-unsent + turn-cap + enriched
report, send-returns-boolean, BYOK cache write-through, suspension cascade,
turn-cap dispatch, stand-alone cannot spawn.
4. Instancing: useInstancing now serializes (C++); the pool grows without null.add
and collapses deleted slots; the instance matrix is normalized
(carrier * correction) and rewritten on rotation/hide; animated/skinned/morph/
multi-mesh models rejected; per-slot shadows; layer moves re-acquire.
5. BYOK role enforcement: studioRoleId persisted and re-applied every turn (tools +
prompt); dispatch filters tools outside the role; readOnly roles skip edit
approval.
6. Warnings + Info: mutating-tool classification, hasOwnProperty role guards,
cache-message merge, spawn arg caps, per-batch GDD note, fan-out cap, plan
dependsOn-omission + caps + duplicate-id + fail-closed + trimmed ids, tilemap
rotated/mirror bail + window margin + null-map guard, pool dispose wired to
unloadScene, schema description required, plus doc/comment corrections.
Verified: engine builds clean; boot + computeAABB (13/13) + Model3DInstancePool
(9/9) harnesses pass; Jest green for src/AiGeneration + src/AI (175), CustomAIClient
(27, incl. the critical second-turn role regression), PlanStore (25),
FinalizeSubAgents (21), LoopGuard (18), RequestWriteGate (11), Roles (9).
196 lines
5.6 KiB
C++
196 lines
5.6 KiB
C++
/**
|
|
|
|
GDevelop - Particle System Extension
|
|
Copyright (c) 2010-2016 Florian Rival ([email protected])
|
|
This project is released under the MIT License.
|
|
*/
|
|
|
|
#pragma once
|
|
|
|
#include "GDCore/Project/ObjectConfiguration.h"
|
|
namespace gd {
|
|
class InitialInstance;
|
|
class Project;
|
|
} // namespace gd
|
|
|
|
class GD_EXTENSION_API Model3DAnimation {
|
|
public:
|
|
Model3DAnimation() : shouldLoop(false) {};
|
|
virtual ~Model3DAnimation(){};
|
|
|
|
/**
|
|
* \brief Return the name of the animation
|
|
*/
|
|
const gd::String &GetName() const { return name; }
|
|
|
|
/**
|
|
* \brief Change the name of the animation
|
|
*/
|
|
void SetName(const gd::String &name_) { name = name_; }
|
|
|
|
/**
|
|
* \brief Return the name of the animation from the GLB file.
|
|
*/
|
|
const gd::String &GetSource() const { return source; }
|
|
|
|
/**
|
|
* \brief Change the name of the animation from the GLB file.
|
|
*/
|
|
void SetSource(const gd::String &source_) { source = source_; }
|
|
|
|
/**
|
|
* \brief Return true if the animation should loop.
|
|
*/
|
|
const bool ShouldLoop() const { return shouldLoop; }
|
|
|
|
/**
|
|
* \brief Change whether the animation should loop or not.
|
|
*/
|
|
void SetShouldLoop(bool shouldLoop_) { shouldLoop = shouldLoop_; }
|
|
|
|
private:
|
|
gd::String name;
|
|
gd::String source;
|
|
bool shouldLoop;
|
|
};
|
|
|
|
/**
|
|
* \brief Particle Emitter object used for storage and for the IDE.
|
|
*/
|
|
class GD_EXTENSION_API Model3DObjectConfiguration
|
|
: public gd::ObjectConfiguration {
|
|
public:
|
|
Model3DObjectConfiguration();
|
|
virtual ~Model3DObjectConfiguration(){};
|
|
virtual std::unique_ptr<gd::ObjectConfiguration> Clone() const override {
|
|
return gd::make_unique<Model3DObjectConfiguration>(*this);
|
|
}
|
|
|
|
virtual void ExposeResources(gd::ArbitraryResourceWorker &worker) override;
|
|
|
|
virtual std::map<gd::String, gd::PropertyDescriptor>
|
|
GetProperties() const override;
|
|
|
|
virtual bool UpdateProperty(const gd::String &name,
|
|
const gd::String &value) override;
|
|
|
|
virtual std::map<gd::String, gd::PropertyDescriptor>
|
|
GetInitialInstanceProperties(const gd::InitialInstance &instance) override;
|
|
|
|
virtual bool UpdateInitialInstanceProperty(gd::InitialInstance &instance,
|
|
const gd::String &name,
|
|
const gd::String &value) override;
|
|
|
|
/** \name Animations
|
|
* Methods related to animations management
|
|
*/
|
|
///@{
|
|
std::size_t GetAnimationsCount() const override { return animations.size(); };
|
|
|
|
const gd::String &GetAnimationName(size_t index) const override;
|
|
|
|
bool HasAnimationNamed(const gd::String &animationName) const override;
|
|
|
|
/**
|
|
* \brief Return the animation at the specified index.
|
|
* If the index is out of bound, a "bad animation" object is returned.
|
|
*/
|
|
const Model3DAnimation &GetAnimation(std::size_t nb) const;
|
|
|
|
/**
|
|
* \brief Return the animation at the specified index.
|
|
* If the index is out of bound, a "bad animation" object is returned.
|
|
*/
|
|
Model3DAnimation &GetAnimation(std::size_t nb);
|
|
|
|
/**
|
|
* \brief Add an animation at the end of the existing ones.
|
|
*/
|
|
void AddAnimation(const Model3DAnimation &animation);
|
|
|
|
/**
|
|
* \brief Remove an animation.
|
|
*/
|
|
bool RemoveAnimation(std::size_t nb);
|
|
|
|
/**
|
|
* \brief Remove all animations.
|
|
*/
|
|
void RemoveAllAnimations() { animations.clear(); }
|
|
|
|
/**
|
|
* \brief Return true if the object hasn't any animation.
|
|
*/
|
|
bool HasNoAnimations() const { return animations.empty(); }
|
|
|
|
/**
|
|
* \brief Swap the position of two animations
|
|
*/
|
|
void SwapAnimations(std::size_t firstIndex, std::size_t secondIndex);
|
|
|
|
/**
|
|
* \brief Change the position of the specified animation
|
|
*/
|
|
void MoveAnimation(std::size_t oldIndex, std::size_t newIndex);
|
|
|
|
/**
|
|
* \brief Return a read-only reference to the vector containing all the
|
|
* animation of the object.
|
|
*/
|
|
const std::vector<Model3DAnimation> &GetAllAnimations() const {
|
|
return animations;
|
|
}
|
|
///@}
|
|
|
|
/** \name Getters
|
|
* Fast access for rendering instances.
|
|
*/
|
|
///@{
|
|
double GetWidth() const { return width; };
|
|
double GetHeight() const { return height; };
|
|
double GetDepth() const { return depth; };
|
|
double GetRotationX() const { return rotationX; };
|
|
double GetRotationY() const { return rotationY; };
|
|
double GetRotationZ() const { return rotationZ; };
|
|
double GetCrossfadeDuration() const { return crossfadeDuration; };
|
|
|
|
const gd::String& GetModelResourceName() const { return modelResourceName; };
|
|
const gd::String& GetMaterialType() const { return materialType; };
|
|
const gd::String& GetOriginLocation() const { return originLocation; };
|
|
const gd::String& GetCenterLocation() const { return centerLocation; };
|
|
|
|
bool shouldKeepAspectRatio() const { return keepAspectRatio; };
|
|
bool shouldCastShadow() const { return isCastingShadow; };
|
|
bool shouldReceiveShadow() const { return isReceivingShadow; };
|
|
bool shouldUseInstancing() const { return useInstancing; };
|
|
///@}
|
|
|
|
protected:
|
|
virtual void DoUnserializeFrom(gd::Project &project,
|
|
const gd::SerializerElement &element) override;
|
|
virtual void DoSerializeTo(gd::SerializerElement &element) const override;
|
|
|
|
private:
|
|
double width;
|
|
double height;
|
|
double depth;
|
|
double rotationX;
|
|
double rotationY;
|
|
double rotationZ;
|
|
double crossfadeDuration;
|
|
|
|
gd::String modelResourceName;
|
|
gd::String materialType;
|
|
gd::String originLocation;
|
|
gd::String centerLocation;
|
|
|
|
bool keepAspectRatio;
|
|
bool isCastingShadow;
|
|
bool isReceivingShadow;
|
|
bool useInstancing;
|
|
|
|
std::vector<Model3DAnimation> animations;
|
|
static Model3DAnimation badAnimation; //< Bad animation when an out of bound
|
|
// animation is requested.
|
|
};
|