KiCad PCB EDA Suite
BRUSHED_METAL_NORMAL Class Reference

Procedural generation of the shiny brushed metal. More...

#include <material.h>

Inheritance diagram for BRUSHED_METAL_NORMAL:
MATERIAL_GENERATOR

Public Member Functions

 BRUSHED_METAL_NORMAL ()
 
 BRUSHED_METAL_NORMAL (float aScale)
 
virtual ~BRUSHED_METAL_NORMAL ()
 
SFVEC3F Generate (const RAY &aRay, const HITINFO &aHitInfo) const override
 Generate a 3D vector based on the ray and hit information depending on the implementation. More...
 

Private Attributes

float m_scale
 

Detailed Description

Procedural generation of the shiny brushed metal.

Definition at line 194 of file material.h.

Constructor & Destructor Documentation

◆ BRUSHED_METAL_NORMAL() [1/2]

BRUSHED_METAL_NORMAL::BRUSHED_METAL_NORMAL ( )
inline

Definition at line 197 of file material.h.

198 {
199 m_scale = 1.0f;
200 }

References m_scale.

◆ BRUSHED_METAL_NORMAL() [2/2]

BRUSHED_METAL_NORMAL::BRUSHED_METAL_NORMAL ( float  aScale)

Definition at line 279 of file material.cpp.

280{
281 m_scale = 1.0f / aScale;
282}

References m_scale.

◆ ~BRUSHED_METAL_NORMAL()

virtual BRUSHED_METAL_NORMAL::~BRUSHED_METAL_NORMAL ( )
inlinevirtual

Definition at line 204 of file material.h.

205 {
206 }

Member Function Documentation

◆ Generate()

SFVEC3F BRUSHED_METAL_NORMAL::Generate ( const RAY aRay,
const HITINFO aHitInfo 
) const
overridevirtual

Generate a 3D vector based on the ray and hit information depending on the implementation.

Parameters
aRaythe camera ray that hits the object
aHitInfothe hit information
Returns
the result of the procedural

Implements MATERIAL_GENERATOR.

Definition at line 285 of file material.cpp.

286{
287 const SFVEC3F hitPos = aHitInfo.m_HitPoint * m_scale;
288
289 const float noise1 = s_perlinNoise.noise( hitPos.x * 1.0f, hitPos.y * 1.1f,
290 hitPos.z * 1.2f ) - 0.5f;
291
292 const float noise2 = s_perlinNoise.noise( hitPos.x * 1.3f, hitPos.y * 1.4f,
293 hitPos.z * 1.5f ) - 0.5f;
294
295 const float noise3 = s_perlinNoise.noise( hitPos.x * 0.1f, hitPos.y * 0.1f,
296 hitPos.z * 1.0f ) - 0.5f;
297
298 return SFVEC3F( noise1 * 0.15f + noise3 * 0.35f, noise2 * 0.25f, noise1 * noise2 * noise3 );
299}
float noise(float x, float y, float z) const
static PerlinNoise s_perlinNoise
Definition: material.cpp:136
SFVEC3F m_HitPoint
(12) hit position
Definition: hitinfo.h:44
glm::vec3 SFVEC3F
Definition: xv3d_types.h:44

References HITINFO::m_HitPoint, m_scale, PerlinNoise::noise(), and s_perlinNoise.

Member Data Documentation

◆ m_scale

float BRUSHED_METAL_NORMAL::m_scale
private

Definition at line 211 of file material.h.

Referenced by BRUSHED_METAL_NORMAL(), and Generate().


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