Main Page   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Namespace Members   Compound Members   File Members   Related Pages  

Projection.h

Go to the documentation of this file.
00001 
00002 /*
00003     TEDDY - General graphics application library
00004     Copyright (C) 1999-2002  Timo Suoranta
00005     tksuoran@cc.helsinki.fi
00006 
00007     This library is free software; you can redistribute it and/or
00008     modify it under the terms of the GNU Lesser General Public
00009     License as published by the Free Software Foundation; either
00010     version 2.1 of the License, or (at your option) any later version.
00011 
00012     This library is distributed in the hope that it will be useful,
00013     but WITHOUT ANY WARRANTY; without even the implied warranty of
00014     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00015     Lesser General Public License for more details.
00016 
00017     You should have received a copy of the GNU Lesser General Public
00018     License along with this library; if not, write to the Free Software
00019     Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
00020 
00021     $Id: Projection.h,v 1.6 2002/03/12 10:46:07 tksuoran Exp $
00022 */
00023 
00024 
00025 #ifndef TEDDY__PHYSICAL_COMPONENTS__PROJECTION__H
00026 #define TEDDY__PHYSICAL_COMPONENTS__PROJECTION__H
00027 
00028 
00029 #include "Teddy/Maths/Matrix.h"
00030 #include "Teddy/MixIn/Options.h"
00031 #include "Teddy/PhysicalComponents/Area.h"
00032 
00033 
00034 //  Forward declarations
00035 namespace Teddy {
00036     namespace Scenes    { class Camera;   };
00037     namespace Models    { class Model;    };
00038     namespace Graphics  { class Texture;  };
00039     namespace Materials { class Material; };
00040 };
00041 
00042 using namespace Teddy::Graphics;
00043 using namespace Teddy::Materials;
00044 using namespace Teddy::Maths;
00045 using namespace Teddy::Models;
00046 using namespace Teddy::Scenes;
00047 
00048 
00049 namespace Teddy              {
00050 namespace PhysicalComponents {
00051 
00052 
00070 class Projection : public Area {
00071 public:
00072     Projection( const std::string &name, Camera *camera );
00073     virtual ~Projection();
00074 
00075     void           setProjectionMatrix  ();  
00076     void           setProjectionMatrix  ( Matrix &m );
00077     void           setModelViewMatrix   ();  
00078     void           setModelViewMatrix   ( Matrix &m );
00079     Model         *pick                 ( const Vector2 &pos );
00080     float          getRatio();
00081 
00082     //  Area Input Interface
00083     virtual Area  *getHit               ( const Vector2 &pos );
00084     virtual void   drawSelf             ();  
00085 
00086     Material      *getMaster            ();
00087     Options       &getSelect            ();
00088     void           setSelect            ( unsigned long select );
00089     void           enableSelect         ( unsigned long select );
00090     void           disableSelect        ( unsigned long select );
00091     void           setClearColor        ( Color c );
00092     Color          getClearColor        ();
00093 
00094     //  Projection Interface - Accessors
00095     Camera        *getCamera            ();
00096     void           setCamera            ( Camera *c = NULL );
00097 
00098     //  Projection Interface - Material control
00099     void           doMaterial           ( Material *m );
00100     void           materialReapplyActive();
00101     bool           materialPass         ();
00102 
00103     //  Projection Interface - Pick control
00104     void           pickState            ( const bool state );
00105 
00106     void           applyFillOutline     ();
00107     void           applyRemoveHidden    ();
00108     void           applyFrustumCull     ();
00109     void           applySortInstances   ();
00110     void           applySortElements    ();
00111 
00112 public:
00113     static int material_skip_count;
00114 
00115 protected:
00116     Camera   *camera;                         //<!  Attached camera (determines Scene)
00117     Material *active_material;                //<!  Currently active Material (last applied)
00118     Texture  *active_texture;                 //<!  Currently active Texture (last applied)
00119     Area     *frame;                          //<!  Window frame
00120     Material *master_material;                //<!  Override settings
00121     Uint8     render_pass;                    //<!  Current / last render pass
00122     Uint8     render_pass_count;              //<!  How manys render passes have been decided
00123     Options   render_options_selection_mask;  //<!  If bit 1 then render option is set from active material
00124     Color     clear_color;                    //<!  
00125 };
00126 
00127 
00128 };  //  namespace PhysicalComponents
00129 };  //  namespace Teddy
00130 
00131 
00132 #endif  //  TEDDY__PHYSICAL_COMPONENTS__PROJECTION__H
00133