KiCad PCB EDA Suite
Loading...
Searching...
No Matches
MATERIAL Class Referenceabstract

Base material class that can be used to derive other material implementations. More...

#include <material.h>

Inheritance diagram for MATERIAL:
BLINN_PHONG_MATERIAL

Public Member Functions

 MATERIAL ()
 
 MATERIAL (const SFVEC3F &aAmbient, const SFVEC3F &aEmissive, const SFVEC3F &aSpecular, float aShinness, float aTransparency, float aReflection)
 
virtual ~MATERIAL ()
 
const SFVEC3FGetAmbientColor () const
 
const SFVEC3FGetEmissiveColor () const
 
const SFVEC3FGetSpecularColor () const
 
float GetReflectivity () const
 
float GetTransparency () const
 
float GetReflection () const
 
float GetAbsorvance () const
 
unsigned int GetRefractionRayCount () const
 
unsigned int GetReflectionRayCount () const
 
unsigned int GetReflectionRecursionCount () const
 
unsigned int GetRefractionRecursionCount () const
 
void SetAbsorvance (float aAbsorvanceFactor)
 
void SetRefractionRayCount (unsigned int aCount)
 
void SetReflectionRayCount (unsigned int aCount)
 
void SetReflectionRecursionCount (unsigned int aCount)
 
void SetRefractionRecursionCount (unsigned int aCount)
 
void SetCastShadows (bool aCastShadows)
 Set if the material can receive shadows.
 
bool GetCastShadows () const
 
virtual SFVEC3F Shade (const RAY &aRay, const HITINFO &aHitInfo, float NdotL, const SFVEC3F &aDiffuseObjColor, const SFVEC3F &aDirToLight, const SFVEC3F &aLightColor, float aShadowAttenuationFactor) const =0
 Shade an intersection point.
 
void SetGenerator (const MATERIAL_GENERATOR *aGenerator)
 
const MATERIAL_GENERATORGetGenerator () const
 
void Generate (SFVEC3F &aNormal, const RAY &aRay, const HITINFO &aHitInfo) const
 

Static Public Member Functions

static void SetDefaultRefractionRayCount (unsigned int aCount)
 
static void SetDefaultReflectionRayCount (unsigned int aCount)
 
static void SetDefaultRefractionRecursionCount (unsigned int aCount)
 
static void SetDefaultReflectionRecursionCount (unsigned int aCount)
 

Protected Attributes

SFVEC3F m_ambientColor
 
SFVEC3F m_emissiveColor
 
SFVEC3F m_specularColor
 
float m_reflectivity
 1.0 is completely transparent, 0.0 completely opaque.
 
float m_transparency
 
float m_absorbance
 absorbance factor for the transparent material.
 
float m_reflection
 1.0 completely reflective, 0.0 no reflective.
 
bool m_castShadows
 true if this object will block the light.
 
unsigned int m_refractionRayCount
 Number of rays that will be interpolated for this material if it is reflective.
 
unsigned int m_reflectionRayCount
 Number of levels it allows for refraction recursiveness.
 
unsigned int m_refractionRecursionCount
 Number of levels it allows for reflection recursiveness.
 
unsigned int m_reflectionRecursionCount
 
const MATERIAL_GENERATORm_generator
 

Static Private Attributes

static int m_defaultRefractionRayCount = 4
 
static int m_defaultReflectionRayCount = 3
 
static int m_defaultRefractionRecursionCount = 2
 
static int m_defaultFeflectionRecursionCount = 3
 

Detailed Description

Base material class that can be used to derive other material implementations.

Definition at line 239 of file material.h.

Constructor & Destructor Documentation

◆ MATERIAL() [1/2]

◆ MATERIAL() [2/2]

◆ ~MATERIAL()

virtual MATERIAL::~MATERIAL ( )
inlinevirtual

Definition at line 266 of file material.h.

Member Function Documentation

◆ Generate()

void MATERIAL::Generate ( SFVEC3F aNormal,
const RAY aRay,
const HITINFO aHitInfo 
) const

◆ GetAbsorvance()

float MATERIAL::GetAbsorvance ( ) const
inline

Definition at line 275 of file material.h.

References m_absorbance.

Referenced by RENDER_3D_RAYTRACE_BASE::shadeHit().

◆ GetAmbientColor()

const SFVEC3F & MATERIAL::GetAmbientColor ( ) const
inline

Definition at line 268 of file material.h.

References m_ambientColor.

Referenced by RENDER_3D_RAYTRACE_BASE::shadeHit().

◆ GetCastShadows()

bool MATERIAL::GetCastShadows ( ) const
inline

Definition at line 309 of file material.h.

References m_castShadows.

Referenced by BVH_PBRT::IntersectP().

◆ GetEmissiveColor()

const SFVEC3F & MATERIAL::GetEmissiveColor ( ) const
inline

Definition at line 269 of file material.h.

References m_emissiveColor.

Referenced by RENDER_3D_RAYTRACE_BASE::shadeHit().

