void ISPCDevice::removeParam(OSPObject _object, const char *name) { ManagedObject *object = (ManagedObject *)_object; // ManagedObjects have to be decref before removing them ManagedObject *existing = object->getParam<ManagedObject*>(name, nullptr); if (existing) existing->refDec(); object->removeParam(name); }
/*! Note that all objects in ospray are refcounted, so one cannot explicitly "delete" any object. Instead, each object is created with a refcount of 1, and this refcount will be increased/decreased every time another object refers to this object resp. releases its hold on it; if the refcount is 0 the object will automatically get deleted. For example, you can create a new material, assign it to a geometry, and immediately after this assignation release it; the material will stay 'alive' as long as the given geometry requires it. */ void ISPCDevice::release(OSPObject _obj) { if (!_obj) return; ManagedObject *obj = (ManagedObject *)_obj; obj->refDec(); }