style cleanup:

also rename mesh_getVertexCos() --> BKE_mesh_vertexCos_get() to match curve function.
This commit is contained in:
Campbell Barton 2013-03-26 07:29:01 +00:00
parent ef961319e0
commit 64d161de87
92 changed files with 304 additions and 300 deletions

@ -69,7 +69,7 @@ void BKE_brush_jitter_pos(const struct Scene *scene, struct Brush *brush,
const float pos[2], float jitterpos[2]);
/* brush curve */
void BKE_brush_curve_preset(struct Brush *b, /*enum CurveMappingPreset*/ int preset);
void BKE_brush_curve_preset(struct Brush *b, int preset);
float BKE_brush_curve_strength_clamp(struct Brush *br, float p, const float len);
float BKE_brush_curve_strength(struct Brush *br, float p, const float len); /* used for sculpt */

@ -221,7 +221,7 @@ void BKE_mesh_calc_normals(
/* Return a newly MEM_malloc'd array of all the mesh vertex locations
* (_numVerts_r_ may be NULL) */
float (*mesh_getVertexCos(struct Mesh *me, int *r_numVerts))[3];
float (*BKE_mesh_vertexCos_get(struct Mesh *me, int *r_numVerts))[3];
/* map from uv vertex to face (for select linked, stitch, uv suburf) */

@ -845,7 +845,7 @@ DerivedMesh *mesh_create_derived_for_modifier(Scene *scene, Object *ob,
if (mti->type == eModifierTypeType_OnlyDeform) {
int numVerts;
float (*deformedVerts)[3] = mesh_getVertexCos(me, &numVerts);
float (*deformedVerts)[3] = BKE_mesh_vertexCos_get(me, &numVerts);
mti->deformVerts(md, ob, NULL, deformedVerts, numVerts, 0);
dm = mesh_create_derived(me, ob, deformedVerts);
@ -1451,7 +1451,7 @@ static void mesh_calc_modifiers(Scene *scene, Object *ob, float (*inputVertexCos
if (mti->type == eModifierTypeType_OnlyDeform && !sculpt_dyntopo) {
if (!deformedVerts)
deformedVerts = mesh_getVertexCos(me, &numVerts);
deformedVerts = BKE_mesh_vertexCos_get(me, &numVerts);
mti->deformVerts(md, ob, NULL, deformedVerts, numVerts, deform_app_flags);
}
@ -1485,7 +1485,7 @@ static void mesh_calc_modifiers(Scene *scene, Object *ob, float (*inputVertexCos
if (inputVertexCos)
deformedVerts = inputVertexCos;
else
deformedVerts = mesh_getVertexCos(me, &numVerts);
deformedVerts = BKE_mesh_vertexCos_get(me, &numVerts);
}
@ -1557,7 +1557,7 @@ static void mesh_calc_modifiers(Scene *scene, Object *ob, float (*inputVertexCos
dm->getVertCos(dm, deformedVerts);
}
else {
deformedVerts = mesh_getVertexCos(me, &numVerts);
deformedVerts = BKE_mesh_vertexCos_get(me, &numVerts);
}
}
@ -2441,30 +2441,30 @@ static int GetNumVertsOfFace(const SMikkTSpaceContext *pContext, const int face_
return pMesh->mface[face_num].v4 != 0 ? 4 : 3;
}
static void GetPosition(const SMikkTSpaceContext *pContext, float fPos[], const int face_num, const int vert_index)
static void GetPosition(const SMikkTSpaceContext *pContext, float r_co[3], const int face_num, const int vert_index)
{
//assert(vert_index >= 0 && vert_index < 4);
SGLSLMeshToTangent *pMesh = (SGLSLMeshToTangent *) pContext->m_pUserData;
const float *co = pMesh->mvert[(&pMesh->mface[face_num].v1)[vert_index]].co;
copy_v3_v3(fPos, co);
copy_v3_v3(r_co, co);
}
static void GetTextureCoordinate(const SMikkTSpaceContext *pContext, float fUV[], const int face_num, const int vert_index)
static void GetTextureCoordinate(const SMikkTSpaceContext *pContext, float r_uv[2], const int face_num, const int vert_index)
{
//assert(vert_index >= 0 && vert_index < 4);
SGLSLMeshToTangent *pMesh = (SGLSLMeshToTangent *) pContext->m_pUserData;
if (pMesh->mtface != NULL) {
float *uv = pMesh->mtface[face_num].uv[vert_index];
fUV[0] = uv[0]; fUV[1] = uv[1];
const float *uv = pMesh->mtface[face_num].uv[vert_index];
copy_v2_v2(r_uv, uv);
}
else {
const float *orco = pMesh->orco[(&pMesh->mface[face_num].v1)[vert_index]];
map_to_sphere(&fUV[0], &fUV[1], orco[0], orco[1], orco[2]);
map_to_sphere(&r_uv[0], &r_uv[1], orco[0], orco[1], orco[2]);
}
}
static void GetNormal(const SMikkTSpaceContext *pContext, float fNorm[], const int face_num, const int vert_index)
static void GetNormal(const SMikkTSpaceContext *pContext, float r_no[3], const int face_num, const int vert_index)
{
//assert(vert_index >= 0 && vert_index < 4);
SGLSLMeshToTangent *pMesh = (SGLSLMeshToTangent *) pContext->m_pUserData;
@ -2472,29 +2472,29 @@ static void GetNormal(const SMikkTSpaceContext *pContext, float fNorm[], const i
const int smoothnormal = (pMesh->mface[face_num].flag & ME_SMOOTH);
if (!smoothnormal) { // flat
if (pMesh->precomputedFaceNormals) {
copy_v3_v3(fNorm, &pMesh->precomputedFaceNormals[3 * face_num]);
copy_v3_v3(r_no, &pMesh->precomputedFaceNormals[3 * face_num]);
}
else {
MFace *mf = &pMesh->mface[face_num];
float *p0 = pMesh->mvert[mf->v1].co;
float *p1 = pMesh->mvert[mf->v2].co;
float *p2 = pMesh->mvert[mf->v3].co;
const float *p0 = pMesh->mvert[mf->v1].co;
const float *p1 = pMesh->mvert[mf->v2].co;
const float *p2 = pMesh->mvert[mf->v3].co;
if (mf->v4) {
float *p3 = pMesh->mvert[mf->v4].co;
normal_quad_v3(fNorm, p0, p1, p2, p3);
const float *p3 = pMesh->mvert[mf->v4].co;
normal_quad_v3(r_no, p0, p1, p2, p3);
}
else {
normal_tri_v3(fNorm, p0, p1, p2);
normal_tri_v3(r_no, p0, p1, p2);
}
}
}
else {
const short *no = pMesh->mvert[(&pMesh->mface[face_num].v1)[vert_index]].no;
normal_short_to_float_v3(fNorm, no);
normal_short_to_float_v3(r_no, no);
}
}
static void SetTSpace(const SMikkTSpaceContext *pContext, const float fvTangent[], const float fSign, const int face_num, const int iVert)
static void SetTSpace(const SMikkTSpaceContext *pContext, const float fvTangent[3], const float fSign, const int face_num, const int iVert)
{
//assert(vert_index >= 0 && vert_index < 4);
SGLSLMeshToTangent *pMesh = (SGLSLMeshToTangent *) pContext->m_pUserData;

@ -417,8 +417,11 @@ void BKE_brush_sculpt_reset(Brush *br)
}
}
/* Library Operations */
void BKE_brush_curve_preset(Brush *b, /*CurveMappingPreset*/ int preset)
/**
* Library Operations
* \param preset CurveMappingPreset
*/
void BKE_brush_curve_preset(Brush *b, int preset)
{
CurveMap *cm = NULL;

@ -2190,7 +2190,7 @@ void BKE_mesh_convert_mfaces_to_mpolys_ex(ID *id, CustomData *fdata, CustomData
*mloop_r = mloop;
}
float (*mesh_getVertexCos(Mesh * me, int *r_numVerts))[3]
float (*BKE_mesh_vertexCos_get(Mesh *me, int *r_numVerts))[3]
{
int i, numVerts = me->totvert;
float (*cos)[3] = MEM_mallocN(sizeof(*cos) * numVerts, "vertexcos1");

@ -457,7 +457,7 @@ float linearrgb_to_srgb(float c)
return 1.055f * powf(c, 1.0f / 2.4f) - 0.055f;
}
void minmax_rgb(short c[])
void minmax_rgb(short c[3])
{
if (c[0] > 255) c[0] = 255;
else if (c[0] < 0) c[0] = 0;

@ -139,7 +139,7 @@ void TransformWriter::add_node_transform_ob(COLLADASW::Node& node, Object *ob, B
void TransformWriter::add_node_transform_identity(COLLADASW::Node& node)
{
float loc[] = {0.0f, 0.0f, 0.0f}, scale[] = {1.0f, 1.0f, 1.0f}, rot[] = {0.0f, 0.0f, 0.0f};
float loc[3] = {0.0f, 0.0f, 0.0f}, scale[3] = {1.0f, 1.0f, 1.0f}, rot[3] = {0.0f, 0.0f, 0.0f};
add_transform(node, loc, rot, scale);
}

@ -279,6 +279,7 @@ static void pose_slide_apply_vec3(tPoseSlideOp *pso, tPChanFCurveLink *pfl, floa
FCurve *fcu = (FCurve *)ld->data;
/* just work on these channels one by one... there's no interaction between values */
BLI_assert(fcu->array_index < 3);
pose_slide_apply_val(pso, fcu, &vec[fcu->array_index]);
}

@ -877,7 +877,7 @@ static bool gp_stroke_eraser_is_occluded(tGPsdata *p,
}
/* eraser tool - check if part of stroke occurs within last segment drawn by eraser */
static short gp_stroke_eraser_strokeinside(const int mval[], const int UNUSED(mvalo[]),
static short gp_stroke_eraser_strokeinside(const int mval[2], const int UNUSED(mvalo[2]),
int rad, int x0, int y0, int x1, int y1)
{
/* simple within-radius check for now */
@ -927,7 +927,7 @@ static void gp_point_to_xy(ARegion *ar, View2D *v2d, rctf *subrect, bGPDstroke *
/* eraser tool - evaluation per stroke */
/* TODO: this could really do with some optimization (KD-Tree/BVH?) */
static void gp_stroke_eraser_dostroke(tGPsdata *p,
const int mval[], const int mvalo[],
const int mval[2], const int mvalo[2],
short rad, const rcti *rect, bGPDframe *gpf, bGPDstroke *gps)
{
bGPDspoint *pt1, *pt2;

@ -3456,7 +3456,7 @@ void sculpt_update_mesh_elements(Scene *scene, Sculpt *sd, Object *ob,
free_sculptsession_deformMats(ss);
ss->orig_cos = (ss->kb) ? BKE_key_convert_to_vertcos(ob, ss->kb) : mesh_getVertexCos(me, NULL);
ss->orig_cos = (ss->kb) ? BKE_key_convert_to_vertcos(ob, ss->kb) : BKE_mesh_vertexCos_get(me, NULL);
crazyspace_build_sculpt(scene, ob, &ss->deform_imats, &ss->deform_cos);
BKE_pbvh_apply_vertCos(ss->pbvh, ss->deform_cos);

@ -332,7 +332,7 @@ int sculpt_get_first_deform_matrices(Scene *scene, Object *ob, float (**deformma
if (!defmats) {
Mesh *me = (Mesh *)ob->data;
dm = mesh_create_derived(me, ob, NULL);
deformedVerts = mesh_getVertexCos(me, &numVerts);
deformedVerts = BKE_mesh_vertexCos_get(me, &numVerts);
defmats = MEM_callocN(sizeof(*defmats) * numVerts, "defmats");
for (a = 0; a < numVerts; a++)
@ -413,7 +413,7 @@ void crazyspace_build_sculpt(Scene *scene, Object *ob, float (**deformmats)[3][3
int a, numVerts;
Mesh *me = (Mesh *)ob->data;
*deformcos = mesh_getVertexCos(me, &numVerts);
*deformcos = BKE_mesh_vertexCos_get(me, &numVerts);
*deformmats = MEM_callocN(sizeof(*(*deformmats)) * numVerts, "defmats");
for (a = 0; a < numVerts; a++)

@ -85,7 +85,7 @@ int imb_is_a_dds(unsigned char *mem) // note: use at most first 32 bytes
struct ImBuf *imb_load_dds(unsigned char *mem, size_t size, int flags, char colorspace[IM_MAX_SPACE])
{
struct ImBuf * ibuf = 0;
struct ImBuf *ibuf = NULL;
DirectDrawSurface dds(mem, size); /* reads header */
unsigned char bits_per_pixel;
unsigned int *rect;

@ -530,16 +530,16 @@ static int GetNumVertsOfFace(const SMikkTSpaceContext * pContext, const int face
return vlr->v4!=NULL ? 4 : 3;
}
static void GetPosition(const SMikkTSpaceContext * pContext, float fPos[], const int face_num, const int vert_index)
static void GetPosition(const SMikkTSpaceContext *pContext, float r_co[3], const int face_num, const int vert_index)
{
//assert(vert_index>=0 && vert_index<4);
SRenderMeshToTangent *pMesh = (SRenderMeshToTangent *) pContext->m_pUserData;
VlakRen *vlr= RE_findOrAddVlak(pMesh->obr, face_num);
const float *co = (&vlr->v1)[vert_index]->co;
copy_v3_v3(fPos, co);
copy_v3_v3(r_co, co);
}
static void GetTextureCoordinate(const SMikkTSpaceContext * pContext, float fUV[], const int face_num, const int vert_index)
static void GetTextureCoordinate(const SMikkTSpaceContext *pContext, float r_uv[2], const int face_num, const int vert_index)
{
//assert(vert_index>=0 && vert_index<4);
SRenderMeshToTangent *pMesh = (SRenderMeshToTangent *) pContext->m_pUserData;
@ -549,17 +549,17 @@ static void GetTextureCoordinate(const SMikkTSpaceContext * pContext, float fUV[
if (tface != NULL) {
coord= tface->uv[vert_index];
fUV[0]= coord[0]; fUV[1]= coord[1];
copy_v2_v2(r_uv, coord);
}
else if ((coord = (&vlr->v1)[vert_index]->orco)) {
map_to_sphere(&fUV[0], &fUV[1], coord[0], coord[1], coord[2]);
map_to_sphere(&r_uv[0], &r_uv[1], coord[0], coord[1], coord[2]);
}
else { /* else we get un-initialized value, 0.0 ok default? */
fUV[0]= fUV[1]= 0.0f;
zero_v2(r_uv);
}
}
static void GetNormal(const SMikkTSpaceContext * pContext, float fNorm[], const int face_num, const int vert_index)
static void GetNormal(const SMikkTSpaceContext *pContext, float r_no[3], const int face_num, const int vert_index)
{
//assert(vert_index>=0 && vert_index<4);
SRenderMeshToTangent *pMesh = (SRenderMeshToTangent *) pContext->m_pUserData;
@ -567,13 +567,13 @@ static void GetNormal(const SMikkTSpaceContext * pContext, float fNorm[], const
if (vlr->flag & ME_SMOOTH) {
const float *n = (&vlr->v1)[vert_index]->n;
copy_v3_v3(fNorm, n);
copy_v3_v3(r_no, n);
}
else {
negate_v3_v3(fNorm, vlr->n);
negate_v3_v3(r_no, vlr->n);
}
}
static void SetTSpace(const SMikkTSpaceContext * pContext, const float fvTangent[], const float fSign, const int face_num, const int iVert)
static void SetTSpace(const SMikkTSpaceContext *pContext, const float fvTangent[3], const float fSign, const int face_num, const int iVert)
{
//assert(vert_index>=0 && vert_index<4);
SRenderMeshToTangent *pMesh = (SRenderMeshToTangent *) pContext->m_pUserData;

@ -47,7 +47,7 @@ CVectorValue::CVectorValue(float x,float y,float z, AllocationTYPE alloctype)
m_vec[KX_Z] = m_transformedvec[KX_Z] = z;
}
CVectorValue::CVectorValue(double vec[],const char *name,AllocationTYPE alloctype)
CVectorValue::CVectorValue(double vec[3], const char *name,AllocationTYPE alloctype)
{
SetCustomFlag1(false);//FancyOutput=false;
@ -65,7 +65,7 @@ CVectorValue::CVectorValue(double vec[],const char *name,AllocationTYPE alloctyp
SetName(name);
}
CVectorValue::CVectorValue(double vec[],AllocationTYPE alloctype)
CVectorValue::CVectorValue(double vec[3], AllocationTYPE alloctype)
{
SetCustomFlag1(false);//FancyOutput=false;

@ -45,10 +45,10 @@ public:
CValue* CalcFinal(VALUE_DATA_TYPE dtype, VALUE_OPERATOR op, CValue *val);
CVectorValue(double vec[],const char *name,AllocationTYPE alloctype=CValue::HEAPVALUE);
CVectorValue(double vec[3], const char *name,AllocationTYPE alloctype=CValue::HEAPVALUE);
CVectorValue() {};
CVectorValue(double vec[],AllocationTYPE alloctype=CValue::HEAPVALUE);
CVectorValue(double vec[3], AllocationTYPE alloctype=CValue::HEAPVALUE);
CVectorValue(float x,float y,float z, AllocationTYPE alloctype = CValue::HEAPVALUE);
virtual ~CVectorValue();
//virtual bool ExportT3D(File *txtfile,bool bNoName=false);

@ -62,7 +62,7 @@
#include "BKE_bmfont.h"
#include "BKE_bmfont_types.h"
/*MAART:
#if 0
void printfGlyph(bmGlyph *glyph)
{
printf("unicode: %d '%c'\n", glyph->unicode, glyph->unicode);
@ -71,7 +71,7 @@ void printfGlyph(bmGlyph * glyph)
printf(" ofsx: %3d ofsy: %3d\n", glyph->ofsx, glyph->ofsy);
printf(" advan: %3d reser: %3d\n", glyph->advance, glyph->reserved);
}
*/
#endif
void calcAlpha(ImBuf *ibuf)
{

@ -403,15 +403,15 @@ PyObject *KX_MeshProxy::pyattr_get_materials(void *self_v, const KX_PYATTRIBUTE_
return materials;
}
PyObject * KX_MeshProxy::pyattr_get_numMaterials(void * selfv, const KX_PYATTRIBUTE_DEF * attrdef)
PyObject *KX_MeshProxy::pyattr_get_numMaterials(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef)
{
KX_MeshProxy * self = static_cast<KX_MeshProxy *> (selfv);
KX_MeshProxy * self = static_cast<KX_MeshProxy *> (self_v);
return PyLong_FromLong(self->m_meshobj->NumMaterials());
}
PyObject * KX_MeshProxy::pyattr_get_numPolygons(void * selfv, const KX_PYATTRIBUTE_DEF * attrdef)
PyObject *KX_MeshProxy::pyattr_get_numPolygons(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef)
{
KX_MeshProxy * self = static_cast<KX_MeshProxy *> (selfv);
KX_MeshProxy * self = static_cast<KX_MeshProxy *> (self_v);
return PyLong_FromLong(self->m_meshobj->NumPolygons());
}