KiCad PCB EDA Suite
TRIANGLE Class Reference

A triangle object. More...

#include <triangle_3d.h>

Inheritance diagram for TRIANGLE:
OBJECT_3D

Public Member Functions

 TRIANGLE (const SFVEC3F &aV1, const SFVEC3F &aV2, const SFVEC3F &aV3)
 
 TRIANGLE (const SFVEC3F &aV1, const SFVEC3F &aV2, const SFVEC3F &aV3, const SFVEC3F &aFaceNormal)
 
 TRIANGLE (const SFVEC3F &aV1, const SFVEC3F &aV2, const SFVEC3F &aV3, const SFVEC3F &aN1, const SFVEC3F &aN2, const SFVEC3F &aN3)
 
void SetColor (const SFVEC3F &aColor)
 
void SetColor (const SFVEC3F &aVC0, const SFVEC3F &aVC1, const SFVEC3F &aVC2)
 
void SetColor (unsigned int aFaceColorRGBA)
 
void SetColor (unsigned int aVertex1ColorRGBA, unsigned int aVertex2ColorRGBA, unsigned int aVertex3ColorRGBA)
 
void SetUV (const SFVEC2F &aUV1, const SFVEC2F &aUV2, const SFVEC2F &aUV3)
 
bool Intersect (const RAY &aRay, HITINFO &aHitInfo) const override
 
bool IntersectP (const RAY &aRay, float aMaxDistance) const override
 
bool Intersects (const BBOX_3D &aBBox) const override
 
SFVEC3F GetDiffuseColor (const HITINFO &aHitInfo) const override
 
const void SetBoardItem (BOARD_ITEM *aBoardItem)
 
BOARD_ITEMGetBoardItem () const
 
void SetMaterial (const MATERIAL *aMaterial)
 
const MATERIALGetMaterial () const
 
float GetModelTransparency () const
 
void SetModelTransparency (float aModelTransparency)
 
const BBOX_3DGetBBox () const
 
const SFVEC3FGetCentroid () const
 

Protected Attributes

BBOX_3D m_bbox
 
SFVEC3F m_centroid
 
OBJECT_3D_TYPE m_obj_type
 
const MATERIALm_material
 
BOARD_ITEMm_boardItem
 
float m_modelTransparency
 

Private Member Functions

void pre_calc_const ()
 

Private Attributes

SFVEC3F m_normal [3]
 
SFVEC3F m_vertex [3]
 
SFVEC3F m_n
 
SFVEC2F m_uv [3]
 
unsigned int m_vertexColorRGBA [3]
 
float m_nu
 
float m_nv
 
float m_nd
 
unsigned int m_k
 
float m_bnu
 
float m_bnv
 
float m_cnu
 
float m_cnv
 

Detailed Description

A triangle object.

Definition at line 42 of file triangle_3d.h.

Constructor & Destructor Documentation

◆ TRIANGLE() [1/3]

TRIANGLE::TRIANGLE ( const SFVEC3F aV1,
const SFVEC3F aV2,
const SFVEC3F aV3 
)

Definition at line 95 of file triangle_3d.cpp.

97 {
98  m_vertex[0] = aV1;
99  m_vertex[1] = aV2;
100  m_vertex[2] = aV3;
101 
102  m_vertexColorRGBA[0] = 0xFFFFFFFF;
103  m_vertexColorRGBA[1] = 0xFFFFFFFF;
104  m_vertexColorRGBA[2] = 0xFFFFFFFF;
105 
106  pre_calc_const();
107 }
OBJECT_3D(OBJECT_3D_TYPE aObjType)
Definition: object_3d.cpp:41
SFVEC3F m_vertex[3]
Definition: triangle_3d.h:73
unsigned int m_vertexColorRGBA[3]
Definition: triangle_3d.h:76
void pre_calc_const()
Definition: triangle_3d.cpp:34

References m_vertex, m_vertexColorRGBA, and pre_calc_const().

◆ TRIANGLE() [2/3]

TRIANGLE::TRIANGLE ( const SFVEC3F aV1,
const SFVEC3F aV2,
const SFVEC3F aV3,
const SFVEC3F aFaceNormal 
)

Definition at line 110 of file triangle_3d.cpp.

