OpenBarnyard
 
Loading...
Searching...
No Matches
TRenderContextD3D Class Reference

#include <TRenderContext_DX8.h>

Inheritance diagram for TRenderContextD3D:
TRenderContext

Public Member Functions

 TRenderContextD3D (TRenderInterface *a_pRenderer)
 
 ~TRenderContextD3D ()
 
virtual void Update () override
 
void ComputePerspectiveProjection ()
 
void ComputeOrthographicProjection ()
 
void ComputePerspectiveFrustum ()
 
void ComputeOrthographicFrustum ()
 
void EnableFogHAL ()
 
void DisableFogHAL ()
 
const TMatrix44GetProjectionMatrix () const
 
- Public Member Functions inherited from TRenderContext
 TRenderContext (TRenderInterface *pRender)
 
virtual ~TRenderContext ()
 
virtual void SetModelViewMatrix (const TMatrix44 &a_rMatrix)
 
virtual void SetWorldViewMatrix (const TMatrix44 &a_rMatrix)
 
void ClearLightIDs ()
 
void AddLight (TLightID a_iLightId)
 
const PROJECTIONPARAMSGetProjectionParams () const
 
void SetProjectionParams (const PROJECTIONPARAMS &a_rParams)
 
const VIEWPORTPARAMSGetViewportParameters () const
 
void SetViewportParameters (const VIEWPORTPARAMS &a_rParams)
 
CameraMode GetCameraMode ()
 
void SetCameraMode (CameraMode a_eCameraMode)
 
void EnableFog (TBOOL a_bEnable)
 
void SetFogDistance (TFLOAT a_fStart, TFLOAT a_fEnd)
 
TFLOAT GetX () const
 
TFLOAT GetY () const
 
TFLOAT GetWidth () const
 
TFLOAT GetHeight () const
 
TBOOL IsFogEnabled () const
 
TBOOL IsDirty () const
 
TSkeletonInstanceGetSkeletonInstance () const
 
void SetSkeletonInstance (TSkeletonInstance *a_pSkeletonInstance)
 
TUINT GetClipFlags () const
 
TUINT SetClipFlags (TUINT a_uiClipFlags)
 
const TPlaneGetWorldPlanes ()
 
const TMatrix44GetViewWorldMatrix ()
 
const TMatrix44GetWorldModelMatrix ()
 
const TMatrix44GetModelWorldMatrix ()
 
const TMatrix44GetViewModelMatrix ()
 
TMatrix44GetModelViewMatrix ()
 
TMatrix44GetWorldViewMatrix ()
 
const TPlaneGetFrustumPlanes () const
 
void SetCameraObject (TCameraObject *a_pCameraObject)
 
TCameraObjectGetCameraObject () const
 
TFLOAT GetAlphaBlend () const
 
void SetAlphaBlend (TFLOAT val)
 
TFLOAT GetShadeCoeff () const
 
void SetShadeCoeff (TFLOAT val)
 
const TVector4GetAmbientColour () const
 

Static Public Member Functions

static TRenderContextD3DUpcast (TRenderContext *a_pRenderContext)
 
- Static Public Member Functions inherited from TRenderContext
static void ComputePerspectiveProjection (TMatrix44 &a_rOutProjection, const VIEWPORTPARAMS &a_rViewportParams, const PROJECTIONPARAMS &a_rProjParams)
 
static void ComputeOrthographicProjection (TMatrix44 &a_rOutProjection, const VIEWPORTPARAMS &a_rViewportParams, const PROJECTIONPARAMS &a_rProjParams)
 
static void ComputePerspectiveFrustum (TFrustum &a_rcFrustum, const VIEWPORTPARAMS &a_rViewportParams, const PROJECTIONPARAMS &a_rProjParams)
 
static void ComputeOrthographicFrustum (TFrustum &a_rcFrustum, const VIEWPORTPARAMS &a_rViewportParams, const PROJECTIONPARAMS &a_rProjParams)
 
static TBOOL CullSphereToFrustumSimple (const TSphere &a_rSphere, const TPlane *a_pPlanes, TINT a_iNumPlanes)
 
static TINT CullSphereToFrustum (const TSphere &a_rSphere, const TPlane *a_pPlanes, TINT a_iClipFlags, TINT a_iClipFlagsMask)
 

