KiCad PCB EDA Suite
Loading...
Searching...
No Matches
BLINN_PHONG_MATERIAL Class Reference

Blinn Phong based material https://en.wikipedia.org/wiki/Blinn%E2%80%93Phong_shading_model. More...

#include <material.h>

Inheritance diagram for BLINN_PHONG_MATERIAL:
MATERIAL

Public Member Functions

 BLINN_PHONG_MATERIAL ()
 
 BLINN_PHONG_MATERIAL (const SFVEC3F &aAmbient, const SFVEC3F &aEmissive, const SFVEC3F &aSpecular, float aShinness, float aTransparency, float aReflection)
 
SFVEC3F Shade (const RAY &aRay, const HITINFO &aHitInfo, float NdotL, const SFVEC3F &aDiffuseObjColor, const SFVEC3F &aDirToLight, const SFVEC3F &aLightColor, float aShadowAttenuationFactor) const override
 Shade an intersection point.
 
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
 
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

Blinn Phong based material https://en.wikipedia.org/wiki/Blinn%E2%80%93Phong_shading_model.

Definition at line 378 of file material.h.

Constructor & Destructor Documentation

◆ BLINN_PHONG_MATERIAL() [1/2]

BLINN_PHONG_MATERIAL::BLINN_PHONG_MATERIAL ( )
inline

Definition at line 381 of file material.h.

◆ BLINN_PHONG_MATERIAL() [2/2]

BLINN_PHONG_MATERIAL::BLINN_PHONG_MATERIAL ( const SFVEC3F aAmbient,
const SFVEC3F aEmissive,
const SFVEC3F aSpecular,
float  aShinness,
float  aTransparency,
float  aReflection 
)
inline

Definition at line 383 of file material.h.

Member Function Documentation

◆ Generate()

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

◆ GetAbsorvance()

float MATERIAL::GetAbsorvance ( ) const
inlineinherited

Definition at line 275 of file material.h.

References MATERIAL::m_absorbance.

Referenced by RENDER_3D_RAYTRACE_BASE::shadeHit().

◆ GetAmbientColor()

const SFVEC3F & MATERIAL::GetAmbientColor ( ) const
inlineinherited

Definition at line 268 of file material.h.

References MATERIAL::m_ambientColor.

Referenced by RENDER_3D_RAYTRACE_BASE::shadeHit().

◆ GetCastShadows()

bool MATERIAL::GetCastShadows ( ) const
inlineinherited

Definition at line 309 of file material.h.

References MATERIAL::m_castShadows.

Referenced by BVH_PBRT::IntersectP().

◆ GetEmissiveColor()

const SFVEC3F & MATERIAL::GetEmissiveColor ( ) const
inlineinherited

Definition at line 269 of file material.h.

References MATERIAL::m_emissiveColor.

Referenced by RENDER_3D_RAYTRACE_BASE::shadeHit().

◆ GetGenerator()

const MATERIAL_GENERATOR * MATERIAL::GetGenerator ( ) const
inlineinherited

Definition at line 333 of file material.h.

References MATERIAL::m_generator.

◆ GetReflection()

float MATERIAL::GetReflection ( ) const
inlineinherited

Definition at line 274 of file material.h.

References MATERIAL::m_reflection.

Referenced by RENDER_3D_RAYTRACE_BASE::shadeHit().

◆ GetReflectionRayCount()

unsigned int MATERIAL::GetReflectionRayCount ( ) const
inlineinherited

Definition at line 277 of file material.h.

References MATERIAL::m_reflectionRayCount.

Referenced by RENDER_3D_RAYTRACE_BASE::shadeHit().

◆ GetReflectionRecursionCount()

unsigned int MATERIAL::GetReflectionRecursionCount ( ) const
inlineinherited

Definition at line 278 of file material.h.

References MATERIAL::m_reflectionRecursionCount.

◆ GetReflectivity()

float MATERIAL::GetReflectivity ( ) const
inlineinherited

Definition at line 272 of file material.h.

References MATERIAL::m_reflectivity.

◆ GetRefractionRayCount()

unsigned int MATERIAL::GetRefractionRayCount ( ) const
inlineinherited

Definition at line 276 of file material.h.

References MATERIAL::m_refractionRayCount.

Referenced by RENDER_3D_RAYTRACE_BASE::shadeHit().

◆ GetRefractionRecursionCount()

unsigned int MATERIAL::GetRefractionRecursionCount ( ) const
inlineinherited

Definition at line 279 of file material.h.

References MATERIAL::m_refractionRecursionCount.

Referenced by RENDER_3D_RAYTRACE_BASE::shadeHit().

◆ GetSpecularColor()

const SFVEC3F & MATERIAL::GetSpecularColor ( ) const
inlineinherited

Definition at line 270 of file material.h.

References MATERIAL::m_specularColor.

Referenced by RENDER_3D_RAYTRACE_BASE::shadeHit().

◆ GetTransparency()

float MATERIAL::GetTransparency ( ) const
inlineinherited

Definition at line 273 of file material.h.

References MATERIAL::m_transparency.

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

◆ SetAbsorvance()

void MATERIAL::SetAbsorvance ( float  aAbsorvanceFactor)
inlineinherited

Definition at line 281 of file material.h.

References MATERIAL::m_absorbance.

◆ SetCastShadows()

void MATERIAL::SetCastShadows ( bool  aCastShadows)
inlineinherited

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 MATERIAL::m_castShadows.

◆ SetDefaultReflectionRayCount()

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

