Changeset View
Changeset View
Standalone View
Standalone View
source/blender/editors/space_view3d/drawobject.c
| Context not available. | |||||
| /* Outer circle */ | /* Outer circle */ | ||||
| circrad = 3.0f * lampsize; | circrad = 3.0f * lampsize; | ||||
| setlinestyle(3); | |||||
| if ((dflag & DRAW_CONSTSTIPPLE) == 0) | |||||
| setlinestyle(3); | |||||
| drawcircball(GL_LINE_LOOP, vec, circrad, imat); | drawcircball(GL_LINE_LOOP, vec, circrad, imat); | ||||
| Context not available. | |||||
| } | } | ||||
| } | } | ||||
| else { | else { | ||||
| setlinestyle(3); | if ((dflag & DRAW_CONSTSTIPPLE) == 0) | ||||
| setlinestyle(3); | |||||
| circrad = 0.0f; | circrad = 0.0f; | ||||
| } | } | ||||
| Context not available. | |||||
| /* center */ | /* center */ | ||||
| glTranslatef(vec[0], vec[1], vec[2]); | glTranslatef(vec[0], vec[1], vec[2]); | ||||
| setlinestyle(3); | if ((dflag & DRAW_CONSTSTIPPLE) == 0) | ||||
| setlinestyle(3); | |||||
| glBegin(GL_LINES); | glBegin(GL_LINES); | ||||
| for (axis = 0; axis < 8; axis++) { | for (axis = 0; axis < 8; axis++) { | ||||
| Context not available. | |||||
| zero_v3(vec); | zero_v3(vec); | ||||
| outdist = 0.14; mul = 1.4; dir = 1; | outdist = 0.14; mul = 1.4; dir = 1; | ||||
| setlinestyle(4); | if ((dflag & DRAW_CONSTSTIPPLE) == 0) | ||||
| setlinestyle(4); | |||||
| /* loop over the 4 compass points, and draw each arc as a LINE_STRIP */ | /* loop over the 4 compass points, and draw each arc as a LINE_STRIP */ | ||||
| for (axis = 0; axis < 4; axis++) { | for (axis = 0; axis < 4; axis++) { | ||||
| float v[3] = {0.0, 0.0, 0.0}; | float v[3] = {0.0, 0.0, 0.0}; | ||||
| Context not available. | |||||
| glLoadMatrixf(rv3d->viewmat); | glLoadMatrixf(rv3d->viewmat); | ||||
| copy_v3_v3(vec, ob->obmat[3]); | copy_v3_v3(vec, ob->obmat[3]); | ||||
| setlinestyle(0); | if ((dflag & DRAW_CONSTSTIPPLE) == 0) | ||||
| setlinestyle(0); | |||||
| if ((la->type == LA_SPOT) && (la->mode & LA_SHAD_BUF) && (is_view == false)) { | if ((la->type == LA_SPOT) && (la->mode & LA_SHAD_BUF) && (is_view == false)) { | ||||
| drawshadbuflimits(la, ob->obmat); | drawshadbuflimits(la, ob->obmat); | ||||
| Context not available. | |||||
| /* 6. draw the arrays */ | /* 6. draw the arrays */ | ||||
| /* 7. clean up */ | /* 7. clean up */ | ||||
| static void draw_new_particle_system(Scene *scene, View3D *v3d, RegionView3D *rv3d, | static void draw_new_particle_system(Scene *scene, View3D *v3d, RegionView3D *rv3d, | ||||
| Base *base, ParticleSystem *psys, int ob_dt) | Base *base, ParticleSystem *psys, int ob_dt, const short dflag) | ||||
| { | { | ||||
| Object *ob = base->object; | Object *ob = base->object; | ||||
| ParticleEditSettings *pset = PE_settings(scene); | ParticleEditSettings *pset = PE_settings(scene); | ||||
| Context not available. | |||||
| } | } | ||||
| if (part->draw & PART_DRAW_SIZE) { | if (part->draw & PART_DRAW_SIZE) { | ||||
| setlinestyle(3); | if ((dflag & DRAW_CONSTSTIPPLE) == 0) | ||||
| setlinestyle(3); | |||||
| drawcircball(GL_LINE_LOOP, state.co, pa_size, imat); | drawcircball(GL_LINE_LOOP, state.co, pa_size, imat); | ||||
| setlinestyle(0); | |||||
| if ((dflag & DRAW_CONSTSTIPPLE) == 0) | |||||
| setlinestyle(0); | |||||
| } | } | ||||
| Context not available. | |||||
| } | } | ||||
| /*path end*/ | /*path end*/ | ||||
| setlinestyle(3); | if ((dflag & DRAW_CONSTSTIPPLE) == 0) | ||||
| setlinestyle(3); | |||||
| where_on_path(ob, 1.0f, guidevec1, guidevec2, NULL, NULL, NULL); | where_on_path(ob, 1.0f, guidevec1, guidevec2, NULL, NULL, NULL); | ||||
| drawcircball(GL_LINE_LOOP, guidevec1, mindist, imat); | drawcircball(GL_LINE_LOOP, guidevec1, mindist, imat); | ||||
| /*path beginning*/ | /*path beginning*/ | ||||
| setlinestyle(0); | if ((dflag & DRAW_CONSTSTIPPLE) == 0) | ||||
| setlinestyle(0); | |||||
| where_on_path(ob, 0.0f, guidevec1, guidevec2, NULL, NULL, NULL); | where_on_path(ob, 0.0f, guidevec1, guidevec2, NULL, NULL, NULL); | ||||
| drawcircball(GL_LINE_LOOP, guidevec1, mindist, imat); | drawcircball(GL_LINE_LOOP, guidevec1, mindist, imat); | ||||
| Context not available. | |||||
| } | } | ||||
| } | } | ||||
| setlinestyle(3); | if ((dflag & DRAW_CONSTSTIPPLE) == 0) | ||||
| setlinestyle(3); | |||||
| if ((dflag & DRAW_CONSTCOLOR) == 0) { | if ((dflag & DRAW_CONSTCOLOR) == 0) { | ||||
| ob_wire_color_blend_theme_id(ob_wire_col, TH_BACK, 0.5f); | ob_wire_color_blend_theme_id(ob_wire_col, TH_BACK, 0.5f); | ||||
| Context not available. | |||||
| drawcone(vec, distance * sinf(radius), -distance * cosf(radius), tmat); | drawcone(vec, distance * sinf(radius), -distance * cosf(radius), tmat); | ||||
| } | } | ||||
| } | } | ||||
| setlinestyle(0); | |||||
| if ((dflag & DRAW_CONSTSTIPPLE) == 0) | |||||
| setlinestyle(0); | |||||
| } | } | ||||
| static void draw_box(float vec[8][3]) | static void draw_box(float vec[8][3]) | ||||
| Context not available. | |||||
| } | } | ||||
| } | } | ||||
| static void drawtexspace(Object *ob) | static void drawtexspace(Object *ob, const short dflag) | ||||
| { | { | ||||
| float vec[8][3], loc[3], size[3]; | float vec[8][3], loc[3], size[3]; | ||||
| Context not available. | |||||
| vec[0][2] = vec[3][2] = vec[4][2] = vec[7][2] = loc[2] - size[2]; | vec[0][2] = vec[3][2] = vec[4][2] = vec[7][2] = loc[2] - size[2]; | ||||
| vec[1][2] = vec[2][2] = vec[5][2] = vec[6][2] = loc[2] + size[2]; | vec[1][2] = vec[2][2] = vec[5][2] = vec[6][2] = loc[2] + size[2]; | ||||
| setlinestyle(2); | if ((dflag & DRAW_CONSTSTIPPLE) == 0) | ||||
| setlinestyle(2); | |||||
| draw_box(vec); | draw_box(vec); | ||||
| setlinestyle(0); | if ((dflag & DRAW_CONSTSTIPPLE) == 0) | ||||
| setlinestyle(0); | |||||
| } | } | ||||
| /* draws wire outline */ | /* draws wire outline */ | ||||
| Context not available. | |||||
| } | } | ||||
| /* should be called in view space */ | /* should be called in view space */ | ||||
| static void draw_hooks(Object *ob) | static void draw_hooks(Object *ob, const short dflag) | ||||
| { | { | ||||
| ModifierData *md; | ModifierData *md; | ||||
| float vec[3]; | float vec[3]; | ||||
| Context not available. | |||||
| mul_v3_m4v3(vec, ob->obmat, hmd->cent); | mul_v3_m4v3(vec, ob->obmat, hmd->cent); | ||||
| if (hmd->object) { | if (hmd->object) { | ||||
| setlinestyle(3); | if ((dflag & DRAW_CONSTSTIPPLE) == 0) | ||||
| setlinestyle(3); | |||||
| glBegin(GL_LINES); | glBegin(GL_LINES); | ||||
| glVertex3fv(hmd->object->obmat[3]); | glVertex3fv(hmd->object->obmat[3]); | ||||
| glVertex3fv(vec); | glVertex3fv(vec); | ||||
| glEnd(); | glEnd(); | ||||
| setlinestyle(0); | if ((dflag & DRAW_CONSTSTIPPLE) == 0) | ||||
| setlinestyle(0); | |||||
| } | } | ||||
| glPointSize(3.0); | glPointSize(3.0); | ||||
| Context not available. | |||||
| eul_to_mat4(mat, &data->axX); | eul_to_mat4(mat, &data->axX); | ||||
| glLineWidth(4.0f); | glLineWidth(4.0f); | ||||
| setlinestyle(2); | |||||
| if ((dflag & DRAW_CONSTSTIPPLE) == 0) | |||||
| setlinestyle(2); | |||||
| for (axis = 0; axis < 3; axis++) { | for (axis = 0; axis < 3; axis++) { | ||||
| float dir[3] = {0, 0, 0}; | float dir[3] = {0, 0, 0}; | ||||
| float v[3]; | float v[3]; | ||||
| Context not available. | |||||
| } | } | ||||
| } | } | ||||
| glLineWidth(1.0f); | glLineWidth(1.0f); | ||||
| setlinestyle(0); | |||||
| if ((dflag & DRAW_CONSTSTIPPLE) == 0) | |||||
| setlinestyle(0); | |||||
| } | } | ||||
| static void draw_object_wire_color(Scene *scene, Base *base, unsigned char r_ob_wire_col[4]) | static void draw_object_wire_color(Scene *scene, Base *base, unsigned char r_ob_wire_col[4]) | ||||
| Context not available. | |||||
| const bool is_obact = (ob == OBACT); | const bool is_obact = (ob == OBACT); | ||||
| const bool render_override = (v3d->flag2 & V3D_RENDER_OVERRIDE) != 0; | const bool render_override = (v3d->flag2 & V3D_RENDER_OVERRIDE) != 0; | ||||
| const bool is_picking = (G.f & G_PICKSEL) != 0; | const bool is_picking = (G.f & G_PICKSEL) != 0; | ||||
| const bool is_wire_color = V3D_IS_WIRECOLOR(v3d); | |||||
| bool particle_skip_object = false; /* Draw particles but not their emitter object. */ | bool particle_skip_object = false; /* Draw particles but not their emitter object. */ | ||||
| /* only once set now, will be removed too, should become a global standard */ | /* only once set now, will be removed too, should become a global standard */ | ||||
| Context not available. | |||||
| ED_view3d_project_base(ar, base); | ED_view3d_project_base(ar, base); | ||||
| draw_object_wire_color(scene, base, _ob_wire_col); | if (is_wire_color) { | ||||
| _ob_wire_col[0] = (unsigned char)(ob->col[0] * 255); | |||||
| _ob_wire_col[1] = (unsigned char)(ob->col[1] * 255); | |||||
| _ob_wire_col[2] = (unsigned char)(ob->col[2] * 255); | |||||
| _ob_wire_col[3] = 255; | |||||
| } | |||||
| else { | |||||
| draw_object_wire_color(scene, base, _ob_wire_col); | |||||
| } | |||||
| ob_wire_col = _ob_wire_col; | ob_wire_col = _ob_wire_col; | ||||
| glColor3ubv(ob_wire_col); | glColor3ubv(ob_wire_col); | ||||
| Context not available. | |||||
| vec2[0] += cu->linewidth; | vec2[0] += cu->linewidth; | ||||
| vec1[1] += cu->linedist * cu->fsize; | vec1[1] += cu->linedist * cu->fsize; | ||||
| vec2[1] -= cu->lines * cu->linedist * cu->fsize; | vec2[1] -= cu->lines * cu->linedist * cu->fsize; | ||||
| setlinestyle(3); | |||||
| if ((dflag & DRAW_CONSTSTIPPLE) == 0) | |||||
| setlinestyle(3); | |||||
| glBegin(GL_LINE_STRIP); | glBegin(GL_LINE_STRIP); | ||||
| glVertex2fv(vec1); | glVertex2fv(vec1); | ||||
| glVertex2fv(vec2); | glVertex2fv(vec2); | ||||
| glEnd(); | glEnd(); | ||||
| setlinestyle(0); | |||||
| if ((dflag & DRAW_CONSTSTIPPLE) == 0) | |||||
| setlinestyle(0); | |||||
| } | } | ||||
| setlinestyle(3); | if ((dflag & DRAW_CONSTSTIPPLE) == 0) | ||||
| setlinestyle(3); | |||||
| for (i = 0; i < cu->totbox; i++) { | for (i = 0; i < cu->totbox; i++) { | ||||
| if (cu->tb[i].w != 0.0f) { | if (cu->tb[i].w != 0.0f) { | ||||
| UI_ThemeColor(i == (cu->actbox - 1) ? TH_ACTIVE : TH_WIRE); | UI_ThemeColor(i == (cu->actbox - 1) ? TH_ACTIVE : TH_WIRE); | ||||
| Context not available. | |||||
| glEnd(); | glEnd(); | ||||
| } | } | ||||
| } | } | ||||
| setlinestyle(0); | |||||
| if ((dflag & DRAW_CONSTSTIPPLE) == 0) | |||||
| setlinestyle(0); | |||||
| if (BKE_vfont_select_get(ob, &selstart, &selend) && ef->selboxes) { | if (BKE_vfont_select_get(ob, &selstart, &selend) && ef->selboxes) { | ||||
| Context not available. | |||||
| draw_update_ptcache_edit(scene, ob, edit); | draw_update_ptcache_edit(scene, ob, edit); | ||||
| } | } | ||||
| draw_new_particle_system(scene, v3d, rv3d, base, psys, dt); | draw_new_particle_system(scene, v3d, rv3d, base, psys, dt, dflag); | ||||
| } | } | ||||
| invert_m4_m4(ob->imat, ob->obmat); | invert_m4_m4(ob->imat, ob->obmat); | ||||
| view3d_cached_text_draw_end(v3d, ar, 0, NULL); | view3d_cached_text_draw_end(v3d, ar, 0, NULL); | ||||
| Context not available. | |||||
| if ((ob->gameflag & OB_BOUNDS) && (ob->mode == OB_MODE_OBJECT)) { | if ((ob->gameflag & OB_BOUNDS) && (ob->mode == OB_MODE_OBJECT)) { | ||||
| if (ob->boundtype != ob->collision_boundtype || (dtx & OB_DRAWBOUNDOX) == 0) { | if (ob->boundtype != ob->collision_boundtype || (dtx & OB_DRAWBOUNDOX) == 0) { | ||||
| setlinestyle(2); | if ((dflag & DRAW_CONSTSTIPPLE) == 0) | ||||
| setlinestyle(2); | |||||
| draw_bounding_volume(ob, ob->collision_boundtype); | draw_bounding_volume(ob, ob->collision_boundtype); | ||||
| setlinestyle(0); | if ((dflag & DRAW_CONSTSTIPPLE) == 0) | ||||
| setlinestyle(0); | |||||
| } | } | ||||
| } | } | ||||
| if (ob->rigidbody_object) { | if (ob->rigidbody_object) { | ||||
| Context not available. | |||||
| /* prevent random colors being used */ | /* prevent random colors being used */ | ||||
| glColor3ubv(ob_wire_col); | glColor3ubv(ob_wire_col); | ||||
| } | } | ||||
| drawtexspace(ob); | drawtexspace(ob, dflag); | ||||
| } | } | ||||
| if (dtx & OB_DRAWNAME) { | if (dtx & OB_DRAWNAME) { | ||||
| /* patch for several 3d cards (IBM mostly) that crash on GL_SELECT with text drawing */ | /* patch for several 3d cards (IBM mostly) that crash on GL_SELECT with text drawing */ | ||||
| Context not available. | |||||
| glColor3ubv(ob_wire_col); | glColor3ubv(ob_wire_col); | ||||
| } | } | ||||
| setlinestyle(2); | if ((dflag & DRAW_CONSTSTIPPLE) == 0) | ||||
| setlinestyle(2); | |||||
| drawcircball(GL_LINE_LOOP, vec, ob->inertia, imat); | drawcircball(GL_LINE_LOOP, vec, ob->inertia, imat); | ||||
| setlinestyle(0); | if ((dflag & DRAW_CONSTSTIPPLE) == 0) | ||||
| setlinestyle(0); | |||||
| } | } | ||||
| } | } | ||||
| Context not available. | |||||
| /* draw hook center and offset line */ | /* draw hook center and offset line */ | ||||
| if (ob != scene->obedit) | if (ob != scene->obedit) | ||||
| draw_hooks(ob); | draw_hooks(ob, dflag); | ||||
| /* help lines and so */ | /* help lines and so */ | ||||
| if (ob != scene->obedit && ob->parent && (ob->parent->lay & v3d->lay)) { | if (ob != scene->obedit && ob->parent && (ob->parent->lay & v3d->lay)) { | ||||
| setlinestyle(3); | |||||
| if ((dflag & DRAW_CONSTSTIPPLE) == 0) | |||||
| setlinestyle(3); | |||||
| glBegin(GL_LINES); | glBegin(GL_LINES); | ||||
| glVertex3fv(ob->obmat[3]); | glVertex3fv(ob->obmat[3]); | ||||
| glVertex3fv(ob->orig); | glVertex3fv(ob->orig); | ||||
| glEnd(); | glEnd(); | ||||
| setlinestyle(0); | |||||
| if ((dflag & DRAW_CONSTSTIPPLE) == 0) | |||||
| setlinestyle(0); | |||||
| } | } | ||||
| /* Drawing the constraint lines */ | /* Drawing the constraint lines */ | ||||
| Context not available. | |||||
| } | } | ||||
| if (camob) { | if (camob) { | ||||
| setlinestyle(3); | if ((dflag & DRAW_CONSTSTIPPLE) == 0) | ||||
| setlinestyle(3); | |||||
| glBegin(GL_LINES); | glBegin(GL_LINES); | ||||
| glVertex3fv(camob->obmat[3]); | glVertex3fv(camob->obmat[3]); | ||||
| glVertex3fv(ob->obmat[3]); | glVertex3fv(ob->obmat[3]); | ||||
| glEnd(); | glEnd(); | ||||
| setlinestyle(0); | |||||
| if ((dflag & DRAW_CONSTSTIPPLE) == 0) | |||||
| setlinestyle(0); | |||||
| } | } | ||||
| } | } | ||||
| else { | else { | ||||
| Context not available. | |||||
| else | else | ||||
| unit_m4(ct->matrix); | unit_m4(ct->matrix); | ||||
| setlinestyle(3); | if ((dflag & DRAW_CONSTSTIPPLE) == 0) | ||||
| setlinestyle(3); | |||||
| glBegin(GL_LINES); | glBegin(GL_LINES); | ||||
| glVertex3fv(ct->matrix[3]); | glVertex3fv(ct->matrix[3]); | ||||
| glVertex3fv(ob->obmat[3]); | glVertex3fv(ob->obmat[3]); | ||||
| glEnd(); | glEnd(); | ||||
| setlinestyle(0); | |||||
| if ((dflag & DRAW_CONSTSTIPPLE) == 0) | |||||
| setlinestyle(0); | |||||
| } | } | ||||
| if (cti->flush_constraint_targets) | if (cti->flush_constraint_targets) | ||||
| Context not available. | |||||
| /* draw rigid body constraint lines */ | /* draw rigid body constraint lines */ | ||||
| if (rbc) { | if (rbc) { | ||||
| UI_ThemeColor(TH_WIRE); | UI_ThemeColor(TH_WIRE); | ||||
| setlinestyle(3); | |||||
| if ((dflag & DRAW_CONSTSTIPPLE) == 0) | |||||
| setlinestyle(3); | |||||
| glBegin(GL_LINES); | glBegin(GL_LINES); | ||||
| if (rbc->ob1) { | if (rbc->ob1) { | ||||
| glVertex3fv(ob->obmat[3]); | glVertex3fv(ob->obmat[3]); | ||||
| Context not available. | |||||
| glVertex3fv(rbc->ob2->obmat[3]); | glVertex3fv(rbc->ob2->obmat[3]); | ||||
| } | } | ||||
| glEnd(); | glEnd(); | ||||
| setlinestyle(0); | |||||
| if ((dflag & DRAW_CONSTSTIPPLE) == 0) | |||||
| setlinestyle(0); | |||||
| } | } | ||||
| } | } | ||||
| Context not available. | |||||