svn merge ^/trunk/blender -r47047:47058

This commit is contained in:
Campbell Barton
2012-05-26 22:31:28 +00:00
41 changed files with 255 additions and 254 deletions

View File

@@ -153,11 +153,11 @@ void FLUID_3D::setBorderObstacles()
{
// bottom slab
index = x + y * _xRes;
if(_domainBcBottom==1) _obstacles[index] = 1;
if(_domainBcBottom) _obstacles[index] = 1;
// top slab
index += _totalCells - _slabSize;
if(_domainBcTop==1) _obstacles[index] = 1;
if(_domainBcTop) _obstacles[index] = 1;
}
for (int z = 0; z < _zRes; z++)
@@ -165,11 +165,11 @@ void FLUID_3D::setBorderObstacles()
{
// front slab
index = x + z * _slabSize;
if(_domainBcFront==1) _obstacles[index] = 1;
if(_domainBcFront) _obstacles[index] = 1;
// back slab
index += _slabSize - _xRes;
if(_domainBcBack==1) _obstacles[index] = 1;
if(_domainBcBack) _obstacles[index] = 1;
}
for (int z = 0; z < _zRes; z++)
@@ -177,11 +177,11 @@ void FLUID_3D::setBorderObstacles()
{
// left slab
index = y * _xRes + z * _slabSize;
if(_domainBcLeft==1) _obstacles[index] = 1;
if(_domainBcLeft) _obstacles[index] = 1;
// right slab
index += _xRes - 1;
if(_domainBcRight==1) _obstacles[index] = 1;
if(_domainBcRight) _obstacles[index] = 1;
}
}
@@ -449,48 +449,7 @@ void FLUID_3D::setBorderCollisions() {
// set side obstacles
int index;
for (int y = 0; y < _yRes; y++)
for (int x = 0; x < _xRes; x++)
{
// front slab
index = x + y * _xRes;
if(_domainBcBottom==1) _obstacles[index] = 1;
else _obstacles[index] = 0;
// back slab
index += _totalCells - _slabSize;
if(_domainBcTop==1) _obstacles[index] = 1;
else _obstacles[index] = 0;
}
for (int z = 0; z < _zRes; z++)
for (int x = 0; x < _xRes; x++)
{
// bottom slab
index = x + z * _slabSize;
if(_domainBcFront==1) _obstacles[index] = 1;
else _obstacles[index] = 0;
// top slab
index += _slabSize - _xRes;
if(_domainBcBack==1) _obstacles[index] = 1;
else _obstacles[index] = 0;
}
for (int z = 0; z < _zRes; z++)
for (int y = 0; y < _yRes; y++)
{
// left slab
index = y * _xRes + z * _slabSize;
if(_domainBcLeft==1) _obstacles[index] = 1;
else _obstacles[index] = 0;
// right slab
index += _xRes - 1;
if(_domainBcRight==1) _obstacles[index] = 1;
else _obstacles[index] = 0;
}
setBorderObstacles();
}
//////////////////////////////////////////////////////////////////////
@@ -813,13 +772,13 @@ void FLUID_3D::project()
setObstacleBoundaries(_pressure, 0, _zRes);
// copy out the boundaries
if(_domainBcLeft == 0) setNeumannX(_xVelocity, _res, 0, _zRes);
if(!_domainBcLeft) setNeumannX(_xVelocity, _res, 0, _zRes);
else setZeroX(_xVelocity, _res, 0, _zRes);
if(_domainBcFront == 0) setNeumannY(_yVelocity, _res, 0, _zRes);
if(!_domainBcFront) setNeumannY(_yVelocity, _res, 0, _zRes);
else setZeroY(_yVelocity, _res, 0, _zRes);
if(_domainBcTop == 0) setNeumannZ(_zVelocity, _res, 0, _zRes);
if(!_domainBcTop) setNeumannZ(_zVelocity, _res, 0, _zRes);
else setZeroZ(_zVelocity, _res, 0, _zRes);
/*
@@ -1369,13 +1328,13 @@ void FLUID_3D::advectMacCormackBegin(int zBegin, int zEnd)
{
Vec3Int res = Vec3Int(_xRes,_yRes,_zRes);
if(_domainBcLeft == 0) copyBorderX(_xVelocityOld, res, zBegin, zEnd);
if(!_domainBcLeft) copyBorderX(_xVelocityOld, res, zBegin, zEnd);
else setZeroX(_xVelocityOld, res, zBegin, zEnd);
if(_domainBcFront == 0) copyBorderY(_yVelocityOld, res, zBegin, zEnd);
if(!_domainBcFront) copyBorderY(_yVelocityOld, res, zBegin, zEnd);
else setZeroY(_yVelocityOld, res, zBegin, zEnd);
if(_domainBcTop == 0) copyBorderZ(_zVelocityOld, res, zBegin, zEnd);
if(!_domainBcTop) copyBorderZ(_zVelocityOld, res, zBegin, zEnd);
else setZeroZ(_zVelocityOld, res, zBegin, zEnd);
}
@@ -1423,13 +1382,13 @@ void FLUID_3D::advectMacCormackEnd2(int zBegin, int zEnd)
advectFieldMacCormack2(dt0, _xVelocityOld, _yVelocityOld, _zVelocityOld, _yVelocityOld, _yVelocityTemp, _yVelocity, t1, res, _obstacles, zBegin, zEnd);
advectFieldMacCormack2(dt0, _xVelocityOld, _yVelocityOld, _zVelocityOld, _zVelocityOld, _zVelocityTemp, _zVelocity, t1, res, _obstacles, zBegin, zEnd);
if(_domainBcLeft == 0) copyBorderX(_xVelocityTemp, res, zBegin, zEnd);
if(!_domainBcLeft) copyBorderX(_xVelocityTemp, res, zBegin, zEnd);
else setZeroX(_xVelocityTemp, res, zBegin, zEnd);
if(_domainBcFront == 0) copyBorderY(_yVelocityTemp, res, zBegin, zEnd);
if(!_domainBcFront) copyBorderY(_yVelocityTemp, res, zBegin, zEnd);
else setZeroY(_yVelocityTemp, res, zBegin, zEnd);
if(_domainBcTop == 0) copyBorderZ(_zVelocityTemp, res, zBegin, zEnd);
if(!_domainBcTop) copyBorderZ(_zVelocityTemp, res, zBegin, zEnd);
else setZeroZ(_zVelocityTemp, res, zBegin, zEnd);
setZeroBorder(_density, res, zBegin, zEnd);

View File

@@ -92,19 +92,15 @@ void FLUID_3D::setNeumannX(float* field, Vec3Int res, int zBegin, int zEnd)
// left slab
index = y * res[0] + z * slabSize;
field[index] = field[index + 2];
/* only allow outwards flux */
if(field[index]>0.) field[index] = 0.;
index += 1;
if(field[index]>0.) field[index] = 0.;
// right slab
index += res[0] - 1;
index = y * res[0] + z * slabSize + res[0] - 1;
field[index] = field[index - 2];
}
// fix, force top slab to only allow outwards flux
for (int y = 0; y < res[1]; y++)
for (int z = zBegin; z < zEnd; z++)
{
// top slab
index = y * res[0] + z * slabSize;
index += res[0] - 1;
/* only allow outwards flux */
if(field[index]<0.) field[index] = 0.;
index -= 1;
if(field[index]<0.) field[index] = 0.;
@@ -121,27 +117,22 @@ void FLUID_3D::setNeumannY(float* field, Vec3Int res, int zBegin, int zEnd)
for (int z = zBegin; z < zEnd; z++)
for (int x = 0; x < res[0]; x++)
{
// bottom slab
// front slab
index = x + z * slabSize;
field[index] = field[index + 2 * res[0]];
/* only allow outwards flux */
if(field[index]>0.) field[index] = 0.;
index += res[0];
if(field[index]>0.) field[index] = 0.;
// top slab
index += slabSize - res[0];
// back slab
index = x + z * slabSize + slabSize - res[0];
field[index] = field[index - 2 * res[0]];
}
// fix, force top slab to only allow outwards flux
for (int z = zBegin; z < zEnd; z++)
for (int x = 0; x < res[0]; x++)
{
// top slab
index = x + z * slabSize;
index += slabSize - res[0];
/* only allow outwards flux */
if(field[index]<0.) field[index] = 0.;
index -= res[0];
if(field[index]<0.) field[index] = 0.;
}
}
//////////////////////////////////////////////////////////////////////
@@ -154,43 +145,33 @@ void FLUID_3D::setNeumannZ(float* field, Vec3Int res, int zBegin, int zEnd)
const int cellsslab = totalCells - slabSize;
int index;
index = 0;
if (zBegin == 0)
for (int y = 0; y < res[1]; y++)
for (int x = 0; x < res[0]; x++, index++)
{
// front slab
field[index] = field[index + 2 * slabSize];
}
if (zBegin == 0) {
for (int y = 0; y < res[1]; y++)
for (int x = 0; x < res[0]; x++)
{
// front slab
index = x + y * res[0];
field[index] = field[index + 2 * slabSize];
/* only allow outwards flux */
if(field[index]>0.) field[index] = 0.;
index += slabSize;
if(field[index]>0.) field[index] = 0.;
}
}
if (zEnd == res[2])
{
index = 0;
int indexx = 0;
for (int y = 0; y < res[1]; y++)
for (int x = 0; x < res[0]; x++, index++)
{
// back slab
indexx = index + cellsslab;
field[indexx] = field[indexx - 2 * slabSize];
}
// fix, force top slab to only allow outwards flux
for (int y = 0; y < res[1]; y++)
for (int x = 0; x < res[0]; x++)
{
// top slab
index = x + y * res[0];
index += cellsslab;
if(field[index]<0.) field[index] = 0.;
index -= slabSize;
if(field[index]<0.) field[index] = 0.;
}
} // zEnd == res[2]
if (zEnd == res[2]) {
for (int y = 0; y < res[1]; y++)
for (int x = 0; x < res[0]; x++)
{
// back slab
index = x + y * res[0] + cellsslab;
field[index] = field[index - 2 * slabSize];
/* only allow outwards flux */
if(field[index]<0.) field[index] = 0.;
index -= slabSize;
if(field[index]<0.) field[index] = 0.;
}
}
}

