citro3d
Loading...
Searching...
No Matches
Data Structures | Macros | Typedefs | Functions
lightlut.h File Reference

Generate lighting lookup tables. More...

#include "types.h"
#include <math.h>

Go to the source code of this file.

Data Structures

struct  C3D_LightLut
 
struct  C3D_LightLutDA
 

Macros

#define LightLut_Phong(lut, shininess)   LightLut_FromFunc((lut), powf, (shininess), false)
 Generates lighting lookup table using powf function (phong lighting).
 
#define LightLut_Spotlight(lut, angle)   LightLut_FromFunc((lut), spot_step, cosf(angle), true)
 Generates lighting lookup table for spotlights.
 
#define LightLutDA_Quadratic(lut, from, to, linear, quad)   LightLutDA_Create((lut), quadratic_dist_attn, (from), (to), (linear), (quad))
 Generates distance attenuation lookup table.
 

Typedefs

typedef float(* C3D_LightLutFunc) (float x, float param)
 
typedef float(* C3D_LightLutFuncDA) (float dist, float arg0, float arg1)
 

Functions

static float quadratic_dist_attn (float dist, float linear, float quad)
 
static float spot_step (float angle, float cutoff)
 
void LightLut_FromArray (C3D_LightLut *lut, float *data)
 Generates lighting lookup table from pre-computed float array.
 
void LightLut_FromFunc (C3D_LightLut *lut, C3D_LightLutFunc func, float param, bool negative)
 Generates lighting lookup table using specified callback function.
 
void LightLutDA_Create (C3D_LightLutDA *lut, C3D_LightLutFuncDA func, float from, float to, float arg0, float arg1)
 Generates distance attenuation lookup table using specified callback function.
 

Detailed Description

Generate lighting lookup tables.

Macro Definition Documentation

◆ LightLut_Phong

#define LightLut_Phong (   lut,
  shininess 
)    LightLut_FromFunc((lut), powf, (shininess), false)

Generates lighting lookup table using powf function (phong lighting).

Parameters
[out]lutPointer to light environment structure.
[in]shininessShininess value of specular highlights (pow function exponent).

◆ LightLut_Spotlight

#define LightLut_Spotlight (   lut,
  angle 
)    LightLut_FromFunc((lut), spot_step, cosf(angle), true)

Generates lighting lookup table for spotlights.

Parameters
[out]lutPointer to light environment structure.
[in]angleBeam angle of the spotlight.

◆ LightLutDA_Quadratic

#define LightLutDA_Quadratic (   lut,
  from,
  to,
  linear,
  quad 
)    LightLutDA_Create((lut), quadratic_dist_attn, (from), (to), (linear), (quad))

Generates distance attenuation lookup table.

Parameters
[out]lutPointer to light environment structure.
[in]fromMinimum distance from light source.
[in]toMaximum distance from light source.
[in]linearLinear coefficient.
[in]quadQuadratic coefficient.

Function Documentation

◆ LightLut_FromArray()

void LightLut_FromArray ( C3D_LightLut lut,
float *  data 
)

Generates lighting lookup table from pre-computed float array.

Parameters
[out]lutPointer to lighting lookup table structure.
[in]dataPointer to pre-computed float array.

◆ LightLut_FromFunc()

void LightLut_FromFunc ( C3D_LightLut lut,
C3D_LightLutFunc  func,
float  param,
bool  negative 
)

Generates lighting lookup table using specified callback function.

Parameters
[out]lutPointer to light environment structure.
[in]funcCallback function.
[in]paramUser-specified parameter to callback function.
[in]negativeIf false, x argument of callback function will be in range [0,256]. If true, x argument will be in range [-128,128].

◆ LightLutDA_Create()

void LightLutDA_Create ( C3D_LightLutDA lut,
C3D_LightLutFuncDA  func,
float  from,
float  to,
float  arg0,
float  arg1 
)

Generates distance attenuation lookup table using specified callback function.

Parameters
[out]lutPointer to light environment structure.
[in]funcCallback function.
[in]fromStarting distance of lighting.
[in]toEnding distance of lighting.
[in]arg0User-specified parameter to callback function.
[in]arg1User-specified parameter to callback function.