// -*- C++ -*-
#ifndef RIREADER_H
#define RIREADER_H
/* Copyright 1996 
 * Fri Sep 19 12:13:11 1997  Brian Smits  (bes@phoenix.cs.utah.edu)
 * 
 * RiReader.H
 * 
 *	
 * 
 * $Id: RiReader.H,v 1.5 1999/07/15 00:05:01 bes Exp $ 
 * 
 */
#ifndef RICOMMON_H
#include <RiCommon.H>
#endif


#ifndef RIOBJECTBUILDER_H
#include <RiObjectBuilder.H>
#endif

#ifndef RIPOLYGON_H
#include <RiPolygon.H>
#endif

#ifndef RISPHERE_H
#include <RiSphere.H>
#endif

#ifndef RIBACKGROUND_H
#include <RiBackground.H>
#endif

#ifndef RICYLINDER_H
#include <RiCylinder.H>
#endif


#ifndef RITHINLENSCAMERA_H
#include <RiThinLensCamera.H>
#endif

#ifndef RILIGHTOBJECT_H
#include <RiLightObject.H>
#endif

#include <rw/tvordvec.h>

#include <stdio.h>

/***************************************************************
CLASS
    RiReader
     Base class for model file readers.

DESCRIPTION
     Note that the derived classes create the builders that they
     can handle.

****************************************************************/

class RiReader {
  public:
				// GROUP: Constructors and assignment
				//// Default Constructor
    RiReader();
				//// Destructor
				// Does not delete the builders or the camera, or anything else...
    virtual ~RiReader() {}
				// GROUP: Accessors
				//// Returns pointer to camera (initially NULL)
    virtual RiThinLensCamera* GetCamera() const;
				//// Returns pointer to polygon builder (initially NULL)
    virtual RiPolygonBuilder* GetPolygonBuilder() const;
				//// Returns pointer to sphere builder (initially NULL)
    virtual RiSphereBuilder*  GetSphereBuilder() const;

				//// Returns pointer to background  (initially NULL)
    virtual RiBackground*  	GetBackground() const;

				//// Returns pointer to cylinder builder (initially NULL)
    virtual RiCylinderBuilder*  GetCylinderBuilder() const;
				//// Return the number of lights (NOT emitting object, virtual lights)
    int     			GetNumLights() const;
				//// Return the ith light
    RiLightObject	       *GetLight(int i) const;
				//// Return the number of other objects (NOT simple primitives)
    int     			GetNumOtherObjects() const;
				//// Return the ith other object
    RiRayObject 	       *GetOtherObject(int i) const;
				// GROUP: Members
				//// Processes current input stream
    virtual bool Read() = 0;
				////
    RiRayObject *BuildRayObject();
  protected:
				//// builder for polygons. Set to null by RiReader
    RiPolygonBuilder *polygonBuilderPtr;
				//// builder for spheres. Set to null by RiReader
    RiSphereBuilder  *sphereBuilderPtr;
				//// builder for cylinder. Set to null by RiReader
    RiCylinderBuilder  *cylinderBuilderPtr;
				//// the camera(should be an array...). Set to null by RiReader
    RiThinLensCamera *cameraPtr;

    RiBackground     *backgroundPtr;
				////  Add a light that isn't associated with geometry.
    void		AddLight(RiLightObject *vLight);
				////  Add a light that isn't associated with geometry.
    void		AddOtherObject(RiRayObject *obj);
  private:
				////
    RWTValOrderedVector<RiLightObject *> lightList;
				////  used for collections of primitives, instances, etc
    RWTValOrderedVector<RiRayObject *>   otherObjects;
};


#endif /* RIREADER_H */

