VedaLib3DEngine/LightModel.h

Go to the documentation of this file.
00001 /*! \file 
00002     \author victorien ferry & www.m4nkind.com
00003     \brief This file applies the GNU LESSER GENERAL PUBLIC LICENSE Version 2.1 , read file COPYING.
00004 */
00005 #ifndef COM_M4NKIND_LightModel_H
00006 #define COM_M4NKIND_LightModel_H
00007 #include "BaseObject.h"
00008 #include "PackULong_Flags.h"
00009 #include "PackDynamicFloat.h"
00010 #include "PackList.h"
00011 #include "PackObjectReference.h"
00012 #include "PackFloatByte_Limits.h"
00013 /*!
00014     \class  LightModel
00015     \ingroup BaseObjectInherited_VedaLib3DEngine
00016     \brief  Describe a light model and provide some methods.
00017             (not final ATM. Experimental.)
00018 */
00019 class LightModel : public BaseObject
00020 {
00021 /*==================================================================
00022                                 PUBLIC
00023 ==================================================================*/
00024 public:
00025     /*!
00026         \brief  Constructor. There should only be initialisation there.
00027     */
00028     LightModel( );
00029     /*!
00030         \brief  Class Inheritance Descriptors. Also forces a destructor. See BASEOBJECT_DECLARE_... in .cpp
00031     */
00032     BASEOBJECT_DEFINE_CLASS(LightModel);
00033     /*
00034         \brief  return true is ambient occlusion should be processed.
00035         \return true or false.
00036     */
00037     inline bool IsAmbientOcclusionActive() { return mSer_Flags.TestFlags(lmf_AmbientOcclusion);  };
00038     /*
00039         \brief  return the first description of a LinearLight object, or null if no linear lights at all.
00040                     the LinearLight is get from the cell with GetManagedObject(), and the next cell
00041                     is found with GetNextBrother()
00042         \return the first list cell.
00043     */
00044     inline PackList::Cell *GetFirstLinearLight() { return mSer_LinearLightList.GetFirstCell(); };
00045     /*
00046         \brief  return the first description of a DifuseLight object, or null if no linear lights at all.
00047                     the DifuseLight is get from the cell with GetManagedObject(), and the next cell
00048                     is found with GetNextBrother()
00049         \return the first list cell.
00050     */
00051     inline PackList::Cell *GetFirstDifuseLight() { return mSer_DifuseLightList.GetFirstCell(); };
00052 
00053     /*!
00054         \brief   Nested class that describes an element of the Linear Light list.
00055     */
00056     class LinearLight : public PackStruct
00057     {
00058     public:
00059         //! \brief element constructor 
00060         LinearLight(void);
00061         //! the color. Should be higher than Ambient.
00062         PackDynamicFloat    mSer_Color;
00063         //! light linear vector. souldn't be 0,0,0.
00064         PackDynamicFloat    mSer_Vector;        
00065     };
00066     /*!
00067         \brief  static method passed to the list to create new elements.
00068         \return a new  object.
00069     */
00070     static BaseType *NewLinearLight();
00071     /*!
00072         \brief   Nested class that describes an element of the difuse light list.           
00073     */
00074     class DifuseLight : public PackStruct
00075     {
00076     public:
00077         //! \brief element constructor 
00078         DifuseLight(void);
00079         //! the color. Should be higher than Ambient. manage also light strength.
00080         PackDynamicFloat    mSer_Color;
00081         //! light linear vector. souldn't be 0,0,0.
00082         PackDynamicFloat    mSer_Position;      
00083     };
00084     /*!
00085         \brief  static method passed to the list to create new elements.
00086         \return a new  object.
00087     */
00088     static BaseType *NewDifuseLight();
00089         typedef enum
00090     {
00091         lmf_AmbientOcclusion=1
00092     } lightmodelflag ;
00093     //! select properties of the model:
00094     PackULong_Flags     mSer_Flags;
00095     //! ambient occlusion strength.
00096     PackFloatByte_Limits    mSer_OcclusionStrength;
00097     //! ambient color: average color in perfect diffusion
00098     PackDynamicFloat    mSer_AmbientColor;
00099     //! list of away-linear lighnings.
00100     PackList            mSer_LinearLightList;
00101     //! list of near dynamic light sources.
00102     PackList            mSer_DifuseLightList;
00103 
00104 /*==================================================================
00105                                 PROTECTED
00106 ==================================================================*/
00107 protected:
00108 
00109 };
00110 #endif

      /\/\        4         N         k         !         N         D
                      _______  _ __ ___  _____            ___ _ _  ____
     ___________  __//___   /________  |/    / ___________\_______/    \
    /   _   _   \/   _     /    _   /      _/_/____/    _       __     /
   /    /   /       /     /    /    \      \/     /    /    \   \     /
  \\___/___/___/    ¯    _____/_____/       ______\___/_____/\________\\
               \________/_ ___ __ l____\      /elD!  
                 http://www.m4nkind.com \____/