Primitive.h

Go to the documentation of this file.
00001 // Copyright (C) 2005 Dave Griffiths
00002 //
00003 // This program is free software; you can redistribute it and/or modify
00004 // it under the terms of the GNU General Public License as published by
00005 // the Free Software Foundation; either version 2 of the License, or
00006 // (at your option) any later version.
00007 //
00008 // This program is distributed in the hope that it will be useful,
00009 // but WITHOUT ANY WARRANTY; without even the implied warranty of
00010 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00011 // GNU General Public License for more details.
00012 //
00013 // You should have received a copy of the GNU General Public License
00014 // along with this program; if not, write to the Free Software
00015 // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
00016 
00017 #include <string>
00018 #include <map>
00019 #include <assert.h>
00020 #include "State.h"
00021 #include "PDataContainer.h"
00022 #include "Evaluator.h"
00023 
00024 #ifndef N_PRIM
00025 #define N_PRIM
00026 
00027 namespace Fluxus
00028 {
00029 
00032 class Primitive : public PDataContainer
00033 {
00034 public:
00035     Primitive();
00036     Primitive(const Primitive &other);
00037     virtual ~Primitive();
00038 
00042     virtual Primitive *Clone() const=0;
00043     virtual void Render()=0;
00044     virtual dBoundingBox GetBoundingBox()=0;
00045     virtual void ApplyTransform(bool ScaleRotOnly=false)=0;
00046     virtual Evaluator *MakeEvaluator()=0;
00048     
00050     virtual string GetTypeName()    { return "Primitive"; }
00051         
00053     virtual void RecalculateNormals(bool smooth) {}
00054     
00058     void RenderBoundingBox();
00059     static void RenderAxes();
00060     void Prerender();
00061     void ApplyState()               { m_State.Apply(); }
00062     
00065     void SetState(State *s)         { assert(s); m_State=*s; }
00066     State *GetState()               { return &m_State; }
00067     
00069     void SetPhysicalHint(bool s)    { m_IsPhysical=s; }
00070     bool IsPhysicalHint()           { return m_IsPhysical; }
00071     
00073     unsigned int GetVisibility()    { return m_Visibility; }
00074     void SetVisibility(unsigned int s) { m_Visibility=s; } 
00075     
00077     bool IsSelectable()             { return m_Selectable; }
00078     void Selectable(bool s)         { m_Selectable=s; }
00080 
00081 protected:
00082     State m_State;
00083     
00084 private:
00085     
00087     bool  m_IsPhysical;
00088     unsigned int m_Visibility;
00089     bool  m_Selectable;
00090 };
00091 
00092 };
00093 
00094 #endif

Generated on Wed Sep 17 21:16:30 2008 for The Fluxus Renderer (libfluxus) by  doxygen 1.5.1