- Main Page
- Related Pages
- Classes
- Files

# 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 namespace sc {
    00043
    00044 class Render;
    00045
    00046 class RenderedObject: public DescribedClass {
    00047   protected:
    00048     char* name_;
    00049     Ref<Material> material_;
    00050     Ref<Appearance> appearance_;
    00051     Ref<Transform> transform_;
    00052
    00053     friend class Render;
    00054   public:
    00055     RenderedObject(const Ref<Material>& = 0);
    00056     RenderedObject(const Ref<KeyVal>&);
    00057     ~RenderedObject();
    00058     const char* name() const { return name_; }
    00059     void set_name(const char *);
    00060     Ref<Material> material() const { return material_; }
    00061     Ref<Appearance> appearance() const { return appearance_; }
    00062     Ref<Transform> transform() const { return transform_; }
    00063     void material(const Ref<Material>&m) { material_ = m; }
    00064     void appearance(const Ref<Appearance>&a) { appearance_ = a; }
    00065     void transform(const Ref<Transform>&t) { transform_ = t; }
    00066
    00067     virtual void print(std::ostream& = ExEnv::out0()) const;
    00068
    00069     // to be called only by derivatives of Render
    00070     virtual void render(const Ref<Render>&) = 0;
    00071 };
    00072
    00073
    00074 class RenderedObjectSet: public RenderedObject {
    00075   private:
    00076     int capacity_;
    00077     int n_;
    00078     Ref<RenderedObject> *array_;
    00079   protected:
    00080     void render(const Ref<Render>&);
    00081   public:
    00082     RenderedObjectSet(int capacity = 10);
    00083     RenderedObjectSet(const Ref<KeyVal>&);
    00084     ~RenderedObjectSet();
    00085     int n() const { return n_; }
    00086     const Ref<RenderedObject>& element(int i) const { return array_[i]; }
    00087     virtual void add(const Ref<RenderedObject>&);
    00088 };
    00089
    00090 }
    00091
    00092 #endif
    00093
    00094 // Local Variables:
    00095 // mode: c++
    00096 // c-file-style: "CLJ"
    00097 // End: