KiCad PCB EDA Suite
COBJECT Class Referenceabstract

#include <cobject.h>

Inheritance diagram for COBJECT:
CDUMMYBLOCK CLAYERITEM CROUNDSEG CTRIANGLE CVCYLINDER CXYPLANE

Public Member Functions

 COBJECT (OBJECT3D_TYPE aObjType)
 
void SetMaterial (const CMATERIAL *aMaterial)
 
const CMATERIALGetMaterial () const
 
virtual SFVEC3F GetDiffuseColor (const HITINFO &aHitInfo) const =0
 
virtual ~COBJECT ()
 
virtual bool Intersects (const CBBOX &aBBox) const =0
 Function Intersects. More...
 
virtual bool Intersect (const RAY &aRay, HITINFO &aHitInfo) const =0
 Functions Intersect. More...
 
virtual bool IntersectP (const RAY &aRay, float aMaxDistance) const =0
 Functions Intersect for shadow test. More...
 
const CBBOXGetBBox () const
 
const SFVEC3FGetCentroid () const
 

Protected Attributes

CBBOX m_bbox
 
SFVEC3F m_centroid
 
OBJECT3D_TYPE m_obj_type
 
const CMATERIALm_material
 

Detailed Description

Definition at line 50 of file cobject.h.

Constructor & Destructor Documentation

◆ COBJECT()

COBJECT::COBJECT ( OBJECT3D_TYPE  aObjType)
explicit

Definition at line 38 of file cobject.cpp.

39 {
40  m_obj_type = aObjType;
41  COBJECT3D_STATS::Instance().AddOne( aObjType );
43 }
OBJECT3D_TYPE m_obj_type
Definition: cobject.h:55
const CMATERIAL * m_material
Definition: cobject.h:56
void AddOne(OBJECT3D_TYPE aObjType)
Definition: cobject.h:112
static const CBLINN_PHONG_MATERIAL s_defaultMaterial
Definition: cobject.cpp:36
static COBJECT3D_STATS & Instance()
Definition: cobject.h:116

References COBJECT3D_STATS::AddOne(), COBJECT3D_STATS::Instance(), m_material, m_obj_type, and s_defaultMaterial.

◆ ~COBJECT()

virtual COBJECT::~COBJECT ( )
inlinevirtual

Definition at line 67 of file cobject.h.

67 {}

Member Function Documentation

◆ GetBBox()

const CBBOX& COBJECT::GetBBox ( ) const
inline

Definition at line 94 of file cobject.h.

94 { return m_bbox; }
CBBOX m_bbox
Definition: cobject.h:53

References m_bbox.

Referenced by CGENERICCONTAINER::Add(), and CBVH_PBRT::Intersect().

◆ GetCentroid()

const SFVEC3F& COBJECT::GetCentroid ( ) const
inline

Definition at line 96 of file cobject.h.

96 { return m_centroid; }
SFVEC3F m_centroid
Definition: cobject.h:54

References m_centroid.

◆ GetDiffuseColor()

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

◆ GetMaterial()

const CMATERIAL* COBJECT::GetMaterial ( ) const
inline

Definition at line 63 of file cobject.h.

63 { return m_material; }
const CMATERIAL * m_material
Definition: cobject.h:56

References m_material.

Referenced by CBVH_PBRT::IntersectP(), and C3D_RENDER_RAYTRACING::shadeHit().

◆ Intersect()

virtual bool COBJECT::Intersect ( const RAY aRay,
HITINFO aHitInfo 
) const
pure virtual

Functions Intersect.

Intersect

Parameters
aRay
aHitInfo
Returns
true if the aRay intersects the object

Implemented in CTRIANGLE, CXYPLANE, CVCYLINDER, CROUNDSEG, CLAYERITEM, and CDUMMYBLOCK.

Referenced by CCONTAINER::Intersect(), CBVH_PBRT::Intersect(), and C3D_RENDER_RAYTRACING::render_preview().

◆ IntersectP()

virtual bool COBJECT::IntersectP ( const RAY aRay,
float  aMaxDistance 
) const
pure virtual

Functions Intersect for shadow test.

Intersect

Parameters
aRay
aMaxDistance- max distance of the test
Returns
true if the aRay intersects the object

Implemented in CTRIANGLE, CXYPLANE, CVCYLINDER, CROUNDSEG, CLAYERITEM, and CDUMMYBLOCK.

Referenced by CCONTAINER::IntersectP(), and CBVH_PBRT::IntersectP().

◆ Intersects()

virtual bool COBJECT::Intersects ( const CBBOX aBBox) const
pure virtual

Function Intersects.

Intersects - a.Intersects(b) ⇔ !a.Disjoint(b) ⇔ !(a ∩ b = ∅) It intersects if the result intersection is not null

Parameters
aBBox
Returns

Implemented in CTRIANGLE, CXYPLANE, CVCYLINDER, CROUNDSEG, CLAYERITEM, and CDUMMYBLOCK.

◆ SetMaterial()

void COBJECT::SetMaterial ( const CMATERIAL aMaterial)
inline

Member Data Documentation

◆ m_bbox

◆ m_centroid

◆ m_material

◆ m_obj_type

OBJECT3D_TYPE COBJECT::m_obj_type
protected

Definition at line 55 of file cobject.h.

Referenced by COBJECT().


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