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
path: root/intern
diff options
context:
space:
mode:
authorDalai Felinto <dfelinto@gmail.com>2014-05-27 17:56:59 +0400
committerDalai Felinto <dfelinto@gmail.com>2014-05-27 18:09:36 +0400
commit517094a6977abd2ca3f50f15780fc15fdb125b99 (patch)
treefbe26e865d1c45ea1974c392089b3f65dd2d067a /intern
parent12abe94de827d9ae9c0dd6cc49bc6c3e377842ad (diff)
Cycles: new camera_direction_from_point
Reviewers: brecht Differential Revision: https://developer.blender.org/D556
Diffstat (limited to 'intern')
-rw-r--r--intern/cycles/kernel/kernel_bake.h10
-rw-r--r--intern/cycles/kernel/kernel_camera.h14
2 files changed, 15 insertions, 9 deletions
diff --git a/intern/cycles/kernel/kernel_bake.h b/intern/cycles/kernel/kernel_bake.h
index 4aae0aada0c..c84398685c1 100644
--- a/intern/cycles/kernel/kernel_bake.h
+++ b/intern/cycles/kernel/kernel_bake.h
@@ -175,21 +175,13 @@ ccl_device void kernel_bake_evaluate(KernelGlobals *kg, ccl_global uint4 *input,
float time = TIME_INVALID;
int bounce = 0;
int transparent_bounce = 0;
- Transform cameratoworld = kernel_data.cam.cameratoworld;
/* light passes */
PathRadiance L;
shader_setup_from_sample(kg, &sd, P, Ng, I, shader, object, prim, u, v, t, time, bounce, transparent_bounce);
- if(kernel_data.cam.type == CAMERA_ORTHOGRAPHIC) {
- float3 camD = make_float3(cameratoworld.x.z, cameratoworld.y.z, cameratoworld.z.z);
- sd.I = -camD;
- }
- else {
- float3 camP = make_float3(cameratoworld.x.w, cameratoworld.y.w, cameratoworld.z.w);
- sd.I = normalize(camP - sd.P);
- }
+ sd.I = camera_direction_from_point(kg, sd.P);
/* update differentials */
sd.dP.dx = sd.dPdu * dudx + sd.dPdv * dvdx;
diff --git a/intern/cycles/kernel/kernel_camera.h b/intern/cycles/kernel/kernel_camera.h
index 7fc66a9fdee..6b03abe9708 100644
--- a/intern/cycles/kernel/kernel_camera.h
+++ b/intern/cycles/kernel/kernel_camera.h
@@ -262,6 +262,20 @@ ccl_device_inline float camera_distance(KernelGlobals *kg, float3 P)
return len(P - camP);
}
+ccl_device_inline float3 camera_direction_from_point(KernelGlobals *kg, float3 P)
+{
+ Transform cameratoworld = kernel_data.cam.cameratoworld;
+
+ if(kernel_data.cam.type == CAMERA_ORTHOGRAPHIC) {
+ float3 camD = make_float3(cameratoworld.x.z, cameratoworld.y.z, cameratoworld.z.z);
+ return -camD;
+ }
+ else {
+ float3 camP = make_float3(cameratoworld.x.w, cameratoworld.y.w, cameratoworld.z.w);
+ return normalize(camP - P);
+ }
+}
+
ccl_device_inline float3 camera_world_to_ndc(KernelGlobals *kg, ShaderData *sd, float3 P)
{
if(kernel_data.cam.type != CAMERA_PANORAMA) {