Nameless Engine
Loading...
Searching...
No Matches
ne::EnvironmentNode Class Reference

#include <EnvironmentNode.h>

Inheritance diagram for ne::EnvironmentNode:
ne::Node ne::Serializable

Public Member Functions

 EnvironmentNode (const std::string &sNodeName)
 
void setAmbientLight (const glm::vec3 &ambientLight)
 
glm::vec3 getAmbientLight () const
 
- Public Member Functions inherited from ne::Node
 Node ()
 
 Node (const std::string &sName)
 
 Node (const Node &)=delete
 
Nodeoperator= (const Node &)=delete
 
 Node (Node &&)=delete
 
Nodeoperator= (Node &&)=delete
 
virtual ~Node () override
 
void setNodeName (const std::string &sName)
 
void detachFromParentAndDespawn ()
 
void addChildNode (const sgc::GcPtr< Node > &pNode, AttachmentRule locationRule=AttachmentRule::KEEP_WORLD, AttachmentRule rotationRule=AttachmentRule::KEEP_WORLD, AttachmentRule scaleRule=AttachmentRule::KEEP_WORLD)
 
void setSerialize (bool bSerialize)
 
std::optional< ErrorserializeNodeTree (const std::filesystem::path &pathToFile, bool bEnableBackup)
 
std::string getNodeName () const
 
sgc::GcPtr< NodegetWorldRootNode ()
 
std::pair< std::recursive_mutex, sgc::GcPtr< Node > > * getParentNode ()
 
std::pair< std::recursive_mutex, sgc::GcVector< sgc::GcPtr< Node > > > * getChildNodes ()
 
template<typename NodeType >
requires std::derived_from<NodeType, Node>
sgc::GcPtr< NodeType > getParentNodeOfType (const std::string &sParentNodeName="")
 
template<typename NodeType >
requires std::derived_from<NodeType, Node>
sgc::GcPtr< NodeType > getChildNodeOfType (const std::string &sChildNodeName="")
 
TickGroup getTickGroup () const
 
std::optional< size_t > getNodeId () const
 
bool isCalledEveryFrame ()
 
bool isReceivingInput ()
 
bool isSpawned ()
 
bool isParentOf (Node *pNode)
 
bool isChildOf (Node *pNode)
 
bool isSerialized () const
 
- Public Member Functions inherited from ne::Serializable
std::optional< Errorserialize (std::filesystem::path pathToFile, bool bEnableBackup, const std::unordered_map< std::string, std::string > &customAttributes={})
 
std::variant< std::string, Errorserialize (toml::value &tomlData, const std::string &sEntityId="", const std::unordered_map< std::string, std::string > &customAttributes={}, const std::optional< std::filesystem::path > &optionalPathToFile={}, bool bEnableBackup=false)
 
std::variant< std::string, Errorserialize (toml::value &tomlData, Serializable *pOriginalObject, std::string sEntityId="", const std::unordered_map< std::string, std::string > &customAttributes={}, const std::optional< std::filesystem::path > &optionalPathToFile={}, bool bEnableBackup=false)
 
std::optional< std::pair< std::string, std::string > > getPathDeserializedFromRelativeToRes () const
 

Protected Member Functions

virtual void onSpawning () override
 
virtual void onDespawning () override
 
- Protected Member Functions inherited from ne::Node
void setIsCalledEveryFrame (bool bEnable)
 
void setTickGroup (TickGroup tickGroup)
 
void setIsReceivingInput (bool bEnable)
 
TimercreateTimer (const std::string &sTimerName)
 
template<typename FunctionType >
NodeNotificationBroadcaster< FunctionType > * createNotificationBroadcaster ()
 
std::pair< std::recursive_mutex, std::unordered_map< unsigned int, std::function< void(KeyboardModifiers, bool)> > > * getActionEventBindings ()
 
std::pair< std::recursive_mutex, std::unordered_map< unsigned int, std::function< void(KeyboardModifiers, float)> > > * getAxisEventBindings ()
 
std::recursive_mutex * getSpawnDespawnMutex ()
 
virtual void onMouseMove (double xOffset, double yOffset)
 
virtual void onMouseScrollMove (int iOffset)
 
virtual void onBeforeNewFrame (float timeSincePrevFrameInSec)
 
virtual void onSpawning ()
 
virtual void onChildNodesSpawned ()
 
virtual void onDespawning ()
 
virtual void onBeforeDetachedFromParent (bool bThisNodeBeingDetached)
 
virtual void onAfterAttachedToNewParent (bool bThisNodeBeingAttached)
 
- Protected Member Functions inherited from ne::Serializable
virtual void onAfterDeserialized ()
 

Private Attributes

glm::vec3 ambientLight = glm::vec3(0.0F, 0.0F, 0.0F)
 

Additional Inherited Members

- Public Types inherited from ne::Node
enum class  AttachmentRule { RESET_RELATIVE , KEEP_RELATIVE , KEEP_WORLD }
 
- Static Public Member Functions inherited from ne::Node
static size_t getAliveNodeCount ()
 
