FiberVISH 0.2
Fish - The Fiber Bundle API for the Vish Visualization Shell
RenderFields.hpp
1#ifndef __FISH_POND_ANEMONEFISH_RenderFields_HPP
2#define __FISH_POND_ANEMONEFISH_RenderFields_HPP
3
4#include <pond/bone/FishField.hpp>
5#include <ocean/Anemonia/RenderNamespace.hpp>
6#include <ocean/Anemonia/Seagrass.hpp>
7#include <fiber/field/FragmentIDCollection.hpp>
8
9#include <unordered_map>
10#include <memcore/shared_mutex.hpp>
11
12#include "anemonefishDllApi.h"
13
14namespace Wizt
15{
16
21{
22public:
24 {
25 string name;
27
28 auto operator<=>(const NamedField&) const = default;
29
30 RefPtr<Fiber::Field> getField() const
31 {
32#ifdef HAVE_FADING_OBJECT_REFCOUNT
33 if (myField.isReceivingExtremeUnction())
34 return nullptr;
35#endif
36 return myField;
37 }
38 };
39
40
41// using NamedField = std::tuple<string, WeakPtr<Fiber::Field> >;
42// using NamedField = std::tuple<string, RefPtr<Fiber::Field> >;
43
55// using FieldList_t = std::unordered_map<RenderNamespace::glsl, NamedField >;
57
67// using RefinedFieldList_t = std::map<RefinementIndex, FieldList_t>;
68
69private:
70
78
94 RefinedFieldList_t myCurrentFields;
95
96public:
97private:
116// using mutex_t = std::mutex;
117// mutable mutex_t FieldMutex;
118// using lock_t = std::lock_guard<mutex_t>;
119
120 mutable MemCore::shared_mutex FieldMutex;
121
124
125private:
129/* auto lock() const
130 {
131 return std::unique_lock<mutex_t>(FieldMutex);
132 }
133*/
134
135 int iterate_u(const RefinementIndex&RI,
136 const std::function<bool(const RenderNamespace::glsl&ShaderAttribute,
137 const string&Fieldname, const RefPtr<Fiber::Field>&F)>&callback) const;
138
139 int iterate_u(const std::function<bool(const RenderNamespace::glsl&ShaderAttribute,
140 const string&Fieldname, const RefPtr<Fiber::Field>&F)>&callback) const;
141
142
143public:
144 void resetRenderFields();
145
147 {}
148
150 {
151 lock_readonly lck(RF.FieldMutex);
152 myCurrentFields = RF.myCurrentFields;
153 }
154
155 void operator=(const RenderFields&RF) = delete;
156
157 void assignRenderFields(const RenderFields&RF)
158 {
159 lock_readonly lck(RF.FieldMutex);
160 lock_writeable lck2(FieldMutex);
161 myCurrentFields = RF.myCurrentFields;
162 }
163
164 ~RenderFields();
165
166 NamedField find(const RefinementIndex&Id, const RenderNamespace::glsl&ShaderAttributeName) const;
167
168 bool find(const RefinementIndex&Id) const;
169
170
171 void insert(const NamedField&N, const RefinementIndex&Id, const RenderNamespace::glsl&ShaderAttributeName);
172
173 void insert(const RefinementIndex&Id, const RenderNamespace::glsl&ShaderAttributeName, const NamedField&N)
174 {
175 insert(N, Id, ShaderAttributeName);
176 }
177
178 void erase( const RefinementIndex&Id, const RenderNamespace::glsl&ShaderAttributeName);
179
180
181 int iterate(const RefinementIndex&RI,
182 const std::function<bool(const RenderNamespace::glsl&ShaderAttribute,
183 const string&Fieldname, const RefPtr<Fiber::Field>&F)>&callback) const;
184
185 int iterate(const std::function<bool(const RenderNamespace::glsl&ShaderAttribute,
186 const string&Fieldname, const RefPtr<Fiber::Field>&F)>&callback) const;
187
188
189 bool checkIfFieldFragmentCreatorsAreNewerThan(const RefinementIndex&RI,
190 const RefPtr<AnemoneCreatorBase>&myAnemoneCreator,
191 const RefPtr<Fiber::FragmentID>&Fid) const;
192
193#if 0
194 bool checkIfFieldFragmentCreatorsAreNewerThan(const RefPtr<AnemoneCreatorBase>&myAnemoneCreator,
195 const RefPtr<Fiber::FragmentID>&Fid) const;
196#endif
197
199
204 void request(const RefPtr<Fiber::FragmentID>&myFragmentID, const result&R = nullptr) const;
205
210 bool isUnderCreation(const RefPtr<Fiber::FragmentID>&myFragmentID) const;
211
212
213 auto operator!=(const RenderFields&RF) const
214 {
215 lock_readonly lck(FieldMutex);
216 lock_readonly lck2(RF.FieldMutex);
217 return myCurrentFields != RF.myCurrentFields;
218 }
219
220 auto operator==(const RenderFields&RF) const
221 {
222 lock_readonly lck(FieldMutex);
223 lock_readonly lck2(RF.FieldMutex);
224 return myCurrentFields == RF.myCurrentFields;
225 }
226
227
228/*
229 const FieldList_t&getFieldList() const;
230
231 WeakPtr<Fiber::Field> findField(const RefinementIndex&RI, const RenderNamespace::glsl&ShaderAttributeName) const;
232
233 WeakPtr<Fiber::Field> operator()(const RefinementIndex&RI, const RenderNamespace::glsl&ShaderAttributeName) const
234 {
235 return findField( RI, ShaderAttributeName );
236 }
237*/
238};
239
240
241} // namespace Wizt
242
243#endif // __FISH_POND_ANEMONEFISH_RenderFields_HPP
constexpr complex< _Tp > & operator=(const _Tp &)
constexpr _InputIterator find(_InputIterator __first, _InputIterator __last, const _Tp &__val)
constexpr auto operator<=>(const basic_string< _CharT, _Traits, _Alloc > &__lhs, const _CharT *__rhs) noexcept -> decltype(__detail::__char_traits_cmp_cat< _Traits >(0))
An iterator with an optional DataCreator, which is just a class to intercept creation of data along a...
Definition CreativeIterator.hpp:34
Identifier for Skeletons within a Grid.
Definition SkeletonID.hpp:24
Handling a hierarchy of fields.
Definition RenderFields.hpp:21
note: cannot derive from FloatingSkeletonRenderer as long as independent base class TriangleRenderer ...
bool operator==(const MultipleStringSelection &a, const MultipleStringSelection &b)
bool operator!=(const MultipleStringSelection &a, const MultipleStringSelection &b)
Definition RenderFields.hpp:24