Kale
Loading...
Searching...
No Matches
Public Attributes | Protected Member Functions | Protected Attributes | Friends | List of all members
Kale::Node Class Reference

#include <Node.hpp>

+ Inheritance diagram for Kale::Node:

Public Attributes

std::string name
 
const float updateTime = 100.0f
 
const float preUpdateTime = 100.0f
 

Protected Member Functions

virtual void begin (const Scene &scene)
 
virtual void render (const Camera &camera, float deltaTime) const
 
virtual void update (size_t threadNum, const Scene &scene, float deltaTime)
 
virtual void preUpdate (size_t threadNum, const Scene &scene, float deltaTime)
 
virtual void end (const Scene &scene)
 
 Node ()
 
 Node (float preUpdateTime, float updateTime)
 

Protected Attributes

std::optional< std::mutex > mutex
 

Friends

class Scene
 

Detailed Description

The main class for nodes, all nodes must inherit from this class

Definition at line 34 of file Node.hpp.

Constructor & Destructor Documentation

◆ Node() [1/2]

Node::Node ( )
protected

Creates the node parent

Definition at line 24 of file Node.cpp.

◆ Node() [2/2]

Node::Node ( float preUpdateTime,
float updateTime )
protected

Creates the node parent

Parameters
preUpdateTimeThe average pre update time, please see Node::preUpdateTime for documentation
updateTimeThe average update time, please see Node::updateTime for documentation

Definition at line 33 of file Node.cpp.

Member Function Documentation

◆ begin()

void Node::begin ( const Scene & scene)
protectedvirtual

Called when the node is added to the scene, guaranteed to be called before any updates & renders and from the main thread.

Parameters
sceneThe scene the node has been added to

Reimplemented in Kale::PathNode< T >, and Kale::PathNode< T >.

Definition at line 42 of file Node.cpp.

◆ end()

void Node::end ( const Scene & scene)
protectedvirtual

Called when the node is removed from the scene, guaranteed to be called from the main thread

Reimplemented in Kale::PathNode< T >, and Kale::PathNode< T >.

Definition at line 77 of file Node.cpp.

◆ preUpdate()

void Node::preUpdate ( size_t threadNum,
const Scene & scene,
float deltaTime )
protectedvirtual

Called prior to update, perfect place to do things such as updating the bounding box, etc

Parameters
threadNumthe index of the thread this update is called on
sceneThe scene being updated to
deltaTimeThe duration of the last frame in microseconds

Reimplemented in Kale::PathNode< T >, and Kale::SkeletalAnimatable.

Definition at line 70 of file Node.cpp.

◆ render()

void Node::render ( const Camera & camera,
float deltaTime ) const
protectedvirtual

Renders the node

Parameters
cameraThe camera to render with

Reimplemented in Kale::PathNode< T >, and Kale::PathNode< T >.

Definition at line 50 of file Node.cpp.

◆ update()

void Node::update ( size_t threadNum,
const Scene & scene,
float deltaTime )
protectedvirtual

Called on update, perfect place to do any physics updating, game logic, etc

Parameters
threadNumthe index of the thread this update is called on
sceneThe scene being updated to
deltaTimeThe duration of the last frame in microseconds

Reimplemented in Kale::SkeletalAnimatable.

Definition at line 60 of file Node.cpp.

Friends And Related Symbol Documentation

◆ Scene

friend class Scene
friend

Definition at line 91 of file Node.hpp.

Member Data Documentation

◆ mutex

std::optional<std::mutex> Kale::Node::mutex
protected

An optional mutex for nodes to use. It is up to the inherited node as to whether or not to use this. In some implementations mutexes are heavy classes and using this can help avoid large amounts of dangling mutexes.

Definition at line 43 of file Node.hpp.

◆ name

std::string Kale::Node::name

The name of this node, optional and does not have to be unique. Making it unique allows for easy access to nodes however.

Definition at line 98 of file Node.hpp.

◆ preUpdateTime

const float Kale::Node::preUpdateTime = 100.0f

The amount of time this node takes to pre-update on average, measured and used similarly to updateTime.

Definition at line 113 of file Node.hpp.

◆ updateTime

const float Kale::Node::updateTime = 100.0f

The amount of time (in microseconds) this node takes to update on average

You can gain this statistic using the Kale Editor calibration tools. This measure is device specific, when developing on multiple devices it is recommended that you use a low powered device for calibration, the same device must be used for calibrating all nodes to avoid potential bias

Definition at line 108 of file Node.hpp.


The documentation for this class was generated from the following files: