KiCad PCB EDA Suite
DUMMY_BLOCK Class Reference

A dummy block is used to fill the polygons. More...

#include <dummy_block_3d.h>

Inheritance diagram for DUMMY_BLOCK:
OBJECT_3D

Public Member Functions

 DUMMY_BLOCK (const BBOX_3D &aBBox)
 
void SetColor (SFVEC3F aObjColor)
 
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 Attributes

SFVEC3F m_diffusecolor
 

Detailed Description

A dummy block is used to fill the polygons.

It will only will be intercepted from top or from bottom.

Definition at line 38 of file dummy_block_3d.h.

Constructor & Destructor Documentation

◆ DUMMY_BLOCK()

DUMMY_BLOCK::DUMMY_BLOCK ( const BBOX_3D aBBox)
explicit

Definition at line 33 of file dummy_block_3d.cpp.

34 {
35  m_centroid = aBBox.GetCenter();
36  m_bbox.Reset();
37  m_bbox.Set( aBBox );
38 }
OBJECT_3D(OBJECT_3D_TYPE aObjType)
Definition: object_3d.cpp:41
SFVEC3F GetCenter() const
Return the center point of the bounding box.
Definition: bbox_3d.cpp:132
BBOX_3D m_bbox
Definition: object_3d.h:97
void Set(const SFVEC3F &aPbMin, const SFVEC3F &aPbMax)
Set bounding box with new parameters.
Definition: bbox_3d.cpp:68
SFVEC3F m_centroid
Definition: object_3d.h:98
void Reset()
Reset the bounding box to zero and de-initialize it.
Definition: bbox_3d.cpp:95

References DUMMYBLOCK, BBOX_3D::GetCenter(), OBJECT_3D::m_bbox, OBJECT_3D::m_centroid, BBOX_3D::Reset(), and BBOX_3D::Set().

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 DUMMY_BLOCK::GetDiffuseColor ( const HITINFO aHitInfo) const
overridevirtual

Implements OBJECT_3D.

Definition at line 89 of file dummy_block_3d.cpp.

90 {
91  (void)aHitInfo; // unused
92 
93  return m_diffusecolor;
94 }
SFVEC3F m_diffusecolor

References m_diffusecolor.

◆ 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 DUMMY_BLOCK::Intersect ( const RAY aRay,
HITINFO aHitInfo 
) const
overridevirtual
Returns
true if the aRay intersects the object.

Implements OBJECT_3D.

Definition at line 41 of file dummy_block_3d.cpp.

42 {
43  float t;
44 
45  if( !m_bbox.Intersect( aRay, &t ) )
46  return false;
47 
48  if( t < aHitInfo.m_tHit )
49  {
50  aHitInfo.m_tHit = t;
51  aHitInfo.m_HitPoint = aRay.at( t );
52 
53  if( aRay.m_dirIsNeg[2] )
54  aHitInfo.m_HitNormal = SFVEC3F( 0.0f, 0.0f, 1.0f );
55  else
56  aHitInfo.m_HitNormal = SFVEC3F( 0.0f, 0.0f,-1.0f );
57 
58  m_material->Generate( aHitInfo.m_HitNormal, aRay, aHitInfo );
59 
60  aHitInfo.pHitObject = this;
61 
62  return true;
63  }
64 
65  return false;
66 }
bool Intersect(const RAY &aRay, float *t) const
Definition: bbox_3d_ray.cpp:46
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
BBOX_3D m_bbox
Definition: object_3d.h:97
unsigned int m_dirIsNeg[3]
Definition: ray.h:80
const MATERIAL * m_material
Definition: object_3d.h:100
const OBJECT_3D * pHitObject
( 4) Object that was hitted
Definition: hitinfo.h:45
glm::vec3 SFVEC3F
Definition: xv3d_types.h:44
SFVEC3F m_HitNormal
(12) normal at the hit point
Definition: hitinfo.h:42

References RAY::at(), MATERIAL::Generate(), BBOX_3D::Intersect(), OBJECT_3D::m_bbox, RAY::m_dirIsNeg, HITINFO::m_HitNormal, HITINFO::m_HitPoint, OBJECT_3D::m_material, HITINFO::m_tHit, and HITINFO::pHitObject.

◆ IntersectP()

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

Implements OBJECT_3D.

Definition at line 69 of file dummy_block_3d.cpp.

70 {
71  float t;
72 
73  if( !m_bbox.Intersect( aRay, &t ) )
74  return false;
75 
76  if( t < aMaxDistance )
77  return true;
78 
79  return false;
80 }
bool Intersect(const RAY &aRay, float *t) const
Definition: bbox_3d_ray.cpp:46
BBOX_3D m_bbox
Definition: object_3d.h:97

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

◆ Intersects()

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

Implements OBJECT_3D.

Definition at line 83 of file dummy_block_3d.cpp.

84 {
85  return m_bbox.Intersects( aBBox );
86 }
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.

◆ 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()

void DUMMY_BLOCK::SetColor ( SFVEC3F  aObjColor)
inline

Definition at line 43 of file dummy_block_3d.h.

43 { m_diffusecolor = aObjColor; }
SFVEC3F m_diffusecolor

References m_diffusecolor.

◆ 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().

Member Data Documentation

◆ m_bbox

◆ m_boardItem

BOARD_ITEM* OBJECT_3D::m_boardItem
protectedinherited

◆ m_centroid

◆ m_diffusecolor

SFVEC3F DUMMY_BLOCK::m_diffusecolor
private

Definition at line 51 of file dummy_block_3d.h.

Referenced by GetDiffuseColor(), and SetColor().

◆ m_material

◆ m_modelTransparency

float OBJECT_3D::m_modelTransparency
protectedinherited

◆ 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().


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