ScummVM API documentation
Material_BaseLight.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_MATERIAL_BASE_LIGHT_H
29#define HPL_MATERIAL_BASE_LIGHT_H
30
31#include "hpl1/engine/graphics/GPUProgram.h"
32#include "hpl1/engine/graphics/Material.h"
33#include "hpl1/engine/scene/Light3D.h"
34
35enum eBaseLightProgram {
36 eBaseLightProgram_Point1 = 0,
37 eBaseLightProgram_Point2 = 1,
38 eBaseLightProgram_Point3 = 2,
39 eBaseLightProgram_Spot1 = 3,
40 eBaseLightProgram_Spot2 = 4,
41 eBaseLightProgram_Spot3 = 5,
42 eBaseLightProgram_LastEnum = 6
43};
44
45namespace hpl {
46
48public:
49 void Setup(iGpuProgram *apProgram, cRenderSettings *apRenderSettings);
50};
51
53public:
54 iMaterial_BaseLight(const tString &asLightVertexProgram,
55 const tString &asLightFragmentProgram,
56
57 const tString &asName, iLowLevelGraphics *apLowLevelGraphics,
58 cImageManager *apImageManager, cTextureManager *apTextureManager,
59 cRenderer2D *apRenderer, cGpuProgramManager *apProgramManager,
60 eMaterialPicture aPicture, cRenderer3D *apRenderer3D);
61
62 virtual ~iMaterial_BaseLight();
63
64 tTextureTypeList GetTextureTypes();
65
66 bool UsesType(eMaterialRenderType aType);
67
68 iGpuProgram *getGpuProgram(const eMaterialRenderType aType, const int alPass, iLight3D *apLight);
69 iMaterialProgramSetup *getGpuProgramSetup(const eMaterialRenderType aType, const int alPass, iLight3D *apLight);
70
71 bool VertexProgramUsesLight(eMaterialRenderType aType, int alPass, iLight3D *apLight);
72 bool VertexProgramUsesEye(eMaterialRenderType aType, int alPass, iLight3D *apLight);
73
74 eMaterialAlphaMode GetAlphaMode(eMaterialRenderType aType, int alPass, iLight3D *apLight);
75 eMaterialBlendMode GetBlendMode(eMaterialRenderType aType, int alPass, iLight3D *apLight);
76 eMaterialChannelMode GetChannelMode(eMaterialRenderType aType, int alPass, iLight3D *apLight);
77
78 iTexture *GetTexture(int alUnit, eMaterialRenderType aType, int alPass, iLight3D *apLight);
79 eMaterialBlendMode GetTextureBlend(int alUnit, eMaterialRenderType aType, int alPass, iLight3D *apLight);
80
81 int GetNumOfPasses(eMaterialRenderType aType, iLight3D *apLight);
82
84 // Old and worthless stuff, only used by 2D renderer
85 void Compile() {}
86 bool StartRendering(eMaterialRenderType aType, iCamera *apCam, iLight *pLight) { return false; }
87 void EndRendering(eMaterialRenderType aType) {}
88 tVtxBatchFlag GetBatchFlags(eMaterialRenderType aType) { return 0; }
89 bool NextPass(eMaterialRenderType aType) { return false; }
90 bool HasMultiplePasses(eMaterialRenderType aType) { return false; }
91 eMaterialType GetType(eMaterialRenderType aType) { return eMaterialType_Diffuse; }
92 void EditVertexes(eMaterialRenderType aType, iCamera *apCam, iLight *pLight,
93 tVertexVec *apVtxVec, cVector3f *apTransform, unsigned int alIndexAdd) {}
94
95protected:
96 iTexture *mpNormalizationMap;
97 iTexture *mpSpotNegativeRejectMap;
98
99 bool mbUsesTwoPassSpot;
100
101 // properties to set
102 bool mbUseSpecular;
103 bool mbUseNormalMap;
104 bool mbUseColorSpecular;
105
106 iGpuProgram *_diffuseShader;
107 iGpuProgram *_ambientShader;
108
109 iGpuProgram *_shaders[eBaseLightProgram_LastEnum];
110};
111
112} // namespace hpl
113
114#endif // HPL_MATERIAL_BASE_LIGHT_H
Definition: list.h:44
Definition: str.h:59
Definition: Material_BaseLight.h:47
Definition: GpuProgramManager.h:39
Definition: ImageManager.h:48
Definition: Renderer3D.h:77
Definition: Renderer2D.h:79
Definition: Renderer3D.h:139
Definition: TextureManager.h:47
Definition: Camera.h:43
Definition: GPUProgram.h:62
Definition: Light3D.h:117
Definition: Light.h:38
Definition: LowLevelGraphics.h:200
Definition: Material_BaseLight.h:52
bool NextPass(eMaterialRenderType aType)
Definition: Material_BaseLight.h:89
void EndRendering(eMaterialRenderType aType)
Definition: Material_BaseLight.h:87
bool HasMultiplePasses(eMaterialRenderType aType)
Definition: Material_BaseLight.h:90
bool StartRendering(eMaterialRenderType aType, iCamera *apCam, iLight *pLight)
Definition: Material_BaseLight.h:86
eMaterialType GetType(eMaterialRenderType aType)
Definition: Material_BaseLight.h:91
tVtxBatchFlag GetBatchFlags(eMaterialRenderType aType)
Definition: Material_BaseLight.h:88
Definition: Material.h:203
Definition: Material.h:181
Definition: Texture.h:88