28 #ifndef HPL_LOWLEVELGRAPHICS_H 29 #define HPL_LOWLEVELGRAPHICS_H 31 #include "hpl1/engine/graphics/GPUProgram.h" 32 #include "hpl1/engine/graphics/GraphicsTypes.h" 33 #include "hpl1/engine/graphics/Texture.h" 34 #include "hpl1/engine/graphics/VertexBuffer.h" 35 #include "hpl1/engine/graphics/bitmap2D.h" 36 #include "hpl1/engine/math/MathTypes.h" 37 #include "hpl1/engine/system/SystemTypes.h" 45 eBlendFunc_OneMinusSrcColor,
47 eBlendFunc_OneMinusDestColor,
49 eBlendFunc_OneMinusSrcAlpha,
51 eBlendFunc_OneMinusDestAlpha,
52 eBlendFunc_SrcAlphaSaturate,
57 eTextureParam_ColorFunc,
58 eTextureParam_AlphaFunc,
59 eTextureParam_ColorSource0,
60 eTextureParam_ColorSource1,
61 eTextureParam_ColorSource2,
62 eTextureParam_AlphaSource0,
63 eTextureParam_AlphaSource1,
64 eTextureParam_AlphaSource2,
65 eTextureParam_ColorOp0,
66 eTextureParam_ColorOp1,
67 eTextureParam_ColorOp2,
68 eTextureParam_AlphaOp0,
69 eTextureParam_AlphaOp1,
70 eTextureParam_AlphaOp2,
71 eTextureParam_ColorScale,
72 eTextureParam_AlphaScale,
73 eTextureParam_LastEnum
78 eTextureOp_OneMinusColor,
80 eTextureOp_OneMinusAlpha,
85 eTextureSource_Texture,
86 eTextureSource_Constant,
87 eTextureSource_Primary,
88 eTextureSource_Previous,
89 eTextureSource_LastEnum
93 eTextureFunc_Modulate,
96 eTextureFunc_Subtract,
97 eTextureFunc_AddSigned,
98 eTextureFunc_Interpolate,
100 eTextureFunc_Dot3RGBA,
101 eTextureFunc_LastEnum
107 eStencilFunc_LessOrEqual,
108 eStencilFunc_Greater,
109 eStencilFunc_GreaterOrEqual,
111 eStencilFunc_NotEqual,
113 eStencilFunc_LastEnum
119 eStencilFace_LastEnum,
122 enum eDepthTestFunc {
123 eDepthTestFunc_Never,
125 eDepthTestFunc_LessOrEqual,
126 eDepthTestFunc_Greater,
127 eDepthTestFunc_GreaterOrEqual,
128 eDepthTestFunc_Equal,
129 eDepthTestFunc_NotEqual,
130 eDepthTestFunc_Always,
131 eDepthTestFunc_LastEnum
134 enum eAlphaTestFunc {
135 eAlphaTestFunc_Never,
137 eAlphaTestFunc_LessOrEqual,
138 eAlphaTestFunc_Greater,
139 eAlphaTestFunc_GreaterOrEqual,
140 eAlphaTestFunc_Equal,
141 eAlphaTestFunc_NotEqual,
142 eAlphaTestFunc_Always,
143 eAlphaTestFunc_LastEnum
150 eStencilOp_Increment,
151 eStencilOp_Decrement,
153 eStencilOp_IncrementWrap,
154 eStencilOp_DecrementWrap,
160 eCullMode_CounterClockwise,
165 eGraphicCaps_TextureTargetRectangle,
166 eGraphicCaps_VertexBufferObject,
167 eGraphicCaps_TwoSideStencil,
169 eGraphicCaps_MaxTextureImageUnits,
170 eGraphicCaps_MaxTextureCoordUnits,
172 eGraphicCaps_AnisotropicFiltering,
173 eGraphicCaps_MaxAnisotropicFiltering,
175 eGraphicCaps_Multisampling,
177 eGraphicCaps_GL_GpuPrograms,
178 eGraphicCaps_GL_NVRegisterCombiners,
179 eGraphicCaps_GL_NVRegisterCombiners_MaxStages,
180 eGraphicCaps_GL_BlendFunctionSeparate,
181 eGraphicCaps_GL_MultiTexture,
183 eGraphicCaps_LastEnum
186 typedef tFlag tVtxBatchFlag;
188 #define eVtxBatchFlag_Normal (0x00000001) 189 #define eVtxBatchFlag_Position (0x00000002) 190 #define eVtxBatchFlag_Color0 (0x00000004) 191 #define eVtxBatchFlag_Texture0 (0x00000008) 192 #define eVtxBatchFlag_Texture1 (0x00000010) 193 #define eVtxBatchFlag_Texture2 (0x00000020) 195 #define kMaxClipPlanes (6) 198 class iOcclusionQuery;
212 virtual bool Init(
int alWidth,
int alHeight,
int alBpp,
int abFullscreen,
int alMultisampling,
213 const tString &asWindowCaption) = 0;
220 virtual int GetCaps(eGraphicCaps aType)
const = 0;
227 virtual int GetMultisampling() = 0;
240 virtual void SetMultisamplingActive(
bool abX) = 0;
242 virtual void SetGammaCorrection(
float afX) = 0;
243 virtual float GetGammaCorrection() = 0;
245 virtual void SetClipPlane(
int alIdx,
const cPlanef &aPlane) = 0;
246 virtual cPlanef GetClipPlane(
int alIdx,
const cPlanef &aPlane) = 0;
247 virtual void SetClipPlaneActive(
int alIdx,
bool abX) = 0;
252 virtual iTexture *CreateTexture(
bool abUseMipMaps, eTextureType aType, eTextureTarget aTarget) = 0;
253 virtual iTexture *CreateTexture(
const tString &asName,
bool abUseMipMaps, eTextureType aType, eTextureTarget aTarget) = 0;
254 virtual iTexture *CreateTexture(
Bitmap2D *apBmp,
bool abUseMipMaps, eTextureType aType,
255 eTextureTarget aTarget) = 0;
257 bool abUseMipMaps, eTextureType aType, eTextureTarget aTarget) = 0;
265 virtual void SaveScreenToBMP(
const tString &asFile) = 0;
269 virtual void PushMatrix(eMatrix aMtxType) = 0;
270 virtual void PopMatrix(eMatrix aMtxType) = 0;
271 virtual void SetIdentityMatrix(eMatrix aMtxType) = 0;
273 virtual void SetMatrix(eMatrix aMtxType,
const cMatrixf &a_mtxA) = 0;
275 virtual void TranslateMatrix(eMatrix aMtxType,
const cVector3f &avPos) = 0;
276 virtual void RotateMatrix(eMatrix aMtxType,
const cVector3f &avRot) = 0;
277 virtual void ScaleMatrix(eMatrix aMtxType,
const cVector3f &avScale) = 0;
279 virtual void SetOrthoProjection(
const cVector2f &avSize,
float afMin,
float afMax) = 0;
288 virtual void ClearScreen() = 0;
290 virtual void SetClearColor(
const cColor &aCol) = 0;
291 virtual void SetClearDepth(
float afDepth) = 0;
292 virtual void SetClearStencil(
int alVal) = 0;
294 virtual void SetClearColorActive(
bool abX) = 0;
295 virtual void SetClearDepthActive(
bool abX) = 0;
296 virtual void SetClearStencilActive(
bool abX) = 0;
298 virtual void SetColorWriteActive(
bool abR,
bool abG,
bool abB,
bool abA) = 0;
299 virtual void SetDepthWriteActive(
bool abX) = 0;
301 virtual void SetCullActive(
bool abX) = 0;
302 virtual void SetCullMode(eCullMode aMode) = 0;
305 virtual void SetDepthTestActive(
bool abX) = 0;
306 virtual void SetDepthTestFunc(eDepthTestFunc aFunc) = 0;
309 virtual void SetAlphaTestActive(
bool abX) = 0;
310 virtual void SetAlphaTestFunc(eAlphaTestFunc aFunc,
float afRef) = 0;
313 virtual void SetStencilActive(
bool abX) = 0;
318 virtual void SetStencil(eStencilFunc aFunc,
int alRef,
unsigned int aMask,
319 eStencilOp aFailOp, eStencilOp aZFailOp, eStencilOp aZPassOp) = 0;
320 virtual void SetStencilTwoSide(eStencilFunc aFrontFunc, eStencilFunc aBackFunc,
321 int alRef,
unsigned int aMask,
322 eStencilOp aFrontFailOp, eStencilOp aFrontZFailOp, eStencilOp aFrontZPassOp,
323 eStencilOp aBackFailOp, eStencilOp aBackZFailOp, eStencilOp aBackZPassOp) = 0;
324 virtual void SetStencilTwoSide(
bool abX) = 0;
327 virtual void SetScissorActive(
bool abX) = 0;
328 virtual void SetScissorRect(
const cRect2l &aRect) = 0;
331 virtual void SetTexture(
unsigned int alUnit,
iTexture *apTex) = 0;
332 virtual void SetActiveTextureUnit(
unsigned int alUnit) = 0;
333 virtual void SetTextureEnv(eTextureParam aParam,
int alVal) = 0;
334 virtual void SetTextureConstantColor(
const cColor &aColor) = 0;
337 virtual void SetColor(
const cColor &aColor) = 0;
340 virtual void SetBlendActive(
bool abX) = 0;
341 virtual void SetBlendFunc(eBlendFunc aSrcFactor, eBlendFunc aDestFactor) = 0;
342 virtual void SetBlendFuncSeparate(eBlendFunc aSrcFactorColor, eBlendFunc aDestFactorColor,
343 eBlendFunc aSrcFactorAlpha, eBlendFunc aDestFactorAlpha) = 0;
346 virtual iVertexBuffer *CreateVertexBuffer(tVertexFlag aFlags, eVertexBufferDrawType aDrawType,
347 eVertexBufferUsageType aUsageType,
348 int alReserveVtxSize = 0,
int alReserveIdxSize = 0) = 0;
350 virtual void DrawRect(
const cVector2f &avPos,
const cVector2f &avSize,
float afZ) = 0;
352 virtual void DrawTri(
const tVertexVec &avVtx) = 0;
353 virtual void DrawTri(
const cVertex *avVtx) = 0;
355 virtual void DrawQuad(
const tVertexVec &avVtx) = 0;
357 virtual void DrawQuad(
const tVertexVec &avVtx,
const float afZ) = 0;
358 virtual void DrawQuad(
const tVertexVec &avVtx,
const float afZ,
const cColor &aCol) = 0;
362 virtual void AddVertexToBatch(
const cVertex &apVtx) = 0;
363 virtual void AddVertexToBatch(
const cVertex *apVtx,
const cVector3f *avTransform) = 0;
364 virtual void AddVertexToBatch(
const cVertex *apVtx,
const cMatrixf *aMtx) = 0;
366 virtual void AddVertexToBatch_Size2D(
const cVertex *apVtx,
const cVector3f *avTransform,
367 const cColor *apCol,
const float &mfW,
const float &mfH) = 0;
369 virtual void AddVertexToBatch_Raw(
const cVector3f &avPos,
const cColor &aColor,
372 virtual void AddIndexToBatch(
int alIndex) = 0;
374 virtual void AddTexCoordToBatch(
unsigned int alUnit,
const cVector3f *apCoord) = 0;
375 virtual void SetBatchTextureUnitActive(
unsigned int alUnit,
bool abActive) = 0;
380 virtual void FlushTriBatch(tVtxBatchFlag aTypeFlags,
bool abAutoClear =
true) = 0;
381 virtual void FlushQuadBatch(tVtxBatchFlag aTypeFlags,
bool abAutoClear =
true) = 0;
382 virtual void ClearBatch() = 0;
387 virtual void DrawSphere(
const cVector3f &avPos,
float afRadius,
cColor aCol) = 0;
390 virtual void DrawLineRect2D(
const cRect2f &aRect,
float afZ,
cColor aCol) = 0;
391 virtual void DrawLineCircle2D(
const cVector2f &avCenter,
float afRadius,
float afZ,
cColor aCol) = 0;
393 virtual void DrawFilledRect2D(
const cRect2f &aRect,
float afZ,
cColor aCol) = 0;
420 virtual void FlushRendering() = 0;
421 virtual void SwapBuffers() = 0;
426 #endif // HPL_LOWLEVELGRAPHICS_H
Definition: VertexBuffer.h:90
virtual void FlushRenderTarget()=0
Definition: bitmap2D.h:42
Definition: font_data.h:67
virtual bool RenderTargetHasZBuffer()=0
Definition: GraphicsTypes.h:137
virtual bool Init(int alWidth, int alHeight, int alBpp, int abFullscreen, int alMultisampling, const tString &asWindowCaption)=0
virtual cVector2f GetScreenSize()=0
Definition: OcclusionQuery.h:33
virtual void SetVirtualSize(cVector2f avSize)=0
virtual void CopyContextToTexure(iTexture *apTex, const cVector2l &avPos, const cVector2l &avSize, const cVector2l &avTexOffset=0)=0
virtual void SetRenderTarget(iTexture *pTex)=0
Definition: LowLevelGraphics.h:200
virtual int GetCaps(eGraphicCaps aType) const =0
Definition: GPUProgram.h:62
virtual void ShowCursor(bool abX)=0