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
 
float m_transparency
 1.0 is completely transparent, 0.0 completely opaque.
 
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 transparent.
 
unsigned int m_reflectionRayCount
 Number of rays that will be interpolated for this material if it is reflective.
 
unsigned int m_refractionRecursionCount
 Number of levels it allows for refraction recursiveness.
 
unsigned int m_reflectionRecursionCount
 Number of levels it allows for reflection recursiveness.
 
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 374 of file material.h.

Constructor & Destructor Documentation

◆ BLINN_PHONG_MATERIAL() [1/2]

BLINN_PHONG_MATERIAL::BLINN_PHONG_MATERIAL ( )
inline

Definition at line 377 of file material.h.

References MATERIAL::MATERIAL().

◆ 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 379 of file material.h.

References MATERIAL::MATERIAL().

Member Function Documentation

◆ Generate()

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

Definition at line 86 of file material.cpp.

References m_generator.

◆ GetAbsorvance()

float MATERIAL::GetAbsorvance ( ) const
inlineinherited

Definition at line 271 of file material.h.

References m_absorbance.

Referenced by RENDER_3D_RAYTRACE_BASE::shadeHit().

◆ GetAmbientColor()

const SFVEC3F & MATERIAL::GetAmbientColor ( ) const
inlineinherited

Definition at line 264 of file material.h.

References m_ambientColor.

Referenced by RENDER_3D_RAYTRACE_BASE::shadeHit().

◆ GetCastShadows()

bool MATERIAL::GetCastShadows ( ) const
inlineinherited

Definition at line 305 of file material.h.

References m_castShadows.

Referenced by BVH_PBRT::IntersectP().

◆ GetEmissiveColor()

const SFVEC3F & MATERIAL::GetEmissiveColor ( ) const
inlineinherited

Definition at line 265 of file material.h.

References m_emissiveColor.

Referenced by RENDER_3D_RAYTRACE_BASE::shadeHit().

◆ GetGenerator()

const MATERIAL_GENERATOR * MATERIAL::GetGenerator ( ) const
inlineinherited

Definition at line 329 of file material.h.

References m_generator.

◆ GetReflection()

float MATERIAL::GetReflection ( ) const
inlineinherited

Definition at line 270 of file material.h.

References m_reflection.

Referenced by RENDER_3D_RAYTRACE_BASE::shadeHit().

◆ GetReflectionRayCount()

unsigned int MATERIAL::GetReflectionRayCount ( ) const
inlineinherited

Definition at line 273 of file material.h.

References m_reflectionRayCount.

Referenced by RENDER_3D_RAYTRACE_BASE::shadeHit().

◆ GetReflectionRecursionCount()

unsigned int MATERIAL::GetReflectionRecursionCount ( ) const
inlineinherited

Definition at line 274 of file material.h.

References m_reflectionRecursionCount.

◆ GetReflectivity()

float MATERIAL::GetReflectivity ( ) const
inlineinherited

Definition at line 268 of file material.h.

References m_reflectivity.

◆ GetRefractionRayCount()

unsigned int MATERIAL::GetRefractionRayCount ( ) const
inlineinherited

Definition at line 272 of file material.h.

References m_refractionRayCount.

Referenced by RENDER_3D_RAYTRACE_BASE::shadeHit().

◆ GetRefractionRecursionCount()

unsigned int MATERIAL::GetRefractionRecursionCount ( ) const
inlineinherited

Definition at line 275 of file material.h.

References m_refractionRecursionCount.

◆ GetSpecularColor()

const SFVEC3F & MATERIAL::GetSpecularColor ( ) const
inlineinherited

Definition at line 266 of file material.h.

References m_specularColor.

Referenced by RENDER_3D_RAYTRACE_BASE::shadeHit().

◆ GetTransparency()

float MATERIAL::GetTransparency ( ) const
inlineinherited

Definition at line 269 of file material.h.

References m_transparency.

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

◆ SetAbsorvance()

void MATERIAL::SetAbsorvance ( float aAbsorvanceFactor)
inlineinherited

Definition at line 277 of file material.h.

References 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 303 of file material.h.

References m_castShadows.

◆ SetDefaultReflectionRayCount()

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

Definition at line 243 of file material.h.

References m_defaultReflectionRayCount.

Referenced by RENDER_3D_RAYTRACE_BASE::setupMaterials().

◆ SetDefaultReflectionRecursionCount()

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