113 {
114  m_vertex[0] = aV1;
115  m_vertex[1] = aV2;
116  m_vertex[2] = aV3;
117 
118  m_vertexColorRGBA[0] = 0xFFFFFFFF;
119  m_vertexColorRGBA[1] = 0xFFFFFFFF;
120  m_vertexColorRGBA[2] = 0xFFFFFFFF;
121 
122  pre_calc_const();
123 
124  m_normal[0] = aFaceNormal;
125  m_normal[1] = aFaceNormal;
126  m_normal[2] = aFaceNormal;
127 }
OBJECT_3D(OBJECT_3D_TYPE aObjType)
Definition: object_3d.cpp:41
SFVEC3F m_vertex[3]
Definition: triangle_3d.h:73
SFVEC3F m_normal[3]
Definition: triangle_3d.h:72
unsigned int m_vertexColorRGBA[3]
Definition: triangle_3d.h:76
void pre_calc_const()
Definition: triangle_3d.cpp:34

References m_normal, m_vertex, m_vertexColorRGBA, and pre_calc_const().

◆ TRIANGLE() [3/3]

TRIANGLE::TRIANGLE ( const SFVEC3F aV1,
const SFVEC3F aV2,
const SFVEC3F aV3,
const SFVEC3F aN1,
const SFVEC3F aN2,
const SFVEC3F aN3 
)

Definition at line 130 of file triangle_3d.cpp.

133 {
134  m_vertex[0] = aV1;
135  m_vertex[1] = aV2;
136  m_vertex[2] = aV3;
137 
138  m_vertexColorRGBA[0] = 0xFFFFFFFF;
139  m_vertexColorRGBA[1] = 0xFFFFFFFF;
140  m_vertexColorRGBA[2] = 0xFFFFFFFF;
141 
142  pre_calc_const();
143 
144  m_normal[0] = aN1;
145  m_normal[1] = aN2;
146  m_normal[2] = aN3;
147 }
OBJECT_3D(OBJECT_3D_TYPE aObjType)
Definition: object_3d.cpp:41
SFVEC3F m_vertex[3]
Definition: triangle_3d.h:73
SFVEC3F m_normal[3]
Definition: triangle_3d.h:72
unsigned int m_vertexColorRGBA[3]
Definition: triangle_3d.h:76
void pre_calc_const()
Definition: triangle_3d.cpp:34

References m_normal, m_vertex, m_vertexColorRGBA, and pre_calc_const().

Member Function Documentation

◆ GetBBox()

const BBOX_3D& OBJECT_3D::GetBBox ( ) const
inlineinherited

Definition at line 92 of file object_3d.h.

92 { return m_bbox; }
BBOX_3D m_bbox
Definition: object_3d.h:97

References OBJECT_3D::m_bbox.

Referenced by CONTAINER_3D_BASE::Add(), and BVH_PBRT::Intersect().

◆ GetBoardItem()

BOARD_ITEM* OBJECT_3D::GetBoardItem ( ) const
inlineinherited

Definition at line 56 of file object_3d.h.

56 { return m_boardItem; }
BOARD_ITEM * m_boardItem
Definition: object_3d.h:102

References OBJECT_3D::m_boardItem.

Referenced by RENDER_3D_RAYTRACE::IntersectBoardItem().

◆ GetCentroid()

const SFVEC3F& OBJECT_3D::GetCentroid ( ) const
inlineinherited

Definition at line 94 of file object_3d.h.

94 { return m_centroid; }
SFVEC3F m_centroid
Definition: object_3d.h:98

References OBJECT_3D::m_centroid.

◆ GetDiffuseColor()

SFVEC3F TRIANGLE::GetDiffuseColor ( const HITINFO aHitInfo) const
overridevirtual

Implements OBJECT_3D.

Definition at line 306 of file triangle_3d.cpp.