◆ GetGenerator()

const MATERIAL_GENERATOR * MATERIAL::GetGenerator ( ) const
inline

Definition at line 333 of file material.h.

References m_generator.

◆ GetReflection()

float MATERIAL::GetReflection ( ) const
inline

Definition at line 274 of file material.h.

References m_reflection.

Referenced by RENDER_3D_RAYTRACE_BASE::shadeHit().

◆ GetReflectionRayCount()

unsigned int MATERIAL::GetReflectionRayCount ( ) const
inline

Definition at line 277 of file material.h.

References m_reflectionRayCount.

Referenced by RENDER_3D_RAYTRACE_BASE::shadeHit().

◆ GetReflectionRecursionCount()

unsigned int MATERIAL::GetReflectionRecursionCount ( ) const
inline

Definition at line 278 of file material.h.

References m_reflectionRecursionCount.

◆ GetReflectivity()

float MATERIAL::GetReflectivity ( ) const
inline

Definition at line 272 of file material.h.

References m_reflectivity.

◆ GetRefractionRayCount()

unsigned int MATERIAL::GetRefractionRayCount ( ) const
inline

Definition at line 276 of file material.h.

References m_refractionRayCount.

Referenced by RENDER_3D_RAYTRACE_BASE::shadeHit().

◆ GetRefractionRecursionCount()

unsigned int MATERIAL::GetRefractionRecursionCount ( ) const
inline

Definition at line 279 of file material.h.

References m_refractionRecursionCount.

Referenced by RENDER_3D_RAYTRACE_BASE::shadeHit().

◆ GetSpecularColor()

const SFVEC3F & MATERIAL::GetSpecularColor ( ) const
inline

Definition at line 270 of file material.h.

References m_specularColor.

Referenced by RENDER_3D_RAYTRACE_BASE::shadeHit().

◆ GetTransparency()

float MATERIAL::GetTransparency ( ) const
inline

Definition at line 273 of file material.h.

References m_transparency.

Referenced by RENDER_3D_RAYTRACE_BASE::addModels(), and OBJECT_3D::SetMaterial().

◆ SetAbsorvance()

void MATERIAL::SetAbsorvance ( float  aAbsorvanceFactor)
inline

Definition at line 281 of file material.h.

References m_absorbance.

◆ SetCastShadows()

void MATERIAL::SetCastShadows ( bool  aCastShadows)
inline

Set if the material can receive shadows.

Parameters
aCastShadowstrue yes it can, false not it cannot

Definition at line 307 of file material.h.

References m_castShadows.

◆ SetDefaultReflectionRayCount()

static void MATERIAL::SetDefaultReflectionRayCount ( unsigned int  aCount)
inlinestatic

Definition at line 247 of file material.h.

References m_defaultReflectionRayCount.

Referenced by RENDER_3D_RAYTRACE_BASE::setupMaterials().

◆ SetDefaultReflectionRecursionCount()

static void MATERIAL::SetDefaultReflectionRecursionCount ( unsigned int  aCount)
inlinestatic

Definition at line 257 of file material.h.

References m_defaultFeflectionRecursionCount.

Referenced by RENDER_3D_RAYTRACE_BASE::setupMaterials().

◆ SetDefaultRefractionRayCount()

static void MATERIAL::SetDefaultRefractionRayCount ( unsigned int  aCount)
inlinestatic

Definition at line 242 of file material.h.

References m_defaultRefractionRayCount.

Referenced by RENDER_3D_RAYTRACE_BASE::setupMaterials().

◆ SetDefaultRefractionRecursionCount()

static void MATERIAL::SetDefaultRefractionRecursionCount ( unsigned int  aCount)
inlinestatic

Definition at line 252 of file material.h.

References m_defaultRefractionRecursionCount.

Referenced by RENDER_3D_RAYTRACE_BASE::setupMaterials().

◆ SetGenerator()

void MATERIAL::SetGenerator ( const MATERIAL_GENERATOR aGenerator)
inline

Definition at line 328 of file material.h.

References m_generator.

Referenced by RENDER_3D_RAYTRACE_BASE::getModelMaterial().

◆ SetReflectionRayCount()

void MATERIAL::SetReflectionRayCount ( unsigned int  aCount)
inline

Definition at line 287 of file material.h.

References m_reflectionRayCount.

◆ SetReflectionRecursionCount()

void MATERIAL::SetReflectionRecursionCount ( unsigned int  aCount)
inline

Definition at line 292 of file material.h.

References m_reflectionRecursionCount.

◆ SetRefractionRayCount()

void MATERIAL::SetRefractionRayCount ( unsigned int  aCount)
inline

Definition at line 282 of file material.h.

References m_refractionRayCount.

◆ SetRefractionRecursionCount()

void MATERIAL::SetRefractionRecursionCount ( unsigned int  aCount)
inline

Definition at line 297 of file material.h.

References m_refractionRecursionCount.

◆ Shade()

