[Bf-blender-cvs] [93ab22f3088] soc-2019-npr: Cleanup: Fix warnings in lanpr_util.c.

YimingWu noreply at git.blender.org
Thu Aug 1 10:20:52 CEST 2019


Commit: 93ab22f308808cc5e07d84034ba73286ced80bba
Author: YimingWu
Date:   Thu Aug 1 16:20:24 2019 +0800
Branches: soc-2019-npr
https://developer.blender.org/rB93ab22f308808cc5e07d84034ba73286ced80bba

Cleanup: Fix warnings in lanpr_util.c.

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

M	source/blender/editors/include/ED_lanpr.h
M	source/blender/editors/lanpr/lanpr_cpu.c
M	source/blender/editors/lanpr/lanpr_util.c

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

diff --git a/source/blender/editors/include/ED_lanpr.h b/source/blender/editors/include/ED_lanpr.h
index ae4ed133ceb..24cd32578da 100644
--- a/source/blender/editors/include/ED_lanpr.h
+++ b/source/blender/editors/include/ED_lanpr.h
@@ -752,6 +752,7 @@ real tmat_dist_2dv(tnsVector2d l, tnsVector2d r);
 
 real tmat_length_3d(tnsVector3d l);
 real tmat_length_2d(tnsVector3d l);
+void tmat_normalize_2d(tnsVector2d result, tnsVector2d l);
 void tmat_normalize_3d(tnsVector3d result, tnsVector3d l);
 void tmat_normalize_3f(tnsVector3f result, tnsVector3f l);
 void tmat_normalize_self_3d(tnsVector3d result);
@@ -759,6 +760,7 @@ real tmat_dot_3d(tnsVector3d l, tnsVector3d r, int normalize);
 real tmat_dot_3df(tnsVector3d l, tnsVector3f r, int normalize);
 real tmat_dot_2d(tnsVector2d l, tnsVector2d r, int normalize);
 real tmat_vector_cross_3d(tnsVector3d result, tnsVector3d l, tnsVector3d r);
+void tmat_vector_cross_only_3d(tnsVector3d result, tnsVector3d l, tnsVector3d r);
 real tmat_angle_rad_3d(tnsVector3d from, tnsVector3d to, tnsVector3d PositiveReference);
 void tmat_apply_rotation_33d(tnsVector3d result, tnsMatrix44d mat, tnsVector3d v);
 void tmat_apply_rotation_43d(tnsVector3d result, tnsMatrix44d mat, tnsVector3d v);
