Changeset View
Changeset View
Standalone View
Standalone View
intern/cycles/kernel/geom/primitive.h
| Show First 20 Lines • Show All 278 Lines • ▼ Show 20 Lines | #endif | ||||
| /* deformation motion */ | /* deformation motion */ | ||||
| AttributeDescriptor desc = find_attribute(kg, sd, ATTR_STD_MOTION_VERTEX_POSITION); | AttributeDescriptor desc = find_attribute(kg, sd, ATTR_STD_MOTION_VERTEX_POSITION); | ||||
| if (desc.offset != ATTR_STD_NOT_FOUND) { | if (desc.offset != ATTR_STD_NOT_FOUND) { | ||||
| /* get motion info */ | /* get motion info */ | ||||
| int numverts, numkeys; | int numverts, numkeys; | ||||
| object_motion_info(kg, sd->object, NULL, &numverts, &numkeys); | object_motion_info(kg, sd->object, NULL, &numverts, &numkeys); | ||||
| /* lookup attributes */ | |||||
| motion_pre = primitive_surface_attribute_float3(kg, sd, desc, NULL, NULL); | |||||
| desc.offset += (sd->type & PRIMITIVE_ALL_TRIANGLE) ? numverts : numkeys; | |||||
| motion_post = primitive_surface_attribute_float3(kg, sd, desc, NULL, NULL); | |||||
| #ifdef __HAIR__ | #ifdef __HAIR__ | ||||
| if (is_curve_primitive && (sd->object_flag & SD_OBJECT_HAS_VERTEX_MOTION) == 0) { | if (is_curve_primitive) { | ||||
| motion_pre = float4_to_float3(curve_attribute_float4(kg, sd, desc, NULL, NULL)); | |||||
| desc.offset += numkeys; | |||||
| motion_post = float4_to_float3(curve_attribute_float4(kg, sd, desc, NULL, NULL)); | |||||
| /* Curve */ | |||||
| if ((sd->object_flag & SD_OBJECT_HAS_VERTEX_MOTION) == 0) { | |||||
| object_position_transform(kg, sd, &motion_pre); | object_position_transform(kg, sd, &motion_pre); | ||||
| object_position_transform(kg, sd, &motion_post); | object_position_transform(kg, sd, &motion_post); | ||||
| } | } | ||||
| } | |||||
| else | |||||
| #endif | #endif | ||||
| if (sd->type & PRIMITIVE_ALL_TRIANGLE) { | |||||
| /* Triangle */ | |||||
| if (subd_triangle_patch(kg, sd) == ~0) { | |||||
| motion_pre = triangle_attribute_float3(kg, sd, desc, NULL, NULL); | |||||
| desc.offset += numverts; | |||||
| motion_post = triangle_attribute_float3(kg, sd, desc, NULL, NULL); | |||||
| } | |||||
| else { | |||||
| motion_pre = subd_triangle_attribute_float3(kg, sd, desc, NULL, NULL); | |||||
| desc.offset += numverts; | |||||
| motion_post = subd_triangle_attribute_float3(kg, sd, desc, NULL, NULL); | |||||
| } | |||||
| } | |||||
| } | } | ||||
| /* object motion. note that depending on the mesh having motion vectors, this | /* object motion. note that depending on the mesh having motion vectors, this | ||||
| * transformation was set match the world/object space of motion_pre/post */ | * transformation was set match the world/object space of motion_pre/post */ | ||||
| Transform tfm; | Transform tfm; | ||||
| tfm = object_fetch_motion_pass_transform(kg, sd->object, OBJECT_PASS_MOTION_PRE); | tfm = object_fetch_motion_pass_transform(kg, sd->object, OBJECT_PASS_MOTION_PRE); | ||||
| motion_pre = transform_point(&tfm, motion_pre); | motion_pre = transform_point(&tfm, motion_pre); | ||||
| ▲ Show 20 Lines • Show All 45 Lines • Show Last 20 Lines | |||||