307 {
308  const unsigned int rgbC1 = m_vertexColorRGBA[0];
309  const unsigned int rgbC2 = m_vertexColorRGBA[1];
310  const unsigned int rgbC3 = m_vertexColorRGBA[2];
311 
312  const SFVEC3F c1 = SFVEC3F( (float) ( ( rgbC1 >> 24 ) & 0xFF ) / 255.0f,
313  (float) ( ( rgbC1 >> 16 ) & 0xFF ) / 255.0f,
314  (float) ( ( rgbC1 >> 8 ) & 0xFF ) / 255.0f );
315  const SFVEC3F c2 = SFVEC3F( (float) ( ( rgbC2 >> 24 ) & 0xFF ) / 255.0f,
316  (float) ( ( rgbC2 >> 16 ) & 0xFF ) / 255.0f,
317  (float) ( ( rgbC2 >> 8 ) & 0xFF ) / 255.0f );
318  const SFVEC3F c3 = SFVEC3F( (float) ( ( rgbC3 >> 24 ) & 0xFF ) / 255.0f,
319  (float) ( ( rgbC3 >> 16 ) & 0xFF ) / 255.0f,
320  (float) ( ( rgbC3 >> 8 ) & 0xFF ) / 255.0f );
321 
322  const float u = aHitInfo.m_UV.x;
323  const float v = aHitInfo.m_UV.y;
324  const float w = 1.0f - u - v;
325 
326  return w * c1 + u * c2 + v * c3;
327 }
glm::vec3 SFVEC3F
Definition: xv3d_types.h:44
unsigned int m_vertexColorRGBA[3]
Definition: triangle_3d.h:76
SFVEC2F m_UV
( 8) 2-D texture coordinates
Definition: hitinfo.h:46

References HITINFO::m_UV, and m_vertexColorRGBA.

◆ GetMaterial()

const MATERIAL* OBJECT_3D::GetMaterial ( ) const
inlineinherited

Definition at line 64 of file object_3d.h.

64 { return m_material; }
const MATERIAL * m_material
Definition: object_3d.h:100

References OBJECT_3D::m_material.

Referenced by BVH_PBRT::IntersectP(), and RENDER_3D_RAYTRACE::shadeHit().

◆ GetModelTransparency()

float OBJECT_3D::GetModelTransparency ( ) const
inlineinherited

Definition at line 65 of file object_3d.h.

65 { return m_modelTransparency; }
float m_modelTransparency
Definition: object_3d.h:106

References OBJECT_3D::m_modelTransparency.

Referenced by RENDER_3D_RAYTRACE::shadeHit().

◆ Intersect()

bool TRIANGLE::Intersect ( const RAY aRay,
HITINFO aHitInfo 
) const
overridevirtual
Returns
true if the aRay intersects the object.

TODO: precalc this, improve it

Implements OBJECT_3D.

Definition at line 202 of file triangle_3d.cpp.

203 {
205 #define ku s_modulo[m_k + 1]
206 #define kv s_modulo[m_k + 2]
207 
208  const SFVEC3F& O = aRay.m_Origin;
209  const SFVEC3F& D = aRay.m_Dir;
210  const SFVEC3F& A = m_vertex[0];
211 
212  const float lnd = 1.0f / (D[m_k] + m_nu * D[ku] + m_nv * D[kv]);
213  const float t = ( m_nd - O[m_k] - m_nu * O[ku] - m_nv * O[kv] ) * lnd;
214 
215  if( !( ( aHitInfo.m_tHit > t ) && ( t > 0.0f ) ) )
216  return false;
217 
218  const float hu = O[ku] + t * D[ku] - A[ku];
219  const float hv = O[kv] + t * D[kv] - A[kv];
220  const float beta = hv * m_bnu + hu * m_bnv;
221 
222  if( beta < 0.0f )
223  return false;
224 
225  const float gamma = hu * m_cnu + hv * m_cnv;
226 
227  if( gamma < 0 )
228  return false;
229 
230  const float v = gamma;
231  const float u = beta;
232 
233  if( (u + v) > 1.0f )
234  return false;
235 
236  if( glm::dot( D, m_n ) > 0.0f )
237  return false;
238 
239  aHitInfo.m_tHit = t;
240  aHitInfo.m_HitPoint = aRay.at( t );
241 
242  // interpolate vertex normals with UVW using Gouraud's shading
243  aHitInfo.m_HitNormal =
244  glm::normalize( ( 1.0f - u - v ) * m_normal[0] + u * m_normal[1] + v * m_normal[2] );
245 
246  m_material->Generate( aHitInfo.m_HitNormal, aRay, aHitInfo );
247 
248  aHitInfo.pHitObject = this;
249 
250  return true;
251 #undef ku
252 #undef kv
253 }
float m_nu
Definition: triangle_3d.h:77
#define ku
SFVEC3F m_n
Definition: triangle_3d.h:74
float m_bnu
Definition: triangle_3d.h:79
float m_cnu
Definition: triangle_3d.h:80
#define kv
void Generate(SFVEC3F &aNormal, const RAY &aRay, const HITINFO &aHitInfo) const
Definition: material.cpp:93
float m_tHit
( 4) distance
Definition: hitinfo.h:43
SFVEC3F at(float t) const
Definition: ray.h:89
SFVEC3F m_HitPoint
(12) hit position
Definition: hitinfo.h:49
float m_bnv
Definition: triangle_3d.h:79
SFVEC3F m_vertex[3]
Definition: triangle_3d.h:73
float m_nd
Definition: triangle_3d.h:77
SFVEC3F m_normal[3]
Definition: triangle_3d.h:72
const MATERIAL * m_material
Definition: object_3d.h:100
const OBJECT_3D * pHitObject
( 4) Object that was hitted
Definition: hitinfo.h:45
SFVEC3F m_Dir
Definition: ray.h:72
SFVEC3F m_Origin
Definition: ray.h:69
glm::vec3 SFVEC3F
Definition: xv3d_types.h:44
SFVEC3F m_HitNormal
(12) normal at the hit point
Definition: hitinfo.h:42
unsigned int m_k
Definition: triangle_3d.h:78
float m_nv
Definition: triangle_3d.h:77
float m_cnv
Definition: triangle_3d.h:80

