// ----------------------------------------------------------------------------
// Blitz-Irrlicht 1.8.3 Wrapper by Ed Musolino 2015
// Based off of Frank Dodd's Irrlicht 1.7 Freebasic Wrapper (2006-2010)
// ----------------------------------------------------------------------------

//  This software is provided 'as-is', without any express Or implied
//  warranty.  In no event will the authors be held liable For any damages
//  arising from the use of this software.

//  Permission is granted To anyone To use this software For any purpose,
//  including commercial applications, And To alter it And redistribute it
//  freely, subject To the following restrictions:

//  1. The Origin of this software must Not be misrepresented; you must not
//     claim that you wrote the original software. If you use this software
//     in a product, an acknowledgement in the product documentation would be
//     appreciated but is Not required.
//  2. Altered source versions must be clearly marked as such, And must Not be
//     misrepresented as being the original software.
//  3. This notice may Not be removed Or altered from any source distribution.
//
// /////////////////////////////////////////////////////////////////////////////

#include "bIrrlicht.h"


extern IrrlichtDevice*		device;
extern IVideoDriver*		driver;
extern ISceneManager*		smgr;
extern IGUIEnvironment*		guienv;




extern "C"
{
/* ----------------------------------------------------------------------------
add a light to the  scene
*/
DLL_EXPORT int * BBCALL iCreateLight( ISceneNode * parent, float X, float Y, float Z, float R, float G, float B, float size )
{
	return (int *)smgr->addLightSceneNode( parent, core::vector3df(X,Y,Z),
		video::SColorf(R, G, B), size );

}

/* ----------------------------------------------------------------------------
Ambient color emitted by the light.
*/
DLL_EXPORT void BBCALL iLightAmbientColor( ILightSceneNode *light, float R, float G, float B )
{
    light->getLightData().AmbientColor = SColorf( R, G, B, 0.0f );
}

/* ----------------------------------------------------------------------------
Diffuse color emitted by the light.
*/
DLL_EXPORT void BBCALL iLightDiffuseColor( ILightSceneNode *light, float R, float G, float B )
{
    light->getLightData().DiffuseColor = SColorf( R, G, B, 0.0f );
}

/* ----------------------------------------------------------------------------
Changes the light strength fading over distance. Good values for distance
effects use ( 1.0, 0.0, 0.0) and simply add small values to the second and
third element.
*/
DLL_EXPORT void BBCALL iLightRange( ILightSceneNode *light, float constant, float linear, float quadratic )
{
    light->getLightData().Attenuation = vector3df( constant, linear, quadratic );
}

/* ----------------------------------------------------------------------------
Does the light cast shadows?
*/
DLL_EXPORT void BBCALL iLightCastShadows( ILightSceneNode *light, bool castShadows )
{
    light->getLightData().CastShadows = castShadows ;
}

/* ----------------------------------------------------------------------------
The light strength's decrease between Outer and Inner cone.
*/
DLL_EXPORT void BBCALL iLightFalloff( ILightSceneNode *light, float Falloff )
{
    light->getLightData().Falloff = Falloff ;
}

DLL_EXPORT void BBCALL iLightConeAngle( ILightSceneNode *light, float InnerCone, float OuterCone )
{
	light->getLightData().InnerCone = InnerCone ;
    light->getLightData().OuterCone = OuterCone ;
}

/* ----------------------------------------------------------------------------
Radius of light. Everything within this radius be be lighted.
*/
DLL_EXPORT void BBCALL iLightRadius( ILightSceneNode *light, float Radius )
{
    light->getLightData().Radius = Radius ;
}

/* ----------------------------------------------------------------------------
Specular color emitted by the light.
*/
DLL_EXPORT void BBCALL iLightSpecularColor( ILightSceneNode *light, float R, float G, float B )
{
    light->getLightData().SpecularColor = SColorf( R, G, B, 0.0f );
}

/* ----------------------------------------------------------------------------
Type of the light. Default: ELT_POINT.
*/
DLL_EXPORT void BBCALL iLightType( ILightSceneNode *light, E_LIGHT_TYPE Type )
{
    light->getLightData().Type = Type ;
}



}


