Cafu Engine
CaSHLWorld.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 /****************************/
8 /*** CaSHL World (Header) ***/
9 /****************************/
10 
11 #ifndef CAFU_CASHLWORLD_HPP_INCLUDED
12 #define CAFU_CASHLWORLD_HPP_INCLUDED
13 
14 #include "../Common/World.hpp"
15 
16 
17 // This switch controls the usage of normal-maps for SHL patches.
18 // Using normal-maps with SHL patches may or may not help, as explained in the appropriate code comments.
19 #define USE_NORMALMAPS 1
20 
21 
22 struct PatchT
23 {
24  ArrayT<double> SHCoeffs_UnradiatedTransfer; // SH coefficients of the transfer function that is not yet "radiated" / "shot" into the environment.
25  ArrayT<double> SHCoeffs_TotalTransfer; // SH coefficients of the (total) transfer function (that is, direct and bounce transfer).
26 
27  VectorT Coord; // Position (+safety) in world space of the center of the patch. Valid only if InsideFace==true.
28 #if USE_NORMALMAPS
29  VectorT Normal; // Normal of the patch. Derived from the normal map normals that are covered by this patch.
30 #endif
31  bool InsideFace; // InsideFace==true <==> this patch is not completely outside its face
32 };
33 
34 
35 /// This class provides the interface that is needed to compute and store the SH lighting.
37 {
38  public:
39 
40  CaSHLWorldT(const char* FileName, ModelManagerT& ModelMan, cf::GuiSys::GuiResourcesT& GuiRes);
41 
42  const cf::SceneGraph::BspTreeNodeT& GetBspTree() const { return *m_BspTree; }
43 
44  double TraceRay(const Vector3dT& Start, const Vector3dT& Ray) const;
45 
46  void PatchesToSHLMaps(const ArrayT< ArrayT<PatchT> >& Patches);
47 
48  // Forwarded functions.
49  void SaveToDisk(const char* FileName) const;
50 
51 
52  private:
53 
54  WorldT m_World;
55  const cf::SceneGraph::BspTreeNodeT* m_BspTree;
57 };
58 
59 #endif
Definition: CaSHLWorld.hpp:22
Definition: World.hpp:85
This class provides the interface that is needed to compute and store the SH lighting.
Definition: CaSHLWorld.hpp:36
The class represents a BSP Tree node, implementing the Composite design pattern.
Definition: BspTreeNode.hpp:30
This class represents a static collision model.
Definition: CollisionModel_static.hpp:25
This class is used for managing model instances.
Definition: ModelManager.hpp:31
This class manages and provides resources (fonts and models) for GuiImplT instances.
Definition: GuiResources.hpp:26