KiCad PCB EDA Suite
OBJECT_3D Class Referenceabstract

#include <object_3d.h>

Inheritance diagram for OBJECT_3D:
CYLINDER DUMMY_BLOCK LAYER_ITEM ROUND_SEGMENT TRIANGLE XY_PLANE

Public Member Functions

 OBJECT_3D (OBJECT_3D_TYPE aObjType)
 
const void SetBoardItem (BOARD_ITEM *aBoardItem)
 
BOARD_ITEMGetBoardItem () const
 
void SetMaterial (const MATERIAL *aMaterial)
 
const MATERIALGetMaterial () const
 
float GetModelTransparency () const
 
void SetModelTransparency (float aModelTransparency)
 
virtual SFVEC3F GetDiffuseColor (const HITINFO &aHitInfo) const =0
 
virtual ~OBJECT_3D ()
 
virtual bool Intersects (const BBOX_3D &aBBox) const =0
 
virtual bool Intersect (const RAY &aRay, HITINFO &aHitInfo) const =0
 
virtual bool IntersectP (const RAY &aRay, float aMaxDistance) const =0
 
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
 

Detailed Description

Definition at line 50 of file object_3d.h.

Constructor & Destructor Documentation

◆ OBJECT_3D()

OBJECT_3D::OBJECT_3D ( OBJECT_3D_TYPE  aObjType)
explicit

Definition at line 41 of file object_3d.cpp.

42 {
43  m_obj_type = aObjType;
44  OBJECT_3D_STATS::Instance().AddOne( aObjType );
46  m_modelTransparency = 0.0f;
47  m_boardItem = nullptr;
48 }
BOARD_ITEM * m_boardItem
Definition: object_3d.h:102
float m_modelTransparency
Definition: object_3d.h:106
OBJECT_3D_TYPE m_obj_type
Definition: object_3d.h:99
static OBJECT_3D_STATS & Instance()
Definition: object_3d.h:132
const MATERIAL * m_material
Definition: object_3d.h:100
static const BLINN_PHONG_MATERIAL s_defaultMaterial
Definition: object_3d.cpp:38
void AddOne(OBJECT_3D_TYPE aObjType)
Definition: object_3d.h:125

References OBJECT_3D_STATS::AddOne(), OBJECT_3D_STATS::Instance(), m_boardItem, m_material, m_modelTransparency, m_obj_type, and s_defaultMaterial.

◆ ~OBJECT_3D()

virtual OBJECT_3D::~OBJECT_3D ( )
inlinevirtual

Definition at line 73 of file object_3d.h.

73 {}

Member Function Documentation

◆ GetBBox()

const BBOX_3D& OBJECT_3D::GetBBox ( ) const
inline

Definition at line 92 of file object_3d.h.

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

References m_bbox.

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

◆ GetBoardItem()

BOARD_ITEM* OBJECT_3D::GetBoardItem ( ) const
inline

Definition at line 56 of file object_3d.h.

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

References m_boardItem.

Referenced by RENDER_3D_RAYTRACE::IntersectBoardItem().

◆ GetCentroid()

const SFVEC3F& OBJECT_3D::GetCentroid ( ) const
inline

Definition at line 94 of file object_3d.h.

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

References m_centroid.

◆ GetDiffuseColor()

virtual SFVEC3F OBJECT_3D::GetDiffuseColor ( const HITINFO aHitInfo) const
pure virtual

◆ GetMaterial()

const MATERIAL* OBJECT_3D::GetMaterial ( ) const
inline

Definition at line 64 of file object_3d.h.

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

References m_material.

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

◆ GetModelTransparency()

float OBJECT_3D::GetModelTransparency ( ) const
inline

Definition at line 65 of file object_3d.h.

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

References m_modelTransparency.

Referenced by RENDER_3D_RAYTRACE::shadeHit().

◆ Intersect()

virtual bool OBJECT_3D::Intersect ( const RAY aRay,
HITINFO aHitInfo 
) const
pure virtual
Returns
true if the aRay intersects the object.

Implemented in TRIANGLE, XY_PLANE, CYLINDER, DUMMY_BLOCK, ROUND_SEGMENT, and LAYER_ITEM.

Referenced by CONTAINER_3D::Intersect(), BVH_PBRT::Intersect(), and RENDER_3D_RAYTRACE::renderPreview().

◆ IntersectP()

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

Implemented in TRIANGLE, XY_PLANE, CYLINDER, DUMMY_BLOCK, ROUND_SEGMENT, and LAYER_ITEM.

Referenced by CONTAINER_3D::IntersectP(), and BVH_PBRT::IntersectP().

◆ Intersects()

virtual bool OBJECT_3D::Intersects ( const BBOX_3D aBBox) const
pure virtual
Returns
true if this object intersects aBBox.

Implemented in TRIANGLE, XY_PLANE, CYLINDER, DUMMY_BLOCK, ROUND_SEGMENT, and LAYER_ITEM.

◆ SetBoardItem()

const void OBJECT_3D::SetBoardItem ( BOARD_ITEM aBoardItem)
inline

Definition at line 55 of file object_3d.h.

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

References m_boardItem.

Referenced by RENDER_3D_RAYTRACE::addModels().

◆ SetMaterial()

void OBJECT_3D::SetMaterial ( const MATERIAL aMaterial)
inline

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:273
float m_modelTransparency
Definition: object_3d.h:106
const MATERIAL * m_material
Definition: object_3d.h:100

References MATERIAL::GetTransparency(), m_material, and 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)
inline

Definition at line 66 of file object_3d.h.

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

References m_modelTransparency.

Referenced by RENDER_3D_RAYTRACE::addModels().

Member Data Documentation

◆ m_bbox

◆ m_boardItem

BOARD_ITEM* OBJECT_3D::m_boardItem
protected

Definition at line 102 of file object_3d.h.

Referenced by GetBoardItem(), OBJECT_3D(), and SetBoardItem().

◆ m_centroid

◆ m_material

◆ m_modelTransparency

float OBJECT_3D::m_modelTransparency
protected

Definition at line 106 of file object_3d.h.

Referenced by GetModelTransparency(), OBJECT_3D(), SetMaterial(), and SetModelTransparency().

◆ m_obj_type

OBJECT_3D_TYPE OBJECT_3D::m_obj_type
protected

Definition at line 99 of file object_3d.h.

Referenced by OBJECT_3D().


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