Isle
Loading...
Searching...
No Matches
TglSurface Class Referenceabstract

[AI] Encapsulates a rendering surface, its associated hardware device, renderer, and view. More...

#include <tglsurface.h>

Inheritance diagram for TglSurface:

Classes

struct  CreateStruct
 [AI] Contains initialization parameters for creating a TglSurface and its underlying DDraw/D3D resources. More...
 

Public Member Functions

 TglSurface ()
 [AI] Constructs a new TglSurface instance with members initialized to their default state. More...
 
virtual ~TglSurface ()
 [AI] Virtual destructor also triggers Destroy(). More...
 
virtual BOOL Create (const CreateStruct &, Tgl::Renderer *, Tgl::Group *pScene)
 [AI] Creates and initializes the surface, rendering device, and optionally installs scene graph. More...
 
virtual void Destroy ()
 [AI] Destroys all resources (view, device), releasing scene and renderer references. More...
 
virtual double Render ()
 [AI] Renders a single frame and returns the render time for that frame. More...
 
Tgl::RendererGetRenderer () const
 [AI] Gets the active renderer for this surface. More...
 
Tgl::DeviceGetDevice () const
 [AI] Returns the graphics device used by this surface, e.g. More...
 
Tgl::ViewGetView () const
 [AI] Gets the current view/camera for this surface. More...
 
Tgl::GroupGetScene () const
 [AI] Returns the currently attached 3D scene root/group. More...
 
unsigned long GetWidth () const
 [AI] Returns the width (in pixels) of the rendered surface. More...
 
unsigned long GetHeight () const
 [AI] Returns the height (in pixels) of the rendered surface. More...
 
double GetRenderingRate () const
 [AI] Returns the measured rendering rate (frames per second) for the rendering routine. More...
 
double GetFrameRate () const
 [AI] Returns the measured frame rate (frames per second) for the current surface. More...
 
unsigned long GetFrameCount () const
 [AI] Returns the frame count since creation or since last meter reset. More...
 

Protected Member Functions

virtual Tgl::ViewCreateView (Tgl::Renderer *, Tgl::Device *)=0
 [AI] Abstract view creation. More...
 
virtual void DestroyView ()
 [AI] Destroys (deletes) the surface's view/camera, and resets the pointer to null. More...
 

Detailed Description

[AI] Encapsulates a rendering surface, its associated hardware device, renderer, and view.

[AI] TglSurface is the main representation of a 3D rendering target, managing the renderer, device, viewport, and main scene group. It handles initialization, device creation, rendering timing/statistics, and render loop operations for LEGO Island's DirectX-based renderer. [AI]

Advanced users may subclass this to customize viewport creation or device handling. [AI]

Definition at line 32 of file tglsurface.h.

Constructor & Destructor Documentation

◆ TglSurface()

TglSurface::TglSurface ( )

[AI] Constructs a new TglSurface instance with members initialized to their default state.

Definition at line 16 of file tglsurface.cpp.

◆ ~TglSurface()

TglSurface::~TglSurface ( )
virtual

[AI] Virtual destructor also triggers Destroy().

Frees device, view, and related resources.

Definition at line 38 of file tglsurface.cpp.

Member Function Documentation

◆ Create()

BOOL TglSurface::Create ( const CreateStruct rCreateStruct,
Tgl::Renderer pRenderer,
Tgl::Group pScene 
)
virtual

[AI] Creates and initializes the surface, rendering device, and optionally installs scene graph.

[AI] This function selects the appropriate color, shading and texturing models for the provided DDraw surfaces, configures texture and color settings based on device format, and initializes the view/camera and rendering statistics. Subclassed implementations will usually handle advanced device and scene graph setup.

Parameters
rCreateStruct[AI] Initialization parameters (window, buffers, palette etc.).
pRenderer[AI] Renderer used to create and manage 3D device and scene.
pScene[AI] Top-level Tgl::Group representing the 3D scene graph root.
Return values
TRUE[AI] On successful device/view/scene setup.
FALSE[AI] If device/view failed to create/setup.

