File: lightutil.hpp

package info (click to toggle)
openmw 0.49.0-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 33,992 kB
  • sloc: cpp: 372,479; xml: 2,149; sh: 1,403; python: 797; makefile: 26
file content (48 lines) | stat: -rw-r--r-- 2,012 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
#ifndef OPENMW_COMPONENTS_LIGHTUTIL_H
#define OPENMW_COMPONENTS_LIGHTUTIL_H

#include <osg/Vec4f>
#include <osg/ref_ptr>

namespace osg
{
    class Group;
    class Light;
}

namespace ESM
{
    struct Light;
}

namespace SceneUtil
{
    class LightSource;
    struct LightCommon;

    /// @brief Set up global attenuation settings for an osg::Light.
    /// @param radius The radius of the light source.
    /// @param isExterior Is the light outside? May be used for deciding which attenuation settings to use.
    void configureLight(osg::Light* light, float radius, bool isExterior);

    /// @brief Convert an ESM::Light to a SceneUtil::LightSource, and add it to a sub graph.
    /// @note If the sub graph contains a node named "AttachLight" (case insensitive), then the light is added to that.
    /// Otherwise, the light is attached directly to the root node of the subgraph.
    /// @param node The sub graph to add a light to
    /// @param esmLight The light definition coming from the game files containing radius, color, flicker, etc.
    /// @param lightMask Mask to assign to the newly created LightSource.
    /// @param isExterior Is the light outside? May be used for deciding which attenuation settings to use.
    osg::ref_ptr<LightSource> addLight(
        osg::Group* node, const SceneUtil::LightCommon& esmLight, unsigned int lightMask, bool isExterior);

    /// @brief Convert an ESM::Light to a SceneUtil::LightSource, and return it.
    /// @param esmLight The light definition coming from the game files containing radius, color, flicker, etc.
    /// @param lightMask Mask to assign to the newly created LightSource.
    /// @param isExterior Is the light outside? May be used for deciding which attenuation settings to use.
    /// @param ambient Ambient component of the light.
    osg::ref_ptr<LightSource> createLightSource(const SceneUtil::LightCommon& esmLight, unsigned int lightMask,
        bool isExterior, const osg::Vec4f& ambient = osg::Vec4f(0, 0, 0, 1));

}

#endif