Additional Inherited Members

- Public Types inherited from TRenderContext
enum  FLAG_ : FLAG {
  FLAG_DIRTY = BITFLAG( 0 ) , FLAG_FOG = BITFLAG( 1 ) , FLAG_HAS_MODELWORLDMATRIX = BITFLAG( 2 ) , FLAG_HAS_VIEWWORLDMATRIX = BITFLAG( 3 ) ,
  FLAG_UNK3 = BITFLAG( 4 ) , FLAG_UNK4 = BITFLAG( 5 ) , FLAG_HAS_WORLDPLANES = BITFLAG( 6 ) , FLAG_UNK6 = BITFLAG( 7 ) ,
  FLAG_DIRTY_WORLDMODELMATRIX = BITFLAG( 8 ) , FLAG_DIRTY_VIEWMODELMATRIX = BITFLAG( 9 )
}
 
enum  CameraMode_ : CameraMode { CameraMode_Perspective , CameraMode_Orthographic }
 
typedef TUINT32 FLAG
 
typedef TUINT32 CameraMode
 
- Protected Member Functions inherited from TRenderContext
void SetDirty (TBOOL a_bDirty)
 
void SetFlag (FLAG a_eFlag, TBOOL a_bEnable)
 
- Protected Attributes inherited from TRenderContext
TRenderInterfacem_pRenderer
 
FLAG m_eFlags
 
TUINT m_eClipFlags
 
TUINT m_Unk
 
CameraMode m_eCameraMode
 
VIEWPORTPARAMS m_oViewportParams
 
PROJECTIONPARAMS m_oProjParams
 
TSkeletonInstancem_pCurrentSkeletonInstance
 
TMatrix44 m_oModelViewMatrix
 
TMatrix44 m_oWorldViewMatrix
 
TMatrix44 m_oModelWorldMatrix
 
TMatrix44 m_oViewWorldMatrix
 
TVector4 m_AmbientColor
 
TVector4 m_FogColor
 
TFLOAT m_fFogDistanceStart
 
TFLOAT m_fFogDistanceEnd
 
TFrustum m_aFrustumPlanes1
 
TFrustum m_aWorldPlanes
 
TFrustum m_aFrustumPlanes2
 
TMatrix44 m_oWorldModelMatrix
 
TMatrix44 m_oViewModelMatrix
 
TFLOAT m_fAlphaBlend
 
TFLOAT m_fShadeCoeff
 
TLightIDList m_oLightIds
 
TCameraObjectm_pCurrentCameraObject
 

Detailed Description

Definition at line 6 of file TRenderContext_DX8.h.

Constructor & Destructor Documentation

◆ TRenderContextD3D()

TRenderContextD3D::TRenderContextD3D ( TRenderInterface * a_pRenderer)

Definition at line 79 of file TRenderContext_DX8.cpp.

80 : TRenderContext( a_pRenderer )
81{
82}
TRenderContext(TRenderInterface *pRender)

◆ ~TRenderContextD3D()

TRenderContextD3D::~TRenderContextD3D ( )

Definition at line 85 of file TRenderContext_DX8.cpp.

86{
87}

Member Function Documentation

◆ ComputeOrthographicFrustum()

void TRenderContextD3D::ComputeOrthographicFrustum ( )

Definition at line 40 of file TRenderContext_DX8.cpp.

41{
43
44 // Copy planes
51}
@ WORLDPLANE_BOTTOM
@ WORLDPLANE_TOP
@ WORLDPLANE_RIGHT
@ WORLDPLANE_FAR
@ WORLDPLANE_NEAR
@ WORLDPLANE_LEFT
PROJECTIONPARAMS m_oProjParams
static void ComputeOrthographicFrustum(TFrustum &a_rcFrustum, const VIEWPORTPARAMS &a_rViewportParams, const PROJECTIONPARAMS &a_rProjParams)
TFrustum m_aFrustumPlanes1
VIEWPORTPARAMS m_oViewportParams
TFrustum m_aFrustumPlanes2

◆ ComputeOrthographicProjection()

void TRenderContextD3D::ComputeOrthographicProjection ( )

