KiCad PCB EDA Suite
CBOARDNORMAL Class Reference

#include <cmaterial.h>

Inheritance diagram for CBOARDNORMAL:
CPROCEDURALGENERATOR

Public Member Functions

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

Constructor & Destructor Documentation

CBOARDNORMAL::CBOARDNORMAL ( )
inline

Definition at line 62 of file cmaterial.h.

References m_scale.

62 : CPROCEDURALGENERATOR() { m_scale = 1.0f; }
float m_scale
Definition: cmaterial.h:69
CBOARDNORMAL::CBOARDNORMAL ( float  aScale)

Definition at line 148 of file cmaterial.cpp.

References m_scale.

149 {
150  m_scale = (2.0f * glm::pi<float>()) / aScale;
151 }
float m_scale
Definition: cmaterial.h:69

Member Function Documentation

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 154 of file cmaterial.cpp.

References Fast_RandFloat(), HITINFO::m_HitPoint, and m_scale.

155 {
156  const SFVEC3F &hitPos = aHitInfo.m_HitPoint;
157 
158  // http://www.fooplot.com/#W3sidHlwZSI6MCwiZXEiOiJzaW4oc2luKHNpbih4KSoxLjkpKjEuNSkiLCJjb2xvciI6IiMwMDAwMDAifSx7InR5cGUiOjEwMDAsIndpbmRvdyI6WyItMC45NjIxMDU3MDgwNzg1MjYyIiwiNy45NzE0MjYyNjc2MDE0MyIsIi0yLjUxNzYyMDM1MTQ4MjQ0OSIsIjIuOTc5OTM3Nzg3Mzk3NTMwMyJdLCJzaXplIjpbNjQ2LDM5Nl19XQ--
159 
160  // Implement a texture as the "measling crazing blistering" method of FR4
161 
162  const float x = (glm::sin(glm::sin( glm::sin( hitPos.x * m_scale ) * 1.9f ) * 1.5f ) + 0.0f) * 0.10f;
163  const float y = (glm::sin(glm::sin( glm::sin( hitPos.y * m_scale ) * 1.9f ) * 1.5f ) + 0.0f) * 0.10f;
164  const float z = glm::sin( 2.0f * hitPos.z * m_scale + Fast_RandFloat() * 1.0f ) * 0.2f;
165 
166  return SFVEC3F( x, y, z );
167 }
float Fast_RandFloat()
Definition: 3d_fastmath.cpp:45
float m_scale
Definition: cmaterial.h:69
SFVEC3F m_HitPoint
(12) hit position
Definition: hitinfo.h:49
glm::vec3 SFVEC3F
Definition: xv3d_types.h:47

Member Data Documentation

float CBOARDNORMAL::m_scale
private

Definition at line 69 of file cmaterial.h.

Referenced by CBOARDNORMAL(), and Generate().


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