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 00023 #ifndef N_PRIM 00024 #define N_PRIM 00025 00026 namespace Fluxus 00027 { 00028 00031 class Primitive : public PDataContainer 00032 { 00033 public: 00034 Primitive(); 00035 Primitive(const Primitive &other); 00036 virtual ~Primitive(); 00037 00041 virtual Primitive *Clone() const=0; 00042 virtual void Render()=0; 00043 virtual dBoundingBox GetBoundingBox()=0; 00044 virtual void ApplyTransform(bool ScaleRotOnly=false)=0; 00046 00048 virtual string GetTypeName() { return "Primitive"; } 00049 00051 virtual void RecalculateNormals(bool smooth) {} 00052 00056 void RenderBoundingBox(); 00057 static void RenderAxes(); 00058 void Prerender(); 00059 void ApplyState() { m_State.Apply(); } 00060 00063 void SetState(State *s) { assert(s); m_State=*s; } 00064 State *GetState() { return &m_State; } 00065 00067 void SetPhysicalHint(bool s) { m_IsPhysical=s; } 00068 bool IsPhysicalHint() { return m_IsPhysical; } 00069 00072 bool Hidden() { return m_Hidden; } 00073 void Hide(bool s) { m_Hidden=s; } 00074 00076 bool IsSelectable() { return m_Selectable; } 00077 void Selectable(bool s) { m_Selectable=s; } 00079 00080 protected: 00081 State m_State; 00082 00083 private: 00084 00086 bool m_IsPhysical; 00087 bool m_Hidden; 00088 bool m_Selectable; 00089 }; 00090 00091 }; 00092 00093 #endif