ScummVM API documentation
Beam.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_BEAM_H
29 #define HPL_BEAM_H
30 
31 #include "RenderList.h"
32 #include "hpl1/engine/graphics/GraphicsTypes.h"
33 #include "hpl1/engine/graphics/Renderable.h"
34 #include "hpl1/engine/math/MathTypes.h"
35 #include "hpl1/engine/scene/Entity3D.h"
36 #include "hpl1/engine/system/SystemTypes.h"
37 
38 namespace hpl {
39 
40 class cMaterialManager;
41 class cResources;
42 class cGraphics;
43 class cFileSearcher;
44 class iLowLevelGraphics;
45 class iMaterial;
46 class iVertexBuffer;
47 
48 //------------------------------------------
49 
50 class cBeam;
51 class cBeamEnd : public iEntity3D {
52  friend class cBeam;
53  friend class cBeamEnd_UpdateCallback;
54 
55 public:
56  cBeamEnd(const tString asName, cBeam *apBeam) : iEntity3D(asName),
57  mColor(1, 1), mpBeam(apBeam) {}
58 
59  void SetColor(const cColor &aColor);
60  const cColor &GetColor() { return mColor; }
61 
63  // Entity implementation
64  tString GetEntityType() { return "BeamEnd"; }
65 
66 private:
67  cColor mColor;
68  cBeam *mpBeam;
69 };
70 
71 //------------------------------------------
72 
74 public:
75  void OnTransformUpdate(iEntity3D *apEntity);
76 };
77 
78 //------------------------------------------
79 
80 class cBeam : public iRenderable {
81  typedef iRenderable super;
82  friend class cBeamEnd;
83 
84 public:
85  cBeam(const tString asName, cResources *apResources, cGraphics *apGraphics);
86  ~cBeam();
87 
88  void SetMaterial(iMaterial *apMaterial);
89 
90  const tString &GetFileName() { return msFileName; }
91 
96  void SetSize(const cVector2f &avSize);
97  cVector2f GetSize() { return mvSize; }
98 
99  void SetColor(const cColor &aColor);
100  const cColor &GetColor() { return mColor; }
101 
102  void SetTileHeight(bool abX);
103  bool GetTileHeight() { return mbTileHeight; }
104 
105  void SetMultiplyAlphaWithColor(bool abX);
106  bool GetMultiplyAlphaWithColor() { return mbMultiplyAlphaWithColor; }
107 
108  cBeamEnd *GetEnd() { return mpEnd; }
109 
110  bool LoadXMLProperties(const tString asFile);
111 
112  cVector3f GetAxis() { return mvAxis; }
113  cVector3f GetMidPosition() { return mvMidPosition; }
114 
116  // Entity implementation
117  tString GetEntityType() { return "Beam"; }
118 
119  bool IsVisible();
120  void SetVisible(bool abVisible) { SetRendered(abVisible); }
121 
122  // Renderable implementations
123  iMaterial *GetMaterial() { return mpMaterial; }
124  iVertexBuffer *GetVertexBuffer() { return mpVtxBuffer; }
125 
126  void UpdateGraphics(cCamera3D *apCamera, float afFrameTime, cRenderList *apRenderList);
127 
128  bool IsShadowCaster() { return false; }
129 
130  cBoundingVolume *GetBoundingVolume();
131 
132  cMatrixf *GetModelMatrix(cCamera3D *apCamera);
133 
134  int GetMatrixUpdateCount();
135 
136  eRenderableType GetRenderType() { return eRenderableType_ParticleSystem; }
137 
138 private:
139  cMaterialManager *mpMaterialManager;
140  cFileSearcher *mpFileSearcher;
141  iLowLevelGraphics *mpLowLevelGraphics;
142 
143  iMaterial *mpMaterial;
144  iVertexBuffer *mpVtxBuffer;
145 
146  cBeamEnd *mpEnd;
147 
148  tString msFileName;
149 
150  int mlStartTransformCount;
151  int mlEndTransformCount;
152 
153  cMatrixf m_mtxTempTransform;
154 
155  int mlLastRenderCount;
156 
157  cBeamEnd_UpdateCallback mEndCallback;
158 
159  cVector2f mvSize;
160 
161  cVector3f mvAxis;
162  cVector3f mvMidPosition;
163 
164  bool mbTileHeight;
165  bool mbMultiplyAlphaWithColor;
166 
167  cColor mColor;
168 };
169 
170 } // namespace hpl
171 
172 #endif // HPL_BEAM_H
Definition: AI.h:36
Definition: Beam.h:73
Definition: str.h:59
Definition: VertexBuffer.h:90
Definition: MaterialManager.h:41
Definition: Beam.h:51
Definition: BoundingVolume.h:71
Definition: Renderable.h:70
Definition: FileSearcher.h:43
Definition: RenderList.h:145
Definition: Resources.h:160
Definition: Color.h:37
Definition: Entity3D.h:81
Definition: Material.h:203
Definition: Entity3D.h:44
Definition: Graphics.h:46
Definition: LowLevelGraphics.h:200
Definition: Camera3D.h:53
Definition: Beam.h:80