View File

@@ -734,7 +734,7 @@ static void pchan_deform_mat_add(bPoseChannel *pchan, float weight, float bbonem
}
static float dist_bone_deform(bPoseChannel *pchan, bPoseChanDeform *pdef_info, float vec[3], DualQuat *dq,
float mat[][3], float *co)
float mat[][3], const float co[3])
{
Bone *bone = pchan->bone;
float fac, contrib = 0.0;
@@ -781,7 +781,7 @@ static float dist_bone_deform(bPoseChannel *pchan, bPoseChanDeform *pdef_info, f
}
static void pchan_bone_deform(bPoseChannel *pchan, bPoseChanDeform *pdef_info, float weight, float vec[3], DualQuat *dq,
float mat[][3], float *co, float *contrib)
float mat[][3], const float co[3], float *contrib)
{
float cop[3], bbonemat[3][3];
DualQuat bbonedq;

View File

@@ -592,10 +592,12 @@ static ImBuf *add_ibuf_size(unsigned int width, unsigned int height, const char
if (floatbuf) {
ibuf = IMB_allocImBuf(width, height, depth, IB_rectfloat);
rect_float = (float *)ibuf->rect_float;
ibuf->profile = IB_PROFILE_LINEAR_RGB;
}
else {
ibuf = IMB_allocImBuf(width, height, depth, IB_rect);
rect = (unsigned char *)ibuf->rect;
ibuf->profile = IB_PROFILE_SRGB;
}
BLI_strncpy(ibuf->name, name, sizeof(ibuf->name));

View File

@@ -83,8 +83,6 @@
#endif
typedef void (*Shrinkwrap_ForeachVertexCallback)(DerivedMesh *target, float *co, float *normal);
/* get derived mesh */
//TODO is anyfunction that does this? returning the derivedFinal without we caring if its in edit mode or not?
DerivedMesh *object_get_derived_final(Object *ob)
@@ -109,23 +107,23 @@ void space_transform_from_matrixs(SpaceTransform *data, float local[4][4], float
invert_m4_m4(data->target2local, data->local2target);
}
void space_transform_apply(const SpaceTransform *data, float *co)
void space_transform_apply(const SpaceTransform *data, float co[3])
{
mul_v3_m4v3(co, ((SpaceTransform *)data)->local2target, co);
}
void space_transform_invert(const SpaceTransform *data, float *co)
void space_transform_invert(const SpaceTransform *data, float co[3])
{
mul_v3_m4v3(co, ((SpaceTransform *)data)->target2local, co);
}
static void space_transform_apply_normal(const SpaceTransform *data, float *no)
static void space_transform_apply_normal(const SpaceTransform *data, float no[3])
{
mul_mat3_m4_v3(((SpaceTransform *)data)->local2target, no);
normalize_v3(no); // TODO: could we just determine de scale value from the matrix?
}
static void space_transform_invert_normal(const SpaceTransform *data, float *no)
static void space_transform_invert_normal(const SpaceTransform *data, float no[3])
{
mul_mat3_m4_v3(((SpaceTransform *)data)->target2local, no);
normalize_v3(no); // TODO: could we just determine de scale value from the matrix?
@@ -211,7 +209,7 @@ static void shrinkwrap_calc_nearest_vertex(ShrinkwrapCalcData *calc)
* MOD_SHRINKWRAP_CULL_TARGET_FRONTFACE (front faces hits are ignored)
* MOD_SHRINKWRAP_CULL_TARGET_BACKFACE (back faces hits are ignored)
*/
int normal_projection_project_vertex(char options, const float *vert, const float *dir, const SpaceTransform *transf, BVHTree *tree, BVHTreeRayHit *hit, BVHTree_RayCastCallback callback, void *userdata)
int normal_projection_project_vertex(char options, const float vert[3], const float dir[3], const SpaceTransform *transf, BVHTree *tree, BVHTreeRayHit *hit, BVHTree_RayCastCallback callback, void *userdata)
{
float tmp_co[3], tmp_no[3];
const float *co, *no;

View File

@@ -50,17 +50,17 @@ KDTree *BLI_kdtree_new(int maxsize);
void BLI_kdtree_free(KDTree *tree);
/* Construction: first insert points, then call balance. Normal is optional. */
void BLI_kdtree_insert(KDTree *tree, int index, float *co, float *nor);
void BLI_kdtree_insert(KDTree *tree, int index, const float co[3], const float nor[3]);
void BLI_kdtree_balance(KDTree *tree);
/* Find nearest returns index, and -1 if no node is found.
* Find n nearest returns number of points found, with results in nearest.
* Normal is optional, but if given will limit results to points in normal direction from co. */
int BLI_kdtree_find_nearest(KDTree *tree, float *co, float *nor, KDTreeNearest *nearest);
int BLI_kdtree_find_n_nearest(KDTree *tree, int n, float *co, float *nor, KDTreeNearest *nearest);
int BLI_kdtree_find_n_nearest(KDTree *tree, int n, const float co[3], const float nor[3], KDTreeNearest *nearest);
/* Range search returns number of points found, with results in nearest */
/* Normal is optional, but if given will limit results to points in normal direction from co. */
/* Remember to free nearest after use! */
int BLI_kdtree_range_search(KDTree *tree, float range, float *co, float *nor, KDTreeNearest **nearest);
int BLI_kdtree_range_search(KDTree *tree, float range, const float co[3], const float nor[3], KDTreeNearest **nearest);
#endif

View File

@@ -73,7 +73,7 @@ void BLI_kdtree_free(KDTree *tree)
}
}
void BLI_kdtree_insert(KDTree *tree, int index, float *co, float *nor)
void BLI_kdtree_insert(KDTree *tree, int index, const float co[3], const float nor[3])
{
KDTreeNode *node = &tree->nodes[tree->totnode++];
@@ -132,7 +132,7 @@ void BLI_kdtree_balance(KDTree *tree)
tree->root = kdtree_balance(tree->nodes, tree->totnode, 0);
}
static float squared_distance(const float v2[3], const float v1[3], float *UNUSED(n1), float *n2)
static float squared_distance(const float v2[3], const float v1[3], const float *UNUSED(n1), const float *n2)
{
float d[3], dist;
@@ -258,7 +258,7 @@ static void add_nearest(KDTreeNearest *ptn, int *found, int n, int index, float
}
/* finds the nearest n entries in tree to specified coordinates */
int BLI_kdtree_find_n_nearest(KDTree *tree, int n, float *co, float *nor, KDTreeNearest *nearest)
int BLI_kdtree_find_n_nearest(KDTree *tree, int n, const float co[3], const float nor[3], KDTreeNearest *nearest)
{
KDTreeNode *root, *node = NULL;
KDTreeNode **stack, *defaultstack[100];
@@ -373,7 +373,7 @@ static void add_in_range(KDTreeNearest **ptn, int found, int *totfoundstack, int
to->dist = sqrt(dist);
copy_v3_v3(to->co, co);
}
int BLI_kdtree_range_search(KDTree *tree, float range, float *co, float *nor, KDTreeNearest **nearest)
int BLI_kdtree_range_search(KDTree *tree, float range, const float co[3], const float nor[3], KDTreeNearest **nearest)
{
KDTreeNode *root, *node = NULL;
KDTreeNode **stack, *defaultstack[100];

View File

@@ -114,7 +114,7 @@ LIBIMPORT void IMB_rectcpy(struct ImBuf *dbuf, struct ImBuf *sbuf,
int destx, int desty, int srcx, int srcy, int width, int height);
LIBIMPORT void IMB_rectfill(struct ImBuf *drect, const float col[4]);
LIBIMPORT void IMB_rectfill_area(struct ImBuf *ibuf, float *col, int x1, int y1, int x2, int y2);
LIBIMPORT void IMB_rectfill_area(struct ImBuf *ibuf, const float col[4], int x1, int y1, int x2, int y2);
LIBIMPORT void buf_rectfill_area(unsigned char *rect, float *rectf, int width, int height, const float col[4], int x1, int y1, int x2, int y2);
LIBIMPORT void IMB_rectfill_alpha(struct ImBuf *drect, const float value);

View File

@@ -42,7 +42,7 @@ int nextAdaptativeSubdivision(struct ToolSettings *toolsettings, struct BArcIter
struct EditBone *subdivideArcBy(struct ToolSettings *toolsettings, struct bArmature *arm, ListBase *editbones, struct BArcIterator *iter, float invmat[][4], float tmat[][3], NextSubdivisionFunc next_subdividion);
void setBoneRollFromNormal(struct EditBone *bone, float *no, float invmat[][4], float tmat[][3]);
void setBoneRollFromNormal(struct EditBone *bone, const float no[3], float invmat[][4], float tmat[][3]);
#endif /* __BIF_GENERATE_H__ */

View File

@@ -50,7 +50,7 @@
#include "armature_intern.h"
#include "BIF_generate.h"
void setBoneRollFromNormal(EditBone *bone, float *no, float UNUSED(invmat[][4]), float tmat[][3])
void setBoneRollFromNormal(EditBone *bone, const float no[3], float UNUSED(invmat[][4]), float tmat[][3])
{
if (no != NULL && !is_zero_v3(no)) {
float normal[3];

View File

@@ -120,18 +120,19 @@ void ED_object_toggle_modes(struct bContext *C, int mode);
void ED_object_exit_editmode(struct bContext *C, int flag);
void ED_object_enter_editmode(struct bContext *C, int flag);
void ED_object_location_from_view(struct bContext *C, float *loc);
void ED_object_rotation_from_view(struct bContext *C, float *rot);
void ED_object_base_init_transform(struct bContext *C, struct Base *base, float *loc, float *rot);
float ED_object_new_primitive_matrix(struct bContext *C, struct Object *editob, float *loc, float *rot, float primmat[][4]);
void ED_object_location_from_view(struct bContext *C, float loc[3]);
void ED_object_rotation_from_view(struct bContext *C, float rot[3]);
void ED_object_base_init_transform(struct bContext *C, struct Base *base, const float loc[3], const float rot[3]);
float ED_object_new_primitive_matrix(struct bContext *C, struct Object *editob,
const float loc[3], const float rot[3], float primmat[][4]);
void ED_object_add_generic_props(struct wmOperatorType *ot, int do_editmode);
int ED_object_add_generic_invoke(struct bContext *C, struct wmOperator *op, struct wmEvent *event);
int ED_object_add_generic_get_opts(struct bContext *C, struct wmOperator *op,
float *loc, float *rot, int *enter_editmode, unsigned int *layer, int *is_view_aligned);
int ED_object_add_generic_get_opts(struct bContext *C, struct wmOperator *op, float loc[3], float rot[3],
int *enter_editmode, unsigned int *layer, int *is_view_aligned);
struct Object *ED_object_add_type(struct bContext *C, int type, float *loc,
float *rot, int enter_editmode, unsigned int layer);
struct Object *ED_object_add_type(struct bContext *C, int type, const float loc[3], const float rot[3],
int enter_editmode, unsigned int layer);
void ED_object_single_users(struct Main *bmain, struct Scene *scene, int full);
void ED_object_single_user(struct Scene *scene, struct Object *ob);
@@ -165,13 +166,17 @@ enum {
MODIFIER_APPLY_SHAPE
};
struct ModifierData *ED_object_modifier_add(struct ReportList *reports, struct Main *bmain, struct Scene *scene, struct Object *ob, const char *name, int type);
int ED_object_modifier_remove(struct ReportList *reports, struct Main *bmain, struct Scene *scene, struct Object *ob, struct ModifierData *md);
struct ModifierData *ED_object_modifier_add(struct ReportList *reports, struct Main *bmain, struct Scene *scene,
struct Object *ob, const char *name, int type);
int ED_object_modifier_remove(struct ReportList *reports, struct Main *bmain, struct Scene *scene,
struct Object *ob, struct ModifierData *md);
void ED_object_modifier_clear(struct Main *bmain, struct Scene *scene, struct Object *ob);
int ED_object_modifier_move_down(struct ReportList *reports, struct Object *ob, struct ModifierData *md);
int ED_object_modifier_move_up(struct ReportList *reports, struct Object *ob, struct ModifierData *md);
int ED_object_modifier_convert(struct ReportList *reports, struct Main *bmain, struct Scene *scene, struct Object *ob, struct ModifierData *md);
int ED_object_modifier_apply(struct ReportList *reports, struct Scene *scene, struct Object *ob, struct ModifierData *md, int mode);
int ED_object_modifier_convert(struct ReportList *reports, struct Main *bmain, struct Scene *scene,
struct Object *ob, struct ModifierData *md);
int ED_object_modifier_apply(struct ReportList *reports, struct Scene *scene,
struct Object *ob, struct ModifierData *md, int mode);
int ED_object_modifier_copy(struct ReportList *reports, struct Object *ob, struct ModifierData *md);
#ifdef __cplusplus

View File

@@ -55,7 +55,7 @@
/* uses context to figure out transform for primitive */
/* returns standard diameter */
static float new_primitive_matrix(bContext *C, float *loc, float *rot, float primmat[][4])
static float new_primitive_matrix(bContext *C, const float loc[3], const float rot[3], float primmat[][4])
{
Object *obedit = CTX_data_edit_object(C);
View3D *v3d = CTX_wm_view3d(C);
@@ -85,7 +85,7 @@ static float new_primitive_matrix(bContext *C, float *loc, float *rot, float pri
static void make_prim_init(bContext *C, const char *idname,
float *dia, float mat[][4],
int *state, float *loc, float *rot, unsigned int layer)
int *state, const float loc[3], const float rot[3], const unsigned int layer)
{
Object *obedit = CTX_data_edit_object(C);

View File

@@ -380,7 +380,7 @@ static BMFace *edge_ray_cast(BMBVHTree *tree, float *co, float *dir, float *hito
return f;
}
static void scale_point(float *c1, float *p, float s)
static void scale_point(float c1[3], const float p[3], const float s)
{
sub_v3_v3(c1, p);
mul_v3_fl(c1, s);

View File

@@ -120,7 +120,7 @@ EnumPropertyItem lamp_type_items[] = {
/************************** Exported *****************************/
void ED_object_location_from_view(bContext *C, float *loc)
void ED_object_location_from_view(bContext *C, float loc[3])
{
View3D *v3d = CTX_wm_view3d(C);
Scene *scene = CTX_data_scene(C);
@@ -131,7 +131,7 @@ void ED_object_location_from_view(bContext *C, float *loc)
copy_v3_v3(loc, cursor);
}
void ED_object_rotation_from_view(bContext *C, float *rot)
void ED_object_rotation_from_view(bContext *C, float rot[3])
{
RegionView3D *rv3d = CTX_wm_region_view3d(C);
if (rv3d) {
@@ -145,7 +145,7 @@ void ED_object_rotation_from_view(bContext *C, float *rot)
}
}
void ED_object_base_init_transform(bContext *C, Base *base, float *loc, float *rot)
void ED_object_base_init_transform(bContext *C, Base *base, const float loc[3], const float rot[3])
{
Object *ob = base->object;
Scene *scene = CTX_data_scene(C);
@@ -163,7 +163,8 @@ void ED_object_base_init_transform(bContext *C, Base *base, float *loc, float *r
/* uses context to figure out transform for primitive */
/* returns standard diameter */
float ED_object_new_primitive_matrix(bContext *C, Object *obedit, float *loc, float *rot, float primmat[][4])
float ED_object_new_primitive_matrix(bContext *C, Object *obedit,
const float loc[3], const float rot[3], float primmat[][4])
{
View3D *v3d = CTX_wm_view3d(C);
float mat[3][3], rmat[3][3], cmat[3][3], imat[3][3];
@@ -260,8 +261,8 @@ int ED_object_add_generic_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(ev
return op->type->exec(C, op);
}
int ED_object_add_generic_get_opts(bContext *C, wmOperator *op, float *loc,
float *rot, int *enter_editmode, unsigned int *layer, int *is_view_aligned)
int ED_object_add_generic_get_opts(bContext *C, wmOperator *op, float loc[3], float rot[3],
int *enter_editmode, unsigned int *layer, int *is_view_aligned)
{
View3D *v3d = CTX_wm_view3d(C);
int a, layer_values[20];
@@ -324,7 +325,7 @@ int ED_object_add_generic_get_opts(bContext *C, wmOperator *op, float *loc,
/* for object add primitive operators */
/* do not call undo push in this function (users of this function have to) */
Object *ED_object_add_type(bContext *C, int type, float *loc, float *rot,
Object *ED_object_add_type(bContext *C, int type, const float loc[3], const float rot[3],
int enter_editmode, unsigned int layer)
{
Main *bmain = CTX_data_main(C);

View File

@@ -88,6 +88,7 @@
#include "object_intern.h"
static void modifier_skin_customdata_ensure(struct Object *ob);
static void modifier_skin_customdata_delete(struct Object *ob);
/******************************** API ****************************/
@@ -231,6 +232,21 @@ static int object_modifier_remove(Object *ob, ModifierData *md, int *sort_depsgr
multires_customdata_delete(ob->data);
}
}
else if (md->type == eModifierType_Skin) {
int ok = 1;
ModifierData *tmpmd;
/* ensure skin CustomData layer isn't used by another skin modifier */
for (tmpmd = ob->modifiers.first; tmpmd; tmpmd = tmpmd->next) {
if (tmpmd != md && tmpmd->type == eModifierType_Skin) {
ok = 0;
break;
}
}
if (ok)
modifier_skin_customdata_delete(ob);
}
if (ELEM(md->type, eModifierType_Softbody, eModifierType_Cloth) &&
ob->particlesystem.first == NULL)
@@ -1369,6 +1385,17 @@ static void modifier_skin_customdata_ensure(Object *ob)
}
}
static void modifier_skin_customdata_delete(Object *ob)
{
Mesh *me = ob->data;
BMEditMesh *em = me->edit_btmesh;
if (em)
BM_data_layer_free(em->bm, &em->bm->vdata, CD_MVERT_SKIN);
else
CustomData_free_layer_active(&me->vdata, CD_MVERT_SKIN, me->totvert);
}
static int skin_poll(bContext *C)
{
return (!CTX_data_edit_object(C) &&

View File

@@ -328,21 +328,15 @@ void clip_draw_dopesheet_channels(const bContext *C, ARegion *ar)
IN_RANGE(ymaxc, v2d->cur.ymin, v2d->cur.ymax))
{
MovieTrackingTrack *track = channel->track;
uiBut *but;
const int icon = (track->flag & TRACK_LOCKED) ? ICON_LOCKED : ICON_UNLOCKED;
PointerRNA ptr;
int icon;
RNA_pointer_create(&clip->id, &RNA_MovieTrackingTrack, track, &ptr);
if (track->flag & TRACK_LOCKED)
icon = ICON_LOCKED;
else
icon = ICON_UNLOCKED;
uiBlockSetEmboss(block, UI_EMBOSSN);
but = uiDefIconButR(block, ICONTOG, 1, icon,
v2d->cur.xmax - UI_UNIT_X - CHANNEL_PAD, y - UI_UNIT_Y / 2.0f,
UI_UNIT_X, UI_UNIT_Y, &ptr, "lock", 0, 0, 0, 0, 0, NULL);
uiDefIconButR(block, ICONTOG, 1, icon,
v2d->cur.xmax - UI_UNIT_X - CHANNEL_PAD, y - UI_UNIT_Y / 2.0f,
UI_UNIT_X, UI_UNIT_Y, &ptr, "lock", 0, 0, 0, 0, 0, NULL);
uiBlockSetEmboss(block, UI_EMBOSS);
}

View File

@@ -146,7 +146,7 @@ static int intersect_edges(float *points, float a, float b, float c, float d, fl
return numpoints;
}
static int convex(float *p0, float *up, float *a, float *b)
static int convex(const float p0[3], const float up[3], const float a[3], const float b[3])
{
// Vec3 va = a-p0, vb = b-p0;
float va[3], vb[3], tmp[3];

View File

@@ -5415,7 +5415,7 @@ typedef struct TransDataTracking {
static void markerToTransDataInit(TransData *td, TransData2D *td2d, TransDataTracking *tdt,
MovieTrackingTrack *track, MovieTrackingMarker *marker,
int area, float *loc, float *rel, float *off, float aspx, float aspy)
int area, float loc[2], float rel[2], const float off[2], float aspx, float aspy)
{
int anchor = area == TRACK_AREA_POINT && off;

View File

@@ -3596,7 +3596,7 @@ typedef struct SmoothNode {
int axis, ntri;
} SmoothNode;
static void p_barycentric_2d(float *v1, float *v2, float *v3, float *p, float *b)
static void p_barycentric_2d(const float v1[2], const float v2[2], const float v3[2], float p[2], float b[2])
{
float a[2], c[2], h[2], div;

View File

@@ -480,7 +480,7 @@ void IMB_freezbuffloatImBuf(struct ImBuf *ibuf);
* \attention Defined in rectop.c
*/
void IMB_rectfill(struct ImBuf *drect, const float col[4]);
void IMB_rectfill_area(struct ImBuf *ibuf, float *col, int x1, int y1, int x2, int y2);
void IMB_rectfill_area(struct ImBuf *ibuf, const float col[4], int x1, int y1, int x2, int y2);
void IMB_rectfill_alpha(struct ImBuf *ibuf, const float value);
/* this should not be here, really, we needed it for operating on render data, IMB_rectfill_area calls it */

View File

@@ -566,7 +566,7 @@ void buf_rectfill_area(unsigned char *rect, float *rectf, int width, int height,
}
}
void IMB_rectfill_area(struct ImBuf *ibuf, float *col, int x1, int y1, int x2, int y2)
void IMB_rectfill_area(struct ImBuf *ibuf, const float col[4], int x1, int y1, int x2, int y2)
{
if (!ibuf) return;
buf_rectfill_area((unsigned char *) ibuf->rect, ibuf->rect_float, ibuf->x, ibuf->y, col, x1, y1, x2, y2);

View File

@@ -53,6 +53,7 @@ static EnumPropertyItem image_source_items[] = {
#ifdef RNA_RUNTIME
#include "IMB_imbuf.h"
#include "IMB_imbuf_types.h"
static void rna_Image_animated_update(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *ptr)
@@ -287,6 +288,15 @@ static int rna_Image_depth_get(PointerRNA *ptr)
return planes;
}
static int rna_Image_frame_duration_get(PointerRNA *ptr)
{
Image *im = (Image *)ptr->data;
if (im->anim)
return IMB_anim_get_duration(im->anim, IMB_TC_RECORD_RUN);
return 1;
}
static int rna_Image_pixels_get_length(PointerRNA *ptr, int length[RNA_MAX_ARRAY_DIMENSION])
{
Image *ima = ptr->id.data;
@@ -629,6 +639,11 @@ static void rna_def_image(BlenderRNA *brna)
prop = RNA_def_float_vector(srna, "resolution", 2, NULL, 0, 0, "Resolution", "X/Y pixels per meter", 0, 0);
RNA_def_property_float_funcs(prop, "rna_Image_resolution_get", "rna_Image_resolution_set", NULL);
prop = RNA_def_property(srna, "frame_duration", PROP_INT, PROP_UNSIGNED);
RNA_def_property_int_funcs(prop, "rna_Image_frame_duration_get", NULL, NULL);
RNA_def_property_ui_text(prop, "Duration", "Duration (in frames) of the image (1 when not a video/sequence)");
RNA_def_property_clear_flag(prop, PROP_EDITABLE);
prop = RNA_def_property(srna, "pixels", PROP_FLOAT, PROP_NONE);
RNA_def_property_flag(prop, PROP_DYNAMIC);
RNA_def_property_multi_array(prop, 1, NULL);

View File

@@ -36,30 +36,30 @@
* add 1 pixel to into filtered three lines
* (float vecs to float vec)
*/
void add_filt_fmask(unsigned int mask, float *col, float *rowbuf, int row_w);
void add_filt_fmask(unsigned int mask, const float col[4], float *rowbuf, int row_w);
void add_filt_fmask_pixsize(unsigned int mask, float *in, float *rowbuf, int row_w, int pixsize);
void add_filt_fmask_coord(float filt[][3], float *col, float *rowbuf, int row_w, int col_h, int x, int y);
void add_filt_fmask_coord(float filt[][3], const float col[4], float *rowbuf, int row_w, int col_h, int x, int y);
void mask_array(unsigned int mask, float filt[][3]);
/**
* Alpha-over blending for floats.
*/
void addAlphaOverFloat(float *dest, float *source);
void addAlphaOverFloat(float dest[4], const float source[4]);
/**
* Alpha-under blending for floats.
*/
void addAlphaUnderFloat(float *dest, float *source);
void addAlphaUnderFloat(float dest[4], const float source[4]);
/**
* Same for floats
*/
void addalphaAddfacFloat(float *dest, float *source, char addfac);
void addalphaAddfacFloat(float dest[4], const float source[4], char addfac);
/**
* dest = dest + source
*/
void addalphaAddFloat(float *dest, float *source);
void addalphaAddFloat(float dest[4], const float source[4]);
#endif /* __PIXELBLENDING_H__ */

View File

@@ -97,8 +97,13 @@ struct VlakRen *RE_findOrAddVlak(struct ObjectRen *obr, int nr);
struct VertRen *RE_findOrAddVert(struct ObjectRen *obr, int nr);
struct StrandRen *RE_findOrAddStrand(struct ObjectRen *obr, int nr);
struct HaloRen *RE_findOrAddHalo(struct ObjectRen *obr, int nr);
struct HaloRen *RE_inithalo(struct Render *re, struct ObjectRen *obr, struct Material *ma, float *vec, float *vec1, float *orco, float hasize, float vectsize, int seed);
struct HaloRen *RE_inithalo_particle(struct Render *re, struct ObjectRen *obr, struct DerivedMesh *dm, struct Material *ma, float *vec, float *vec1, float *orco, float *uvco, float hasize, float vectsize, int seed, float *pa_co);
struct HaloRen *RE_inithalo(struct Render *re, struct ObjectRen *obr, struct Material *ma,
const float vec[3], const float vec1[3],
const float *orco, float hasize, float vectsize, int seed);
struct HaloRen *RE_inithalo_particle(struct Render *re, struct ObjectRen *obr, struct DerivedMesh *dm, struct Material *ma,
const float vec[3], const float vec1[3],
const float *orco, const float *uvco, float hasize, float vectsize, int seed,
const float pa_co[3]);
struct StrandBuffer *RE_addStrandBuffer(struct ObjectRen *obr, int totvert);
struct ObjectRen *RE_addRenderObject(struct Render *re, struct Object *ob, struct Object *par, int index, int psysindex, int lay);

View File

@@ -96,7 +96,7 @@ ListBase *get_lights(struct ShadeInput *shi);
float lamp_get_visibility(struct LampRen *lar, const float co[3], float lv[3], float *dist);
void lamp_get_shadow(struct LampRen *lar, ShadeInput *shi, float inp, float shadfac[4], int do_real);
float fresnel_fac(float *view, float *vn, float fresnel, float fac);
float fresnel_fac(const float view[3], const float vn[3], float fresnel, float fac);
/* rayshade.c */
extern void shade_ray(struct Isect *is, struct ShadeInput *shi, struct ShadeResult *shr);

View File

@@ -42,13 +42,13 @@ struct ScatterTree;
typedef struct ScatterTree ScatterTree;
ScatterSettings *scatter_settings_new(float refl, float radius, float ior,
float reflfac, float frontweight, float backweight);
float reflfac, float frontweight, float backweight);
void scatter_settings_free(ScatterSettings *ss);
ScatterTree *scatter_tree_new(ScatterSettings *ss[3], float scale, float error,
float (*co)[3], float (*color)[3], float *area, int totpoint);
float (*co)[3], float (*color)[3], float *area, int totpoint);
void scatter_tree_build(ScatterTree *tree);
void scatter_tree_sample(ScatterTree *tree, float *co, float *color);
void scatter_tree_sample(ScatterTree *tree, const float co[3], float color[3]);
void scatter_tree_free(ScatterTree *tree);
/* Internal renderer API */
@@ -61,7 +61,7 @@ void make_sss_tree(struct Render *re);
void sss_add_points(Render *re, float (*co)[3], float (*color)[3], float *area, int totpoint);
void free_sss(struct Render *re);
int sample_sss(struct Render *re, struct Material *mat, float *co, float *col);
int sample_sss(struct Render *re, struct Material *mat, const float co[3], float color[3]);
int sss_pass_done(struct Render *re, struct Material *mat);
#endif /*__SSS_H__*/

View File

@@ -67,7 +67,7 @@ void do_halo_tex(struct HaloRen *har, float xn, float yn, float col_r[4]);
void do_sky_tex(const float rco[3], float lo[3], const float dxyview[2], float hor[3], float zen[3], float *blend, int skyflag, short thread);
void do_material_tex(struct ShadeInput *shi, struct Render *re);
void do_lamp_tex(LampRen *la, const float lavec[3], struct ShadeInput *shi, float col_r[3], int effect);
void do_volume_tex(struct ShadeInput *shi, const float xyz[3], int mapto_flag, float col[3], float *val, struct Render *re);
void do_volume_tex(struct ShadeInput *shi, const float xyz[3], int mapto_flag, float col_r[3], float *val, struct Render *re);
void init_render_textures(Render *re);
void end_render_textures(Render *re);

View File

@@ -91,7 +91,7 @@ typedef struct ZSpan {
int rectx, recty; /* range for clipping */
int miny1, maxy1, miny2, maxy2; /* actual filled in range */
float *minp1, *maxp1, *minp2, *maxp2; /* vertex pointers detect min/max range in */
const float *minp1, *maxp1, *minp2, *maxp2; /* vertex pointers detect min/max range in */
float *span1, *span2;
float zmulx, zmuly, zofsx, zofsy; /* transform from hoco to zbuf co */
@@ -115,23 +115,26 @@ typedef struct ZSpan {
void *sss_handle; /* used by sss */
void (*sss_func)(void *, int, int, int, int, int);
void (*zbuffunc)(struct ZSpan *, int, int, float *, float *, float *, float *);
void (*zbuflinefunc)(struct ZSpan *, int, int, float *, float *);
void (*zbuffunc)(struct ZSpan *, int, int, const float *, const float *, const float *, const float *);
void (*zbuflinefunc)(struct ZSpan *, int, int, const float *, const float *);
} ZSpan;
/* exported to shadbuf.c */
void zbufclip4(struct ZSpan *zspan, int obi, int zvlnr, float *f1, float *f2, float *f3, float *f4, int c1, int c2, int c3, int c4);
void zbufclip4(struct ZSpan *zspan, int obi, int zvlnr, float *f1, float *f2, float *f3, float *f4,
int c1, int c2, int c3, int c4);
void zbuf_free_span(struct ZSpan *zspan);
void freepsA(struct ListBase *lb);
/* to rendercore.c */
void zspan_scanconvert(struct ZSpan *zpan, void *handle, float *v1, float *v2, float *v3, void (*func)(void *, int, int, float, float) );
void zspan_scanconvert(struct ZSpan *zpan, void *handle, float *v1, float *v2, float *v3,
void (*func)(void *, int, int, float, float) );
/* exported to edge render... */
void zbufclip(struct ZSpan *zspan, int obi, int zvlnr, float *f1, float *f2, float *f3, int c1, int c2, int c3);
void zbuf_alloc_span(struct ZSpan *zspan, int rectx, int recty, float clipcrop);
void zbufclipwire(struct ZSpan *zspan, int obi, int zvlnr, int ec, float *ho1, float *ho2, float *ho3, float *ho4, int c1, int c2, int c3, int c4);
void zbufclipwire(struct ZSpan *zspan, int obi, int zvlnr, int ec,
float *ho1, float *ho2, float *ho3, float *ho4, int c1, int c2, int c3, int c4);
/* exported to shadeinput.c */
void zbuf_make_winmat(Render *re, float winmat[][4]);

View File

@@ -130,7 +130,7 @@
/* ------------------------------------------------------------------------- */
/* this is a bad beast, since it is misused by the 3d view drawing as well. */
static HaloRen *initstar(Render *re, ObjectRen *obr, float *vec, float hasize)
static HaloRen *initstar(Render *re, ObjectRen *obr, const float vec[3], float hasize)
{
HaloRen *har;
float hoco[4];
@@ -1324,7 +1324,8 @@ static void static_particle_wire(ObjectRen *obr, Material *ma, const float vec[3
}
static void particle_curve(Render *re, ObjectRen *obr, DerivedMesh *dm, Material *ma, ParticleStrandData *sd, float *loc, float *loc1, int seed, float *pa_co)
static void particle_curve(Render *re, ObjectRen *obr, DerivedMesh *dm, Material *ma, ParticleStrandData *sd,
const float loc[3], const float loc1[3], int seed, float *pa_co)
{
HaloRen *har=0;

View File

@@ -586,7 +586,7 @@ void make_envmaps(Render *re)
/* ------------------------------------------------------------------------- */
static int envcube_isect(EnvMap *env, float *vec, float *answ)
static int envcube_isect(EnvMap *env, const float vec[3], float answ[2])
{
float labda;
int face;

View File

@@ -76,7 +76,7 @@ static void boxsample(ImBuf *ibuf, float minx, float miny, float maxx, float max
/* x and y have to be checked for image size */
static void ibuf_get_color(float *col, struct ImBuf *ibuf, int x, int y)
static void ibuf_get_color(float col[4], struct ImBuf *ibuf, int x, int y)
{
int ofs = y * ibuf->x + x;
@@ -637,7 +637,7 @@ enum {TXC_XMIR=1, TXC_YMIR, TXC_REPT, TXC_EXTD};
// similar to ibuf_get_color() but clips/wraps coords according to repeat/extend flags
// returns true if out of range in clipmode
static int ibuf_get_color_clip(float *col, ImBuf *ibuf, int x, int y, int extflag)
static int ibuf_get_color_clip(float col[4], ImBuf *ibuf, int x, int y, int extflag)
{
int clip = 0;
switch (extflag) {
@@ -695,7 +695,7 @@ static int ibuf_get_color_clip(float *col, ImBuf *ibuf, int x, int y, int extfla
}
// as above + bilerp
static int ibuf_get_color_clip_bilerp(float *col, ImBuf *ibuf, float u, float v, int intpol, int extflag)
static int ibuf_get_color_clip_bilerp(float col[4], ImBuf *ibuf, float u, float v, int intpol, int extflag)
{
if (intpol) {
float c00[4], c01[4], c10[4], c11[4];

View File

@@ -73,7 +73,7 @@ extern struct Render R;
/* ------------------------------------------------------------------------- */
void addAlphaOverFloat(float *dest, float *source)
void addAlphaOverFloat(float dest[4], const float source[4])
{
/* d = s + (1-alpha_s)d*/
float mul;
@@ -90,7 +90,7 @@ void addAlphaOverFloat(float *dest, float *source)
/* ------------------------------------------------------------------------- */
void addAlphaUnderFloat(float *dest, float *source)
void addAlphaUnderFloat(float dest[4], const float source[4])
{
float mul;
@@ -104,7 +104,7 @@ void addAlphaUnderFloat(float *dest, float *source)
/* ------------------------------------------------------------------------- */
void addalphaAddfacFloat(float *dest, float *source, char addfac)
void addalphaAddfacFloat(float dest[4], const float source[4], char addfac)
{
float m; /* weiging factor of destination */
float c; /* intermediate color */
@@ -148,7 +148,7 @@ void addalphaAddfacFloat(float *dest, float *source, char addfac)
/* ------------------------------------------------------------------------- */
/* filtered adding to scanlines */
void add_filt_fmask(unsigned int mask, float *col, float *rowbuf, int row_w)
void add_filt_fmask(unsigned int mask, const float col[4], float *rowbuf, int row_w)
{
/* calc the value of mask */
float **fmask1= R.samples->fmask1, **fmask2=R.samples->fmask2;
@@ -242,7 +242,7 @@ void mask_array(unsigned int mask, float filt[][3])
* --- --- ---
*/
void add_filt_fmask_coord(float filt[][3], float *col, float *rowbuf, int row_w, int col_h, int x, int y)
void add_filt_fmask_coord(float filt[][3], const float col[4], float *rowbuf, int row_w, int col_h, int x, int y)
{
float *fpoin[3][3];
float val, r, g, b, al, lfilt[3][3];
@@ -366,7 +366,7 @@ void add_filt_fmask_pixsize(unsigned int mask, float *in, float *rowbuf, int row
}
/* ------------------------------------------------------------------------- */
void addalphaAddFloat(float *dest, float *source)
void addalphaAddFloat(float dest[4], const float source[4])
{
/* Makes me wonder whether this is required... */

View File

@@ -280,8 +280,8 @@ static float haloZtoDist(int z)
* \param xn The x coordinate of the pixel relaticve to the center of the halo. given in pixels
* \param yn The y coordinate of the pixel relaticve to the center of the halo. given in pixels
*/
int shadeHaloFloat(HaloRen *har, float *col, int zz,
float dist, float xn, float yn, short flarec)
int shadeHaloFloat(HaloRen *har, float col[4], int zz,
float dist, float xn, float yn, short flarec)
{
/* fill in col */
float t, zn, radist, ringf=0.0f, linef=0.0f, alpha, si, co;

View File

@@ -604,7 +604,7 @@ static void reflection(float ref[3], float n[3], const float view[3], const floa
}
#if 0
static void color_combine(float *result, float fac1, float fac2, float *col1, float *col2)
static void color_combine(float *result, float fac1, float fac2, float col1[3], float col2[3])
{
float col1t[3], col2t[3];

View File

@@ -814,7 +814,7 @@ static int plugintex(Tex *tex, float *texvec, float *dxt, float *dyt, int osatex
}
static int cubemap_glob(float *n, float x, float y, float z, float *adr1, float *adr2)
static int cubemap_glob(const float n[3], float x, float y, float z, float *adr1, float *adr2)
{
float x1, y1, z1, nor[3];
int ret;
@@ -852,7 +852,7 @@ static int cubemap_glob(float *n, float x, float y, float z, float *adr1, float
/* ------------------------------------------------------------------------- */
/* mtex argument only for projection switches */
static int cubemap(MTex *mtex, VlakRen *vlr, float *n, float x, float y, float z, float *adr1, float *adr2)
static int cubemap(MTex *mtex, VlakRen *vlr, const float n[3], float x, float y, float z, float *adr1, float *adr2)
{
int proj[4]={0, ME_PROJXY, ME_PROJXZ, ME_PROJYZ}, ret= 0;
@@ -910,7 +910,7 @@ static int cubemap(MTex *mtex, VlakRen *vlr, float *n, float x, float y, float z
/* ------------------------------------------------------------------------- */
static int cubemap_ob(Object *ob, float *n, float x, float y, float z, float *adr1, float *adr2)
static int cubemap_ob(Object *ob, const float n[3], float x, float y, float z, float *adr1, float *adr2)
{
float x1, y1, z1, nor[3];
int ret;
@@ -944,7 +944,7 @@ static int cubemap_ob(Object *ob, float *n, float x, float y, float z, float *ad
/* ------------------------------------------------------------------------- */
static void do_2d_mapping(MTex *mtex, float *t, VlakRen *vlr, float *n, float *dxt, float *dyt)
static void do_2d_mapping(MTex *mtex, float *t, VlakRen *vlr, const float n[3], float *dxt, float *dyt)
{
Tex *tex;
Object *ob= NULL;
@@ -2690,7 +2690,7 @@ void do_material_tex(ShadeInput *shi, Render *re)
}
void do_volume_tex(ShadeInput *shi, const float *xyz, int mapto_flag, float *col, float *val, Render *re)
void do_volume_tex(ShadeInput *shi, const float *xyz, int mapto_flag, float col_r[3], float *val, Render *re)
{
MTex *mtex;
Tex *tex;
@@ -2811,17 +2811,17 @@ void do_volume_tex(ShadeInput *shi, const float *xyz, int mapto_flag, float *col
/* used for emit */
if ((mapto_flag & MAP_EMISSION_COL) && (mtex->mapto & MAP_EMISSION_COL)) {
float colemitfac= mtex->colemitfac*stencilTin;
texture_rgb_blend(col, tcol, col, texres.tin, colemitfac, mtex->blendtype);
texture_rgb_blend(col_r, tcol, col_r, texres.tin, colemitfac, mtex->blendtype);
}
if ((mapto_flag & MAP_REFLECTION_COL) && (mtex->mapto & MAP_REFLECTION_COL)) {
float colreflfac= mtex->colreflfac*stencilTin;
texture_rgb_blend(col, tcol, col, texres.tin, colreflfac, mtex->blendtype);
texture_rgb_blend(col_r, tcol, col_r, texres.tin, colreflfac, mtex->blendtype);
}
if ((mapto_flag & MAP_TRANSMISSION_COL) && (mtex->mapto & MAP_TRANSMISSION_COL)) {
float coltransfac= mtex->coltransfac*stencilTin;
texture_rgb_blend(col, tcol, col, texres.tin, coltransfac, mtex->blendtype);
texture_rgb_blend(col_r, tcol, col_r, texres.tin, coltransfac, mtex->blendtype);
}
}
@@ -3508,7 +3508,7 @@ void render_realtime_texture(ShadeInput *shi, Image *ima)
/* A modified part of shadeinput.c -> shade_input_set_uv()
* Used for sampling UV mapped texture color */
static void textured_face_generate_uv(float *uv, float *normal, float *hit, float *v1, float *v2, float *v3)
static void textured_face_generate_uv(float *uv, const float normal[3], float *hit, float *v1, float *v2, float *v3)
{
float detsh, t00, t10, t01, t11;

View File

@@ -1509,7 +1509,7 @@ static void addps_sss(void *cb_handle, int obi, int facenr, int x, int y, int z)
}
}
static void shade_sample_sss(ShadeSample *ssamp, Material *mat, ObjectInstanceRen *obi, VlakRen *vlr, int quad, float x, float y, float z, float *co, float *color, float *area)
static void shade_sample_sss(ShadeSample *ssamp, Material *mat, ObjectInstanceRen *obi, VlakRen *vlr, int quad, float x, float y, float z, float *co, float color[3], float *area)
{
ShadeInput *shi= ssamp->shi;
ShadeResult shr;

View File

@@ -444,16 +444,16 @@ VlakRen *RE_vlakren_copy(ObjectRen *obr, VlakRen *vlr)
return vlr1;
}
void RE_vlakren_get_normal(Render *UNUSED(re), ObjectInstanceRen *obi, VlakRen *vlr, float *nor)
void RE_vlakren_get_normal(Render *UNUSED(re), ObjectInstanceRen *obi, VlakRen *vlr, float r_nor[3])
{
float (*nmat)[3]= obi->nmat;
if (obi->flag & R_TRANSFORMED) {
mul_v3_m3v3(nor, nmat, vlr->n);
normalize_v3(nor);
mul_v3_m3v3(r_nor, nmat, vlr->n);
normalize_v3(r_nor);
}
else {
copy_v3_v3(nor, vlr->n);
copy_v3_v3(r_nor, vlr->n);
}
}
@@ -931,8 +931,9 @@ HaloRen *RE_findOrAddHalo(ObjectRen *obr, int nr)
/* ------------------------------------------------------------------------- */
HaloRen *RE_inithalo(Render *re, ObjectRen *obr, Material *ma, float *vec, float *vec1,
float *orco, float hasize, float vectsize, int seed)
HaloRen *RE_inithalo(Render *re, ObjectRen *obr, Material *ma,
const float vec[3], const float vec1[3],
const float *orco, float hasize, float vectsize, int seed)
{
HaloRen *har;
MTex *mtex;
@@ -1044,8 +1045,9 @@ HaloRen *RE_inithalo(Render *re, ObjectRen *obr, Material *ma, float *vec, f
return har;
}
HaloRen *RE_inithalo_particle(Render *re, ObjectRen *obr, DerivedMesh *dm, Material *ma, float *vec, float *vec1,
float *orco, float *uvco, float hasize, float vectsize, int seed, float *pa_co)
HaloRen *RE_inithalo_particle(Render *re, ObjectRen *obr, DerivedMesh *dm, Material *ma,
const float vec[3], const float vec1[3],
const float *orco, const float *uvco, float hasize, float vectsize, int seed, const float pa_co[3])
{
HaloRen *har;
MTex *mtex;

View File

@@ -1449,7 +1449,7 @@ typedef struct ISBBranch {
typedef struct BSPFace {
Boxf box;
float *v1, *v2, *v3, *v4;
const float *v1, *v2, *v3, *v4;
int obi; /* object for face lookup */
int facenr; /* index to retrieve VlakRen */
int type; /* only for strand now */
@@ -1868,7 +1868,8 @@ static void isb_bsp_recalc_box(ISBBranch *root)
}
/* callback function for zbuf clip */
static void isb_bsp_test_strand(ZSpan *zspan, int obi, int zvlnr, float *v1, float *v2, float *v3, float *v4)
static void isb_bsp_test_strand(ZSpan *zspan, int obi, int zvlnr,
const float *v1, const float *v2, const float *v3, const float *v4)
{
BSPFace face;
@@ -1902,7 +1903,8 @@ static void isb_bsp_test_strand(ZSpan *zspan, int obi, int zvlnr, float *v1, flo
}
/* callback function for zbuf clip */
static void isb_bsp_test_face(ZSpan *zspan, int obi, int zvlnr, float *v1, float *v2, float *v3, float *v4)
static void isb_bsp_test_face(ZSpan *zspan, int obi, int zvlnr,
const float *v1, const float *v2, const float *v3, const float *v4)
{
BSPFace face;

View File

@@ -77,7 +77,7 @@ ListBase *get_lights(ShadeInput *shi)
}
#if 0
static void fogcolor(float *colf, float *rco, float *view)
static void fogcolor(const float colf[3], float *rco, float *view)
{
float alpha, stepsize, startdist, dist, hor[4], zen[3], vec[3], dview[3];
float div=0.0f, distfac;
@@ -408,13 +408,13 @@ static double Normalize_d(double *n)
}
/* mix of 'real' fresnel and allowing control. grad defines blending gradient */
float fresnel_fac(float *view, float *vn, float grad, float fac)
float fresnel_fac(const float view[3], const float vn[3], float grad, float fac)
{
float t1, t2;
if (fac==0.0f) return 1.0f;
t1= (view[0]*vn[0] + view[1]*vn[1] + view[2]*vn[2]);
t1 = dot_v3v3(view, vn);
if (t1>0.0f) t2= 1.0f+t1;
else t2= 1.0f-t1;
@@ -433,7 +433,7 @@ static double saacos_d(double fac)
}
/* Stoke's form factor. Need doubles here for extreme small area sizes */
static float area_lamp_energy(float (*area)[3], float *co, float *vn)
static float area_lamp_energy(float (*area)[3], const float co[3], const float vn[3])
{
double fac;
double vec[4][3]; /* vectors of rendered co to vertices lamp */
@@ -482,7 +482,7 @@ static float area_lamp_energy(float (*area)[3], float *co, float *vn)
return fac;
}
static float area_lamp_energy_multisample(LampRen *lar, float *co, float *vn)
static float area_lamp_energy_multisample(LampRen *lar, const float co[3], float *vn)
{
/* corner vectors are moved around according lamp jitter */
float *jitlamp= lar->jitter, vec[3];
@@ -554,7 +554,7 @@ static float spec(float inp, int hard)
return inp;
}
static float Phong_Spec(float *n, float *l, float *v, int hard, int tangent )
static float Phong_Spec(const float n[3], const float l[3], const float v[3], int hard, int tangent )
{
float h[3];
float rslt;
@@ -575,7 +575,7 @@ static float Phong_Spec(float *n, float *l, float *v, int hard, int tangent )
/* reduced cook torrance spec (for off-specular peak) */
static float CookTorr_Spec(float *n, float *l, float *v, int hard, int tangent)
static float CookTorr_Spec(const float n[3], const float l[3], const float v[3], int hard, int tangent)
{
float i, nh, nv, h[3];
@@ -599,7 +599,7 @@ static float CookTorr_Spec(float *n, float *l, float *v, int hard, int tangent)
}
/* Blinn spec */
static float Blinn_Spec(float *n, float *l, float *v, float refrac, float spec_power, int tangent)
static float Blinn_Spec(const float n[3], const float l[3], const float v[3], float refrac, float spec_power, int tangent)
{
float i, nh, nv, nl, vh, h[3];
float a, b, c, g=0.0f, p, f, ang;
@@ -653,7 +653,7 @@ static float Blinn_Spec(float *n, float *l, float *v, float refrac, float spec_p
}
/* cartoon render spec */
static float Toon_Spec(float *n, float *l, float *v, float size, float smooth, int tangent)
static float Toon_Spec(const float n[3], const float l[3], const float v[3], float size, float smooth, int tangent)
{
float h[3];
float ang;
@@ -677,7 +677,7 @@ static float Toon_Spec(float *n, float *l, float *v, float size, float smooth, i
}
/* Ward isotropic gaussian spec */
static float WardIso_Spec(float *n, float *l, float *v, float rms, int tangent)
static float WardIso_Spec(const float n[3], const float l[3], const float v[3], float rms, int tangent)
{
float i, nh, nv, nl, h[3], angle, alpha;
@@ -709,7 +709,7 @@ static float WardIso_Spec(float *n, float *l, float *v, float rms, int tangent)
}
/* cartoon render diffuse */
static float Toon_Diff(float *n, float *l, float *UNUSED(v), float size, float smooth)
static float Toon_Diff(const float n[3], const float l[3], const float UNUSED(v[3]), float size, float smooth)
{
float rslt, ang;
@@ -728,7 +728,7 @@ static float Toon_Diff(float *n, float *l, float *UNUSED(v), float size, float s
/* 'nl' is either dot product, or return value of area light */
/* in latter case, only last multiplication uses 'nl' */
static float OrenNayar_Diff(float nl, float *n, float *l, float *v, float rough )
static float OrenNayar_Diff(float nl, const float n[3], const float l[3], const float v[3], float rough )
{
float i/*, nh*/, nv /*, vh */, realnl, h[3];
float a, b, t, A, B;
@@ -788,7 +788,7 @@ static float OrenNayar_Diff(float nl, float *n, float *l, float *v, float rough
}
/* Minnaert diffuse */
static float Minnaert_Diff(float nl, float *n, float *v, float darkness)
static float Minnaert_Diff(float nl, const float n[3], const float v[3], float darkness)
{
float i, nv;

View File

@@ -810,12 +810,12 @@ void scatter_tree_build(ScatterTree *tree)
sum_radiance(tree, tree->root);
}
void scatter_tree_sample(ScatterTree *tree, float *co, float *color)
void scatter_tree_sample(ScatterTree *tree, const float co[3], float color[3])
{
float sco[3];
copy_v3_v3(sco, co);
mul_v3_fl(sco, 1.0f/tree->scale);
mul_v3_fl(sco, 1.0f / tree->scale);
compute_radiance(tree, sco, color);
}
@@ -1025,7 +1025,7 @@ void free_sss(Render *re)
}
}
int sample_sss(Render *re, Material *mat, float *co, float *color)
int sample_sss(Render *re, Material *mat, const float co[3], float color[3])
{
if (re->sss_hash) {
SSSData *sss= BLI_ghash_lookup(re->sss_hash, mat);

View File

@@ -116,9 +116,10 @@ static void zbuf_init_span(ZSpan *zspan)
zspan->minp1= zspan->maxp1= zspan->minp2= zspan->maxp2= NULL;
}
static void zbuf_add_to_span(ZSpan *zspan, float *v1, float *v2)
static void zbuf_add_to_span(ZSpan *zspan, const float *v1, const float *v2)
{
float *minv, *maxv, *span;
const float *minv, *maxv;
float *span;
float xx1, dx0, xs0;
int y, my0, my2;
@@ -301,7 +302,8 @@ static APixstr *addpsA(ZSpan *zspan)
return zspan->curpstr;
}
static void zbuffillAc4(ZSpan *zspan, int obi, int zvlnr, float *v1, float *v2, float *v3, float *v4)
static void zbuffillAc4(ZSpan *zspan, int obi, int zvlnr,
const float *v1, const float *v2, const float *v3, const float *v4)
{
APixstr *ap, *apofs, *apn;
double zxd, zyd, zy0, zverg;
@@ -427,7 +429,7 @@ static void zbuffillAc4(ZSpan *zspan, int obi, int zvlnr, float *v1, float *v2,
static void zbuflineAc(ZSpan *zspan, int obi, int zvlnr, float *vec1, float *vec2)
static void zbuflineAc(ZSpan *zspan, int obi, int zvlnr, const float vec1[3], const float vec2[3])
{
APixstr *ap, *apn;
int *rectz, *rectmask;
@@ -584,7 +586,7 @@ static void zbuflineAc(ZSpan *zspan, int obi, int zvlnr, float *vec1, float *vec
/* ************* NORMAL ZBUFFER ************ */
static void zbufline(ZSpan *zspan, int obi, int zvlnr, float *vec1, float *vec2)
static void zbufline(ZSpan *zspan, int obi, int zvlnr, const float vec1[3], const float vec2[3])
{
int *rectz, *rectp, *recto, *rectmask;
int start, end, x, y, oldx, oldy, ofs;
@@ -714,7 +716,7 @@ static void zbufline(ZSpan *zspan, int obi, int zvlnr, float *vec1, float *vec2)
}
}
static void zbufline_onlyZ(ZSpan *zspan, int UNUSED(obi), int UNUSED(zvlnr), float *vec1, float *vec2)
static void zbufline_onlyZ(ZSpan *zspan, int UNUSED(obi), int UNUSED(zvlnr), const float vec1[3], const float vec2[3])
{
int *rectz, *rectz1= NULL;
int start, end, x, y, oldx, oldy, ofs;
@@ -1039,7 +1041,8 @@ void zbufsinglewire(ZSpan *zspan, int obi, int zvlnr, const float ho1[4], const
/* WATCH IT: zbuffillGLinv4 and zbuffillGL4 are identical except for a 2 lines,
* commented below */
static void zbuffillGLinv4(ZSpan *zspan, int obi, int zvlnr, float *v1, float *v2, float *v3, float *v4)
static void zbuffillGLinv4(ZSpan *zspan, int obi, int zvlnr,
const float *v1, const float *v2, const float *v3, const float *v4)
{
double zxd, zyd, zy0, zverg;
float x0, y0, z0;
@@ -1161,7 +1164,8 @@ static void zbuffillGLinv4(ZSpan *zspan, int obi, int zvlnr, float *v1, float *v
/* WATCH IT: zbuffillGLinv4 and zbuffillGL4 are identical except for a 2 lines,
* commented below */
static void zbuffillGL4(ZSpan *zspan, int obi, int zvlnr, float *v1, float *v2, float *v3, float *v4)
static void zbuffillGL4(ZSpan *zspan, int obi, int zvlnr,
const float *v1, const float *v2, const float *v3, const float *v4)
{
double zxd, zyd, zy0, zverg;
float x0, y0, z0;
@@ -1291,7 +1295,8 @@ static void zbuffillGL4(ZSpan *zspan, int obi, int zvlnr, float *v1, float *v2,
*/
/* now: filling two Z values, the closest and 2nd closest */
static void zbuffillGL_onlyZ(ZSpan *zspan, int UNUSED(obi), int UNUSED(zvlnr), float *v1, float *v2, float *v3, float *v4)
static void zbuffillGL_onlyZ(ZSpan *zspan, int UNUSED(obi), int UNUSED(zvlnr),
const float *v1, const float *v2, const float *v3, const float *v4)
{
double zxd, zyd, zy0, zverg;
float x0, y0, z0;
@@ -2445,7 +2450,8 @@ void zbuffer_shadow(Render *re, float winmat[][4], LampRen *lar, int *rectz, int
zbuf_free_span(&zspan);
}
static void zbuffill_sss(ZSpan *zspan, int obi, int zvlnr, float *v1, float *v2, float *v3, float *v4)
static void zbuffill_sss(ZSpan *zspan, int obi, int zvlnr,
const float *v1, const float *v2, const float *v3, const float *v4)
{
double zxd, zyd, zy0, z;
float x0, y0, x1, y1, x2, y2, z0, z1, z2, xx1, *span1, *span2;