FiberVISH 0.2
Fish - The Fiber Bundle API for the Vish Visualization Shell
GridAnemone.hpp
1#ifndef __FISH_POND_ANEMONEFISH_GridAnemone_HPP
2#define __FISH_POND_ANEMONEFISH_GridAnemone_HPP
3
4#include <spine/SkeletonOperator.hpp>
5#include <ocean/Anemonia/VRenderObject.hpp>
6#include <ocean/Anemonia/Seagrass.hpp>
7#include <ocean/shrimp/Options.hpp>
8#include <ocean/shrimp/PhysicalSpace.hpp>
9
10#include <memcore/Timer.hpp>
11#include <bone/FishSlice.hpp>
12
13#include "CellTensorFunctor.hpp"
14#include "ShaderFields.hpp"
15#include "AnemoneRenderFields.hpp"
16
17#include "RegionOfInterest.hpp"
18
19#include "AnemoneCreationContext.hpp"
20
21#include "anemonefishDllApi.h"
22
23namespace Wizt
24{
25
26struct Lanternfish;
27struct LanternFestivalParameters;
28struct SeaBed; // internal class
29
30using AnemoneCreatorDependency = AnemoneRenderFields::AnemoneCreatorDependency;
31
32class anemonefish_API GridAnemoneState;
33using RefPtrGridAnemoneState = RefPtr<GridAnemoneState,VObject::State>;
34
35
36#if 0
37class anemonefish_API GridAnemone;
38struct anemonefish_API GridAnemone::AnemoneCreationContext;
39
40#endif
41
77class anemonefish_API GridAnemone : public virtual Fish<double>
79{
80
81 bool renderCachedFragments(VRenderContext&Context,
82 bool ShowTerminalOnly) const;
83
84 bool renderLanternfish(VRenderContext&Context,
86 bool ShowTerminalOnly) const;
87
88// bool renderSeabedResult(VRenderContext&Context, const RefPtrGridAnemoneState&GAS) const;
89
90
91 in<pRegionOfInterest> inRegionOfInterest;
92 in<bool> inUseRegionOfInterest;
93
94public:
98
99 inout<double> inLevelThreshold;
100
101 in<double> inRenderTimeFactor;
102
103 inout<RefPtr<CellTensorFunctor>> inCellTensorFunctor;
104
105 in<bool> inFreeze, inShowTerminalOnly;
106
107 inout<int> inMinLevel, inNumberOfLevels;
108
109 inout<int> inMaxNumberOfRenderFragments,
110 inMinNumberOfElementsPerFragments,
111 inMaxNumberOfElementsPerFragments;
112
113 out<VBoundingBox> outVisibleBBox;
114 out<Fiber::Grid> outVisibleGrid;
115
116virtual GridSelector getGridFieldSelector(const RefPtr<ValuePool>&Context) const = 0;
117
118 Ageable AgeOfRoI(const RefPtr<ValuePool>&Context) const;
119
121 getRegionOfInterest(const RefPtr<ValuePool>&Context) const;
122
127 RefPtr<Fiber::Chart> getCartesianChart(const RefPtr<Fiber::Grid>&G, const RefPtr<ValuePool>&Context) const;
128
130
132 {
133 SkeletonID myID;
134 RefPtr<Fiber::Representation> myRepresentation;
135 RefPtr<Fiber::Field> myPositions;
136
137 FieldInfo()
138 : myID( nullptr )
139 {}
140
144 )
145 : myID( theID )
146 , myRepresentation( theRepresentation )
147 , myPositions( thePositions )
148 {}
149 };
150
152
154
155 RefPtr<State> newState() const override;
156
158 GridAnemone(const string&name, int RenderCategory, const RefPtr<VCreationPreferences>&VP);
159
161 ~GridAnemone();
162
163 RenderTime getLastRenderTime(VRenderContext&Context) const override;
164
165
176 virtual FieldHierarchy getRenderFields(VRenderContext&Context) const;
177
178
186 struct anemonefish_API CoordinateShift : Interface<CoordinateShift>
187 {
188 Eagle::tvector3 ShiftToCenter;
189
190 CoordinateShift(const Eagle::tvector3&ShiftToCenter);
192 };
193
194
204 {
205 Timer Duration;
206 WeakPtr<GridAnemone> myExplorersGridAnemone;
207 RefPtrGridAnemoneState myGridAnemoneState;
208 pRegionOfInterest myRegionOfInterest;
209
210 /*
211 Statistics: Time for creating coordinates such as loading from disk.
212 Such time is likely to be a one-time effort that may no longer occur
213 on next call.
214 */
215 double CoordinateCreationTime = 0.0;
216
220
222
224 RefPtr<Fiber::Chart> getCurrentChart() const;
225
227 RefPtr<Fiber::Grid> getCurrentGrid() const;
228
233 RefPtr<Fiber::Representation> getChartRepresentation(const SkeletonID&SID) const;
234 RefPtr<Fiber::Skeleton> getSkeleton(const SkeletonID&SID) const;
235
236 RenderNamespace::glsl setupRegionOfInterest(VRenderContext&Context, const FloatingAnemone&);
237 };
238
239 virtual RefPtr<AnemoneExplorer> getAnemoneExplorer(VRenderContext&Context) const;
240
241
289 virtual RefPtr<AnemoneCreatorBase> newAnemoneCreator(const Seagrass&theSeaggrass) const;
290
291
293 createVertexCoordinates(VRenderContext&Context, const RefPtr<Fiber::MemBase>&Coordinates,
295
296 using AnemoneRenderStatus = AnemoneRenderFields::AnemoneRenderStatus;
297
298static const char*getAnemoneRenderStatusDescription(AnemoneRenderStatus);
299
304 AnemoneRenderStatus renderAnemone (Anemone&RenderAnemone, const AnemoneCreationContext&ARC, const RefPtr<AnemoneExplorer>&AE,
306
307
310
316 AnemoneRenderStatus raiseAnemone(Anemone&RenderAnemone,
318 const RefPtr<AnemoneExplorer>&AE) const;
319
320
339 virtual AnemoneRenderStatus initializeAnemone(Anemone&RenderAnemone,
341 const RefPtr<AnemoneExplorer>&AE) const = 0;
342
358 virtual bool isValidAnemone (const Anemone&RenderAnemone, const AnemoneCreationContext&ARC, const RefPtr<AnemoneExplorer>&AE) const;
359
360
364 virtual bool disabledFragment(VRenderContext&theContext, const AnemoneExplorer&theAnemoneExplorer,
367 const RefPtr<Fiber::Representation>&R) const;
368
375 virtual bool updateAnemone(Anemone&RenderAnemone, const AnemoneCreationContext&ARC, const RefPtr<AnemoneExplorer>&AE) const;
376
381 RefPtr<BoundingBall> getTouchableBoundingBall(const RefPtr<ValuePool>&VP) const override;
382
383
384static void destroyAnemone(RefPtr<Anemone>&Anemone, const AnemoneCreationContext&ARC);
385
400 virtual bool validateInput(VRequest&Context, Fiber::Info<Fiber::Grid>&,
404 string&ValidateInputInfoString) const;
405
412 virtual bool addSupplementaryData(VRequest&Context, Fiber::Info<Fiber::Grid>&,
416 string&InfoString);
417
418
422 virtual void requestSupplementaryData(VRenderContext&theContext,
423 const RefPtr<Fiber::FragmentID>&myFragmentID) const;
424
428 virtual bool isCreatingSupplementaryData(VRenderContext&theContext,
429 const RefPtr<Fiber::FragmentID>&myFragmentID) const;
430
435 bool update(VRequest&R, double precision) override;
436
437#if 0
438 struct FragmentSorter : ReferenceBase<FragmentSorter>
439 {
441
442 virtual ~FragmentSorter();
443
444 virtual double getSortCriteria(const SkeletonID&, const RefPtr<Fiber::FragmentID>&fID) const = 0;
445 };
446#endif
447
448 enum class SortMethod
449 {
450 None,
451 BackToFront,
452 FrontToBack,
453 MostVisible
454 };
455
456 SortMethod CurrentSortMethod = SortMethod::None;
457
458private:
459 bool renderSeaBed(SeaBed&SB,VRenderContext&Context) const;
460
461 std::pair<bool, bool> renderGrid(const RefPtr<Fiber::Grid>&G,
462 VRenderContext&Context,
463 const LanternFestivalParameters&LFP) const;
464
465public:
466// virtual RefPtr<FragmentSorter> getFragmentSorter(VRenderContext&Context) const;
467
468
469
470 bool environment_render(VRenderContext&Context) const override;
471
477 TouchIndex_t do_feedback_render(VRenderContext&Context, TouchIndex_t StartIndex) const;
478
483 virtual TouchIndex_t getTouchIndexFragmentIndexMultiplicator(VRenderContext&Context, const Fiber::Field&) const;
484
485}; // end GridAnemone class
486
491inline std::tuple<Anemone&, VRenderContext&> operator<<(Anemone&A, const GridAnemoneCreationContext&ACC)
492{
493 return std::tuple<Anemone&, VRenderContext&>(A, ACC.myContext);
494}
495
496} // namespace Wizt
497
498#endif // __FISH_POND_ANEMONEFISH_GridAnemone_HPP
Base class for multidimensional arrays that employ deferred storage, i.e.
Definition CreativeArrayBase.hpp:75
An iterator with an optional DataCreator, which is just a class to intercept creation of data along a...
Definition CreativeIterator.hpp:34
A Field is a collection of CreativeArrayBase reference pointers which are accessed via FragmentID obj...
Definition Field.hpp:245
Context information to select a grid from within a bundle.
Definition GridSelector.hpp:26
Identifier for Skeletons within a Grid.
Definition SkeletonID.hpp:24
Definition AnemoneCreationContext.hpp:11
Definition GridAnemoneState.hpp:46
Base class for objects that render information given on a Grid.
Definition GridAnemone.hpp:79
virtual AnemoneRenderStatus initializeAnemone(Anemone &RenderAnemone, const AnemoneCreationContext &ARC, const RefPtr< AnemoneExplorer > &AE) const =0
Handling a hierarchy of fields.
Definition RenderFields.hpp:21
Anemone_Context_t operator<<(Anemone &A, VRenderContext &VC)
note: cannot derive from FloatingSkeletonRenderer as long as independent base class TriangleRenderer ...
RenderCategory
Definition Lytica.hpp:7
Special properties that are available optionally in shader code.
Definition AnemoneCreationContext.hpp:36
Definition FloatingAnemone.hpp:57
The context of creating a RenderAnemone.
Definition AnemoneCreationContext.hpp:58
The Anemone Explorer is an object that lives throughout rendering of a set of Anemones.
Definition GridAnemone.hpp:204
An optional interface that is stored by the FloatingAnemoneExplorer on each AnemoneCreator to specify...
Definition GridAnemone.hpp:187
Definition GridAnemone.hpp:132
Internal class to collect fragments and to render them afterwards.
Definition Lanternfish.hpp:21