Cafu Engine
PatchMesh.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_PATCH_MESH_HPP_INCLUDED
8 #define CAFU_PATCH_MESH_HPP_INCLUDED
9 
10 class MaterialT;
11 
12 
13 namespace cf
14 {
15  namespace SceneGraph
16  {
17  class GenericNodeT;
18  }
19 
20 
21  struct PatchT
22  {
23  VectorT UnradiatedEnergy; ///< The energy that has not yet been radiated into the environment (per unit time per unit area).
24  VectorT TotalEnergy; ///< The energy that this patch radiates into the environment (per unit time per unit area).
25  VectorT EnergyFromDir; ///< The main (average) direction from which the total energy arrived at the patch.
26 
27  VectorT Coord; ///< Position (+safety) in world space of the center of the patch. Valid only if InsideFace==true.
28  VectorT Normal; ///< The normal vector of the patch surface.
29  double Area; ///< The area of the patch surface.
30  bool InsideFace; ///< InsideFace==true <==> this patch is not completely outside its face.
31  };
32 
33  struct PatchMeshT
34  {
35  unsigned long Width;
36  unsigned long Height;
37  ArrayT<PatchT> Patches; ///< The patches that form this patch mesh.
38 
39  bool WrapsHorz; ///< Returns whether the patch mesh wraps "in the width". Note that if true, the extra-column at the right is *not* included in the Patches array!
40  bool WrapsVert; ///< Returns whether the patch mesh wraps "in the height". Note that if true, the extra-row at the bottom is *not* included in the Patches array!
41 
42  const cf::SceneGraph::GenericNodeT* Node; ///< The GenericNodeT this PatchMesh belongs to - quasi its "parent".
43  MaterialT* Material; ///< The MaterialT "beneath" this PatchMesh.
44 
45 
46  /// Returns the const mesh patch at (i, j).
47  const PatchT& GetPatch(unsigned long i, unsigned long j) const { assert(i<Width && j<Height); return Patches[j*Width+i]; }
48 
49  /// Returns the (non-const) mesh patch at (i, j).
50  PatchT& GetPatch(unsigned long i, unsigned long j) { assert(i<Width && j<Height); return Patches[j*Width+i]; }
51  };
52 }
53 
54 #endif
bool InsideFace
InsideFace==true <==> this patch is not completely outside its face.
Definition: PatchMesh.hpp:30
VectorT EnergyFromDir
The main (average) direction from which the total energy arrived at the patch.
Definition: PatchMesh.hpp:25
bool WrapsVert
Returns whether the patch mesh wraps "in the height". Note that if true, the extra-row at the bottom ...
Definition: PatchMesh.hpp:40
ArrayT< PatchT > Patches
The patches that form this patch mesh.
Definition: PatchMesh.hpp:37
Definition: PatchMesh.hpp:33
VectorT UnradiatedEnergy
The energy that has not yet been radiated into the environment (per unit time per unit area)...
Definition: PatchMesh.hpp:23
const cf::SceneGraph::GenericNodeT * Node
The GenericNodeT this PatchMesh belongs to - quasi its "parent".
Definition: PatchMesh.hpp:42
MaterialT * Material
The MaterialT "beneath" this PatchMesh.
Definition: PatchMesh.hpp:43
VectorT TotalEnergy
The energy that this patch radiates into the environment (per unit time per unit area).
Definition: PatchMesh.hpp:24
PatchT & GetPatch(unsigned long i, unsigned long j)
Returns the (non-const) mesh patch at (i, j).
Definition: PatchMesh.hpp:50
This class represents a surface material ("A datastructural representation of a scripts material def...
Definition: Material.hpp:22
double Area
The area of the patch surface.
Definition: PatchMesh.hpp:29
VectorT Normal
The normal vector of the patch surface.
Definition: PatchMesh.hpp:28
Definition: PatchMesh.hpp:21
const PatchT & GetPatch(unsigned long i, unsigned long j) const
Returns the const mesh patch at (i, j).
Definition: PatchMesh.hpp:47
VectorT Coord
Position (+safety) in world space of the center of the patch. Valid only if InsideFace==true.
Definition: PatchMesh.hpp:27
Definition: Renderer.hpp:16
Definition: Node.hpp:35
bool WrapsHorz
Returns whether the patch mesh wraps "in the width". Note that if true, the extra-column at the right...
Definition: PatchMesh.hpp:39