Annwvyn::AnnGameObjectManager Class Reference

Game object manager. Create, destroy and keep track of objects, lights and other movable stuff. More...

#include <AnnGameObjectManager.hpp>

Inheritance diagram for Annwvyn::AnnGameObjectManager:
Collaboration diagram for Annwvyn::AnnGameObjectManager:

Public Member Functions

 AnnGameObjectManager ()
 
void update () override
 Update from the game engine. More...
 
Ogre::MeshPtr getAndConvertFromV1Mesh (const char *meshName, Ogre::v1::MeshPtr &v1Mesh, Ogre::MeshPtr &v2Mesh) const
 Get a MeshPtr by loading a v1Mesh ptr, specify the name and where to put the 2 pointers. More...
 
std::shared_ptr< AnnGameObjectcreateGameObject (const std::string &mesh, std::string identifier="", std::shared_ptr< AnnGameObject > object=std::make_shared< AnnGameObject >())
 
void removeGameObject (std::shared_ptr< AnnGameObject > object)
 
std::shared_ptr< AnnGameObjectgetFromNode (Ogre::SceneNode *node)
 Search for an AnnGameObject that holds this node, returns it if found. Return nullptr if not found. More...
 
void removeLightObject (std::shared_ptr< AnnLightObject > light)
 
std::shared_ptr< AnnLightObjectcreateLightObject (std::string identifier="")
 Add a light source to the scene. return a pointer to the new light. More...
 
std::shared_ptr< AnnTriggerObjectcreateTriggerObject (std::string identifier="")
 Create a trigger object. More...
 
void removeTriggerObject (std::shared_ptr< AnnTriggerObject > trigger)
 Remove the object from the engine. More...
 
std::shared_ptr< AnnGameObjectplayerLookingAt (unsigned short limit=5)
 Get the AnnGameObject the player is looking at. More...
 
std::shared_ptr< AnnGameObjectgetGameObject (std::string gameObjectName)
 Get an AnnGameObject for the required string; return nullptr if object cannot be found. More...
 
std::shared_ptr< AnnLightObjectgetLightObject (std::string lightObjectName)
 Get an AnnLightObject from it's name; return nullptr if object not found. More...
 
std::shared_ptr< AnnTriggerObjectgetTriggerObject (std::string triggerObjectName)
 Get an AnnTriggerObject from it's name; return nullptr if object not found. More...
 
void setImportParameter (bool halfPosition, bool halfTextureCoord, bool qTangents)
 Set the options to pass while converting Ogre V1 meshes to Ogre V2 meshes. More...
 
- Public Member Functions inherited from Annwvyn::AnnSubSystem
 AnnSubSystem (const std::string &systemName)
 Construct a SubSystem. More...
 
virtual ~AnnSubSystem ()
 Destruct a SubSystem. More...
 

Private Member Functions

uID nextID ()
 

Private Attributes

AnnTriggerObjectList Triggers
 Dynamic container for triggers objects present in engine. More...
 
AnnLightList Lights
 Dynamic container for lights objects present in engine. More...
 
AnnGameObjectList Objects
 Dynamic container for Game objects present in engine. More...
 
std::unordered_map< std::string, std::shared_ptr< AnnGameObject > > identifiedObjects
 objects mapped to ID strings More...
 
std::unordered_map< std::string, std::shared_ptr< AnnLightObject > > identifiedLights
 lights mapped to ID strings More...
 
std::unordered_map< std::string, std::shared_ptr< AnnTriggerObject > > identifiedTriggerObjects
 triggers identified to ID string More...
 
uID autoID
 
bool halfPos
 
bool halfTexCoord
 
bool qTan
 
Ogre_glTF::glTFLoaderInterface * glTFLoader = nullptr
 

Friends

class AnnEngine
 

Additional Inherited Members

- Protected Member Functions inherited from Annwvyn::AnnSubSystem
virtual bool needUpdate ()
 To be called by AnnEngine : Return if the subsystem wants to be updated. More...
 
- Protected Attributes inherited from Annwvyn::AnnSubSystem
std::string name
 Name of the subsystem. More...
 

Detailed Description

Game object manager. Create, destroy and keep track of objects, lights and other movable stuff.

Definition at line 20 of file AnnGameObjectManager.hpp.

Constructor & Destructor Documentation

◆ AnnGameObjectManager()

AnnGameObjectManager::AnnGameObjectManager ( )

Definition at line 16 of file AnnGameObjectManager.cpp.

Member Function Documentation

◆ createGameObject()

std::shared_ptr< AnnGameObject > AnnGameObjectManager::createGameObject ( const std::string mesh,
std::string  identifier = "",
std::shared_ptr< AnnGameObject object = std::make_shared<AnnGameObject>() 
)

Create a game object form the name of an entity.

Parameters
meshName of an mesh loaded to the Ogre ResourceGroupManager
objectAn instance of an empty AnnGameObject. Useful for creating object of inherited class

Definition at line 67 of file AnnGameObjectManager.cpp.

Here is the call graph for this function:

◆ createLightObject()

std::shared_ptr< AnnLightObject > AnnGameObjectManager::createLightObject ( std::string  identifier = "")

Add a light source to the scene. return a pointer to the new light.

Definition at line 155 of file AnnGameObjectManager.cpp.

Here is the call graph for this function:

◆ createTriggerObject()

std::shared_ptr< AnnTriggerObject > AnnGameObjectManager::createTriggerObject ( std::string  identifier = "")

Create a trigger object.

Definition at line 166 of file AnnGameObjectManager.cpp.

Here is the call graph for this function:

◆ getAndConvertFromV1Mesh()

Ogre::MeshPtr AnnGameObjectManager::getAndConvertFromV1Mesh ( const char *  meshName,
Ogre::v1::MeshPtr &  v1Mesh,
Ogre::MeshPtr &  v2Mesh 
) const

