// *********************************************************
// Object Class
// Author : Tamy Boubekeur (boubek@gmail.com).
// Copyright (C) 2010 Tamy Boubekeur.
// All rights reserved.
// *********************************************************

#ifndef OBJECT_H
#define OBJECT_H

#include <iostream>
#include <vector>

#include "Mesh.h"
#include "Material.h"
#include "BoundingBox.h"
#include "Ray.h"

struct IntersectedTriangle;

class Object {
public:
    inline Object () : mat(), selected(false) {}
    inline Object (const Mesh& mesh, const Material& mat) : mesh (mesh), mat(mat), selected(false) {}
    virtual ~Object () {}

    const Vec3Df & getTrans () const { return trans;}
    void setTrans (const Vec3Df & t) { trans = t; }

    const Mesh & getMesh () const { return mesh; }
    Mesh & getMesh () { return mesh; }

    Material& getMaterial() { return mat; }
    const Material& getMaterial() const { return mat; }
    void setMaterial(const Material& m) { mat = m; }

    const BoundingBox& getBoundingBox () const { return mesh.getBoundingBox(); }

    bool intersect(const Ray& r, IntersectedTriangle& tri) const;
    bool intersectWithTransform(const Ray& r, IntersectedTriangle& tri) const;

    bool isSelected() const { return selected; }
    void setSelected(bool b) { selected = b; }

private:
    Mesh mesh;
    Material mat;
    Vec3Df trans;
    bool selected;
};


#endif // Scene_H

// Some Emacs-Hints -- please don't remove:
//
//  Local Variables:
//  mode:C++
//  tab-width:4
//  End:
