diff options
author | Brecht Van Lommel <brechtvanlommel@pandora.be> | 2012-04-16 12:35:21 +0400 |
---|---|---|
committer | Brecht Van Lommel <brechtvanlommel@pandora.be> | 2012-04-16 12:35:21 +0400 |
commit | 93df58160e56f81bb588a7df6a3a3d3d77365ce5 (patch) | |
tree | f53e6d8a7d2c7270f2ae3d53bd2d5f8ec5872153 | |
parent | 9cf2e5baf64a927325efeba5ed20c20dfec3da57 (diff) |
Fix #30966: cycles nan mesh vertices got set to (0, 0, 0), now remove them instead.
-rw-r--r-- | intern/cycles/app/cycles_xml.cpp | 6 | ||||
-rw-r--r-- | intern/cycles/kernel/kernel_bvh.h | 6 | ||||
-rw-r--r-- | intern/cycles/kernel/kernel_camera.h | 16 | ||||
-rw-r--r-- | intern/cycles/kernel/kernel_mbvh.h | 2 | ||||
-rw-r--r-- | intern/cycles/kernel/kernel_object.h | 2 | ||||
-rw-r--r-- | intern/cycles/kernel/kernel_passes.h | 2 | ||||
-rw-r--r-- | intern/cycles/kernel/kernel_qbvh.h | 6 | ||||
-rw-r--r-- | intern/cycles/kernel/svm/svm_camera.h | 2 | ||||
-rw-r--r-- | intern/cycles/kernel/svm/svm_mapping.h | 2 | ||||
-rw-r--r-- | intern/cycles/kernel/svm/svm_tex_coord.h | 30 | ||||
-rw-r--r-- | intern/cycles/render/camera.cpp | 8 | ||||
-rw-r--r-- | intern/cycles/render/light.cpp | 6 | ||||
-rw-r--r-- | intern/cycles/render/object.cpp | 8 | ||||
-rw-r--r-- | intern/cycles/subd/subd_dice.cpp | 2 | ||||
-rw-r--r-- | intern/cycles/subd/subd_split.cpp | 2 | ||||
-rw-r--r-- | intern/cycles/util/util_boundbox.h | 6 | ||||
-rw-r--r-- | intern/cycles/util/util_transform.h | 10 |
17 files changed, 62 insertions, 54 deletions
diff --git a/intern/cycles/app/cycles_xml.cpp b/intern/cycles/app/cycles_xml.cpp index b93f61b98d5..b954ff45e27 100644 --- a/intern/cycles/app/cycles_xml.cpp +++ b/intern/cycles/app/cycles_xml.cpp @@ -724,7 +724,7 @@ static void xml_read_patch(const XMLReadState& state, pugi::xml_node node) LinearQuadPatch *bpatch = new LinearQuadPatch(); for(int i = 0; i < 4; i++) - P[i] = transform(&state.tfm, P[i]); + P[i] = transform_point(&state.tfm, P[i]); memcpy(bpatch->hull, &P[0], sizeof(bpatch->hull)); patch = bpatch; @@ -738,7 +738,7 @@ static void xml_read_patch(const XMLReadState& state, pugi::xml_node node) BicubicPatch *bpatch = new BicubicPatch(); for(int i = 0; i < 16; i++) - P[i] = transform(&state.tfm, P[i]); + P[i] = transform_point(&state.tfm, P[i]); memcpy(bpatch->hull, &P[0], sizeof(bpatch->hull)); patch = bpatch; @@ -777,7 +777,7 @@ static void xml_read_light(const XMLReadState& state, pugi::xml_node node) Light *light = new Light(); light->shader = state.shader; xml_read_float3(&light->co, node, "P"); - light->co = transform(&state.tfm, light->co); + light->co = transform_point(&state.tfm, light->co); state.scene->lights.push_back(light); } diff --git a/intern/cycles/kernel/kernel_bvh.h b/intern/cycles/kernel/kernel_bvh.h index 35215fd0f9f..523ae8ae926 100644 --- a/intern/cycles/kernel/kernel_bvh.h +++ b/intern/cycles/kernel/kernel_bvh.h @@ -59,7 +59,7 @@ __device_inline void bvh_instance_push(KernelGlobals *kg, int object, const Ray { Transform tfm = object_fetch_transform(kg, object, OBJECT_INVERSE_TRANSFORM); - *P = transform(&tfm, ray->P); + *P = transform_point(&tfm, ray->P); float3 dir = transform_direction(&tfm, ray->D); @@ -351,7 +351,7 @@ __device_inline float3 bvh_triangle_refine(KernelGlobals *kg, const Intersection if(isect->object != ~0) { Transform tfm = object_fetch_transform(kg, isect->object, OBJECT_INVERSE_TRANSFORM); - P = transform(&tfm, P); + P = transform_point(&tfm, P); D = transform_direction(&tfm, D*t); D = normalize_len(D, &t); } @@ -367,7 +367,7 @@ __device_inline float3 bvh_triangle_refine(KernelGlobals *kg, const Intersection if(isect->object != ~0) { Transform tfm = object_fetch_transform(kg, isect->object, OBJECT_TRANSFORM); - P = transform(&tfm, P); + P = transform_point(&tfm, P); } return P; diff --git a/intern/cycles/kernel/kernel_camera.h b/intern/cycles/kernel/kernel_camera.h index 0460765fe86..58c482212df 100644 --- a/intern/cycles/kernel/kernel_camera.h +++ b/intern/cycles/kernel/kernel_camera.h @@ -39,7 +39,7 @@ __device void camera_sample_perspective(KernelGlobals *kg, float raster_x, float { /* create ray form raster position */ Transform rastertocamera = kernel_data.cam.rastertocamera; - float3 Pcamera = transform(&rastertocamera, make_float3(raster_x, raster_y, 0.0f)); + float3 Pcamera = transform_perspective(&rastertocamera, make_float3(raster_x, raster_y, 0.0f)); ray->P = make_float3(0.0f, 0.0f, 0.0f); ray->D = Pcamera; @@ -63,7 +63,7 @@ __device void camera_sample_perspective(KernelGlobals *kg, float raster_x, float /* transform ray from camera to world */ Transform cameratoworld = kernel_data.cam.cameratoworld; - ray->P = transform(&cameratoworld, ray->P); + ray->P = transform_point(&cameratoworld, ray->P); ray->D = transform_direction(&cameratoworld, ray->D); ray->D = normalize(ray->D); @@ -93,7 +93,7 @@ __device void camera_sample_orthographic(KernelGlobals *kg, float raster_x, floa { /* create ray form raster position */ Transform rastertocamera = kernel_data.cam.rastertocamera; - float3 Pcamera = transform(&rastertocamera, make_float3(raster_x, raster_y, 0.0f)); + float3 Pcamera = transform_perspective(&rastertocamera, make_float3(raster_x, raster_y, 0.0f)); ray->P = Pcamera; ray->D = make_float3(0.0f, 0.0f, 1.0f); @@ -101,7 +101,7 @@ __device void camera_sample_orthographic(KernelGlobals *kg, float raster_x, floa /* transform ray from camera to world */ Transform cameratoworld = kernel_data.cam.cameratoworld; - ray->P = transform(&cameratoworld, ray->P); + ray->P = transform_point(&cameratoworld, ray->P); ray->D = transform_direction(&cameratoworld, ray->D); ray->D = normalize(ray->D); @@ -127,7 +127,7 @@ __device void camera_sample_orthographic(KernelGlobals *kg, float raster_x, floa __device void camera_sample_environment(KernelGlobals *kg, float raster_x, float raster_y, Ray *ray) { Transform rastertocamera = kernel_data.cam.rastertocamera; - float3 Pcamera = transform(&rastertocamera, make_float3(raster_x, raster_y, 0.0f)); + float3 Pcamera = transform_perspective(&rastertocamera, make_float3(raster_x, raster_y, 0.0f)); /* create ray form raster position */ ray->P = make_float3(0.0, 0.0f, 0.0f); @@ -136,7 +136,7 @@ __device void camera_sample_environment(KernelGlobals *kg, float raster_x, float /* transform ray from camera to world */ Transform cameratoworld = kernel_data.cam.cameratoworld; - ray->P = transform(&cameratoworld, ray->P); + ray->P = transform_point(&cameratoworld, ray->P); ray->D = transform_direction(&cameratoworld, ray->D); ray->D = normalize(ray->D); @@ -145,10 +145,10 @@ __device void camera_sample_environment(KernelGlobals *kg, float raster_x, float ray->dP.dx = make_float3(0.0f, 0.0f, 0.0f); ray->dP.dy = make_float3(0.0f, 0.0f, 0.0f); - Pcamera = transform(&rastertocamera, make_float3(raster_x + 1.0f, raster_y, 0.0f)); + Pcamera = transform_perspective(&rastertocamera, make_float3(raster_x + 1.0f, raster_y, 0.0f)); ray->dD.dx = normalize(transform_direction(&cameratoworld, equirectangular_to_direction(Pcamera.x, Pcamera.y))) - ray->D; - Pcamera = transform(&rastertocamera, make_float3(raster_x, raster_y + 1.0f, 0.0f)); + Pcamera = transform_perspective(&rastertocamera, make_float3(raster_x, raster_y + 1.0f, 0.0f)); ray->dD.dy = normalize(transform_direction(&cameratoworld, equirectangular_to_direction(Pcamera.x, Pcamera.y))) - ray->D; #endif diff --git a/intern/cycles/kernel/kernel_mbvh.h b/intern/cycles/kernel/kernel_mbvh.h index 3995e782abd..ccbd3d069b4 100644 --- a/intern/cycles/kernel/kernel_mbvh.h +++ b/intern/cycles/kernel/kernel_mbvh.h @@ -61,7 +61,7 @@ __device void mbvh_instance_push(KernelGlobals *kg, int object, MBVHRay *ray) { Transform tfm = object_fetch_transform(kg, object, OBJECT_INVERSE_TRANSFORM); - ray->P = transform(&tfm, ray->origP); + ray->P = transform_point(&tfm, ray->origP); float3 dir = ray->origD; diff --git a/intern/cycles/kernel/kernel_object.h b/intern/cycles/kernel/kernel_object.h index 318a6fea489..b676f58e5d4 100644 --- a/intern/cycles/kernel/kernel_object.h +++ b/intern/cycles/kernel/kernel_object.h @@ -42,7 +42,7 @@ __device_inline Transform object_fetch_transform(KernelGlobals *kg, int object, __device_inline void object_position_transform(KernelGlobals *kg, int object, float3 *P) { Transform tfm = object_fetch_transform(kg, object, OBJECT_TRANSFORM); - *P = transform(&tfm, *P); + *P = transform_point(&tfm, *P); } __device_inline void object_normal_transform(KernelGlobals *kg, int object, float3 *N) diff --git a/intern/cycles/kernel/kernel_passes.h b/intern/cycles/kernel/kernel_passes.h index d195af293b7..fd4ee17cdc1 100644 --- a/intern/cycles/kernel/kernel_passes.h +++ b/intern/cycles/kernel/kernel_passes.h @@ -53,7 +53,7 @@ __device_inline void kernel_write_data_passes(KernelGlobals *kg, __global float if(sample == 0) { if(flag & PASS_DEPTH) { Transform tfm = kernel_data.cam.worldtocamera; - float depth = len(transform(&tfm, sd->P)); + float depth = len(transform_point(&tfm, sd->P)); kernel_write_pass_float(buffer + kernel_data.film.pass_depth, sample, depth); } diff --git a/intern/cycles/kernel/kernel_qbvh.h b/intern/cycles/kernel/kernel_qbvh.h index 96e68d797dd..525b616921d 100644 --- a/intern/cycles/kernel/kernel_qbvh.h +++ b/intern/cycles/kernel/kernel_qbvh.h @@ -50,7 +50,7 @@ __device_inline void qbvh_instance_push(KernelGlobals *kg, int object, const Ray { Transform tfm = object_fetch_transform(kg, object, OBJECT_INVERSE_TRANSFORM); - *P = transform(&tfm, ray->P); + *P = transform_point(&tfm, ray->P); float3 dir = transform_direction(&tfm, ray->D); @@ -384,7 +384,7 @@ __device_inline float3 bvh_triangle_refine(KernelGlobals *kg, const Intersection if(isect->object != ~0) { Transform tfm = object_fetch_transform(kg, isect->object, OBJECT_INVERSE_TRANSFORM); - P = transform(&tfm, P); + P = transform_point(&tfm, P); D = transform_direction(&tfm, D*t); D = normalize_len(D, &t); } @@ -400,7 +400,7 @@ __device_inline float3 bvh_triangle_refine(KernelGlobals *kg, const Intersection if(isect->object != ~0) { Transform tfm = object_fetch_transform(kg, isect->object, OBJECT_TRANSFORM); - P = transform(&tfm, P); + P = transform_point(&tfm, P); } return P; diff --git a/intern/cycles/kernel/svm/svm_camera.h b/intern/cycles/kernel/svm/svm_camera.h index cf161ddcd8c..f13cefb7764 100644 --- a/intern/cycles/kernel/svm/svm_camera.h +++ b/intern/cycles/kernel/svm/svm_camera.h @@ -25,7 +25,7 @@ __device void svm_node_camera(KernelGlobals *kg, ShaderData *sd, float *stack, u float3 vector; Transform tfm = kernel_data.cam.worldtocamera; - vector = transform(&tfm, sd->P); + vector = transform_point(&tfm, sd->P); zdepth = vector.z; distance = len(vector); diff --git a/intern/cycles/kernel/svm/svm_mapping.h b/intern/cycles/kernel/svm/svm_mapping.h index 7633c3e783b..6dc74aece08 100644 --- a/intern/cycles/kernel/svm/svm_mapping.h +++ b/intern/cycles/kernel/svm/svm_mapping.h @@ -30,7 +30,7 @@ __device void svm_node_mapping(KernelGlobals *kg, ShaderData *sd, float *stack, tfm.z = read_node_float(kg, offset); tfm.w = read_node_float(kg, offset); - float3 r = transform(&tfm, v); + float3 r = transform_point(&tfm, v); stack_store_float3(stack, out_offset, r); } diff --git a/intern/cycles/kernel/svm/svm_tex_coord.h b/intern/cycles/kernel/svm/svm_tex_coord.h index bcf3716ae57..f494b6d66e1 100644 --- a/intern/cycles/kernel/svm/svm_tex_coord.h +++ b/intern/cycles/kernel/svm/svm_tex_coord.h @@ -34,7 +34,7 @@ __device void svm_node_tex_coord(KernelGlobals *kg, ShaderData *sd, float *stack case NODE_TEXCO_OBJECT: { if(sd->object != ~0) { Transform tfm = object_fetch_transform(kg, sd->object, OBJECT_INVERSE_TRANSFORM); - data = transform(&tfm, sd->P); + data = transform_point(&tfm, sd->P); } else data = sd->P; @@ -44,18 +44,18 @@ __device void svm_node_tex_coord(KernelGlobals *kg, ShaderData *sd, float *stack Transform tfm = kernel_data.cam.worldtocamera; if(sd->object != ~0) - data = transform(&tfm, sd->P); + data = transform_point(&tfm, sd->P); else - data = transform(&tfm, sd->P + svm_background_offset(kg)); + data = transform_point(&tfm, sd->P + svm_background_offset(kg)); break; } case NODE_TEXCO_WINDOW: { Transform tfm = kernel_data.cam.worldtondc; if(sd->object != ~0) - data = transform(&tfm, sd->P); + data = transform_perspective(&tfm, sd->P); else - data = transform(&tfm, sd->P + svm_background_offset(kg)); + data = transform_perspective(&tfm, sd->P + svm_background_offset(kg)); break; } case NODE_TEXCO_REFLECTION: { @@ -79,7 +79,7 @@ __device void svm_node_tex_coord_bump_dx(KernelGlobals *kg, ShaderData *sd, floa case NODE_TEXCO_OBJECT: { if(sd->object != ~0) { Transform tfm = object_fetch_transform(kg, sd->object, OBJECT_INVERSE_TRANSFORM); - data = transform(&tfm, sd->P + sd->dP.dx); + data = transform_point(&tfm, sd->P + sd->dP.dx); } else data = sd->P + sd->dP.dx; @@ -89,18 +89,18 @@ __device void svm_node_tex_coord_bump_dx(KernelGlobals *kg, ShaderData *sd, floa Transform tfm = kernel_data.cam.worldtocamera; if(sd->object != ~0) - data = transform(&tfm, sd->P + sd->dP.dx); + data = transform_point(&tfm, sd->P + sd->dP.dx); else - data = transform(&tfm, sd->P + sd->dP.dx + svm_background_offset(kg)); + data = transform_point(&tfm, sd->P + sd->dP.dx + svm_background_offset(kg)); break; } case NODE_TEXCO_WINDOW: { Transform tfm = kernel_data.cam.worldtondc; if(sd->object != ~0) - data = transform(&tfm, sd->P + sd->dP.dx); + data = transform_perspective(&tfm, sd->P + sd->dP.dx); else - data = transform(&tfm, sd->P + sd->dP.dx + svm_background_offset(kg)); + data = transform_perspective(&tfm, sd->P + sd->dP.dx + svm_background_offset(kg)); break; } case NODE_TEXCO_REFLECTION: { @@ -127,7 +127,7 @@ __device void svm_node_tex_coord_bump_dy(KernelGlobals *kg, ShaderData *sd, floa case NODE_TEXCO_OBJECT: { if(sd->object != ~0) { Transform tfm = object_fetch_transform(kg, sd->object, OBJECT_INVERSE_TRANSFORM); - data = transform(&tfm, sd->P + sd->dP.dy); + data = transform_point(&tfm, sd->P + sd->dP.dy); } else data = sd->P + sd->dP.dy; @@ -137,18 +137,18 @@ __device void svm_node_tex_coord_bump_dy(KernelGlobals *kg, ShaderData *sd, floa Transform tfm = kernel_data.cam.worldtocamera; if(sd->object != ~0) - data = transform(&tfm, sd->P + sd->dP.dy); + data = transform_point(&tfm, sd->P + sd->dP.dy); else - data = transform(&tfm, sd->P + sd->dP.dy + svm_background_offset(kg)); + data = transform_point(&tfm, sd->P + sd->dP.dy + svm_background_offset(kg)); break; } case NODE_TEXCO_WINDOW: { Transform tfm = kernel_data.cam.worldtondc; if(sd->object != ~0) - data = transform(&tfm, sd->P + sd->dP.dy); + data = transform_perspective(&tfm, sd->P + sd->dP.dy); else - data = transform(&tfm, sd->P + sd->dP.dy + svm_background_offset(kg)); + data = transform_perspective(&tfm, sd->P + sd->dP.dy + svm_background_offset(kg)); break; } case NODE_TEXCO_REFLECTION: { diff --git a/intern/cycles/render/camera.cpp b/intern/cycles/render/camera.cpp index 6edf9c66f1d..f9290dfc835 100644 --- a/intern/cycles/render/camera.cpp +++ b/intern/cycles/render/camera.cpp @@ -107,10 +107,10 @@ void Camera::update() dy = transform_direction(&rastertocamera, make_float3(0, 1, 0)); } else if(type == CAMERA_PERSPECTIVE) { - dx = transform(&rastertocamera, make_float3(1, 0, 0)) - - transform(&rastertocamera, make_float3(0, 0, 0)); - dy = transform(&rastertocamera, make_float3(0, 1, 0)) - - transform(&rastertocamera, make_float3(0, 0, 0)); + dx = transform_perspective(&rastertocamera, make_float3(1, 0, 0)) - + transform_perspective(&rastertocamera, make_float3(0, 0, 0)); + dy = transform_perspective(&rastertocamera, make_float3(0, 1, 0)) - + transform_perspective(&rastertocamera, make_float3(0, 0, 0)); } else { dx = make_float3(0, 0, 0); diff --git a/intern/cycles/render/light.cpp b/intern/cycles/render/light.cpp index bd3acb00f6d..316e5cec9aa 100644 --- a/intern/cycles/render/light.cpp +++ b/intern/cycles/render/light.cpp @@ -213,9 +213,9 @@ void LightManager::device_update_distribution(Device *device, DeviceScene *dscen offset++; Mesh::Triangle t = mesh->triangles[i]; - float3 p1 = transform(&tfm, mesh->verts[t.v[0]]); - float3 p2 = transform(&tfm, mesh->verts[t.v[1]]); - float3 p3 = transform(&tfm, mesh->verts[t.v[2]]); + float3 p1 = transform_point(&tfm, mesh->verts[t.v[0]]); + float3 p2 = transform_point(&tfm, mesh->verts[t.v[1]]); + float3 p3 = transform_point(&tfm, mesh->verts[t.v[2]]); totarea += triangle_area(p1, p2, p3); } diff --git a/intern/cycles/render/object.cpp b/intern/cycles/render/object.cpp index f83c85c632d..5f7a5810c09 100644 --- a/intern/cycles/render/object.cpp +++ b/intern/cycles/render/object.cpp @@ -54,7 +54,7 @@ void Object::apply_transform() return; for(size_t i = 0; i < mesh->verts.size(); i++) - mesh->verts[i] = transform(&tfm, mesh->verts[i]); + mesh->verts[i] = transform_point(&tfm, mesh->verts[i]); Attribute *attr_fN = mesh->attributes.find(Attribute::STD_FACE_NORMAL); Attribute *attr_vN = mesh->attributes.find(Attribute::STD_VERTEX_NORMAL); @@ -159,9 +159,9 @@ void ObjectManager::device_update_transforms(Device *device, DeviceScene *dscene } else { foreach(Mesh::Triangle& t, mesh->triangles) { - float3 p1 = transform(&tfm, mesh->verts[t.v[0]]); - float3 p2 = transform(&tfm, mesh->verts[t.v[1]]); - float3 p3 = transform(&tfm, mesh->verts[t.v[2]]); + float3 p1 = transform_point(&tfm, mesh->verts[t.v[0]]); + float3 p2 = transform_point(&tfm, mesh->verts[t.v[1]]); + float3 p3 = transform_point(&tfm, mesh->verts[t.v[2]]); surface_area += triangle_area(p1, p2, p3); } diff --git a/intern/cycles/subd/subd_dice.cpp b/intern/cycles/subd/subd_dice.cpp index 086b7b246d3..6b29d1ca51a 100644 --- a/intern/cycles/subd/subd_dice.cpp +++ b/intern/cycles/subd/subd_dice.cpp @@ -141,7 +141,7 @@ float3 QuadDice::eval_projected(SubPatch& sub, float u, float v) sub.patch->eval(&P, NULL, NULL, uv.x, uv.y); if(camera) - P = transform(&camera->worldtoraster, P); + P = transform_perspective(&camera->worldtoraster, P); return P; } diff --git a/intern/cycles/subd/subd_split.cpp b/intern/cycles/subd/subd_split.cpp index d61a42e4dcf..f0b87200f08 100644 --- a/intern/cycles/subd/subd_split.cpp +++ b/intern/cycles/subd/subd_split.cpp @@ -57,7 +57,7 @@ float3 DiagSplit::project(Patch *patch, float2 uv) patch->eval(&P, NULL, NULL, uv.x, uv.y); if(camera) - P = transform(&camera->worldtoraster, P); + P = transform_perspective(&camera->worldtoraster, P); return P; } diff --git a/intern/cycles/util/util_boundbox.h b/intern/cycles/util/util_boundbox.h index 0114a9a26a5..bb1df0b220f 100644 --- a/intern/cycles/util/util_boundbox.h +++ b/intern/cycles/util/util_boundbox.h @@ -76,8 +76,8 @@ public: bool valid(void) const { return (min.x <= max.x) && (min.y <= max.y) && (min.z <= max.z) && - !(isnan(min.x) || isnan(min.y) || isnan(min.z)) && - !(isnan(max.x) || isnan(max.y) || isnan(max.z)); + (isfinite(min.x) && isfinite(min.y) && isfinite(min.z)) && + (isfinite(max.x) && isfinite(max.y) && isfinite(max.z)); } BoundBox transformed(const Transform *tfm) @@ -91,7 +91,7 @@ public: p.y = (i & 2)? min.y: max.y; p.z = (i & 4)? min.z: max.z; - result.grow(transform(tfm, p)); + result.grow(transform_point(tfm, p)); } return result; diff --git a/intern/cycles/util/util_transform.h b/intern/cycles/util/util_transform.h index 07db52f6392..aeaef7b0e21 100644 --- a/intern/cycles/util/util_transform.h +++ b/intern/cycles/util/util_transform.h @@ -37,7 +37,7 @@ typedef struct Transform { #endif } Transform; -__device_inline float3 transform(const Transform *t, const float3 a) +__device_inline float3 transform_perspective(const Transform *t, const float3 a) { float4 b = make_float4(a.x, a.y, a.z, 1.0f); float3 c = make_float3(dot(t->x, b), dot(t->y, b), dot(t->z, b)); @@ -46,6 +46,14 @@ __device_inline float3 transform(const Transform *t, const float3 a) return (w != 0.0f)? c/w: make_float3(0.0f, 0.0f, 0.0f); } +__device_inline float3 transform_point(const Transform *t, const float3 a) +{ + float4 b = make_float4(a.x, a.y, a.z, 1.0f); + float3 c = make_float3(dot(t->x, b), dot(t->y, b), dot(t->z, b)); + + return c; +} + __device_inline float3 transform_direction(const Transform *t, const float3 a) { float4 b = make_float4(a.x, a.y, a.z, 0.0f); |