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;
41 /**--------------------------------------------------------------------------------------------------
42 \brief A core class that provides a dynamic effect to an object in a model heirarchy.
43 **/
45 {
46 public:
48 {
49 e_none
50 , e_placeholer
51 , e_3D_fade_in
52 , e_3D_fade_out
53 , e_draw_bounding_box
54 , e_station
55 , e_set_transform
56 , e_scan
57 , e_light
58 , e_design_property
59 , e_model_property
60 , e_material_property
61 , e_geometry_property
62 , e_material_uv_color
63 , e_location_operations
64 , e_azimuth_operations
65 , e_tile_model_to_object
66 };
67
69 {
70 e_effect_type
71 , e_is_active
72 , e_start_time
73 , e_end_time
74 , e_frequency
75 , e_extra_size
76 , e_extra_transform
77 , e_destroy_when_finished
78 , e_target_property
79 , e_target_value_a
80 , e_target_value_b
81 };
82 public:
83 Effect();//constructor for invalid object
84 Effect(uint04 index, DesignObjectBase* property_table);
85 Effect(DesignObjectBase* property_table);
86
87 template<class t_type>
88 void setEffectProperty(EffectProperties mat_index, const t_type& type)
89 {
90 m_base->effect_table.get()[m_base->effect_property_index[mat_index]].set(m_design_index, type);
91 }
92 template<class t_type>
93 [[nodiscard]] t_type getEffectProperty(EffectProperties mat_index) const
94 {
95 t_type type;
96 m_base->effect_table.get()[m_base->effect_property_index[mat_index]].get(m_design_index, type);
97 return type;
98 }
99 void cleanup();
100 void setupAsLight(fltp04 intensity = 1.0);
101 void setupAsBlinking(fltp04 frequency);
102 void setupAsBoundingBox(const Model& bounds);
103 void setupAsBoundingBox(const Model& bounds, const Model& target);
105 void setBoundsRotation(bool bounds_can_rotate);
106 bool getBoundsRotation() const;
107#if NDEVR_STATION_MODEL
108 void setupAsStation(const Model& station);
109#endif
110 void copyFrom(const Effect& effect);
111 void setupAsModelTile(const Model& model_tile);
112#if NDEVR_CALIBRATION
113 void setupAsCalibration(const Model& calibration);
114#endif
115#if NDEVR_SCAN
116 void setupAsScan(const Model& scan);
117#endif
118 void setupAsLocationOperations(const Model& reference);
119 void setupAsSetTransform(const Model& target, const Matrix<fltp08>& transform, const TimeSpan& span = TimeSpan(1.0));
122 void update(Time current_time, DesignObjectLookup* lock_ptr);
123
124 template<class t_type>
125 void setTargetProperty(uint04 property_name, t_type value)
126 {
127 setEffectProperty(EffectProperties::e_target_property, property_name);
128 setEffectProperty(EffectProperties::e_target_value_a, value);
129 }
130 template<class t_type>
131 void setTargetProperty(uint04 property_name, t_type value_a, t_type value_b)
132 {
133 setEffectProperty(EffectProperties::e_target_property, property_name);
134 setEffectProperty(EffectProperties::e_target_value_a, value_a);
135 setEffectProperty(EffectProperties::e_target_value_b, value_b);
136 }
137 void clearTargets() const;
138 void removeTarget(uint04 index);
139
141 void setTarget(uint04 index, const DesignObject& target);
142 void addTarget(uint04 index, const DesignObject& target);
143 void addTarget(const DesignObject& target);
147 void activate();
149 bool operator==(const Effect& mat) const
150 {
151 return mat.index() == index();
152 }
153 bool operator!=(const Effect& mat) const
154 {
155 return mat.index() != index();
156 }
157 private:
158 void _updateTargetProperty(EffectType effect_type, Buffer<DesignObject>& targets, const String& value, const void* lock_ptr = nullptr);
159#if NDEVR_STATION_MODEL
160 void _updateStation(const Time& update_time, DesignObjectLookup* lookup);
161#endif
162 void _updateAzimuth(const Time& update_time, DesignObjectLookup* lookup);
163 void _updateLocation(const Time& update_time, DesignObjectLookup* lookup);
164#if NDEVR_SCAN
165 void _updateScan(const Time& update_time, const void* lock_ptr);
166#endif
167 };
168
169
170}
171
172
173
#define NDEVR_DESIGN_API
Definition DLLInfo.h:55
The equivelent of std::vector but with a bit more control. The basic array unit of the library.
Definition Buffer.hpp:56
Provides the underlying data storage for the NDEVR Scene Model heirarchy.
Definition DesignObjectBase.h:150
A low-level database object that can be used to access general stored properties within the NDEVR Mod...
Definition DesignObject.h:67
uint04 index() const
Definition DesignObject.h:337
A core class where all Design Objects including models, materials, and geometries are stored....
Definition DesignObjectLookup.h:65
A core class that provides a dynamic effect to an object in a model heirarchy.
Definition Effect.h:45
void removeTarget(uint04 index)
void setupAsModelTile(const Model &model_tile)
bool operator==(const Effect &mat) const
Definition Effect.h:149
void setupAsLocationOperations(const Model &reference)
void setupAsLight(fltp04 intensity=1.0)
t_type getEffectProperty(EffectProperties mat_index) const
Definition Effect.h:93
Effect(uint04 index, DesignObjectBase *property_table)
EffectType effectType() const
void setupAsBoundingBox(const Model &bounds, const Model &target)
DesignObject getTarget(uint04 target) const
void setTargetProperty(uint04 property_name, t_type value)
Definition Effect.h:125
void copyFrom(const Effect &effect)
void update(Time current_time, DesignObjectLookup *lock_ptr)
EffectType
Definition Effect.h:48
void setEffectProperty(EffectProperties mat_index, const t_type &type)
Definition Effect.h:88
void deactivate()
void setTarget(uint04 index, const DesignObject &target)
void addTarget(const DesignObject &target)
EffectProperties
Definition Effect.h:69
bool operator!=(const Effect &mat) const
Definition Effect.h:153
Buffer< DesignObject, uint04, ObjectAllocator< DESIGN_PRIM > > getTargets() const
void clearTargets() const
Effect(DesignObjectBase *property_table)
void setBoundsRotation(bool bounds_can_rotate)
void setupAsBlinking(fltp04 frequency)
void deleteEffect()
bool getBoundsRotation() const
void setupAsBoundingBox(const Model &bounds, const Buffer< Model, uint04, ObjectAllocator< DESIGN_PRIM > > &targets)
void addTarget(uint04 index, const DesignObject &target)
uint04 numberOfTargets() const
void setupAsBoundingBox(const Model &bounds)
void setEffectType(EffectType type)
void setTargetProperty(uint04 property_name, t_type value_a, t_type value_b)
Definition Effect.h:131
void setupAsSetTransform(const Model &target, const Matrix< fltp08 > &transform, const TimeSpan &span=TimeSpan(1.0))
Definition Matrix.hpp:176
A core class that represents a node on model heirarchy. This node may contain a Geometry or one or mo...
Definition Model.h:58
Definition MemoryManager.h:261
The core String class for the NDEVR API.
Definition String.h:69
Represents a timestamp with utilities for manipulation and conversion.
Definition Time.h:54
Stores a time span, or difference between two times, with an optional start time.
Definition TimeSpan.h:46
Definition ACIColor.h:37
float fltp04
Defines an alias representing a 4 byte floating-point number Bit layout is as follows: -Sign: 1 bit a...
Definition BaseValues.hpp:127
uint8_t uint01
-Defines an alias representing a 1 byte, unsigned integer -Can represent exact integer values 0 throu...
Definition BaseValues.hpp:80
uint32_t uint04
-Defines an alias representing a 4 byte, unsigned integer -Can represent exact integer values 0 throu...
Definition BaseValues.hpp:96