git-svn-id: svn://db.shs.com.ru/libs@631 a8b55f48-bf90-11e4-a774-851b48703e85

This commit is contained in:
2019-11-26 21:20:59 +00:00
parent 9059a17cd0
commit 5eaf516eae
16 changed files with 615 additions and 411 deletions

View File

@@ -26,6 +26,7 @@
class RendererService {
friend class QGLView;
friend class MouseController;
friend class Renderer;
friend class RendererSelection;
@@ -33,17 +34,32 @@ public:
RendererService(Renderer * r_);
virtual ~RendererService();
enum HandleType {
htNoHandle,
htMoveX,
htMoveY,
htMoveZ,
htRotateX,
htRotateY,
htRotateZ,
htScaleX,
htScaleY,
htScaleZ,
enum HandleAction {
haNoAction,
haMove,
haRotate,
haScale,
};
enum HandleMesh {
hmMoveX = 0x01,
hmMoveY = 0x02,
hmMoveZ = 0x04,
hmMoveXY = hmMoveX | hmMoveY,
hmMoveXZ = hmMoveX | hmMoveZ,
hmMoveYZ = hmMoveY | hmMoveZ,
hmMaxMove = hmMoveX | hmMoveY | hmMoveZ,
hmRotateX = 0x08,
hmRotateY = 0x10,
hmRotateZ = 0x20,
hmMaxRotate = hmRotateX | hmRotateY | hmRotateZ,
hmScaleX = 0x40,
hmScaleY = 0x80,
hmScaleZ = 0x100,
hmScaleXY = hmScaleX | hmScaleY,
hmScaleXZ = hmScaleX | hmScaleZ,
hmScaleYZ = hmScaleY | hmScaleZ,
hmMaxScale = hmScaleX | hmScaleY | hmScaleZ,
};
void init(int width, int height);
@@ -52,26 +68,29 @@ public:
QMatrix4x4 invariantSizeMatrix(QVector3D p);
void fillXYZObjects();
void fillOmniObjects();
void fillHandleObjects(QVector3D center, HandleType first, QMatrix4x4 add_mat);
bool fillCurrentHandleObjects();
void fillHandleObjects(QVector3D center, HandleMesh ids[], const QVector<QMatrix4x4> & mats, const QVector<QVector4D> & colors, QMatrix4x4 add_mat, int count = 3);
bool calculateCenter();
void drawCurrentHandleObjects();
void setObjectsColor(QVector<QGLEngineShaders::Object> & ol, QColor col);
void renderService();
void setCurrentHadle(HandleType ht) {current_handle = ht;}
void setCurrentAction(HandleAction ha) {current_action = ha;}
Mesh * currentHandleMesh();
private:
Renderer * r;
Mesh * axis_mesh, * handle_move_mesh, * handle_rotate_mesh, * handle_scale_mesh;
Mesh * handle_ms_2_mesh, * handle_scale_3_mesh;
Mesh * box_mesh_f, * omni_mesh_f, * box_mesh, * omni_mesh;
QMatrix4x4 v_mat, axis_mat;
QVector3D selection_center;
QVector<QMatrix4x4> mat_xyz;
QVector<QVector4D> color_xyz;
QVector<QMatrix4x4> mat_xyz, mat_ms2;
QVector<QVector4D> color_xyz, color_ms2;
QVector<QGLEngineShaders::Object> cur_objects;
Camera * axis_camera;
QSize axis_viewport;
HandleType current_handle;
HandleAction current_action;
QFlags<HandleMesh> current_handle;
int line_width;
double size_vp_scale, size_full_scale;