App::cCameraManager class

The implementation of ICameraManager; this should only be used for extending and detouring.

Base classes

class ICameraManager
This manager handles the cameras in the game.
class IVirtual
A default interface that provides a virtual destructor, it should only be used internally.

Constructors, destructors, conversion operators

cCameraManager()

Public functions

auto HandleMessage(uint32_t messageID, void* msg) -> bool override
Called every time a message is received.
auto AddRef() -> int override
auto Release() -> int override
auto Initialize(const char* pCheatName) -> bool override
auto Dispose() -> bool override
auto SetViewer(cViewer* pViewer) -> void override
Sets the Viewer that will receive the results of the camera in this camera manager.
auto GetViewer() -> cViewer* override
Gets the Viewer that will receive the results of the camera in this camera manager.
auto AddCameraType(uint32_t typeID, CameraFactoryFunction_t function) -> void override
Adds a new camera type.
auto PutCamera(uint32_t cameraID, ICamera* pCamera, const char16_t* pName) -> void override
Adds a new camera into this manager.
auto ParseCameras() -> void override
Reads and stores in this manager all the cameras in the 0x40410100 (camera_properties~) folder.
auto Update(int nDeltaTime) -> void override
A method called every game loop that updates the active camera.
auto SetActiveCameraByKey(const char16_t* pKeyString) -> bool override
Sets the active camera to the one that matches the given key eastl::string.
auto SetActiveCameraByID(uint32_t cameraID) -> bool override
Sets the active camera to the one mapped to the given ID.
auto GetActiveCamera() -> ICamera* override
Returns the currently active camera, or nullptr if there is no active camera.
auto GetActiveCameraID() -> uint32_t override
Returns the ID mapped to the currently active camera, or 0 if there is no active camera.
auto GetCamera(uint32_t cameraID) -> ICamera* override
Returns the ICamera mapped to the given ID, or nullptr if there is no camera mapped to that ID.
auto GetCameraID(const char* pName) -> uint32_t override
Returns the ID of the camera mapped to the given name, or 0 if there is no ID mapped to that name.
auto GetCamerasCount() -> size_t override
Returns the number of cameras contained in this manager.
auto GetCameraAt(int nIndex) -> ICamera* override
Returns the ICamera at the given index, or nullptr if the index is not valid.
auto GetCameraIDAt(int nIndex) -> uint32_t override
Returns the camera ID at the given index, or nullptr if the index is not valid.
auto SetActiveCamera(int nIndex) -> bool override
Sets the active camera of this manager, which will be used to calculate all the view transformations used for rendering, and that will receive all the input events.
auto GetActiveCameraIndex() -> int override
Returns the index of the currently active camera, or -1 if there is no active camera.
auto RemoveCameras() -> void override
Removes all the cameras and their mappings from this manager.

Public variables

int mnRefCount
bool field_0C
eastl::string mCheatKeyword
eastl::hash_map<eastl::string16, int> field_20
eastl::hash_map<uint32_t, CameraFactoryFunction_t> mTypeFactories
eastl::hash_map<uint32_t, size_t> mCameraIndices
eastl::vector<ICameraPtr> mpCameras
eastl::vector<eastl::string16> mCameraNames
int mnActiveIndex
int field_AC
cViewer* mpViewer

Function documentation

bool App::cCameraManager::HandleMessage(uint32_t messageID, void* msg) override

Called every time a message is received.

Parameters
messageID The ID of the message received.
msg The data of the message received, it might be nullptr.
Returns Whether the message was handled or not.

Only the messages with an ID this listener signed up for will call this event.

void App::cCameraManager::SetViewer(cViewer* pViewer) override

Sets the Viewer that will receive the results of the camera in this camera manager.

Parameters
pViewer The new Viewer.

void App::cCameraManager::AddCameraType(uint32_t typeID, CameraFactoryFunction_t function) override

Adds a new camera type.

Parameters
typeID The ID that identifies this type of camera.
function A function that takes a App::PropertyList* parameter and returns an ICamera*.

When a camera settings .prop file uses the 'cameraType' property with this typeID value, the given factory function will be called to create a new ICamera.

void App::cCameraManager::PutCamera(uint32_t cameraID, ICamera* pCamera, const char16_t* pName) override

Adds a new camera into this manager.

Parameters
cameraID The ID that uniquely identifices the camera.
pCamera The new ICamera.
pName [Optional] A eastl::string that identifies the camera.

The camera will be mapped to the given cameraID and ICamera::OnAttach(ICameraManager*) will be called. If another camera is already mapped to that ID, ICamera::OnDeattach() will be called on it. Additionally, if the camera replaced is the active one, ICamera::OnExit() will be called, and the new camera will be the active.

A name can also be optionally specified.

void App::cCameraManager::Update(int nDeltaTime) override

A method called every game loop that updates the active camera.

Parameters
nDeltaTime The time ellapsed since the last call, in milliseconds.

This will call the ICamera::Update() method on the active camera, passing the manager Viewer as a parameter.

bool App::cCameraManager::SetActiveCameraByKey(const char16_t* pKeyString) override

Sets the active camera to the one that matches the given key eastl::string.

Parameters
pKeyString The eastl::string representation of a ResourceKey.
Returns True if the active camera was changed, false otherwise.

Only the instance ID will be used, the rest will be ignored. The eastl::string will be parsed using ResourceKey::Parse(). This will call SetActiveCameraByID(uint32_t).

bool App::cCameraManager::SetActiveCameraByID(uint32_t cameraID) override

Sets the active camera to the one mapped to the given ID.

Parameters
cameraID The ID of the new active camera.
Returns True if the active camera was changed, false otherwise.

If the ID is not mapped, nothing will happen. This will call SetActiveCamera(size_t)

ICamera* App::cCameraManager::GetCamera(uint32_t cameraID) override

Returns the ICamera mapped to the given ID, or nullptr if there is no camera mapped to that ID.

Parameters
cameraID The ID of the camera.

uint32_t App::cCameraManager::GetCameraID(const char* pName) override

Returns the ID of the camera mapped to the given name, or 0 if there is no ID mapped to that name.

Parameters
pName A char c-eastlstring.

ICamera* App::cCameraManager::GetCameraAt(int nIndex) override

Returns the ICamera at the given index, or nullptr if the index is not valid.

Parameters
nIndex

uint32_t App::cCameraManager::GetCameraIDAt(int nIndex) override

Returns the camera ID at the given index, or nullptr if the index is not valid.

Parameters
nIndex

bool App::cCameraManager::SetActiveCamera(int nIndex) override

Sets the active camera of this manager, which will be used to calculate all the view transformations used for rendering, and that will receive all the input events.

Parameters
nIndex The index of the new active camera.
Returns True if the active camera changed, false otherwise.

ICamera::OnEnter() will be called on the new active camera, and ICamera::OnExit() will be caleld on the old active camera.