diff --git a/source/blender/editors/lanpr/lanpr_cpu.c b/source/blender/editors/lanpr/lanpr_cpu.c
index 2e953310c71..13ba79d3364 100644
--- a/source/blender/editors/lanpr/lanpr_cpu.c
+++ b/source/blender/editors/lanpr/lanpr_cpu.c
@@ -1695,7 +1695,7 @@ static void lanpr_make_render_geometry_buffers_object(
       tMatVectorAccum3d(rt->gc, rt->v[2]->fbcoord);
       tMatVectorMultiSelf3d(rt->gc, 1.0f / 3.0f);
       tmat_apply_normal_transform_43df(rt->gn, Normal, f->no);
-      tmat_normalize_self_3d(rt->gn);
+      normalize_v3_d(rt->gn);
       lanpr_assign_render_line_with_triangle(rt);
       /*  m = tnsGetIndexedMaterial(rb->scene, f->material_id); */
       /*  if(m) m->Previewv_count += (f->triangle_count*3); */
diff --git a/source/blender/editors/lanpr/lanpr_util.c b/source/blender/editors/lanpr/lanpr_util.c
index 0266afcc30c..be126681670 100644
--- a/source/blender/editors/lanpr/lanpr_util.c
+++ b/source/blender/editors/lanpr/lanpr_util.c
@@ -578,14 +578,12 @@ void tmat_apply_transform_43d(tnsVector3d result, tnsMatrix44d mat, tnsVector3d
 }
 void tmat_apply_normal_transform_43d(tnsVector3d result, tnsMatrix44d mat, tnsVector3d v)
 {
-  real w;
   result[0] = mat[0] * v[0] + mat[4] * v[1] + mat[8] * v[2] + mat[12] * 1;
   result[1] = mat[1] * v[0] + mat[5] * v[1] + mat[9] * v[2] + mat[13] * 1;
   result[2] = mat[2] * v[0] + mat[6] * v[1] + mat[10] * v[2] + mat[14] * 1;
 }
 void tmat_apply_normal_transform_43df(tnsVector3d result, tnsMatrix44d mat, tnsVector3f v)
 {
-  real w;
   result[0] = mat[0] * v[0] + mat[4] * v[1] + mat[8] * v[2] + mat[12] * 1;
   result[1] = mat[1] * v[0] + mat[5] * v[1] + mat[9] * v[2] + mat[13] * 1;
   result[2] = mat[2] * v[0] + mat[6] * v[1] + mat[10] * v[2] + mat[14] * 1;
@@ -599,7 +597,6 @@ void tmat_apply_transform_44d(tnsVector4d result, tnsMatrix44d mat, tnsVector4d
 }
 void tmat_apply_transform_43dfND(tnsVector4d result, tnsMatrix44d mat, tnsVector3f v)
 {
-  real w;
   result[0] = mat[0] * v[0] + mat[4] * v[1] + mat[8] * v[2] + mat[12] * 1;
   result[1] = mat[1] * v[0] + mat[5] * v[1] + mat[9] * v[2] + mat[13] * 1;
   result[2] = mat[2] * v[0] + mat[6] * v[1] + mat[10] * v[2] + mat[14] * 1;
@@ -610,7 +607,7 @@ void tmat_apply_transform_43df(tnsVector4d result, tnsMatrix44d mat, tnsVector3f
   result[0] = mat[0] * v[0] + mat[4] * v[1] + mat[8] * v[2] + mat[12] * 1;
   result[1] = mat[1] * v[0] + mat[5] * v[1] + mat[9] * v[2] + mat[13] * 1;
   result[2] = mat[2] * v[0] + mat[6] * v[1] + mat[10] * v[2] + mat[14] * 1;
-  real w = mat[3] * v[0] + mat[7] * v[1] + mat[11] * v[2] + mat[15] * 1;
+  /* real w = mat[3] * v[0] + mat[7] * v[1] + mat[11] * v[2] + mat[15] * 1; */
   /*  result[0] /= w; */
   /*  result[1] /= w; */
   /*  result[2] /= w; */
@@ -643,59 +640,10 @@ void tmat_clear_translation_44d(tnsMatrix44d mat)
   mat[11] = 0;
 }
 
-void tmat_extract_xyz_euler_44d(tnsMatrix44d mat, real *x_result, real *y_result, real *z_result)
-{
-  real xRot, yRot, zRot;
-
-  if (mat[2] < 1) {
-    if (mat[2] > -1) {
-      yRot = asin(mat[2]);
-      xRot = atan2(-mat[6], mat[10]);
-      zRot = atan2(-mat[1], mat[0]);
-    }
-    else {
-      yRot = -M_PI / 2;
-      xRot = -atan2(-mat[4], mat[5]);
-      zRot = 0;
-    }
-  }
-  else {
-    yRot = M_PI / 2;
-    xRot = atan2(-mat[4], mat[5]);
-    zRot = 0;
-  }
-
-  (*x_result) = -xRot;
-  (*y_result) = -yRot;
-  (*z_result) = -zRot;
-}
-void tmat_extract_location_44d(tnsMatrix44d mat, real *x_result, real *y_result, real *z_result)
-{
-  *x_result = mat[12];
-  *y_result = mat[13];
-  *z_result = mat[14];
-}
-void tmat_extract_uniform_scale_44d(tnsMatrix44d mat, real *result)
-{
-  tnsVector3d v = {mat[0], mat[1], mat[2]};
-  *result = tmat_length_3d(v);
-}
-
 #define L(row, col) l[(col << 2) + row]
 #define R(row, col) r[(col << 2) + row]
 #define P(row, col) result[(col << 2) + row]
 
-void tmat_print_matrix_44d(tnsMatrix44d l)
-{
-  int i, j;
-  for (i = 0; i < 4; i++) {
-    for (j = 0; j < 4; j++) {
-      printf("%.5f ", L(i, j));
-    }
-    printf("\n");
-  }
-}
-
 void tmat_obmat_to_16d(float obmat[4][4], tnsMatrix44d out)
 {
   out[0] = obmat[0][0];
@@ -715,11 +663,6 @@ void tmat_obmat_to_16d(float obmat[4][4], tnsMatrix44d out)
   out[14] = obmat[3][2];
   out[15] = obmat[3][3];
 }
-
-void tmat_copy_matrix_44d(tnsMatrix44d from, tnsMatrix44d to)
-{
-  memcpy(to, from, sizeof(tnsMatrix44d));
-}
 void tmat_multiply_44d(tnsMatrix44d result, tnsMatrix44d l, tnsMatrix44d r)
 {
   int i;
@@ -741,7 +684,7 @@ void tmat_inverse_44d(tnsMatrix44d inverse, tnsMatrix44d mat)
 
   tmat_load_identity_44d(inverse);
 
-  tmat_copy_matrix_44d(mat, tempmat);
+  memcpy(tempmat, mat, sizeof(tnsMatrix44d));
 
   for (i = 0; i < 4; i++) {
     /* Look for row with max pivot */



More information about the Bf-blender-cvs mailing list