/****************************************************************************************

	NonUniformScale.h

	Copyright (c)1990 - 1999 MetaCreations. All rights reserved.

	Author:	Jonathan Trachtenberg

	Date:	06/09/99

	Revision History

	when		who			what & why
	=========== ===========	=============================================================

****************************************************************************************/

#ifndef __NONUNIFORMSCALE__
#define __NONUNIFORMSCALE__  

#if CP_PRAGMA_ONCE
#pragma once
#endif

#include	"BasicModifiers.h"   
#include	"I3dExModifier.h"
#include	"BasicWireFrame.h"
#include	"I3dWireFrame.h"
#include	"NonUniformScaleDef.h"

// Define the NonUniformScale CLSID ( see the NonUniformScaleDef.h file to get the R_CLSID_NonUniformScale value )

extern const MCGUID CLSID_NonUniformScale;


// Data storage of our extension :
struct NonUniformScaleData
{
	int32	fAxis;			// ID of the axis (AXEX AXEY or AXEZ)
	real    fUBegScale;		// First scaling of the U axis (if Z is selected, it is the X axis) 
	real    fUEndScale;		// Last scaling of the U axis (if Z is selected, it is the X axis)
	real    fVBegScale;		// First scaling of the V axis (if Z is selected, it is the Y axis)
	real	fVEndScale;		// Last scaling of the U axis (if Z is selected, it is the Y axis)
	TBBox3D	fBoundingBox;	// Bounding Box
};
 
// NonUniformScale Object :

class NonUniformScale : public TBasicWireframe, public TBasicDeformModifier
{
public :  
  NonUniformScale();

	// IUnknown methods
	STANDARD_RELEASE;
	virtual uint32 		MCCOMAPI AddRef					();
	virtual MCCOMErr	MCCOMAPI QueryInterface			(const MCIID& riid, void** ppvObj);

	// IExDataExchanger methods :
	virtual void*	 MCCOMAPI GetExtensionDataBuffer	();
	virtual int32	 MCCOMAPI GetParamsBufferSize		() const	{ return sizeof(fData);}
  
	// I3DExModifier methods
	virtual void		MCCOMAPI SetBoundingBox			(const TBBox3D& bbox);
	virtual MCCOMErr	MCCOMAPI DeformPoint			(const TVector3& point, TVector3& result);
	virtual MCCOMErr	MCCOMAPI DeformBBox				(const TBBox3D& in,TBBox3D& out);

	//I3DWireFrame methods
	virtual MCCOMErr   MCCOMAPI	TrackWireFrame			(I3DShWireFrame* wireFrame, int16 proj, I3DShTreeElement* tree, int16 handle, const TRACKINFO& startinfo, const TRACKINFO& previnfo, const TRACKINFO& nextinfo);
	virtual MCCOMErr   MCCOMAPI	DataToWireFrame			(I3DShWireFrame* wireFrame, int16 proj, I3DShTreeElement* tree);

protected :
	
enum
{
	kRadioX_id	= IDTYPE('X', 'A', 'X', 'I'), //IDs from .rsr
	kRadioY_id	= IDTYPE('Y', 'A', 'X', 'I'),
	kRadioZ_id	= IDTYPE('Z', 'A', 'X', 'I'),
};

    NonUniformScaleData		fData;

	void	WFUpdatePoints (I3DShWireFrame* wireFrame);

};

#endif