// ----------------------------------------------------------------------------
// Blitz-Irrlicht 1.8.3 Wrapper by Ed Musolino 2015
// Based off of Frank Dodd's Irrlicht 1.7 Freebasic Wrapper (2006-2010)
// ----------------------------------------------------------------------------

//  This software is provided 'as-is', without any express Or implied
//  warranty.  In no event will the authors be held liable For any damages
//  arising from the use of this software.

//  Permission is granted To anyone To use this software For any purpose,
//  including commercial applications, And To alter it And redistribute it
//  freely, subject To the following restrictions:

//  1. The Origin of this software must Not be misrepresented; you must not
//     claim that you wrote the original software. If you use this software
//     in a product, an acknowledgement in the product documentation would be
//     appreciated but is Not required.
//  2. Altered source versions must be clearly marked as such, And must Not be
//     misrepresented as being the original software.
//  3. This notice may Not be removed Or altered from any source distribution.
//
// /////////////////////////////////////////////////////////////////////////////

// Copyright (C) 2009 Gaz Davidson
// Released under The Irrlicht Engine License, see irrlicht.h

#ifndef __C_BEAM_SCENE_NODE_H_INCLUDED__
#define __C_BEAM_SCENE_NODE_H_INCLUDED__

#include "ISceneNode.h"
#include "S3DVertex.h"

namespace irr
{
namespace scene
{

//! Scene node  
class CBeamSceneNode : public ISceneNode
{
public:

	//! constructor
	CBeamSceneNode(ISceneNode* parent, ISceneManager* mgr, s32 id,
			const core::vector3df& startPosition, const core::vector3df& endPosition, f32 size);

	//! pre render event
	virtual void OnRegisterSceneNode();

	//! render
	virtual void render();

	//! returns the axis aligned bounding box of this node
	virtual const core::aabbox3d<f32>& getBoundingBox() const;

	//! sets the size of the billboard
	virtual void setSize(f32 size);

	//! gets the size of the billboard
	virtual f32 getSize() const;

	//! sets the position of start and end points
	virtual void setPosition(const core::vector3df& startPos, const core::vector3df& endPos);

	//! Returns the material
	virtual video::SMaterial& getMaterial(u32 i);
	
	//! returns amount of materials used by this scene node.
	virtual u32 getMaterialCount() const;
	


	//! Writes attributes of the scene node.
	virtual void serializeAttributes(io::IAttributes* out, io::SAttributeReadWriteOptions* options=0) const;

	//! Reads attributes of the scene node.
	virtual void deserializeAttributes(io::IAttributes* in, io::SAttributeReadWriteOptions* options=0);

	//! Returns type of the scene node
	virtual ESCENE_NODE_TYPE getType() const { return ESCENE_NODE_TYPE(MAKE_IRR_ID('B','E','A','M')); }

	//! Creates a clone of this scene node and its children.
	//virtual ISceneNode* clone(ISceneNode* newParent=0, ISceneManager* newManager=0);
	
private:

	void recalculateBoundingBox();

	f32 Size;
	core::vector3df EndPos;

	core::aabbox3d<f32> BBox;
	video::SMaterial Material;

	video::S3DVertex vertices[12];
};


} // end namespace scene
} // end namespace irr

#endif