Definition at line 253 of file material.h.

References m_defaultFeflectionRecursionCount.

Referenced by RENDER_3D_RAYTRACE_BASE::setupMaterials().

◆ SetDefaultRefractionRayCount()

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

Definition at line 238 of file material.h.

References m_defaultRefractionRayCount.

Referenced by RENDER_3D_RAYTRACE_BASE::setupMaterials().

◆ SetDefaultRefractionRecursionCount()

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

Definition at line 248 of file material.h.

References m_defaultRefractionRecursionCount.

Referenced by RENDER_3D_RAYTRACE_BASE::setupMaterials().

◆ SetGenerator()

void MATERIAL::SetGenerator ( const MATERIAL_GENERATOR * aGenerator)
inlineinherited

Definition at line 324 of file material.h.

References m_generator.

Referenced by RENDER_3D_RAYTRACE_BASE::getModelMaterial().

◆ SetReflectionRayCount()

void MATERIAL::SetReflectionRayCount ( unsigned int aCount)
inlineinherited

Definition at line 283 of file material.h.

References m_reflectionRayCount.

◆ SetReflectionRecursionCount()

void MATERIAL::SetReflectionRecursionCount ( unsigned int aCount)
inlineinherited

Definition at line 288 of file material.h.

References m_reflectionRecursionCount.

◆ SetRefractionRayCount()

void MATERIAL::SetRefractionRayCount ( unsigned int aCount)
inlineinherited

Definition at line 278 of file material.h.

References m_refractionRayCount.

◆ SetRefractionRecursionCount()

void MATERIAL::SetRefractionRecursionCount ( unsigned int aCount)
inlineinherited

Definition at line 293 of file material.h.

References 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 97 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 346 of file material.h.

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

◆ m_ambientColor

SFVEC3F MATERIAL::m_ambientColor
protectedinherited

Definition at line 334 of file material.h.

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

◆ m_castShadows

bool MATERIAL::m_castShadows
protectedinherited

true if this object will block the light.

Definition at line 348 of file material.h.

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

◆ m_defaultFeflectionRecursionCount

int MATERIAL::m_defaultFeflectionRecursionCount = 3
staticprivateinherited

Definition at line 368 of file material.h.

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

◆ m_defaultReflectionRayCount

int MATERIAL::m_defaultReflectionRayCount = 3
staticprivateinherited

Definition at line 366 of file material.h.

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

◆ m_defaultRefractionRayCount

int MATERIAL::m_defaultRefractionRayCount = 4
staticprivateinherited

Definition at line 365 of file material.h.

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

◆ m_defaultRefractionRecursionCount

int MATERIAL::m_defaultRefractionRecursionCount = 2
staticprivateinherited

Definition at line 367 of file material.h.

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

◆ m_emissiveColor

SFVEC3F MATERIAL::m_emissiveColor
protectedinherited

Definition at line 340 of file material.h.

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

◆ m_generator

const MATERIAL_GENERATOR* MATERIAL::m_generator
protectedinherited

Definition at line 362 of file material.h.

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

◆ m_reflection

float MATERIAL::m_reflection
protectedinherited

1.0 completely reflective, 0.0 no reflective.

Definition at line 347 of file material.h.

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

◆ m_reflectionRayCount

unsigned int MATERIAL::m_reflectionRayCount
protectedinherited

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

Definition at line 354 of file material.h.

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

◆ m_reflectionRecursionCount

unsigned int MATERIAL::m_reflectionRecursionCount
protectedinherited

Number of levels it allows for reflection recursiveness.

Definition at line 360 of file material.h.

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

◆ m_reflectivity

float MATERIAL::m_reflectivity
protectedinherited

Definition at line 342 of file material.h.

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

◆ m_refractionRayCount

unsigned int MATERIAL::m_refractionRayCount
protectedinherited

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

Definition at line 351 of file material.h.

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

◆ m_refractionRecursionCount

unsigned int MATERIAL::m_refractionRecursionCount
protectedinherited

Number of levels it allows for refraction recursiveness.

Definition at line 357 of file material.h.

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

◆ m_specularColor

SFVEC3F MATERIAL::m_specularColor
protectedinherited

Definition at line 341 of file material.h.

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

◆ m_transparency

float MATERIAL::m_transparency
protectedinherited

1.0 is completely transparent, 0.0 completely opaque.

Definition at line 345 of file material.h.

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


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