AGX Dynamics  2.35.0.1
ParticleFilters.h
Go to the documentation of this file.
1 /*
2 Copyright 2007-2022. Algoryx Simulation AB.
3 
4 All AGX source code, intellectual property, documentation, sample code,
5 tutorials, scene files and technical white papers, are copyrighted, proprietary
6 and confidential material of Algoryx Simulation AB. You may not download, read,
7 store, distribute, publish, copy or otherwise disseminate, use or expose this
8 material unless having a written signed agreement with Algoryx Simulation AB, or having been
9 advised so by Algoryx Simulation AB for a time limited evaluation, or having purchased a
10 valid commercial license from Algoryx Simulation AB.
11 
12 Algoryx Simulation AB disclaims all responsibilities for loss or damage caused
13 from using this software, unless otherwise stated in written agreements with
14 Algoryx Simulation AB.
15 */
16 
17 #ifndef AGXQT_FILTER_H
18 #define AGXQT_FILTER_H
19 
20 #include <agx/config/AGX_USE_KEYSHOT.h>
21 #include <agxQt/export.h>
22 #include <agx/Referenced.h>
24 #include <agx/PushDisableWarnings.h> // Disabling warnings. Include agx/PopDisableWarnings.h below!
25 #include <agx/PopDisableWarnings.h> // End of disabled warnings.
26 
27 namespace agxQt
28 {
29 
30  // Forward declaration
31  class ParticleRenderFilter;
32 
39  {
43 
44  bool operator==(const ParticleFilterMode& rhs) { return m_id == rhs.m_id; }
45  };
47 
54  {
55  public:
57 
58  public:
60 
63 
66 
73 
80 
86 
92 
99 
107 
115 
120 
121  protected:
123 
125 
127  // Variables
129  protected:
133  };
134 
142  {
143  public:
144  static const char * const PARTICLEFILTER_NONE_NAME;
145 
146  public:
148  virtual void preRender(agx::ParticleSystem * system) = 0;
149 
151  virtual void postRender(agx::ParticleSystem * system) = 0;
152 
159  void setScalarRenderThreshold(agx::Real scalarThreshold);
160 
166  agx::Name getName() const;
167 
168  protected:
170 
171  void filterParticle(agx::Physics::ParticlePtr ptr, bool shouldFilter);
172 
174 
176  // Variables
178  protected:
181  };
182 
184 
189  {
190  public:
192 
193  virtual void preRender(agx::ParticleSystem * system) override;
194 
195  virtual void postRender(agx::ParticleSystem * system) override;
196 
197  protected:
199  };
200 
205  {
206  public:
208 
209  virtual void preRender(agx::ParticleSystem * system) override;
210 
211  virtual void postRender(agx::ParticleSystem * system) override;
212 
213  protected:
215 
217  // Variables
219  protected:
220  };
221 
226  {
227  public:
229 
230  public:
232 
233  virtual void preRender(agx::ParticleSystem * system) override;
234 
235  virtual void postRender(agx::ParticleSystem * system) override;
236 
237  protected:
239 
241  // Variables
243  protected:
245  };
246 
248  {
249  return ParticleFilterMode{ ParticleRenderFilter::PARTICLEFILTER_NONE_NAME, []{ return nullptr; }, "" };
250  }
251 }
252 
253 #endif /*AGXQT_QTOSGUTILS_H*/
#define AGX_DECLARE_POINTER_TYPES(type)
Definition: Referenced.h:248
#define AGXQT_EXPORT
This is a class that filters particles from contact energy.
virtual void preRender(agx::ParticleSystem *system) override
Execute on particles before rendering.
virtual void postRender(agx::ParticleSystem *system) override
Execute after render state.
This is a class that filters particles from certain criteria.
LambdaParticleRenderFilter(const agx::Name &name, const ParticleFilterFunction &function)
ParticleFilterFunction m_filterFunction
std::function< bool(agx::ParticleSystem *, agx::Physics::ParticlePtr)> ParticleFilterFunction
virtual void postRender(agx::ParticleSystem *system) override
Execute after render state.
virtual void preRender(agx::ParticleSystem *system) override
Execute on particles before rendering.
ParticleFilterMode getActiveParticleRenderFilterMode() const
Returns the ParticleFilterMode struct for the active filter in the manager.
void postRender(agx::ParticleSystem *system)
Execute after render state.
void resetParticleFilterState(agx::ParticleSystem *system) const
Resets the filtered state in the particle system.
agx::Real getFilterThresholdScalar() const
Returns the filter threshold of the ParticleRenderFilter.
ParticleRenderFilterModeVector getAvailableParticleRenderModes() const
Returns the ParticleFilterMode structs added to the manager.
void setActiveParticleRenderFilter(ParticleFilterMode mode)
Switches active particle render filter based on a ParticleFilter mode.
void setFilterThresholdScalar(agx::Real threshold)
Sets the filter threshold of the ParticleRenderFilter.
ParticleRenderFilter * m_activeParticleFilter
agx::HashTable< agx::Name, ParticleFilterMode > ParticleColorModeTable
ParticleColorModeTable m_availableParticleFilters
void preRender(agx::ParticleSystem *system)
Execute on particles before rendering.
void setActiveParticleRenderFilterFromString(const agx::String &name)
Switches active particle render filter based on name identifier.
bool particleRenderFilterExists(const agx::String &name)
Returns true/false if an ParticleRenderFilter with given name identifier exists in the manager.
This is a base abstract class for filtering particles.
agx::Name getName() const
Returns the name type identifier for the ParticleFilter.
virtual void postRender(agx::ParticleSystem *system)=0
Execute after render state.
void setScalarRenderThreshold(agx::Real scalarThreshold)
Sets the filter threshold of the ParticleRenderFilter.
void filterParticle(agx::Physics::ParticlePtr ptr, bool shouldFilter)
virtual void preRender(agx::ParticleSystem *system)=0
Execute on particles before rendering.
ParticleRenderFilter(const agx::Name &name)
static const char *const PARTICLEFILTER_NONE_NAME
This is a class that filters particles from certain criteria.
virtual void postRender(agx::ParticleSystem *system) override
Execute after render state.
virtual void preRender(agx::ParticleSystem *system) override
Execute on particles before rendering.
Inheritance with partial specialization due to bug with ref_ptr containers.
Representation of a name string.
Definition: Name.h:33
A basic particle system that contains all the storages and buffers required for basic operation and a...
Pointer to a entity instance of type Physics.Particle.
Base class providing referencing counted objects.
Definition: Referenced.h:114
#define AGX_FORCE_INLINE
Definition: macros.h:58
Contains classes/utility functions for connecting AGX to QT with OSG.
ParticleFilterMode AGXQT_EXPORT createNoneParticleFilterMode()
std::function< ParticleRenderFilter *()> ParticleFilterConstructor
Struct containing information and constructors for a specific particle filter, that removes rendering...
agx::Vector< ParticleFilterMode > ParticleRenderFilterModeVector
double Real
Definition: Real.h:42
ParticleFilterConstructor m_constructor
bool operator==(const ParticleFilterMode &rhs)