
#ifndef __WFX_MATH_CUBE_H__
#define __WFX_MATH_CUBE_H__

#include <WFX/WFXIncludes.h>
#include <WFX/scene/BoundingVolume.h>

namespace WFX {

    namespace math {

        /**
         * a Cube in 3D space
         * implements BoundingVolume interface
         */
        class Cube : public WFX::scene::BoundingVolume {
            public:
                /**
                 * Ctor/Dtor
                 * @param: c - center point
                 * @param: w - width
                 */
                Cube(math::Vector3& c, Real w) {
                    Center = c;
                    Width = w;
                }
                Cube() {
                    Center = math::Vector3::ZERO;
                    Width = 0.0f;
                }
                virtual ~Cube() {} 

                /** implement Boudningvolume interface */
                void transformBy(math::Matrix3& rot, math::Vector3& trans, Real scale);
                void computeFromVertices(UInt count, math::Vector3* verts);
                math::Plane::Side whichSide(const math::Plane& plane) const;
                BoundingVolume* copy();
                void merge(BoundingVolume* bv);
                void mergeMe(BoundingVolume* bv);
                void mergeSphere(math::Sphere& s);
                void mergeCube(math::Cube& s);
                void printDebug();

                /** member access */
                math::Vector3& getCenter() {
                    return Center;
                }
                Real getWidth() {
                    return Width;
                }
                void setWidth(Real r) {
                    Width = r;
                }
               
                /**  implement Drawable interface */
                void draw(WFX::renderer::Renderer* r);
                /** accept a SceneGraphVisitor */
                void accept(WFX::scene::SceneGraphVisitor* v);

                /** clones this Cube */
                Cube* clone();
            protected:
                /** Center point */
                math::Vector3 Center;
                /** radius */
                Real Width;
                 
                
        };

    }

}


#endif //include guard


