2011-01-14 07:36:50 -08:00
|
|
|
// Copyright (C) 2002-2011 Nikolaus Gebhardt
|
2007-05-20 11:03:49 -07:00
|
|
|
// This file is part of the "Irrlicht Engine".
|
|
|
|
// For conditions of distribution and use, see copyright notice in irrlicht.h
|
|
|
|
|
|
|
|
#ifndef __S_LIGHT_H_INCLUDED__
|
|
|
|
#define __S_LIGHT_H_INCLUDED__
|
|
|
|
|
|
|
|
#include "SColor.h"
|
|
|
|
|
|
|
|
namespace irr
|
|
|
|
{
|
|
|
|
namespace video
|
|
|
|
{
|
|
|
|
|
|
|
|
//! Enumeration for different types of lights
|
|
|
|
enum E_LIGHT_TYPE
|
|
|
|
{
|
|
|
|
//! point light, it has a position in space and radiates light in all directions
|
|
|
|
ELT_POINT,
|
2007-08-14 20:39:44 -07:00
|
|
|
//! spot light, it has a position in space, a direction, and a limited cone of influence
|
|
|
|
ELT_SPOT,
|
2007-05-20 11:03:49 -07:00
|
|
|
//! directional light, coming from a direction from an infinite distance
|
|
|
|
ELT_DIRECTIONAL
|
|
|
|
};
|
|
|
|
|
|
|
|
//! Names for light types
|
|
|
|
const c8* const LightTypeNames[] =
|
|
|
|
{
|
|
|
|
"Point",
|
2007-08-14 20:39:44 -07:00
|
|
|
"Spot",
|
2007-05-20 11:03:49 -07:00
|
|
|
"Directional",
|
|
|
|
0
|
|
|
|
};
|
|
|
|
|
|
|
|
//! structure for holding data describing a dynamic point light.
|
2007-08-14 20:39:44 -07:00
|
|
|
/** Irrlicht supports point lights, spot lights, and directional lights.
|
2007-05-20 11:03:49 -07:00
|
|
|
*/
|
|
|
|
struct SLight
|
|
|
|
{
|
2008-03-02 06:28:48 -08:00
|
|
|
SLight() : AmbientColor(0.f,0.f,0.f), DiffuseColor(1.f,1.f,1.f),
|
|
|
|
SpecularColor(1.f,1.f,1.f), Attenuation(1.f,0.f,0.f),
|
2008-11-27 15:52:13 -08:00
|
|
|
OuterCone(45.f), InnerCone(0.f), Falloff(2.f),
|
2008-03-02 06:28:48 -08:00
|
|
|
Position(0.f,0.f,0.f), Direction(0.f,0.f,1.f),
|
2008-11-27 15:52:13 -08:00
|
|
|
Radius(100.f), Type(ELT_POINT), CastShadows(true)
|
2008-05-22 04:51:37 -07:00
|
|
|
{}
|
2007-05-20 11:03:49 -07:00
|
|
|
|
|
|
|
//! Ambient color emitted by the light
|
|
|
|
SColorf AmbientColor;
|
|
|
|
|
|
|
|
//! Diffuse color emitted by the light.
|
2008-05-22 04:51:37 -07:00
|
|
|
/** This is the primary color you want to set. */
|
|
|
|
SColorf DiffuseColor;
|
2007-05-20 11:03:49 -07:00
|
|
|
|
2008-05-22 04:51:37 -07:00
|
|
|
//! Specular color emitted by the light.
|
|
|
|
/** For details how to use specular highlights, see SMaterial::Shininess */
|
2007-05-20 11:03:49 -07:00
|
|
|
SColorf SpecularColor;
|
|
|
|
|
2007-11-09 07:37:46 -08:00
|
|
|
//! Attenuation factors (constant, linear, quadratic)
|
2008-11-27 15:52:13 -08:00
|
|
|
/** Changes the light strength fading over distance.
|
|
|
|
Can also be altered by setting the radius, Attenuation will change to
|
|
|
|
(0,1.f/radius,0). Can be overridden after radius was set. */
|
2007-06-21 14:06:21 -07:00
|
|
|
core::vector3df Attenuation;
|
|
|
|
|
2007-08-14 20:39:44 -07:00
|
|
|
//! The angle of the spot's outer cone. Ignored for other lights.
|
|
|
|
f32 OuterCone;
|
|
|
|
|
|
|
|
//! The angle of the spot's inner cone. Ignored for other lights.
|
|
|
|
f32 InnerCone;
|
|
|
|
|
|
|
|
//! The light strength's decrease between Outer and Inner cone.
|
|
|
|
f32 Falloff;
|
|
|
|
|
2008-05-22 04:51:37 -07:00
|
|
|
//! Read-ONLY! Position of the light.
|
|
|
|
/** If Type is ELT_DIRECTIONAL, it is ignored. Changed via light scene node's position. */
|
2008-03-02 06:28:48 -08:00
|
|
|
core::vector3df Position;
|
|
|
|
|
2008-05-22 04:51:37 -07:00
|
|
|
//! Read-ONLY! Direction of the light.
|
|
|
|
/** If Type is ELT_POINT, it is ignored. Changed via light scene node's rotation. */
|
2008-03-02 06:28:48 -08:00
|
|
|
core::vector3df Direction;
|
2007-05-20 11:03:49 -07:00
|
|
|
|
2010-07-18 14:25:27 -07:00
|
|
|
//! Read-ONLY! Radius of light. Everything within this radius will be lighted.
|
2008-11-27 15:52:13 -08:00
|
|
|
f32 Radius;
|
|
|
|
|
|
|
|
//! Read-ONLY! Type of the light. Default: ELT_POINT
|
2007-05-20 11:03:49 -07:00
|
|
|
E_LIGHT_TYPE Type;
|
2007-08-14 20:39:44 -07:00
|
|
|
|
2008-11-27 15:52:13 -08:00
|
|
|
//! Read-ONLY! Does the light cast shadows?
|
2009-05-04 17:09:53 -07:00
|
|
|
bool CastShadows:1;
|
2007-05-20 11:03:49 -07:00
|
|
|
};
|
|
|
|
|
|
|
|
} // end namespace video
|
|
|
|
} // end namespace irr
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|