17#include <glm/gtc/quaternion.hpp>
19#include <nlohmann/json.hpp>
30using json = nlohmann::json;
548 std::vector<kObject *> children;
550 bool isActive =
true;
551 bool isStatic =
false;
552 bool debugMode =
false;
571 bool importChild =
false;
574 uint32_t iconVAO = 0;
575 uint32_t iconVertexBuffer = 0;
576 float iconVertices[12] =
584 std::vector<kScript> scripts;
585 std::vector<kParticle> particles;
586 std::vector<kAudioSource> audioSources;
587 std::vector<kAudioListener>audioListeners;
589 bool hasPhysicsDesc =
false;
592 bool hasCharacterDesc =
false;
596 bool hasNavMeshDesc =
false;
Runtime wrapper around a Jolt character.
Definition kcharactercontroller.h:47
Groups a shader program with textures and surface parameters.
Definition kmaterial.h:27
bool getStatic()
Returns whether this object is marked as static (immobile geometry).
void setTemplateUuid(const kString &uuid)
Sets the corresponding template UUID for this prefab instance node.
void attachCharacter(kCharacterController *character)
Attaches a runtime character controller to this object.
kPhysicsObject * getPhysicsObject()
Returns the attached physics body, or nullptr if none is attached.
void setMaterial(kMaterial *newMaterial, bool setChildren=true)
Assigns a material to this object and optionally its children.
kString getName()
Returns the display name of this object.
virtual json serialize()
Serialises the object to a JSON value.
std::vector< kAudioListener > & getAudioListeners()
Returns a mutable reference to the list of audio listener components (0 or 1).
void setDebugMode(bool newMode)
Enables or disables editor debug visualization for this object.
void addAudioListener(const kAudioListener &listener)
Attaches an audio listener descriptor to this object.
void calculateModelMatrix()
Recomputes the local and world-space model matrices.
kVec3 getGlobalScale()
Returns the world-space scale derived from the world transform.
kString getUuid()
Returns the UUID kString of this object.
virtual void deserialize(json data)
Restores the object state from a JSON value.
kObject(kObject *parentNode=nullptr)
Constructs a kObject and optionally attaches it to a parent.
kNavMeshDesc & getNavMeshDesc()
Returns a mutable reference to the navigation surface descriptor.
std::vector< kObject * > getChildren()
Returns the list of direct children.
void setParent(kObject *newParent)
Reparents this object under newParent.
kVec3 getScale()
Returns the local scale.
std::vector< kAudioSource > & getAudioSources()
Returns a mutable reference to the list of attached audio sources.
kString getTemplateUuid() const
Returns the UUID of the corresponding node in the prefab template.
void removeParticle(const kString &uuid)
Removes the particle system with the given UUID from this object.
virtual ~kObject()
Destroys the object.
kMaterial * getMaterial()
Returns the assigned material.
kCharacterController * getCharacterController()
Returns the attached character controller, or nullptr.
kString getPrefabRef() const
Returns the prefab asset UUID this object is an instance of, or empty.
kCharacterControllerDesc & getCharacterDesc()
Returns a mutable reference to the character controller descriptor.
void setName(kString newName)
Sets the display name.
void removeScript(const kString &uuid)
Removes the script with the given UUID from this object.
kQuat getGlobalRotation()
Returns the world-space rotation derived from the world transform.
kString getMaterialUuid() const
Returns the source asset UUID of the assigned material.
Definition kobject.h:430
void addParticle(const kParticle &particle)
Appends a particle system descriptor to this object.
void syncFromCharacter()
Copies the character controller's position into this object's local transform. Call once per frame af...
void syncFromPhysics()
Copies the physics body's current position and rotation into this object's local transform.
void attachPhysics(kPhysicsObject *physicsObj)
Attaches a physics body to this object.
void detachFromParent()
Removes this object from its parent's children list.
kPhysicsObjectDesc & getPhysicsDesc()
Returns a mutable reference to the physics body descriptor.
kObject * getParent()
Returns the parent node.
void setMaterialUuid(const kString &uuid)
Sets the source asset UUID of the assigned material.
Definition kobject.h:424
void setParentKeepTransform(kObject *newParent)
Reparents this object while keeping its world transform.
kVec3 getPosition()
Returns the local position.
bool getImportChild() const
Whether this node is an import-derived sub-mesh (see setImportChild).
Definition kobject.h:449
void addAudioSource(const kAudioSource &source)
Appends an audio source descriptor to this object.
void detachPhysics()
Detaches the physics body without destroying it.
kVec3 calculateForward()
Computes the local forward (-Z) direction in world space.
kQuat getRotation()
Returns the local rotation as a quaternion.
virtual void setRotation(kQuat newRotation)
Sets the local rotation from a quaternion.
void rotate(kVec3 rotationAxis, float angularSpeed)
Rotates the object around an axis by a given angular speed.
kMat4 getModelMatrixWorld()
Returns the world-space model matrix.
void setImportChild(bool v)
Marks this node as an import-derived sub-mesh.
Definition kobject.h:443
bool getHasPhysicsDesc() const
Returns true if this object has a physics body descriptor configured.
virtual void setScale(kVec3 newScale)
Sets the local scale.
void setHasNavMeshDesc(bool val)
Sets whether this object carries a navigation surface.
void setActive(bool newActive)
Activates or deactivates the object.
virtual void draw()
Draws the object.
void addScript(const kScript &script)
Appends a script descriptor to this object.
std::vector< kParticle > & getParticles()
Returns a mutable reference to the list of attached particle systems.
std::vector< kScript > & getScripts()
Returns a mutable reference to the list of attached scripts.
bool getHasNavMeshDesc() const
Returns true if this object carries a navigation surface.
void removeAudioListener(const kString &uuid)
Removes the audio listener with the given UUID from this object.
bool getDebugMode()
Returns whether editor debug visualization is enabled.
virtual void setPosition(kVec3 newPosition)
Sets the local position.
kVec3 getGlobalPosition()
Returns the world-space position derived from the world transform.
bool getActive()
Returns whether this object is active (visible/processed).
void setHasCharacterDesc(bool val)
Sets whether this object has a character controller descriptor.
void setId(unsigned int newId)
Sets the numeric identifier.
void detachCharacter()
Detaches the character controller without destroying it.
void setType(kNodeType newType)
Sets the node type tag.
kVec3 calculateUp()
Computes the local up (+Y) direction in world space.
kNodeType getType()
Returns the scene-graph node type tag.
kVec3 calculateRight()
Computes the local right (+X) direction in world space.
void setHasPhysicsDesc(bool val)
Sets whether this object has a physics body descriptor.
kVec3 getRotationEuler()
Returns the local rotation as Euler angles in degrees.
unsigned int getId()
Returns the numeric identifier of this object.
void setStatic(bool newStatic)
Marks the object as static or dynamic.
bool getHasCharacterDesc() const
Returns true if this object has a character controller configured.
void removeAudioSource(const kString &uuid)
Removes the audio source with the given UUID from this object.
kMat4 getModelMatrixLocal()
Returns the local model matrix (relative to the parent).
void setUuid(kString newUuid)
Sets the UUID kString.
void setPrefabRef(const kString &ref)
Sets the prefab asset UUID this object is an instance of.
Represents a single rigid body or trigger volume inside the physics simulation.
Definition kphysicsobject.h:131
Audio emitter and listener component descriptors for scene objects.
Capsule character controller built on Jolt's JPH::Character.
Core type aliases, enumerations, structs, and utility functions used throughout the engine.
Abstract graphics driver interface used by the engine.
Symbol visibility / linkage macro for the Kemena3D library.
#define KEMENA3D_API
Definition kexport.h:35
Surface material combining a shader, textures, and PBR/Phong properties.
Navigation mesh baking and pathfinding.
nlohmann::json json
Definition kobject.h:30
Particle system component and manager.
A single physics body — shape, type (dynamic / static / kinematic / trigger), and runtime controls.
AngelScript engine wrapper: script-asset registry, text/bytecode compilation, and per-object script i...
Top-level Kemena3D engine namespace.
Definition kanimation.h:23
std::string kString
Standard string alias.
Definition kdatatype.h:42
glm::quat kQuat
Unit quaternion.
Definition kdatatype.h:40
kNodeType
Scene-graph node type tag.
Definition kdatatype.h:86
@ NODE_TYPE_OBJECT
Generic empty object.
Definition kdatatype.h:87
glm::vec3 kVec3
3-component float vector.
Definition kdatatype.h:33
glm::mat4 kMat4
4x4 float matrix.
Definition kdatatype.h:39
Marks a scene object as the audio listener (typically the main camera).
Definition kaudiosource.h:43
Describes an audio emitter attached to a scene object.
Definition kaudiosource.h:21
Editor-authored description of a character controller.
Definition kcharactercontroller.h:26
Serialisable settings for a navigation surface attached to an object in the editor.
Definition knavmesh.h:108
Data descriptor for a single particle system attached to a scene object.
Definition kparticle.h:23
All parameters needed to create a kPhysicsObject.
Definition kphysicsobject.h:92
Per-object script component descriptor.
Definition kscriptmanager.h:79