NDEVR
API Documentation
GripsModel.h
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{
38 class SnapPoint;
40
50 class NDEVR_DESIGN_API GripsModel : public Model
51 {
52 public:
56 enum GripMode
57 {
58 e_no_grips
59 , e_vertex_offset_grips
60 , e_model_scale_grips
61 , e_model_horizontal_offset_grips
62 , e_model_vertical_offset_grips
63 , e_model_rotate_grips
64 , e_default_grips
65 };
66 public:
71 GripsModel(const Model& model);
72
78 bool processSelection(const SelectionInfo& info) const;
79
87 void processSnapPoint(SnapPoint& point, DesignObjectLookup* lookup, SelectionInfo& info, const void* lock_ptr) const;
88
89#if NDEVR_VIEWPORT
96 GripMode processGripSelection(const SnapPoint& point, const void* lock_ptr);
97
105 GripMode processGripClicked(const SnapPoint& point, ModelEditController& controller, const void* lock_ptr);
106#endif
107
112 static UUID CursorID();
113
118 static constexpr StringView TypeName() { return "grips_model"; }
119
124 Model target() const;
125
130 void attachTo(const Model& model);
131
136 void detach();
137
142 void setToDefaultGrips(const void* lock = nullptr);
143
148 void setToHighlight(const void* lock = nullptr);
149
155 void setColor(const RGBColor& color, const void* lock = nullptr);
156
162 Ray<3, fltp08> getIndexNormal(uint04 index);
163
169 Ray<3, fltp08> getIndexTangent(uint04 index);
170
176 static RGBColor GripColor(GripMode mode);
177
182 BitFlag activeGripFlag() const;
183
189 void setActiveGripFlag(BitFlag flag, const void* lock_ptr = nullptr);
190
191 protected:
197 void _setActiveGripFlag(BitFlag flag, const void* lock_ptr = nullptr);
198
202 void setupBoundsModel();
203
207 void setupDiagonalExpandGrips();
208
212 void setupExpandGrips();
213
217 void setupRotationGrips();
218
223 void setupOffsetGrips(bool horizontal);
224
228 void setupVertexGrips();
229
234 void hideAllGrips(const void* lock_ptr) const;
235
241 void showGrip(uint04 index, const void* lock_ptr) const;
242
243 protected:
244 Model m_bounds_model;
245 Model m_diagonal_expand_grips;
246 Model m_expand_grips;
247 Model m_rotation_grips;
248 Model m_horizontal_offset_grips;
249 Model m_vertical_offset_grips;
250 Model m_vertex_grip;
251 static const constexpr uint04 rotate_segs = 128;
252 };
253}
254#endif
A core class where all Design Objects including models, materials, and geometries are stored.
Takes user input in order to modify a model in real-time.
A core class that represents a node on model hierarchy.
Definition Model.h:292
Contains information about a particular point of interest created from a user mouse interaction.
Definition SnapPoint.h:46
The primary namespace for the NDEVR SDK.
@ BitFlag
Per-vertex bit flags (selected, hidden, etc.).
uint32_t uint04
-Defines an alias representing a 4 byte, unsigned integer -Can represent exact integer values 0 throu...