/project/max5_modifier/max_joint.cpp
http://narutortsproject.googlecode.com/ · C++ · 831 lines · 517 code · 154 blank · 160 comment · 47 complexity · 1f1e5cf6912dbc0b90cbd79d5c099c38 MD5 · raw file
- #include <crtdbg.h>
-
- #include "max5_modifier_mod.h"
- #include "max_joint.h"
-
-
- JointObjectClassDesc joint_object_class_desc;
-
- int JointObjectClassDesc::IsPublic()
- {
- return 1;
- };
-
- void * JointObjectClassDesc::Create(BOOL loading)
- {
- return new JointObject;
- };
-
- const TCHAR * JointObjectClassDesc::ClassName()
- {
- static char class_name[MAX_STRING_LENGTH];
- strcpy_s(class_name, MAX_STRING_LENGTH, JOINTOBJECT_CLASS_NAME);
- return class_name;
- };
-
- const TCHAR* JointObjectClassDesc::InternalName()
- {
- static char class_name[MAX_STRING_LENGTH];
- strcpy_s(class_name, MAX_STRING_LENGTH, JOINTOBJECT_CLASS_NAME);
- return class_name;
- };
-
- HINSTANCE JointObjectClassDesc::HInstance()
- {
- return hInstance;
- }
-
- SClass_ID JointObjectClassDesc::SuperClassID()
- {
- //return WSM_OBJECT_CLASS_ID;
- return GEOMOBJECT_CLASS_ID;
- };
-
- Class_ID JointObjectClassDesc::ClassID()
- {
- return Class_ID (JOINTOBJECT_CLASS_ID, JOINTOBJECT_CLASS_SID);
- };
-
- const TCHAR* JointObjectClassDesc::Category()
- {
- static char class_category[MAX_STRING_LENGTH];
- strcpy_s(class_category, MAX_STRING_LENGTH, JOINTOBJECT_CATEGORY);
-
- return class_category;
- };
-
- class JointObjectValidator : public PBValidator
- {
- // pick only
- BOOL Validate(PB2Value &v)
- {
- if (!v.r)
- return FALSE;
- //static Object *ob;
- //ob = (((INode *)v.r)->EvalWorldState(0)).obj;
- //if ( ob && (ob->ClassID() == Class_ID(WAYPOINT_CLASS_ID, WAYPOINT_CLASS_SID)) )
- return TRUE;
- //else
- // return FALSE;
- }
- };
-
- static JointObjectValidator joint_object_point_validator;
-
-
- class JointObjectPBAccessor : public PBAccessor
- {
- public:
-
- void TabChanged(tab_changes changeCode, Tab<PB2Value>* tab, ReferenceMaker* owner, ParamID id, int tabIndex, int count)
- {
- }
-
- void Get(PB2Value& v, ReferenceMaker* owner, ParamID id, int tabIndex, TimeValue t, Interval &valid)
- {
- JointObject* joint_object = (JointObject*) owner;
- switch (id)
- {
- case JO_NODE0:
- {
- /*ICustButton *iBut = GetICustButton(GetDlgItem(giz->hGizmoParams, IDC_EDIT));
- if (GetCOREInterface()->GetSubObjectLevel() == 0)
- iBut->Enable(FALSE);
- else iBut->Enable(TRUE);
- iBut->SetType(CBT_CHECK);
- iBut->SetHighlightColor(GREEN_WASH);
- ReleaseICustButton(iBut);*/
-
- }
- };
- }
-
- void Set(PB2Value& v, ReferenceMaker* owner, ParamID id, int tabIndex, TimeValue t) // set from v
- {
- JointObject* joint_object = (JointObject*) owner;
- switch (id)
- {
- case JO_NODE0:
- {
- //way_point->SetNodeR(WP_NODE_R0, v.i > 0, t);
- }
- };
- }
- };
-
-
- static JointObjectPBAccessor joint_object_point_accessor;
-
- static ParamBlockDesc2 JointObjectDescParam
- (
- 0, _T("JointObjectParameters"), 0, &joint_object_class_desc, P_AUTO_CONSTRUCT+P_AUTO_UI, 0,
-
- //rollout
- IDD_DIALOG_JOINT, "Parameters", 0, 0, NULL,
-
- // params
- WP_NODE0, _T("nodePicker1"), TYPE_INODE, 0, "NODE1",
- p_ui, TYPE_PICKNODEBUTTON, IDC_BUTTON_BODY1,
- end,
-
- WP_NODE1, _T("nodePicker2"), TYPE_INODE, 0, "NODE2",
- p_ui, TYPE_PICKNODEBUTTON, IDC_BUTTON_BODY2,
- end,
- end
- );
-
- IObjParam* JointObject::ip = 0;
- JointObject* JointObject::editOb = 0;
- IParamMap2* JointObject::pmapParam = 0;
-
- //Call back
- class JointObjectCreateCallBack: public CreateMouseCallBack {
- JointObject* ob;
- Point3 p0,p1;
- IPoint2 sp0, sp1;
- BOOL square;
- public:
- int proc( ViewExp *vpt,int msg, int point, int flags, IPoint2 m, Matrix3& mat );
- void SetObj(JointObject *obj) { ob = obj; }
- };
-
- int JointObjectCreateCallBack::proc( ViewExp *vpt,int msg, int point, int flags, IPoint2 m, Matrix3& mat )
- {
- Point3 d;
- if (msg == MOUSE_FREEMOVE)
- {
- //vpt->SnapPreview(m,m,NULL, SNAP_IN_3D);
- } else
- if ( msg == MOUSE_POINT || msg == MOUSE_MOVE)
- {
- if (point == 0)
- {
- // Find the node and plug in the wire color
- ULONG handle;
- ob->NotifyDependents(FOREVER, (PartID)&handle, REFMSG_GET_NODE_HANDLE);
- INode *node;
- node = GetCOREInterface()->GetINodeByHandle(handle);
- if (node)
- {
- Point3 color = GetUIColor(COLOR_POINT_OBJ);
- node->SetWireColor(RGB(color.x*255.0f, color.y*255.0f, color.z*255.0f));
- }
-
- ob->suspendSnap = TRUE;
- #ifdef _3D_CREATE
- mat.SetTrans(vpt->SnapPoint(m,m,NULL,SNAP_IN_3D));
- #else
- mat.SetTrans(vpt->SnapPoint(m,m,NULL,SNAP_IN_PLANE));
- #endif
- } else
- if (point == 1)
- {
- #ifdef _3D_CREATE
- mat.SetTrans(vpt->SnapPoint(m,m,NULL,SNAP_IN_3D));
- #else
- mat.SetTrans(vpt->SnapPoint(m,m,NULL,SNAP_IN_PLANE));
- #endif
- if (msg==MOUSE_POINT)
- {
- ob->suspendSnap = FALSE;
- return 0;
- }
- return CREATE_STOP;
- }
- } else
- if (msg == MOUSE_ABORT)
- {
- return CREATE_ABORT;
- }
-
- return TRUE;
- };
-
- static JointObjectCreateCallBack joint_object_create_call_back;
-
-
- JointObject::JointObject()
- {
- pblock = 0;
- joint_object_class_desc.MakeAutoParamBlocks(this);
-
- //SetAFlag(A_OBJ_CREATING);
- };
-
- JointObject::~JointObject()
- {
-
- };
-
- void JointObject::SetNodeR(int node_id, bool val, TimeValue time)
- {
- pblock->SetValue(node_id, time, BOOL(val));
- };
-
- bool JointObject::GetNodeR(int node_id, TimeValue time)
- {
- BOOL val = FALSE;
- pblock->GetValue(node_id, time, val, FOREVER);
- return val;
- };
-
- RefResult JointObject::NotifyRefChanged( Interval changeInt, RefTargetHandle hTarget, PartID& partID, RefMessage message )
- {
- switch (message)
- {
- case REFMSG_CHANGE:
- {
- if (editOb==this)
- InvalidateUI();
-
- /*if (pblock)
- {
- for (int i = WP_NODE0; i <= WP_NODE4; i ++)
- {
- INode* node = 0;
- if (pblock->GetValue(i, changeInt.Start(), node, FOREVER) && node)
- {
- Class_ID node_class = node->ClassID();
- Object * node_obj = node->EvalWorldState(changeInt.Start()).obj;
- if (node_obj)
- {
- Class_ID obj_class = node_obj->ClassID();
-
- if (obj_class != Class_ID(WAYPOINT_CLASS_ID, WAYPOINT_CLASS_SID))
- pblock->SetValue(i, changeInt.Start(), 0);
- }
- };
- }
- }*/
- break;
- };
- }
- return(REF_SUCCEED);
- };
-
- int JointObject::HitTest(TimeValue t, INode *inode, int type, int crossing, int flags, IPoint2 *p, ViewExp *vpt)
- {
- Matrix3 tm(1);
- HitRegion hitRegion;
- DWORD savedLimits;
- Point3 pt(0,0,0);
-
- vpt->getGW()->setTransform(tm);
- GraphicsWindow *gw = vpt->getGW();
- Material *mtl = gw->getMaterial();
-
- tm = inode->GetObjectTM(t);
- MakeHitRegion(hitRegion, type, crossing, 4, p);
-
- gw->setRndLimits(((savedLimits = gw->getRndLimits())|GW_PICK)&~GW_ILLUM);
- gw->setHitRegion(&hitRegion);
- gw->clearHitCode();
-
- DrawAndHit(t, inode, vpt);
-
- //if (showAxis) {
- //DrawAxis(vpt,tm,axisLength,screenSize);
- //}
- //vpt->getGW()->setTransform(tm);
- //vpt->getGW()->marker(&pt,X_MRKR);
-
- gw->setRndLimits(savedLimits);
-
- if ((hitRegion.type != POINT_RGN) && !hitRegion.crossing)
- return TRUE;
-
- return gw->checkHitCode();
- return 0;
- }
-
- void JointObject::Snap(TimeValue t, INode* inode, SnapInfo *snap, IPoint2 *p, ViewExp *vpt)
- {
- if(suspendSnap)
- return;
- /*
-
- Matrix3 tm = inode->GetObjectTM(t);
- GraphicsWindow *gw = vpt->getGW();
- gw->setTransform(tm);
-
- Matrix3 invPlane = Inverse(snap->plane);
-
- // Make sure the vertex priority is active and at least as important as the best snap so far
- if(snap->vertPriority > 0 && snap->vertPriority <= snap->priority)
- {
- Point2 fp = Point2((float)p->x, (float)p->y);
- Point2 screen2;
- IPoint3 pt3;
-
- Point3 thePoint(0,0,0);
- // If constrained to the plane, make sure this point is in it!
- if(snap->snapType == SNAP_2D || snap->flags & SNAP_IN_PLANE)
- {
- Point3 test = thePoint * tm * invPlane;
- if(fabs(test.z) > 0.0001) // Is it in the plane (within reason)?
- return;
- }
-
- gw->wTransPoint(&thePoint,&pt3);
- screen2.x = (float)pt3.x;
- screen2.y = (float)pt3.y;
-
- // Are we within the snap radius?
- int len = (int)Length(screen2 - fp);
- if(len <= snap->strength)
- {
- // Is this priority better than the best so far?
- if(snap->vertPriority < snap->priority)
- {
- snap->priority = snap->vertPriority;
- snap->bestWorld = thePoint * tm;
- snap->bestScreen = screen2;
- snap->bestDist = len;
- } else
- if(len < snap->bestDist)
- {
- snap->priority = snap->vertPriority;
- snap->bestWorld = thePoint * tm;
- snap->bestScreen = screen2;
- snap->bestDist = len;
- }
- }
- }*/
-
- };
-
- void JointObject::SetExtendedDisplay(int flags)
- {
- extDispFlags = flags;
- };
-
- int JointObject::Display(TimeValue t, INode* inode, ViewExp *vpt, int flags)
- {
- DrawAndHit(t, inode, vpt);
- return 0;
- };
-
-
- CreateMouseCallBack* JointObject::GetCreateMouseCallBack()
- {
- joint_object_create_call_back.SetObj(this);
- return(&joint_object_create_call_back);
- };
-
- void JointObject::BeginEditParams(IObjParam *ip, ULONG flags, Animatable *prev)
- {
- editOb = this;
- this->ip = ip;
-
- joint_object_class_desc.BeginEditParams(ip, this, flags, prev);
-
- /*static TCHAR stringBuf[MAX_STRING_LENGTH];
- strcpy_s(stringBuf, MAX_STRING_LENGTH, NARUTO_PARAMETERS);
-
- if (pmapParam)
- {
- // Left over from last one created
- pmapParam->SetParamBlock(pblock);
- } else
- {
- // Gotta make a new one.
- pmapParam = CreateCPParamMap(
- WayPointdescParam, WAYPOINT_PARAMDESC_LENGTH,
- pblock,
- ip,
- hInstance,
- MAKEINTRESOURCE(IDD_DIALOG_WAYPOINT),
- stringBuf, 0);
- }
- way_point_dlg_proc.SetObject(this);
- pmapParam->SetUserDlgProc(&way_point_dlg_proc);*/
- };
-
- //On close custom menu
- void JointObject::EndEditParams(IObjParam *ip, ULONG flags, Animatable *next)
- {
- editOb = NULL;
-
- this->ip = NULL;
- joint_object_class_desc.EndEditParams(ip, this, flags, next);
- ClearAFlag(A_OBJ_CREATING);
-
- /*
- if(IsDlgButtonChecked(pmapParam->GetHWnd(), IDC_GRID_HOME_INTENSITY ))
- dlgGridColor = GRID_COLOR_HOME_INT;
- else if(IsDlgButtonChecked(pmapParam->GetHWnd(), IDC_GRID_HOME_COLOR ))
- dlgGridColor = GRID_COLOR_HOME;
- else if(IsDlgButtonChecked(pmapParam->GetHWnd(), IDC_GRID_OBJECT_COLOR ))
- dlgGridColor = GRID_COLOR_OBJECT;
- else
- dlgGridColor = GRID_COLOR_GRAY;
- */
-
- /*if (flags & END_EDIT_REMOVEUI )
- {
- DestroyCPParamMap(pmapParam);
- pmapParam = 0;
- }
- this->ip = 0;
- way_point_dlg_proc.SetObject(0);*/
- };
-
- TCHAR* JointObject::GetObjectName()
- {
- return JOINTOBJECT_NAME;
- };
-
- ObjectState JointObject::Eval(TimeValue time)
- {
- return ObjectState(this);
- };
-
-
- void JointObject::DeleteThis()
- {
- delete this;
- };
-
- Class_ID JointObject::ClassID()
- {
- return Class_ID (JOINTOBJECT_CLASS_ID, JOINTOBJECT_CLASS_SID);
- };
-
- int JointObject::GetParamBlockIndex(int id)
- {
- if (pblock && id >= 0 && id < pblock->NumParams())
- return id;
- else
- return -1;
- };
-
- void JointObject::GetWorldBoundBox(TimeValue t, INode *inode, ViewExp *vpt, Box3& box )
- {
- Matrix3 tm;
- tm = inode->GetObjectTM(t);
- Box3 lbox;
-
- GetLocalBoundBox(t, inode, vpt, lbox);
- box = Box3(tm.GetTrans(), tm.GetTrans());
- for (int i=0; i<8; i++)
- {
- box += lbox * tm;
- }
- };
-
- void JointObject::GetLocalBoundBox(TimeValue t, INode *inode, ViewExp *vpt, Box3& box )
- {
- Matrix3 tm = inode->GetObjectTM(t);
-
- float size = 20.0;
- int screenSize = 0;
-
- //pblock2->GetValue(pointobj_size, t, size, FOREVER);
- //pblock2->GetValue(pointobj_screensize, t, screenSize, FOREVER);
-
- float zoom = 1.0f;
- if (screenSize)
- {
- zoom = vpt->GetScreenScaleFactor(tm.GetTrans())*0.005f;
- }
- if (zoom==0.0f) zoom = 1.0f;
-
- size *= zoom;
- box = Box3(Point3(0,0,0), Point3(0,0,0));
- box += Point3(size*0.5f, 0.0f, 0.0f);
- box += Point3( 0.0f, size*0.5f, 0.0f);
- box += Point3( 0.0f, 0.0f, size*0.5f);
- box += Point3(-size*0.5f, 0.0f, 0.0f);
- box += Point3( 0.0f, -size*0.5f, 0.0f);
- box += Point3( 0.0f, 0.0f, -size*0.5f);
-
- box.EnlargeBy(10.0f/zoom);
- };
-
- Interval JointObject::ObjectValidity(TimeValue t)
- {
- return FOREVER;
- };
-
- RefTargetHandle JointObject::Clone(RemapDir& remap)
- {
- JointObject* new_joint = new JointObject();
- new_joint->ReplaceReference(0,remap.CloneRef(pblock));
- BaseClone(this, new_joint, remap);
- return(new_joint);
- };
-
- Animatable* JointObject::SubAnim(int i)
- {
- return pblock;
- }
-
- IParamArray* JointObject::GetParamBlock()
- {
- return (IParamArray*)pblock;
- };
-
- IParamBlock2* JointObject::GetParamBlock(int i)
- {
- return pblock;
- }
-
- IParamBlock2* JointObject::GetParamBlockByID(short id)
- {
- return pblock;
- }
-
- RefTargetHandle JointObject::GetReference(int i)
- {
- return pblock;
- }
-
- void JointObject::SetReference(int i, RefTargetHandle rtarg)
- {
- pblock=(IParamBlock2*)rtarg;
- }
-
-
- void JointObject::InvalidateUI()
- {
- //pointobj_param_blk.InvalidateUI(pblock2->LastNotifyParamID());
- };
-
- void JointObject::UpdateParamblockFromVars()
- {
- SuspendAnimate();
- AnimateOff();
-
-
- ResumeAnimate();
- };
-
- void JointObject::DrawLine(ViewExp *vpt, float x1, float y1, float z1, float x2, float y2, float z2)
- {
- Point3 pts[2];
- pts[0] = Point3(x1, y1, z1); pts[1] = Point3(x2, y2, z2);
- vpt->getGW()->polyline(2, pts, NULL, NULL, FALSE, NULL);
- }
-
- void JointObject::DrawArrow(ViewExp *vpt, float x, float y, float z, float size, bool arrow1, bool arrow2)
- {
- float x1 = x/3.0f;
- float y1 = y/3.0f;
- float z1 = z/3.0f;
-
- float x2 = 0.75f*x;
- float y2 = 0.75f*y;
- float z2 = 0.75f*z;
-
- vpt->getGW()->setColor( LINE_COLOR, 0.0f, 1.0f, 0.0f);
- DrawLine(vpt, 0.0f, 0.0f, 0.0f, x, y, z);
-
- float d = size/4.0f;
- vpt->getGW()->setColor(LINE_COLOR, 1.0f, 1.0f, 0.0f);
-
- //Arrow 1
- if (arrow1)
- {
- DrawLine(vpt, x2, y2, z2, x, y, z);
-
- DrawLine(vpt, x2-d, y2, z2, x, y, z);
- DrawLine(vpt, x2+d, y2, z2, x, y, z);
-
- DrawLine(vpt, x2, y2-d, z2, x, y, z);
- DrawLine(vpt, x2, y2+d, z2, x, y, z);
-
- DrawLine(vpt, x2, y2, z2-d, x, y, z);
- DrawLine(vpt, x2, y2, z2+d, x, y, z);
- };
-
- if (arrow2)
- {
- DrawLine(vpt, x1, y1, z1, 0.0f, 0.0f, 0.0f);
-
- DrawLine(vpt, x1-d, y1, z1, 0.0f, 0.0f, 0.0f);
- DrawLine(vpt, x1+d, y1, z1, 0.0f, 0.0f, 0.0f);
-
- DrawLine(vpt, x1, y1-d, z1, 0.0f, 0.0f, 0.0f);
- DrawLine(vpt, x1, y1+d, z1, 0.0f, 0.0f, 0.0f);
-
- DrawLine(vpt, x1, y1, z1-d, 0.0f, 0.0f, 0.0f);
- DrawLine(vpt, x1, y1, z1+d, 0.0f, 0.0f, 0.0f);
- };
- };
-
- int JointObject::DrawAndHit(TimeValue t, INode *inode, ViewExp *vpt)
- {
- float size;
- int centerMarker, axisTripod, cross, box, screenSize, drawOnTop;
-
- DWORD dw_color = inode->GetWireColor();
- Color color(dw_color);
-
- Interval ivalid = FOREVER;
- size = 20.0f;
- centerMarker = 0;
- axisTripod = 0;
- cross = 1;
- box = 0;
- screenSize = 0;
- drawOnTop = 0;
-
- //pblock2->GetValue(pointobj_size, t, size, ivalid);
- //pblock2->GetValue(pointobj_centermarker, t, centerMarker, ivalid);
- //pblock2->GetValue(pointobj_axistripod, t, axisTripod, ivalid);
- //pblock2->GetValue(pointobj_cross, t, cross, ivalid);
- //pblock2->GetValue(pointobj_box, t, box, ivalid);
- //pblock2->GetValue(pointobj_screensize, t, screenSize, ivalid);
- //pblock2->GetValue(pointobj_drawontop, t, drawOnTop, ivalid);
-
- Matrix3 tm(1);
- Matrix3 tm_base(1);
- Point3 pt(0,0,0);
- Point3 pts[5];
-
- tm_base = vpt->getGW()->getTransform();
-
- vpt->getGW()->setTransform(tm);
- tm = inode->GetObjectTM(t);
-
- int limits = vpt->getGW()->getRndLimits();
- if (drawOnTop)
- vpt->getGW()->setRndLimits(limits & ~GW_Z_BUFFER);
-
- if (inode->Selected())
- {
- vpt->getGW()->setColor( TEXT_COLOR, GetUIColor(COLOR_SELECTION) );
- vpt->getGW()->setColor( LINE_COLOR, GetUIColor(COLOR_SELECTION) );
- } else if (!inode->IsFrozen() && !inode->Dependent())
- {
- //vpt->getGW()->setColor( TEXT_COLOR, GetUIColor(COLOR_POINT_AXES) );
- //vpt->getGW()->setColor( LINE_COLOR, GetUIColor(COLOR_POINT_AXES) );
- vpt->getGW()->setColor( TEXT_COLOR, color);
- vpt->getGW()->setColor( LINE_COLOR, color);
- }
-
- if (axisTripod) {
- //DrawAxis(vpt, tm, size, screenSize);
- }
-
- size *= 0.5f;
-
- float zoom = vpt->GetScreenScaleFactor(tm.GetTrans())*0.005f;
- if (screenSize)
- {
- tm.Scale(Point3(zoom,zoom,zoom));
- }
-
- vpt->getGW()->setTransform(tm);
-
- if (!inode->IsFrozen() && !inode->Dependent() && !inode->Selected())
- {
- //vpt->getGW()->setColor(LINE_COLOR, GetUIColor(COLOR_POINT_OBJ));
- vpt->getGW()->setColor( LINE_COLOR, color);
- }
-
- if (centerMarker) {
- vpt->getGW()->marker(&pt,X_MRKR);
- }
-
- //if (cross)
- {
- // X
- pts[0] = Point3(-size, 0.0f, 0.0f); pts[1] = Point3(size, 0.0f, 0.0f);
- vpt->getGW()->polyline(2, pts, NULL, NULL, FALSE, NULL);
-
- // Y
- pts[0] = Point3(0.0f, -size, 0.0f); pts[1] = Point3(0.0f, size, 0.0f);
- vpt->getGW()->polyline(2, pts, NULL, NULL, FALSE, NULL);
-
- // Z
- pts[0] = Point3(0.0f, 0.0f, -size); pts[1] = Point3(0.0f, 0.0f, size);
- vpt->getGW()->polyline(2, pts, NULL, NULL, FALSE, NULL);
- }
-
- {
- pts[0] = Point3(-size, 0.0f, 0.0f); pts[1] = Point3(0.0f, 0.0f, size);
- vpt->getGW()->polyline(2, pts, NULL, NULL, FALSE, NULL);
-
- pts[0] = Point3( size, 0.0f, 0.0f); pts[1] = Point3(0.0f, 0.0f, size);
- vpt->getGW()->polyline(2, pts, NULL, NULL, FALSE, NULL);
-
- pts[0] = Point3(0.0f, -size, 0.0f); pts[1] = Point3(0.0f, 0.0f, size);
- vpt->getGW()->polyline(2, pts, NULL, NULL, FALSE, NULL);
-
- pts[0] = Point3(0.0f, size, 0.0f); pts[1] = Point3(0.0f, 0.0f, size);
- vpt->getGW()->polyline(2, pts, NULL, NULL, FALSE, NULL);
-
- pts[0] = Point3(-size, 0.0f, 0.0f); pts[1] = Point3(0.0f, 0.0f, -size);
- vpt->getGW()->polyline(2, pts, NULL, NULL, FALSE, NULL);
-
- pts[0] = Point3( size, 0.0f, 0.0f); pts[1] = Point3(0.0f, 0.0f, -size);
- vpt->getGW()->polyline(2, pts, NULL, NULL, FALSE, NULL);
-
- pts[0] = Point3(0.0f, -size, 0.0f); pts[1] = Point3(0.0f, 0.0f, -size);
- vpt->getGW()->polyline(2, pts, NULL, NULL, FALSE, NULL);
-
- pts[0] = Point3(0.0f, size, 0.0f); pts[1] = Point3(0.0f, 0.0f, -size);
- vpt->getGW()->polyline(2, pts, NULL, NULL, FALSE, NULL);
-
-
-
- pts[0] = Point3(-size, 0.0f, 0.0f); pts[1] = Point3(0.0f, -size, 0.0f);
- vpt->getGW()->polyline(2, pts, NULL, NULL, FALSE, NULL);
-
- pts[0] = Point3(-size, 0.0f, 0.0f); pts[1] = Point3(0.0f, size, 0.0f);
- vpt->getGW()->polyline(2, pts, NULL, NULL, FALSE, NULL);
-
- pts[0] = Point3(size, 0.0f, 0.0f); pts[1] = Point3(0.0f, -size, 0.0f);
- vpt->getGW()->polyline(2, pts, NULL, NULL, FALSE, NULL);
-
- pts[0] = Point3(size, 0.0f, 0.0f); pts[1] = Point3(0.0f, size, 0.0f);
- vpt->getGW()->polyline(2, pts, NULL, NULL, FALSE, NULL);
- }
-
- //Link to another node
- if (pblock)
- {
- Matrix3 matrix_base = inode->GetObjectTM(t);
- Point3 pos_base = matrix_base.GetRow(3);
-
- for (int node_i = JO_NODE0; node_i <= JO_NODE1; node_i ++)
- {
- INode* node = 0;
- if (pblock->GetValue(node_i, t, node, FOREVER) && node)
- {
- Matrix3 matrix = node->GetObjectTM(t);
- vpt->getGW()->setColor( LINE_COLOR, 0.0f, 1.0f, 0.0f);
-
- Point3 pos = matrix.GetRow(3);
- Point3 delta_pos = pos-pos_base;
-
- BOOL arrow_1 = FALSE;
- BOOL arrow_2 = FALSE;
- pblock->GetValue(node_i+WP_NODE_R0, t, arrow_1, FOREVER);
- pblock->GetValue(node_i+WP_NODE_B0, t, arrow_2, FOREVER);
-
- DrawArrow(vpt, delta_pos.x, delta_pos.y, delta_pos.z, size, arrow_1, arrow_2);
- }
- }
- };
-
-
- if (box)
- {
-
- // Make the box half the size
- size = size * 0.5f;
-
- // Bottom
- pts[0] = Point3(-size, -size, -size);
- pts[1] = Point3(-size, size, -size);
- pts[2] = Point3( size, size, -size);
- pts[3] = Point3( size, -size, -size);
- vpt->getGW()->polyline(4, pts, NULL, NULL, TRUE, NULL);
-
- // Top
- pts[0] = Point3(-size, -size, size);
- pts[1] = Point3(-size, size, size);
- pts[2] = Point3( size, size, size);
- pts[3] = Point3( size, -size, size);
- vpt->getGW()->polyline(4, pts, NULL, NULL, TRUE, NULL);
-
- // Sides
- pts[0] = Point3(-size, -size, -size);
- pts[1] = Point3(-size, -size, size);
- vpt->getGW()->polyline(2, pts, NULL, NULL, FALSE, NULL);
-
- pts[0] = Point3(-size, size, -size);
- pts[1] = Point3(-size, size, size);
- vpt->getGW()->polyline(2, pts, NULL, NULL, FALSE, NULL);
-
- pts[0] = Point3( size, size, -size);
- pts[1] = Point3( size, size, size);
- vpt->getGW()->polyline(2, pts, NULL, NULL, FALSE, NULL);
-
- pts[0] = Point3( size, -size, -size);
- pts[1] = Point3( size, -size, size);
- vpt->getGW()->polyline(2, pts, NULL, NULL, FALSE, NULL);
- }
-
- vpt->getGW()->setTransform(tm_base);
- vpt->getGW()->setRndLimits(limits);
-
- return 1;
- };
-
- IOResult JointObject::Load(ILoad *iload)
- {
- //WAYPOINT_CHUNKID
- return IO_OK;
- };
-
- IOResult JointObject::Save(ISave *isave)
- {
- //useless
- //isave->BeginChunk(WAYPOINT_CHUNKID);
- //isave->EndChunk();
- return IO_OK;
- };