[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [37790] branches/soc-2011-onion/source/ blender: Minor edits.
Jason Wilkins
Jason.A.Wilkins at gmail.com
Fri Jun 24 14:54:53 CEST 2011
Revision: 37790
http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=37790
Author: jwilkins
Date: 2011-06-24 12:54:52 +0000 (Fri, 24 Jun 2011)
Log Message:
-----------
Minor edits. Some 'const' correctness and some implicit dependencies on other files pre-declaring struct names.
Committing some minor edits that I had to made to unrelated files while refactoring sculpt. I'd go ahead and add 'const' to all the math routines if I wasn't worried it would turn into a big job. As it is I just did the ones I use. Same with adding 'struct' to places where things will break in the future if the you rearrange header files slightly.
Modified Paths:
--------------
branches/soc-2011-onion/source/blender/blenlib/BLI_math_matrix.h
branches/soc-2011-onion/source/blender/blenlib/BLI_pbvh.h
branches/soc-2011-onion/source/blender/blenlib/intern/math_matrix.c
branches/soc-2011-onion/source/blender/blenlib/intern/pbvh.c
branches/soc-2011-onion/source/blender/editors/include/ED_sculpt.h
branches/soc-2011-onion/source/blender/editors/include/ED_view3d.h
branches/soc-2011-onion/source/blender/editors/space_view3d/view3d_select.c
branches/soc-2011-onion/source/blender/editors/space_view3d/view3d_view.c
Modified: branches/soc-2011-onion/source/blender/blenlib/BLI_math_matrix.h
===================================================================
--- branches/soc-2011-onion/source/blender/blenlib/BLI_math_matrix.h 2011-06-24 10:56:08 UTC (rev 37789)
+++ branches/soc-2011-onion/source/blender/blenlib/BLI_math_matrix.h 2011-06-24 12:54:52 UTC (rev 37790)
@@ -54,7 +54,7 @@
void unit_m4(float R[4][4]);
void copy_m3_m3(float R[3][3], float A[3][3]);
-void copy_m4_m4(float R[4][4], float A[4][4]);
+void copy_m4_m4(float R[4][4], const float A[4][4]);
void copy_m3_m4(float R[3][3], float A[4][4]);
void copy_m4_m3(float R[4][4], float A[3][3]);
@@ -67,7 +67,7 @@
void add_m4_m4m4(float R[4][4], float A[4][4], float B[4][4]);
void mul_m3_m3m3(float R[3][3], float A[3][3], float B[3][3]);
-void mul_m4_m4m4(float R[4][4], float A[4][4], float B[4][4]);
+void mul_m4_m4m4(float R[4][4], const float A[4][4], const float B[4][4]);
void mul_m4_m3m4(float R[4][4], float A[3][3], float B[4][4]);
void mul_m4_m4m3(float R[4][4], float A[4][4], float B[3][3]);
void mul_m3_m3m4(float R[3][3], float A[3][3], float B[4][4]);
@@ -80,10 +80,10 @@
float M5[4][4], float M6[4][4], float M7[4][4], float M8[4][4]);
void mul_m4_v3(float M[4][4], float r[3]);
-void mul_v3_m4v3(float r[3], float M[4][4], float v[3]);
+void mul_v3_m4v3(float r[3], const float M[4][4], const float v[3]);
void mul_mat3_m4_v3(float M[4][4], float r[3]);
-void mul_m4_v4(float M[4][4], float r[4]);
-void mul_v4_m4v4(float r[4], float M[4][4], float v[4]);
+void mul_m4_v4(const float M[4][4], float r[4]);
+void mul_v4_m4v4(float r[4], const float M[4][4], float v[4]);
void mul_project_m4_v3(float M[4][4], float vec[3]);
void mul_m3_v3(float M[3][3], float r[3]);
@@ -98,7 +98,7 @@
int invert_m3(float R[3][3]);
int invert_m3_m3(float R[3][3], float A[3][3]);
int invert_m4(float R[4][4]);
-int invert_m4_m4(float R[4][4], float A[4][4]);
+int invert_m4_m4(float R[4][4], const float A[4][4]);
/****************************** Linear Algebra *******************************/
Modified: branches/soc-2011-onion/source/blender/blenlib/BLI_pbvh.h
===================================================================
--- branches/soc-2011-onion/source/blender/blenlib/BLI_pbvh.h 2011-06-24 10:56:08 UTC (rev 37789)
+++ branches/soc-2011-onion/source/blender/blenlib/BLI_pbvh.h 2011-06-24 12:54:52 UTC (rev 37790)
@@ -58,7 +58,7 @@
struct PBVHHiddenArea *next, *prev;
float clip_planes[4][4];
int hide_inside;
-} HiddenArea;
+} PBVHHiddenArea;
/* Callbacks */
@@ -70,7 +70,7 @@
/* test AABB against sphere */
typedef struct {
- float *center;
+ const float *center;
float radius_squared;
int original;
} PBVHSearchSphereData;
@@ -81,12 +81,12 @@
PBVH *BLI_pbvh_new(void);
void BLI_pbvh_build_mesh(PBVH *bvh, struct MFace *faces, struct MVert *verts,
struct CustomData *vdata, struct CustomData *fdata,
- int totface, int totvert, ListBase *hidden_areas);
+ int totface, int totvert, struct ListBase *hidden_areas);
void BLI_pbvh_build_grids(PBVH *bvh, struct DMGridData **grids,
struct DMGridAdjacency *gridadj, int totgrid,
int gridsize, struct GridKey *gridkey, void **gridfaces,
struct CustomData *vdata, struct CustomData *fdata,
- ListBase *hidden_areas);
+ struct ListBase *hidden_areas);
void BLI_pbvh_free(PBVH *bvh);
/* Hierarchical Search in the BVH, two methods:
@@ -329,7 +329,7 @@
void BLI_pbvh_gather_proxies(PBVH* pbvh, PBVHNode*** nodes, int* totnode);
void BLI_pbvh_draw_nodes_in_sphere(PBVH *bvh, float center[3], float radius, int flags);
-void BLI_pbvh_gather_nodes_in_sphere(PBVH *bvh, float center[3], float radius, PBVHNode ***nodes, int *totnode);
+void BLI_pbvh_gather_nodes_in_sphere(PBVH *bvh, const float center[3], float radius, PBVHNode ***nodes, int *totnode);
void BLI_pbvh_node_array_draw(PBVH *bvh, PBVHNode **nodes, int totnode, int flags);
//void BLI_pbvh_node_BB_reset(PBVHNode* node);
Modified: branches/soc-2011-onion/source/blender/blenlib/intern/math_matrix.c
===================================================================
--- branches/soc-2011-onion/source/blender/blenlib/intern/math_matrix.c 2011-06-24 10:56:08 UTC (rev 37789)
+++ branches/soc-2011-onion/source/blender/blenlib/intern/math_matrix.c 2011-06-24 12:54:52 UTC (rev 37790)
@@ -68,7 +68,7 @@
memcpy(&m1[0], &m2[0], 9*sizeof(float));
}
-void copy_m4_m4(float m1[][4], float m2[][4])
+void copy_m4_m4(float m1[][4], const float m2[][4])
{
memcpy(m1, m2, 4*4*sizeof(float));
}
@@ -144,14 +144,22 @@
/******************************** Arithmetic *********************************/
-void mul_m4_m4m4(float m1[][4], float m2_[][4], float m3_[][4])
+void mul_m4_m4m4(float m1[][4], const float m2[][4], const float m3[][4])
{
- float m2[4][4], m3[4][4];
+ float t2[4][4], t3[4][4];
/* copy so it works when m1 is the same pointer as m2 or m3 */
- copy_m4_m4(m2, m2_);
- copy_m4_m4(m3, m3_);
+ if (m2 == m1) {
+ copy_m4_m4(t2, m2);
+ m2= t2;
+ }
+
+ if (m3 == m1) {
+ copy_m4_m4(t3, m3);
+ m3= t3;
+ }
+
/* matrix product: m1[j][k] = m2[j][i].m3[i][k] */
m1[0][0] = m2[0][0]*m3[0][0] + m2[0][1]*m3[1][0] + m2[0][2]*m3[2][0] + m2[0][3]*m3[3][0];
m1[0][1] = m2[0][0]*m3[0][1] + m2[0][1]*m3[1][1] + m2[0][2]*m3[2][1] + m2[0][3]*m3[3][1];
@@ -317,7 +325,7 @@
vec[2]=x*mat[0][2] + y*mat[1][2] + mat[2][2]*vec[2] + mat[3][2];
}
-void mul_v3_m4v3(float *in, float mat[][4], float *vec)
+void mul_v3_m4v3(float *in, const float mat[][4], const float *vec)
{
float x,y;
@@ -350,7 +358,7 @@
vec[2] /= w;
}
-void mul_v4_m4v4(float r[4], float mat[4][4], float v[4])
+void mul_v4_m4v4(float r[4], const float mat[4][4], float v[4])
{
float x, y, z;
@@ -364,7 +372,7 @@
r[3]= x*mat[0][3] + y*mat[1][3] + z*mat[2][3] + mat[3][3]*v[3];
}
-void mul_m4_v4(float mat[4][4], float r[4])
+void mul_m4_v4(const float mat[4][4], float r[4])
{
mul_v4_m4v4(r, mat, r);
}
@@ -508,7 +516,7 @@
* Mark Segal - 1992
*/
-int invert_m4_m4(float inverse[4][4], float mat[4][4])
+int invert_m4_m4(float inverse[4][4], const float mat[4][4])
{
int i, j, k;
double temp;
Modified: branches/soc-2011-onion/source/blender/blenlib/intern/pbvh.c
===================================================================
--- branches/soc-2011-onion/source/blender/blenlib/intern/pbvh.c 2011-06-24 10:56:08 UTC (rev 37789)
+++ branches/soc-2011-onion/source/blender/blenlib/intern/pbvh.c 2011-06-24 12:54:52 UTC (rev 37790)
@@ -557,7 +557,7 @@
/* Returns 0 if the primitive should be hidden, 1 otherwise */
static int test_prim_against_hidden_areas(BBC *prim_bbc, ListBase *hidden_areas)
{
- HiddenArea *area;
+ PBVHHiddenArea *area;
for(area = hidden_areas->first; area; area = area->next) {
int prim_inside_planes = pbvh_planes_contain_AABB(prim_bbc->bmin, prim_bbc->bmax, area->clip_planes);
@@ -1821,7 +1821,7 @@
*r_tot= tot;
}
-void BLI_pbvh_gather_nodes_in_sphere(PBVH *bvh, float center[3], float radius, PBVHNode ***nodes, int *totnode)
+void BLI_pbvh_gather_nodes_in_sphere(PBVH *bvh, const float center[3], float radius, PBVHNode ***nodes, int *totnode)
{
PBVHSearchSphereData data;
Modified: branches/soc-2011-onion/source/blender/editors/include/ED_sculpt.h
===================================================================
--- branches/soc-2011-onion/source/blender/editors/include/ED_sculpt.h 2011-06-24 10:56:08 UTC (rev 37789)
+++ branches/soc-2011-onion/source/blender/editors/include/ED_sculpt.h 2011-06-24 12:54:52 UTC (rev 37790)
@@ -41,9 +41,10 @@
/* sculpt.c */
void ED_operatortypes_sculpt(void);
-void ED_sculpt_force_update(struct bContext *C);
-void ED_paint_modifiers_changed(struct Object *ob);
+/* paint_mesh.c */
+void ED_paint_mesh_modifiers_changed(struct Object *ob);
+void ED_paint_mesh_force_update(struct bContext *C);
/* paint_ops.c */
void ED_operatortypes_paint(void);
Modified: branches/soc-2011-onion/source/blender/editors/include/ED_view3d.h
===================================================================
--- branches/soc-2011-onion/source/blender/editors/include/ED_view3d.h 2011-06-24 10:56:08 UTC (rev 37789)
+++ branches/soc-2011-onion/source/blender/editors/include/ED_view3d.h 2011-06-24 12:54:52 UTC (rev 37790)
@@ -145,7 +145,7 @@
* @param coord The world-space location.
* @param vec The resulting normalized vector.
*/
-void ED_view3d_global_to_vector(struct RegionView3D *rv3d, const float coord[3], float vec[3]);
+void ED_view3d_global_to_vector(const struct RegionView3D *rv3d, const float coord[3], float vec[3]);
/**
* Calculate the view transformation matrix from RegionView3D input.
@@ -210,7 +210,7 @@
void ED_view3d_ob_clip_range_get(struct Object *ob, float *lens, float *clipsta, float *clipend);
int ED_view3d_clip_range_get(struct View3D *v3d, struct RegionView3D *rv3d, float *clipsta, float *clipend);
int ED_view3d_viewplane_get(struct View3D *v3d, struct RegionView3D *rv3d, int winxi, int winyi, struct rctf *viewplane, float *clipsta, float *clipend, float *pixsize);
-void ED_view3d_ob_project_mat_get(struct RegionView3D *v3d, struct Object *ob, float pmat[4][4]);
+void ED_view3d_ob_project_mat_get(const struct RegionView3D *v3d, const struct Object *ob, float pmat[4][4]);
void ED_view3d_project_float(struct ARegion *a, const float vec[3], float adr[2], float mat[4][4]);
void ED_view3d_calc_camera_border(struct Scene *scene, struct ARegion *ar, struct View3D *v3d, struct RegionView3D *rv3d, struct rctf *viewborder_r, short do_shift);
@@ -246,9 +246,9 @@
/* select */
#define MAXPICKBUF 10000
-short view3d_opengl_select(struct ViewContext *vc, unsigned int *buffer, unsigned int bufsize, rcti *input);
+short view3d_opengl_select(struct ViewContext *vc, unsigned int *buffer, unsigned int bufsize, struct rcti *input);
-void view3d_set_viewcontext(struct bContext *C, struct ViewContext *vc);
+void view3d_set_viewcontext(const struct bContext *C, struct ViewContext *vc);
void view3d_operator_needs_opengl(const struct bContext *C);
void view3d_region_operator_needs_opengl(struct wmWindow *win, struct ARegion *ar);
int view3d_get_view_aligned_coordinate(struct ViewContext *vc, float fp[3], const int mval[2], const short do_fallback);
@@ -274,10 +274,10 @@
int winx, int winy, float viewmat[][4], float winmat[][4]);
@@ Diff output truncated at 10240 characters. @@
More information about the Bf-blender-cvs
mailing list