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

object.h

00001 //
00002 // object.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 #ifndef _util_render_object_h
00029 #define _util_render_object_h
00030 
00031 #ifdef __GNUC__
00032 #pragma interface
00033 #endif
00034 
00035 #include <iostream>
00036 
00037 #include <util/keyval/keyval.h>
00038 #include <util/render/material.h>
00039 #include <util/render/appearance.h>
00040 #include <util/render/transform.h>
00041 
00042 class Render;
00043 
00044 class RenderedObject: public DescribedClass {
00045   protected:
00046     char* name_;
00047     Ref<Material> material_;
00048     Ref<Appearance> appearance_;
00049     Ref<Transform> transform_;
00050 
00051     friend class Render;
00052   public:
00053     RenderedObject(const Ref<Material>& = 0);
00054     RenderedObject(const Ref<KeyVal>&);
00055     ~RenderedObject();
00056     const char* name() const { return name_; }
00057     void set_name(const char *);
00058     Ref<Material> material() const { return material_; }
00059     Ref<Appearance> appearance() const { return appearance_; }
00060     Ref<Transform> transform() const { return transform_; }
00061     void material(const Ref<Material>&m) { material_ = m; }
00062     void appearance(const Ref<Appearance>&a) { appearance_ = a; }
00063     void transform(const Ref<Transform>&t) { transform_ = t; }
00064 
00065     virtual void print(std::ostream& = ExEnv::out()) const;
00066 
00067     // to be called only by derivatives of Render
00068     virtual void render(const Ref<Render>&) = 0;
00069 };
00070 
00071 
00072 class RenderedObjectSet: public RenderedObject {
00073   private:
00074     int capacity_;
00075     int n_;
00076     Ref<RenderedObject> *array_;
00077   protected:
00078     void render(const Ref<Render>&);
00079   public:
00080     RenderedObjectSet(int capacity = 10);
00081     RenderedObjectSet(const Ref<KeyVal>&);
00082     ~RenderedObjectSet();
00083     int n() const { return n_; }
00084     const Ref<RenderedObject>& element(int i) const { return array_[i]; }
00085     virtual void add(const Ref<RenderedObject>&);
00086 };
00087 
00088 
00089 #endif
00090 
00091 // Local Variables:
00092 // mode: c++
00093 // c-file-style: "CLJ"
00094 // End:

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