Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'intern/cycles/kernel/types.h')
-rw-r--r--intern/cycles/kernel/types.h49
1 files changed, 26 insertions, 23 deletions
diff --git a/intern/cycles/kernel/types.h b/intern/cycles/kernel/types.h
index 855cc97edbf..20abea37649 100644
--- a/intern/cycles/kernel/types.h
+++ b/intern/cycles/kernel/types.h
@@ -537,31 +537,34 @@ typedef struct Intersection {
typedef enum PrimitiveType {
PRIMITIVE_NONE = 0,
PRIMITIVE_TRIANGLE = (1 << 0),
- PRIMITIVE_MOTION_TRIANGLE = (1 << 1),
- PRIMITIVE_CURVE_THICK = (1 << 2),
- PRIMITIVE_MOTION_CURVE_THICK = (1 << 3),
- PRIMITIVE_CURVE_RIBBON = (1 << 4),
- PRIMITIVE_MOTION_CURVE_RIBBON = (1 << 5),
- PRIMITIVE_POINT = (1 << 6),
- PRIMITIVE_MOTION_POINT = (1 << 7),
- PRIMITIVE_VOLUME = (1 << 8),
- PRIMITIVE_LAMP = (1 << 9),
-
- PRIMITIVE_ALL_TRIANGLE = (PRIMITIVE_TRIANGLE | PRIMITIVE_MOTION_TRIANGLE),
- PRIMITIVE_ALL_CURVE = (PRIMITIVE_CURVE_THICK | PRIMITIVE_MOTION_CURVE_THICK |
- PRIMITIVE_CURVE_RIBBON | PRIMITIVE_MOTION_CURVE_RIBBON),
- PRIMITIVE_ALL_POINT = (PRIMITIVE_POINT | PRIMITIVE_MOTION_POINT),
- PRIMITIVE_ALL_VOLUME = (PRIMITIVE_VOLUME),
- PRIMITIVE_ALL_MOTION = (PRIMITIVE_MOTION_TRIANGLE | PRIMITIVE_MOTION_CURVE_THICK |
- PRIMITIVE_MOTION_CURVE_RIBBON | PRIMITIVE_MOTION_POINT),
- PRIMITIVE_ALL = (PRIMITIVE_ALL_TRIANGLE | PRIMITIVE_ALL_CURVE | PRIMITIVE_ALL_VOLUME |
- PRIMITIVE_LAMP | PRIMITIVE_ALL_POINT),
-
- PRIMITIVE_NUM = 10,
+ PRIMITIVE_CURVE_THICK = (1 << 1),
+ PRIMITIVE_CURVE_RIBBON = (1 << 2),
+ PRIMITIVE_POINT = (1 << 3),
+ PRIMITIVE_VOLUME = (1 << 4),
+ PRIMITIVE_LAMP = (1 << 5),
+
+ PRIMITIVE_MOTION = (1 << 6),
+ PRIMITIVE_MOTION_TRIANGLE = (PRIMITIVE_TRIANGLE | PRIMITIVE_MOTION),
+ PRIMITIVE_MOTION_CURVE_THICK = (PRIMITIVE_CURVE_THICK | PRIMITIVE_MOTION),
+ PRIMITIVE_MOTION_CURVE_RIBBON = (PRIMITIVE_CURVE_RIBBON | PRIMITIVE_MOTION),
+ PRIMITIVE_MOTION_POINT = (PRIMITIVE_POINT | PRIMITIVE_MOTION),
+
+ PRIMITIVE_CURVE = (PRIMITIVE_CURVE_THICK | PRIMITIVE_CURVE_RIBBON),
+
+ PRIMITIVE_ALL = (PRIMITIVE_TRIANGLE | PRIMITIVE_CURVE | PRIMITIVE_POINT | PRIMITIVE_VOLUME |
+ PRIMITIVE_LAMP | PRIMITIVE_MOTION),
+
+ PRIMITIVE_NUM_SHAPES = 6,
+ PRIMITIVE_NUM_BITS = PRIMITIVE_NUM_SHAPES + 1, /* All shapes + motion bit. */
+ PRIMITIVE_NUM = PRIMITIVE_NUM_SHAPES * 2, /* With and without motion. */
} PrimitiveType;
-#define PRIMITIVE_PACK_SEGMENT(type, segment) ((segment << PRIMITIVE_NUM) | (type))
-#define PRIMITIVE_UNPACK_SEGMENT(type) (type >> PRIMITIVE_NUM)
+/* Convert type to index in range 0..PRIMITIVE_NUM-1. */
+#define PRIMITIVE_INDEX(type) (bitscan((uint32_t)(type)) * 2 + (((type)&PRIMITIVE_MOTION) ? 1 : 0))
+
+/* Pack segment into type value to save space. */
+#define PRIMITIVE_PACK_SEGMENT(type, segment) ((segment << PRIMITIVE_NUM_BITS) | (type))
+#define PRIMITIVE_UNPACK_SEGMENT(type) (type >> PRIMITIVE_NUM_BITS)
typedef enum CurveShapeType {
CURVE_RIBBON = 0,