$search
00001 /* 00002 * Copyright (C) 2008 00003 * Robert Bosch LLC 00004 * Research and Technology Center North America 00005 * Palo Alto, California 00006 * 00007 * All rights reserved. 00008 * 00009 *------------------------------------------------------------------------------ 00010 * project ....: PUMA: Probablistic Unsupervised Model Acquisition 00011 * file .......: RenderNode.h 00012 * authors ....: Benjamin Pitzer 00013 * organization: Robert Bosch LLC 00014 * creation ...: 04/16/2007 00015 * modified ...: $Date: 2009-02-10 21:31:50 -0800 (Tue, 10 Feb 2009) $ 00016 * changed by .: $Author: benjaminpitzer $ 00017 * revision ...: $Revision: 801 $ 00018 */ 00019 #ifndef RENDER_NODE_H 00020 #define RENDER_NODE_H 00021 00022 //== INCLUDES ================================================================== 00023 #include "rtc/rtcTransform.h" 00024 00025 //== NAMESPACES ================================================================ 00026 namespace rtc { 00027 00031 enum eRenderMode { 00032 Immediate = 0, 00033 VertexBufferObjects = 1, 00034 DisplayLists = 2, 00035 }; 00036 00037 class Renderer; 00038 class RenderNode { 00039 00040 public: 00044 class Parameters { 00045 public: 00049 Parameters(); 00050 00055 Parameters(const Parameters& other); 00056 00060 virtual ~Parameters(); 00061 00067 Parameters& copy(const Parameters& other); 00068 00074 Parameters& operator=(const Parameters& other); 00075 00076 00080 virtual RenderNode::Parameters* clone() const; 00081 00085 virtual bool write(std::ostream& os) const; 00086 00090 virtual bool read(std::istream& is); 00091 00092 // ------------------------------------------------ 00093 // the Parameters 00094 // ------------------------------------------------ 00095 bool draw_faces; 00096 bool draw_vertices; 00097 bool draw_wireframe; 00098 bool use_vertex_colors; 00099 typedef enum {NO_COLOR,VERTEX_COLOR,TEXTURE_COLOR} ColorMode; 00100 ColorMode color_mode; 00101 bool highlite; 00102 }; 00103 00104 // default constructor 00105 RenderNode(Renderer* renderer); 00106 // destructor 00107 virtual ~RenderNode(); 00108 // Set Renderers's Parameters. 00109 virtual bool setParameters(const Parameters& theParam); 00110 // returns used Parameters 00111 const Parameters& getParameters() const; 00112 // returns used Parameters 00113 Parameters& getParameters(); 00114 // initialize rendering 00115 virtual void initialize(); 00116 // rebuild node 00117 virtual void rebuild(); 00118 // clear rendering 00119 virtual void clear(); 00120 // rendering call 00121 virtual void render()=0; 00122 // prerendering call 00123 virtual void preRender(); 00124 // post rendering call 00125 virtual void postRender(); 00126 //returns the render mode 00127 eRenderMode getRenderMode(); 00128 // sets transform for render node 00129 void setTransform(Transformf transform); 00130 //returns the render node's transform 00131 const Transformf& getTransform(); 00132 // display faces 00133 virtual void displayFaces(bool b); 00134 // display vertices 00135 virtual void displayVertices(bool b); 00136 // display wireframe 00137 virtual void displayWireframe(bool b); 00138 // set color mode 00139 virtual void setColorMode(Parameters::ColorMode b); 00140 // draws in a highlite color 00141 virtual void setHighlite(bool b); 00142 protected: 00146 Parameters* m_params; 00147 00151 bool m_is_initialized; 00152 00156 Renderer* m_renderer; 00157 00161 Transformf m_transform; 00162 00163 }; 00164 00165 //============================================================================= 00166 } // NAMESPACE rtc 00167 //============================================================================= 00168 #endif // RENDER_NODE_H defined 00169 //============================================================================= 00170