virtual SFVEC3F MATERIAL::Shade ( const RAY aRay,
const HITINFO aHitInfo,
float  NdotL,
const SFVEC3F aDiffuseObjColor,
const SFVEC3F aDirToLight,
const SFVEC3F aLightColor,
float  aShadowAttenuationFactor 
) const
pure virtual

Shade an intersection point.

Parameters
aRaythe camera ray that hits the object
aHitInfothe hit information
NdotLthe dot product between Normal and Light
aDiffuseObjColordiffuse object color
aDirToLighta vector of the incident light direction
aLightColorthe light color
aShadowAttenuationFactor0.0f total in shadow, 1.0f completely not in shadow
Returns
the resultant color

Implemented in BLINN_PHONG_MATERIAL.

Referenced by RENDER_3D_RAYTRACE_BASE::shadeHit().

Member Data Documentation

◆ m_absorbance

float MATERIAL::m_absorbance
protected

absorbance factor for the transparent material.

Definition at line 350 of file material.h.

Referenced by GetAbsorvance(), MATERIAL(), and SetAbsorvance().

◆ m_ambientColor

SFVEC3F MATERIAL::m_ambientColor
protected

Definition at line 338 of file material.h.

Referenced by GetAmbientColor(), MATERIAL(), and BLINN_PHONG_MATERIAL::Shade().

◆ m_castShadows

bool MATERIAL::m_castShadows
protected

true if this object will block the light.

Number of rays that will be interpolated for this material if it is transparent.

Definition at line 352 of file material.h.

Referenced by GetCastShadows(), MATERIAL(), and SetCastShadows().

◆ m_defaultFeflectionRecursionCount

int MATERIAL::m_defaultFeflectionRecursionCount = 3
staticprivate

Definition at line 372 of file material.h.

Referenced by MATERIAL(), and SetDefaultReflectionRecursionCount().

◆ m_defaultReflectionRayCount

int MATERIAL::m_defaultReflectionRayCount = 3
staticprivate

Definition at line 370 of file material.h.

Referenced by MATERIAL(), and SetDefaultReflectionRayCount().

◆ m_defaultRefractionRayCount

int MATERIAL::m_defaultRefractionRayCount = 4
staticprivate

Definition at line 369 of file material.h.

Referenced by MATERIAL(), and SetDefaultRefractionRayCount().

◆ m_defaultRefractionRecursionCount

int MATERIAL::m_defaultRefractionRecursionCount = 2
staticprivate

Definition at line 371 of file material.h.

Referenced by MATERIAL(), and SetDefaultRefractionRecursionCount().

◆ m_emissiveColor

SFVEC3F MATERIAL::m_emissiveColor
protected

Definition at line 344 of file material.h.

Referenced by GetEmissiveColor(), and MATERIAL().

◆ m_generator

const MATERIAL_GENERATOR* MATERIAL::m_generator
protected

Definition at line 366 of file material.h.

Referenced by Generate(), GetGenerator(), MATERIAL(), and SetGenerator().

◆ m_reflection

float MATERIAL::m_reflection
protected

1.0 completely reflective, 0.0 no reflective.

Definition at line 351 of file material.h.

Referenced by GetReflection(), and MATERIAL().

◆ m_reflectionRayCount

unsigned int MATERIAL::m_reflectionRayCount
protected

Number of levels it allows for refraction recursiveness.

Definition at line 358 of file material.h.

Referenced by GetReflectionRayCount(), MATERIAL(), and SetReflectionRayCount().

◆ m_reflectionRecursionCount

unsigned int MATERIAL::m_reflectionRecursionCount
protected

Definition at line 364 of file material.h.

Referenced by GetReflectionRecursionCount(), MATERIAL(), and SetReflectionRecursionCount().

◆ m_reflectivity

float MATERIAL::m_reflectivity
protected

1.0 is completely transparent, 0.0 completely opaque.

Definition at line 346 of file material.h.

Referenced by GetReflectivity(), MATERIAL(), and BLINN_PHONG_MATERIAL::Shade().

◆ m_refractionRayCount

unsigned int MATERIAL::m_refractionRayCount
protected

Number of rays that will be interpolated for this material if it is reflective.

Definition at line 355 of file material.h.

Referenced by GetRefractionRayCount(), MATERIAL(), and SetRefractionRayCount().

◆ m_refractionRecursionCount

unsigned int MATERIAL::m_refractionRecursionCount
protected

Number of levels it allows for reflection recursiveness.

Definition at line 361 of file material.h.

Referenced by GetRefractionRecursionCount(), MATERIAL(), and SetRefractionRecursionCount().

◆ m_specularColor

SFVEC3F MATERIAL::m_specularColor
protected

Definition at line 345 of file material.h.

Referenced by GetSpecularColor(), MATERIAL(), and BLINN_PHONG_MATERIAL::Shade().

◆ m_transparency

float MATERIAL::m_transparency
protected

Definition at line 349 of file material.h.

Referenced by GetTransparency(), and MATERIAL().


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