![]()
|
render.h00001 // 00002 // render.h 00003 // 00004 // Copyright (C) 1996 Limit Point Systems, Inc. 00005 // 00006 // Author: Curtis Janssen <cljanss@limitpt.com> 00007 // Maintainer: LPS 00008 // 00009 // This file is part of the SC Toolkit. 00010 // 00011 // The SC Toolkit is free software; you can redistribute it and/or modify 00012 // it under the terms of the GNU Library General Public License as published by 00013 // the Free Software Foundation; either version 2, or (at your option) 00014 // any later version. 00015 // 00016 // The SC Toolkit is distributed in the hope that it will be useful, 00017 // but WITHOUT ANY WARRANTY; without even the implied warranty of 00018 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00019 // GNU Library General Public License for more details. 00020 // 00021 // You should have received a copy of the GNU Library General Public License 00022 // along with the SC Toolkit; see the file COPYING.LIB. If not, write to 00023 // the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. 00024 // 00025 // The U.S. Government is granted a limited license as per AL 91-7. 00026 // 00027 00028 #ifdef __GNUC__ 00029 #pragma interface 00030 #endif 00031 00032 #ifndef _util_render_render_h 00033 #define _util_render_render_h 00034 00035 #include <util/class/class.h> 00036 #include <util/render/appearance.h> 00037 #include <util/render/material.h> 00038 #include <util/render/transform.h> 00039 #include <util/render/stack.h> 00040 00041 namespace sc { 00042 00043 class RenderedObject; 00044 class AnimatedObject; 00045 class RenderedObjectSet; 00046 class RenderedSphere; 00047 class RenderedPolygons; 00048 class RenderedPolylines; 00049 00050 class Render: public DescribedClass { 00051 protected: 00052 Ref<Material> default_material_; 00053 Ref<Appearance> default_appearance_; 00054 Ref<Transform> default_transform_; 00055 00056 Stack<Ref<Material> > material_stack_; 00057 Stack<Ref<Appearance> > appearance_stack_; 00058 Stack<Ref<Transform> > transform_stack_; 00059 00060 virtual void push_material(const Ref<Material>& m); 00061 virtual void push_appearance(const Ref<Appearance>& a); 00062 virtual void push_transform(const Ref<Transform>& t); 00063 virtual Ref<Material> pop_material(); 00064 virtual Ref<Appearance> pop_appearance(); 00065 virtual Ref<Transform> pop_transform(); 00066 00067 public: 00068 Render(); 00069 Render(const Ref<KeyVal>&); 00070 virtual ~Render(); 00071 00072 Ref<Material> default_material() { return default_material_; } 00073 Ref<Appearance> default_appearance() { return default_appearance_; } 00074 Ref<Transform> default_transform() { return default_transform_; } 00075 void default_material(const Ref<Material>& m) { default_material_ = m; } 00076 void default_appearance(const Ref<Appearance>& a) {default_appearance_ = a;} 00077 void default_transform(const Ref<Transform>& t) {default_transform_ = t;} 00078 00079 virtual void clear() = 0; 00080 00081 virtual void render(const Ref<RenderedObject>&); 00082 virtual void animate(const Ref<AnimatedObject> &); 00083 00084 virtual void set(const Ref<RenderedObjectSet>&); 00085 virtual void sphere(const Ref<RenderedSphere>&); 00086 virtual void polygons(const Ref<RenderedPolygons>&) = 0; 00087 virtual void polylines(const Ref<RenderedPolylines>&) = 0; 00088 }; 00089 00090 00091 class FileRender: public Render { 00092 protected: 00093 char* filename_; 00094 char* basename_; 00095 std::streambuf *sbuf_; 00096 int delete_sbuf_; 00097 int depth_; 00098 00099 char *get_filename(const char *objectname); 00100 void open_sbuf(const char *objectname); 00101 void close_sbuf(); 00102 public: 00103 FileRender(const char * filename); 00104 FileRender(std::ostream &o = ExEnv::out0()); 00105 FileRender(const Ref<KeyVal>&); 00106 virtual ~FileRender(); 00107 00108 void clear(); 00109 00110 virtual void set_filename(const char *name); 00111 virtual void set_basename(const char *name); 00112 virtual const char *file_extension(); 00113 }; 00114 00115 } 00116 00117 #endif 00118 00119 // Local Variables: 00120 // mode: c++ 00121 // c-file-style: "CLJ" 00122 // End: Generated at Fri Jan 10 08:14:09 2003 for MPQC 2.1.3 using the documentation package Doxygen 1.2.14. |