Ejemplo n.º 1
0
int intersect(SVBVHTree *obj, Isect* isec)
{
	//TODO renable hint support
	if(RE_rayobject_isAligned(obj->root))
		return bvh_node_stack_raycast<SVBVHNode,StackSize,false>( obj->root, isec);
	else
		return RE_rayobject_intersect( (RayObject*) obj->root, isec );
}
Ejemplo n.º 2
0
static int intersect(QBVHTree *obj, Isect *isec)
{
	//TODO renable hint support
	if (RE_rayobject_isAligned(obj->root)) {
		if (isec->mode == RE_RAY_SHADOW)
			return svbvh_node_stack_raycast<StackSize, true>(obj->root, isec);
		else
			return svbvh_node_stack_raycast<StackSize, false>(obj->root, isec);
	}
	else
		return RE_rayobject_intersect((RayObject *)obj->root, isec);
}
Ejemplo n.º 3
0
RayObject *RE_rayobject_blibvh_create(int size)
{
	BVHObject *obj= (BVHObject*)MEM_callocN(sizeof(BVHObject), "BVHObject");
	assert(RE_rayobject_isAligned(obj)); /* RayObject API assumes real data to be 4-byte aligned */	
	
	obj->rayobj.api = &bvh_api;
	obj->bvh = BLI_bvhtree_new(size, 0.0, 4, 6);
	obj->next_leaf = obj->leafs = (RayObject**)MEM_callocN(size*sizeof(RayObject*), "BVHObject leafs");
	
	INIT_MINMAX(obj->bb[0], obj->bb[1]);
	return RE_rayobject_unalignRayAPI((RayObject*) obj);
}
RayObject *RE_rayobject_instance_create(RayObject *target, float transform[4][4], void *ob, void *target_ob)
{
    InstanceRayObject *obj = (InstanceRayObject *)MEM_callocN(sizeof(InstanceRayObject), "InstanceRayObject");
    assert(RE_rayobject_isAligned(obj) );  /* RayObject API assumes real data to be 4-byte aligned */

    obj->rayobj.api = &instance_api;
    obj->target = target;
    obj->ob = ob;
    obj->target_ob = target_ob;

    copy_m4_m4(obj->target2global, transform);
    invert_m4_m4(obj->global2target, obj->target2global);

    return RE_rayobject_unalignRayAPI((RayObject *) obj);
}