Free Electron
SurfaceTriangles.h
Go to the documentation of this file.
1 /* Copyright (C) 2003-2021 Free Electron Organization
2  Any use of this software requires a license. If a valid license
3  was not distributed with this file, visit freeelectron.org. */
4 
5 /** @file */
6 
7 #ifndef __surface_SurfaceTriangles_h__
8 #define __surface_SurfaceTriangles_h__
9 
10 namespace fe
11 {
12 namespace ext
13 {
14 
15 /**************************************************************************//**
16  @brief Discrete Triangle Surface
17 
18  @ingroup surface
19 *//***************************************************************************/
20 class FE_DL_EXPORT SurfaceTriangles:
21  public SurfaceSearchable,
22  public CastableAs<SurfaceTriangles>
23 {
24  public:
25 
26  class FE_DL_EXPORT Impact:
27  public SurfaceSearchable::Impact,
28  public CastableAs<Impact>
29  {
30  public:
31  Impact(void)
32  {
33 #if FE_COUNTED_STORE_TRACKER
34  setName("SurfaceTriangles::Impact");
35 #endif
36  }
37  virtual ~Impact(void) {}
38 
39  virtual I32 pointIndex2(void) const
40  { return m_pointIndex2; }
41  void setPointIndex2(I32 a_pointIndex2)
42  { m_pointIndex2=a_pointIndex2; }
43 
44  virtual SpatialVector vertex2(void) const
45  { return m_vertex2; }
46  void setVertex2(SpatialVector a_vertex2)
47  { m_vertex2=a_vertex2; }
48 
49  virtual SpatialVector normal2(void) const
50  { return m_normal2; }
51  void setNormal2(SpatialVector a_normal2)
52  { m_normal2=a_normal2; }
53 
54  virtual I32 face(void)
55  { return m_face; }
56  void setFace(I32 a_face)
57  { m_face=a_face; }
58 
59  virtual void copy(sp<SpatialTreeI::Hit>& a_rspHit);
60 
61  using SurfaceSearchable::Impact::draw;
62 
63  virtual void draw(const SpatialTransform& a_rTransform,
64  sp<DrawI> a_spDrawI,
65  const fe::Color* a_pColor,
66  sp<DrawBufferI> a_spDrawBuffer,
67  sp<PartitionI> a_spPartition) const;
68 
69  private:
70  I32 m_pointIndex2;
71  SpatialVector m_vertex2;
72  SpatialVector m_normal2;
73  I32 m_face;
74  };
75 
76 
77  SurfaceTriangles(void);
78 virtual ~SurfaceTriangles(void);
79 
80  //* As SurfaceI
81 virtual void setTriangulation(Triangulation a_triangulation)
82  { m_triangulation=a_triangulation; }
83 
84  using SurfaceSearchable::sampleImpact;
85  using SurfaceSearchable::sample;
86 
87 virtual sp<ImpactI> sampleImpact(I32 a_triangleIndex,
88  SpatialBary a_barycenter,
89  SpatialVector a_tangent) const;
90 virtual SpatialTransform sample(I32 a_triangleIndex,SpatialBary a_barycenter,
91  SpatialVector a_tangent) const;
92 
93 virtual void drawInternal(BWORD a_transformed,
94  const SpatialTransform* a_pTransform,
95  sp<DrawI> a_spDrawI,
96  const fe::Color* a_pColor,
97  sp<DrawBufferI> a_spDrawBuffer,
98  sp<PartitionI> a_spPartition) const;
99 
100  void setGroup(String a_group)
101  { m_group=a_group; }
102  String group(void) const
103  { return m_group; }
104 
105  protected:
106 
107 virtual void resolveImpact(sp<ImpactI> a_spImpactI) const;
108 
109  Triangulation m_triangulation;
110 
111  private:
112 mutable CountedPool<Impact> m_triangleImpactPool;
113  String m_group;
114 };
115 
116 } /* namespace ext */
117 } /* namespace fe */
118 
119 #endif /* __surface_SurfaceTriangles_h__ */
Discrete Triangle Surface.
Definition: SurfaceTriangles.h:20
kernel
Definition: namespace.dox:3
Special vector for color (RGBA)
Definition: Color.h:21
Automatically reference-counted string container.
Definition: String.h:128
Tree-searchable Surface.
Definition: SurfaceSearchable.h:20
Intrusive Smart Pointer.
Definition: src/core/ptr.h:53
virtual void setTriangulation(Triangulation a_triangulation)
Set how 4+ vertex polygons break down.
Definition: SurfaceTriangles.h:81
Per-class participation non-RTTI fallback dynamic casting mechanism.
Definition: Castable.h:192