struct hiro::shader::Light — HIRO 0.7.0 documentation

# struct hiro::shader::Light

## Overview

Definition of scene light. More…

    #include <ShaderApi.h>

    struct Light {
        // fields

        glm::mat4 view { 1.0f };
        glm::vec4 position { 0.0f };
        cogs::Color3f color { cogs::color::WHITE };
        float ambient_intensity { 0.1f };
        float in_camera_space { false };
        bool cast_shadow { false };
        uint8_t __padding0 { 0 };
        uint16_t __padding1 { 0 };
        glm::vec2 __padding2 { 0.0f };

        // methods

        static hiro::shader::Light CreateLight(const glm::vec4& position, const cogs::Color3f& color, float ambient_intensity, bool in_camera_space);
        static hiro::shader::Light CreatePointLight(const glm::vec3& position, const cogs::Color3f& color, float ambient_intensity);
        static hiro::shader::Light CreateDirectionalLight(const glm::vec3& direction, const cogs::Color3f& color, float ambient_intensity);
        static hiro::shader::Light CreateHeadLight(const cogs::Color3f& color);
        static hiro::shader::Light CreateShadowSunLight(const glm::vec3& direction, const cogs::Color3f& color, float ambient_intensity, const geom::Sphere& scene_bounds);
        static hiro::shader::Light CreateShadowSpotlight(const glm::vec3& position, const glm::mat4& view, const glm::mat4& projection, const cogs::Color3f& color);
        static hiro::shader::Light CreateShadowPointLight(const glm::vec3& position, const cogs::Color3f& color, float ambient_intensity, const geom::Sphere& scene_bounds);
    };

## Detailed Documentation

Definition of scene light.

### Fields

    glm::vec4 position { 0.0f }

Lighting position or direction (defined by homogeneous coordinate).

    cogs::Color3f color { cogs::color::WHITE }

Generated color influence of light.

    float ambient_intensity { 0.1f }

Ambient color influence of light.

    float in_camera_space { false }

Whether is light position defined in camera space.

### Methods

    static hiro::shader::Light CreateHeadLight(const cogs::Color3f& color)

A point light whose position is at the position of the camera, oriented in direction of view.

    static hiro::shader::Light CreateShadowSunLight(const glm::vec3& direction, const cogs::Color3f& color, float ambient_intensity, const geom::Sphere& scene_bounds)

An experimental version of directional light that is able to cast shadows.

    static hiro::shader::Light CreateShadowSpotlight(const glm::vec3& position, const glm::mat4& view, const glm::mat4& projection, const cogs::Color3f& color)

An experimental version of spot light that is able to cast shadows.

    static hiro::shader::Light CreateShadowPointLight(const glm::vec3& position, const cogs::Color3f& color, float ambient_intensity, const geom::Sphere& scene_bounds)

An experimental version of point light that is able to cast shadows.