[Bf-blender-cvs] [099f7dc] openvdb: Set the primitive type for volume samples to VOLUME.

Lukas Tönne noreply at git.blender.org
Sun Nov 13 21:44:54 CET 2016


Commit: 099f7dc9ddb2be02cd7235d74b2c4c49aeb27d56
Author: Lukas Tönne
Date:   Sun Nov 13 17:45:29 2016 +0100
Branches: openvdb
https://developer.blender.org/rB099f7dc9ddb2be02cd7235d74b2c4c49aeb27d56

Set the primitive type for volume samples to VOLUME.

This is so the primitive_attribute_* functions correctly look for
voxel attributes.

===================================================================

M	intern/cycles/kernel/geom/geom_primitive.h
M	intern/cycles/kernel/kernel_shader.h
M	intern/cycles/kernel/kernel_types.h

===================================================================

diff --git a/intern/cycles/kernel/geom/geom_primitive.h b/intern/cycles/kernel/geom/geom_primitive.h
index 4384c20..dbf0b80 100644
--- a/intern/cycles/kernel/geom/geom_primitive.h
+++ b/intern/cycles/kernel/geom/geom_primitive.h
@@ -40,7 +40,7 @@ ccl_device_inline float primitive_attribute_float(KernelGlobals *kg,
 	}
 #endif
 #ifdef __VOLUME__
-	else if(ccl_fetch(sd, object) != OBJECT_NONE && desc.element == ATTR_ELEMENT_VOXEL) {
+	else if(ccl_fetch(sd, type) & PRIMITIVE_ALL_VOLUME) {
 		return volume_attribute_float(kg, sd, desc, dx, dy);
 	}
 #endif
@@ -68,7 +68,7 @@ ccl_device_inline float3 primitive_attribute_float3(KernelGlobals *kg,
 	}
 #endif
 #ifdef __VOLUME__
-	else if(ccl_fetch(sd, object) != OBJECT_NONE && desc.element == ATTR_ELEMENT_VOXEL) {
+	else if(ccl_fetch(sd, type) & PRIMITIVE_ALL_VOLUME) {
 		return volume_attribute_float3(kg, sd, desc, dx, dy);
 	}
 #endif
diff --git a/intern/cycles/kernel/kernel_shader.h b/intern/cycles/kernel/kernel_shader.h
index 604d0e8..652612c 100644
--- a/intern/cycles/kernel/kernel_shader.h
+++ b/intern/cycles/kernel/kernel_shader.h
@@ -441,7 +441,7 @@ ccl_device_inline void shader_setup_from_volume(KernelGlobals *kg, ShaderData *s
 	sd->object = PRIM_NONE; /* todo: fill this for texture coordinates */
 #endif
 	sd->prim = PRIM_NONE;
-	sd->type = PRIMITIVE_NONE;
+	sd->type = PRIMITIVE_VOLUME;
 
 #ifdef __UV__
 	sd->u = 0.0f;
diff --git a/intern/cycles/kernel/kernel_types.h b/intern/cycles/kernel/kernel_types.h
index ad5b138..96f2dd1 100644
--- a/intern/cycles/kernel/kernel_types.h
+++ b/intern/cycles/kernel/kernel_types.h
@@ -562,7 +562,8 @@ typedef enum PrimitiveType {
 	PRIMITIVE_ALL_TRIANGLE = (PRIMITIVE_TRIANGLE|PRIMITIVE_MOTION_TRIANGLE),
 	PRIMITIVE_ALL_CURVE = (PRIMITIVE_CURVE|PRIMITIVE_MOTION_CURVE),
 	PRIMITIVE_ALL_MOTION = (PRIMITIVE_MOTION_TRIANGLE|PRIMITIVE_MOTION_CURVE),
-	PRIMITIVE_ALL = (PRIMITIVE_ALL_TRIANGLE|PRIMITIVE_ALL_CURVE|PRIMITIVE_VOLUME),
+	PRIMITIVE_ALL_VOLUME = (PRIMITIVE_VOLUME),
+	PRIMITIVE_ALL = (PRIMITIVE_ALL_TRIANGLE|PRIMITIVE_ALL_CURVE|PRIMITIVE_ALL_VOLUME),
 
 	/* Total number of different primitives.
 	 * NOTE: This is an actual value, not a bitflag.




More information about the Bf-blender-cvs mailing list