nngn
Loading...
Searching...
No Matches
nngn::Lighting Class Reference

#include <light.h>

Collaboration diagram for nngn::Lighting:

Public Member Functions

void init (Math *m)
 
bool enabled () const
 
bool zsprites (void) const
 
bool update_sun (void) const
 
bool shadows_enabled (void) const
 
const vec4ambient_light () const
 
std::span< const Lightdir_lights () const
 
std::span< Lightdir_lights ()
 
std::span< const Lightpoint_lights () const
 
std::span< Lightpoint_lights ()
 
Lightsun_light ()
 
const Lightsun_light () const
 
float shadow_map_near () const
 
float shadow_map_far () const
 
const mat4dir_proj () const
 
const mat4point_proj () const
 
const mat4dir_view (size_t i) const
 
const mat4point_view (size_t i, size_t f) const
 
const LightsUBOubo () const
 
Sunsun ()
 
void set_enabled (bool b)
 
void set_zsprites (bool b)
 
void set_update_sun (bool b)
 
void set_shadows_enabled (bool b)
 
void set_ambient_light (const vec4 &v)
 
void set_ambient_anim (LightAnimation a)
 
void set_sun_light (Light *l)
 
void set_shadow_map_proj_size (float s)
 
void set_shadow_map_near (float f)
 
void set_shadow_map_far (float f)
 
Lightadd_light (Light::Type t)
 
void remove_light (Light *l)
 
bool update (const Timing &t)
 
void update_view (const vec3 &eye)
 
void init (Math *m)
 
bool enabled () const
 
bool zsprites (void) const
 
bool update_sun (void) const
 
bool shadows_enabled (void) const
 
const vec4ambient_light () const
 
std::span< const Lightdir_lights () const
 
std::span< Lightdir_lights ()
 
std::span< const Lightpoint_lights () const
 
std::span< Lightpoint_lights ()
 
Lightsun_light ()
 
const Lightsun_light () const
 
float shadow_map_near () const
 
float shadow_map_far () const
 
const mat4dir_proj () const
 
const mat4point_proj () const
 
const mat4dir_view (size_t i) const
 
const mat4point_view (size_t i, size_t f) const
 
const LightsUBOubo () const
 
Sunsun ()
 
void set_enabled (bool b)
 
void set_zsprites (bool b)
 
void set_update_sun (bool b)
 
void set_shadows_enabled (bool b)
 
void set_ambient_light (const vec4 &v)
 
void set_ambient_anim (LightAnimation a)
 
void set_sun_light (Light *l)
 
void set_shadow_map_proj_size (float s)
 
void set_shadow_map_near (float f)
 
void set_shadow_map_far (float f)
 
Lightadd_light (Light::Type t)
 
void remove_light (Light *l)
 
bool update (const Timing &t)
 
void update_view (const vec3 &eye)
 

Static Public Attributes

static constexpr size_t MAX_LIGHTS = NNGN_MAX_LIGHTS
 

Private Types

enum  Flag : uint8_t {
  ENABLED = 1u << 0 , SHADOWS_ENABLED = NNGN_SHADOWS_ENABLED_BIT , ZSPRITES = 1u << 2 , UPDATE_SUN = 1u << 3 ,
  UPDATED = 1u << 4 , VIEW_UPDATED = 1u << 5 , SHADOW_MAPS_UPDATED = 1u << 6 , ENABLED = 1u << 0 ,
  SHADOWS_ENABLED = NNGN_SHADOWS_ENABLED_BIT , ZSPRITES = 1u << 2 , UPDATE_SUN = 1u << 3 , UPDATED = 1u << 4 ,
  VIEW_UPDATED = 1u << 5 , SHADOW_MAPS_UPDATED = 1u << 6
}
 
