//
// Irrlicht Wrapper for Imperative Languages
// Frank Dodd (2006)
//
// Additional Work
// Michael Taupitz (2006)
//
// This wrapper DLL encapsulates a sub-set of the features of the powerful
// Irrlicht 3D Graphics Engine exposing the Object Oriented architecture and
// providing a functional 3D SDK for languages that are not object oriented.
//
// This source was created with the help of the great examples in the Irrlicht
// SDK and the excellent Irrlicht documentation. This software was developed
// using the GCC compiler and Code::Blocks IDE
//

/* ////////////////////////////////////////////////////////////////////////////
includes
*/
#include "irrlichtwrapper.h"
#include "CEffects.h"


/* ////////////////////////////////////////////////////////////////////////////
global variables
*/

/* ////////////////////////////////////////////////////////////////////////////
external variables
*/
extern IrrlichtDevice *device;
extern IVideoDriver* driver;
extern ISceneManager* smgr;
extern IGUIEnvironment* guienv;


/* ////////////////////////////////////////////////////////////////////////////
Global Function Declarations

all of the below functions are declared as C functions and are exposed without
any mangled names so that they can be easily imported into imperative
languages like FreeBasic
*/
extern "C"
{

/****f* FX/IrrFXCreateGlow
* NAME
*    IrrFXCreateGlow - Create GlowingEffect.
* SYNOPSIS
*    pitch.l = IrrFXCreateGlow(*Camera, GlowSize.l)
* INPUTS
*   *Camera            - A Pointer to a Camera
*   GlowSize           - Size of Glowing (default is 64)
* FUNCTION
*   This creates a simple glowing-effect wthot use of a shader.
*   It is slow but impressive.*
****
* This is for creating the PB-Importfile, and avoiding to make everything manual
#PBIMPORT:IrrFXCreateGlow(*Camera, GlowSize.l=64)
*/

STATIC_EXPORT void DLL_EXPORT  IrrFXCreateGlow( scene::ICameraSceneNode* CamGlow, s32 GlowSize )
{
    CreateGlow(CamGlow,smgr,driver,GlowSize);
}

/****f* FX/IrrFXRenderGlow
* NAME
*    IrrFXRenderGlow - Create GlowingEffect.
* SYNOPSIS
*   IrrFXRenderGlow()
* FUNCTION
*   Renders the glowing effect.
*   Use in Main-Loop before the IrrDrawScene().
*   It is slow but impressive.*
****
* This is for creating the PB-Importfile, and avoiding to make everything manual
#PBIMPORT:IrrFXRenderGlow()
*/
STATIC_EXPORT void DLL_EXPORT  IrrFXRenderGlow()
{
    RenderGlow(smgr,driver,0,0,0,0);
}




/****f* FX/IrrFXCreateDreamFilter
* NAME
*    IrrFXCreateDreamFilter - Create DreamEffect.
* SYNOPSIS
*    IrrFXCreateDreamFilter(*Camera, EffectSize.f, DreamSize.l)
* INPUTS
*   *Camera            - A Pointer to a Camera
*   EffectSize.l        - Size of Effect
*   DreamSize           - Size of Glowing (default is 64)
* FUNCTION
*   This creates a simple dream-effect wthot use of a shader.
*   It is slow but impressive.*
****
* This is for creating the PB-Importfile, and avoiding to make everything manual
#PBIMPORT:IrrFXCreateDreamFilter(*Camera, EffectSize.f=1.0, DreamSize.l=64)
*/

STATIC_EXPORT void DLL_EXPORT  IrrFXCreateDreamFilter( scene::ICameraSceneNode* CamGlow, f32 EffectSize, s32 DreamSize )
{
//    void CreateDreamFilter(scene::ICameraSceneNode* CamDream,scene::ISceneManager* smgr,video::IVideoDriver* driver,f32 EffectSize=1.0f,s32 DreamSize=64)

    CreateDreamFilter(CamGlow,smgr,driver,EffectSize, DreamSize);
}

/****f* FX/IrrFXRenderDreamFilter
* NAME
*    IrrFXRenderDreamFilter - Render DreamEffect.
* SYNOPSIS
*   IrrFXRenderDreamFilter()
* FUNCTION
*   Renders the dreamy effect.
*   Use in Main-Loop before the IrrDrawScene().
*   It is slow but impressive.*
****
* This is for creating the PB-Importfile, and avoiding to make everything manual
#PBIMPORT:IrrFXRenderDreamFilter()
*/
STATIC_EXPORT void DLL_EXPORT  IrrFXRenderDreamFilter()
{
    RenderDreamFilter(smgr,driver,0,0,0,0);
}


/****f* FX/IrrFXCreateNightVision
* NAME
*    IrrFXCreateNightVision - Create NightVision-Effect
* SYNOPSIS
*    IrrFXCreateNightVision(*Camera, NoiseFile.s, NightVisionSize.l)
* INPUTS
*   *Camera            - A Pointer to a Camera
*   NoiseFile.s        - NoiseFile
*   NightVisionSize    - Size
* FUNCTION
*   This creates a simple night-vision-effect wthot use of a shader.
*   It is slow but impressive.*
****
* This is for creating the PB-Importfile, and avoiding to make everything manual
#PBIMPORT:IrrFXCreateNightVision(*Camera, NoiseFile.p-ascii, NightVisionSize.l=64)
*/

STATIC_EXPORT void DLL_EXPORT  IrrFXCreateNightVision( scene::ICameraSceneNode* CamGlow, irr::c8* NoiseFile,s32 NightVisionSize )
{
//   void CreateNightVision(scene::ICameraSceneNode* CamNightVision,scene::ISceneManager* smgr,video::IVideoDriver* driver,irr::c8* NoiseFile,s32 NightVisionSize);
    CreateNightVision(CamGlow,smgr,driver,NoiseFile, NightVisionSize);
}

/****f* FX/IrrFXRenderNightVision
* NAME
*    IrrFXRenderNightVision - Render NightVision-Effect.
* SYNOPSIS
*   IrrFXRenderNightVision()
* FUNCTION
*   Renders the nightvision effect.
*   Use in Main-Loop before the IrrDrawScene().
*   It is slow but impressive.*
****
* This is for creating the PB-Importfile, and avoiding to make everything manual
#PBIMPORT:IrrFXRenderNightVision()
*/

STATIC_EXPORT void DLL_EXPORT  IrrFXRenderNightVision()
{
    RenderNightVision(smgr,driver);
}



}
