Class TAdScene

DescriptionHierarchyFieldsMethodsProperties

Unit

Declaration

type TAdScene = class(TObject)

Description

Simple class that copes with scene management. TAdScene holds its own copy of the current view and projection matrix and applies it to the graphic system when needed. TAdScene is used in TAdRenderingSurface (and so in TAdDraw and TAdTextureSurface, as they are descendants of TAdRenderingSurface) to allow easy access on the scene settings of the surface.

Hierarchy

Overview

Methods

Public constructor Create(ADraw: TAdDraw);
Public destructor Destroy; override;
Public procedure Activate;
Public procedure Deactivate;
Public procedure Setup2DScene(AWidth, AHeight: integer);
Public procedure Setup3DScene(AWidth, AHeight: integer; APos, ADir, AUp: TAdVector3);

Properties

Public property ViewMatrix: TAdMatrix read FViewMatrix write SetViewMatrix;
Public property ProjectionMatrix: TAdMatrix read FProjectionMatrix write SetProjectionMatrix;
Public property Viewport: TAdRect read FViewPort write SetViewPort;
Public property AmbientColor: TAndorraColor read FAmbientColor write SetAmbientColor;
Public property Width: integer read FWidth;
Public property Height: integer read FHeight;
Public property ClipPlaneNearZ: double read FNearZ write FNearZ;
Public property ClipPlaneFarZ: double read FFarZ write FFarZ;
Public property Activated: boolean read FActivated;
Public property AdDraw: TAdDraw read FDraw;
Public property OnActivate: TAdNotifyEvent read FOnActivate write FOnActivate;

Description

Methods

Public constructor Create(ADraw: TAdDraw);

Creates an instance of TAdScene and links itself to the TAdDraw object.

Public destructor Destroy; override;

Destroys the instance of TAdScene.

Public procedure Activate;

Pushs the current scene settings in the graphic system and indicates this scene object as being "active".

Public procedure Deactivate;

Actually does not more than indicating this scene object to be inactive.

Public procedure Setup2DScene(AWidth, AHeight: integer);

Creates an orhtogonal 2D-Scene with a specific width and height. SceneWidth and SceneHeight are set to the values passed here. The clipping planes are set to tha values in ClipPlaneNearZ and ClipPlaneFarZ.

Public procedure Setup3DScene(AWidth, AHeight: integer; APos, ADir, AUp: TAdVector3);

Creates an perspectivic 3D-Scene. SceneWidth and SceneHeight are set to the values passed here.

Parameters
APos
defines the position of the camera
ADir
defines the target point of the camara
AUp
is a normalized vector that targets at the head of the scene

Properties

Public property ViewMatrix: TAdMatrix read FViewMatrix write SetViewMatrix;

The ViewMatrix specifies the position of the objects in the scene. It is normally established by the SetupScene functions. You can set this property to transform the objects on the screen in a special way.

Public property ProjectionMatrix: TAdMatrix read FProjectionMatrix write SetProjectionMatrix;

The ProjectionMatrix specifies the way the objects are projected on the surface. It is normally established by the SetupScene functions. You can set this property to project the objects on the screen in a special way.

Public property Viewport: TAdRect read FViewPort write SetViewPort;

Defines the rectangle where graphic operations take place. Viewport is automatically set when a change in the size of the surface occurs. If you want to use your own viewport, don't forget to reset it after such a change happened. The viewport is always given in absolute coordinates.

Public property AmbientColor: TAndorraColor read FAmbientColor write SetAmbientColor;

The ambient color of the scene. The ambient color is the base color all lights are added to. To use an ambient color, lights have to be enabled.

See also
TAdRenderingSurface.Options
Options that control the rendering process.
Public property Width: integer read FWidth;

Returns the width of the scene, that specifies the width of the relative coordinate system.

Public property Height: integer read FHeight;

Returns the height of the scene, that specifies the height of the relative coordinate system.

Public property ClipPlaneNearZ: double read FNearZ write FNearZ;

The position of the near Z-Clipping plane. However, in the right handed coordinate system used by Andorra 2D, the near and the far clipping plane swap their roles. The distance between the near and the far clipping plane should always be as small as possible, because this value is responsible for the resolution of the Z-Buffer. A change of the value will take effect after setting up a new 2D/3D scene. The default value is "100".

Public property ClipPlaneFarZ: double read FFarZ write FFarZ;

The position of the far Z-Clipping plane. However, in the right handed coordinate system used by Andorra 2D, the near and the far clipping plane swap their roles. The distance between the near and the far clipping plane should always be as small as possible, because this value is responsible for the resolution of the Z-Buffer. A change of the value will take effect after setting up a new 2D/3D scene. The default value is "-100".

Public property Activated: boolean read FActivated;

Returns whether the scene is currently activated.

Public property AdDraw: TAdDraw read FDraw;

Points on the parent AdDraw instance.

Public property OnActivate: TAdNotifyEvent read FOnActivate write FOnActivate;

This event is raised when the current scene is activated. OnActivate may already be in use internally, so you have to test if it really is set to nil if you want to assign to it.

SourceForge.net Logo


Generated by PasDoc 0.11.0 on 2008-12-31 14:31:59