KiCad PCB EDA Suite
PLATED_COPPER_NORMAL Class Reference

#include <material.h>

Inheritance diagram for PLATED_COPPER_NORMAL:
MATERIAL_GENERATOR

Public Member Functions

 PLATED_COPPER_NORMAL ()
 
 PLATED_COPPER_NORMAL (float aScale)
 
virtual ~PLATED_COPPER_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 102 of file material.h.

Constructor & Destructor Documentation

◆ PLATED_COPPER_NORMAL() [1/2]

PLATED_COPPER_NORMAL::PLATED_COPPER_NORMAL ( )
inline

Definition at line 105 of file material.h.

106  {
107  m_scale = 1.0f;
108  }

References m_scale.

◆ PLATED_COPPER_NORMAL() [2/2]

PLATED_COPPER_NORMAL::PLATED_COPPER_NORMAL ( float  aScale)
inline

Definition at line 110 of file material.h.

111  {
112  m_scale = 1.0f / aScale;
113  }

References m_scale.

◆ ~PLATED_COPPER_NORMAL()

virtual PLATED_COPPER_NORMAL::~PLATED_COPPER_NORMAL ( )
inlinevirtual

Definition at line 115 of file material.h.

116  {
117  }

Member Function Documentation

◆ Generate()

SFVEC3F PLATED_COPPER_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 223 of file material.cpp.

224 {
225  SFVEC3F hitPos = aHitInfo.m_HitPoint * m_scale;
226 
227  const float noise1 = ( s_perlinNoise.noise( hitPos.x, hitPos.y ) - 0.5f );
228  const float noise2 = ( s_perlinNoise.noise( hitPos.y, hitPos.x ) - 0.5f );
229 
230  return SFVEC3F( noise1, noise2, -( noise1 + noise2 ) ) * 0.02f;
231 }
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 PLATED_COPPER_NORMAL::m_scale
private

Definition at line 122 of file material.h.

Referenced by Generate(), and PLATED_COPPER_NORMAL().


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