source: GTP/trunk/App/Demos/Geom/Shark3D/src/drv_d3d9_util.h @ 2236

Revision 2236, 2.6 KB checked in by gumbau, 17 years ago (diff)
Line 
1///////////////////////////////////////////////////////////////////////////////
2//
3//      ##  ######
4//       ######  ###
5//  ## ###############        Shark 3D Engine (www.shark3d.com)
6//   ########## # # #
7//    ########                Copyright (c) 1996-2006 Spinor GmbH.
8//   ######### # # #          All rights reserved.
9//  ##   ##########
10//      ##
11//
12///////////////////////////////////////////////////////////////////////////////
13
14//@cpp
15
16#ifndef S3D_DRV_D3D9_UTIL_H
17#define S3D_DRV_D3D9_UTIL_H
18
19#include "drv_d3d9_types.h"
20#include "drv_d3d9_prog.h"
21#include "drv_d3d9_buf.h"
22#include "sys/core/sys_float.h"
23
24///////////////////////////////////////////////////////////////////////////////
25
26void drv_d3d9_DbgPrintF(const s3d_CSysChar *FmtStr, ...);
27
28#ifdef S3D_GENERAL_DEBUG
29#define S3D_DRV_D3D9_DBGPRINTF drv_d3d9_DbgPrintF
30#else
31#define S3D_DRV_D3D9_DBGPRINTF
32#endif
33
34///////////////////////////////////////////////////////////////////////////////
35
36#define S3D_DRV_D3D9_UTIL_COLORVALUE(r, g, b, a) \
37    D3DCOLOR_RGBA( \
38        s3d_SysIntOfFloatCoarse((r) * 255.f), \
39        s3d_SysIntOfFloatCoarse((g) * 255.f), \
40        s3d_SysIntOfFloatCoarse((b) * 255.f), \
41        s3d_SysIntOfFloatCoarse((a) * 255.f))
42
43///////////////////////////////////////////////////////////////////////////////
44
45//@
46class s3d_CDrvD3d9Util
47{
48public:
49
50    //@
51    static int ColBitsOfFmt(D3DFORMAT Fmt);
52   
53    //@
54    static int DepthBitsOfFmt(D3DFORMAT Fmt);
55
56    //@
57    static bool IsDepthStencilFmt(D3DFORMAT Fmt);
58   
59    //@
60    static int StencilBitsOfFmt(D3DFORMAT Fmt);
61
62    //@
63    static D3DFORMAT LinearFmtOfSwizzledFmt(D3DFORMAT Fmt);
64
65    //@
66    static s3d_CUtilStr StrOfFmt(D3DFORMAT Fmt);
67
68    //@
69    static s3d_CUtilStr StrOfMutliSampleType(
70            D3DMULTISAMPLE_TYPE MultiSampleType);
71
72    //@
73    static void ErrorD3d(
74            s3d_CUtilMsgHandler *MsgHandler, HRESULT DxResult,
75            const char *File, int Line);
76   
77    //@
78    static s3d_CUtilStr StrOfSemantic(
79            const D3DXSEMANTIC &Semantic);
80    //@
81    static s3d_CUtilStr StrOfProgDecl(
82            const s3d_CDrvD3d9ProgDecl &ProgDecl);
83
84    //@
85    static s3d_CUtilStr StrOfVertDecl(
86            s3d_CDrvD3d9Env *Env, const s3d_CDrvD3d9VertDecl &VertDecl);
87
88    //@
89    static s3d_CUtilStr StrOfVertElemArray(
90            s3d_CSysIntps ElemCnt, const D3DVERTEXELEMENT9 *ElemArray);
91
92    //@
93    static s3d_CSysIntps SizeOfDeclType(int Type);
94
95    //@
96    static D3DRENDERSTATETYPE D3dWrapOfSamp(int Samp);
97};
98
99///////////////////////////////////////////////////////////////////////////////
100
101
102#endif
Note: See TracBrowser for help on using the repository browser.