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:
authorSergey Sharybin <sergey.vfx@gmail.com>2010-03-05 19:47:52 +0300
committerSergey Sharybin <sergey.vfx@gmail.com>2010-03-05 19:47:52 +0300
commitd0c70ad1d581d69f650d604293c006b2e0023310 (patch)
treeb0fdfd5063ed11dd875ca602f8bbf09f5c4cdb8f /source/blender/editors/space_view3d/drawobject.c
parentbf4d8ffe3ab8a85a8e3071d54a1eaf84960ddae3 (diff)
Constructive modifiers for curves and surfaces
Used approach with creating DerivedMesh for curves whet they've got such modifiers. Available modifiers are: array, edge split, mirror, solidify, subsurf.
Diffstat (limited to 'source/blender/editors/space_view3d/drawobject.c')
-rw-r--r--source/blender/editors/space_view3d/drawobject.c67
1 files changed, 59 insertions, 8 deletions
diff --git a/source/blender/editors/space_view3d/drawobject.c b/source/blender/editors/space_view3d/drawobject.c
index 052edc66ed0..ac1e13a6510 100644
--- a/source/blender/editors/space_view3d/drawobject.c
+++ b/source/blender/editors/space_view3d/drawobject.c
@@ -2977,6 +2977,41 @@ static void drawDispListshaded(ListBase *lb, Object *ob)
glDisableClientState(GL_COLOR_ARRAY);
}
+static void drawCurveDMWired(Object *ob)
+{
+ DerivedMesh *dm = ob->derivedFinal;
+ dm->drawEdges (dm, 1);
+}
+
+/* return 1 when nothing was drawn */
+static int drawCurveDerivedMesh(Scene *scene, View3D *v3d, RegionView3D *rv3d, Base *base, int dt)
+{
+ Object *ob= base->object;
+ DerivedMesh *dm = ob->derivedFinal;
+ Curve *cu= ob->data;
+
+ if (!dm) {
+ return 1;
+ }
+
+ if(dt>OB_WIRE && displist_has_faces(&cu->disp)!=0) {
+ int glsl = draw_glsl_material(scene, ob, v3d, dt);
+ GPU_begin_object_materials(v3d, rv3d, scene, ob, glsl, NULL);
+
+ if (!glsl)
+ glLightModeli(GL_LIGHT_MODEL_TWO_SIDE, 0);
+
+ glEnable(GL_LIGHTING);
+ dm->drawFacesSolid(dm, NULL, 0, GPU_enable_material);
+ glDisable(GL_LIGHTING);
+ GPU_end_object_materials();
+ } else {
+ drawCurveDMWired (ob);
+ }
+
+ return 0;
+}
+
/* returns 1 when nothing was drawn */
static int drawDispList(Scene *scene, View3D *v3d, RegionView3D *rv3d, Base *base, int dt)
{
@@ -2988,6 +3023,10 @@ static int drawDispList(Scene *scene, View3D *v3d, RegionView3D *rv3d, Base *bas
solid= (dt > OB_WIRE);
+ if (drawCurveDerivedMesh(scene, v3d, rv3d, base, dt) == 0) {
+ return 0;
+ }
+
switch(ob->type) {
case OB_FONT:
case OB_CURVE:
@@ -5037,7 +5076,7 @@ static void draw_bounding_volume(Scene *scene, Object *ob)
bb= mesh_get_bb(ob);
}
else if ELEM3(ob->type, OB_CURVE, OB_SURF, OB_FONT) {
- bb= ( (Curve *)ob->data )->bb;
+ bb= ob->bb ? ob->bb : ( (Curve *)ob->data )->bb;
}
else if(ob->type==OB_MBALL) {
bb= ob->bb;
@@ -5104,9 +5143,15 @@ static void drawSolidSelect(Scene *scene, View3D *v3d, ARegion *ar, Base *base)
if(ELEM3(ob->type, OB_FONT,OB_CURVE, OB_SURF)) {
Curve *cu = ob->data;
- if (displist_has_faces(&cu->disp) && boundbox_clip(rv3d, ob->obmat, cu->bb)) {
+ DerivedMesh *dm = ob->derivedFinal;
+
+ if (displist_has_faces(&cu->disp) && boundbox_clip(rv3d, ob->obmat, ob->bb ? ob->bb : cu->bb)) {
draw_index_wire= 0;
- drawDispListwire(&cu->disp);
+ if (dm) {
+ draw_mesh_object_outline(v3d, ob, dm);
+ } else {
+ drawDispListwire(&cu->disp);
+ }
draw_index_wire= 1;
}
} else if (ob->type==OB_MBALL) {
@@ -5151,10 +5196,16 @@ static void drawWireExtra(Scene *scene, RegionView3D *rv3d, Object *ob)
if (ELEM3(ob->type, OB_FONT, OB_CURVE, OB_SURF)) {
Curve *cu = ob->data;
- if (boundbox_clip(rv3d, ob->obmat, cu->bb)) {
+ if (boundbox_clip(rv3d, ob->obmat, ob->bb ? ob->bb : cu->bb)) {
if (ob->type==OB_CURVE)
draw_index_wire= 0;
- drawDispListwire(&cu->disp);
+
+ if (ob->derivedFinal) {
+ drawCurveDMWired(ob);
+ } else {
+ drawDispListwire(&cu->disp);
+ }
+
if (ob->type==OB_CURVE)
draw_index_wire= 1;
}
@@ -5574,7 +5625,7 @@ void draw_object(Scene *scene, ARegion *ar, View3D *v3d, Base *base, int flag)
}
else if(dt==OB_BOUNDBOX)
draw_bounding_volume(scene, ob);
- else if(boundbox_clip(rv3d, ob->obmat, cu->bb))
+ else if(boundbox_clip(rv3d, ob->obmat, ob->bb ? ob->bb : cu->bb))
empty_object= drawDispList(scene, v3d, rv3d, base, dt);
break;
@@ -5587,12 +5638,12 @@ void draw_object(Scene *scene, ARegion *ar, View3D *v3d, Base *base, int flag)
}
else if(dt==OB_BOUNDBOX)
draw_bounding_volume(scene, ob);
- else if(boundbox_clip(rv3d, ob->obmat, cu->bb)) {
+ else if(boundbox_clip(rv3d, ob->obmat, ob->bb ? ob->bb : cu->bb)) {
empty_object= drawDispList(scene, v3d, rv3d, base, dt);
if(cu->path)
curve_draw_speed(scene, ob);
- }
+ }
break;
case OB_MBALL:
{