static std::variant< sgc::GcPtr< Node >, ErrordeserializeNodeTree (const std::filesystem::path &pathToFile)
 
static GameInstancegetGameInstance ()
 
- Static Public Member Functions inherited from ne::Serializable
static std::optional< ErrorserializeMultiple (std::filesystem::path pathToFile, std::vector< SerializableObjectInformation > vObjects, bool bEnableBackup)
 
static std::variant< std::set< std::string >, ErrorgetIdsFromFile (std::filesystem::path pathToFile)
 
template<typename SmartPointer , typename InnerType = typename SmartPointer::element_type>
requires std::derived_from<InnerType, Serializable> && (std::same_as<SmartPointer, sgc::GcPtr<InnerType>> || std::same_as<SmartPointer, std::unique_ptr<InnerType>>)
static std::variant< SmartPointer, Errordeserialize (const std::filesystem::path &pathToFile)
 
template<typename SmartPointer , typename InnerType = typename SmartPointer::element_type>
requires std::derived_from<InnerType, Serializable> && (std::same_as<SmartPointer, sgc::GcPtr<InnerType>> || std::same_as<SmartPointer, std::unique_ptr<InnerType>>)
static std::variant< SmartPointer, Errordeserialize (const std::filesystem::path &pathToFile, std::unordered_map< std::string, std::string > &customAttributes)
 
template<typename SmartPointer , typename InnerType = typename SmartPointer::element_type>
requires std::derived_from<InnerType, Serializable> && (std::same_as<SmartPointer, sgc::GcPtr<InnerType>> || std::same_as<SmartPointer, std::unique_ptr<InnerType>>)
static std::variant< SmartPointer, Errordeserialize (std::filesystem::path pathToFile, std::unordered_map< std::string, std::string > &customAttributes, const std::string &sEntityId)
 
template<typename SmartPointer , typename InnerType = typename SmartPointer::element_type>
requires std::derived_from<InnerType, Serializable> && (std::same_as<SmartPointer, sgc::GcPtr<InnerType>> || std::same_as<SmartPointer, std::unique_ptr<InnerType>>)
static std::variant< SmartPointer, Errordeserialize (const std::filesystem::path &pathToFile, const std::string &sEntityId)
 
template<typename SmartPointer , typename InnerType = typename SmartPointer::element_type>
requires std::same_as<SmartPointer, sgc::GcPtr<Serializable>> || std::same_as<SmartPointer, std::unique_ptr<Serializable>>
static std::variant< std::vector< DeserializedObjectInformation< SmartPointer > >, ErrordeserializeMultiple (std::filesystem::path pathToFile, const std::set< std::string > &ids)
 
template<typename SmartPointer , typename InnerType = typename SmartPointer::element_type>
requires std::derived_from<InnerType, Serializable> && (std::same_as<SmartPointer, sgc::GcPtr<InnerType>> || std::same_as<SmartPointer, std::unique_ptr<InnerType>>)
static std::variant< SmartPointer, Errordeserialize (const toml::value &tomlData, std::unordered_map< std::string, std::string > &customAttributes, std::string sEntityId="", std::optional< std::filesystem::path > optionalPathToFile={})
 

Detailed Description

Allows configuring environment settings such as ambient light, skybox, etc.

Constructor & Destructor Documentation

◆ EnvironmentNode()

ne::EnvironmentNode::EnvironmentNode ( const std::string &  sNodeName)

Creates a new node with the specified name.

Parameters
sNodeNameName of this node.

Member Function Documentation

◆ getAmbientLight()

glm::vec3 ne::EnvironmentNode::getAmbientLight ( ) const

Returns ambient light color intensity.

Returns
Light color intensity in RGB format in range [0.0; 1.0].

◆ onDespawning()

void ne::EnvironmentNode::onDespawning ( )
overrideprotectedvirtual

Called before this node is despawned from the world to execute custom despawn logic.

Remarks
This node will be marked as despawned after this function is called.
This function is called after all child nodes were despawned.
Warning
If overriding you must call the parent's version of this function first (before executing your login) to execute parent's logic.

Reimplemented from ne::Node.

◆ onSpawning()

void ne::EnvironmentNode::onSpawning ( )
overrideprotectedvirtual

Called when this node was not spawned previously and it was either attached to a parent node that is spawned or set as world's root node to execute custom spawn logic.

Remarks
This node will be marked as spawned before this function is called.
This function is called before any of the child nodes are spawned. If you need to do some logic after child nodes are spawned use onChildNodesSpawned.
Warning
If overriding you must call the parent's version of this function first (before executing your login) to execute parent's logic.

Reimplemented from ne::Node.

◆ setAmbientLight()

void ne::EnvironmentNode::setAmbientLight ( const glm::vec3 &  ambientLight)

Sets intensity and color of the ambient lighting.

Parameters
ambientLightLight color intensity in RGB format in range [0.0; 1.0].

Member Data Documentation

◆ ambientLight

glm::vec3 ne::EnvironmentNode::ambientLight = glm::vec3(0.0F, 0.0F, 0.0F)
private

Intensity and color of the ambient lighting.


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