// $Source: /usr/local/SimSoft/SoftShop/XGraph/Views/OGLLight.h,v $
// $Revision: 1.2 $
// $Author: baum $
// $Date: 2001/11/29 15:52:24 $
//
// Login name of the user who locked the revision
// $Locker:  $
// Tag name used to checkout the file
// $Name: Release-20 $
// State assigned to revision
// $State: Exp $
//
//
// $Log: OGLLight.h,v $
// Revision 1.2  2001/11/29 15:52:24  baum
// -In Kalender.cpp und Kalender.h Handsteuerung eingebaut
//

#ifndef _OGLLIGHT_H
#define _OGLLIGHT_H 1

#include "GL/gl.h"

#include "Angle.h"
#include "Vec3D.h"
#include "HMatrx3D.h"
#include "Wrap.h"
#include "Color.h"

#ifdef _OGLLIGHT_CPP
#  undef _impexp
#  define _impexp __declspec(dllexport)
#elif defined BUILD_VIEWS_DLL
#  undef _impexp
#  define _impexp
#else
#  undef _impexp
#  define _impexp __declspec(dllimport)
#endif

#if defined __GNUG__ || defined __hpux
#  undef _impexp
#  define _impexp
#endif

//==================================================================
//		Class-Header
//		for class OGLLight
//==================================================================

//##ModelId=4030D770008C
enum OGL_LIGHTTYPE {OGL_DIRECTIONAL, OGL_SPOT};

//##ModelId=4030D77000EA
class _impexp OGLLight {
  public:
    // default constructor
	//##ModelId=4030D77000EB
    OGLLight ();

    // constructor
	//##ModelId=4030D77000FA
    OGLLight (const RGBAColor& ambient, const RGBAColor& diffuse,
              const RGBAColor& specular, const Vec3D& dir, const Vec3D& pos);

    // destructor
	//##ModelId=4030D7700100
    ~OGLLight ();

	//##ModelId=4030D7700109
    void setToDirectional (); // default!
	//##ModelId=4030D770010A
    void setToSpot        ();

	//##ModelId=4030D770010B
    OGL_LIGHTTYPE LightType () const;

    // getting the components for all lights
	//##ModelId=4030D770010D
    const RGBAColor& Ambient   () const;
	//##ModelId=4030D7700119
    const RGBAColor& Diffuse   () const;
	//##ModelId=4030D770011B
    const RGBAColor& Specular  () const;

    // for Directional- and SpotLight
	//##ModelId=4030D770011D
    Vec3D         Direction () const;

    // for Spotlight
	//##ModelId=4030D770011F
    Vec3D         Position  () const;
	//##ModelId=4030D7700129
    const double& Exponent  () const;
	//##ModelId=4030D770012B
    const double& CutOff    () const;

    // setting the components for all lights
	//##ModelId=4030D770012D
    void setAmbient   (const RGBAColor& amb);
	//##ModelId=4030D7700138
    void setDiffuse   (const RGBAColor& dif);
	//##ModelId=4030D770013A
    void setSpecular  (const RGBAColor& spec);

    // for Directional- and SpotLight
	//##ModelId=4030D770013C
    void setDirection (const Vec3D& dir);

    // for Spotlight
	//##ModelId=4030D7700149
    void setPosition            (const Vec3D& pos);
	//##ModelId=4030D770014B
    void setExponent  (const double& exp);
	//##ModelId=4030D770014D
    void setCutOff    (const double& cutoff);

    // shadow settings
	//##ModelId=4030D7700158
	void setOGLShadowMatrix (const WrapBox& baseWrap);
    
	// render functions
	//##ModelId=4030D770015A
	void setOGLState (GLenum lightNumber);
	//##ModelId=4030D7700167
    void showLight   ()                   const;

	//##ModelId=4030D7700169
    void OGLShadowMatrix ();

  private:
    // declared, but not defined
    // copy constructor
	//##ModelId=4030D770016A
    OGLLight (const OGLLight&);

    // assignment operator
	//##ModelId=4030D7700178
    OGLLight& operator = (const OGLLight&);

	//##ModelId=4030D770017B
    OGL_LIGHTTYPE ObjLightType;

	//##ModelId=4030D7700186
    bool ObjHasChanged;

	//##ModelId=4030D7700197
    RGBAColor ObjAmbient;          // default 0 0 0 1 black
	//##ModelId=4030D770019C
    RGBAColor ObjDiffuse;          // default 1 1 1 1 white
	//##ModelId=4030D77001A6
    RGBAColor ObjSpecular;         // default 1 1 1 1 white

    // for Directional- and Spotlight
	//##ModelId=4030D77001AB
    GLfloat ObjDirection [4];      // default 0 0 -10 0

    // for Positional and SpotLight
	//##ModelId=4030D77001B8
    GLfloat ObjPosition [4];       // default 0 0 10 0

    // for Spotlight
	//##ModelId=4030D77001C5
    double  ObjExponent;           // default 0
	//##ModelId=4030D77001C6
    double  ObjCutOff;             // default 180 degrees
	//##ModelId=4030D77001D4
    double  ObjCutOffSaved;        // during directional light

    // for ShadowPlane
	//##ModelId=4030D77001D5
    double ObjShadowPlane [4];       // default 0 0 0 0
	//##ModelId=4030D77001E5
	HMatrx3D ObjShadowMatrix;

	//##ModelId=4030D7700222
  typedef void (OGLStateFunc)  (OGLLight* light, GLenum lightNumber);
	//##ModelId=4030D77001F5
    OGLStateFunc* ObjOGLStateFunc;

	//##ModelId=4030D77001F9
	void calcOGLShadowMatrix ();

	//##ModelId=4030D7700203
    static void DirectionalStateFunc (OGLLight* light, GLenum lightNumber);
	//##ModelId=4030D7700213
    static void SpotStateFunc        (OGLLight* light, GLenum lightNumber);
};

#endif // !_OGLLIGHT_H


