KiCad PCB EDA Suite
CPLASTICSHINENORMAL Class Reference

#include <cmaterial.h>

Inheritance diagram for CPLASTICSHINENORMAL:
CPROCEDURALGENERATOR

Public Member Functions

 CPLASTICSHINENORMAL ()
 
 CPLASTICSHINENORMAL (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

PerlinNoise m_perlin
 
float m_scale
 

Detailed Description

Definition at line 129 of file cmaterial.h.

Constructor & Destructor Documentation

CPLASTICSHINENORMAL::CPLASTICSHINENORMAL ( )
inline

Definition at line 132 of file cmaterial.h.

References m_scale.

133  {
134  m_scale = 1.0f;
135  }
CPLASTICSHINENORMAL::CPLASTICSHINENORMAL ( float  aScale)

Definition at line 250 of file cmaterial.cpp.

References m_scale.

251 {
252  m_scale = 1.0f / aScale;
253 }

Member Function Documentation

SFVEC3F CPLASTICSHINENORMAL::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 256 of file cmaterial.cpp.

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

257 {
258  const SFVEC3F hitPos = aHitInfo.m_HitPoint * m_scale;
259 
260  const float noise1 = m_perlin.noise( hitPos.x * 0.05f,
261  hitPos.y * 0.05f,
262  hitPos.z * 0.05f ) - 0.5f;
263 
264  const float noise2 = m_perlin.noise( hitPos.x * 0.2f,
265  hitPos.y * 0.2f,
266  hitPos.z * 0.2f ) - 0.5f;
267 
268  const float noise3 = m_perlin.noise( hitPos.x * 0.5f,
269  hitPos.y * 0.5f,
270  hitPos.z * 0.5f ) - 0.5f;
271 
272  return SFVEC3F( noise1 * 0.5f, noise2 * 0.5f, noise3 * 0.5f );
273 }
SFVEC3F m_HitPoint
(12) hit position
Definition: hitinfo.h:49
PerlinNoise m_perlin
Definition: cmaterial.h:143
float noise(float x, float y, float z) const
Definition: PerlinNoise.cpp:97
glm::vec3 SFVEC3F
Definition: xv3d_types.h:47

Member Data Documentation

PerlinNoise CPLASTICSHINENORMAL::m_perlin
private

Definition at line 143 of file cmaterial.h.

Referenced by Generate().

float CPLASTICSHINENORMAL::m_scale
private

Definition at line 144 of file cmaterial.h.

Referenced by CPLASTICSHINENORMAL(), and Generate().


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