KiCad PCB EDA Suite
SILK_SCREEN_NORMAL Class Reference

#include <material.h>

Inheritance diagram for SILK_SCREEN_NORMAL:
MATERIAL_GENERATOR

Public Member Functions

 SILK_SCREEN_NORMAL ()
 
 SILK_SCREEN_NORMAL (float aScale)
 
virtual ~SILK_SCREEN_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

Definition at line 215 of file material.h.

Constructor & Destructor Documentation

◆ SILK_SCREEN_NORMAL() [1/2]

SILK_SCREEN_NORMAL::SILK_SCREEN_NORMAL ( )
inline

Definition at line 218 of file material.h.

219 {
220 m_scale = 1.0f;
221 }

References m_scale.

◆ SILK_SCREEN_NORMAL() [2/2]

SILK_SCREEN_NORMAL::SILK_SCREEN_NORMAL ( float  aScale)

Definition at line 302 of file material.cpp.

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

References m_scale.

◆ ~SILK_SCREEN_NORMAL()

virtual SILK_SCREEN_NORMAL::~SILK_SCREEN_NORMAL ( )
inlinevirtual

Definition at line 225 of file material.h.

226 {
227 }

Member Function Documentation

◆ Generate()

SFVEC3F SILK_SCREEN_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 308 of file material.cpp.

309{
310 const SFVEC3F hitPos = aHitInfo.m_HitPoint * m_scale;
311
312 const float noise1 = s_perlinNoise.noise( hitPos.x * 2.0f, hitPos.y * 2.0f, hitPos.z );
313
314 const float noise2 = s_perlinNoise.noise( hitPos.x * 0.6f, hitPos.y * 0.6f, hitPos.z );
315
316 SFVEC3F t = SFVEC3F( noise1, noise2, 0.0f ) - 0.5f;
317
318 SFVEC3F tt = t * t;
319
320 t = t * tt * tt * 100.0f; // this factor controls the intensity of the effect
321
322 t.z = 0.0f; // this will keep untouch the original z component of the normal
323
324 return t;
325}
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 SILK_SCREEN_NORMAL::m_scale
private

Definition at line 232 of file material.h.

Referenced by Generate(), and SILK_SCREEN_NORMAL().


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