Class TCastleViewport
Unit
CastleSceneManager
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 TUIControl, position of viewport on the Controls list (like TCastleControlCustom.Controls or TCastleWindowCustom.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
Properties
Description
Methods
 |
function GetHeadlightCamera: TCamera; override; |
|
 |
function GetPlayer: TPlayer; override; |
|
 |
function GetTimeScale: Single; override; |
|
 |
function PointingDeviceActivate(const Active: boolean): boolean; override; |
|
 |
function PointingDeviceMove(const RayOrigin, RayDirection: TVector3): boolean; override; |
|
 |
function CameraMoveAllowed(ACamera: TWalkCamera; const ProposedNewPos: TVector3; out NewPos: TVector3; const BecauseOfGravity: boolean): boolean; override; |
|
 |
function CameraHeight(ACamera: TWalkCamera; const Position: TVector3; out AboveHeight: Single; out AboveGround: PTriangle): boolean; override; |
|
 |
procedure CameraVisibleChange(ACamera: TObject); override; |
|
 |
destructor Destroy; override; |
|
 |
procedure Render; override; |
|
Properties
Generated by PasDoc 0.15.0.
|