Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'source/blender/editors/space_view3d/drawmesh.c')
-rw-r--r--source/blender/editors/space_view3d/drawmesh.c290
1 files changed, 145 insertions, 145 deletions
diff --git a/source/blender/editors/space_view3d/drawmesh.c b/source/blender/editors/space_view3d/drawmesh.c
index 0ec9e9664f6..39f1552c8a6 100644
--- a/source/blender/editors/space_view3d/drawmesh.c
+++ b/source/blender/editors/space_view3d/drawmesh.c
@@ -71,7 +71,7 @@
#include "ED_mesh.h"
#include "ED_uvedit.h"
-#include "view3d_intern.h" // own include
+#include "view3d_intern.h" // own include
/* user data structures for derived mesh callbacks */
typedef struct drawMeshFaceSelect_userData {
@@ -96,8 +96,8 @@ typedef struct drawTFace_userData {
/* Flags for marked edges */
enum {
- eEdge_Visible = (1<<0),
- eEdge_Select = (1<<1),
+ eEdge_Visible = (1 << 0),
+ eEdge_Select = (1 << 1),
};
/* Creates a hash of edges to flags indicating selected/visible */
@@ -108,7 +108,7 @@ static void get_marked_edge_info__orFlags(EdgeHash *eh, int v0, int v1, int flag
if (!BLI_edgehash_haskey(eh, v0, v1))
BLI_edgehash_insert(eh, v0, v1, NULL);
- flags_p = (int*) BLI_edgehash_lookup_p(eh, v0, v1);
+ flags_p = (int *) BLI_edgehash_lookup_p(eh, v0, v1);
*flags_p |= flags;
}
@@ -120,7 +120,7 @@ static EdgeHash *get_tface_mesh_marked_edge_info(Mesh *me)
MLoop *ml_next;
int i, j;
- for (i=0; i<me->totpoly; i++) {
+ for (i = 0; i < me->totpoly; i++) {
mp = &me->mpoly[i];
if (!(mp->flag & ME_HIDE)) {
@@ -128,7 +128,7 @@ static EdgeHash *get_tface_mesh_marked_edge_info(Mesh *me)
if (mp->flag & ME_FACE_SEL) flags |= eEdge_Select;
ml = me->mloop + mp->loopstart;
- for (j=0; j<mp->totloop; j++, ml++) {
+ for (j = 0; j < mp->totloop; j++, ml++) {
ml_next = ME_POLY_LOOP_NEXT(me->mloop, mp, j);
get_marked_edge_info__orFlags(eh, ml->v, ml_next->v, flags);
}
@@ -142,7 +142,7 @@ static EdgeHash *get_tface_mesh_marked_edge_info(Mesh *me)
static DMDrawOption draw_mesh_face_select__setHiddenOpts(void *userData, int index)
{
drawMeshFaceSelect_userData *data = userData;
- Mesh *me= data->me;
+ Mesh *me = data->me;
MEdge *med = &me->medge[index];
uintptr_t flags = (intptr_t) BLI_edgehash_lookup(data->eh, med->v1, med->v2);
@@ -170,11 +170,11 @@ static DMDrawOption draw_mesh_face_select__setSelectOpts(void *userData, int ind
/* draws unselected */
static DMDrawOption draw_mesh_face_select__drawFaceOptsInv(void *userData, int index)
{
- Mesh *me = (Mesh*)userData;
+ Mesh *me = (Mesh *)userData;
MPoly *mface = &me->mpoly[index];
- if (!(mface->flag&ME_HIDE) && !(mface->flag&ME_FACE_SEL))
- return DM_DRAW_OPTION_NO_MCOL; /* Don't set color */
+ if (!(mface->flag & ME_HIDE) && !(mface->flag & ME_FACE_SEL))
+ return DM_DRAW_OPTION_NO_MCOL; /* Don't set color */
else
return DM_DRAW_OPTION_SKIP;
}
@@ -202,20 +202,20 @@ static void draw_mesh_face_select(RegionView3D *rv3d, Mesh *me, DerivedMesh *dm)
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
/* dull unselected faces so as not to get in the way of seeing color */
glColor4ub(96, 96, 96, 64);
- dm->drawMappedFacesTex(dm, draw_mesh_face_select__drawFaceOptsInv, NULL, (void*)me);
+ dm->drawMappedFacesTex(dm, draw_mesh_face_select__drawFaceOptsInv, NULL, (void *)me);
glDisable(GL_BLEND);
}
bglPolygonOffset(rv3d->dist, 1.0);
- /* Draw Stippled Outline for selected faces */
+ /* Draw Stippled Outline for selected faces */
glColor3ub(255, 255, 255);
setlinestyle(1);
dm->drawMappedEdges(dm, draw_mesh_face_select__setSelectOpts, &data);
setlinestyle(0);
- bglPolygonOffset(rv3d->dist, 0.0); // resets correctly now, even after calling accumulated offsets
+ bglPolygonOffset(rv3d->dist, 0.0); // resets correctly now, even after calling accumulated offsets
BLI_edgehash_free(data.eh, NULL);
}
@@ -224,10 +224,10 @@ static void draw_mesh_face_select(RegionView3D *rv3d, Mesh *me, DerivedMesh *dm)
static Material *give_current_material_or_def(Object *ob, int matnr)
{
- extern Material defmaterial; // render module abuse...
- Material *ma= give_current_material(ob, matnr);
+ extern Material defmaterial; // render module abuse...
+ Material *ma = give_current_material(ob, matnr);
- return ma?ma:&defmaterial;
+ return ma ? ma : &defmaterial;
}
/* Icky globals, fix with userdata parameter */
@@ -255,9 +255,9 @@ static int set_draw_settings_cached(int clearcache, MTFace *texface, Material *m
int lit = 0;
if (clearcache) {
- c_textured= c_lit= c_backculled= -1;
- c_texface= (MTFace*) -1;
- c_badtex= 0;
+ c_textured = c_lit = c_backculled = -1;
+ c_texface = (MTFace *) -1;
+ c_badtex = 0;
}
else {
textured = gtexdraw.istex;
@@ -284,35 +284,35 @@ static int set_draw_settings_cached(int clearcache, MTFace *texface, Material *m
else
textured = 0;
- if (backculled!=c_backculled) {
+ if (backculled != c_backculled) {
if (backculled) glEnable(GL_CULL_FACE);
else glDisable(GL_CULL_FACE);
- c_backculled= backculled;
+ c_backculled = backculled;
}
- if (textured!=c_textured || texface!=c_texface) {
- if (textured ) {
- c_badtex= !GPU_set_tpage(texface, !(litob->mode & OB_MODE_TEXTURE_PAINT), alphablend);
+ if (textured != c_textured || texface != c_texface) {
+ if (textured) {
+ c_badtex = !GPU_set_tpage(texface, !(litob->mode & OB_MODE_TEXTURE_PAINT), alphablend);
}
else {
GPU_set_tpage(NULL, 0, 0);
- c_badtex= 0;
+ c_badtex = 0;
}
- c_textured= textured;
- c_texface= texface;
+ c_textured = textured;
+ c_texface = texface;
}
- if (c_badtex) lit= 0;
- if (lit!=c_lit || ma!=c_ma) {
+ if (c_badtex) lit = 0;
+ if (lit != c_lit || ma != c_ma) {
if (lit) {
float spec[4];
- if (!ma)ma= give_current_material_or_def(NULL, 0); //default material
+ if (!ma) ma = give_current_material_or_def(NULL, 0); //default material
- spec[0]= ma->spec*ma->specr;
- spec[1]= ma->spec*ma->specg;
- spec[2]= ma->spec*ma->specb;
- spec[3]= 1.0;
+ spec[0] = ma->spec * ma->specr;
+ spec[1] = ma->spec * ma->specg;
+ spec[2] = ma->spec * ma->specb;
+ spec[3] = 1.0;
glMaterialfv(GL_FRONT_AND_BACK, GL_SPECULAR, spec);
glColorMaterial(GL_FRONT_AND_BACK, GL_DIFFUSE);
@@ -324,7 +324,7 @@ static int set_draw_settings_cached(int clearcache, MTFace *texface, Material *m
glDisable(GL_LIGHTING);
glDisable(GL_COLOR_MATERIAL);
}
- c_lit= lit;
+ c_lit = lit;
}
return c_badtex;
@@ -340,25 +340,25 @@ static void draw_textured_begin(Scene *scene, View3D *v3d, RegionView3D *rv3d, O
/* texture draw is abused for mask selection mode, do this so wire draw
* with face selection in weight paint is not lit. */
if ((v3d->drawtype <= OB_WIRE) && (ob->mode & OB_MODE_WEIGHT_PAINT)) {
- solidtex= FALSE;
- Gtexdraw.islit= 0;
+ solidtex = FALSE;
+ Gtexdraw.islit = 0;
}
- else if (v3d->drawtype==OB_SOLID || ((ob->mode & OB_MODE_EDIT) && v3d->drawtype!=OB_TEXTURE)) {
+ else if (v3d->drawtype == OB_SOLID || ((ob->mode & OB_MODE_EDIT) && v3d->drawtype != OB_TEXTURE)) {
/* draw with default lights in solid draw mode and edit mode */
- solidtex= TRUE;
- Gtexdraw.islit= -1;
+ solidtex = TRUE;
+ Gtexdraw.islit = -1;
}
else {
/* draw with lights in the scene otherwise */
- solidtex= FALSE;
- Gtexdraw.islit= GPU_scene_object_lights(scene, ob, v3d->lay, rv3d->viewmat, !rv3d->is_persp);
+ solidtex = FALSE;
+ Gtexdraw.islit = GPU_scene_object_lights(scene, ob, v3d->lay, rv3d->viewmat, !rv3d->is_persp);
}
rgba_float_to_uchar(obcol, ob->col);
glCullFace(GL_BACK); glEnable(GL_CULL_FACE);
- if (solidtex || v3d->drawtype==OB_TEXTURE) istex= 1;
- else istex= 0;
+ if (solidtex || v3d->drawtype == OB_TEXTURE) istex = 1;
+ else istex = 0;
Gtexdraw.ob = ob;
Gtexdraw.istex = istex;
@@ -393,8 +393,8 @@ static void draw_textured_end(void)
static DMDrawOption draw_tface__set_draw_legacy(MTFace *tface, int has_mcol, int matnr)
{
- Material *ma= give_current_material(Gtexdraw.ob, matnr+1);
- int validtexture=0;
+ Material *ma = give_current_material(Gtexdraw.ob, matnr + 1);
+ int validtexture = 0;
if (ma && (ma->game.flag & GEMAT_INVISIBLE))
return DM_DRAW_OPTION_SKIP;
@@ -405,7 +405,7 @@ static DMDrawOption draw_tface__set_draw_legacy(MTFace *tface, int has_mcol, int
glColor3ub(0xFF, 0x00, 0xFF);
return DM_DRAW_OPTION_NO_MCOL; /* Don't set color */
}
- else if (ma && (ma->shade_flag&MA_OBCOLOR)) {
+ else if (ma && (ma->shade_flag & MA_OBCOLOR)) {
glColor3ubv(Gtexdraw.obcol);
return DM_DRAW_OPTION_NO_MCOL; /* Don't set color */
}
@@ -438,7 +438,7 @@ static DMDrawOption draw_mcol__set_draw_legacy(MTFace *UNUSED(tface), int has_mc
static DMDrawOption draw_tface__set_draw(MTFace *tface, int has_mcol, int matnr)
{
- Material *ma= give_current_material(Gtexdraw.ob, matnr+1);
+ Material *ma = give_current_material(Gtexdraw.ob, matnr + 1);
if (ma && (ma->game.flag & GEMAT_INVISIBLE)) return 0;
@@ -461,78 +461,78 @@ static void add_tface_color_layer(DerivedMesh *dm)
MTFace *tface = DM_get_poly_data_layer(dm, CD_MTFACE);
MFace *mface = dm->getTessFaceArray(dm);
MCol *finalCol;
- int i,j;
+ int i, j;
MCol *mcol = dm->getTessFaceDataArray(dm, CD_PREVIEW_MCOL);
if (!mcol)
mcol = dm->getTessFaceDataArray(dm, CD_MCOL);
- finalCol = MEM_mallocN(sizeof(MCol)*4*dm->getNumTessFaces(dm),"add_tface_color_layer");
- for (i=0;i<dm->getNumTessFaces(dm);i++) {
- Material *ma= give_current_material(Gtexdraw.ob, mface[i].mat_nr+1);
+ finalCol = MEM_mallocN(sizeof(MCol) * 4 * dm->getNumTessFaces(dm), "add_tface_color_layer");
+ for (i = 0; i < dm->getNumTessFaces(dm); i++) {
+ Material *ma = give_current_material(Gtexdraw.ob, mface[i].mat_nr + 1);
- if (ma && (ma->game.flag&GEMAT_INVISIBLE)) {
- if ( mcol )
- memcpy(&finalCol[i*4],&mcol[i*4],sizeof(MCol)*4);
+ if (ma && (ma->game.flag & GEMAT_INVISIBLE)) {
+ if (mcol)
+ memcpy(&finalCol[i * 4], &mcol[i * 4], sizeof(MCol) * 4);
else
- for (j=0;j<4;j++) {
- finalCol[i*4+j].b = 255;
- finalCol[i*4+j].g = 255;
- finalCol[i*4+j].r = 255;
+ for (j = 0; j < 4; j++) {
+ finalCol[i * 4 + j].b = 255;
+ finalCol[i * 4 + j].g = 255;
+ finalCol[i * 4 + j].r = 255;
}
}
else if (tface && mface && set_draw_settings_cached(0, tface, ma, Gtexdraw)) {
- for (j=0;j<4;j++) {
- finalCol[i*4+j].b = 255;
- finalCol[i*4+j].g = 0;
- finalCol[i*4+j].r = 255;
+ for (j = 0; j < 4; j++) {
+ finalCol[i * 4 + j].b = 255;
+ finalCol[i * 4 + j].g = 0;
+ finalCol[i * 4 + j].r = 255;
}
}
else if (tface && (tface->mode & TF_OBCOL)) {
- for (j=0;j<4;j++) {
- finalCol[i*4+j].b = FTOCHAR(Gtexdraw.obcol[0]);
- finalCol[i*4+j].g = FTOCHAR(Gtexdraw.obcol[1]);
- finalCol[i*4+j].r = FTOCHAR(Gtexdraw.obcol[2]);
+ for (j = 0; j < 4; j++) {
+ finalCol[i * 4 + j].b = FTOCHAR(Gtexdraw.obcol[0]);
+ finalCol[i * 4 + j].g = FTOCHAR(Gtexdraw.obcol[1]);
+ finalCol[i * 4 + j].r = FTOCHAR(Gtexdraw.obcol[2]);
}
}
else if (!mcol) {
if (tface) {
- for (j=0;j<4;j++) {
- finalCol[i*4+j].b = 255;
- finalCol[i*4+j].g = 255;
- finalCol[i*4+j].r = 255;
+ for (j = 0; j < 4; j++) {
+ finalCol[i * 4 + j].b = 255;
+ finalCol[i * 4 + j].g = 255;
+ finalCol[i * 4 + j].r = 255;
}
}
else {
float col[3];
- Material *ma= give_current_material(Gtexdraw.ob, mface[i].mat_nr+1);
+ Material *ma = give_current_material(Gtexdraw.ob, mface[i].mat_nr + 1);
if (ma) {
if (Gtexdraw.color_profile) linearrgb_to_srgb_v3_v3(col, &ma->r);
else copy_v3_v3(col, &ma->r);
- for (j=0;j<4;j++) {
- finalCol[i*4+j].b = FTOCHAR(col[0]);
- finalCol[i*4+j].g = FTOCHAR(col[1]);
- finalCol[i*4+j].r = FTOCHAR(col[2]);
+ for (j = 0; j < 4; j++) {
+ finalCol[i * 4 + j].b = FTOCHAR(col[0]);
+ finalCol[i * 4 + j].g = FTOCHAR(col[1]);
+ finalCol[i * 4 + j].r = FTOCHAR(col[2]);
}
}
else
- for (j=0;j<4;j++) {
- finalCol[i*4+j].b = 255;
- finalCol[i*4+j].g = 255;
- finalCol[i*4+j].r = 255;
+ for (j = 0; j < 4; j++) {
+ finalCol[i * 4 + j].b = 255;
+ finalCol[i * 4 + j].g = 255;
+ finalCol[i * 4 + j].r = 255;
}
}
}
else {
- for (j=0;j<4;j++) {
- finalCol[i*4+j].r = mcol[i*4+j].r;
- finalCol[i*4+j].g = mcol[i*4+j].g;
- finalCol[i*4+j].b = mcol[i*4+j].b;
+ for (j = 0; j < 4; j++) {
+ finalCol[i * 4 + j].r = mcol[i * 4 + j].r;
+ finalCol[i * 4 + j].g = mcol[i * 4 + j].g;
+ finalCol[i * 4 + j].b = mcol[i * 4 + j].b;
}
}
}
- CustomData_add_layer( &dm->faceData, CD_TEXTURE_MCOL, CD_ASSIGN, finalCol, dm->numTessFaceData );
+ CustomData_add_layer(&dm->faceData, CD_TEXTURE_MCOL, CD_ASSIGN, finalCol, dm->numTessFaceData);
}
static DMDrawOption draw_tface_mapped__set_draw(void *userData, int index)
@@ -549,7 +549,7 @@ static DMDrawOption draw_tface_mapped__set_draw(void *userData, int index)
}
else {
MTexPoly *tpoly = (me->mtpoly) ? &me->mtpoly[index] : NULL;
- MTFace mtf= {{{0}}};
+ MTFace mtf = {{{0}}};
int matnr = mpoly->mat_nr;
if (tpoly) {
@@ -564,13 +564,13 @@ static DMDrawOption draw_em_tf_mapped__set_draw(void *userData, int index)
{
drawEMTFMapped_userData *data = userData;
BMEditMesh *em = data->em;
- BMFace *efa= EDBM_get_face_for_index(em, index);
+ BMFace *efa = EDBM_face_at_index(em, index);
- if (efa==NULL || BM_elem_flag_test(efa, BM_ELEM_HIDDEN)) {
+ if (efa == NULL || BM_elem_flag_test(efa, BM_ELEM_HIDDEN)) {
return DM_DRAW_OPTION_SKIP;
}
else {
- MTFace mtf= {{{0}}};
+ MTFace mtf = {{{0}}};
int matnr = efa->mat_nr;
if (data->has_mtface) {
@@ -579,16 +579,16 @@ static DMDrawOption draw_em_tf_mapped__set_draw(void *userData, int index)
}
return draw_tface__set_draw_legacy(data->has_mtface ? &mtf : NULL,
- data->has_mcol, matnr);
+ data->has_mcol, matnr);
}
}
static DMDrawOption wpaint__setSolidDrawOptions_material(void *userData, int index)
{
- Mesh *me = (Mesh*)userData;
+ Mesh *me = (Mesh *)userData;
if (me->mat && me->mpoly) {
- Material *ma= me->mat[me->mpoly[index].mat_nr];
+ Material *ma = me->mat[me->mpoly[index].mat_nr];
if (ma && (ma->game.flag & GEMAT_INVISIBLE)) {
return DM_DRAW_OPTION_SKIP;
}
@@ -600,7 +600,7 @@ static DMDrawOption wpaint__setSolidDrawOptions_material(void *userData, int ind
/* when face select is on, use face hidden flag */
static DMDrawOption wpaint__setSolidDrawOptions_facemask(void *userData, int index)
{
- Mesh *me = (Mesh*)userData;
+ Mesh *me = (Mesh *)userData;
MPoly *mp = &me->mpoly[index];
if (mp->flag & ME_HIDE)
return DM_DRAW_OPTION_SKIP;
@@ -615,7 +615,7 @@ static void draw_mesh_text(Scene *scene, Object *ob, int glsl)
MTexPoly *mtpoly = me->mtpoly;
MLoopUV *mloopuv = me->mloopuv;
MLoopUV *luv;
- MLoopCol *mloopcol = me->mloopcol; /* why does mcol exist? */
+ MLoopCol *mloopcol = me->mloopcol; /* why does mcol exist? */
MLoopCol *lcol;
bProperty *prop = get_ob_property(ob, "Text");
@@ -623,7 +623,7 @@ static void draw_mesh_text(Scene *scene, Object *ob, int glsl)
int a, totpoly = me->totpoly;
/* fake values to pass to GPU_render_text() */
- MCol tmp_mcol[4] = {{0}};
+ MCol tmp_mcol[4] = {{0}};
MCol *tmp_mcol_pt = mloopcol ? tmp_mcol : NULL;
MTFace tmp_tf = {{{0}}};
@@ -634,33 +634,33 @@ static void draw_mesh_text(Scene *scene, Object *ob, int glsl)
/* don't draw when editing */
if (ob->mode & OB_MODE_EDIT)
return;
- else if (ob==OBACT)
+ else if (ob == OBACT)
if (paint_facesel_test(ob) || paint_vertsel_test(ob))
return;
ddm = mesh_get_derived_deform(scene, ob, CD_MASK_BAREMESH);
- for (a=0, mp=mface; a<totpoly ; a++, mtpoly++, mp++) {
- short matnr= mp->mat_nr;
- int mf_smooth= mp->flag & ME_SMOOTH;
+ for (a = 0, mp = mface; a < totpoly; a++, mtpoly++, mp++) {
+ short matnr = mp->mat_nr;
+ int mf_smooth = mp->flag & ME_SMOOTH;
Material *mat = me->mat[matnr];
- int mode= mat->game.flag;
+ int mode = mat->game.flag;
- if (!(mode&GEMAT_INVISIBLE) && (mode&GEMAT_TEXT) && mp->totloop >= 3) {
+ if (!(mode & GEMAT_INVISIBLE) && (mode & GEMAT_TEXT) && mp->totloop >= 3) {
/* get the polygon as a tri/quad */
int mp_vi[4];
float v1[3], v2[3], v3[3], v4[3];
char string[MAX_PROPSTRING];
- int characters, i, glattrib= -1, badtex= 0;
+ int characters, i, glattrib = -1, badtex = 0;
/* TEXFACE */
ME_MTEXFACE_CPY(&tmp_tf, mtpoly);
if (glsl) {
- GPU_enable_material(matnr+1, &gattribs);
+ GPU_enable_material(matnr + 1, &gattribs);
- for (i=0; i<gattribs.totlayer; i++) {
+ for (i = 0; i < gattribs.totlayer; i++) {
if (gattribs.layer[i].type == CD_MTFACE) {
glattrib = gattribs.layer[i].glindex;
break;
@@ -675,9 +675,9 @@ static void draw_mesh_text(Scene *scene, Object *ob, int glsl)
}
mp_vi[0] = me->mloop[mp->loopstart + 0].v;
- mp_vi[1] = me->mloop[mp->loopstart + 1].v;
- mp_vi[2] = me->mloop[mp->loopstart + 2].v;
- mp_vi[3] = (mp->totloop >= 4) ? me->mloop[mp->loopstart + 3].v : 0;
+ mp_vi[1] = me->mloop[mp->loopstart + 1].v;
+ mp_vi[2] = me->mloop[mp->loopstart + 2].v;
+ mp_vi[3] = (mp->totloop >= 4) ? me->mloop[mp->loopstart + 3].v : 0;
/* UV */
luv = &mloopuv[mp->loopstart];
@@ -721,13 +721,13 @@ static void draw_mesh_text(Scene *scene, Object *ob, int glsl)
if (!mf_smooth) {
float nor[3];
- normal_tri_v3( nor,v1, v2, v3);
+ normal_tri_v3(nor, v1, v2, v3);
glNormal3fv(nor);
}
GPU_render_text(&tmp_tf, mode, string, characters,
- (unsigned int*)tmp_mcol_pt, v1, v2, v3, (mp->totloop >= 4 ? v4: NULL), glattrib);
+ (unsigned int *)tmp_mcol_pt, v1, v2, v3, (mp->totloop >= 4 ? v4 : NULL), glattrib);
}
}
@@ -749,7 +749,7 @@ static int compareDrawOptions(void *userData, int cur_index, int next_index)
static int compareDrawOptionsEm(void *userData, int cur_index, int next_index)
{
- drawEMTFMapped_userData *data= userData;
+ drawEMTFMapped_userData *data = userData;
if (data->mf && data->mf[cur_index].mat_nr != data->mf[next_index].mat_nr)
return 0;
@@ -762,7 +762,7 @@ static int compareDrawOptionsEm(void *userData, int cur_index, int next_index)
void draw_mesh_textured_old(Scene *scene, View3D *v3d, RegionView3D *rv3d, Object *ob, DerivedMesh *dm, int draw_flags)
{
- Mesh *me= ob->data;
+ Mesh *me = ob->data;
/* correct for negative scale */
if (ob->transflag & OB_NEG_SCALE) glFrontFace(GL_CW);
@@ -771,23 +771,23 @@ void draw_mesh_textured_old(Scene *scene, View3D *v3d, RegionView3D *rv3d, Objec
/* draw the textured mesh */
draw_textured_begin(scene, v3d, rv3d, ob);
- glColor4f(1.0f,1.0f,1.0f,1.0f);
+ glColor4f(1.0f, 1.0f, 1.0f, 1.0f);
if (ob->mode & OB_MODE_EDIT) {
drawEMTFMapped_userData data;
- data.em= me->edit_btmesh;
- data.has_mcol= CustomData_has_layer(&me->edit_btmesh->bm->ldata, CD_MLOOPCOL);
- data.has_mtface= CustomData_has_layer(&me->edit_btmesh->bm->pdata, CD_MTEXPOLY);
- data.mf= DM_get_tessface_data_layer(dm, CD_MFACE);
- data.tf= DM_get_tessface_data_layer(dm, CD_MTFACE);
+ data.em = me->edit_btmesh;
+ data.has_mcol = CustomData_has_layer(&me->edit_btmesh->bm->ldata, CD_MLOOPCOL);
+ data.has_mtface = CustomData_has_layer(&me->edit_btmesh->bm->pdata, CD_MTEXPOLY);
+ data.mf = DM_get_tessface_data_layer(dm, CD_MFACE);
+ data.tf = DM_get_tessface_data_layer(dm, CD_MTFACE);
dm->drawMappedFacesTex(dm, draw_em_tf_mapped__set_draw, compareDrawOptionsEm, &data);
}
else if (draw_flags & DRAW_FACE_SELECT) {
if (ob->mode & OB_MODE_WEIGHT_PAINT)
dm->drawMappedFaces(dm, wpaint__setSolidDrawOptions_facemask, GPU_enable_material, NULL, me,
- DM_DRAW_USE_COLORS | DM_DRAW_ALWAYS_SMOOTH);
+ DM_DRAW_USE_COLORS | DM_DRAW_ALWAYS_SMOOTH);
else
dm->drawMappedFacesTex(dm, me->mpoly ? draw_tface_mapped__set_draw : NULL, NULL, me);
}
@@ -801,7 +801,7 @@ void draw_mesh_textured_old(Scene *scene, View3D *v3d, RegionView3D *rv3d, Objec
else {
drawTFace_userData userData;
- if (!CustomData_has_layer(&dm->faceData,CD_TEXTURE_MCOL))
+ if (!CustomData_has_layer(&dm->faceData, CD_TEXTURE_MCOL))
add_tface_color_layer(dm);
userData.mf = DM_get_tessface_data_layer(dm, CD_MFACE);
@@ -849,22 +849,22 @@ static void tex_mat_set_material_cb(void *UNUSED(userData), int mat_nr, void *at
static void tex_mat_set_texture_cb(void *userData, int mat_nr, void *attribs)
{
/* texture draw mode without GLSL */
- TexMatCallback *data= (TexMatCallback*)userData;
+ TexMatCallback *data = (TexMatCallback *)userData;
GPUVertexAttribs *gattribs = attribs;
Image *ima;
ImageUser *iuser;
bNode *node;
- int texture_set= 0;
+ int texture_set = 0;
/* draw image texture if we find one */
if (ED_object_get_active_image(data->ob, mat_nr, &ima, &iuser, &node)) {
/* get openl texture */
- int mipmap= 1;
- int bindcode= (ima)? GPU_verify_image(ima, iuser, 0, 0, mipmap): 0;
+ int mipmap = 1;
+ int bindcode = (ima) ? GPU_verify_image(ima, iuser, 0, 0, mipmap) : 0;
float zero[4] = {0.0f, 0.0f, 0.0f, 0.0f};
if (bindcode) {
- NodeTexBase *texbase= node->storage;
+ NodeTexBase *texbase = node->storage;
/* disable existing material */
GPU_disable_material();
@@ -886,12 +886,12 @@ static void tex_mat_set_texture_cb(void *userData, int mat_nr, void *attribs)
/* use active UV texture layer */
memset(gattribs, 0, sizeof(*gattribs));
- gattribs->layer[0].type= CD_MTFACE;
- gattribs->layer[0].name[0]= '\0';
- gattribs->layer[0].gltexco= 1;
- gattribs->totlayer= 1;
+ gattribs->layer[0].type = CD_MTFACE;
+ gattribs->layer[0].name[0] = '\0';
+ gattribs->layer[0].gltexco = 1;
+ gattribs->totlayer = 1;
- texture_set= 1;
+ texture_set = 1;
}
}
@@ -912,8 +912,8 @@ static void tex_mat_set_texture_cb(void *userData, int mat_nr, void *attribs)
static int tex_mat_set_face_mesh_cb(void *userData, int index)
{
/* faceselect mode face hiding */
- TexMatCallback *data= (TexMatCallback*)userData;
- Mesh *me = (Mesh*)data->me;
+ TexMatCallback *data = (TexMatCallback *)userData;
+ Mesh *me = (Mesh *)data->me;
MPoly *mp = &me->mpoly[index];
return !(mp->flag & ME_HIDE);
@@ -922,9 +922,9 @@ static int tex_mat_set_face_mesh_cb(void *userData, int index)
static int tex_mat_set_face_editmesh_cb(void *userData, int index)
{
/* editmode face hiding */
- TexMatCallback *data= (TexMatCallback*)userData;
- Mesh *me = (Mesh*)data->me;
- BMFace *efa= EDBM_get_face_for_index(me->edit_btmesh, index);
+ TexMatCallback *data = (TexMatCallback *)userData;
+ Mesh *me = (Mesh *)data->me;
+ BMFace *efa = EDBM_face_at_index(me->edit_btmesh, index);
return !BM_elem_flag_test(efa, BM_ELEM_HIDDEN);
}
@@ -945,32 +945,32 @@ void draw_mesh_textured(Scene *scene, View3D *v3d, RegionView3D *rv3d, Object *o
if (ob->mode & OB_MODE_WEIGHT_PAINT) {
/* weight paint mode exception */
dm->drawMappedFaces(dm, wpaint__setSolidDrawOptions_material,
- GPU_enable_material, NULL, ob->data, DM_DRAW_USE_COLORS | DM_DRAW_ALWAYS_SMOOTH);
+ GPU_enable_material, NULL, ob->data, DM_DRAW_USE_COLORS | DM_DRAW_ALWAYS_SMOOTH);
}
else {
- Mesh *me= ob->data;
+ Mesh *me = ob->data;
TexMatCallback data = {scene, ob, me, dm};
- int (*set_face_cb)(void*, int);
+ int (*set_face_cb)(void *, int);
int glsl;
/* face hiding callback depending on mode */
if (ob == scene->obedit)
- set_face_cb= tex_mat_set_face_editmesh_cb;
+ set_face_cb = tex_mat_set_face_editmesh_cb;
else if (draw_flags & DRAW_FACE_SELECT)
- set_face_cb= tex_mat_set_face_mesh_cb;
+ set_face_cb = tex_mat_set_face_mesh_cb;
else
- set_face_cb= NULL;
+ set_face_cb = NULL;
/* test if we can use glsl */
- glsl= (v3d->drawtype == OB_MATERIAL) && GPU_glsl_support();
+ glsl = (v3d->drawtype == OB_MATERIAL) && GPU_glsl_support();
GPU_begin_object_materials(v3d, rv3d, scene, ob, glsl, NULL);
if (glsl) {
/* draw glsl */
dm->drawMappedFacesMat(dm,
- tex_mat_set_material_cb,
- set_face_cb, &data);
+ tex_mat_set_material_cb,
+ set_face_cb, &data);
}
else {
float zero[4] = {0.0f, 0.0f, 0.0f, 0.0f};
@@ -981,8 +981,8 @@ void draw_mesh_textured(Scene *scene, View3D *v3d, RegionView3D *rv3d, Object *o
glMateriali(GL_FRONT_AND_BACK, GL_SHININESS, 0);
dm->drawMappedFacesMat(dm,
- tex_mat_set_texture_cb,
- set_face_cb, &data);
+ tex_mat_set_texture_cb,
+ set_face_cb, &data);
}
GPU_end_object_materials();