class
ICameraManagerThis manager handles the cameras in the game.
A camera is represented by the class ICamera, and is responsible of setting the view transformations necessary for the game to render. The manager can only have one active camera at a time; this active camera receives the user input (mouse and keyboard) and updates the view transformations used for rendering. The cameras are mapped by ID and, optionally, by a name.
The manager also contains a map of camera types. An ID is mapped to a factory function that creates an ICamera of the appropiate type; when a camera .prop file is readed, the camera will be created with the appropiate factory according to its 'cameraType' property. On initialization, the manager reads all the cameras in the 0x40410100 (camera_properties~) folder.
This manager is different from most managers, that have a Get() method to get the current instance. ICameraManager depends on the mode manager, and therefore the method IGameModeManager::
Base classes
- class IMessageListener
- An interface that can receive messages sent through the app.
Derived classes
- class cCameraManager
- The implementation of ICameraManager; this should only be used for extending and detouring.
Constructors, destructors, conversion operators
- ~ICameraManager() virtual
Public functions
- auto Initialize(const char* pCheatName) -> bool pure virtual
- auto Dispose() -> bool pure virtual
- auto SetViewer(cViewer* pViewer) -> void pure virtual
- Sets the Viewer that will receive the results of the camera in this camera manager.
- auto GetViewer() -> cViewer* pure virtual
- Gets the Viewer that will receive the results of the camera in this camera manager.
-
auto AddCameraType(uint32_
t typeID, CameraFactoryFunction_ t function) -> void pure virtual - Adds a new camera type.
-
auto PutCamera(uint32_
t cameraID, ICamera* pCamera, const char16_ t* pName = nullptr) -> void pure virtual - Adds a new camera into this manager.
- auto ParseCameras() -> void pure virtual
- Reads and stores in this manager all the cameras in the 0x40410100 (camera_properties~) folder.
- auto Update(int nDeltaTime) -> void pure virtual
- A method called every game loop that updates the active camera.
-
auto SetActiveCameraByKey(const char16_
t* pKeyString) -> bool pure virtual - Sets the active camera to the one that matches the given key eastl::string.
-
auto SetActiveCameraByID(uint32_
t cameraID) -> bool pure virtual - Sets the active camera to the one mapped to the given ID.
- auto GetActiveCamera() -> ICamera* pure virtual
- Returns the currently active camera, or nullptr if there is no active camera.
-
auto GetActiveCameraID() -> uint32_
t pure virtual - Returns the ID mapped to the currently active camera, or 0 if there is no active camera.
-
auto GetCamera(uint32_
t cameraID) -> ICamera* pure virtual - 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 pure virtual - 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 pure virtual - Returns the number of cameras contained in this manager.
- auto GetCameraAt(int nIndex) -> ICamera* pure virtual
- Returns the ICamera at the given index, or nullptr if the index is not valid.
-
auto GetCameraIDAt(int nIndex) -> uint32_
t pure virtual - Returns the camera ID at the given index, or nullptr if the index is not valid.
- auto SetActiveCamera(int nIndex) -> bool pure virtual
- 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 pure virtual
- Returns the index of the currently active camera, or -1 if there is no active camera.
- auto RemoveCameras() -> void pure virtual
- Removes all the cameras and their mappings from this manager.
Function documentation
void App:: ICameraManager:: AddCameraType(uint32_ t typeID,
CameraFactoryFunction_ t function) pure virtual
Adds a new camera type.
Parameters | |
---|---|
typeID | The ID that identifies this type of camera. |
function | A function that takes a App:: |
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:: ICameraManager:: PutCamera(uint32_ t cameraID,
ICamera* pCamera,
const char16_ t* pName = nullptr) pure virtual
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::
A name can also be optionally specified.
void App:: ICameraManager:: Update(int nDeltaTime) pure virtual
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::
bool App:: ICameraManager:: SetActiveCameraByKey(const char16_ t* pKeyString) pure virtual
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::
bool App:: ICameraManager:: SetActiveCameraByID(uint32_ t cameraID) pure virtual
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)
uint32_ t App:: ICameraManager:: GetCameraID(const char* pName) pure virtual
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:: ICameraManager:: GetCameraAt(int nIndex) pure virtual
Returns the ICamera at the given index, or nullptr if the index is not valid.
Parameters | |
---|---|
nIndex |
uint32_ t App:: ICameraManager:: GetCameraIDAt(int nIndex) pure virtual
Returns the camera ID at the given index, or nullptr if the index is not valid.
Parameters | |
---|---|
nIndex |
bool App:: ICameraManager:: SetActiveCamera(int nIndex) pure virtual
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::