ScummVM API documentation
Material_Fallback01_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_FALLBACK01_BASE_LIGHT_H
29 #define HPL_MATERIAL_FALLBACK01_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 
35 #include "hpl1/engine/graphics/Material_BaseLight.h"
36 
37 namespace hpl {
38 
39 //---------------------------------------------------------------
40 
42 public:
43  iMaterial_Fallback01_BaseLight(bool abNormalMap, bool abSpecular,
44  const tString &asName, iLowLevelGraphics *apLowLevelGraphics,
45  cImageManager *apImageManager, cTextureManager *apTextureManager,
46  cRenderer2D *apRenderer, cGpuProgramManager *apProgramManager,
47  eMaterialPicture aPicture, cRenderer3D *apRenderer3D);
48 
50 
51  tTextureTypeList GetTextureTypes();
52 
53  bool UsesType(eMaterialRenderType aType);
54 
55  iGpuProgram *getGpuProgram(const eMaterialRenderType aType, const int alPass, iLight3D *apLight);
56  iMaterialProgramSetup *getGpuProgramSetup(const eMaterialRenderType aType, const int alPass, iLight3D *apLight);
57 
58  bool VertexProgramUsesLight(eMaterialRenderType aType, int alPass, iLight3D *apLight);
59  bool VertexProgramUsesEye(eMaterialRenderType aType, int alPass, iLight3D *apLight);
60 
61  eMaterialAlphaMode GetAlphaMode(eMaterialRenderType aType, int alPass, iLight3D *apLight);
62  eMaterialBlendMode GetBlendMode(eMaterialRenderType aType, int alPass, iLight3D *apLight);
63  eMaterialChannelMode GetChannelMode(eMaterialRenderType aType, int alPass, iLight3D *apLight);
64 
65  iTexture *GetTexture(int alUnit, eMaterialRenderType aType, int alPass, iLight3D *apLight);
66  eMaterialBlendMode GetTextureBlend(int alUnit, eMaterialRenderType aType, int alPass, iLight3D *apLight);
67 
68  int GetNumOfPasses(eMaterialRenderType aType, iLight3D *apLight);
69 
71  // Old and worthless stuff, only used by 2D renderer
72  void Compile() {}
73  bool StartRendering(eMaterialRenderType aType, iCamera *apCam, iLight *pLight) { return false; }
74  void EndRendering(eMaterialRenderType aType) {}
75  tVtxBatchFlag GetBatchFlags(eMaterialRenderType aType) { return 0; }
76  bool NextPass(eMaterialRenderType aType) { return false; }
77  bool HasMultiplePasses(eMaterialRenderType aType) { return false; }
78  eMaterialType GetType(eMaterialRenderType aType) { return eMaterialType_Diffuse; }
79  void EditVertexes(eMaterialRenderType aType, iCamera *apCam, iLight *pLight,
80  tVertexVec *apVtxVec, cVector3f *apTransform, unsigned int alIndexAdd) {}
81 
82 protected:
83  iTexture *mpNormalizationMap;
84  iTexture *mpSpotNegativeRejectMap;
85 
86  // properties to set
87  bool mbUseSpecular;
88  bool mbUseNormalMap;
89 
90  bool mbUsesTwoPassSpot;
91 
92  iTexture *mpAttenuationMap;
93 
94  iGpuProgram *_programs[eBaseLightProgram_LastEnum];
95  iGpuProgram *_diffuseShader;
96  iGpuProgram *_ambientShader;
97 };
98 
100 // Diffuse
102 
104 public:
105  cMaterial_Fallback01_Diffuse(const tString &asName, iLowLevelGraphics *apLowLevelGraphics,
106  cImageManager *apImageManager, cTextureManager *apTextureManager,
107  cRenderer2D *apRenderer, cGpuProgramManager *apProgramManager,
108  eMaterialPicture aPicture, cRenderer3D *apRenderer3D)
109  : iMaterial_Fallback01_BaseLight(false, false,
110  asName, apLowLevelGraphics, apImageManager, apTextureManager, apRenderer, apProgramManager,
111  aPicture, apRenderer3D) {
112  }
113 };
114 
116 // Bump
118 
120 public:
121  cMaterial_Fallback01_Bump(const tString &asName, iLowLevelGraphics *apLowLevelGraphics,
122  cImageManager *apImageManager, cTextureManager *apTextureManager,
123  cRenderer2D *apRenderer, cGpuProgramManager *apProgramManager,
124  eMaterialPicture aPicture, cRenderer3D *apRenderer3D)
125  : iMaterial_Fallback01_BaseLight(true, false,
126  asName, apLowLevelGraphics, apImageManager, apTextureManager, apRenderer, apProgramManager,
127  aPicture, apRenderer3D) {
128  }
129 };
130 
131 //---------------------------------------------------------------
132 
133 } // namespace hpl
134 
135 #endif // HPL_MATERIAL_FALLBACK01_BASE_LIGHT_H
Definition: AI.h:36
Definition: str.h:59
Definition: Light3D.h:117
Definition: GpuProgramManager.h:39
Definition: Material_Fallback01_BaseLight.h:119
bool StartRendering(eMaterialRenderType aType, iCamera *apCam, iLight *pLight)
Definition: Material_Fallback01_BaseLight.h:73
Definition: Texture.h:88
Definition: list.h:44
Definition: Material_Fallback01_BaseLight.h:41
Definition: Material_Fallback01_BaseLight.h:103
Definition: Material.h:181
bool NextPass(eMaterialRenderType aType)
Definition: Material_Fallback01_BaseLight.h:76
bool HasMultiplePasses(eMaterialRenderType aType)
Definition: Material_Fallback01_BaseLight.h:77
Definition: Light.h:38
Definition: Renderer2D.h:79
Definition: Renderer3D.h:139
Definition: TextureManager.h:47
void EndRendering(eMaterialRenderType aType)
Definition: Material_Fallback01_BaseLight.h:74
tVtxBatchFlag GetBatchFlags(eMaterialRenderType aType)
Definition: Material_Fallback01_BaseLight.h:75
Definition: ImageManager.h:48
Definition: Camera.h:43
Definition: Material.h:203
Definition: LowLevelGraphics.h:200
Definition: GPUProgram.h:62
eMaterialType GetType(eMaterialRenderType aType)
Definition: Material_Fallback01_BaseLight.h:78