KiCad PCB EDA Suite
CMETALBRUSHEDNORMAL Class Reference

#include <cmaterial.h>

Inheritance diagram for CMETALBRUSHEDNORMAL:
CPROCEDURALGENERATOR

Public Member Functions

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

Private Attributes

float m_scale
 

Detailed Description

Definition at line 193 of file cmaterial.h.

Constructor & Destructor Documentation

◆ CMETALBRUSHEDNORMAL() [1/2]

CMETALBRUSHEDNORMAL::CMETALBRUSHEDNORMAL ( )
inline

Definition at line 196 of file cmaterial.h.

197  {
198  m_scale = 1.0f;
199  }

References m_scale.

◆ CMETALBRUSHEDNORMAL() [2/2]

CMETALBRUSHEDNORMAL::CMETALBRUSHEDNORMAL ( float  aScale)

Definition at line 301 of file cmaterial.cpp.

302 {
303  m_scale = 1.0f / aScale;
304 }

References m_scale.

◆ ~CMETALBRUSHEDNORMAL()

virtual CMETALBRUSHEDNORMAL::~CMETALBRUSHEDNORMAL ( )
inlinevirtual

Definition at line 203 of file cmaterial.h.

204  {
205  }

Member Function Documentation

◆ Generate()

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

Generate - Generates 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 CPROCEDURALGENERATOR.

Definition at line 307 of file cmaterial.cpp.

308 {
309  const SFVEC3F hitPos = aHitInfo.m_HitPoint * m_scale;
310 
311  const float noise1 = s_perlinNoise.noise( hitPos.x * 1.0f,
312  hitPos.y * 1.1f,
313  hitPos.z * 1.2f ) - 0.5f;
314 
315  const float noise2 = s_perlinNoise.noise( hitPos.x * 1.3f,
316  hitPos.y * 1.4f,
317  hitPos.z * 1.5f ) - 0.5f;
318 
319  const float noise3 = s_perlinNoise.noise( hitPos.x * 0.1f,
320  hitPos.y * 0.1f,
321  hitPos.z * 1.0f ) - 0.5f;
322 
323  return SFVEC3F( noise1 * 0.15f + noise3 * 0.35f,
324  noise2 * 0.25f,
325  noise1 * noise2 * noise3 );
326 }
SFVEC3F m_HitPoint
(12) hit position
Definition: hitinfo.h:49
static PerlinNoise s_perlinNoise
Definition: cmaterial.cpp:157
glm::vec3 SFVEC3F
Definition: xv3d_types.h:47
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 CMETALBRUSHEDNORMAL::m_scale
private

Definition at line 211 of file cmaterial.h.

Referenced by CMETALBRUSHEDNORMAL(), and Generate().


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