Code

Infrastructure to set direction of infinite VPs (now adjustable by some shortcuts...
[inkscape.git] / src / box3d.h
index a47b066634b43b494c27bb6e40d8c4b7013e5d8d..1e567ded95d2e1751d73cda2e8fb7bff9d9691f1 100644 (file)
@@ -36,7 +36,9 @@
 struct SP3DBox : public SPGroup {
     NR::Point corners[8];
     Box3DFace *faces[6];
-    guint z_orders[6]; // z_orders[i] holds the ID of the face at position #i in the group (from top to bottom)
+    gint z_orders[6]; // z_orders[i] holds the ID of the face at position #i in the group (from top to bottom)
+
+    std::vector<gint> currently_visible_faces;
 
     // TODO: Keeping/updating the ratios works reasonably well but is still an ad hoc implementation.
     //       Use a mathematically correct model to update the boxes.
@@ -48,12 +50,14 @@ struct SP3DBox : public SPGroup {
 
     // FIXME: If we only allow a single box to be dragged at a time then we can save memory by storing
     //        the old positions centrally in SP3DBoxContext (instead of in each box separately)
+    // Also, it may be better not to store the old corners but rather the old lines to which we want to snap
     NR::Point old_center;
     NR::Point old_corner2;
     NR::Point old_corner1;
     NR::Point old_corner0;
     NR::Point old_corner3;
     NR::Point old_corner5;
+    NR::Point old_corner7;
 
     gint my_counter; // for testing only
 };
@@ -67,19 +71,20 @@ GType sp_3dbox_get_type (void);
 void sp_3dbox_position_set (SP3DBoxContext &bc);
 void sp_3dbox_set_shape(SP3DBox *box3d, bool use_previous_corners = false);
 void sp_3dbox_recompute_corners (SP3DBox *box, NR::Point const pt1, NR::Point const pt2, NR::Point const pt3);
-bool sp_3dbox_recompute_z_orders (SP3DBox *box); /* returns true if there was a change in the z-orders
-                                                   (which triggers an update of the repr) */
-void sp_3dbox_set_z_orders (SP3DBox *box);
+void sp_3dbox_set_z_orders_in_the_first_place (SP3DBox *box);
+void sp_3dbox_set_z_orders_later_on (SP3DBox *box);
 void sp_3dbox_update_curves (SP3DBox *box);
 void sp_3dbox_link_to_existing_paths (SP3DBox *box, Inkscape::XML::Node *repr);
 void sp_3dbox_set_ratios (SP3DBox *box, Box3D::Axis axes = Box3D::XYZ);
 void sp_3dbox_switch_front_face (SP3DBox *box, Box3D::Axis axis);
+void sp_3dbox_reshape_after_VP_rotation (SP3DBox *box, Box3D::Axis axis);
 void sp_3dbox_move_corner_in_XY_plane (SP3DBox *box, guint id, NR::Point pt, Box3D::Axis axes = Box3D::XY);
 void sp_3dbox_move_corner_in_Z_direction (SP3DBox *box, guint id, NR::Point pt, bool constrained = true);
 void sp_3dbox_reshape_after_VP_toggling (SP3DBox *box, Box3D::Axis axis);
 NR::Maybe<NR::Point> sp_3dbox_get_center (SP3DBox *box);
 NR::Maybe<NR::Point> sp_3dbox_get_midpoint_between_corners (SP3DBox *box, guint id_corner1, guint id_corner2);
 void sp_3dbox_recompute_XY_corners_from_new_center (SP3DBox *box, NR::Point const new_center);
+void sp_3dbox_recompute_Z_corners_from_new_center (SP3DBox *box, NR::Point const new_center);
 NR::Point sp_3dbox_get_midpoint_in_axis_direction (NR::Point const &C, NR::Point const &D, Box3D::Axis axis, Box3D::Perspective3D *persp);
 
 void sp_3dbox_update_perspective_lines();