References RAY::at(), MATERIAL::Generate(), ku, kv, m_bnu, m_bnv, m_cnu, m_cnv, RAY::m_Dir, HITINFO::m_HitNormal, HITINFO::m_HitPoint, m_k, OBJECT_3D::m_material, m_n, m_nd, m_normal, m_nu, m_nv, RAY::m_Origin, HITINFO::m_tHit, m_vertex, and HITINFO::pHitObject.

◆ IntersectP()

bool TRIANGLE::IntersectP ( const RAY aRay,
float  aMaxDistance 
) const
overridevirtual
Parameters
aMaxDistanceis the maximum distance of the test.
Returns
true if aRay intersects the object.

TODO: precalc this

Implements OBJECT_3D.

Definition at line 256 of file triangle_3d.cpp.

257 {
259 #define ku s_modulo[m_k + 1]
260 #define kv s_modulo[m_k + 2]
261 
262  const SFVEC3F O = aRay.m_Origin;
263  const SFVEC3F D = aRay.m_Dir;
264  const SFVEC3F A = m_vertex[0];
265 
266  const float lnd = 1.0f / (D[m_k] + m_nu * D[ku] + m_nv * D[kv]);
267  const float t = ( m_nd - O[m_k] - m_nu * O[ku] - m_nv * O[kv] ) * lnd;
268 
269  if( !( ( aMaxDistance > t ) && ( t > 0.0f ) ) )
270  return false;
271 
272  const float hu = O[ku] + t * D[ku] - A[ku];
273  const float hv = O[kv] + t * D[kv] - A[kv];
274  const float beta = hv * m_bnu + hu * m_bnv;
275 
276  if( beta < 0.0f )
277  return false;
278 
279  const float gamma = hu * m_cnu + hv * m_cnv;
280 
281  if( gamma < 0.0f )
282  return false;
283 
284  const float v = gamma;
285  const float u = beta;
286 
287  if( (u + v) > 1.0f )
288  return false;
289 
290  if( glm::dot( D, m_n ) > 0.0f )
291  return false;
292 
293  return true;
294 #undef ku
295 #undef kv
296 }
float m_nu
Definition: triangle_3d.h:77
#define ku
SFVEC3F m_n
Definition: triangle_3d.h:74
float m_bnu
Definition: triangle_3d.h:79
float m_cnu
Definition: triangle_3d.h:80
#define kv
float m_bnv
Definition: triangle_3d.h:79
SFVEC3F m_vertex[3]
Definition: triangle_3d.h:73
float m_nd
Definition: triangle_3d.h:77
SFVEC3F m_Dir
Definition: ray.h:72
SFVEC3F m_Origin
Definition: ray.h:69
glm::vec3 SFVEC3F
Definition: xv3d_types.h:44
unsigned int m_k
Definition: triangle_3d.h:78
float m_nv
Definition: triangle_3d.h:77
float m_cnv
Definition: triangle_3d.h:80

References ku, kv, m_bnu, m_bnv, m_cnu, m_cnv, RAY::m_Dir, m_k, m_n, m_nd, m_nu, m_nv, RAY::m_Origin, and m_vertex.

