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

render.h

00001 //
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 class RenderedObject;
00042 class AnimatedObject;
00043 class RenderedObjectSet;
00044 class RenderedSphere;
00045 class RenderedPolygons;
00046 class RenderedPolylines;
00047 
00048 class Render: public DescribedClass {
00049   protected:
00050     Ref<Material> default_material_;
00051     Ref<Appearance> default_appearance_;
00052     Ref<Transform> default_transform_;
00053 
00054     Stack<Ref<Material> > material_stack_;
00055     Stack<Ref<Appearance> > appearance_stack_;
00056     Stack<Ref<Transform> > transform_stack_;
00057 
00058     virtual void push_material(const Ref<Material>& m);
00059     virtual void push_appearance(const Ref<Appearance>& a);
00060     virtual void push_transform(const Ref<Transform>& t);
00061     virtual Ref<Material> pop_material();
00062     virtual Ref<Appearance> pop_appearance();
00063     virtual Ref<Transform> pop_transform();
00064 
00065   public:
00066     Render();
00067     Render(const Ref<KeyVal>&);
00068     virtual ~Render();
00069 
00070     Ref<Material> default_material() { return default_material_; }
00071     Ref<Appearance> default_appearance() { return default_appearance_; }
00072     Ref<Transform> default_transform() { return default_transform_; }
00073     void default_material(const Ref<Material>& m) { default_material_ = m; }
00074     void default_appearance(const Ref<Appearance>& a) {default_appearance_ = a;}
00075     void default_transform(const Ref<Transform>& t) {default_transform_ = t;}
00076 
00077     virtual void clear() = 0;
00078 
00079     virtual void render(const Ref<RenderedObject>&);
00080     virtual void animate(const Ref<AnimatedObject> &);
00081 
00082     virtual void set(const Ref<RenderedObjectSet>&);
00083     virtual void sphere(const Ref<RenderedSphere>&);
00084     virtual void polygons(const Ref<RenderedPolygons>&) = 0;
00085     virtual void polylines(const Ref<RenderedPolylines>&) = 0;
00086 };
00087 
00088 
00089 class FileRender: public Render {
00090   protected:
00091     char* filename_;
00092     char* basename_;
00093     std::streambuf *sbuf_;
00094     int delete_sbuf_;
00095     int depth_;
00096 
00097     char *get_filename(const char *objectname);
00098     void open_sbuf(const char *objectname);
00099     void close_sbuf();
00100   public:
00101     FileRender(const char * filename);
00102     FileRender(std::ostream &o = ExEnv::out());
00103     FileRender(const Ref<KeyVal>&);
00104     virtual ~FileRender();
00105 
00106     void clear();
00107 
00108     virtual void set_filename(const char *name);
00109     virtual void set_basename(const char *name);
00110     virtual const char *file_extension();
00111 };
00112 
00113 
00114 #endif
00115 
00116 // Local Variables:
00117 // mode: c++
00118 // c-file-style: "CLJ"
00119 // End:

Generated at Thu Oct 4 18:08:47 2001 for MPQC 2.0.0 using the documentation package Doxygen 1.2.5.