
#define VIRTUAL

// File         Graphic3d_GraphicDriver_712.cxx
// Created      Mardi 28 janvier 1997
// Author       CAL
//      02.15.100 : JR : Clutter

//-Copyright    MatraDatavision 1997

//-Version

//-Design       Declaration des variables specifiques aux Drivers

//-Warning      Un driver encapsule les Pex et OpenGl drivers

//-References

//-Language     C++ 2.0

//-Declarations

// for the class
#include <Graphic3d_GraphicDriver.jxx>

#include <Aspect_DriverDefinitionError.hxx>

extern "C" {
#include <InterfaceGraphic_Cextern.hxx>
}

//-Aliases

//-Global data definitions

//-Methods, in order

#ifdef VIRTUAL
void Graphic3d_GraphicDriver::Bezier (const Graphic3d_CGroup& , const Graphic3d_Array1OfVertex& , const Standard_Boolean ) {
#else
void Graphic3d_GraphicDriver::Bezier (const Graphic3d_CGroup& ACGroup, const Graphic3d_Array1OfVertex& ListVertex, const Standard_Boolean EvalMinMax) {

Graphic3d_CGroup MyCGroup = ACGroup;

//static void (*fp) (Graphic3d_CGroup *, CALL_DEF_LISTPOINTS *) = NULL;

	//if (! fp) {
	    //OSD_Function osdfp = NULL;
	    //osdfp = MySharedLibrary.DlSymb ("call_togl_bezier");
	    //fp = (void (*)(Graphic3d_CGroup *, CALL_DEF_LISTPOINTS *)) osdfp;
	    //if (! osdfp)
		//Aspect_DriverDefinitionError::Raise
			//(MySharedLibrary.DlError ());
	//}

Standard_Integer Lower	= ListVertex.Lower ();

CALL_DEF_LISTPOINTS alpoints;

	alpoints.NbPoints	= int (ListVertex.Length ());
	alpoints.TypePoints	= 1;
	alpoints.UPoints.Points	= (CALL_DEF_POINT *) &ListVertex (Lower);

	if (MyTraceLevel) {
		PrintFunction ("call_togl_bezier");
		PrintCGroup (MyCGroup, 1);
	}
	call_togl_bezier (&MyCGroup, &alpoints);

#endif
}

#ifdef VIRTUAL
void Graphic3d_GraphicDriver::Bezier (const Graphic3d_CGroup& , const Graphic3d_Array1OfVertex& , const TColStd_Array1OfReal& , const Standard_Boolean ) {
#else
void Graphic3d_GraphicDriver::Bezier (const Graphic3d_CGroup& ACGroup, const Graphic3d_Array1OfVertex& ListVertex, const TColStd_Array1OfReal& ListWeight, const Standard_Boolean EvalMinMax) {

Graphic3d_CGroup MyCGroup = ACGroup;

//static void (*fp) (Graphic3d_CGroup *, CALL_DEF_LISTPOINTS *, CALL_DEF_LISTREALS *) = NULL;

	//if (! fp) {
	    //OSD_Function osdfp = NULL;
	    //osdfp = MySharedLibrary.DlSymb ("call_togl_bezier_weight");
	    //fp = (void (*)(Graphic3d_CGroup *, CALL_DEF_LISTPOINTS *, CALL_DEF_LISTREALS *)) osdfp;
	    //if (! osdfp)
		//Aspect_DriverDefinitionError::Raise
			//(MySharedLibrary.DlError ());
	//}

Standard_Integer i, j;
Standard_Integer Lower	= ListVertex.Lower ();
Standard_Integer Upper	= ListVertex.Upper ();

CALL_DEF_LISTREALS alweights;
float *weights;
CALL_DEF_LISTPOINTS alpoints;

	j	= ListWeight.Length ();

	alpoints.NbPoints	= int (ListVertex.Length ());
	alpoints.TypePoints	= 1;
	alpoints.UPoints.Points	= (CALL_DEF_POINT *) &ListVertex (Lower);

	weights	= new float [j];
	alweights.NbReals	= j;
	alweights.Reals		= weights;

	Lower	= ListWeight.Lower ();
	Upper	= ListWeight.Upper ();

	// Parcours des poids
	for (j=0, i=Lower; i<=Upper; i++, j++)
		weights[j]	= float (ListWeight (i));

	if (MyTraceLevel) {
		PrintFunction ("call_togl_bezier_weight");
		PrintCGroup (MyCGroup, 1);
	}
	call_togl_bezier_weight (&MyCGroup, &alpoints, &alweights);

	// Desallocation dynamique
	delete [] weights;

#endif
}