enum  Flag : uint8_t {
  ENABLED = 1u << 0 , SHADOWS_ENABLED = NNGN_SHADOWS_ENABLED_BIT , ZSPRITES = 1u << 2 , UPDATE_SUN = 1u << 3 ,
  UPDATED = 1u << 4 , VIEW_UPDATED = 1u << 5 , SHADOW_MAPS_UPDATED = 1u << 6 , ENABLED = 1u << 0 ,
  SHADOWS_ENABLED = NNGN_SHADOWS_ENABLED_BIT , ZSPRITES = 1u << 2 , UPDATE_SUN = 1u << 3 , UPDATED = 1u << 4 ,
  VIEW_UPDATED = 1u << 5 , SHADOW_MAPS_UPDATED = 1u << 6
}
 

Private Attributes

Mathmath = nullptr
 
Flags< Flagflags = {Flag::ENABLED | Flag::UPDATE_SUN | Flag::UPDATED}
 
vec3 view_pos = {}
 
vec4 m_ambient_light = vec4(1)
 
LightAnimation m_ambient_anim = {}
 
size_t n_dir = 0
 
size_t n_point = 0
 
std::array< Light, MAX_LIGHTSm_dir_lights = {}
 
std::array< Light, MAX_LIGHTSm_point_lights = {}
 
Lightm_sun_light = nullptr
 
float m_shadow_map_proj_size = 128.0f
 
float m_shadow_map_near = 1.0f
 
float m_shadow_map_far = 1024.0f
 
mat4 m_dir_proj = {}
 
mat4 m_point_proj = {}
 
std::array< mat4, 7 *MAX_LIGHTSviews = {}
 
LightsUBO m_ubo = {}
 
Sun m_sun = {}
 

Member Enumeration Documentation

◆ Flag [1/2]

enum nngn::Lighting::Flag : uint8_t
private
Enumerator
ENABLED 
SHADOWS_ENABLED 
ZSPRITES 
UPDATE_SUN 
UPDATED 
VIEW_UPDATED 
SHADOW_MAPS_UPDATED 
ENABLED 
SHADOWS_ENABLED 
ZSPRITES 
UPDATE_SUN 
UPDATED 
VIEW_UPDATED 
SHADOW_MAPS_UPDATED 

◆ Flag [2/2]

enum nngn::Lighting::Flag : uint8_t
private
Enumerator
ENABLED 
SHADOWS_ENABLED 
ZSPRITES 
UPDATE_SUN 
UPDATED 
VIEW_UPDATED 
SHADOW_MAPS_UPDATED 
ENABLED 
SHADOWS_ENABLED 
ZSPRITES 
UPDATE_SUN 
UPDATED 
VIEW_UPDATED 
SHADOW_MAPS_UPDATED 

Member Function Documentation

◆ add_light() [1/2]

Light * nngn::Lighting::add_light ( Light::Type  t)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ add_light() [2/2]

Light * nngn::Lighting::add_light ( Light::Type  t)

◆ ambient_light() [1/2]

const vec4 & nngn::Lighting::ambient_light ( ) const
inline

◆ ambient_light() [2/2]

const vec4 & nngn::Lighting::ambient_light ( ) const
inline

◆ dir_lights() [1/4]

std::span< Light > nngn::Lighting::dir_lights ( )
inline

◆ dir_lights() [2/4]

std::span< Light > nngn::Lighting::dir_lights ( )

◆ dir_lights() [3/4]

std::span< const Light > nngn::Lighting::dir_lights ( ) const
inline

◆ dir_lights() [4/4]

std::span< const Light > nngn::Lighting::dir_lights ( ) const

◆ dir_proj() [1/2]

const mat4 & nngn::Lighting::dir_proj ( ) const
inline

◆ dir_proj() [2/2]

const mat4 & nngn::Lighting::dir_proj ( ) const
inline

◆ dir_view() [1/2]

const mat4 & nngn::Lighting::dir_view ( size_t  i) const
inline

◆ dir_view() [2/2]

const mat4 & nngn::Lighting::dir_view ( size_t  i) const
inline

◆ enabled() [1/2]

bool nngn::Lighting::enabled ( ) const
inline
Here is the call graph for this function:
Here is the caller graph for this function:

◆ enabled() [2/2]

bool nngn::Lighting::enabled ( ) const
inline
Here is the call graph for this function:

