Class TCastleViewport

Unit

Declaration

type TCastleViewport = class(TCastleAbstractViewport)

Description

Custom 2D viewport showing 3D world. This uses assigned SceneManager to show 3D world on the screen.

For simple games, using this is not needed, because TCastleSceneManager also acts as a viewport (when TCastleSceneManager.DefaultViewport is True, which is the default). Using custom viewports (implemented by this class) is useful when you want to have more than one viewport showing the same 3D world. Different viewports may have different cameras, but they always share the same 3D world (in scene manager).

You can control the size of this viewport by FullSize, Left, Bottom, Width, Height properties. For custom viewports, you often want to set FullSize = False and control viewport's position and size explicitly.

Viewports may be overlapping, that is one viewport may (partially) obscure another viewport. Just like with any other TCastleUserInterface, position of viewport on the Controls list (like TCastleControlBase.Controls or TCastleWindowBase.Controls) is important: Controls are specified in the back-to-front order. That is, if the viewport A may obscure viewport B, then A must be after B on the Controls list.

The viewports are a cool feature for many cases. For example typical 3D modeling programs have 4 viewports to view the model from various sides. Or you can make a split-screen game, played by 2 people on a single monitor. Or you can show in a 3D FPS game an additional view from some security camera, or from a flying rocket. For examples of using viewports see:

Hierarchy

Overview

Methods

Protected function GetItems: TSceneManagerWorld; override;
Protected function GetMainScene: TCastleScene; override;
Protected function GetShadowVolumeRenderer: TGLShadowVolumeRenderer; override;
Protected function GetMouseRayHit: TRayCollision; override;
Protected function GetHeadlightCamera: TCamera; override;
Protected function GetPlayer: TPlayer; override;
Protected function GetTimeScale: Single; override;
Protected function PointingDeviceActivate(const Active: boolean): boolean; override;
Protected function PointingDeviceMove(const RayOrigin, RayDirection: TVector3): boolean; override;
Protected function CameraMoveAllowed(ACamera: TWalkCamera; const ProposedNewPos: TVector3; out NewPos: TVector3; const BecauseOfGravity: boolean): boolean; override;
Protected function CameraHeight(ACamera: TWalkCamera; const Position: TVector3; out AboveHeight: Single; out AboveGround: PTriangle): boolean; override;
Protected function CameraRayCollision(const RayOrigin, RayDirection: TVector3): TRayCollision; override;
Protected procedure CameraVisibleChange(const Sender: TInputListener; const Changes: TCastleUserInterfaceChanges; const ChangeInitiatedByChildren: boolean); override;
Protected function Headlight: TAbstractLightNode; override;
Public destructor Destroy; override;
Public procedure Render; override;

Properties

Published property SceneManager: TCastleSceneManager read FSceneManager write SetSceneManager;

Description

Methods

Protected function GetItems: TSceneManagerWorld; override;
 
Protected function GetMainScene: TCastleScene; override;
 
Protected function GetShadowVolumeRenderer: TGLShadowVolumeRenderer; override;
 
Protected function GetMouseRayHit: TRayCollision; override;
 
Protected function GetHeadlightCamera: TCamera; override;
 
Protected function GetPlayer: TPlayer; override;
 
Protected function GetTimeScale: Single; override;
 
Protected function PointingDeviceActivate(const Active: boolean): boolean; override;
 
Protected function PointingDeviceMove(const RayOrigin, RayDirection: TVector3): boolean; override;
 
Protected function CameraMoveAllowed(ACamera: TWalkCamera; const ProposedNewPos: TVector3; out NewPos: TVector3; const BecauseOfGravity: boolean): boolean; override;
 
Protected function CameraHeight(ACamera: TWalkCamera; const Position: TVector3; out AboveHeight: Single; out AboveGround: PTriangle): boolean; override;
 
Protected function CameraRayCollision(const RayOrigin, RayDirection: TVector3): TRayCollision; override;
 
Protected procedure CameraVisibleChange(const Sender: TInputListener; const Changes: TCastleUserInterfaceChanges; const ChangeInitiatedByChildren: boolean); override;
 
Protected function Headlight: TAbstractLightNode; override;
 
Public destructor Destroy; override;
 
Public procedure Render; override;
 

Properties

Published property SceneManager: TCastleSceneManager read FSceneManager write SetSceneManager;
 

Generated by PasDoc 0.15.0.