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:
authorBrecht Van Lommel <brechtvanlommel@gmail.com>2018-03-08 08:48:14 +0300
committerBrecht Van Lommel <brechtvanlommel@gmail.com>2018-03-10 06:54:05 +0300
commitb66efbecf4780c65833f72ac8de5d18b5bca7e15 (patch)
tree58f258df9e797f55ad1a77082115989df147e6db /intern/cycles/kernel/osl
parent623141f339d5066ed6b96ad70ab45fb294e3e612 (diff)
Code refactor: make Transform always affine, dropping last row.
This save a little memory and copying in the kernel by storing only a 4x3 matrix instead of a 4x4 matrix. We already did this in a few places, and those don't need to be special exceptions anymore now.
Diffstat (limited to 'intern/cycles/kernel/osl')
-rw-r--r--intern/cycles/kernel/osl/osl_services.cpp6
1 files changed, 2 insertions, 4 deletions
diff --git a/intern/cycles/kernel/osl/osl_services.cpp b/intern/cycles/kernel/osl/osl_services.cpp
index dec56c6665b..0c5e5e30e47 100644
--- a/intern/cycles/kernel/osl/osl_services.cpp
+++ b/intern/cycles/kernel/osl/osl_services.cpp
@@ -64,8 +64,7 @@ CCL_NAMESPACE_BEGIN
static void copy_matrix(OSL::Matrix44& m, const Transform& tfm)
{
- // TODO: remember when making affine
- Transform t = transform_transpose(tfm);
+ ProjectionTransform t = projection_transpose(ProjectionTransform(tfm));
memcpy(&m, &t, sizeof(m));
}
@@ -553,8 +552,7 @@ static bool set_attribute_float3_3(float3 P[3], TypeDesc type, bool derivatives,
static bool set_attribute_matrix(const Transform& tfm, TypeDesc type, void *val)
{
if(type == TypeDesc::TypeMatrix) {
- Transform transpose = transform_transpose(tfm);
- memcpy(val, &transpose, sizeof(Transform));
+ copy_matrix(*(OSL::Matrix44*)val, tfm);
return true;
}