diff options
| author | Maximilian Albert <maximilian.albert@gmail.com> | 2007-08-06 00:07:25 +0000 |
|---|---|---|
| committer | cilix42 <cilix42@users.sourceforge.net> | 2007-08-06 00:07:25 +0000 |
| commit | ea6e0e4d2cd55a2b851a8504a68afff34fc6a683 (patch) | |
| tree | a5529ebcf86551413491b721ab9328d08c6ad1df /src/box3d-context.cpp | |
| parent | Filter effects dialog: (diff) | |
| download | inkscape-ea6e0e4d2cd55a2b851a8504a68afff34fc6a683.tar.gz inkscape-ea6e0e4d2cd55a2b851a8504a68afff34fc6a683.zip | |
Store a global list of existing perspectives; for each perspective hold a list of associated boxes; explicitly pass perspectives as arguments when creating PLs
(bzr r3380)
Diffstat (limited to 'src/box3d-context.cpp')
| -rw-r--r-- | src/box3d-context.cpp | 26 |
1 files changed, 6 insertions, 20 deletions
diff --git a/src/box3d-context.cpp b/src/box3d-context.cpp index d5d367d81..25f6f78f1 100644 --- a/src/box3d-context.cpp +++ b/src/box3d-context.cpp @@ -90,7 +90,7 @@ static void sp_3dbox_context_class_init(SP3DBoxContextClass *klass) event_context_class->item_handler = sp_3dbox_context_item_handler; } -Box3D::Perspective3D * SP3DBoxContext::current_perspective = NULL; +Box3D::Perspective3D * Box3D::Perspective3D::current_perspective = NULL; guint SP3DBoxContext::number_of_handles = 3; static void sp_3dbox_context_init(SP3DBoxContext *box3d_context) @@ -116,20 +116,6 @@ static void sp_3dbox_context_init(SP3DBoxContext *box3d_context) box3d_context->ctrl_dragged = false; box3d_context->extruded = false; - - /* create an initial perspective */ - if (!SP3DBoxContext::current_perspective) { - SP3DBoxContext::current_perspective = new Box3D::Perspective3D ( - // VP in x-direction - Box3D::VanishingPoint( NR::Point( 50.0, 600.0), - NR::Point( -1.0, 0.0), Box3D::VP_INFINITE), - // VP in y-direction - Box3D::VanishingPoint( NR::Point(500.0,1000.0), - NR::Point( 0.0, 1.0), Box3D::VP_INFINITE), - // VP in z-direction - Box3D::VanishingPoint( NR::Point(700.0, 500.0), - NR::Point(sqrt(3.0),1.0), Box3D::VP_INFINITE)); - } new (&box3d_context->sel_changed_connection) sigc::connection(); } @@ -371,18 +357,18 @@ static gint sp_3dbox_context_root_handler(SPEventContext *event_context, GdkEven // Without Ctrl, motion of the extruded corner is constrained to the // perspective line from drag_ptB to vanishing point Y. if (!rc->ctrl_dragged) { - rc->drag_ptC = Box3D::perspective_line_snap (rc->drag_ptB, Box3D::Z, motion_dt); + rc->drag_ptC = Box3D::perspective_line_snap (rc->drag_ptB, Box3D::Z, motion_dt, Box3D::Perspective3D::current_perspective); } else { rc->drag_ptC = motion_dt; } rc->drag_ptC = m.freeSnap(Inkscape::Snapper::SNAPPOINT_BBOX | Inkscape::Snapper::SNAPPOINT_NODE, rc->drag_ptC, rc->item).getPoint(); if (rc->ctrl_dragged) { - Box3D::PerspectiveLine pl1 (NR::Point (event_context->xp, event_context->yp), Box3D::Y); - Box3D::PerspectiveLine pl2 (rc->drag_ptB, Box3D::X); + Box3D::PerspectiveLine pl1 (NR::Point (event_context->xp, event_context->yp), Box3D::Y, Box3D::Perspective3D::current_perspective); + Box3D::PerspectiveLine pl2 (rc->drag_ptB, Box3D::X, Box3D::Perspective3D::current_perspective); NR::Point corner1 = pl1.meet(pl2); - Box3D::PerspectiveLine pl3 (corner1, Box3D::X); - Box3D::PerspectiveLine pl4 (rc->drag_ptC, Box3D::Z); + Box3D::PerspectiveLine pl3 (corner1, Box3D::X, Box3D::Perspective3D::current_perspective); + Box3D::PerspectiveLine pl4 (rc->drag_ptC, Box3D::Z, Box3D::Perspective3D::current_perspective); rc->drag_ptB = pl3.meet(pl4); } } |
