NSUNI/NSLAR Library a250670
Loading...
Searching...
No Matches

Classes

struct  nnl::lit::Light
 Represents a directional light in the scene. This structure represents a directional light source that affects dynamically lit materials. More...
struct  nnl::lit::Lit
 Represents a lighting configuration for a scene. More...

Functions

std::vector< nnl::SLightnnl::lit::Convert (const Lit &lit)
 Converts a light config to a more generic representation that is more suitable for exporting into other formats.
Lit nnl::lit::Convert (const std::vector< nnl::SLight > &slights, glm::vec3 ambient=glm::vec3(0), bool enable_specular=true, float character_brightness=1.0f)
 Converts a vector of lights to a light config.
bool nnl::lit::IsOfType (BufferView buffer)
 Tests if the provided file is a light source config.
Lit nnl::lit::Import (BufferView buffer)
 Parses a binary file and converts it to a Lit struct.
Buffer nnl::lit::Export (const Lit &lit)
 Converts a light config to a binary file representation.

Detailed Description


Class Documentation

◆ nnl::lit::Light

struct nnl::lit::Light

Represents a directional light in the scene. This structure represents a directional light source that affects dynamically lit materials.

See also
nnl::lit::Lit
nnl::model::MaterialFeatures::kLit

Public Attributes

bool active = false
 Indicates if the light is used.
glm::vec3 direction = {0, 1.0f, 0}
 Direction to the light source.
u32 diffuse = 0xFF'FF'FF'FF
u32 specular = 0xFF'00'00'00

Member Data Documentation

◆ active

bool nnl::lit::Light::active = false

Indicates if the light is used.

◆ diffuse

u32 nnl::lit::Light::diffuse = 0xFF'FF'FF'FF

Diffuse color of the light in ABGR format (alpha is ignored)

◆ direction

glm::vec3 nnl::lit::Light::direction = {0, 1.0f, 0}

Direction to the light source.

◆ specular

u32 nnl::lit::Light::specular = 0xFF'00'00'00

Specular color of the light in ABGR format (alpha is ignored)

◆ nnl::lit::Lit

struct nnl::lit::Lit

Represents a lighting configuration for a scene.

Public Attributes

std::array< Light, 3 > lights
glm::vec3 cel_shadow_light_direction = {0, 1.0f, 0}
u8 character_brightness = 0xFF
u32 global_ambient = 0xFF'7F'7F'7F

Member Data Documentation

◆ cel_shadow_light_direction

glm::vec3 nnl::lit::Lit::cel_shadow_light_direction = {0, 1.0f, 0}

Controls the direction of the environmental "light".

See also
nnl::model::MaterialFeatures::kEnvironmentMapping

◆ character_brightness

u8 nnl::lit::Lit::character_brightness = 0xFF

A multiplier for characters' ambient, diffuse, specular colors.

◆ global_ambient

u32 nnl::lit::Lit::global_ambient = 0xFF'7F'7F'7F

Global ambient light in ABGR format (alpha is ignored)

◆ lights

std::array<Light, 3> nnl::lit::Lit::lights

Light sources that affect dynamically lit materials.

See also
nnl::model::MaterialFeatures::kLit

Function Documentation

◆ Convert() [1/2]

std::vector< nnl::SLight > nnl::lit::Convert ( const Lit & lit)

Converts a light config to a more generic representation that is more suitable for exporting into other formats.

Parameters
litThe light config to be converted.
Returns
A vector of lights.

◆ Convert() [2/2]

Lit nnl::lit::Convert ( const std::vector< nnl::SLight > & slights,
glm::vec3 ambient = glm::vec3(0),
bool enable_specular = true,
float character_brightness = 1.0f )

Converts a vector of lights to a light config.

Parameters
slightsA vector of lights to be converted.
ambientThe color of the ambient light. If set to (0,0,0), it's computed automatically.
enable_specularIf the specular component should be enabled.
character_brightnessA multiplier that affects materials of characters.
Returns
A light config.

◆ Export()

Buffer nnl::lit::Export ( const Lit & lit)
nodiscard

Converts a light config to a binary file representation.

This function takes a Lit object and converts it into a Buffer, which represents the binary format of the light config.

Parameters
litThe Lit object to be converted into a binary format.
Returns
A Buffer containing the binary representation of the config.

◆ Import()

Lit nnl::lit::Import ( BufferView buffer)

Parses a binary file and converts it to a Lit struct.

This function takes a binary representation of a light config, parses its contents, and converts them into a Lit struct for easier access and manipulation.

Parameters
bufferThe binary data to be processed.
Returns
A Lit object representing the converted data.
See also
nnl::lit::IsOfType
nnl::lit::Export

◆ IsOfType()

bool nnl::lit::IsOfType ( BufferView buffer)

Tests if the provided file is a light source config.

This function takes data representing a file and checks whether it corresponds to the in-game light source config format.

Parameters
bufferThe data to be tested.
Returns
Returns true if the file is identified as a light config.
See also
nnl::lit::Import