/*
 * Author: Andrew Mann
 *
 * Copyright (C) 2004 PlaneShift Team (info@planeshift.it,
 * http://www.planeshift.it)
 *
 * This program is free software; you can redistribute it and/or
 * modify it under the terms of the GNU General Public License
 * as published by the Free Software Foundation (version 2 of the License)
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
 *
 */

#ifndef __HELPERS_DOT_H__
#define __HELPERS_DOT_H__


#include "iutil/objreg.h"
#include "iutil/plugin.h"
#include "iengine/engine.h"
#include "iengine/camera.h"
#include "iengine/sector.h"
#include "imesh/thing.h"
#include "iengine/mesh.h"
#include "iengine/material.h"
#include "iengine/movable.h"
#include "imesh/object.h"
#include "imesh/genmesh.h"


class DirectionArrow
{
public:
    DirectionArrow(iObjectRegistry* o_reg,iSector *sector, csVector3 position,csVector3 direction,float length);
    ~DirectionArrow();
    bool Initialize();
    void SetShaftColor(csColor c);
    void SetHeadColor(csColor c);
    void Hide();
    void Show();
    void MoveTo(csVector3 position);
    void PointTo(csVector3 direction);


protected:
    bool InitializeArrowFactory();
    bool InitializeArrowMaterial();
    bool InitializeArrowShader();


public:
    static iObjectRegistry *object_reg;
    static iEngine *engine;
    static iShader *arrow_shader;
    static const char *shader_string;
    static iMaterialWrapper *arrow_material_wrapper;



    bool shown;
    iSector *loc_sector;
    csVector3 loc_position;
    csVector3 loc_direction;
    float loc_length;

    csRef<iMeshObject> arrow_mesh;
    csRef<iMeshWrapper> arrow_mesh_wrapper;
    csRef<iMeshFactoryWrapper> arrow_factory_wrapper;


};


class CoordinateArrows : public iMovableListener
{
public:
    CoordinateArrows(iObjectRegistry* o_reg,iSector *sector, csVector3 position,csVector3 vec_y,csVector3 vec_x ,float arrow_offset, float arrow_length);
    virtual ~CoordinateArrows();

SCF_DECLARE_IBASE;

    bool Initialize();
    void Show();
    void Hide();

  /**
   * The movable has changed. This is called whenever something does
   * UpdateMove() on the movable.
   */
  virtual void MovableChanged (iMovable* movable);
  /// The movable is about to be destroyed.
  virtual void MovableDestroyed (iMovable* movable);


protected:
    DirectionArrow *arrow_x,*arrow_y,*arrow_z;
    float offset,length;

};









#endif // #ifndef __HELPERS_DOT_H__


