[Bf-blender-cvs] [e073562] master: Cycles: Make transform from viewplane a generic utility function

Sergey Sharybin noreply at git.blender.org
Fri Apr 10 12:53:23 CEST 2015


Commit: e073562f80121ced07db38716e996c32b0c01a45
Author: Sergey Sharybin
Date:   Fri Apr 10 15:52:40 2015 +0500
Branches: master
https://developer.blender.org/rBe073562f80121ced07db38716e996c32b0c01a45

Cycles: Make transform from viewplane a generic utility function

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

M	intern/cycles/render/camera.cpp
M	intern/cycles/render/camera.h
M	intern/cycles/util/util_transform.cpp
M	intern/cycles/util/util_transform.h

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

diff --git a/intern/cycles/render/camera.cpp b/intern/cycles/render/camera.cpp
index 80101a8..9e3a17b 100644
--- a/intern/cycles/render/camera.cpp
+++ b/intern/cycles/render/camera.cpp
@@ -409,15 +409,4 @@ BoundBox Camera::viewplane_bounds_get()
 	return bounds;
 }
 
-Transform Camera::transform_from_viewplane(BoundBox2D &viewplane)
-{
-	return
-		transform_scale(1.0f / (viewplane.right - viewplane.left),
-		                1.0f / (viewplane.top - viewplane.bottom),
-		                1.0f) *
-		transform_translate(-viewplane.left,
-		                    -viewplane.bottom,
-		                    0.0f);
-}
-
 CCL_NAMESPACE_END
diff --git a/intern/cycles/render/camera.h b/intern/cycles/render/camera.h
index e1faee3..31240f6 100644
--- a/intern/cycles/render/camera.h
+++ b/intern/cycles/render/camera.h
@@ -125,7 +125,6 @@ public:
 
 	BoundBox viewplane_bounds_get();
 	float3 transform_raster_to_world(float raster_x, float raster_y);
-	Transform transform_from_viewplane(BoundBox2D &viewplane);
 };
 
 CCL_NAMESPACE_END
diff --git a/intern/cycles/util/util_transform.cpp b/intern/cycles/util/util_transform.cpp
index 0a1c09a..acaca69 100644
--- a/intern/cycles/util/util_transform.cpp
+++ b/intern/cycles/util/util_transform.cpp
@@ -46,9 +46,11 @@
  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-#include "util_math.h"
 #include "util_transform.h"
 
+#include "util_boundbox.h"
+#include "util_math.h"
+
 CCL_NAMESPACE_BEGIN
 
 /* Transform Inverse */
@@ -271,5 +273,15 @@ void transform_motion_decompose(DecompMotionTransform *decomp, const MotionTrans
 	decomp->post_y = post.y;
 }
 
-CCL_NAMESPACE_END
+Transform transform_from_viewplane(BoundBox2D& viewplane)
+{
+	return
+		transform_scale(1.0f / (viewplane.right - viewplane.left),
+		                1.0f / (viewplane.top - viewplane.bottom),
+		                1.0f) *
+		transform_translate(-viewplane.left,
+		                    -viewplane.bottom,
+		                    0.0f);
+}
 
+CCL_NAMESPACE_END
diff --git a/intern/cycles/util/util_transform.h b/intern/cycles/util/util_transform.h
index ac97fa5..1829ad2 100644
--- a/intern/cycles/util/util_transform.h
+++ b/intern/cycles/util/util_transform.h
@@ -449,6 +449,8 @@ ccl_device void transform_motion_interpolate(Transform *tfm, const DecompMotionT
 
 #ifndef __KERNEL_GPU__
 
+class BoundBox2D;
+
 ccl_device_inline bool operator==(const MotionTransform& A, const MotionTransform& B)
 {
 	return (A.pre == B.pre && A.post == B.post);
@@ -456,6 +458,7 @@ ccl_device_inline bool operator==(const MotionTransform& A, const MotionTransfor
 
 float4 transform_to_quat(const Transform& tfm);
 void transform_motion_decompose(DecompMotionTransform *decomp, const MotionTransform *motion, const Transform *mid);
+Transform transform_from_viewplane(BoundBox2D& viewplane);
 
 #endif




More information about the Bf-blender-cvs mailing list