◆ SetDefaultReflectionRecursionCount()

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

◆ SetDefaultRefractionRayCount()

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

◆ SetDefaultRefractionRecursionCount()

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

◆ SetGenerator()

void MATERIAL::SetGenerator ( const MATERIAL_GENERATOR aGenerator)
inlineinherited

Definition at line 328 of file material.h.

References MATERIAL::m_generator.

Referenced by RENDER_3D_RAYTRACE_BASE::getModelMaterial().

◆ SetReflectionRayCount()

void MATERIAL::SetReflectionRayCount ( unsigned int  aCount)
inlineinherited

Definition at line 287 of file material.h.

References MATERIAL::m_reflectionRayCount.

◆ SetReflectionRecursionCount()

void MATERIAL::SetReflectionRecursionCount ( unsigned int  aCount)
inlineinherited

Definition at line 292 of file material.h.

References MATERIAL::m_reflectionRecursionCount.

◆ SetRefractionRayCount()

void MATERIAL::SetRefractionRayCount ( unsigned int  aCount)
inlineinherited

Definition at line 282 of file material.h.

References MATERIAL::m_refractionRayCount.

◆ SetRefractionRecursionCount()

void MATERIAL::SetRefractionRecursionCount ( unsigned int  aCount)
inlineinherited

Definition at line 297 of file material.h.

References MATERIAL::m_refractionRecursionCount.

◆ Shade()

SFVEC3F BLINN_PHONG_MATERIAL::Shade ( const RAY aRay,
const HITINFO aHitInfo,
float  NdotL,
const SFVEC3F aDiffuseObjColor,
const SFVEC3F aDirToLight,
const SFVEC3F aLightColor,
float  aShadowAttenuationFactor 
) const
overridevirtual

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

Implements MATERIAL.

Definition at line 100 of file material.cpp.

References H, MATERIAL::m_ambientColor, RAY::m_Dir, HITINFO::m_HitNormal, MATERIAL::m_reflectivity, MATERIAL::m_specularColor, and SPECULAR_FACTOR.

Member Data Documentation

◆ m_absorbance

float MATERIAL::m_absorbance
protectedinherited

absorbance factor for the transparent material.

Definition at line 350 of file material.h.

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

◆ m_ambientColor

SFVEC3F MATERIAL::m_ambientColor
protectedinherited

Definition at line 338 of file material.h.

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

◆ m_castShadows

bool MATERIAL::m_castShadows
protectedinherited

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 MATERIAL::GetCastShadows(), MATERIAL::MATERIAL(), and MATERIAL::SetCastShadows().

◆ m_defaultFeflectionRecursionCount

int MATERIAL::m_defaultFeflectionRecursionCount = 3
staticprivateinherited

Definition at line 372 of file material.h.

Referenced by MATERIAL::MATERIAL(), and MATERIAL::SetDefaultReflectionRecursionCount().

◆ m_defaultReflectionRayCount

int MATERIAL::m_defaultReflectionRayCount = 3
staticprivateinherited

Definition at line 370 of file material.h.

Referenced by MATERIAL::MATERIAL(), and MATERIAL::SetDefaultReflectionRayCount().

◆ m_defaultRefractionRayCount

int MATERIAL::m_defaultRefractionRayCount = 4
staticprivateinherited

Definition at line 369 of file material.h.

Referenced by MATERIAL::MATERIAL(), and MATERIAL::SetDefaultRefractionRayCount().

◆ m_defaultRefractionRecursionCount

int MATERIAL::m_defaultRefractionRecursionCount = 2
staticprivateinherited

Definition at line 371 of file material.h.

Referenced by MATERIAL::MATERIAL(), and MATERIAL::SetDefaultRefractionRecursionCount().

◆ m_emissiveColor

SFVEC3F MATERIAL::m_emissiveColor
protectedinherited

Definition at line 344 of file material.h.

Referenced by MATERIAL::GetEmissiveColor(), and MATERIAL::MATERIAL().

◆ m_generator

const MATERIAL_GENERATOR* MATERIAL::m_generator
protectedinherited

◆ m_reflection

float MATERIAL::m_reflection
protectedinherited

1.0 completely reflective, 0.0 no reflective.

Definition at line 351 of file material.h.

Referenced by MATERIAL::GetReflection(), and MATERIAL::MATERIAL().

◆ m_reflectionRayCount

unsigned int MATERIAL::m_reflectionRayCount
protectedinherited

Number of levels it allows for refraction recursiveness.

Definition at line 358 of file material.h.

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

◆ m_reflectionRecursionCount

unsigned int MATERIAL::m_reflectionRecursionCount
protectedinherited

◆ m_reflectivity

float MATERIAL::m_reflectivity
protectedinherited

1.0 is completely transparent, 0.0 completely opaque.

Definition at line 346 of file material.h.

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

◆ m_refractionRayCount

unsigned int MATERIAL::m_refractionRayCount
protectedinherited

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

Definition at line 355 of file material.h.

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

◆ m_refractionRecursionCount

unsigned int MATERIAL::m_refractionRecursionCount
protectedinherited

Number of levels it allows for reflection recursiveness.

Definition at line 361 of file material.h.

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

◆ m_specularColor

SFVEC3F MATERIAL::m_specularColor
protectedinherited

Definition at line 345 of file material.h.

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

◆ m_transparency

float MATERIAL::m_transparency
protectedinherited

Definition at line 349 of file material.h.

Referenced by MATERIAL::GetTransparency(), and MATERIAL::MATERIAL().


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