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:
authorCampbell Barton <ideasman42@gmail.com>2012-01-24 23:57:34 +0400
committerCampbell Barton <ideasman42@gmail.com>2012-01-24 23:57:34 +0400
commit439e9a39a8dd16076648d8e3eaa6a721ce349a57 (patch)
treeef00175be1496e7d08894c6c0721734dc87dbeb4 /source/blender/editors
parent7a628a3967b08f8a099791572112a9e68c4144c6 (diff)
use a struct to pass normals to normal draw derived mesh callbacks (no functional changes)
Diffstat (limited to 'source/blender/editors')
-rw-r--r--source/blender/editors/space_view3d/drawobject.c42
1 files changed, 27 insertions, 15 deletions
diff --git a/source/blender/editors/space_view3d/drawobject.c b/source/blender/editors/space_view3d/drawobject.c
index 1482340632e..2766ddab15b 100644
--- a/source/blender/editors/space_view3d/drawobject.c
+++ b/source/blender/editors/space_view3d/drawobject.c
@@ -154,6 +154,10 @@ typedef struct drawDMFacesSel_userData {
int *orig_index;
} drawDMFacesSel_userData;
+typedef struct drawDMNormal_userData {
+ float normalsize;
+} drawDMNormal_userData;
+
typedef struct bbsObmodeMeshVerts_userData {
void *offset;
MVert *mvert;
@@ -2212,20 +2216,24 @@ void nurbs_foreachScreenVert(
static void draw_dm_face_normals__mapFunc(void *userData, int index, float *cent, float *no)
{
- ToolSettings *ts= ((Scene *)userData)->toolsettings;
+ drawDMNormal_userData *data = userData;
EditFace *efa = EM_get_face_for_index(index);
if (efa->h==0 && efa->fgonf!=EM_FGON) {
glVertex3fv(cent);
- glVertex3f( cent[0] + no[0]*ts->normalsize,
- cent[1] + no[1]*ts->normalsize,
- cent[2] + no[2]*ts->normalsize);
+ glVertex3f(cent[0] + no[0] * data->normalsize,
+ cent[1] + no[1] * data->normalsize,
+ cent[2] + no[2] * data->normalsize);
}
}
static void draw_dm_face_normals(Scene *scene, DerivedMesh *dm)
{
+ drawDMNormal_userData data;
+
+ data.normalsize = scene->toolsettings->normalsize;
+
glBegin(GL_LINES);
- dm->foreachMappedFaceCenter(dm, draw_dm_face_normals__mapFunc, scene);
+ dm->foreachMappedFaceCenter(dm, draw_dm_face_normals__mapFunc, &data);
glEnd();
}
@@ -2247,28 +2255,32 @@ static void draw_dm_face_centers(DerivedMesh *dm, int sel)
static void draw_dm_vert_normals__mapFunc(void *userData, int index, float *co, float *no_f, short *no_s)
{
- Scene *scene= (Scene *)userData;
- ToolSettings *ts= scene->toolsettings;
+ drawDMNormal_userData *data = userData;
EditVert *eve = EM_get_vert_for_index(index);
if (eve->h==0) {
glVertex3fv(co);
if (no_f) {
- glVertex3f( co[0] + no_f[0]*ts->normalsize,
- co[1] + no_f[1]*ts->normalsize,
- co[2] + no_f[2]*ts->normalsize);
- } else {
- glVertex3f( co[0] + no_s[0]*ts->normalsize/32767.0f,
- co[1] + no_s[1]*ts->normalsize/32767.0f,
- co[2] + no_s[2]*ts->normalsize/32767.0f);
+ glVertex3f(co[0] + no_f[0] * data->normalsize,
+ co[1] + no_f[1] * data->normalsize,
+ co[2] + no_f[2] * data->normalsize);
+ }
+ else {
+ glVertex3f(co[0] + no_s[0] * (data->normalsize / 32767.0f),
+ co[1] + no_s[1] * (data->normalsize / 32767.0f),
+ co[2] + no_s[2] * (data->normalsize / 32767.0f));
}
}
}
static void draw_dm_vert_normals(Scene *scene, DerivedMesh *dm)
{
+ drawDMNormal_userData data;
+
+ data.normalsize = scene->toolsettings->normalsize;
+
glBegin(GL_LINES);
- dm->foreachMappedVert(dm, draw_dm_vert_normals__mapFunc, scene);
+ dm->foreachMappedVert(dm, draw_dm_vert_normals__mapFunc, &data);
glEnd();
}