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:
authorJens Ole Wund <bjornmose@gmx.net>2009-11-26 03:15:26 +0300
committerJens Ole Wund <bjornmose@gmx.net>2009-11-26 03:15:26 +0300
commit6a30bc6816672b5d02dc538dddd5fd724daf91ad (patch)
treeddaecf4c5234406d3d116f03dcdde190baa1dcb9 /source/blender/editors/space_view3d/drawobject.c
parent12968cdd8a0141aa57e196256e7161ff11dd1ec3 (diff)
v Cloud to matrix
nice drawing for soft bodies BTW could be used by any object by design
Diffstat (limited to 'source/blender/editors/space_view3d/drawobject.c')
-rw-r--r--source/blender/editors/space_view3d/drawobject.c226
1 files changed, 173 insertions, 53 deletions
diff --git a/source/blender/editors/space_view3d/drawobject.c b/source/blender/editors/space_view3d/drawobject.c
index 41eab057d40..51af31496f1 100644
--- a/source/blender/editors/space_view3d/drawobject.c
+++ b/source/blender/editors/space_view3d/drawobject.c
@@ -4326,63 +4326,168 @@ static void draw_ptcache_edit(Scene *scene, View3D *v3d, RegionView3D *rv3d, Obj
glPointSize(1.0);
}
-static void draw_sb_motion(Scene *scene, Object *ob)
+//static void ob_draw_RE_motion(float com[3],float rotscale[3][3],float tw,float th)
+static void ob_draw_RE_motion(float com[3],float rotscale[3][3],float itw,float ith,float drw_size)
{
- SoftBody *sb = 0;
- if ((sb= ob->soft)){
- if(sb->solverflags & SBSO_MONITOR ||sb->solverflags & SBSO_ESTIMATEIPO){
- /* draw com */
- float rt[3][3],sc[3][3],tr[3][3];
- /* looks like to swap a b in reverse */
- copy_m3_m3(sc,sb->lscale);
- copy_m3_m3(rt,sb->lrot);
- mul_m3_m3m3(tr,rt,sc);
- if(1){
- float root[3],tip[3];
+ float tr[3][3];
+ float root[3],tip[3];
+ float tw,th;
+ /* take a copy for not spoiling original */
+ copy_m3_m3(tr,rotscale);
+ tw = itw * drw_size;
+ th = ith * drw_size;
+
+ glColor4ub(0x7F, 0x00, 0x00, 155);
+ glBegin(GL_LINES);
+ root[1] = root[2] = 0.0f;
+ root[0] = -drw_size;
+ mul_m3_v3(tr,root);
+ VECADD(root,root,com);
+ glVertex3fv(root);
+ tip[1] = tip[2] = 0.0f;
+ tip[0] = drw_size;
+ mul_m3_v3(tr,tip);
+ VECADD(tip,tip,com);
+ glVertex3fv(tip);
+ glEnd();
- glBegin(GL_LINES);
- root[1] = root[2] = 0.0f;
- root[0] = -1.0f;
- mul_m3_v3(tr,root);
- VECADD(root,root,sb->lcom);
- glVertex3fv(root);
- tip[1] = tip[2] = 0.0f;
- tip[0] = 1.0f;
- mul_m3_v3(tr,tip);
- VECADD(tip,tip,sb->lcom);
- glVertex3fv(tip);
- glEnd();
+ root[1] =0.0f; root[2] = tw;
+ root[0] = th;
+ glBegin(GL_LINES);
+ mul_m3_v3(tr,root);
+ VECADD(root,root,com);
+ glVertex3fv(root);
+ glVertex3fv(tip);
+ glEnd();
- glBegin(GL_LINES);
- root[0] = root[2] = 0.0f;
- root[1] = -1.0f;
- mul_m3_v3(tr,root);
- VECADD(root,root,sb->lcom);
- glVertex3fv(root);
- tip[0] = tip[2] = 0.0f;
- tip[1] = 1.0f;
- mul_m3_v3(tr,tip);
- VECADD(tip,tip,sb->lcom);
- glVertex3fv(tip);
- glEnd();
+ root[1] =0.0f; root[2] = -tw;
+ root[0] = th;
+ glBegin(GL_LINES);
+ mul_m3_v3(tr,root);
+ VECADD(root,root,com);
+ glVertex3fv(root);
+ glVertex3fv(tip);
+ glEnd();
- glBegin(GL_LINES);
- root[0] = root[1] = 0.0f;
- root[2] = -1.0f;
- mul_m3_v3(tr,root);
- VECADD(root,root,sb->lcom);
- glVertex3fv(root);
- tip[0] = tip[1] = 0.0f;
- tip[2] = 1.0f;
- mul_m3_v3(tr,tip);
- VECADD(tip,tip,sb->lcom);
- glVertex3fv(tip);
- glEnd();
- }
+ root[1] =tw; root[2] = 0.0f;
+ root[0] =th;
+ glBegin(GL_LINES);
+ mul_m3_v3(tr,root);
+ VECADD(root,root,com);
+ glVertex3fv(root);
+ glVertex3fv(tip);
+ glEnd();
- }
- }
-};
+ root[1] =-tw; root[2] = 0.0f;
+ root[0] = th;
+ glBegin(GL_LINES);
+ mul_m3_v3(tr,root);
+ VECADD(root,root,com);
+ glVertex3fv(root);
+ glVertex3fv(tip);
+ glEnd();
+
+ glColor4ub(0x00, 0x7F, 0x00, 155);
+
+ glBegin(GL_LINES);
+ root[0] = root[2] = 0.0f;
+ root[1] = -drw_size;
+ mul_m3_v3(tr,root);
+ VECADD(root,root,com);
+ glVertex3fv(root);
+ tip[0] = tip[2] = 0.0f;
+ tip[1] = drw_size;
+ mul_m3_v3(tr,tip);
+ VECADD(tip,tip,com);
+ glVertex3fv(tip);
+ glEnd();
+
+ root[0] =0.0f; root[2] = tw;
+ root[1] = th;
+ glBegin(GL_LINES);
+ mul_m3_v3(tr,root);
+ VECADD(root,root,com);
+ glVertex3fv(root);
+ glVertex3fv(tip);
+ glEnd();
+
+ root[0] =0.0f; root[2] = -tw;
+ root[1] = th;
+ glBegin(GL_LINES);
+ mul_m3_v3(tr,root);
+ VECADD(root,root,com);
+ glVertex3fv(root);
+ glVertex3fv(tip);
+ glEnd();
+
+ root[0] =tw; root[2] = 0.0f;
+ root[1] =th;
+ glBegin(GL_LINES);
+ mul_m3_v3(tr,root);
+ VECADD(root,root,com);
+ glVertex3fv(root);
+ glVertex3fv(tip);
+ glEnd();
+
+ root[0] =-tw; root[2] = 0.0f;
+ root[1] = th;
+ glBegin(GL_LINES);
+ mul_m3_v3(tr,root);
+ VECADD(root,root,com);
+ glVertex3fv(root);
+ glVertex3fv(tip);
+ glEnd();
+
+ glColor4ub(0x00, 0x00, 0x7F, 155);
+ glBegin(GL_LINES);
+ root[0] = root[1] = 0.0f;
+ root[2] = -drw_size;
+ mul_m3_v3(tr,root);
+ VECADD(root,root,com);
+ glVertex3fv(root);
+ tip[0] = tip[1] = 0.0f;
+ tip[2] = drw_size;
+ mul_m3_v3(tr,tip);
+ VECADD(tip,tip,com);
+ glVertex3fv(tip);
+ glEnd();
+
+ root[0] =0.0f; root[1] = tw;
+ root[2] = th;
+ glBegin(GL_LINES);
+ mul_m3_v3(tr,root);
+ VECADD(root,root,com);
+ glVertex3fv(root);
+ glVertex3fv(tip);
+ glEnd();
+
+ root[0] =0.0f; root[1] = -tw;
+ root[2] = th;
+ glBegin(GL_LINES);
+ mul_m3_v3(tr,root);
+ VECADD(root,root,com);
+ glVertex3fv(root);
+ glVertex3fv(tip);
+ glEnd();
+
+ root[0] = tw; root[1] = 0.0f;
+ root[2] = th;
+ glBegin(GL_LINES);
+ mul_m3_v3(tr,root);
+ VECADD(root,root,com);
+ glVertex3fv(root);
+ glVertex3fv(tip);
+ glEnd();
+
+ root[0] = -tw; root[1] = 0.0f;
+ root[2] = th;
+ glBegin(GL_LINES);
+ mul_m3_v3(tr,root);
+ VECADD(root,root,com);
+ glVertex3fv(root);
+ glVertex3fv(tip);
+ glEnd();
+}
/*place to add drawers */
unsigned int nurbcol[8]= {
@@ -5779,7 +5884,22 @@ void draw_object(Scene *scene, ARegion *ar, View3D *v3d, Base *base, int flag)
default:
drawaxes(1.0, flag, OB_ARROWS);
}
- if(ob->soft /*&& flag & OB_SBMOTION*/) draw_sb_motion(scene, ob);
+ if(ob->soft /*&& flag & OB_SBMOTION*/){
+ float mrt[3][3],msc[3][3],mtr[3][3];
+ SoftBody *sb = 0;
+ float tipw = 0.5f, tiph = 0.5f,drawsize = 4.0f;
+ if ((sb= ob->soft)){
+ if(sb->solverflags & SBSO_MONITOR ||sb->solverflags & SBSO_ESTIMATEIPO){
+
+ wmLoadMatrix(rv3d->viewmat);
+ copy_m3_m3(msc,sb->lscale);
+ copy_m3_m3(mrt,sb->lrot);
+ mul_m3_m3m3(mtr,mrt,msc);
+ ob_draw_RE_motion(sb->lcom,mtr,tipw,tiph,drawsize);
+ wmMultMatrix(ob->obmat);
+ }
+ }
+ }
if(ob->pd && ob->pd->forcefield) draw_forcefield(scene, ob);