Geno3D
A simple 3D visualisation library, using C++/SFML.
 All Classes Functions Variables
Public Member Functions | Private Attributes | List of all members
Geno3D::SunLight Class Reference

#include <SunLight.hpp>

Inheritance diagram for Geno3D::SunLight:
Geno3D::Light Geno3D::Transformable

Public Member Functions

 SunLight (Eigen::Vector3f direction)
 
Eigen::VectorXf vertexLighting (const Eigen::Matrix3Xf &normals) override
 
Eigen::Vector3f getDirection ()
 
void setDirection (float x, float y, float z)
 
void translate (float x, float y, float z) override
 
void scale (float m) override
 
void rotate (float x, float y, float z) override
 
void transform (const Transformation &t) override
 

Private Attributes

Eigen::Vector3f direction
 The 3d direction unit vector of the light.
 

Detailed Description

A directional light class.

Constructor & Destructor Documentation

Geno3D::SunLight::SunLight ( Eigen::Vector3f  direction)

Construct a sun light with a direction vector.

Parameters
directionthe 3D direction vector of the light
See Also
getDirection()
setDirection()

Member Function Documentation

Eigen::Vector3f Geno3D::SunLight::getDirection ( )
inline

Get the current direction of the light as a 3D unit vector.

See Also
setDirection()

References direction.

void Geno3D::SunLight::rotate ( float  x,
float  y,
float  z 
)
overridevirtual

Rotate by Euler angles, in radians.

Parameters
xthe angle to rotate by about the x-axis
ythe angle to rotate by about the y-axis
zthe angle to rotate by about the z-axis

Implements Geno3D::Transformable.

References direction.

void Geno3D::SunLight::scale ( float  m)
inlineoverridevirtual

Scale by a factor.

Parameters
mthe factor to scale by

Implements Geno3D::Transformable.

void Geno3D::SunLight::setDirection ( float  x,
float  y,
float  z 
)

Set the direction of the light as a 3D vector.

Parameters
xthe magnitude of the direction in the x-axis
ythe magnitude of the direction in the y-axis
zthe magnitude of the direction in the z-axis
See Also
getDirection()
void Geno3D::SunLight::transform ( const Transformation t)
overridevirtual

Transform by a compound transformation.

Parameters
tthe transformation to apply

Implements Geno3D::Transformable.

References Geno3D::Transformation::apply(), and direction.

void Geno3D::SunLight::translate ( float  x,
float  y,
float  z 
)
overridevirtual

Translate by a 3D vector.

Parameters
xthe amount to translate in the x-axis
ythe amount to translate in the y-axis
zthe amount to translate in the z-axis

Implements Geno3D::Transformable.

References direction.

Eigen::VectorXf Geno3D::SunLight::vertexLighting ( const Eigen::Matrix3Xf &  normals)
overridevirtual

Calculate the lighting on each vertex of an object. Uses vertex normals to calculate the clamped light intensity on each vertex.

Parameters
normalsa 3 by X matrix containing the normals as 3D unit vectors
See Also
Object::render()

Implements Geno3D::Light.

References direction.


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