◆ Intersects()

bool TRIANGLE::Intersects ( const BBOX_3D aBBox) const
overridevirtual
Returns
true if this object intersects aBBox.

TODO: improve

Implements OBJECT_3D.

Definition at line 299 of file triangle_3d.cpp.

300 {
302  return m_bbox.Intersects( aBBox );
303 }
BBOX_3D m_bbox
Definition: object_3d.h:97
bool Intersects(const BBOX_3D &aBBox) const
Test if a bounding box intersects this box.
Definition: bbox_3d.cpp:227

References BBOX_3D::Intersects(), and OBJECT_3D::m_bbox.

◆ pre_calc_const()

void TRIANGLE::pre_calc_const ( )
private

Definition at line 34 of file triangle_3d.cpp.

35 {
36  const SFVEC3F& A = m_vertex[0];
37  const SFVEC3F& B = m_vertex[1];
38  const SFVEC3F& C = m_vertex[2];
39  const SFVEC3F c = B - A;
40  const SFVEC3F b = C - A;
41 
42  m_bbox.Reset();
43  m_bbox.Set( A );
44  m_bbox.Union( B );
45  m_bbox.Union( C );
48 
49  m_n = glm::cross( b, c );
50 
51  if( glm::abs( m_n.x ) > glm::abs( m_n.y ) )
52  {
53  if( glm::abs( m_n.x ) > glm::abs( m_n.z ) )
54  m_k = 0;
55  else
56  m_k = 2;
57  }
58  else
59  {
60  if( glm::abs( m_n.y ) > glm::abs( m_n.z ) )
61  m_k = 1;
62  else
63  m_k = 2;
64  }
65 
66  int u = ( m_k + 1 ) % 3;
67  int v = ( m_k + 2 ) % 3;
68 
69  // precomp
70  float krec = 1.0f / m_n[m_k];
71 
72  m_nu = m_n[u] * krec;
73  m_nv = m_n[v] * krec;
74  m_nd = glm::dot( m_n, A ) * krec;
75 
76  // first line equation
77  float reci = 1.0f / (b[u] * c[v] - b[v] * c[u]);
78 
79  m_bnu = b[u] * reci;
80  m_bnv = -b[v] * reci;
81 
82  // second line equation
83  m_cnu = c[v] * reci;
84  m_cnv = -c[u] * reci;
85 
86  // finalize normal
87  m_n = glm::normalize( m_n );
88 
89  m_normal[0] = m_n;
90  m_normal[1] = m_n;
91  m_normal[2] = m_n;
92 }
float m_nu
Definition: triangle_3d.h:77
SFVEC3F m_n
Definition: triangle_3d.h:74
float m_bnu
Definition: triangle_3d.h:79
float m_cnu
Definition: triangle_3d.h:80
void Union(const SFVEC3F &aPoint)
Recalculate the bounding box adding a point.
Definition: bbox_3d.cpp:102
SFVEC3F GetCenter() const
Return the center point of the bounding box.
Definition: bbox_3d.cpp:132
float m_bnv
Definition: triangle_3d.h:79
BBOX_3D m_bbox
Definition: object_3d.h:97
SFVEC3F m_vertex[3]
Definition: triangle_3d.h:73
float m_nd
Definition: triangle_3d.h:77
SFVEC3F m_normal[3]
Definition: triangle_3d.h:72
void Set(const SFVEC3F &aPbMin, const SFVEC3F &aPbMax)
Set bounding box with new parameters.
Definition: bbox_3d.cpp:68
void ScaleNextUp()
Scale a bounding box to the next float representation making it larger.
Definition: bbox_3d.cpp:203
SFVEC3F m_centroid
Definition: object_3d.h:98
glm::vec3 SFVEC3F
Definition: xv3d_types.h:44
unsigned int m_k
Definition: triangle_3d.h:78
float m_nv
Definition: triangle_3d.h:77
float m_cnv
Definition: triangle_3d.h:80
void Reset()
Reset the bounding box to zero and de-initialize it.
Definition: bbox_3d.cpp:95

References A, BBOX_3D::GetCenter(), OBJECT_3D::m_bbox, m_bnu, m_bnv, OBJECT_3D::m_centroid, m_cnu, m_cnv, m_k, m_n, m_nd, m_normal, m_nu, m_nv, m_vertex, BBOX_3D::Reset(), BBOX_3D::ScaleNextUp(), BBOX_3D::Set(), and BBOX_3D::Union().

