KiCad PCB EDA Suite
BOARD_NORMAL Class Reference

#include <material.h>

Inheritance diagram for BOARD_NORMAL:
MATERIAL_GENERATOR

Public Member Functions

 BOARD_NORMAL ()
 
 BOARD_NORMAL (float aScale)
 
virtual ~BOARD_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 59 of file material.h.

Constructor & Destructor Documentation

◆ BOARD_NORMAL() [1/2]

BOARD_NORMAL::BOARD_NORMAL ( )
inline

Definition at line 62 of file material.h.

62 : MATERIAL_GENERATOR() { m_scale = 1.0f; }
float m_scale
Definition: material.h:72

References m_scale.

◆ BOARD_NORMAL() [2/2]

BOARD_NORMAL::BOARD_NORMAL ( float  aScale)

Definition at line 143 of file material.cpp.

144 {
145  m_scale = ( 2.0f * glm::pi<float>() ) / aScale;
146 }
float m_scale
Definition: material.h:72

References m_scale.

◆ ~BOARD_NORMAL()

virtual BOARD_NORMAL::~BOARD_NORMAL ( )
inlinevirtual

Definition at line 65 of file material.h.

66  {
67  }

Member Function Documentation

◆ Generate()

SFVEC3F BOARD_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 149 of file material.cpp.

150 {
151  const SFVEC3F hitPos = aHitInfo.m_HitPoint * m_scale;
152 
153  // http://www.fooplot.com/#W3sidHlwZSI6MCwiZXEiOiJzaW4oc2luKHNpbih4KSoxLjkpKjEuNSkiLCJjb2xvciI6IiMwMDAwMDAifSx7InR5cGUiOjEwMDAsIndpbmRvdyI6WyItMC45NjIxMDU3MDgwNzg1MjYyIiwiNy45NzE0MjYyNjc2MDE0MyIsIi0yLjUxNzYyMDM1MTQ4MjQ0OSIsIjIuOTc5OTM3Nzg3Mzk3NTMwMyJdLCJzaXplIjpbNjQ2LDM5Nl19XQ--
154 
155  // Implement a texture as the "measling crazing blistering" method of FR4
156  const float x = glm::sin( glm::sin( hitPos.x ) * 1.5f ) * 0.06f;
157  const float y = glm::sin( glm::sin( hitPos.y ) * 1.5f ) * 0.03f;
158  const float z = -(x + y) + glm::sin( hitPos.z ) * 0.06f;
159 
160  const float noise1 = s_perlinNoise.noise( hitPos.x * 1.0f, hitPos.y * 0.7f ) - 0.5f;
161  const float noise2 = s_perlinNoise.noise( hitPos.x * 0.7f, hitPos.y * 1.0f ) - 0.5f;
162  const float noise3 = s_perlinNoise.noise( hitPos.x * 0.3f, hitPos.z * 1.0f ) - 0.5f;
163 
164  return ( SFVEC3F( noise1, noise2, -( noise3 ) ) * 0.3f + SFVEC3F( x, y, z ) );
165 }
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
float m_scale
Definition: material.h:72

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

Member Data Documentation

◆ m_scale

float BOARD_NORMAL::m_scale
private

Definition at line 72 of file material.h.

Referenced by BOARD_NORMAL(), and Generate().


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