FiberVISH 0.2
Fish - The Fiber Bundle API for the Vish Visualization Shell
Lanternfish.hpp
1#ifndef __FISH_POND_ANEMONEFISH_Lanternfish_HPP
2#define __FISH_POND_ANEMONEFISH_Lanternfish_HPP
3
4#include "GridAnemone.hpp"
5#include <memcore/shared_mutex.hpp>
6#include <forward_list>
7
8namespace Wizt
9{
10
11using namespace Fiber;
12using namespace Eagle;
13
14struct SeaBed;
15
21{
22 struct Fragment
23 {
24 const RefPtr<FragmentID> fID;
26 const RefPtr<BoundingBox> myFragmentBoundingBox;
27 SkeletonID myCurrentSkeletonID;
28 const GridAnemone::AnemoneParameters myAnemoneParameters;
29 bool TerminalFragment;
30
35
36 enum class FragmentRenderStatus
37 {
38 allDone, underConstruction, IOerror
39 };
40
41 mutable size_t MemUsed = 0, NumberOfVertices = 0;
42
43 FragmentRenderStatus
44 render(int id,
45 VRenderContext&theContext,
47 const WeakPtr<GridAnemone>&myGridAnemone,
50 ) const;
51
52
53 bool haveValidAnemone(RenderBasin&theContext,
55 const WeakPtr<GridAnemone>&myGridAnemone,
57
58 bool haveDataUnderCreation() const;
59 void request(const Fiber::CreativeArrayBase::result&R) const;
60
61 void cancelCreation() const;
62 };
63
64mutable std::mutex FragmentListMutex;
66
67 RefPtr<Fiber::Grid> myCurrentGrid;
68 RefPtr<Fiber::Chart> myCurrentChart;
69
70 std::set<RefPtr<FragmentID>> myFragmentIDs;
71
72 int id = 0;
73 double CreationTime = 0.0;
74 MemCore::Timer myLifetime;
75
76 using creation_result = std::chrono::duration<double>;
77 std::future<creation_result> SeabedCreation;
78
79 std::atomic<bool> creationComplete{false};
80
81 double getDataLoadTime() const;
82
83 bool isCurrentlyUnderCreation() const
84 {
85 return SeabedCreation.valid() &&
86 SeabedCreation.wait_for(std::chrono::seconds(0)) != std::future_status::ready;
87 }
88
89 bool hasCreationCompleted() const
90 {
91 return creationComplete.load(std::memory_order_acquire);
92 }
93
94
95 bool isValid() const
96 {
97 return hasCreationCompleted() and NumberOfFragmentsUnderCreation()==0 and allFragmentsAreFine();
98 }
99
100 void setCompletion();
101
104
105 ~Lanternfish();
106
108
109 void catchFragment(const Fragment&F);
110
111 size_t NumberOfFragments() const;
112
114 {
115 size_t Completed = 0,
116 Incomplete = 0,
117
118 MemUsed = 0, NumberOfVertices = 0;
119
120 RenderFragmentInfo(size_t C, size_t IC, size_t aMemUsed = 0, size_t aNumberOfVertices = 0)
121 : Completed(C)
122 , Incomplete(IC)
123 , MemUsed(aMemUsed)
124 , NumberOfVertices( aNumberOfVertices )
125 {}
126 };
127
128 unsigned NumberOfFragmentsUnderCreation() const;
129
130 std::string description() const;
131
132 void request(const Fiber::CreativeArrayBase::result&R) const;
133 void cancelCreation() const;
134
138 bool allFragmentsAreFine() const;
139
145 renderFragments(VRenderContext&theContext,
147 const WeakPtr<GridAnemone>&myGridAnemone,
148 double RenderTimeFactor,
151
152
153 RefPtr<BoundingBox> getBoundingBox(unsigned N) const;
154
155 // void updateAnemones(VRenderContext&theContext,
156 // const WeakPtr<GridAnemone>&myGridAnemone,
157 // const WeakPtr<Fiber::Chart>&theCurrentChart) const;
158
159#if 0
166 isRenderAble(VRenderContext&theContext,
170 unsigned MaxNumberOfRenderFragments) const;
171#endif
172
173};
174
176{
177 unsigned DisplayMinLevel = 0,
178 DisplayMaxLevel = 0;
179
180 bool mayDisplay(const SkeletonID&S) const;
181};
182
194{
195 Ageable myRegionOfInterestAge;
196 PhysicalSpace::Frustum myFrustum;
197 VCamera myCamera;
198 double Threshold = 400.0;
199 WeakPtr<Chart> myChart;
200 WeakPtr<CellTensorFunctor> myCellTensor;
201 RenderFields myFields;
202
203
204 bool operator==(const LanternFestivalParameters&) const;
205 bool operator!=(const LanternFestivalParameters&) const;
206};
207
208
214{
216
218 {
219 RefPtr<Lanternfish> myLantern;
220 };
221
223 WeakPtr<Chart> myChart;
224
226
227 // TODO: also consider chart
229 mutable MemCore::shared_mutex myLanternView_mutex;
230
233
234static unsigned LanternsToRemember;
235
238
242 RefPtr<Lanternfish> getExactLantern(const Parameters&LFP) const;
243
247 RefPtr<Lanternfish> getBestLantern(const Parameters&LFP) const;
248
255 getMostRecentValidLantern() const;
256
258 newLantern(const RefPtr<Grid>&G, const RefPtr<Chart>&chart,
260
261 void setLanternGrid(const RefPtr<Grid>&G, const RefPtr<Chart>&chart);
262
263 bool hasSameLanternGrid(const RefPtr<Grid>&G, const RefPtr<Chart>&chart) const
264 {
265 return myChart == chart and
266 myGrid == G;
267 }
268};
269
270} // namespace Wizt
271
272#endif // __FISH_POND_ANEMONEFISH_Lanternfish_HPP
basic_string< char > string
A generic Chart object that may be used to cast information of points within a manifold to numerical ...
Definition Chart.hpp:91
An iterator with an optional DataCreator, which is just a class to intercept creation of data along a...
Definition CreativeIterator.hpp:34
Data structure describing all fields available per fragment, which is a selection of createable data ...
Definition Fragment.hpp:38
A Grid is a set of Skeleton objects, each of them accessed via some unique SkeletonID object.
Definition Grid.hpp:60
Identifier for Skeletons within a Grid.
Definition SkeletonID.hpp:24
Handling a hierarchy of fields.
Definition RenderFields.hpp:21
Given a fragmented field of curvilinear coordinates, (3D array of coordinates), build a uniform Grid ...
Definition FAQ.dox:2
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)
Special properties that are available optionally in shader code.
Definition AnemoneCreationContext.hpp:36
Set of parameters that trigger a new Lanternfish upon change:
Definition Lanternfish.hpp:194
Definition Lanternfish.hpp:218
Behavior is similar to a map<VCamera, RefPtr<Lanternfish>> but the number of entries here remains lim...
Definition Lanternfish.hpp:214
Definition Lanternfish.hpp:23
AnemoneCreatorDependency myDataCreators
List of field names and CreatorBase objects.
Definition Lanternfish.hpp:34
Definition Lanternfish.hpp:114
Internal class to collect fragments and to render them afterwards.
Definition Lanternfish.hpp:21
Definition Lanternfish.hpp:176
Definition SeaBed.hpp:36