◆ init() [1/2]

void nngn::Lighting::init ( Math m)
inline

◆ init() [2/2]

void nngn::Lighting::init ( Math m)
inline

◆ point_lights() [1/4]

std::span< Light > nngn::Lighting::point_lights ( )
inline

◆ point_lights() [2/4]

std::span< Light > nngn::Lighting::point_lights ( )

◆ point_lights() [3/4]

std::span< const Light > nngn::Lighting::point_lights ( ) const
inline

◆ point_lights() [4/4]

std::span< const Light > nngn::Lighting::point_lights ( ) const

◆ point_proj() [1/2]

const mat4 & nngn::Lighting::point_proj ( ) const
inline

◆ point_proj() [2/2]

const mat4 & nngn::Lighting::point_proj ( ) const
inline

◆ point_view() [1/2]

const mat4 & nngn::Lighting::point_view ( size_t  i,
size_t  f 
) const
inline
Here is the call graph for this function:

◆ point_view() [2/2]

const mat4 & nngn::Lighting::point_view ( size_t  i,
size_t  f 
) const
inline
Here is the call graph for this function:

◆ remove_light() [1/2]

void nngn::Lighting::remove_light ( Light l)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ remove_light() [2/2]

void nngn::Lighting::remove_light ( Light l)

◆ set_ambient_anim() [1/2]

void nngn::Lighting::set_ambient_anim ( LightAnimation  a)

◆ set_ambient_anim() [2/2]

void nngn::Lighting::set_ambient_anim ( LightAnimation  a)

◆ set_ambient_light() [1/2]

void nngn::Lighting::set_ambient_light ( const vec4 v)

◆ set_ambient_light() [2/2]

void nngn::Lighting::set_ambient_light ( const vec4 v)

◆ set_enabled() [1/2]

void nngn::Lighting::set_enabled ( bool  b)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ set_enabled() [2/2]

void nngn::Lighting::set_enabled ( bool  b)

◆ set_shadow_map_far() [1/2]

void nngn::Lighting::set_shadow_map_far ( float  f)
Here is the call graph for this function:

◆ set_shadow_map_far() [2/2]

void nngn::Lighting::set_shadow_map_far ( float  f)

◆ set_shadow_map_near() [1/2]

void nngn::Lighting::set_shadow_map_near ( float  f)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ set_shadow_map_near() [2/2]

void nngn::Lighting::set_shadow_map_near ( float  f)

◆ set_shadow_map_proj_size() [1/2]

void nngn::Lighting::set_shadow_map_proj_size ( float  s)
Here is the caller graph for this function:

◆ set_shadow_map_proj_size() [2/2]

void nngn::Lighting::set_shadow_map_proj_size ( float  s)

◆ set_shadows_enabled() [1/2]

void nngn::Lighting::set_shadows_enabled ( bool  b)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ set_shadows_enabled() [2/2]

void nngn::Lighting::set_shadows_enabled ( bool  b)

◆ set_sun_light() [1/2]

void nngn::Lighting::set_sun_light ( Light l)
inline
Here is the caller graph for this function:

◆ set_sun_light() [2/2]

void nngn::Lighting::set_sun_light ( Light l)
inline

◆ set_update_sun() [1/2]

void nngn::Lighting::set_update_sun ( bool  b)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ set_update_sun() [2/2]

void nngn::Lighting::set_update_sun ( bool  b)

◆ set_zsprites() [1/2]

void nngn::Lighting::set_zsprites ( bool  b)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ set_zsprites() [2/2]

void nngn::Lighting::set_zsprites ( bool  b)

◆ shadow_map_far() [1/2]

float nngn::Lighting::shadow_map_far ( ) const
inline

◆ shadow_map_far() [2/2]

float nngn::Lighting::shadow_map_far ( ) const
inline

◆ shadow_map_near() [1/2]

float nngn::Lighting::shadow_map_near ( ) const
inline

◆ shadow_map_near() [2/2]

float nngn::Lighting::shadow_map_near ( ) const
inline

◆ shadows_enabled() [1/2]

