示例#1
0
	void CybPhantom::exitHL()
	{
		if(shapeIdListIscreated){
			for(int i = 0; i < numHapticLayers; i++)
				hlDeleteShapes(shapeId[i], 1);
			delete [] properties;
		}
	
	
		hlMakeCurrent(NULL);
		if(hapticContext != NULL)
		{
			hlDeleteContext(hapticContext);
		}
	
		if(hapticDevice != HD_INVALID_HANDLE)
		{
			hdDisableDevice(hapticDevice);
			hapticDevice = HD_INVALID_HANDLE;
		}
	
		if(ambientPropertyIsEnable){
			CybViscosity *viscosity = CybViscosity::getInstance();
			viscosity->stopAmbientProperty();
			delete viscosity;
		}
	
	}
//*******************************************************************************
HapticObject::~HapticObject()
{
	// Shapes für Haptik freigeben
	hlDeleteShapes(m_HLShapeID, 1);
//	hlDeleteShapes(m_constraintSID, 1);

	// evtl. vorhandene Actionhandler freigeben
	vector<IHapticAction*>::iterator iterAct = NULL;
	for (iterAct = m_HapticActions.begin(); iterAct != m_HapticActions.end(); iterAct++)
	{
		if (*iterAct != NULL)
		{
			(*iterAct)->unregisterAction(m_HLShapeID);
			delete (*iterAct);
			(*iterAct) = NULL;
		}
	}

	// Constraint freigeben, wenn eins vorhanden ist
	if (m_pHapticConstraint != NULL)
	{
		delete m_pHapticConstraint;
		m_pHapticConstraint = NULL;
	}
}
示例#3
0
/*******************************************************************************
 This handler is called when the application is exiting.  Deallocates any state 
 and cleans up.
*******************************************************************************/
void exitHandler()
{
    // Remove event callbacks.
    hlRemoveEventCallback(HL_EVENT_TOUCH, gSphereShapeId, 
        HL_CLIENT_THREAD, touchSphereCallback);
    hlRemoveEventCallback(HL_EVENT_UNTOUCH, gSphereShapeId, 
        HL_CLIENT_THREAD, untouchSphereCallback);
    hlRemoveEventCallback(HL_EVENT_TOUCH, gTorusShapeId, 
        HL_CLIENT_THREAD, touchTorusCallback);
    hlRemoveEventCallback(HL_EVENT_UNTOUCH, gTorusShapeId, 
        HL_CLIENT_THREAD, untouchTorusCallback);
    hlRemoveEventCallback(HL_EVENT_TOUCH, gTeapotShapeId, 
        HL_CLIENT_THREAD, touchTeapotCallback);
    hlRemoveEventCallback(HL_EVENT_UNTOUCH, gTeapotShapeId, 
        HL_CLIENT_THREAD, untouchTeapotCallback);
    hlRemoveEventCallback(HL_EVENT_CALIBRATION_UPDATE, HL_OBJECT_ANY,
        HL_CLIENT_THREAD, calibrationCallback);                       
    hlRemoveEventCallback(HL_EVENT_CALIBRATION_INPUT, HL_OBJECT_ANY,
        HL_CLIENT_THREAD, calibrationCallback);                       

    // Deallocate the shape ids we reserved in initHL.
    hlDeleteShapes(gSphereShapeId, 1);
    hlDeleteShapes(gTorusShapeId, 1);
    hlDeleteShapes(gSphereShapeId, 1);

    // Free up the haptic rendering context.
    hlMakeCurrent(NULL);
    if (hHLRC != NULL)
    {
        hlDeleteContext(hHLRC);
    }

    // Free up the haptic device.
    if (hHD != HD_INVALID_HANDLE)
    {
        hdDisableDevice(hHD);
    }
}
示例#4
0
/*******************************************************************************
 This handler is called when the application is exiting.  Deallocates any state
 and cleans up.
*******************************************************************************/
void exitHandler()
{
// Deallocate the sphere shape id we reserved in initHL.
    if (objmodel)
    {
        hlDeleteShapes(gShapeId, 1);
        hlDeleteShapes(gPointId, 1);
    }

// Free up the haptic rendering context.
    hlMakeCurrent(NULL);

    if (ghHLRC != NULL)
    {
        hlDeleteContext(ghHLRC);
    }

// Free up the haptic device.
    if (ghHD != HD_INVALID_HANDLE)
    {
        hdDisableDevice(ghHD);
    }
}
示例#5
0
RigidBody::~RigidBody()
{
    // delete our faces, edges, vertices, and normals
    deleteFaces();
    deleteEdges(edges);

    // Since nonParallelEdges is a list of pointers to some 
    // of the edge objects in "edges" (i.e. re-use of same
    // edge objects) we don't need to delete them again, just
    // clear the list.
    nonParallelEdges.clear();
    deleteVectorList(verticesWorld);
    deleteVectorList(verticesObject);
    deleteVectorList(normalsWorld);
    deleteVectorList(normalsObject);

    hlDeleteShapes(shapeId, 1);
}
//*******************************************************************************
HapticConstraint::~HapticConstraint()
{
	// Shape bei HLAPI deregistrieren
	hlDeleteShapes(m_HLConstraintID, 1);
}