ScummVM API documentation
GPUProgram.h
1/* ScummVM - Graphic Adventure Engine
2 *
3 * ScummVM is the legal property of its developers, whose names
4 * are too numerous to list here. Please refer to the COPYRIGHT
5 * file distributed with this source distribution.
6 *
7 * This program is free software: you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation, either version 3 of the License, or
10 * (at your option) any later version.
11 *
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with this program. If not, see <http://www.gnu.org/licenses/>.
19 *
20 */
21
22/*
23 * Copyright (C) 2006-2010 - Frictional Games
24 *
25 * This file is part of HPL1 Engine.
26 */
27
28#ifndef HPL_GPU_PROGRAM_H
29#define HPL_GPU_PROGRAM_H
30
31#include "hpl1/engine/graphics/GraphicsTypes.h"
32#include "hpl1/engine/math/MathTypes.h"
33#include "hpl1/engine/resources/ResourceBase.h"
34#include "hpl1/engine/system/SystemTypes.h"
35
36namespace hpl {
37
38class iTexture;
39
40enum eGpuProgramType {
41 eGpuProgramType_Vertex,
42 eGpuProgramType_Fragment,
43 eGpuProgramType_LastEnum
44};
45
46enum eGpuProgramMatrix {
47 eGpuProgramMatrix_View,
48 eGpuProgramMatrix_Projection,
49 eGpuProgramMatrix_Texture,
50 eGpuProgramMatrix_ViewProjection,
51 eGpuProgramMatrix_LastEnum
52};
53
54enum eGpuProgramMatrixOp {
55 eGpuProgramMatrixOp_Identity,
56 eGpuProgramMatrixOp_Inverse,
57 eGpuProgramMatrixOp_Transpose,
58 eGpuProgramMatrixOp_InverseTranspose,
59 eGpuProgramMatrixOp_LastEnum
60};
61
62class iGpuProgram : public iResourceBase {
63public:
64 iGpuProgram(const tString &asName) : iResourceBase(asName, 0) {
65 }
66 virtual ~iGpuProgram() {}
67
68 static void SetLogDebugInformation(bool abX) { mbDebugInfo = abX; }
69
73 virtual void Bind() = 0;
77 virtual void UnBind() = 0;
78
79 virtual bool SetFloat(const tString &asName, float afX) = 0;
80
81 bool SetVec2f(const tString &asName, const cVector2f avVec) {
82 return SetVec2f(asName, avVec.x, avVec.y);
83 }
84 virtual bool SetVec2f(const tString &asName, float afX, float afY) = 0;
85
86 bool SetVec3f(const tString &asName, const cVector3f &avVec) {
87 return SetVec3f(asName, avVec.x, avVec.y, avVec.z);
88 }
89 bool SetColor3f(const tString &asName, const cColor &aCol) {
90 return SetVec3f(asName, aCol.r, aCol.g, aCol.b);
91 }
92 virtual bool SetVec3f(const tString &asName, float afX, float afY, float afZ) = 0;
93
94 bool SetColor4f(const tString &asName, const cColor &aCol) {
95 return SetVec4f(asName, aCol.r, aCol.g, aCol.b, aCol.a);
96 }
97 virtual bool SetVec4f(const tString &asName, float afX, float afY, float afZ, float afW) = 0;
98
99 virtual bool SetMatrixf(const tString &asName, const cMatrixf &mMtx) = 0;
100 virtual bool SetMatrixf(const tString &asName, eGpuProgramMatrix mType,
101 eGpuProgramMatrixOp mOp) = 0;
102
103protected:
104 static bool mbDebugInfo;
105};
106
107} // namespace hpl
108
109#endif // HPL_GPU_PROGRAM_H
Definition: str.h:59
Definition: GPUProgram.h:62
virtual void Bind()=0
virtual void UnBind()=0
Definition: ResourceBase.h:36