API Documentation
Loading...
Searching...
No Matches
Effect.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: Effect
29Included in API: True
30Author(s): Tyler Parke
31 *-----------------------------------------------------------------------------------------**/
32#pragma once
33#include "DLLInfo.h"
34#include <NDEVR/DesignObject.h>
35#include <NDEVR/BaseValues.h>
36#include <NDEVR/TimeSpan.h>
37namespace NDEVR
38{
39 class Model;
40 class DesignObjectLookup;
42 {
43 public:
45 {
46 e_none
47 , e_placeholer
48 , e_3D_fade_in
49 , e_3D_fade_out
50 , e_draw_bounding_box
51 , e_station
52 , e_set_transform
53 , e_scan
54 , e_light
55 , e_design_property
56 , e_model_property
57 , e_material_property
58 , e_geometry_property
59 , e_material_uv_color
60 , e_location_operations
61 , e_azimuth_operations
62 , e_tile_model_to_object
63 };
64
66 {
67 e_effect_type
68 , e_is_active
69 , e_start_time
70 , e_end_time
71 , e_frequency
72 , e_extra_size
73 , e_extra_transform
74 , e_destroy_when_finished
75 , e_target_property
76 , e_target_value_a
77 , e_target_value_b
78 };
79 public:
80 Effect();//constructor for invalid object
81 Effect(uint04 index, DesignObjectBase* property_table);
82 Effect(DesignObjectBase* property_table);
83
84 template<class t_type>
85 void setEffectProperty(EffectProperties mat_index, const t_type& type)
86 {
87 m_base->effect_table.get()[m_base->effect_property_index[mat_index]].set(m_design_index, type);
88 }
89 template<class t_type>
90 [[nodiscard]] t_type getEffectProperty(EffectProperties mat_index) const
91 {
92 t_type type;
93 m_base->effect_table.get()[m_base->effect_property_index[mat_index]].get(m_design_index, type);
94 return type;
95 }
96 void cleanup();
97 void setupAsLight(fltp04 intensity = 1.0);
98 void setupAsBlinking(fltp04 frequency);
99 void setupAsBoundingBox(const Model& bounds);
100 void setupAsBoundingBox(const Model& bounds, const Model& target);
102 void setBoundsRotation(bool bounds_can_rotate);
103 bool getBoundsRotation() const;
104#if NDEVR_STATION_MODEL
105 void setupAsStation(const Model& station);
106#endif
107 void copyFrom(const Effect& effect);
108 void setupAsModelTile(const Model& model_tile);
109#if NDEVR_CALIBRATION
110 void setupAsCalibration(const Model& calibration);
111#endif
112#if NDEVR_SCAN
113 void setupAsScan(const Model& scan);
114#endif
115 void setupAsLocationOperations(const Model& reference);
116 void setupAsSetTransform(const Model& target, const Matrix<fltp08>& transform, const TimeSpan& span = TimeSpan(1.0));
117 uint04 numberOfTargets() const;
118 DesignObject getTarget(uint04 target) const;
119 void update(Time current_time, DesignObjectLookup* lock_ptr);
120
121 template<class t_type>
122 void setTargetProperty(uint04 property_name, t_type value)
123 {
124 setEffectProperty(EffectProperties::e_target_property, property_name);
125 setEffectProperty(EffectProperties::e_target_value_a, value);
126 }
127 template<class t_type>
128 void setTargetProperty(uint04 property_name, t_type value_a, t_type value_b)
129 {
130 setEffectProperty(EffectProperties::e_target_property, property_name);
131 setEffectProperty(EffectProperties::e_target_value_a, value_a);
132 setEffectProperty(EffectProperties::e_target_value_b, value_b);
133 }
134 void clearTargets() const;
135 void removeTarget(uint04 index);
136
138 void setTarget(uint04 index, const DesignObject& target);
139 void addTarget(uint04 index, const DesignObject& target);
140 void addTarget(const DesignObject& target);
141 EffectType effectType() const;
142 void setEffectType(EffectType type);
143 void deactivate();
144 void activate();
145 void deleteEffect();
146 bool operator==(const Effect& mat) const
147 {
148 return mat.index() == index();
149 }
150 bool operator!=(const Effect& mat) const
151 {
152 return mat.index() != index();
153 }
154 protected:
155 void _updateTargetProperty(EffectType effect_type, Buffer<DesignObject>& targets, const String& value, const void* lock_ptr = nullptr);
156#if NDEVR_STATION_MODEL
157 void _updateStation(const Time& update_time, DesignObjectLookup* lookup);
158#endif
159 void _updateAzimuth(const Time& update_time, DesignObjectLookup* lookup);
160 void _updateLocation(const Time& update_time, DesignObjectLookup* lookup);
161#if NDEVR_SCAN
162 void _updateScan(const Time& update_time, const void* lock_ptr);
163#endif
164 };
165
166
167}
168
169
170
#define NDEVR_DESIGN_API
Definition DLLInfo.h:77
The equivelent of std::vector but with a bit more control. The basic array unit of the library.
Definition Buffer.hpp:64
Definition DesignObjectBase.h:140
Definition DesignObject.h:66
uint04 index() const
Definition DesignObject.h:344
Definition DesignObjectLookup.h:61
Definition Effect.h:42
void setupAsModelTile(const Model &model_tile)
bool operator==(const Effect &mat) const
Definition Effect.h:146
t_type getEffectProperty(EffectProperties mat_index) const
Definition Effect.h:90
void setTargetProperty(uint04 property_name, t_type value)
Definition Effect.h:122
EffectType
Definition Effect.h:45
void setEffectProperty(EffectProperties mat_index, const t_type &type)
Definition Effect.h:85
EffectProperties
Definition Effect.h:66
bool operator!=(const Effect &mat) const
Definition Effect.h:150
void setupAsBoundingBox(const Model &bounds, const Buffer< Model, uint04, ObjectAllocator< DESIGN_PRIM > > &targets)
void setTargetProperty(uint04 property_name, t_type value_a, t_type value_b)
Definition Effect.h:128
Definition Matrix.hpp:173
Definition Model.h:54
Definition MemoryManager.h:283
Definition String.h:40
Represents a timestamp with utilities for manipulation and conversion.
Definition Time.h:54
Definition TimeSpan.h:40
Definition ACIColor.h:37
float fltp04
Defines an alias representing a 4 byte floating-point number.
Definition BaseValues.hpp:157
uint8_t uint01
-Defines an alias representing a 1 byte, unsigned integer -Can represent exact integer values 0 throu...
Definition BaseValues.hpp:98
uint32_t uint04
-Defines an alias representing a 4 byte, unsigned integer -Can represent exact integer values 0 throu...
Definition BaseValues.hpp:120