Definition at line 20 of file TRenderContext_DX8.cpp.

21{
23}
static void ComputeOrthographicProjection(TMatrix44 &a_rOutProjection, const VIEWPORTPARAMS &a_rViewportParams, const PROJECTIONPARAMS &a_rProjParams)

◆ ComputePerspectiveFrustum()

void TRenderContextD3D::ComputePerspectiveFrustum ( )

◆ ComputePerspectiveProjection()

void TRenderContextD3D::ComputePerspectiveProjection ( )

Definition at line 14 of file TRenderContext_DX8.cpp.

15{
17}
static void ComputePerspectiveProjection(TMatrix44 &a_rOutProjection, const VIEWPORTPARAMS &a_rViewportParams, const PROJECTIONPARAMS &a_rProjParams)

◆ DisableFogHAL()

void TRenderContextD3D::DisableFogHAL ( )

Definition at line 70 of file TRenderContext_DX8.cpp.

71{
72 auto pRenderer = TSTATICCAST( TRenderD3DInterface, m_pRenderer );
73 auto pDevice = pRenderer->GetDirect3DDevice();
74
75 pDevice->SetRenderState( D3DRS_FOGENABLE, FALSE );
76}
#define TSTATICCAST(POINTERTYPE, VALUE)
Definition Defines.h:69
TRenderInterface * m_pRenderer

◆ EnableFogHAL()

void TRenderContextD3D::EnableFogHAL ( )

Definition at line 54 of file TRenderContext_DX8.cpp.

55{
56 auto pRenderer = TSTATICCAST( TRenderD3DInterface, m_pRenderer );
57 auto pDevice = pRenderer->GetDirect3DDevice();
58
59 pDevice->SetRenderState( D3DRS_FOGENABLE, TRUE );
60 pDevice->SetRenderState( D3DRS_FOGTABLEMODE, D3DFOG_LINEAR );
61 pDevice->SetRenderState(
62 D3DRS_FOGCOLOR,
63 ( ( ( TUINT8( m_FogColor.x * 255.0f ) << 8 ) | TUINT8( m_FogColor.y * 255.0f ) ) << 8 ) | TUINT8( m_FogColor.z * 255.0f )
64 );
65
66 pDevice->SetRenderState( D3DRS_FOGSTART, *TREINTERPRETCAST( DWORD*, &m_fFogDistanceStart ) );
67 pDevice->SetRenderState( D3DRS_FOGEND, *TREINTERPRETCAST( DWORD*, &m_fFogDistanceEnd ) );
68}
#define TREINTERPRETCAST(TYPE, VALUE)
Definition Defines.h:68
uint8_t TUINT8
Definition Typedefs.h:17
TFLOAT m_fFogDistanceStart

◆ GetProjectionMatrix()

const TMatrix44 & TRenderContextD3D::GetProjectionMatrix ( ) const
inline

Definition at line 23 of file TRenderContext_DX8.h.

23{ return m_Projection; }

◆ Upcast()

static TRenderContextD3D * TRenderContextD3D::Upcast ( TRenderContext * a_pRenderContext)
inlinestatic

Definition at line 25 of file TRenderContext_DX8.h.

26 {
27 return TSTATICCAST( TRenderContextD3D, a_pRenderContext );
28 }
TRenderContextD3D(TRenderInterface *a_pRenderer)

◆ Update()

void TRenderContextD3D::Update ( )
overridevirtual

Implements TRenderContext.

Definition at line 90 of file TRenderContext_DX8.cpp.

91{
92 if ( IsDirty() )
93 {
95 {
98 }
99 else
100 {
103 }
104
105 auto pRenderer = TSTATICCAST( TRenderD3DInterface, m_pRenderer );
106 pRenderer->GetDirect3DDevice()->SetTransform( D3DTS_VIEW, TREINTERPRETCAST( D3DMATRIX*, &TMatrix44::IDENTITY ) );
107 pRenderer->GetDirect3DDevice()->SetTransform( D3DTS_PROJECTION, TREINTERPRETCAST( D3DMATRIX*, &m_Projection ) );
108 }
109}
static constinit TMatrix44 IDENTITY
Definition TMatrix44.h:357
CameraMode m_eCameraMode
TBOOL IsDirty() const

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