Referenced by TRIANGLE().

◆ SetBoardItem()

const void OBJECT_3D::SetBoardItem ( BOARD_ITEM aBoardItem)
inlineinherited

Definition at line 55 of file object_3d.h.

55 { m_boardItem = aBoardItem; }
BOARD_ITEM * m_boardItem
Definition: object_3d.h:102

References OBJECT_3D::m_boardItem.

Referenced by RENDER_3D_RAYTRACE::addModels().

◆ SetColor() [1/4]

void TRIANGLE::SetColor ( const SFVEC3F aColor)

Definition at line 150 of file triangle_3d.cpp.

151 {
152  m_vertexColorRGBA[0] = ( (unsigned int) ( aColor.r * 255 ) << 24 )
153  | ( (unsigned int) ( aColor.g * 255 ) << 16 )
154  | ( (unsigned int) ( aColor.b * 255 ) << 8 ) | 0xFF;
157 }
unsigned int m_vertexColorRGBA[3]
Definition: triangle_3d.h:76

References m_vertexColorRGBA.

Referenced by RENDER_3D_RAYTRACE::addModels(), and RENDER_3D_RAYTRACE::Reload().

◆ SetColor() [2/4]

void TRIANGLE::SetColor ( const SFVEC3F aVC0,
const SFVEC3F aVC1,
const SFVEC3F aVC2 
)

Definition at line 160 of file triangle_3d.cpp.

161 {
162  m_vertexColorRGBA[0] = ( (unsigned int) ( aVC0.r * 255 ) << 24 )
163  | ( (unsigned int) ( aVC0.g * 255 ) << 16 )
164  | ( (unsigned int) ( aVC0.b * 255 ) << 8 ) | 0xFF;
165  m_vertexColorRGBA[1] = ( (unsigned int) ( aVC1.r * 255 ) << 24 )
166  | ( (unsigned int) ( aVC1.g * 255 ) << 16 )
167  | ( (unsigned int) ( aVC1.b * 255 ) << 8 ) | 0xFF;
168  m_vertexColorRGBA[2] = ( (unsigned int) ( aVC2.r * 255 ) << 24 )
169  | ( (unsigned int) ( aVC2.g * 255 ) << 16 )
170  | ( (unsigned int) ( aVC2.b * 255 ) << 8 ) | 0xFF;
171 }
unsigned int m_vertexColorRGBA[3]
Definition: triangle_3d.h:76

References m_vertexColorRGBA.

◆ SetColor() [3/4]

void TRIANGLE::SetColor ( unsigned int  aFaceColorRGBA)

Definition at line 174 of file triangle_3d.cpp.

175 {
176  m_vertexColorRGBA[0] = aFaceColorRGBA;
177  m_vertexColorRGBA[1] = aFaceColorRGBA;
178  m_vertexColorRGBA[2] = aFaceColorRGBA;
179 }
unsigned int m_vertexColorRGBA[3]
Definition: triangle_3d.h:76

References m_vertexColorRGBA.

◆ SetColor() [4/4]

void TRIANGLE::SetColor ( unsigned int  aVertex1ColorRGBA,
unsigned int  aVertex2ColorRGBA,
unsigned int  aVertex3ColorRGBA 
)

Definition at line 182 of file triangle_3d.cpp.

184 {
185  m_vertexColorRGBA[0] = aVertex1ColorRGBA;
186  m_vertexColorRGBA[1] = aVertex2ColorRGBA;
187  m_vertexColorRGBA[2] = aVertex3ColorRGBA;
188 }
unsigned int m_vertexColorRGBA[3]
Definition: triangle_3d.h:76

References m_vertexColorRGBA.

◆ SetMaterial()

void OBJECT_3D::SetMaterial ( const MATERIAL aMaterial)
inlineinherited

Definition at line 58 of file object_3d.h.

59  {
60  m_material = aMaterial;
61  m_modelTransparency = aMaterial->GetTransparency(); // Default transparency is from material
62  }
float GetTransparency() const
Definition: material.h:277
float m_modelTransparency
Definition: object_3d.h:106
const MATERIAL * m_material
Definition: object_3d.h:100

