OpenBarnyard
 
Loading...
Searching...
No Matches
TRenderContext_DX8.cpp
Go to the documentation of this file.
1#include "ToshiPCH.h"
4
5//-----------------------------------------------------------------------------
6// Enables memory debugging.
7// Note: Should be the last include!
8//-----------------------------------------------------------------------------
10
12
13// $Barnyard: FUNCTION 006d6c80
18
19// $Barnyard: FUNCTION 006d6f80
24
25// $Barnyard: FUNCTION 006d6d30
38
39// $Barnyard: FUNCTION 006d7030
52
53// $Barnyard: FUNCTION 006d7220
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}
69
71{
72 auto pRenderer = TSTATICCAST( TRenderD3DInterface, m_pRenderer );
73 auto pDevice = pRenderer->GetDirect3DDevice();
74
75 pDevice->SetRenderState( D3DRS_FOGENABLE, FALSE );
76}
77
78// $Barnyard: FUNCTION 006d6c60
80 : TRenderContext( a_pRenderer )
81{
82}
83
84// $Barnyard: FUNCTION 006d72e0
88
89// $Barnyard: FUNCTION 006d7310
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}
110
@ WORLDPLANE_BOTTOM
@ WORLDPLANE_TOP
@ WORLDPLANE_RIGHT
@ WORLDPLANE_FAR
@ WORLDPLANE_NEAR
@ WORLDPLANE_LEFT
#define TSTATICCAST(POINTERTYPE, VALUE)
Definition Defines.h:69
#define TREINTERPRETCAST(TYPE, VALUE)
Definition Defines.h:68
#define TOSHI_NAMESPACE_START
Definition Defines.h:47
#define TOSHI_NAMESPACE_END
Definition Defines.h:50
uint8_t TUINT8
Definition Typedefs.h:17
static constinit TMatrix44 IDENTITY
Definition TMatrix44.h:357
TRenderContextD3D(TRenderInterface *a_pRenderer)
virtual void Update() override
DirectX 8 implementation of the render interface Handles DirectX 8 specific rendering functionality a...
PROJECTIONPARAMS m_oProjParams
TRenderContext(TRenderInterface *pRender)
CameraMode m_eCameraMode
static void ComputeOrthographicFrustum(TFrustum &a_rcFrustum, const VIEWPORTPARAMS &a_rViewportParams, const PROJECTIONPARAMS &a_rProjParams)
TFrustum m_aFrustumPlanes1
TFLOAT m_fFogDistanceStart
VIEWPORTPARAMS m_oViewportParams
static void ComputeOrthographicProjection(TMatrix44 &a_rOutProjection, const VIEWPORTPARAMS &a_rViewportParams, const PROJECTIONPARAMS &a_rProjParams)
TRenderInterface * m_pRenderer
TFrustum m_aFrustumPlanes2
static void ComputePerspectiveProjection(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)
TBOOL IsDirty() const