OpenBarnyard
 
Loading...
Searching...
No Matches
AGrassMaterialHAL_DX8.cpp
Go to the documentation of this file.
1#include "pch.h"
3
7
8//-----------------------------------------------------------------------------
9// Enables memory debugging.
10// Note: Should be the last include!
11//-----------------------------------------------------------------------------
12#include <Core/TMemoryDebugOn.h>
13
15
17
22
23// $Barnyard: FUNCTION 005f80c0
24// $Barnyard: FUNCTION 005f8810
28
29// $Barnyard: FUNCTION 005f8120
31{
33 TRenderContextD3D* pCurrentContext = TRenderContextD3D::Upcast( pRenderInterface->GetCurrentContext() );
34 IDirect3DDevice8* pDevice = pRenderInterface->GetDirect3DDevice();
36
37 extern TTextureResourceHAL* g_pGrassShaderTerrainTexture; // AGrassShaderHAL_DX8.cpp
39
40 if ( pTextureHAL )
41 {
42 pTextureHAL->Validate();
43
44 if ( pTextureHAL->GetD3DTexture() )
45 {
46 pDevice->SetTexture( 0, pTextureHAL->GetD3DTexture() );
47 pRenderInterface->SetTextureAddress( 0, pTextureHAL->GetAddressing(), TEXCOORD_UV );
48 }
49 }
50
51 if ( m_Flags & FLAGS_NO_CULL )
52 pDevice->SetRenderState( D3DRS_CULLMODE, 1 );
53
54 switch ( m_eBlendMode )
55 {
56 case 0:
57 pDevice->SetRenderState( D3DRS_SRCBLEND, 5 );
58 pDevice->SetRenderState( D3DRS_DESTBLEND, 6 );
59 pDevice->SetRenderState( D3DRS_ZWRITEENABLE, TRUE );
60 break;
61 case 1:
62 pDevice->SetRenderState( D3DRS_SRCBLEND, 5 );
63 pDevice->SetRenderState( D3DRS_DESTBLEND, 6 );
64 pDevice->SetRenderState( D3DRS_ZWRITEENABLE, FALSE );
65 break;
66 case 2:
67 pDevice->SetRenderState( D3DRS_SRCBLEND, 1 );
68 pDevice->SetRenderState( D3DRS_DESTBLEND, 3 );
69 pDevice->SetRenderState( D3DRS_ZWRITEENABLE, FALSE );
70 break;
71 case 3:
72 pDevice->SetRenderState( D3DRS_SRCBLEND, 5 );
73 pDevice->SetRenderState( D3DRS_DESTBLEND, 2 );
74 pDevice->SetRenderState( D3DRS_ZWRITEENABLE, FALSE );
75 break;
76 }
77
78 pCurrentContext->EnableFogHAL();
79}
80
81// $Barnyard: FUNCTION 005f8220
83{
85 IDirect3DDevice8* pDevice = pRenderInterface->GetDirect3DDevice();
86
87 if ( m_Flags & FLAGS_NO_CULL )
88 pDevice->SetRenderState( D3DRS_CULLMODE, 2 );
89
90 pRenderInterface->SetTextureAddress( 0, ADDRESSINGMODE_WRAP, TEXCOORD_UV );
91 pDevice->SetTexture( 0, TNULL );
92 pDevice->SetRenderState( D3DRS_ZWRITEENABLE, TRUE );
93}
@ ADDRESSINGMODE_WRAP
Definition TRender.h:40
@ TEXCOORD_UV
Definition TRender.h:29
#define TSTATICCAST(POINTERTYPE, VALUE)
Definition Defines.h:69
#define TOSHI_NAMESPACE_USING
Definition Defines.h:46
#define TDEFINE_CLASS(...)
Definition TObject.h:120
#define TNULL
Definition Typedefs.h:23
TTextureResourceHAL * g_pGrassShaderTerrainTexture
static TRenderContextD3D * Upcast(TRenderContext *a_pRenderContext)
DirectX 8 implementation of the render interface Handles DirectX 8 specific rendering functionality a...
TFORCEINLINE IDirect3DDevice8 * GetDirect3DDevice() const
Gets the Direct3D device.
static TFORCEINLINE TRenderD3DInterface * Interface()
Gets the render interface singleton.
void SetTextureAddress(TINT a_iStage, ADDRESSINGMODE a_eAddressing, TEXCOORD a_eTextureCoordinate=TEXCOORD_UV)
Sets texture addressing mode.
IDirect3DTexture8 * GetD3DTexture()
virtual TBOOL Validate() override
ADDRESSINGMODE GetAddressing() const
Definition TTexture.h:55
TRenderContext * GetCurrentContext() const
virtual void PostRender() override
virtual void PreRender() override
BLENDMODE m_eBlendMode
Toshi::TTexture * m_aTextures[AWorldMaterial::MAX_TEXTURES]