References MATERIAL::GetTransparency(), OBJECT_3D::m_material, and OBJECT_3D::m_modelTransparency.

Referenced by RENDER_3D_RAYTRACE::addModels(), RENDER_3D_RAYTRACE::createItemsFromContainer(), RENDER_3D_RAYTRACE::createObject(), RENDER_3D_RAYTRACE::insertHole(), and RENDER_3D_RAYTRACE::Reload().

◆ SetModelTransparency()

void OBJECT_3D::SetModelTransparency ( float  aModelTransparency)
inlineinherited

Definition at line 66 of file object_3d.h.

67  {
68  m_modelTransparency = aModelTransparency;
69  }
float m_modelTransparency
Definition: object_3d.h:106

References OBJECT_3D::m_modelTransparency.

Referenced by RENDER_3D_RAYTRACE::addModels().

◆ SetUV()

void TRIANGLE::SetUV ( const SFVEC2F aUV1,
const SFVEC2F aUV2,
const SFVEC2F aUV3 
)

Definition at line 191 of file triangle_3d.cpp.

192 {
193  m_uv[0] = aUV1;
194  m_uv[1] = aUV2;
195  m_uv[2] = aUV3;
196 }
SFVEC2F m_uv[3]
Definition: triangle_3d.h:75

References m_uv.

Member Data Documentation

◆ m_bbox

◆ m_bnu

float TRIANGLE::m_bnu
private

Definition at line 79 of file triangle_3d.h.

Referenced by Intersect(), IntersectP(), and pre_calc_const().

◆ m_bnv

float TRIANGLE::m_bnv
private

Definition at line 79 of file triangle_3d.h.

Referenced by Intersect(), IntersectP(), and pre_calc_const().

◆ m_boardItem

BOARD_ITEM* OBJECT_3D::m_boardItem
protectedinherited

◆ m_centroid

◆ m_cnu

float TRIANGLE::m_cnu
private

Definition at line 80 of file triangle_3d.h.

Referenced by Intersect(), IntersectP(), and pre_calc_const().

◆ m_cnv

float TRIANGLE::m_cnv
private

Definition at line 80 of file triangle_3d.h.

Referenced by Intersect(), IntersectP(), and pre_calc_const().

◆ m_k

unsigned int TRIANGLE::m_k
private

Definition at line 78 of file triangle_3d.h.

Referenced by Intersect(), IntersectP(), and pre_calc_const().

◆ m_material

◆ m_modelTransparency

float OBJECT_3D::m_modelTransparency
protectedinherited

◆ m_n

SFVEC3F TRIANGLE::m_n
private

Definition at line 74 of file triangle_3d.h.

Referenced by Intersect(), IntersectP(), and pre_calc_const().

◆ m_nd

float TRIANGLE::m_nd
private

Definition at line 77 of file triangle_3d.h.

Referenced by Intersect(), IntersectP(), and pre_calc_const().

◆ m_normal

SFVEC3F TRIANGLE::m_normal[3]
private

Definition at line 72 of file triangle_3d.h.

Referenced by Intersect(), pre_calc_const(), and TRIANGLE().

◆ m_nu

float TRIANGLE::m_nu
private

Definition at line 77 of file triangle_3d.h.

Referenced by Intersect(), IntersectP(), and pre_calc_const().

◆ m_nv

float TRIANGLE::m_nv
private

Definition at line 77 of file triangle_3d.h.

Referenced by Intersect(), IntersectP(), and pre_calc_const().

◆ m_obj_type

OBJECT_3D_TYPE OBJECT_3D::m_obj_type
protectedinherited

Definition at line 99 of file object_3d.h.

Referenced by OBJECT_3D::OBJECT_3D().

◆ m_uv

SFVEC2F TRIANGLE::m_uv[3]
private

Definition at line 75 of file triangle_3d.h.

Referenced by SetUV().

◆ m_vertex

SFVEC3F TRIANGLE::m_vertex[3]
private

Definition at line 73 of file triangle_3d.h.

Referenced by Intersect(), IntersectP(), pre_calc_const(), and TRIANGLE().

◆ m_vertexColorRGBA

unsigned int TRIANGLE::m_vertexColorRGBA[3]
private

Definition at line 76 of file triangle_3d.h.

Referenced by GetDiffuseColor(), SetColor(), and TRIANGLE().


The documentation for this class was generated from the following files: