
//**************************************************************************/
// Copyright (c) 2008 Autodesk, Inc.
// All rights reserved.
//
// Use of this software is subject to the terms of the Autodesk license
// agreement provided at the time of installation or download, or which
// otherwise accompanies this software in either electronic or hard copy form.
//
//**************************************************************************/
// DESCRIPTION:
// CREATED: October 2008
//**************************************************************************/

namespace mudbox {

/// Represents a 3d object in the scene.
class MBDLL_DECL Geometry : virtual public GroupNode
{
	DECLARE_CLASS;

protected:
	/// Constructor.  Do not use this directly; use CreateInstance() instead.
	Geometry( void );

public:
	/// Returns the number of the subdivision levels in the object.
	virtual unsigned int LevelCount( void ) const;
	
	/// Returns a pointer to the lowest subdivision level (the one with the fewest faces).
	virtual SubdivisionLevel *LowestLevel( void ) const;
	
	/// Returns a pointer to the highest subdivision level (the one with the most faces).
	virtual SubdivisionLevel *HighestLevel( void ) const;
	
	/// Returns a subdivision level by index.  Returns NULL if index is out-of-range.
	virtual SubdivisionLevel *Level(
		unsigned int iIndex		///< [in] Index of the subdivision level to be returned
		) const;

	/// Adds a subdivision level to the object.
	virtual void AddLevel( 
		SubdivisionLevel *pLevel,	///< [in] The subdivision level.
		bool bFirst = false			///< [in] true to add as the first level. (if there are no levels, this parameter is ignored)
		);

	/// Returns the active subdivision level.
	virtual SubdivisionLevel *ActiveLevel( void ) const;
	
	/// Sets the active subdivision level.
	virtual void SetActiveLevel(
		SubdivisionLevel *pNewActiveLevel	///< [in] A pointer to the subdivision level to be made active.
		);

	/// Returns the number of sculpt layers in this geometry
	virtual unsigned int LayerCount() const;

	/// Returns a pointer to the layer delta/mask data for the specified layer. 
	/// Returns NULL if there is no layer data for the given subdivision level or
	/// if the layer index is out of range.
	virtual LayerMeshData* LayerData( 
		unsigned int iLayer,				///< [in] Index to a sculpt layer.
		const SubdivisionLevel* pLevel		///< [in] Pointer to the subdivision level for the layer data.
		) const;

	/// Returns the material associated with this geometry.
	virtual mudbox::Material *Material( void ) const;
	
	/// Sets the material associated with this geometry.
	virtual void SetMaterial( mudbox::Material *pMaterial );

	/// \brief This variable contains the address of the active level. 
	/// Plugins can use this attribute to catch level change events by connecting their own attribute of the same type.
	/// \see Attribute::Connect()
	/// \see Node::OnNodeEvent()
	aptr<SubdivisionLevel> m_pActiveLevel;
};

}; // end of namespace mudbox
