PlayerViewport class
#include <Jazz2/Rendering/PlayerViewport.h>
Player viewport.
Owns the on-screen region rendered for a single player together with its full render pipeline: the scene viewport and camera that follows a target actor, the LightingRenderer, the chain of BlurRenderPass passes, and the CombineRenderer. Also drives per-frame camera movement, shake, overrides and ambient light.
Constructors, destructors, conversion operators
-
PlayerViewport(LevelHandler* levelHandler,
Actors::
ActorBase* targetActor) - Creates a new instance.
Public functions
- auto Initialize(SceneNode* sceneNode, SceneNode* outputNode, Recti bounds, bool useHalfRes) -> bool
- Initializes the viewport.
- void Register()
- Registers the viewport and its render passes into the viewport chain.
- auto GetBounds() const -> Rectf
- Returns bounds of the viewport.
- auto GetViewportSize() const -> Vector2i
- Returns size of the viewport.
-
auto GetTargetActor() const -> Actors::
ActorBase* - Returns the actor the camera follows.
- void OnEndFrame()
- Called at the end of each frame.
- void UpdateCamera(float timeMult)
- Updates the camera position.
- void ShakeCameraView(float duration)
- Shakes the camera view for a given duration.
- void OverrideCamera(float x, float y, bool topLeft = false)
- Overrides the camera position.
- void WarpCameraToTarget(bool fast)
- Instantly moves the camera to the target actor.
Function documentation
Jazz2:: Rendering:: PlayerViewport:: PlayerViewport(LevelHandler* levelHandler,
Actors:: ActorBase* targetActor)
Creates a new instance.
| Parameters | |
|---|---|
| levelHandler | Level handler that owns the viewport |
| targetActor | Actor the camera follows |
bool Jazz2:: Rendering:: PlayerViewport:: Initialize(SceneNode* sceneNode,
SceneNode* outputNode,
Recti bounds,
bool useHalfRes)
Initializes the viewport.
| Parameters | |
|---|---|
| sceneNode | Root node of the rendered scene |
| outputNode | Node the resulting image is attached to |
| bounds | Bounds of the viewport |
| useHalfRes | Whether to render at half resolution |