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

Constructor & Destructor Documentation

◆ BRUSHED_METAL_NORMAL() [1/2]

BRUSHED_METAL_NORMAL::BRUSHED_METAL_NORMAL ( )
inline

Definition at line 201 of file material.h.

202  {
203  m_scale = 1.0f;
204  }

References m_scale.

◆ BRUSHED_METAL_NORMAL() [2/2]

BRUSHED_METAL_NORMAL::BRUSHED_METAL_NORMAL ( float  aScale)

Definition at line 283 of file material.cpp.

284 {
285  m_scale = 1.0f / aScale;
286 }

References m_scale.

◆ ~BRUSHED_METAL_NORMAL()

virtual BRUSHED_METAL_NORMAL::~BRUSHED_METAL_NORMAL ( )
inlinevirtual

Definition at line 208 of file material.h.

209  {
210  }

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 289 of file material.cpp.

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

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

Referenced by BRUSHED_METAL_NORMAL(), and Generate().


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