-
Notifications
You must be signed in to change notification settings - Fork 0
/
Direct3D.h
46 lines (40 loc) · 923 Bytes
/
Direct3D.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
#pragma once
struct CUSTOMVERTEX
{
float x, y, z;
DWORD color;
float uv, ux;
void SetVtx(float _x, float _y, float _z)
{
x = _x;
y = _y;
z = _z;
}
void SetColor(int r, int g, int b, int a)
{
//color = a << 24 | r << 16 | g << 8 | b;
color = a << 24 | r << 16 | g << 8 | b;
}
void SetUV(float _uv, float _ux)
{
uv = _uv;
ux = _ux;
}
};
#define D3DFVF_CUSTOMVERTEX (D3DFVF_XYZ|D3DFVF_DIFFUSE|D3DFVF_TEX2)
class CDirect3D:public CSingleInstance<CDirect3D>
{
public:
LPDIRECT3D9 g_pD3D = NULL; // Used to create the D3DDevice
LPDIRECT3DDEVICE9 g_pd3dDevice = NULL; // Our rendering device
const bool isWindowed = TRUE;
const DWORD dScnX = 1920, dScnY = 1080;
public:
CDirect3D();
virtual ~CDirect3D();
HRESULT InitD3D(HWND hWnd);
VOID Cleanup();
VOID SetupMatrices();
VOID Render();
LPDIRECT3DTEXTURE9 LoadTextureFromFile(LPCSTR filename, D3DXIMAGE_INFO * info);
};