#ifndef _dmsObject_h_
#define _dmsObject_h_

#include <dms/Material.h>
#include <dms/Texture2D.h>
#include <dms/Transparency.h>
#include <dms/Transform.h>

namespace dms
{

class Object
    {
    public:
        typedef void (*CallbackFunc)(Object&,void*);

        Object(void);
        virtual ~Object(void);
        void drawAll(void);
        void updateAll(void);

        virtual void draw(void);
        virtual void update(void);

        void setTransform(Transform&);
        void setMaterial(Material&);
        void setTexture(Texture&);
        void setTransparency(Transparency&);
        Transform& transform(void) const { return *transform_; }
        Material& material(void) const { return *material_; }
        Texture& texture(void) const { return *texture_; }
        Transparency& transparency(void) const { return *transparency_; }
        
        void attach(Object&);
        void detach(Object&);
        int numChildren(void);
        Object& child(int n);

        void setDrawCallback(CallbackFunc drawfunc,void *data=0);
        void setDrawCallbackData(void *data);
        void setUpdateCallback(CallbackFunc updatefunc,void *data=0);
        void setUpdateCallbackData(void *data);
        
    private:
        Material * material_;
        Texture * texture_;
        Transparency * transparency_;
        Transform * transform_;
        Object * parent_;
        Object ** children_;
        int numChildren_, maxChildren_;
        CallbackFunc drawFunc_, updateFunc_;
        void *drawData_, *updateData_;
    };

}

#endif
