Cleanup: pass const matrices

Also order return matrices last.
master
Campbell Barton 4 years ago
parent ba6ed01058
commit 70d7805fa9

@ -123,22 +123,24 @@ void get_objectspace_bone_matrix(struct Bone *bone,
float M_accumulatedMatrix[4][4],
int root,
int posed);
void vec_roll_to_mat3(const float vec[3], const float roll, float mat[3][3]);
void vec_roll_to_mat3_normalized(const float nor[3], const float roll, float mat[3][3]);
void vec_roll_to_mat3(const float vec[3], const float roll, float r_mat[3][3]);
void vec_roll_to_mat3_normalized(const float nor[3], const float roll, float r_mat[3][3]);
void mat3_to_vec_roll(const float mat[3][3], float r_vec[3], float *r_roll);
void mat3_vec_to_roll(const float mat[3][3], const float vec[3], float *r_roll);
/* Common Conversions Between Co-ordinate Spaces */
void BKE_armature_mat_world_to_pose(struct Object *ob, float inmat[4][4], float outmat[4][4]);
void BKE_armature_mat_world_to_pose(struct Object *ob,
const float inmat[4][4],
float outmat[4][4]);
void BKE_armature_loc_world_to_pose(struct Object *ob, const float inloc[3], float outloc[3]);
void BKE_armature_mat_pose_to_bone(struct bPoseChannel *pchan,
float inmat[4][4],
const float inmat[4][4],
float outmat[4][4]);
void BKE_armature_loc_pose_to_bone(struct bPoseChannel *pchan,
const float inloc[3],
float outloc[3]);
void BKE_armature_mat_bone_to_pose(struct bPoseChannel *pchan,
float inmat[4][4],
const float inmat[4][4],
float outmat[4][4]);
void BKE_armature_mat_pose_to_delta(float delta_mat[4][4],
float pose_mat[4][4],
@ -147,13 +149,13 @@ void BKE_armature_mat_pose_to_delta(float delta_mat[4][4],
void BKE_armature_mat_pose_to_bone_ex(struct Depsgraph *depsgraph,
struct Object *ob,
struct bPoseChannel *pchan,
float inmat[4][4],
const float inmat[4][4],
float outmat[4][4]);
void BKE_pchan_mat3_to_rot(struct bPoseChannel *pchan, float mat[3][3], bool use_compat);
void BKE_pchan_rot_to_mat3(const struct bPoseChannel *pchan, float mat[3][3]);
void BKE_pchan_apply_mat4(struct bPoseChannel *pchan, float mat[4][4], bool use_comat);
void BKE_pchan_to_mat4(const struct bPoseChannel *pchan, float chan_mat[4][4]);
void BKE_pchan_mat3_to_rot(struct bPoseChannel *pchan, const float mat[3][3], bool use_compat);
void BKE_pchan_rot_to_mat3(const struct bPoseChannel *pchan, float r_mat[3][3]);
void BKE_pchan_apply_mat4(struct bPoseChannel *pchan, const float mat[4][4], bool use_comat);
void BKE_pchan_to_mat4(const struct bPoseChannel *pchan, float r_mat[4][4]);
void BKE_pchan_calc_mat(struct bPoseChannel *pchan);
/* Simple helper, computes the offset bone matrix. */

@ -98,15 +98,15 @@ bool BKE_curve_minmax(struct Curve *cu, bool use_radius, float min[3], float max
bool BKE_curve_center_median(struct Curve *cu, float cent[3]);
bool BKE_curve_center_bounds(struct Curve *cu, float cent[3]);
void BKE_curve_transform_ex(struct Curve *cu,
float mat[4][4],
const float mat[4][4],
const bool do_keys,
const bool do_props,
const float unit_scale);
void BKE_curve_transform(struct Curve *cu,
float mat[4][4],
const float mat[4][4],
const bool do_keys,
const bool do_props);
void BKE_curve_translate(struct Curve *cu, float offset[3], const bool do_keys);
void BKE_curve_translate(struct Curve *cu, const float offset[3], const bool do_keys);
void BKE_curve_material_index_remove(struct Curve *cu, int index);
bool BKE_curve_material_index_used(struct Curve *cu, int index);
void BKE_curve_material_index_clear(struct Curve *cu);

@ -76,7 +76,7 @@ void BKE_gpencil_stroke_fill_triangulate(struct bGPDstroke *gps);
void BKE_gpencil_stroke_geometry_update(struct bGPDstroke *gps);
void BKE_gpencil_stroke_uv_update(struct bGPDstroke *gps);
void BKE_gpencil_transform(struct bGPdata *gpd, float mat[4][4]);
void BKE_gpencil_transform(struct bGPdata *gpd, const float mat[4][4]);
typedef struct GPencilPointCoordinates {
/* This is used when doing "move only origin" in object_data_transform.c.

@ -67,8 +67,8 @@ void BKE_lattice_minmax_dl(struct Object *ob, struct Lattice *lt, float min[3],
void BKE_lattice_minmax(struct Lattice *lt, float min[3], float max[3]);
void BKE_lattice_center_median(struct Lattice *lt, float cent[3]);
void BKE_lattice_center_bounds(struct Lattice *lt, float cent[3]);
void BKE_lattice_translate(struct Lattice *lt, float offset[3], bool do_keys);
void BKE_lattice_transform(struct Lattice *lt, float mat[4][4], bool do_keys);
void BKE_lattice_translate(struct Lattice *lt, const float offset[3], bool do_keys);
void BKE_lattice_transform(struct Lattice *lt, const float mat[4][4], bool do_keys);
bool BKE_lattice_is_any_selected(const struct Lattice *lt);

@ -231,7 +231,7 @@ void BKE_mesh_nomain_to_meshkey(struct Mesh *mesh_src, struct Mesh *mesh_dst, st
/* vertex level transformations & checks (no derived mesh) */
bool BKE_mesh_minmax(const struct Mesh *me, float r_min[3], float r_max[3]);
void BKE_mesh_transform(struct Mesh *me, float mat[4][4], bool do_keys);
void BKE_mesh_transform(struct Mesh *me, const float mat[4][4], bool do_keys);
void BKE_mesh_translate(struct Mesh *me, const float offset[3], const bool do_keys);
void BKE_mesh_ensure_navmesh(struct Mesh *me);

@ -144,21 +144,21 @@ struct Object *BKE_object_duplicate(struct Main *bmain,
void BKE_object_obdata_size_init(struct Object *ob, const float scale);
void BKE_object_scale_to_mat3(struct Object *ob, float mat[3][3]);
void BKE_object_rot_to_mat3(const struct Object *ob, float mat[3][3], bool use_drot);
void BKE_object_mat3_to_rot(struct Object *ob, float mat[3][3], bool use_compat);
void BKE_object_to_mat3(struct Object *ob, float mat[3][3]);
void BKE_object_to_mat4(struct Object *ob, float mat[4][4]);
void BKE_object_scale_to_mat3(struct Object *ob, float r_mat[3][3]);
void BKE_object_rot_to_mat3(const struct Object *ob, float r_mat[3][3], bool use_drot);
void BKE_object_mat3_to_rot(struct Object *ob, float r_mat[3][3], bool use_compat);
void BKE_object_to_mat3(struct Object *ob, float r_mat[3][3]);
void BKE_object_to_mat4(struct Object *ob, float r_mat[4][4]);
void BKE_object_apply_mat4(struct Object *ob,
float mat[4][4],
const float mat[4][4],
const bool use_compat,
const bool use_parent);
void BKE_object_apply_mat4_ex(struct Object *ob,
float mat[4][4],
const float mat[4][4],
struct Object *parent,
float parentinv[4][4],
const float parentinv[4][4],
const bool use_compat);
void BKE_object_matrix_local_get(struct Object *ob, float mat[4][4]);
void BKE_object_matrix_local_get(struct Object *ob, float r_mat[4][4]);
bool BKE_object_pose_context_check(const struct Object *ob);
struct Object *BKE_object_pose_armature_get(struct Object *ob);
@ -188,7 +188,7 @@ struct Base **BKE_object_pose_base_array_get(struct ViewLayer *view_layer,
struct View3D *v3d,
unsigned int *r_bases_len);
void BKE_object_get_parent_matrix(struct Object *ob, struct Object *par, float parentmat[4][4]);
void BKE_object_get_parent_matrix(struct Object *ob, struct Object *par, float r_parentmat[4][4]);
void BKE_object_where_is_calc(struct Depsgraph *depsgraph, struct Scene *scene, struct Object *ob);
void BKE_object_where_is_calc_ex(struct Depsgraph *depsgraph,
struct Scene *scene,
@ -199,7 +199,7 @@ void BKE_object_where_is_calc_time(struct Depsgraph *depsgraph,
struct Scene *scene,
struct Object *ob,
float ctime);
void BKE_object_where_is_calc_mat4(struct Object *ob, float obmat[4][4]);
void BKE_object_where_is_calc_mat4(struct Object *ob, float r_obmat[4][4]);
/* possibly belong in own moduke? */
struct BoundBox *BKE_boundbox_alloc_unit(void);
@ -207,12 +207,12 @@ void BKE_boundbox_init_from_minmax(struct BoundBox *bb, const float min[3], cons
void BKE_boundbox_calc_center_aabb(const struct BoundBox *bb, float r_cent[3]);
void BKE_boundbox_calc_size_aabb(const struct BoundBox *bb, float r_size[3]);
void BKE_boundbox_minmax(const struct BoundBox *bb,
float obmat[4][4],
const float obmat[4][4],
float r_min[3],
float r_max[3]);
struct BoundBox *BKE_object_boundbox_get(struct Object *ob);
void BKE_object_dimensions_get(struct Object *ob, float vec[3]);
void BKE_object_dimensions_get(struct Object *ob, float r_vec[3]);
void BKE_object_dimensions_set_ex(struct Object *ob,
const float value[3],
int axis_mask,
@ -233,7 +233,7 @@ bool BKE_object_minmax_dupli(struct Depsgraph *depsgraph,
/* sometimes min-max isn't enough, we need to loop over each point */
void BKE_object_foreach_display_point(struct Object *ob,
float obmat[4][4],
const float obmat[4][4],
void (*func_cb)(const float[3], void *),
void *user_data);
void BKE_scene_foreach_display_point(struct Depsgraph *depsgraph,

@ -1382,7 +1382,7 @@ void get_objectspace_bone_matrix(struct Bone *bone,
}
/* Convert World-Space Matrix to Pose-Space Matrix */
void BKE_armature_mat_world_to_pose(Object *ob, float inmat[4][4], float outmat[4][4])
void BKE_armature_mat_world_to_pose(Object *ob, const float inmat[4][4], float outmat[4][4])
{
float obmat[4][4];
@ -1674,7 +1674,9 @@ void BKE_bone_parent_transform_apply(const struct BoneParentTransform *bpt,
/* Convert Pose-Space Matrix to Bone-Space Matrix.
* NOTE: this cannot be used to convert to pose-space transforms of the supplied
* pose-channel into its local space (i.e. 'visual'-keyframing) */
void BKE_armature_mat_pose_to_bone(bPoseChannel *pchan, float inmat[4][4], float outmat[4][4])
void BKE_armature_mat_pose_to_bone(bPoseChannel *pchan,
const float inmat[4][4],
float outmat[4][4])
{
BoneParentTransform bpt;
@ -1684,7 +1686,9 @@ void BKE_armature_mat_pose_to_bone(bPoseChannel *pchan, float inmat[4][4], float
}
/* Convert Bone-Space Matrix to Pose-Space Matrix. */
void BKE_armature_mat_bone_to_pose(bPoseChannel *pchan, float inmat[4][4], float outmat[4][4])
void BKE_armature_mat_bone_to_pose(bPoseChannel *pchan,
const float inmat[4][4],
float outmat[4][4])
{
BoneParentTransform bpt;
@ -1720,7 +1724,7 @@ void BKE_armature_loc_pose_to_bone(bPoseChannel *pchan, const float inloc[3], fl
void BKE_armature_mat_pose_to_bone_ex(struct Depsgraph *depsgraph,
Object *ob,
bPoseChannel *pchan,
float inmat[4][4],
const float inmat[4][4],
float outmat[4][4])
{
bPoseChannel work_pchan = *pchan;
@ -1741,7 +1745,7 @@ void BKE_armature_mat_pose_to_bone_ex(struct Depsgraph *depsgraph,
/**
* Same as #BKE_object_mat3_to_rot().
*/
void BKE_pchan_mat3_to_rot(bPoseChannel *pchan, float mat[3][3], bool use_compat)
void BKE_pchan_mat3_to_rot(bPoseChannel *pchan, const float mat[3][3], bool use_compat)
{
BLI_ASSERT_UNIT_M3(mat);
@ -1766,17 +1770,17 @@ void BKE_pchan_mat3_to_rot(bPoseChannel *pchan, float mat[3][3], bool use_compat
/**
* Same as #BKE_object_rot_to_mat3().
*/
void BKE_pchan_rot_to_mat3(const bPoseChannel *pchan, float mat[3][3])
void BKE_pchan_rot_to_mat3(const bPoseChannel *pchan, float r_mat[3][3])
{
/* rotations may either be quats, eulers (with various rotation orders), or axis-angle */
if (pchan->rotmode > 0) {
/* euler rotations (will cause gimble lock,
* but this can be alleviated a bit with rotation orders) */
eulO_to_mat3(mat, pchan->eul, pchan->rotmode);
eulO_to_mat3(r_mat, pchan->eul, pchan->rotmode);
}
else if (pchan->rotmode == ROT_MODE_AXISANGLE) {
/* axis-angle - not really that great for 3D-changing orientations */
axis_angle_to_mat3(mat, pchan->rotAxis, pchan->rotAngle);
axis_angle_to_mat3(r_mat, pchan->rotAxis, pchan->rotAngle);
}
else {
/* quats are normalized before use to eliminate scaling issues */
@ -1786,7 +1790,7 @@ void BKE_pchan_rot_to_mat3(const bPoseChannel *pchan, float mat[3][3])
* since this was kindof evil in some cases but if this proves to be too problematic,
* switch back to the old system of operating directly on the stored copy. */
normalize_qt_qt(quat, pchan->quat);
quat_to_mat3(mat, quat);
quat_to_mat3(r_mat, quat);
}
}
@ -1794,7 +1798,7 @@ void BKE_pchan_rot_to_mat3(const bPoseChannel *pchan, float mat[3][3])
* Apply a 4x4 matrix to the pose bone,
* similar to #BKE_object_apply_mat4().
*/
void BKE_pchan_apply_mat4(bPoseChannel *pchan, float mat[4][4], bool use_compat)
void BKE_pchan_apply_mat4(bPoseChannel *pchan, const float mat[4][4], bool use_compat)
{
float rot[3][3];
mat4_to_loc_rot_size(pchan->loc, rot, pchan->size, mat);
@ -1998,7 +2002,7 @@ void mat3_vec_to_roll(const float mat[3][3], const float vec[3], float *r_roll)
* -2 * x * z, x^2 - z^2
* </pre>
*/
void vec_roll_to_mat3_normalized(const float nor[3], const float roll, float mat[3][3])
void vec_roll_to_mat3_normalized(const float nor[3], const float roll, float r_mat[3][3])
{
#define THETA_THRESHOLD_NEGY 1.0e-9f
#define THETA_THRESHOLD_NEGY_CLOSE 1.0e-5f
@ -2052,18 +2056,18 @@ void vec_roll_to_mat3_normalized(const float nor[3], const float roll, float mat
axis_angle_normalized_to_mat3(rMatrix, nor, roll);
/* Combine and output result */
mul_m3_m3m3(mat, rMatrix, bMatrix);
mul_m3_m3m3(r_mat, rMatrix, bMatrix);
#undef THETA_THRESHOLD_NEGY
#undef THETA_THRESHOLD_NEGY_CLOSE
}
void vec_roll_to_mat3(const float vec[3], const float roll, float mat[3][3])
void vec_roll_to_mat3(const float vec[3], const float roll, float r_mat[3][3])
{
float nor[3];
normalize_v3_v3(nor, vec);
vec_roll_to_mat3_normalized(nor, roll, mat);
vec_roll_to_mat3_normalized(nor, roll, r_mat);
}
/** \} */
@ -2418,8 +2422,10 @@ void BKE_pose_rebuild(Main *bmain, Object *ob, bArmature *arm, const bool do_id_
/** \name Pose Solver
* \{ */
/* loc/rot/size to given mat4 */
void BKE_pchan_to_mat4(const bPoseChannel *pchan, float chan_mat[4][4])
/**
* Convert the loc/rot/size to \a r_chanmat (typically #bPoseChannel.chan_mat).
*/
void BKE_pchan_to_mat4(const bPoseChannel *pchan, float r_chanmat[4][4])
{
float smat[3][3];
float rmat[3][3];
@ -2433,12 +2439,12 @@ void BKE_pchan_to_mat4(const bPoseChannel *pchan, float chan_mat[4][4])
/* calculate matrix of bone (as 3x3 matrix, but then copy the 4x4) */
mul_m3_m3m3(tmat, rmat, smat);
copy_m4_m3(chan_mat, tmat);
copy_m4_m3(r_chanmat, tmat);
/* prevent action channels breaking chains */
/* need to check for bone here, CONSTRAINT_TYPE_ACTION uses this call */
if ((pchan->bone == NULL) || !(pchan->bone->flag & BONE_CONNECTED)) {
copy_v3_v3(chan_mat[3], pchan->loc);
copy_v3_v3(r_chanmat[3], pchan->loc);
}
}

@ -5309,8 +5309,11 @@ bool BKE_curve_center_bounds(Curve *cu, float cent[3])
return false;
}
void BKE_curve_transform_ex(
Curve *cu, float mat[4][4], const bool do_keys, const bool do_props, const float unit_scale)
void BKE_curve_transform_ex(Curve *cu,
const float mat[4][4],
const bool do_keys,
const bool do_props,
const float unit_scale)
{
Nurb *nu;
BPoint *bp;
@ -5373,13 +5376,13 @@ void BKE_curve_transform_ex(
}
}
void BKE_curve_transform(Curve *cu, float mat[4][4], const bool do_keys, const bool do_props)
void BKE_curve_transform(Curve *cu, const float mat[4][4], const bool do_keys, const bool do_props)
{
float unit_scale = mat4_to_scale(mat);
BKE_curve_transform_ex(cu, mat, do_keys, do_props, unit_scale);
}
void BKE_curve_translate(Curve *cu, float offset[3], const bool do_keys)
void BKE_curve_translate(Curve *cu, const float offset[3], const bool do_keys)
{
ListBase *nurb_lb = BKE_curve_nurbs_get(cu);
Nurb *nu;

@ -2427,7 +2427,7 @@ void BKE_gpencil_convert_mesh(Main *bmain,
* \param gpd: Grease pencil data-block
* \param mat: Transformation matrix
*/
void BKE_gpencil_transform(bGPdata *gpd, float mat[4][4])
void BKE_gpencil_transform(bGPdata *gpd, const float mat[4][4])
{
if (gpd == NULL) {
return;

@ -672,7 +672,7 @@ void BKE_lattice_center_bounds(Lattice *lt, float cent[3])
mid_v3_v3v3(cent, min, max);
}
void BKE_lattice_transform(Lattice *lt, float mat[4][4], bool do_keys)
void BKE_lattice_transform(Lattice *lt, const float mat[4][4], bool do_keys)
{
BPoint *bp = lt->def;
int i = lt->pntsu * lt->pntsv * lt->pntsw;
@ -694,7 +694,7 @@ void BKE_lattice_transform(Lattice *lt, float mat[4][4], bool do_keys)
}
}
void BKE_lattice_translate(Lattice *lt, float offset[3], bool do_keys)
void BKE_lattice_translate(Lattice *lt, const float offset[3], bool do_keys)
{
int i, numVerts;

@ -315,7 +315,7 @@ static float densfunc(const MetaElem *ball, float x, float y, float z)
float dist2;
float dvec[3] = {x, y, z};
mul_m4_v3((float(*)[4])ball->imat, dvec);
mul_m4_v3((const float(*)[4])ball->imat, dvec);
switch (ball->type) {
case MB_BALL:

@ -1305,7 +1305,7 @@ bool BKE_mesh_minmax(const Mesh *me, float r_min[3], float r_max[3])
return (me->totvert != 0);
}
void BKE_mesh_transform(Mesh *me, float mat[4][4], bool do_keys)
void BKE_mesh_transform(Mesh *me, const float mat[4][4], bool do_keys)
{
int i;
MVert *mvert = me->mvert;

@ -2344,7 +2344,7 @@ void BKE_object_tfm_copy(Object *object_dst, const Object *object_src)
#undef TFMCPY4D
}
void BKE_object_to_mat3(Object *ob, float mat[3][3]) /* no parent */
void BKE_object_to_mat3(Object *ob, float r_mat[3][3]) /* no parent */
{
float smat[3][3];
float rmat[3][3];
@ -2355,38 +2355,38 @@ void BKE_object_to_mat3(Object *ob, float mat[3][3]) /* no parent */
/* rot */
BKE_object_rot_to_mat3(ob, rmat, true);
mul_m3_m3m3(mat, rmat, smat);
mul_m3_m3m3(r_mat, rmat, smat);
}
void BKE_object_to_mat4(Object *ob, float mat[4][4])
void BKE_object_to_mat4(Object *ob, float r_mat[4][4])
{
float tmat[3][3];
BKE_object_to_mat3(ob, tmat);
copy_m4_m3(mat, tmat);
copy_m4_m3(r_mat, tmat);
add_v3_v3v3(mat[3], ob->loc, ob->dloc);
add_v3_v3v3(r_mat[3], ob->loc, ob->dloc);
}
void BKE_object_matrix_local_get(struct Object *ob, float mat[4][4])
void BKE_object_matrix_local_get(struct Object *ob, float r_mat[4][4])
{
if (ob->parent) {
float par_imat[4][4];
BKE_object_get_parent_matrix(ob, ob->parent, par_imat);
invert_m4(par_imat);
mul_m4_m4m4(mat, par_imat, ob->obmat);
mul_m4_m4m4(r_mat, par_imat, ob->obmat);
}
else {
copy_m4_m4(mat, ob->obmat);
copy_m4_m4(r_mat, ob->obmat);
}
}
/**
* \return success if \a mat is set.
*/
static bool ob_parcurve(Object *ob, Object *par, float mat[4][4])
static bool ob_parcurve(Object *ob, Object *par, float r_mat[4][4])
{
Curve *cu = par->data;
float vec[4], dir[3], quat[4], radius, ctime;
@ -2420,34 +2420,34 @@ static bool ob_parcurve(Object *ob, Object *par, float mat[4][4])
}
CLAMP(ctime, 0.0f, 1.0f);
unit_m4(mat);
unit_m4(r_mat);
/* vec: 4 items! */
if (where_on_path(par, ctime, vec, dir, (cu->flag & CU_FOLLOW) ? quat : NULL, &radius, NULL)) {
if (cu->flag & CU_FOLLOW) {
quat_apply_track(quat, ob->trackflag, ob->upflag);
normalize_qt(quat);
quat_to_mat4(mat, quat);
quat_to_mat4(r_mat, quat);
}
if (cu->flag & CU_PATH_RADIUS) {
float tmat[4][4], rmat[4][4];
scale_m4_fl(tmat, radius);
mul_m4_m4m4(rmat, tmat, mat);
copy_m4_m4(mat, rmat);
mul_m4_m4m4(rmat, tmat, r_mat);
copy_m4_m4(r_mat, rmat);
}
copy_v3_v3(mat[3], vec);
copy_v3_v3(r_mat[3], vec);
}
return true;
}
static void ob_parbone(Object *ob, Object *par, float mat[4][4])
static void ob_parbone(Object *ob, Object *par, float r_mat[4][4])
{
bPoseChannel *pchan;
float vec[3];
if (par->type != OB_ARMATURE) {
unit_m4(mat);
unit_m4(r_mat);
return;
}
@ -2456,7 +2456,7 @@ static void ob_parbone(Object *ob, Object *par, float mat[4][4])
if (!pchan || !pchan->bone) {
CLOG_ERROR(
&LOG, "Object %s with Bone parent: bone %s doesn't exist", ob->id.name + 2, ob->parsubstr);
unit_m4(mat);
unit_m4(r_mat);
return;
}
@ -2464,15 +2464,15 @@ static void ob_parbone(Object *ob, Object *par, float mat[4][4])
if (pchan->bone->flag & BONE_RELATIVE_PARENTING) {
/* the new option uses the root - expected behavior, but differs from old... */
/* XXX check on version patching? */
copy_m4_m4(mat, pchan->chan_mat);
copy_m4_m4(r_mat, pchan->chan_mat);
}
else {
copy_m4_m4(mat, pchan->pose_mat);
copy_m4_m4(r_mat, pchan->pose_mat);
/* but for backwards compatibility, the child has to move to the tail */
copy_v3_v3(vec, mat[1]);
copy_v3_v3(vec, r_mat[1]);
mul_v3_fl(vec, pchan->bone->length);
add_v3_v3(mat[3], vec);
add_v3_v3(r_mat[3], vec);
}
}
@ -2594,7 +2594,7 @@ static void give_parvert(Object *par, int nr, float vec[3])
}
}
static void ob_parvert3(Object *ob, Object *par, float mat[4][4])
static void ob_parvert3(Object *ob, Object *par, float r_mat[4][4])
{
/* in local ob space */
@ -2607,16 +2607,16 @@ static void ob_parvert3(Object *ob, Object *par, float mat[4][4])
tri_to_quat(q, v1, v2, v3);
quat_to_mat3(cmat, q);
copy_m4_m3(mat, cmat);
copy_m4_m3(r_mat, cmat);
mid_v3_v3v3v3(mat[3], v1, v2, v3);
mid_v3_v3v3v3(r_mat[3], v1, v2, v3);
}
else {
unit_m4(mat);
unit_m4(r_mat);
}
}
void BKE_object_get_parent_matrix(Object *ob, Object *par, float parentmat[4][4])
void BKE_object_get_parent_matrix(Object *ob, Object *par, float r_parentmat[4][4])
{
float tmat[4][4];
float vec[3];
@ -2632,31 +2632,31 @@ void BKE_object_get_parent_matrix(Object *ob, Object *par, float parentmat[4][4]
}
if (ok) {
mul_m4_m4m4(parentmat, par->obmat, tmat);
mul_m4_m4m4(r_parentmat, par->obmat, tmat);
}
else {
copy_m4_m4(parentmat, par->obmat);
copy_m4_m4(r_parentmat, par->obmat);
}
break;
case PARBONE:
ob_parbone(ob, par, tmat);
mul_m4_m4m4(parentmat, par->obmat, tmat);
mul_m4_m4m4(r_parentmat, par->obmat, tmat);
break;
case PARVERT1:
unit_m4(parentmat);
unit_m4(r_parentmat);
give_parvert(par, ob->par1, vec);
mul_v3_m4v3(parentmat[3], par->obmat, vec);
mul_v3_m4v3(r_parentmat[3], par->obmat, vec);
break;
case PARVERT3:
ob_parvert3(ob, par, tmat);
mul_m4_m4m4(parentmat, par->obmat, tmat);
mul_m4_m4m4(r_parentmat, par->obmat, tmat);
break;
case PARSKEL:
copy_m4_m4(parentmat, par->obmat);
copy_m4_m4(r_parentmat, par->obmat);
break;
}
}
@ -2672,7 +2672,7 @@ void BKE_object_get_parent_matrix(Object *ob, Object *par, float parentmat[4][4]
* (without its own matrix applied)
*/
static void solve_parenting(
Object *ob, Object *par, float obmat[4][4], float r_originmat[3][3], const bool set_origin)
Object *ob, Object *par, const bool set_origin, float r_obmat[4][4], float r_originmat[3][3])
{
float totmat[4][4];
float tmat[4][4];
@ -2684,7 +2684,7 @@ static void solve_parenting(
/* total */
mul_m4_m4m4(tmat, totmat, ob->parentinv);
mul_m4_m4m4(obmat, tmat, locmat);
mul_m4_m4m4(r_obmat, tmat, locmat);
if (r_originmat) {
/* usable originmat */
@ -2714,7 +2714,7 @@ static void object_where_is_calc_ex(Depsgraph *depsgraph,
Object *par = ob->parent;
/* calculate parent matrix */
solve_parenting(ob, par, ob->obmat, r_originmat, true);
solve_parenting(ob, par, true, ob->obmat, r_originmat);
}
else {
BKE_object_to_mat4(ob, ob->obmat);
@ -2757,14 +2757,14 @@ void BKE_object_where_is_calc_time(Depsgraph *depsgraph, Scene *scene, Object *o
* constraints -- assume dependencies are already solved by depsgraph.
* no changes to object and it's parent would be done.
* used for bundles orientation in 3d space relative to parented blender camera */
void BKE_object_where_is_calc_mat4(Object *ob, float obmat[4][4])
void BKE_object_where_is_calc_mat4(Object *ob, float r_obmat[4][4])
{
if (ob->parent) {
Object *par = ob->parent;
solve_parenting(ob, par, obmat, NULL, false);
solve_parenting(ob, par, false, r_obmat, NULL);
}
else {
BKE_object_to_mat4(ob, obmat);
BKE_object_to_mat4(ob, r_obmat);
}
}
@ -2825,8 +2825,11 @@ void BKE_object_workob_calc_parent(Depsgraph *depsgraph, Scene *scene, Object *o
* \param use_compat: true to ensure that rotations are set using the
* min difference between the old and new orientation.
*/
void BKE_object_apply_mat4_ex(
Object *ob, float mat[4][4], Object *parent, float parentinv[4][4], const bool use_compat)
void BKE_object_apply_mat4_ex(Object *ob,
const float mat[4][4],
Object *parent,
const float parentinv[4][4],
const bool use_compat)
{
/* see BKE_pchan_apply_mat4() for the equivalent 'pchan' function */
@ -2867,7 +2870,7 @@ void BKE_object_apply_mat4_ex(
/* XXX: should be removed after COW operators port to use BKE_object_apply_mat4_ex directly */
void BKE_object_apply_mat4(Object *ob,
float mat[4][4],
const float mat[4][4],
const bool use_compat,
const bool use_parent)
{
@ -2917,7 +2920,10 @@ void BKE_boundbox_calc_size_aabb(const BoundBox *bb, float r_size[3])
r_size[2] = 0.5f * fabsf(bb->vec[0][2] - bb->vec[1][2]);
}
void BKE_boundbox_minmax(const BoundBox *bb, float obmat[4][4], float r_min[3], float r_max[3])
void BKE_boundbox_minmax(const BoundBox *bb,
const float obmat[4][4],
float r_min[3],
float r_max[3])
{
int i;
for (i = 0; i < 8; i++) {
@ -3009,7 +3015,7 @@ void BKE_object_boundbox_calc_from_mesh(struct Object *ob, struct Mesh *me_eval)
* \warning Setting dimensions is prone to feedback loops in evaluation.
* \{ */
void BKE_object_dimensions_get(Object *ob, float vec[3])
void BKE_object_dimensions_get(Object *ob, float r_vec[3])
{
BoundBox *bb = NULL;
@ -3019,12 +3025,12 @@ void BKE_object_dimensions_get(Object *ob, float vec[3])
mat4_to_size(scale, ob->obmat);
vec[0] = fabsf(scale[0]) * (bb->vec[4][0] - bb->vec[0][0]);
vec[1] = fabsf(scale[1]) * (bb->vec[2][1] - bb->vec[0][1]);
vec[2] = fabsf(scale[2]) * (bb->vec[1][2] - bb->vec[0][2]);
r_vec[0] = fabsf(scale[0]) * (bb->vec[4][0] - bb->vec[0][0]);
r_vec[1] = fabsf(scale[1]) * (bb->vec[2][1] - bb->vec[0][1]);
r_vec[2] = fabsf(scale[2]) * (bb->vec[1][2] - bb->vec[0][2]);
}
else {
zero_v3(vec);
zero_v3(r_vec);
}
}
@ -3293,7 +3299,7 @@ bool BKE_object_minmax_dupli(Depsgraph *depsgraph,
}
void BKE_object_foreach_display_point(Object *ob,
float obmat[4][4],
const float obmat[4][4],
void (*func_cb)(const float[3], void *),
void *user_data)
{

@ -45,7 +45,7 @@ void BLI_uvproject_from_view(float target[2],
float winy);
/* apply ortho uv's */
void BLI_uvproject_from_view_ortho(float target[2], float source[3], float rotmat[4][4]);
void BLI_uvproject_from_view_ortho(float target[2], float source[3], const float rotmat[4][4]);
/* so we can adjust scale with keeping the struct private */
void BLI_uvproject_camera_info_scale(struct ProjCameraInfo *uci, float scale_x, float scale_y);

@ -183,7 +183,7 @@ ProjCameraInfo *BLI_uvproject_camera_info(Object *ob, float (*rotmat)[4], float
return NULL;
}
void BLI_uvproject_from_view_ortho(float target[2], float source[3], float rotmat[4][4])
void BLI_uvproject_from_view_ortho(float target[2], float source[3], const float rotmat[4][4])
{
float pv[3];

@ -160,7 +160,7 @@ void EEVEE_render_view_sync(EEVEE_Data *vedata, RenderEngine *engine, struct Dep
struct Object *ob_camera_eval = DEG_get_evaluated_object(depsgraph, RE_GetCamera(engine->re));
RE_GetCameraWindow(engine->re, ob_camera_eval, winmat);
RE_GetCameraWindowWithOverscan(engine->re, winmat, g_data->overscan);
RE_GetCameraWindowWithOverscan(engine->re, g_data->overscan, winmat);
RE_GetCameraModelMatrix(engine->re, ob_camera_eval, viewinv);
invert_m4_m4(viewmat, viewinv);

@ -229,7 +229,7 @@ EditBone *ED_armature_ebone_find_shared_parent(EditBone *ebone_child[], const ui
return NULL;
}
void ED_armature_ebone_to_mat3(EditBone *ebone, float mat[3][3])
void ED_armature_ebone_to_mat3(EditBone *ebone, float r_mat[3][3])
{
float delta[3], roll;
@ -246,20 +246,20 @@ void ED_armature_ebone_to_mat3(EditBone *ebone, float mat[3][3])
}
}
vec_roll_to_mat3_normalized(delta, roll, mat);
vec_roll_to_mat3_normalized(delta, roll, r_mat);
}
void ED_armature_ebone_to_mat4(EditBone *ebone, float mat[4][4])
void ED_armature_ebone_to_mat4(EditBone *ebone, float r_mat[4][4])
{
float m3[3][3];
ED_armature_ebone_to_mat3(ebone, m3);
copy_m4_m3(mat, m3);
copy_v3_v3(mat[3], ebone->head);
copy_m4_m3(r_mat, m3);
copy_v3_v3(r_mat[3], ebone->head);
}
void ED_armature_ebone_from_mat3(EditBone *ebone, float mat[3][3])
void ED_armature_ebone_from_mat3(EditBone *ebone, const float mat[3][3])
{
float vec[3], roll;
const float len = len_v3v3(ebone->head, ebone->tail);
@ -270,7 +270,7 @@ void ED_armature_ebone_from_mat3(EditBone *ebone, float mat[3][3])
ebone->roll = roll;
}
void ED_armature_ebone_from_mat4(EditBone *ebone, float mat[4][4])
void ED_armature_ebone_from_mat4(EditBone *ebone, const float mat[4][4])
{
float mat3[3][3];

@ -225,10 +225,10 @@ void ED_armature_ebone_remove(struct bArmature *arm, EditBone *exBone);
bool ED_armature_ebone_is_child_recursive(EditBone *ebone_parent, EditBone *ebone_child);
EditBone *ED_armature_ebone_find_shared_parent(EditBone *ebone_child[],
const unsigned int ebone_child_tot);
void ED_armature_ebone_to_mat3(EditBone *ebone, float mat[3][3]);
void ED_armature_ebone_to_mat4(EditBone *ebone, float mat[4][4]);
void ED_armature_ebone_from_mat3(EditBone *ebone, float mat[3][3]);
void ED_armature_ebone_from_mat4(EditBone *ebone, float mat[4][4]);
void ED_armature_ebone_to_mat3(EditBone *ebone, float r_mat[3][3]);
void ED_armature_ebone_to_mat4(EditBone *ebone, float r_mat[4][4]);
void ED_armature_ebone_from_mat3(EditBone *ebone, const float mat[3][3]);
void ED_armature_ebone_from_mat4(EditBone *ebone, const float mat[4][4]);
EditBone *ED_armature_ebone_find_name(const struct ListBase *edbo, const char *name);
EditBone *ED_armature_ebone_get_mirrored(const struct ListBase *edbo, EditBone *ebo);
void ED_armature_ebone_transform_mirror_update(struct bArmature *arm,

@ -135,13 +135,13 @@ bool ED_view3d_has_workbench_in_texture_color(const struct Scene *scene,
void ED_view3d_cursor3d_position(struct bContext *C,
const int mval[2],
const bool use_depth,
float cursor_co[3]);
float r_cursor_co[3]);
void ED_view3d_cursor3d_position_rotation(struct bContext *C,
const int mval[2],
const bool use_depth,
enum eV3DCursorOrient orientation,
float cursor_co[3],
float cursor_quat[4]);
float r_cursor_co[3],
float r_cursor_quat[4]);
void ED_view3d_cursor3d_update(struct bContext *C,
const int mval[2],
const bool use_depth,
@ -403,10 +403,10 @@ bool ED_view3d_win_to_segment_clipped(struct Depsgraph *depsgraph,
const bool do_clip);
void ED_view3d_ob_project_mat_get(const struct RegionView3D *v3d,
struct Object *ob,
float pmat[4][4]);
float r_pmat[4][4]);
void ED_view3d_ob_project_mat_get_from_obmat(const struct RegionView3D *rv3d,
float obmat[4][4],
float pmat[4][4]);
const float obmat[4][4],
float r_pmat[4][4]);
void ED_view3d_project(const struct ARegion *region, const float world[3], float r_region_co[3]);
bool ED_view3d_unproject(
@ -460,7 +460,7 @@ void ED_view3d_clipping_calc(struct BoundBox *bb,
const struct ARegion *region,
const struct Object *ob,
const struct rcti *rect);
void ED_view3d_clipping_local(struct RegionView3D *rv3d, float mat[4][4]);
void ED_view3d_clipping_local(struct RegionView3D *rv3d, const float mat[4][4]);
bool ED_view3d_clipping_test(const struct RegionView3D *rv3d,
const float co[3],
const bool is_local);
@ -601,8 +601,8 @@ void ED_view3d_draw_setup_view(const struct wmWindowManager *wm,
struct Scene *scene,
struct ARegion *region,
struct View3D *v3d,
float viewmat[4][4],
float winmat[4][4],
const float viewmat[4][4],
const float winmat[4][4],
const struct rcti *rect);
struct Base *ED_view3d_give_base_under_cursor(struct bContext *C, const int mval[2]);
@ -613,11 +613,11 @@ void ED_view3d_update_viewmat(struct Depsgraph *depsgraph,
const struct Scene *scene,
struct View3D *v3d,
struct ARegion *region,
float viewmat[4][4],
float winmat[4][4],
const float viewmat[4][4],
const float winmat[4][4],
const struct rcti *rect,
bool offscreen);
bool ED_view3d_quat_from_axis_view(const char view, const char view_axis_roll, float quat[4]);
bool ED_view3d_quat_from_axis_view(const char view, const char view_axis_roll, float r_quat[4]);
bool ED_view3d_quat_to_axis_view(const float viewquat[4],
const float epsilon,
char *r_view,
@ -676,7 +676,9 @@ void ED_view3d_lock_clear(struct View3D *v3d);
#define VIEW3D_MARGIN 1.4f
#define VIEW3D_DIST_FALLBACK 1.0f
float ED_view3d_offset_distance(float mat[4][4], const float ofs[3], const float dist_fallback);
float ED_view3d_offset_distance(const float mat[4][4],
const float ofs[3],
const float dist_fallback);
void ED_view3d_distance_set(struct RegionView3D *rv3d, const float dist);
bool ED_view3d_distance_set_from_location(struct RegionView3D *rv3d,
const float dist_co[3],

@ -49,8 +49,8 @@ void ED_view3d_draw_offscreen(struct Depsgraph *depsgraph,
struct ARegion *region,
int winx,
int winy,
float viewmat[4][4],
float winmat[4][4],
const float viewmat[4][4],
const float winmat[4][4],
bool is_image_render,
bool do_sky,
bool is_persp,
@ -65,8 +65,8 @@ void ED_view3d_draw_offscreen_simple(struct Depsgraph *depsgraph,
int winx,
int winy,
unsigned int draw_flags,
float viewmat[4][4],
float winmat[4][4],
const float viewmat[4][4],
const float winmat[4][4],
float clip_start,
float clip_end,
bool is_image_render,

@ -255,13 +255,13 @@ void ED_object_base_init_transform_on_add(Object *object, const float loc[3], co
/* Uses context to figure out transform for primitive.
* Returns standard diameter. */
float ED_object_new_primitive_matrix(
bContext *C, Object *obedit, const float loc[3], const float rot[3], float primmat[4][4])
bContext *C, Object *obedit, const float loc[3], const float rot[3], float r_primmat[4][4])
{
Scene *scene = CTX_data_scene(C);
View3D *v3d = CTX_wm_view3d(C);
float mat[3][3], rmat[3][3], cmat[3][3], imat[3][3];
unit_m4(primmat);
unit_m4(r_primmat);
eul_to_mat3(rmat, rot);
invert_m3(rmat);
@ -270,13 +270,13 @@ float ED_object_new_primitive_matrix(
copy_m3_m4(mat, obedit->obmat);
mul_m3_m3m3(cmat, rmat, mat);
invert_m3_m3(imat, cmat);
copy_m4_m3(primmat, imat);
copy_m4_m3(r_primmat, imat);
/* center */
copy_v3_v3(primmat[3], loc);
sub_v3_v3v3(primmat[3], primmat[3], obedit->obmat[3]);
copy_v3_v3(r_primmat[3], loc);
sub_v3_v3v3(r_primmat[3], r_primmat[3], obedit->obmat[3]);
invert_m3_m3(imat, mat);
mul_m3_v3(imat, primmat[3]);
mul_m3_v3(imat, r_primmat[3]);
{
const float dia = v3d ? ED_view3d_grid_scale(scene, v3d, NULL) :

@ -115,8 +115,8 @@ void ED_view3d_update_viewmat(Depsgraph *depsgraph,
const Scene *scene,
View3D *v3d,
ARegion *region,
float viewmat[4][4],
float winmat[4][4],
const float viewmat[4][4],
const float winmat[4][4],
const rcti *rect,
bool offscreen)
{
@ -197,8 +197,8 @@ static void view3d_main_region_setup_view(Depsgraph *depsgraph,
Scene *scene,
View3D *v3d,
ARegion *region,
float viewmat[4][4],
float winmat[4][4],
const float viewmat[4][4],
const float winmat[4][4],
const rcti *rect)
{
RegionView3D *rv3d = region->regiondata;
@ -214,8 +214,8 @@ static void view3d_main_region_setup_offscreen(Depsgraph *depsgraph,
const Scene *scene,
View3D *v3d,
ARegion *region,
float viewmat[4][4],
float winmat[4][4])
const float viewmat[4][4],
const float winmat[4][4])
{
RegionView3D *rv3d = region->regiondata;
ED_view3d_update_viewmat(depsgraph, scene, v3d, region, viewmat, winmat, NULL, true);
@ -353,8 +353,8 @@ void ED_view3d_draw_setup_view(const wmWindowManager *wm,
Scene *scene,
ARegion *region,
View3D *v3d,
float viewmat[4][4],
float winmat[4][4],
const float viewmat[4][4],
const float winmat[4][4],
const rcti *rect)
{
RegionView3D *rv3d = region->regiondata;
@ -1640,7 +1640,7 @@ static void view3d_stereo3d_setup_offscreen(Depsgraph *depsgraph,
const Scene *scene,
View3D *v3d,
ARegion *region,
float winmat[4][4],
const float winmat[4][4],
const char *viewname)
{
/* update the viewport matrices with the new camera */
@ -1667,8 +1667,8 @@ void ED_view3d_draw_offscreen(Depsgraph *depsgraph,
ARegion *region,
int winx,
int winy,
float viewmat[4][4],
float winmat[4][4],
const float viewmat[4][4],
const float winmat[4][4],
bool is_image_render,
bool do_sky,
bool UNUSED(is_persp),
@ -1759,8 +1759,8 @@ void ED_view3d_draw_offscreen_simple(Depsgraph *depsgraph,
int winx,
int winy,
uint draw_flags,
float viewmat[4][4],
float winmat[4][4],
const float viewmat[4][4],
const float winmat[4][4],
float clip_start,
float clip_end,
bool is_image_render,
@ -2406,7 +2406,7 @@ struct RV3DMatrixStore *ED_view3d_mats_rv3d_backup(struct RegionView3D *rv3d)
copy_m4_m4(rv3dmat->viewinv, rv3d->viewinv);
copy_v4_v4(rv3dmat->viewcamtexcofac, rv3d->viewcamtexcofac);
rv3dmat->pixsize = rv3d->pixsize;
return (void *)rv3dmat;
return rv3dmat;
}
void ED_view3d_mats_rv3d_restore(struct RegionView3D *rv3d, struct RV3DMatrixStore *rv3dmat_pt)

@ -4868,7 +4868,9 @@ void VIEW3D_OT_background_image_remove(wmOperatorType *ot)
* Draw border or toggle off.
* \{ */
static void calc_local_clipping(float clip_local[6][4], BoundBox *clipbb, float mat[4][4])
static void calc_local_clipping(float clip_local[6][4],
const BoundBox *clipbb,
const float mat[4][4])
{
BoundBox clipbb_local;
float imat[4][4];
@ -4883,7 +4885,7 @@ static void calc_local_clipping(float clip_local[6][4], BoundBox *clipbb, float
ED_view3d_clipping_calc_from_boundbox(clip_local, &clipbb_local, is_negative_m4(mat));
}
void ED_view3d_clipping_local(RegionView3D *rv3d, float mat[4][4])
void ED_view3d_clipping_local(RegionView3D *rv3d, const float mat[4][4])
{
if (rv3d->rflag & RV3D_CLIPPING) {
calc_local_clipping(rv3d->clip_local, rv3d->clipbb, mat);

@ -303,12 +303,12 @@ eV3DProjStatus ED_view3d_project_float_object(const ARegion *region,
float ED_view3d_pixel_size(const RegionView3D *rv3d, const float co[3])
{
return mul_project_m4_v3_zfac((float(*)[4])rv3d->persmat, co) * rv3d->pixsize * U.pixelsize;
return mul_project_m4_v3_zfac(rv3d->persmat, co) * rv3d->pixsize * U.pixelsize;
}
float ED_view3d_pixel_size_no_ui_scale(const RegionView3D *rv3d, const float co[3])
{
return mul_project_m4_v3_zfac((float(*)[4])rv3d->persmat, co) * rv3d->pixsize;
return mul_project_m4_v3_zfac(rv3d->persmat, co) * rv3d->pixsize;
}
/**
@ -316,7 +316,7 @@ float ED_view3d_pixel_size_no_ui_scale(const RegionView3D *rv3d, const float co[
*/
float ED_view3d_calc_zfac(const RegionView3D *rv3d, const float co[3], bool *r_flip)
{
float zfac = mul_project_m4_v3_zfac((float(*)[4])rv3d->persmat, co);
float zfac = mul_project_m4_v3_zfac(rv3d->persmat, co);
if (r_flip) {
*r_flip = (zfac < 0.0f);
@ -483,11 +483,11 @@ void ED_view3d_global_to_vector(const RegionView3D *rv3d, const float coord[3],
p1[3] = 1.0f;
copy_v3_v3(p2, p1);
p2[3] = 1.0f;
mul_m4_v4((float(*)[4])rv3d->viewmat, p2);
mul_m4_v4(rv3d->viewmat, p2);
mul_v3_fl(p2, 2.0f);
mul_m4_v4((float(*)[4])rv3d->viewinv, p2);
mul_m4_v4(rv3d->viewinv, p2);
sub_v3_v3v3(vec, p1, p2);
}
@ -749,25 +749,26 @@ bool ED_view3d_win_to_segment_clipped(struct Depsgraph *depsgraph,
return true;
}
/* Utility functions for projection
* ******************************** */
/* -------------------------------------------------------------------- */
/** \name Utility functions for projection
* \{ */
void ED_view3d_ob_project_mat_get(const RegionView3D *rv3d, Object *ob, float pmat[4][4])
void ED_view3d_ob_project_mat_get(const RegionView3D *rv3d, Object *ob, float r_pmat[4][4])
{
float vmat[4][4];
mul_m4_m4m4(vmat, (float(*)[4])rv3d->viewmat, ob->obmat);
mul_m4_m4m4(pmat, (float(*)[4])rv3d->winmat, vmat);
mul_m4_m4m4(vmat, rv3d->viewmat, ob->obmat);
mul_m4_m4m4(r_pmat, rv3d->winmat, vmat);
}
void ED_view3d_ob_project_mat_get_from_obmat(const RegionView3D *rv3d,
float obmat[4][4],
float pmat[4][4])
const float obmat[4][4],
float r_pmat[4][4])
{
float vmat[4][4];
mul_m4_m4m4(vmat, (float(*)[4])rv3d->viewmat, obmat);
mul_m4_m4m4(pmat, (float(*)[4])rv3d->winmat, vmat);
mul_m4_m4m4(vmat, rv3d->viewmat, obmat);
mul_m4_m4m4(r_pmat, rv3d->winmat, vmat);
}
/**
@ -791,3 +792,5 @@ bool ED_view3d_unproject(
return GPU_matrix_unproject(region_co, rv3d->viewmat, rv3d->winmat, viewport, world);
}
/** \} */

@ -335,7 +335,7 @@ void ED_view3d_clipping_calc(
*
* \{ */
static bool view3d_boundbox_clip_m4(const BoundBox *bb, float persmatob[4][4])
static bool view3d_boundbox_clip_m4(const BoundBox *bb, const float persmatob[4][4])
{
int a, flag = -1, fl;
@ -1243,7 +1243,9 @@ float ED_view3d_radius_to_dist(const View3D *v3d,
* \param fallback_dist: The distance to use if the object is too near or in front of \a ofs.
* \returns A newly calculated distance or the fallback.
*/
float ED_view3d_offset_distance(float mat[4][4], const float ofs[3], const float fallback_dist)
float ED_view3d_offset_distance(const float mat[4][4],
const float ofs[3],
const float fallback_dist)
{
float pos[4] = {0.0f, 0.0f, 0.0f, 1.0f};
float dir[4] = {0.0f, 0.0f, 1.0f, 0.0f};
@ -1374,11 +1376,11 @@ static float view3d_quat_axis[6][4][4] = {
};
bool ED_view3d_quat_from_axis_view(const char view, const char view_axis_roll, float quat[4])
bool ED_view3d_quat_from_axis_view(const char view, const char view_axis_roll, float r_quat[4])
{
BLI_assert(view_axis_roll <= RV3D_VIEW_AXIS_ROLL_270);
if (RV3D_VIEW_IS_AXIS(view)) {
copy_qt_qt(quat, view3d_quat_axis[view - RV3D_VIEW_FRONT][view_axis_roll]);
copy_qt_qt(r_quat, view3d_quat_axis[view - RV3D_VIEW_FRONT][view_axis_roll]);
return true;
}
return false;

@ -37,7 +37,7 @@
#ifdef RNA_RUNTIME
static void rna_Curve_transform(Curve *cu, float *mat, bool shape_keys)
{
BKE_curve_transform(cu, (float(*)[4])mat, shape_keys, true);
BKE_curve_transform(cu, (const float(*)[4])mat, shape_keys, true);
DEG_id_tag_update(&cu->id, 0);
}

@ -367,8 +367,8 @@ struct RenderPass *RE_pass_find_by_type(volatile struct RenderLayer *rl,
#define RE_BAKE_AO 2
void RE_GetCameraWindow(struct Render *re, struct Object *camera, float mat[4][4]);
void RE_GetCameraWindowWithOverscan(struct Render *re, float mat[4][4], float overscan);
void RE_GetCameraModelMatrix(struct Render *re, struct Object *camera, float r_mat[4][4]);
void RE_GetCameraWindowWithOverscan(struct Render *re, float overscan, float r_winmat[4][4]);
void RE_GetCameraModelMatrix(struct Render *re, struct Object *camera, float r_modelmat[4][4]);
struct Scene *RE_GetScene(struct Render *re);
void RE_SetScene(struct Render *re, struct Scene *sce);

@ -211,14 +211,14 @@ void RE_SetCamera(Render *re, Object *cam_ob)
re_camera_params_get(re, &params);
}
void RE_GetCameraWindow(struct Render *re, struct Object *camera, float mat[4][4])
void RE_GetCameraWindow(struct Render *re, struct Object *camera, float r_winmat[4][4])
{
RE_SetCamera(re, camera);
copy_m4_m4(mat, re->winmat);
copy_m4_m4(r_winmat, re->winmat);
}
/* Must be called after RE_GetCameraWindow(), does not change re->winmat. */
void RE_GetCameraWindowWithOverscan(struct Render *re, float mat[4][4], float overscan)
void RE_GetCameraWindowWithOverscan(struct Render *re, float overscan, float r_winmat[4][4])
{
CameraParams params;
params.is_ortho = re->winmat[3][3] != 0.0f;
@ -233,12 +233,12 @@ void RE_GetCameraWindowWithOverscan(struct Render *re, float mat[4][4], float ov
params.viewplane.ymin -= overscan;
params.viewplane.ymax += overscan;
BKE_camera_params_compute_matrix(&params);
copy_m4_m4(mat, params.winmat);
copy_m4_m4(r_winmat, params.winmat);
}
void RE_GetCameraModelMatrix(Render *re, struct Object *camera, float r_mat[4][4])
void RE_GetCameraModelMatrix(Render *re, struct Object *camera, float r_modelmat[4][4])
{
BKE_camera_multiview_model_matrix(&re->r, camera, re->viewname, r_mat);
BKE_camera_multiview_model_matrix(&re->r, camera, re->viewname, r_modelmat);
}
/* ~~~~~~~~~~~~~~~~ part (tile) calculus ~~~~~~~~~~~~~~~~~~~~~~ */

Loading…
Cancel
Save