CAST II Game Engine

   DESCRIPTION       FEATURES       SCREENSHOTS       FORUMS       DOCUMENTATION       DOWNLOADS       CONTACTS   
Units
Class Hierarchy
Classes, Interfaces and Objects
Types
Enumerations
Variables
Constants
Functions and Procedures
Identifiers

Unit C2Render

Description

CAST II Engine render unit

(C) 2006 George "Mirage" Bakhtadze. www.casteng.com
The source code may be used under either MPL 1.1 or LGPL 2.1 license. See included license.txt file
Unit contains API-independent basic renderer classes

Classes, Interfaces and Objects

NameDescription
Class TAPIBuffers 
Class TAPIStateWrapper 
Class TBuffers 
Class TRendererRenderer class
Class TTextures 

Types

Overview

TAppRequirements = record Flags: set of TAppRequirementsFlag; MinYResolution: Cardinal; HWAccelerationLevel: THWAccelLevel; TotalBackBuffers: Cardinal; end;
TBuffer = record Index, Size: Integer; Position: Integer; ResetCounter: Integer; end;
TGammaRamp = record R, G, B: array[0..255] of Word; end;
TLockedRectData = record Data: Pointer; Pitch: Integer; end;
TRenderTarget = record ColorBuffer, DepthBuffer, ColorTexture, DepthTexture: Pointer; ColorFormat, DepthFormat, ActualColorFormat, ActualDepthFormat: Integer; Width, Height: Integer; LastUpdateFrame, LastUseFrame: Integer; end;
TRenderTargets = array of TRenderTarget;
TShader = record Shader: Integer; LastUseFrame: Integer; Resource: TShaderResource; end;
TShaders = array of TShader;
TTexture = record Texture: Pointer; Format : Cardinal; Options: TTextureOptions; Width, Height, Depth, Levels: Integer; LastUseFrame: Integer; Resource: TImageResource; end;
TTextureArray = array of TTexture;
TTextureOptions = set of TTextureOptionFlag;
TVideoMode = packed record Width, Height: Integer; RefreshRate : Integer; Format : Integer; end;
TVideoModes = array of TVideoMode;
TViewPort = packed record X, Y, Width, Height: Longword; MinZ, MaxZ: Single; end;

Description

TAppRequirements = record Flags: set of TAppRequirementsFlag; MinYResolution: Cardinal; HWAccelerationLevel: THWAccelLevel; TotalBackBuffers: Cardinal; end;

Application requirements record. These values can be changed before renderer initialization to change its behaviour.
Flags - [arUseStencil, arUseZBuffer] by default.
MinYResolution - minimal vertical resolution of modes to iclude in available video modes list. 480 by default.
HWAccelerationLevel - level of hardware acceleration required. haMixedVP by default.
TotalBackBuffers - number of back buffers required. 1 by default.

TBuffer = record Index, Size: Integer; Position: Integer; ResetCounter: Integer; end;

API-independent buffer structure

TGammaRamp = record R, G, B: array[0..255] of Word; end;

Gamma ramp

TLockedRectData = record Data: Pointer; Pitch: Integer; end;

Data structure used to represent a locked rectangular area of some data Data - pointer to actual data Pitch - offset in bytes between two rows of data

TRenderTarget = record ColorBuffer, DepthBuffer, ColorTexture, DepthTexture: Pointer; ColorFormat, DepthFormat, ActualColorFormat, ActualDepthFormat: Integer; Width, Height: Integer; LastUpdateFrame, LastUseFrame: Integer; end;

Render target

TRenderTargets = array of TRenderTarget;

 

TShader = record Shader: Integer; LastUseFrame: Integer; Resource: TShaderResource; end;

Shader

TShaders = array of TShader;

 

TTexture = record Texture: Pointer; Format : Cardinal; Options: TTextureOptions; Width, Height, Depth, Levels: Integer; LastUseFrame: Integer; Resource: TImageResource; end;

Texture

TTextureArray = array of TTexture;

 

TTextureOptions = set of TTextureOptionFlag;

Texture option set

TVideoMode = packed record Width, Height: Integer; RefreshRate : Integer; Format : Integer; end;

Video mode data structure.
Width, Height - horizontal and vertical resolution.
RefreshRate - refresh rate.
Format - pixel format.

TVideoModes = array of TVideoMode;

Array of video modes

TViewPort = packed record X, Y, Width, Height: Longword; MinZ, MaxZ: Single; end;

Viewport

Enumerations

TAppRequirementsFlag
 arUseStencilUse stencil buffering
 arUseZBufferUse Z-buffering
 arForceVSyncForces vertcial syncronization on
 arForceNoVSyncForces vertcial syncronization off
 arMultithreadedRenderTells API that it will be used from several threads
 arPreserveFPUTells API to not change FPU state within its routines
 arModesUseRefreshIncludes modes with all refresh rates in available video modes list
 arPreserveBackBufferTells API that backbuffer contents should not be changed or discarded between frames. May be slow on some configurations.
 arLockableBackBufferTells API that backbuffer should be lockable
THWAccelLevel
Hardware acceleration level (DirectX only)
 haSoftwareVPSoftware vertex processing
 haMixedVPMixed vertex processing
 haHardwareVPHardware vertex processing
 haPureDevicePure device
TRendererState
Renderer states
 rsOKRenderer is ready
 rsNotReadyRenderer is in process of initialization
 rsLostRenderer has lost device and will try to restore it (DirectX-specific)
 rsNotInitializedRenderer has not been initialized
TTextureOptionFlag
Texture option flags
 toImmediateLoadTexture should be immediately loaded
 toNonAPIManagedTexture is not managed by an API [b](currently unsupported)[/b]
 toCubeMapTexture is a cube map [b](currently unsupported)[/b]
 toProceduralTexture is procedurally generated at runtime

Constants

Overview

IndicesSize = 2;
MaxVertexBuffers = 64;
OffScreenX = -10000;
OffScreenY = -10000;
reNone = 0;
rePixelShaderAssembleFail = 5;
rePixelShaderCreateFail = 6;
reTooManyStages = 1;
reTooManyTextures = 2;
reVertexShaderAssembleFail = 3;
reVertexShaderCreateFail = 4;

Description

IndicesSize = 2;

Size of indices

MaxVertexBuffers = 64;

Maximum number of vertex buffer with different vertex sizes

OffScreenX = -10000;

max X coordinate of window to consider it off-screen

OffScreenY = -10000;

max Y coordinate of window to consider it off-screen

reNone = 0;

No error

rePixelShaderAssembleFail = 5;

Pixel shader compilation failed

rePixelShaderCreateFail = 6;

Pixel shader creation failed

reTooManyStages = 1;

Number of texture stages in a pass exceeding renderer capabilities (see MaxTextureStages)

reTooManyTextures = 2;

Number of textures used in a pass exceeding renderer capabilities (see MaxTexturesPerPass)

reVertexShaderAssembleFail = 3;

Vertex shader compilation failed

reVertexShaderCreateFail = 4;

Vertex shader creation failed

Last modified: 4 Jul, 2008
Copyright (C) 2006-2008, casteng.com