KiCad PCB EDA Suite
CBOARDNORMAL Class Reference

#include <cmaterial.h>

Inheritance diagram for CBOARDNORMAL:
CPROCEDURALGENERATOR

Public Member Functions

 CBOARDNORMAL ()
 
 CBOARDNORMAL (float aScale)
 
virtual ~CBOARDNORMAL ()
 
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 63 of file cmaterial.h.

Constructor & Destructor Documentation

◆ CBOARDNORMAL() [1/2]

CBOARDNORMAL::CBOARDNORMAL ( )
inline

Definition at line 66 of file cmaterial.h.

66 : CPROCEDURALGENERATOR() { m_scale = 1.0f; }
float m_scale
Definition: cmaterial.h:77

References m_scale.

◆ CBOARDNORMAL() [2/2]

CBOARDNORMAL::CBOARDNORMAL ( float  aScale)

Definition at line 160 of file cmaterial.cpp.

161 {
162  m_scale = (2.0f * glm::pi<float>()) / aScale;
163 }
float m_scale
Definition: cmaterial.h:77

References m_scale.

◆ ~CBOARDNORMAL()

virtual CBOARDNORMAL::~CBOARDNORMAL ( )
inlinevirtual

Definition at line 69 of file cmaterial.h.

70  {
71  }

Member Function Documentation

◆ Generate()

SFVEC3F CBOARDNORMAL::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 166 of file cmaterial.cpp.

167 {
168  const SFVEC3F hitPos = aHitInfo.m_HitPoint * m_scale;
169 
170  // http://www.fooplot.com/#W3sidHlwZSI6MCwiZXEiOiJzaW4oc2luKHNpbih4KSoxLjkpKjEuNSkiLCJjb2xvciI6IiMwMDAwMDAifSx7InR5cGUiOjEwMDAsIndpbmRvdyI6WyItMC45NjIxMDU3MDgwNzg1MjYyIiwiNy45NzE0MjYyNjc2MDE0MyIsIi0yLjUxNzYyMDM1MTQ4MjQ0OSIsIjIuOTc5OTM3Nzg3Mzk3NTMwMyJdLCJzaXplIjpbNjQ2LDM5Nl19XQ--
171 
172  // Implement a texture as the "measling crazing blistering" method of FR4
173 
174  const float x = glm::sin( glm::sin( hitPos.x ) * 1.5f ) * 0.06f;
175  const float y = glm::sin( glm::sin( hitPos.y ) * 1.5f ) * 0.03f;
176  const float z = -(x + y) + glm::sin( hitPos.z ) * 0.06f;
177 
178  const float noise1 = s_perlinNoise.noise( hitPos.x * 1.0f, hitPos.y * 0.7f ) - 0.5f;
179  const float noise2 = s_perlinNoise.noise( hitPos.x * 0.7f, hitPos.y * 1.0f ) - 0.5f;
180  const float noise3 = s_perlinNoise.noise( hitPos.x * 0.3f, hitPos.z * 1.0f ) - 0.5f;
181 
182  return ( SFVEC3F( noise1, noise2, -( noise3 ) ) * 0.3f + SFVEC3F( x, y, z ) );
183 }
float m_scale
Definition: cmaterial.h:77
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 CBOARDNORMAL::m_scale
private

Definition at line 77 of file cmaterial.h.

Referenced by CBOARDNORMAL(), and Generate().


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