Example #1
0
// this function must not be called on CSG objects
void Invert_Object(ObjectPtr Object)
{
	if (Object == NULL)
		return;
	assert((Object->Type & IS_CSG_OBJECT) == 0);
	Object->Invert();
}
Example #2
0
// Invert_CSG_Object deletes the original object and returns a new one
// we force use of a separate function for this to help ensure that calling code handles this
// we also set the passed pointer to NULL
// (yes, this is ugly and needs to be fixed)
ObjectPtr Invert_CSG_Object(ObjectPtr& Object)
{
	CSG     *csg_object;

	if(Object == NULL)
		return NULL;
	Object->Invert();

	csg_object = dynamic_cast<CSG *>(Object);
	assert(csg_object != NULL);

	// Morph will delete the old object
	csg_object = csg_object->Morph();
	Object = NULL;

	return csg_object;
}