Get a MeshPtr by loading a v1Mesh ptr, specify the name and where to put the 2 pointers.

Definition at line 41 of file AnnGameObjectManager.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ getFromNode()

std::shared_ptr< AnnGameObject > AnnGameObjectManager::getFromNode ( Ogre::SceneNode *  node)

Search for an AnnGameObject that holds this node, returns it if found. Return nullptr if not found.

Definition at line 134 of file AnnGameObjectManager.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ getGameObject()

std::shared_ptr< AnnGameObject > AnnGameObjectManager::getGameObject ( std::string  gameObjectName)

Get an AnnGameObject for the required string; return nullptr if object cannot be found.

Definition at line 216 of file AnnGameObjectManager.cpp.

◆ getLightObject()

std::shared_ptr< AnnLightObject > AnnGameObjectManager::getLightObject ( std::string  lightObjectName)

Get an AnnLightObject from it's name; return nullptr if object not found.

Definition at line 224 of file AnnGameObjectManager.cpp.

◆ getTriggerObject()

std::shared_ptr< AnnTriggerObject > Annwvyn::AnnGameObjectManager::getTriggerObject ( std::string  triggerObjectName)

Get an AnnTriggerObject from it's name; return nullptr if object not found.

Definition at line 232 of file AnnGameObjectManager.cpp.

◆ nextID()

uID AnnGameObjectManager::nextID ( )
private

Definition at line 247 of file AnnGameObjectManager.cpp.

Here is the caller graph for this function:

◆ playerLookingAt()

std::shared_ptr< AnnGameObject > AnnGameObjectManager::playerLookingAt ( unsigned short  limit = 5)

Get the AnnGameObject the player is looking at.

Definition at line 185 of file AnnGameObjectManager.cpp.

Here is the call graph for this function:

◆ removeGameObject()

void AnnGameObjectManager::removeGameObject ( std::shared_ptr< AnnGameObject object)

Remove object from the manager. Object will be destroyed when no more references are in scope

Parameters
objectthe object to remove

Definition at line 121 of file AnnGameObjectManager.cpp.

Here is the call graph for this function:

◆ removeLightObject()

void AnnGameObjectManager::removeLightObject ( std::shared_ptr< AnnLightObject light)

Remove the given light from the scene

Parameters
lightshared pointer to the light

Definition at line 145 of file AnnGameObjectManager.cpp.

Here is the call graph for this function:

◆ removeTriggerObject()

void AnnGameObjectManager::removeTriggerObject ( std::shared_ptr< AnnTriggerObject trigger)

Remove the object from the engine.

Definition at line 176 of file AnnGameObjectManager.cpp.

Here is the call graph for this function:

◆ setImportParameter()

void AnnGameObjectManager::setImportParameter ( bool  halfPosition,
bool  halfTextureCoord,
bool  qTangents 
)

Set the options to pass while converting Ogre V1 meshes to Ogre V2 meshes.

Definition at line 240 of file AnnGameObjectManager.cpp.

◆ update()

void AnnGameObjectManager::update ( )
overridevirtual

Update from the game engine.

Reimplemented from Annwvyn::AnnSubSystem.

Definition at line 29 of file AnnGameObjectManager.cpp.

Here is the call graph for this function:

Friends And Related Function Documentation

◆ AnnEngine

friend class AnnEngine
friend

Definition at line 73 of file AnnGameObjectManager.hpp.

Member Data Documentation

◆ autoID

uID Annwvyn::AnnGameObjectManager::autoID
private

Definition at line 91 of file AnnGameObjectManager.hpp.

◆ glTFLoader

Ogre_glTF::glTFLoaderInterface* Annwvyn::AnnGameObjectManager::glTFLoader = nullptr
private

Definition at line 96 of file AnnGameObjectManager.hpp.

◆ halfPos

bool Annwvyn::AnnGameObjectManager::halfPos
private

Definition at line 94 of file AnnGameObjectManager.hpp.

◆ halfTexCoord

bool Annwvyn::AnnGameObjectManager::halfTexCoord
private

Definition at line 94 of file AnnGameObjectManager.hpp.

◆ identifiedLights

std::unordered_map<std::string, std::shared_ptr<AnnLightObject> > Annwvyn::AnnGameObjectManager::identifiedLights
private

lights mapped to ID strings

Definition at line 86 of file AnnGameObjectManager.hpp.

◆ identifiedObjects

std::unordered_map<std::string, std::shared_ptr<AnnGameObject> > Annwvyn::AnnGameObjectManager::identifiedObjects
private

objects mapped to ID strings

Definition at line 83 of file AnnGameObjectManager.hpp.

◆ identifiedTriggerObjects

std::unordered_map<std::string, std::shared_ptr<AnnTriggerObject> > Annwvyn::AnnGameObjectManager::identifiedTriggerObjects
private

triggers identified to ID string

Definition at line 89 of file AnnGameObjectManager.hpp.

◆ Lights

AnnLightList Annwvyn::AnnGameObjectManager::Lights
private

Dynamic container for lights objects present in engine.

Definition at line 78 of file AnnGameObjectManager.hpp.

◆ Objects

AnnGameObjectList Annwvyn::AnnGameObjectManager::Objects
private

Dynamic container for Game objects present in engine.

Definition at line 80 of file AnnGameObjectManager.hpp.

◆ qTan

bool Annwvyn::AnnGameObjectManager::qTan
private

Definition at line 94 of file AnnGameObjectManager.hpp.

◆ Triggers

AnnTriggerObjectList Annwvyn::AnnGameObjectManager::Triggers
private

Dynamic container for triggers objects present in engine.

Definition at line 76 of file AnnGameObjectManager.hpp.


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