API Documentation
Loading...
Searching...
No Matches
GripsModel.h
Go to the documentation of this file.
1/*--------------------------------------------------------------------------------------------
2Copyright (c) 2019, NDEVR LLC
3tyler.parke@ndevr.org
4 __ __ ____ _____ __ __ _______
5 | \ | | | __ \ | ___|\ \ / / | __ \
6 | \ | | | | \ \ | |___ \ \ / / | |__) |
7 | . \| | | |__/ / | |___ \ V / | _ /
8 | |\ |_|_____/__|_____|___\_/____| | \ \
9 |__| \__________________________________| \__\
10
11Subject to the terms of the Enterprise+ Agreement, NDEVR hereby grants
12Licensee a limited, non-exclusive, non-transferable, royalty-free license
13(without the right to sublicense) to use the API solely for the purpose of
14Licensee's internal development efforts to develop applications for which
15the API was provided.
16
17The above copyright notice and this permission notice shall be included in all
18copies or substantial portions of the Software.
19
20THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
21INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
22PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE
23FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
24OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
25DEALINGS IN THE SOFTWARE.
26
27Library: Design
28File: GripsModel
29Included in API: True
30Author(s): Tyler Parke
31 *-----------------------------------------------------------------------------------------**/
32#pragma once
33#include <NDEVR/Model.h>
34#if NDEVR_GRIPS
35namespace NDEVR
36{
37 class ModelEditController;
38 class SnapPoint;
39 class DesignObjectLookup;
40
41 /**--------------------------------------------------------------------------------------------------
42 \brief A Model which contains points to adjust a target orientation, scale, or offset with the mouse.
43 **/
44 class NDEVR_DESIGN_API GripsModel : public Model
45 {
46 public:
47 enum GripMode
48 {
49 e_no_grips
50 , e_vertex_offset_grips
51 , e_model_scale_grips
52 , e_model_horizontal_offset_grips
53 , e_model_vertical_offset_grips
54 , e_model_rotate_grips
55 , e_default_grips
56 };
57 public:
58 GripsModel(const Model& model);
59 bool processSelection(SelectionInfo& info) const;
60 void processSnapPoint(SnapPoint& point, DesignObjectLookup* lookup, SelectionInfo& info) const;
61#if NDEVR_VIEWPORT
62 GripMode processGripSelection(const SnapPoint& point, const void* lock_ptr);
63 GripMode processGripClicked(const SnapPoint& point, ModelEditController& controller, const void* lock_ptr);
64#endif
65 static UUID CursorID();
66 static constexpr const char* TypeName() { return "grips_model"; }
67 Model target() const;
68 void attachTo(const Model& model);
69 void detatch();
70 void setToDefaultGrips(const void* lock = nullptr);
71 void setToHighlight(const void* lock = nullptr);
72 void setColor(const RGBColor& color, const void* lock = nullptr);
73 Ray<3, fltp08> getIndexNormal(uint04 index);
74 Ray<3, fltp08> getIndexTangent(uint04 index);
75 static RGBColor GripColor(GripMode mode);
76 BitFlag activeGripFlag() const;
77 void setActiveGripFlag(BitFlag flag, const void* lock_ptr = nullptr);
78 protected:
79
80 void setupBoundsModel();
81 void setupDiagonalExpandGrips();
82 void setupExpandGrips();
83 void setupRotationGrips();
84 void setupOffsetGrips(bool horizontal);
85 void setupVertexGrips();
86 void hideAllGrips() const;
87 void showGrip(uint04 index) const;
88 protected:
89 Model m_bounds_model;
90 Model m_diagonal_expand_grips;
91 Model m_expand_grips;
92 Model m_rotation_grips;
93 Model m_horizontal_offset_grips;
94 Model m_vertical_offset_grips;
95 Model m_vertex_grip;
96 static const constexpr uint04 rotate_segs = 128;
97 };
98}
99#endif
#define NDEVR_DESIGN_API
Definition DLLInfo.h:55
Definition ACIColor.h:37
uint32_t uint04
-Defines an alias representing a 4 byte, unsigned integer -Can represent exact integer values 0 throu...
Definition BaseValues.hpp:96