Class TCastleViewport
Unit
Declaration
type TCastleViewport = class(TCastleScreenEffects)
Description
Viewport displays a tree of scenes and transformations (TCastleTransform and descendants of it, like TCastleScene). Add the scenes and transformations to Items. See https://castle-engine.io/viewport_and_scenes .
Each viewport has a Camera with a position and orientation. Viewport may have multiple cameras.
Viewport may also have a navigation that allows to move camera by keyboard, mouse and other inputs. You can use any navigation method implemented in the engine (TCastleExamineNavigation, TCastleWalkNavigation, TCastleThirdPersonNavigation) or implement your own (you can create your own descendants of TCastleNavigation, or just move/rotate the camera by calling TCastleTransform.SetWorldView from anywhere). Just add TCastleNavigation as a child of TCastleViewport.
Viewport may display a background. It may be a solid color, a 3D skybox or a gradient. See Background, BackgroundColor properties and https://castle-engine.io/background . Alternatively, viewport background may be transparent (so other TCastleUserInterface underneath will be visible) if Transparent.
Multiple viewports can display the same world. To do this, simply copy Items reference from one TCastleViewport to another. You can also just create your own TCastleRootTransform instance and then assign it to multiple viewports. This allows e.g. to make a split-screen game (played by 2 people, with 2 viewports, 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. See https://castle-engine.io/multiple_viewports_to_display_one_world .
Source: scene/castleviewport.pas (line 78).
Hierarchy
- TObject
- TPersistent
- TComponent
- TCastleComponent
- TCastleUserInterface
- TCastleScreenEffects
- TCastleViewport
Generated by PasDoc 0.17.0.snapshot.