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/drawobject.c')
-rw-r--r--source/blender/editors/space_view3d/drawobject.c157
1 files changed, 47 insertions, 110 deletions
diff --git a/source/blender/editors/space_view3d/drawobject.c b/source/blender/editors/space_view3d/drawobject.c
index 391eecbbbae..e6889f4563f 100644
--- a/source/blender/editors/space_view3d/drawobject.c
+++ b/source/blender/editors/space_view3d/drawobject.c
@@ -215,7 +215,7 @@ int draw_glsl_material(Scene *scene, Object *ob, View3D *v3d, int dt)
if(ob==OBACT && (ob && ob->mode & OB_MODE_WEIGHT_PAINT))
return 0;
- return (scene->gm.matmode == GAME_MAT_GLSL) && (dt >= OB_SHADED);
+ return (scene->gm.matmode == GAME_MAT_GLSL) && (dt > OB_SOLID);
}
static int check_material_alpha(Base *base, Mesh *me, int glsl)
@@ -1335,6 +1335,11 @@ static void draw_focus_cross(float dist, float size)
glEnd();
}
+#ifdef VIEW3D_CAMERA_BORDER_HACK
+float view3d_camera_border_hack_col[4];
+short view3d_camera_border_hack_test= FALSE;
+#endif
+
/* flag similar to draw_object() */
static void drawcamera(Scene *scene, View3D *v3d, RegionView3D *rv3d, Object *ob, int flag)
{
@@ -1348,7 +1353,15 @@ static void drawcamera(Scene *scene, View3D *v3d, RegionView3D *rv3d, Object *ob
const float scax= 1.0f / len_v3(ob->obmat[0]);
const float scay= 1.0f / len_v3(ob->obmat[1]);
const float scaz= 1.0f / len_v3(ob->obmat[2]);
-
+
+#ifdef VIEW3D_CAMERA_BORDER_HACK
+ if(is_view && !(G.f & G_PICKSEL)) {
+ glGetFloatv(GL_CURRENT_COLOR, view3d_camera_border_hack_col);
+ view3d_camera_border_hack_test= TRUE;
+ return;
+ }
+#endif
+
cam= ob->data;
aspx= (float) scene->r.xsch*scene->r.xasp;
aspy= (float) scene->r.ysch*scene->r.yasp;
@@ -2584,7 +2597,6 @@ static void draw_mesh_fancy(Scene *scene, ARegion *ar, View3D *v3d, RegionView3D
const short is_paint_sel= (ob==OBACT && paint_facesel_test(ob));
int draw_wire = 0;
int /* totvert,*/ totedge, totface;
- DispList *dl;
DerivedMesh *dm= mesh_get_derived_final(scene, ob, scene->customdata_mask);
if(!dm)
@@ -2718,10 +2730,7 @@ static void draw_mesh_fancy(Scene *scene, ARegion *ar, View3D *v3d, RegionView3D
}
}
else if(dt==OB_SHADED) {
- int do_draw= 1; /* to resolve all G.f settings below... */
-
if(ob==OBACT) {
- do_draw= 0;
if(ob && ob->mode & OB_MODE_WEIGHT_PAINT) {
/* enforce default material settings */
GPU_enable_material(0, NULL);
@@ -2750,38 +2759,6 @@ static void draw_mesh_fancy(Scene *scene, ARegion *ar, View3D *v3d, RegionView3D
dm->drawMappedFaces(dm, wpaint__setSolidDrawOptions, NULL, 0, GPU_enable_material);
}
}
- else do_draw= 1;
- }
- if(do_draw) {
- dl = ob->disp.first;
- if (!dl || !dl->col1) {
- /* release and reload derivedmesh because it might be freed in
- shadeDispList due to a different datamask */
- dm->release(dm);
- shadeDispList(scene, base);
- dl = find_displist(&ob->disp, DL_VERTCOL);
- dm= mesh_get_derived_final(scene, ob, scene->customdata_mask);
- }
-
- if ((v3d->flag&V3D_SELECT_OUTLINE) && ((v3d->flag2 & V3D_RENDER_OVERRIDE)==0) && (base->flag&SELECT) && !draw_wire) {
- draw_mesh_object_outline(v3d, ob, dm);
- }
-
- /* False for dupliframe objects */
- if (dl) {
- unsigned int *obCol1 = dl->col1;
- unsigned int *obCol2 = dl->col2;
-
- dm->drawFacesColored(dm, me->flag&ME_TWOSIDED, (unsigned char*) obCol1, (unsigned char*) obCol2);
- }
-
- if(base->flag & SELECT) {
- UI_ThemeColor((ob==OBACT)?TH_ACTIVE:TH_SELECT);
- } else {
- UI_ThemeColor(TH_WIRE);
- }
- if((v3d->flag2 & V3D_RENDER_OVERRIDE)==0)
- dm->drawLooseEdges(dm);
}
}
@@ -3139,57 +3116,6 @@ static void drawDispListsolid(ListBase *lb, Object *ob, int glsl)
glFrontFace(GL_CCW);
}
-static void drawDispListshaded(ListBase *lb, Object *ob)
-{
- DispList *dl, *dlob;
- unsigned int *cdata;
-
- if(lb==NULL) return;
-
- glShadeModel(GL_SMOOTH);
- glEnableClientState(GL_VERTEX_ARRAY);
- glEnableClientState(GL_COLOR_ARRAY);
-
- dl= lb->first;
- dlob= ob->disp.first;
- while(dl && dlob) {
-
- cdata= dlob->col1;
- if(cdata==NULL) break;
-
- switch(dl->type) {
- case DL_SURF:
- if(dl->index) {
- glVertexPointer(3, GL_FLOAT, 0, dl->verts);
- glColorPointer(4, GL_UNSIGNED_BYTE, 0, cdata);
- glDrawElements(GL_QUADS, 4*dl->totindex, GL_UNSIGNED_INT, dl->index);
- }
- break;
-
- case DL_INDEX3:
-
- glVertexPointer(3, GL_FLOAT, 0, dl->verts);
- glColorPointer(4, GL_UNSIGNED_BYTE, 0, cdata);
- glDrawElements(GL_TRIANGLES, 3*dl->parts, GL_UNSIGNED_INT, dl->index);
- break;
-
- case DL_INDEX4:
-
- glVertexPointer(3, GL_FLOAT, 0, dl->verts);
- glColorPointer(4, GL_UNSIGNED_BYTE, 0, cdata);
- glDrawElements(GL_QUADS, 4*dl->parts, GL_UNSIGNED_INT, dl->index);
- break;
- }
-
- dl= dl->next;
- dlob= dlob->next;
- }
-
- glShadeModel(GL_FLAT);
- glDisableClientState(GL_VERTEX_ARRAY);
- glDisableClientState(GL_COLOR_ARRAY);
-}
-
static void drawCurveDMWired(Object *ob)
{
DerivedMesh *dm = ob->derivedFinal;
@@ -3270,10 +3196,6 @@ static int drawDispList(Scene *scene, View3D *v3d, RegionView3D *rv3d, Base *bas
drawDispListsolid(lb, ob, 1);
GPU_end_object_materials();
}
- else if(dt == OB_SHADED) {
- if(ob->disp.first==NULL) shadeDispList(scene, base);
- drawDispListshaded(lb, ob);
- }
else {
GPU_begin_object_materials(v3d, rv3d, scene, ob, 0, NULL);
glLightModeli(GL_LIGHT_MODEL_TWO_SIDE, 0);
@@ -3312,10 +3234,6 @@ static int drawDispList(Scene *scene, View3D *v3d, RegionView3D *rv3d, Base *bas
drawDispListsolid(lb, ob, 1);
GPU_end_object_materials();
}
- else if(dt==OB_SHADED) {
- if(ob->disp.first==NULL) shadeDispList(scene, base);
- drawDispListshaded(lb, ob);
- }
else {
GPU_begin_object_materials(v3d, rv3d, scene, ob, 0, NULL);
glLightModeli(GL_LIGHT_MODEL_TWO_SIDE, 0);
@@ -3341,11 +3259,6 @@ static int drawDispList(Scene *scene, View3D *v3d, RegionView3D *rv3d, Base *bas
drawDispListsolid(lb, ob, 1);
GPU_end_object_materials();
}
- else if(dt == OB_SHADED) {
- dl= lb->first;
- if(dl && dl->col1==NULL) shadeDispList(scene, base);
- drawDispListshaded(lb, ob);
- }
else {
GPU_begin_object_materials(v3d, rv3d, scene, ob, 0, NULL);
glLightModeli(GL_LIGHT_MODEL_TWO_SIDE, 0);
@@ -3713,8 +3626,6 @@ static void draw_new_particle_system(Scene *scene, View3D *v3d, RegionView3D *rv
bb.align = part->bb_align;
bb.anim = part->bb_anim;
bb.lock = part->draw & PART_DRAW_BB_LOCK;
- bb.offset[0] = part->bb_offset[0];
- bb.offset[1] = part->bb_offset[1];
break;
case PART_DRAW_PATH:
break;
@@ -3884,7 +3795,20 @@ static void draw_new_particle_system(Scene *scene, View3D *v3d, RegionView3D *rv
/* create actiual particle data */
if(draw_as == PART_DRAW_BB) {
- bb.size = pa_size;
+ bb.offset[0] = part->bb_offset[0];
+ bb.offset[1] = part->bb_offset[1];
+ bb.size[0] = part->bb_size[0] * pa_size;
+ if (part->bb_align==PART_BB_VEL) {
+ float pa_vel = len_v3(state.vel);
+ float head = part->bb_vel_head*pa_vel;
+ float tail = part->bb_vel_tail*pa_vel;
+ bb.size[1] = part->bb_size[1]*pa_size + head + tail;
+ /* use offset to adjust the particle center. this is relative to size, so need to divide! */
+ if (bb.size[1] > 0.0f)
+ bb.offset[1] += (head-tail) / bb.size[1];
+ }
+ else
+ bb.size[1] = part->bb_size[1] * pa_size;
bb.tilt = part->bb_tilt * (1.0f - part->bb_rand_tilt * r_tilt);
bb.time = ct;
}
@@ -3904,7 +3828,20 @@ static void draw_new_particle_system(Scene *scene, View3D *v3d, RegionView3D *rv
/* create actiual particle data */
if(draw_as == PART_DRAW_BB) {
- bb.size = pa_size;
+ bb.offset[0] = part->bb_offset[0];
+ bb.offset[1] = part->bb_offset[1];
+ bb.size[0] = part->bb_size[0] * pa_size;
+ if (part->bb_align==PART_BB_VEL) {
+ float pa_vel = len_v3(state.vel);
+ float head = part->bb_vel_head*pa_vel;
+ float tail = part->bb_vel_tail*pa_vel;
+ bb.size[1] = part->bb_size[1]*pa_size + head + tail;
+ /* use offset to adjust the particle center. this is relative to size, so need to divide! */
+ if (bb.size[1] > 0.0f)
+ bb.offset[1] += (head-tail) / bb.size[1];
+ }
+ else
+ bb.size[1] = part->bb_size[1] * pa_size;
bb.tilt = part->bb_tilt * (1.0f - part->bb_rand_tilt * r_tilt);
bb.time = pa_time;
}
@@ -5541,7 +5478,7 @@ static void drawObjectSelect(Scene *scene, View3D *v3d, ARegion *ar, Base *base)
}
else if(ob->type==OB_ARMATURE) {
if(!(ob->mode & OB_MODE_POSE))
- draw_armature(scene, v3d, ar, base, OB_WIRE, 0);
+ draw_armature(scene, v3d, ar, base, OB_WIRE, FALSE, TRUE);
}
glLineWidth(1.0);
@@ -5812,7 +5749,7 @@ void draw_object(Scene *scene, ARegion *ar, View3D *v3d, Base *base, int flag)
/* multiply view with object matrix.
* local viewmat and persmat, to calculate projections */
- ED_view3d_init_mats_rv3d(ob, rv3d);
+ ED_view3d_init_mats_rv3d_gl(ob, rv3d);
/* which wire color */
if((flag & DRAW_CONSTCOLOR) == 0) {
@@ -6077,7 +6014,7 @@ void draw_object(Scene *scene, ARegion *ar, View3D *v3d, Base *base, int flag)
case OB_ARMATURE:
if((v3d->flag2 & V3D_RENDER_OVERRIDE)==0) {
if(dt>OB_WIRE) GPU_enable_material(0, NULL); // we use default material
- empty_object= draw_armature(scene, v3d, ar, base, dt, flag);
+ empty_object= draw_armature(scene, v3d, ar, base, dt, flag, FALSE);
if(dt>OB_WIRE) GPU_disable_material();
}
break;
@@ -6311,7 +6248,7 @@ void draw_object(Scene *scene, ARegion *ar, View3D *v3d, Base *base, int flag)
}
}
- if(dt<OB_SHADED && (v3d->flag2 & V3D_RENDER_OVERRIDE)==0) {
+ if(dt<=OB_SOLID && (v3d->flag2 & V3D_RENDER_OVERRIDE)==0) {
if((ob->gameflag & OB_DYNAMIC) ||
((ob->gameflag & OB_BOUNDS) && (ob->boundtype == OB_BOUND_SPHERE))) {
float imat[4][4], vec[3]= {0.0f, 0.0f, 0.0f};