AGX Dynamics
2.42.1.1
Loading...
Searching...
No Matches
ParticleContactGraphDrawable.h
Go to the documentation of this file.
1
/*
2
Copyright 2007-2025. 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 AGXOSG_PARTICLE_CONTACTGRAPH_DRAWABLE_H
18
#define AGXOSG_PARTICLE_CONTACTGRAPH_DRAWABLE_H
19
20
#include <
agx/PushDisableWarnings.h
>
// Disabling warnings. Include agx/PopDisableWarnings.h below!
21
#include <osg/Drawable>
22
#include <osgViewer/Viewer>
23
#include <osgSim/ColorRange>
24
#include <osgSim/ScalarsToColors>
25
#include <osg/Version>
26
#include <
agx/PopDisableWarnings.h
>
// End of disabled warnings.
27
28
#include <
agxOSG/export.h
>
29
#include <
agx/Task.h
>
30
#include <
agx/observer_ptr.h
>
31
#include <
agx/ParticleSystem.h
>
32
33
namespace
agxOSG
34
{
35
class
AGXOSG_EXPORT
ParticleContactGraphDrawable
:
public
osg::Drawable
36
{
37
38
public
:
39
ParticleContactGraphDrawable
(
agx::ParticleSystem
*particleSystem);
40
// ParticleSystemDrawable( const ParticleSystemDrawable&c, const osg::CopyOp& copyOp );
41
42
virtual
osg::Object*
cloneType
()
const
{
return
new
ParticleContactGraphDrawable
(m_particleSystem.get()); }
43
virtual
osg::Object*
clone
(
const
osg::CopyOp&)
const
{
return
new
ParticleContactGraphDrawable
(*
this
); }
44
virtual
bool
isSameKindAs
(
const
osg::Object* obj)
const
{
return
dynamic_cast<
const
ParticleContactGraphDrawable
*
>
(obj) !=
nullptr
; }
45
virtual
const
char
*
libraryName
()
const
{
return
"agxOSG"
; }
46
virtual
const
char
*
className
()
const
{
return
"ParticleContactGraphDrawable"
; }
47
48
50
# if OSG_VERSION_GREATER_OR_EQUAL(3,4,0)
51
virtual
osg::BoundingSphere computeBound()
const
;
52
virtual
osg::BoundingBox computeBoundingBox()
const
;
53
#else
54
virtual
osg::BoundingBox
computeBound
()
const
;
55
#endif
56
58
virtual
void
drawImplementation
(osg::RenderInfo& renderInfo)
const
;
59
60
void
setEnable(
bool
enable);
61
62
bool
getEnable()
const
;
63
64
void
updateKernelBuffers
();
65
66
void
setMinForce(
agx::Real
minForce);
67
68
void
setMaxForce(
agx::Real
maxForce);
69
70
agx::Real
getMinForce()
const
;
71
72
agx::Real
getMaxForce()
const
;
73
74
agx::ParticleSystem
* getParticleSystem();
75
76
void
resample
();
77
78
protected
:
79
virtual
~ParticleContactGraphDrawable
();
80
81
void
initColors
();
82
84
// Variables
86
protected
:
87
mutable
agx::ParticleSystemObserver
m_particleSystem
;
88
agx::TaskGroupRef
m_renderTask
;
89
90
agxData::BufferRef
m_verticesBuffer
;
91
agxData::BufferRef
m_colorBuffer
;
92
agxData::BufferRef
m_countBuffer
;
93
agxData::BufferRef
m_firstsBuffer
;
94
int
m_maxPosCounts
;
95
96
osg::ref_ptr<osgSim::ColorRange>
m_colorRange
;
97
agx::Real
m_minForce
;
98
agx::Real
m_maxForce
;
99
bool
m_enable
;
100
agx::Real
m_sampling
;
101
};
102
103
AGX_FORCE_INLINE
agx::ParticleSystem
*
ParticleContactGraphDrawable::getParticleSystem
() {
return
m_particleSystem
; }
104
105
AGX_FORCE_INLINE
bool
ParticleContactGraphDrawable::getEnable
()
const
{
return
m_enable
; }
106
107
AGX_FORCE_INLINE
void
ParticleContactGraphDrawable::setEnable
(
bool
enable) {
m_enable
= enable; }
108
109
AGX_FORCE_INLINE
void
ParticleContactGraphDrawable::setMinForce
(
agx::Real
minForce) {
m_minForce
= minForce;
initColors
(); }
110
111
AGX_FORCE_INLINE
void
ParticleContactGraphDrawable::setMaxForce
(
agx::Real
maxForce) {
m_maxForce
= maxForce;
initColors
(); }
112
113
AGX_FORCE_INLINE
agx::Real
ParticleContactGraphDrawable::getMinForce
()
const
{
return
m_minForce
; }
114
115
AGX_FORCE_INLINE
agx::Real
ParticleContactGraphDrawable::getMaxForce
()
const
{
return
m_maxForce
; }
116
}
117
118
119
#endif
/* AGXOSG_PARTICLE_SYSTEMDRAWABLE_H */
ParticleSystem.h
PopDisableWarnings.h
PushDisableWarnings.h
Task.h
export.h
AGXOSG_EXPORT
#define AGXOSG_EXPORT
agxOSG::ParticleContactGraphDrawable
Definition:
ParticleContactGraphDrawable.h:36
agxOSG::ParticleContactGraphDrawable::className
virtual const char * className() const
Definition:
ParticleContactGraphDrawable.h:46
agxOSG::ParticleContactGraphDrawable::m_verticesBuffer
agxData::BufferRef m_verticesBuffer
Definition:
ParticleContactGraphDrawable.h:90
agxOSG::ParticleContactGraphDrawable::libraryName
virtual const char * libraryName() const
Definition:
ParticleContactGraphDrawable.h:45
agxOSG::ParticleContactGraphDrawable::getMaxForce
agx::Real getMaxForce() const
Definition:
ParticleContactGraphDrawable.h:115
agxOSG::ParticleContactGraphDrawable::m_enable
bool m_enable
Definition:
ParticleContactGraphDrawable.h:99
agxOSG::ParticleContactGraphDrawable::m_sampling
agx::Real m_sampling
Definition:
ParticleContactGraphDrawable.h:100
agxOSG::ParticleContactGraphDrawable::computeBound
virtual osg::BoundingBox computeBound() const
Compute the bounding box around Drawables's geometry.
agxOSG::ParticleContactGraphDrawable::initColors
void initColors()
agxOSG::ParticleContactGraphDrawable::setMaxForce
void setMaxForce(agx::Real maxForce)
Definition:
ParticleContactGraphDrawable.h:111
agxOSG::ParticleContactGraphDrawable::m_renderTask
agx::TaskGroupRef m_renderTask
Definition:
ParticleContactGraphDrawable.h:88
agxOSG::ParticleContactGraphDrawable::setMinForce
void setMinForce(agx::Real minForce)
Definition:
ParticleContactGraphDrawable.h:109
agxOSG::ParticleContactGraphDrawable::isSameKindAs
virtual bool isSameKindAs(const osg::Object *obj) const
Definition:
ParticleContactGraphDrawable.h:44
agxOSG::ParticleContactGraphDrawable::updateKernelBuffers
void updateKernelBuffers()
agxOSG::ParticleContactGraphDrawable::m_minForce
agx::Real m_minForce
Definition:
ParticleContactGraphDrawable.h:97
agxOSG::ParticleContactGraphDrawable::drawImplementation
virtual void drawImplementation(osg::RenderInfo &renderInfo) const
The actual draw method for the particle system.
agxOSG::ParticleContactGraphDrawable::getMinForce
agx::Real getMinForce() const
Definition:
ParticleContactGraphDrawable.h:113
agxOSG::ParticleContactGraphDrawable::m_colorBuffer
agxData::BufferRef m_colorBuffer
Definition:
ParticleContactGraphDrawable.h:91
agxOSG::ParticleContactGraphDrawable::setEnable
void setEnable(bool enable)
Definition:
ParticleContactGraphDrawable.h:107
agxOSG::ParticleContactGraphDrawable::clone
virtual osg::Object * clone(const osg::CopyOp &) const
Definition:
ParticleContactGraphDrawable.h:43
agxOSG::ParticleContactGraphDrawable::resample
void resample()
agxOSG::ParticleContactGraphDrawable::cloneType
virtual osg::Object * cloneType() const
Definition:
ParticleContactGraphDrawable.h:42
agxOSG::ParticleContactGraphDrawable::getEnable
bool getEnable() const
Definition:
ParticleContactGraphDrawable.h:105
agxOSG::ParticleContactGraphDrawable::~ParticleContactGraphDrawable
virtual ~ParticleContactGraphDrawable()
agxOSG::ParticleContactGraphDrawable::m_maxForce
agx::Real m_maxForce
Definition:
ParticleContactGraphDrawable.h:98
agxOSG::ParticleContactGraphDrawable::ParticleContactGraphDrawable
ParticleContactGraphDrawable(agx::ParticleSystem *particleSystem)
agxOSG::ParticleContactGraphDrawable::m_particleSystem
agx::ParticleSystemObserver m_particleSystem
Definition:
ParticleContactGraphDrawable.h:87
agxOSG::ParticleContactGraphDrawable::m_firstsBuffer
agxData::BufferRef m_firstsBuffer
Definition:
ParticleContactGraphDrawable.h:93
agxOSG::ParticleContactGraphDrawable::getParticleSystem
agx::ParticleSystem * getParticleSystem()
Definition:
ParticleContactGraphDrawable.h:103
agxOSG::ParticleContactGraphDrawable::m_colorRange
osg::ref_ptr< osgSim::ColorRange > m_colorRange
Definition:
ParticleContactGraphDrawable.h:96
agxOSG::ParticleContactGraphDrawable::m_maxPosCounts
int m_maxPosCounts
Definition:
ParticleContactGraphDrawable.h:94
agxOSG::ParticleContactGraphDrawable::m_countBuffer
agxData::BufferRef m_countBuffer
Definition:
ParticleContactGraphDrawable.h:92
agx::ParticleSystem
A basic particle system that contains all the storages and buffers required for basic operation and a...
Definition:
ParticleSystem.h:68
agx::observer_ptr< ParticleSystem >
agx::ref_ptr< TaskGroup >
AGX_FORCE_INLINE
#define AGX_FORCE_INLINE
Definition:
macros.h:58
agxOSG
The agxOSG namespace provides functionality for visualizing AGX simulations with OpenSceneGraph.
agx::Real
double Real
Definition:
Real.h:41
observer_ptr.h
include
agxOSG
ParticleContactGraphDrawable.h
Generated by
1.9.6