[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [59408] trunk/blender/source/blender: set function args in BLI_math_rotation as const where possible.
Campbell Barton
ideasman42 at gmail.com
Fri Aug 23 11:46:11 CEST 2013
Revision: 59408
http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=59408
Author: campbellbarton
Date: 2013-08-23 09:46:11 +0000 (Fri, 23 Aug 2013)
Log Message:
-----------
set function args in BLI_math_rotation as const where possible.
Modified Paths:
--------------
trunk/blender/source/blender/blenlib/BLI_math_rotation.h
trunk/blender/source/blender/blenlib/intern/math_rotation.c
trunk/blender/source/blender/makesrna/intern/rna_lamp.c
Modified: trunk/blender/source/blender/blenlib/BLI_math_rotation.h
===================================================================
--- trunk/blender/source/blender/blenlib/BLI_math_rotation.h 2013-08-23 09:44:24 UTC (rev 59407)
+++ trunk/blender/source/blender/blenlib/BLI_math_rotation.h 2013-08-23 09:46:11 UTC (rev 59408)
@@ -66,7 +66,7 @@
float normalize_qt_qt(float q1[4], const float q2[4]);
/* comparison */
-int is_zero_qt(float q[4]);
+bool is_zero_qt(const float q[4]);
/* interpolation */
void interp_qt_qtqt(float q[4], const float a[4], const float b[4], const float t);
@@ -163,13 +163,13 @@
float scale_weight;
} DualQuat;
-void copy_dq_dq(DualQuat *r, DualQuat *dq);
+void copy_dq_dq(DualQuat *r, const DualQuat *dq);
void normalize_dq(DualQuat *dq, float totw);
-void add_weighted_dq_dq(DualQuat *r, DualQuat *dq, float weight);
+void add_weighted_dq_dq(DualQuat *r, const DualQuat *dq, float weight);
void mul_v3m3_dq(float r[3], float R[3][3], DualQuat *dq);
void mat4_to_dquat(DualQuat *r, float base[4][4], float M[4][4]);
-void dquat_to_mat4(float R[4][4], DualQuat *dq);
+void dquat_to_mat4(float R[4][4], const DualQuat *dq);
void quat_apply_track(float quat[4], short axis, short upflag);
void vec_apply_track(float vec[3], short axis);
Modified: trunk/blender/source/blender/blenlib/intern/math_rotation.c
===================================================================
--- trunk/blender/source/blender/blenlib/intern/math_rotation.c 2013-08-23 09:44:24 UTC (rev 59407)
+++ trunk/blender/source/blender/blenlib/intern/math_rotation.c 2013-08-23 09:46:11 UTC (rev 59408)
@@ -62,7 +62,7 @@
q1[3] = q2[3];
}
-int is_zero_qt(float *q)
+bool is_zero_qt(const float q[4])
{
return (q[0] == 0 && q[1] == 0 && q[2] == 0 && q[3] == 0);
}
@@ -993,7 +993,7 @@
}
/* XYZ order */
-void eul_to_quat(float *quat, const float eul[3])
+void eul_to_quat(float quat[4], const float eul[3])
{
float ti, tj, th, ci, cj, ch, si, sj, sh, cc, cs, sc, ss;
@@ -1018,7 +1018,7 @@
}
/* XYZ order */
-void rotate_eul(float *beul, const char axis, const float ang)
+void rotate_eul(float beul[3], const char axis, const float ang)
{
float eul[3], mat1[3][3], mat2[3][3], totmat[3][3];
@@ -1229,7 +1229,7 @@
}
/* returns two euler calculation methods, so we can pick the best */
-static void mat3_to_eulo2(float M[3][3], float *e1, float *e2, const short order)
+static void mat3_to_eulo2(float M[3][3], float e1[3], float e2[3], const short order)
{
const RotOrderInfo *R = GET_ROTATIONORDER_INFO(order);
short i = R->axis[0], j = R->axis[1], k = R->axis[2];
@@ -1478,9 +1478,10 @@
dq->trans[3] = 0.5f * ( t[0] * q[2] - t[1] * q[1] + t[2] * q[0]);
}
-void dquat_to_mat4(float mat[4][4], DualQuat *dq)
+void dquat_to_mat4(float mat[4][4], const DualQuat *dq)
{
- float len, *t, q0[4];
+ float len, q0[4];
+ const float *t;
/* regular quaternion */
copy_qt_qt(q0, dq->quat);
@@ -1502,7 +1503,7 @@
/* note: this does not handle scaling */
}
-void add_weighted_dq_dq(DualQuat *dqsum, DualQuat *dq, float weight)
+void add_weighted_dq_dq(DualQuat *dqsum, const DualQuat *dq, float weight)
{
int flipped = 0;
@@ -1530,7 +1531,7 @@
if (flipped) /* we don't want negative weights for scaling */
weight = -weight;
- copy_m4_m4(wmat, dq->scale);
+ copy_m4_m4(wmat, (float(*)[4])dq->scale);
mul_m4_fl(wmat, weight);
add_m4_m4m4(dqsum->scale, dqsum->scale, wmat);
dqsum->scale_weight += weight;
@@ -1609,7 +1610,7 @@
}
}
-void copy_dq_dq(DualQuat *dq1, DualQuat *dq2)
+void copy_dq_dq(DualQuat *dq1, const DualQuat *dq2)
{
memcpy(dq1, dq2, sizeof(DualQuat));
}
Modified: trunk/blender/source/blender/makesrna/intern/rna_lamp.c
===================================================================
--- trunk/blender/source/blender/makesrna/intern/rna_lamp.c 2013-08-23 09:44:24 UTC (rev 59407)
+++ trunk/blender/source/blender/makesrna/intern/rna_lamp.c 2013-08-23 09:46:11 UTC (rev 59408)
@@ -26,6 +26,7 @@
#include <stdlib.h>
+#include "BLI_sys_types.h"
#include "BLI_math_base.h"
#include "BLI_math_rotation.h"
More information about the Bf-blender-cvs
mailing list