bool nngn::Lighting::shadows_enabled ( void  ) const
inline
Here is the call graph for this function:
Here is the caller graph for this function:

◆ shadows_enabled() [2/2]

bool nngn::Lighting::shadows_enabled ( void  ) const
inline
Here is the call graph for this function:

◆ sun() [1/2]

Sun * nngn::Lighting::sun ( )
inline
Here is the caller graph for this function:

◆ sun() [2/2]

Sun * nngn::Lighting::sun ( )
inline

◆ sun_light() [1/4]

Light * nngn::Lighting::sun_light ( )
inline

◆ sun_light() [2/4]

Light * nngn::Lighting::sun_light ( )
inline

◆ sun_light() [3/4]

const Light * nngn::Lighting::sun_light ( ) const
inline

◆ sun_light() [4/4]

const Light * nngn::Lighting::sun_light ( ) const
inline

◆ ubo() [1/2]

const LightsUBO & nngn::Lighting::ubo ( ) const
inline

◆ ubo() [2/2]

const LightsUBO & nngn::Lighting::ubo ( ) const
inline

◆ update() [1/2]

bool nngn::Lighting::update ( const Timing t)
Here is the call graph for this function:

◆ update() [2/2]

bool nngn::Lighting::update ( const Timing t)

◆ update_sun() [1/2]

bool nngn::Lighting::update_sun ( void  ) const
inline
Here is the call graph for this function:
Here is the caller graph for this function:

◆ update_sun() [2/2]

bool nngn::Lighting::update_sun ( void  ) const
inline
Here is the call graph for this function:

◆ update_view() [1/2]

void nngn::Lighting::update_view ( const vec3 eye)

◆ update_view() [2/2]

void nngn::Lighting::update_view ( const vec3 eye)

◆ zsprites() [1/2]

bool nngn::Lighting::zsprites ( void  ) const
inline
Here is the call graph for this function:
Here is the caller graph for this function:

◆ zsprites() [2/2]

bool nngn::Lighting::zsprites ( void  ) const
inline
Here is the call graph for this function:

Member Data Documentation

◆ flags

Flags< Flag > nngn::Lighting::flags = {Flag::ENABLED | Flag::UPDATE_SUN | Flag::UPDATED}
private

◆ m_ambient_anim

LightAnimation nngn::Lighting::m_ambient_anim = {}
private

◆ m_ambient_light

vec4 nngn::Lighting::m_ambient_light = vec4(1)
private

◆ m_dir_lights

std::array< Light, MAX_LIGHTS > nngn::Lighting::m_dir_lights = {}
private

◆ m_dir_proj

mat4 nngn::Lighting::m_dir_proj = {}
private

◆ m_point_lights

std::array< Light, MAX_LIGHTS > nngn::Lighting::m_point_lights = {}
private

◆ m_point_proj

mat4 nngn::Lighting::m_point_proj = {}
private

◆ m_shadow_map_far

float nngn::Lighting::m_shadow_map_far = 1024.0f
private

◆ m_shadow_map_near

float nngn::Lighting::m_shadow_map_near = 1.0f
private

◆ m_shadow_map_proj_size

float nngn::Lighting::m_shadow_map_proj_size = 128.0f
private

◆ m_sun

Sun nngn::Lighting::m_sun = {}
private

◆ m_sun_light

Light * nngn::Lighting::m_sun_light = nullptr
private

◆ m_ubo

LightsUBO nngn::Lighting::m_ubo = {}
private

◆ math

Math * nngn::Lighting::math = nullptr
private

◆ MAX_LIGHTS

static constexpr size_t nngn::Lighting::MAX_LIGHTS = NNGN_MAX_LIGHTS
staticconstexpr

◆ n_dir

size_t nngn::Lighting::n_dir = 0
private

◆ n_point

size_t nngn::Lighting::n_point = 0
private

◆ view_pos

vec3 nngn::Lighting::view_pos = {}
private

◆ views

std::array< mat4, 7 *MAX_LIGHTS > nngn::Lighting::views = {}
private

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