33 template <
typename T,
typename... Args>
38 template <
typename T,
typename First,
typename... Rest>
40 : std::bool_constant<std::is_constructible_v<
45 std::shared_ptr<SceneNode>,
50 template <
typename T,
typename... Args>
52 std::is_base_of_v<Components::Logic, T> &&
54 std::is_constructible_v<T, Scene *, entt::entity &, std::shared_ptr<SceneNode>, Args...> ||
55 std::is_constructible_v<T,
Scene *, entt::entity &, Args..., std::shared_ptr<SceneNode>> ||
56 std::is_constructible_v<T, Scene *, std::shared_ptr<SceneNode>, Args...> ||
57 std::is_constructible_v<T,
Scene *, entt::entity &, Args...> ||
58 std::is_constructible_v<T,
Scene *, Args...> );
81 template <
typename T,
typename... Args>
89 else if constexpr ( std::is_constructible_v<
93 std::shared_ptr<SceneNode>,
100 else if constexpr ( std::is_constructible_v<
105 std::shared_ptr<SceneNode>> )
111 else if constexpr ( std::is_constructible_v<T, Scene *, std::shared_ptr<SceneNode>, Args...> )
117 else if constexpr ( std::is_constructible_v<T,
Scene *, entt::entity &, Args...> )
136 void tick(
double deltaTime )
override;
262 template <
typename T,
typename First,
typename... Rest>
268 std::forward<First>( first ),
270 std::forward<Rest>( rest )...
A scene component has a transform.
The physics engine manages creating and destroying physics objects for the physics simulation.
Actor(const SpawnContext &context)
glm::vec3 getUpVector() const
Gets the up world vector.
void setActorLocation(glm::vec3 newLocation) const
Set the new world location for this actor.
EngineKern * getEngine() const
Gets the engine this actor belongs to.
virtual void endPlay()
Gets executed when an actor is getting removed from the scene.
glm::vec3 getActorRotation() const
Gets the actors rotation in the world.
void setActorRotation(glm::vec3 newRotation) const
Sets the world rotation.
virtual void beginPlay()
Gets executed when the actor is spawned into the world.
glm::mat4 getWorldTransform() const
Gets the model matrix.
void destroyActor()
Queues this actor for destruction after the current tick finishes.
void destroyActorImmediate()
Destroys this actor immediately. Prefer destroyActor() during gameplay/tick code.
void rotateActor(glm::vec3 deltaRotation) const
Applies an incremental rotation to the actor using quaternion multiplication. Use this instead of get...
std::optional< std::shared_ptr< SceneNode > > sceneNode
virtual bool drawImGui() const
Allows drawing custom Imgui panels for the editor.
void setActorScale(glm::vec3 newScale) const
sets the world scale for this actor
glm::vec3 getActorScale() const
Scales the actor to world scale.
Scene * getOwningScene() const
Get the pointer to the scene this entity is a part of.
Core::PhysicsEngine * getPhysicsEngine() const
Gets the physics engine through this actor's owning engine.
glm::vec3 getRightVector() const
Gets the right.
glm::vec3 getActorLocation() const
Gets the actors location in the world.
void tick(double deltaTime) override
Executed every frame.
~Actor() override=default
glm::vec3 getForwardVector() const
Gets the forward world vector.
std::shared_ptr< SceneNode > getSceneNode() const
Getter for the scene graph node for this object.
T * addComponentWithSceneEntityFirstNodeRest(First &&first, Rest &&... rest)
std::weak_ptr< Components::Scene > rootComponent_
T * addComponent(Args &&... args)
Adds a component using this actor's scene, ECS entity and scene node where supported.
glm::quat getActorRotationQuat() const
Gets the actors world rotation.
virtual std::string getActorName() const
T * addComponent(Args &&... args)
Adds a component to the entity. Checks for uniqueness if the component defines 'static constexpr bool...
A scene is the overarching structure which can spawn, contain and destroy actors or entities.
Manages IBL (Image-Based Lighting) resources for specular reflections.
Scene ownership data passed to actor and component constructors during spawning.