/* object.h                                              -*-C++-*-
 *   by Will Wagner <wwagner@io.com>
 *   last updated 20 Sep 1997, 17:22:27 wwagner
 *
 * This file contains the interface definition for the generic POVRay
 * object.  All objects must inherit from this class, since POVRay
 * expects to get pointers to Object objects out of the parse routine.
 *
 * Changes
 *   29 Jul 1997
 *     - Minor changes; corrected type discrepancies; got rid of the
 *     type member (it seems pretty useless).
 *
 *   18 Aug 1997
 *     - Fixed the generic bounding object; added the include for the
 *     bounding object; removed parse method from the compound object,
 *     since it will never be instantiated.
 *
 *   20 Sep 1997
 *     - The generic bounding object, which was at one point a
 *     template, is now based on DBLs instead of SNGLs.
 *
 * Things to do
 *     - Add methods for getting/setting the various data members.
 *
 *     - See what the sibling/bound/clip/texture collections really
 *     need; can we make them into vectors, and should we use pointers
 *     instead of instances?  How about smart pointers which
 *     automatically delete the referenced object when they die?
 *
 */

#ifndef __INC_OBJECT_H__
#define __INC_OBJECT_H__

#include <g++/iostream.h>
#include <g++/list.h>
#include "counter.h"
#include "bound.h"
#include "vector.h"
#include "matrix.h"
/*#include "texture.h"*/
#include "parse.h"
/*#include "ray.h"*/

class Object
{
  private:
    unsigned short flags;
    list<Object> sibling, bound, clip;
    list<Texture> texture;
    BoundingObject *bound_obj;

  protected:
    /* the intersection test counters and such */
    static Counter bound_tests, bound_test_successes;
    static Counter clip_tests, clip_test_successes;
    static Counter object_tests, object_test_successes;

  public:
    Object(int);
    Object(const Object&);
    virtual ~Object();

    static Object *Parse(Parser&);
    static void Stats(void);

    /*virtual int Intersects(const Ray&);
    virtual int All_Intersections(const Ray&, IStack&);*/
    virtual int Inside(const pov_vector<DBL>&) const;
    /*virtual pov_vector<DBL> Normal(const Intersection&) const;*/
    virtual Object *Copy(void) const;
    virtual void Translate(pov_vector<DBL>&, Transformation&);
    virtual void Rotate(pov_vector<DBL>&, Transformation&);
    virtual void Scale(pov_vector<DBL>&, Transformation&);
    virtual void Transform(Transformation&);
    virtual void Invert(void);
};

class CompoundObject : public Object
{
  private:
    list<Object> children;

  public:
    CompoundObject();
    CompoundObject(const CompoundObject&);
    virtual ~CompoundObject();
};

#endif /* __INC_OBJECT_H__ */
