PDA

View Full Version : Drawing Bezier to Viewports


Loftless
11-15-2010, 09:40 PM
So, long story short I am trying to connect 2 objects by linking them with a bezier line.

Right now, this is how I am doing it:


//Lets test trying to draw a spline on the screen =)
void PropertyTest::TESTDrawSpline( BezierShape& ashape )
{
//Get active viewport
vpt = GetCOREInterface()->GetActiveViewport();

// Delete all points in the existing spline
Spline3D *spline = ashape.NewSpline();

spline->AddKnot( SplineKnot( KTYPE_BEZIER, LTYPE_LINE, Point3(1,1,1), Point3(0,0,0), Point3(0,0,0) ) );
spline->AddKnot( SplineKnot( KTYPE_BEZIER, LTYPE_LINE, Point3(1,1,1), Point3(0,0,0), Point3(0,0,0) ) );
spline->AddKnot( SplineKnot( KTYPE_BEZIER, LTYPE_LINE, Point3(2,2,2), Point3(0,0,0), Point3(0,0,0) ) );
spline->AddKnot( SplineKnot( KTYPE_BEZIER, LTYPE_LINE, Point3(5,5,5), Point3(0,0,0), Point3(0,0,0) ) );
spline->AddKnot( SplineKnot( KTYPE_BEZIER, LTYPE_LINE, Point3(10,10,10), Point3(0,0,0), Point3(0,0,0) ) );

ashape.optimize = TRUE;
spline->SetClosed();
spline->ComputeBezPoints();
ashape.UpdateSels();
ashape.InvalidateGeomCache();

INode *temp;
temp->SetObjectRef( (Object*)spline );


//Display the object. Please?
Display( ip->GetTime(), temp, vpt, USE_DAMAGE_RECT );
}

int PropertyTest::Display( TimeValue t, INode* inode, ViewExp *vpt, int flags )
{

GraphicsWindow *gw = vpt->getGW();
Matrix3 mat = inode->GetObjectTM(t);
gw->setTransform(mat);

Mesh mesh;
mesh.render( gw, inode->Mtls(), (flags&USE_DAMAGE_RECT) ? &vpt->GetDammageRect() : NULL, COMP_ALL, inode->NumMtls() );
return 0;
}


This is just debug code. I am not connecting the objects yet. I am simply attempting to draw the Bezier on the screen. This doesn't seem to be working. I can not seem to get it to display said lines.

Any help is much appreciated on the matter.

Loftless
11-19-2010, 03:10 PM
Still having no luck. Tried integrating the logic to select the two objects, and draw between them, to no avail. Definitely something weird to do with the code listed above.

Anyone out there in the multi-verse who has any ideas?

CGTalk Moderation
11-19-2010, 03:10 PM
This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.