Definition at line 76 of file tglsurface.cpp.

◆ CreateView()

virtual Tgl::View * TglSurface::CreateView ( Tgl::Renderer ,
Tgl::Device  
)
protectedpure virtual

[AI] Abstract view creation.

Subclasses must override to provide appropriate view/camera for the surface.

Parameters
pRenderer[AI] The renderer with which to associate the new view.
pDevice[AI] The device on which this view will be rendered.
Returns
[AI] Pointer to the created Tgl::View, or nullptr on failure.

Implemented in LegoView.

◆ Destroy()

void TglSurface::Destroy ( )
virtual

[AI] Destroys all resources (view, device), releasing scene and renderer references.

[AI] Safe to call multiple times, always results in idle/inert surface.

Reimplemented in Lego3DView, LegoView, and LegoView1.

Definition at line 45 of file tglsurface.cpp.

◆ DestroyView()

void TglSurface::DestroyView ( )
protectedvirtual

[AI] Destroys (deletes) the surface's view/camera, and resets the pointer to null.

[AI] Provided for use in cleanup and destruction workflows. Safe to call if view is null. [AI]

Definition at line 171 of file tglsurface.cpp.

◆ GetDevice()

Tgl::Device * TglSurface::GetDevice ( ) const
inline

[AI] Returns the graphics device used by this surface, e.g.

hardware or software abstraction.

Returns
[AI] Device instance, or nullptr if not ready.

Definition at line 102 of file tglsurface.h.

◆ GetFrameCount()

unsigned long TglSurface::GetFrameCount ( ) const
inline

[AI] Returns the frame count since creation or since last meter reset.

[AI] Used for diagnostics, animation timing, or display statistics.

Definition at line 144 of file tglsurface.h.

◆ GetFrameRate()

double TglSurface::GetFrameRate ( ) const
inline

[AI] Returns the measured frame rate (frames per second) for the current surface.

[AI] Uses the frame rate frequency meter to report the last few frames' average rate. [AI]

Definition at line 138 of file tglsurface.h.

◆ GetHeight()

unsigned long TglSurface::GetHeight ( ) const
inline

[AI] Returns the height (in pixels) of the rendered surface.

Returns
[AI] The current device height.

Definition at line 126 of file tglsurface.h.

◆ GetRenderer()

Tgl::Renderer * TglSurface::GetRenderer ( ) const
inline

[AI] Gets the active renderer for this surface.

Returns
[AI] Renderer instance, or nullptr if not created.

Definition at line 96 of file tglsurface.h.

◆ GetRenderingRate()

double TglSurface::GetRenderingRate ( ) const
inline

[AI] Returns the measured rendering rate (frames per second) for the rendering routine.

[AI] Uses the rendering rate frequency meter to report recent rendering rate. [AI]

Definition at line 132 of file tglsurface.h.

◆ GetScene()

Tgl::Group * TglSurface::GetScene ( ) const
inline

[AI] Returns the currently attached 3D scene root/group.

Returns
[AI] Scene group pointer, or nullptr if not attached.

Definition at line 114 of file tglsurface.h.

◆ GetView()

Tgl::View * TglSurface::GetView ( ) const
inline

[AI] Gets the current view/camera for this surface.

Returns
[AI] View/camera pointer.

Definition at line 108 of file tglsurface.h.

◆ GetWidth()

unsigned long TglSurface::GetWidth ( ) const
inline

[AI] Returns the width (in pixels) of the rendered surface.

Returns
[AI] The current device width.

Definition at line 120 of file tglsurface.h.

◆ Render()

double TglSurface::Render ( )
virtual

[AI] Renders a single frame and returns the render time for that frame.

[AI] Uses and updates the statistics meters for framerate and rendering time monitoring. Handles view-calling and statistics upkeep.

Returns
[AI] Elapsed render time in seconds for the completed frame.

Definition at line 179 of file tglsurface.cpp.


The documentation for this class was generated from the following files: