Cafu Engine
LightMapMan.hpp
1 /*
2 Cafu Engine, http://www.cafu.de/
3 Copyright (c) Carsten Fuchs and other contributors.
4 This project is licensed under the terms of the MIT license.
5 */
6 
7 #ifndef CAFU_SCENEGRAPH_LIGHTMAP_MANAGER_HPP_INCLUDED
8 #define CAFU_SCENEGRAPH_LIGHTMAP_MANAGER_HPP_INCLUDED
9 
10 #include "Templates/Array.hpp"
11 
12 struct BitmapT;
13 
14 namespace MatSys
15 {
16  class TextureMapI;
17 }
18 
19 
20 namespace cf
21 {
22  namespace SceneGraph
23  {
24  /// This class manages lightmaps, e.g. by "allocating" rectangular areas in larger bitmaps.
26  {
27  public:
28 
29  static const unsigned int SIZE_S;
30  static const unsigned int SIZE_T;
31  static const unsigned int INIT_COLOR1;
32  static const unsigned int INIT_COLOR2;
33 
34  /// The constructor.
35  LightMapManT();
36 
37  /// The destructor.
38  ~LightMapManT();
39 
40  /// Finds a position for a rectangular lightmap within LightMaps[LightMaps.Size()-1].Data.
41  /// If no such position exists, a new, empty LightMapT is created and appended to the LightMaps.
42  /// Returns true on success, false on failure (i.e. if SizeS>MAX_SIZE_S || SizeT>MAX_SIZE_T).
43  bool Allocate(unsigned int SizeS, unsigned int SizeT, unsigned long& BitmapNr, unsigned int& PosS, unsigned int& PosT);
44 
45  /// Initializes the MatSys textures in the Textures and Textures2 arrays.
46  /// Gamma correction by value Gamma is applied to the textures in Textures, but not in Textures2.
47  void InitTextures(const float Gamma, const int AmbientR, const int AmbientG, const int AmbientB);
48 
49 
50  ArrayT<BitmapT*> Bitmaps;
51  ArrayT<BitmapT*> Bitmaps2;
54 
55 
56  private:
57 
58  LightMapManT(const LightMapManT&); ///< Use of the Copy Constructor is not allowed.
59  void operator = (const LightMapManT&); ///< Use of the Assignment Operator is not allowed.
60 
61  bool AllocateHelper(unsigned int SizeS, unsigned int SizeT, unsigned int& PosS, unsigned int& PosT);
62 
63  ArrayT<unsigned int> BitmapAllocated;
64  };
65  }
66 }
67 
68 #endif
This class manages lightmaps, e.g. by "allocating" rectangular areas in larger bitmaps.
Definition: LightMapMan.hpp:25
LightMapManT()
The constructor.
Definition: LightMapMan.cpp:21
void InitTextures(const float Gamma, const int AmbientR, const int AmbientG, const int AmbientB)
Initializes the MatSys textures in the Textures and Textures2 arrays.
Definition: LightMapMan.cpp:79
This class represents a RGBA bitmap.
Definition: Bitmap.hpp:20
~LightMapManT()
The destructor.
Definition: LightMapMan.cpp:28
bool Allocate(unsigned int SizeS, unsigned int SizeT, unsigned long &BitmapNr, unsigned int &PosS, unsigned int &PosT)
Finds a position for a rectangular lightmap within LightMaps[LightMaps.Size()-1].Data.
Definition: LightMapMan.cpp:51