AGXDynamics
2.35.0.3
GranularImpactsDrawable.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 AGXOSG_GRANULARIMPACTDRAWABLE_H
18
#define AGXOSG_GRANULARIMPACTDRAWABLE_H
19
20
#include <
agx/PushDisableWarnings.h
>
// Disabling warnings. Include agx/PopDisableWarnings.h below!
21
#include <osg/Drawable>
22
#include <osgViewer/Viewer>
23
#include <osg/Version>
24
#include <osgSim/ColorRange>
25
#include <osgSim/ScalarsToColors>
26
#include <
agx/PopDisableWarnings.h
>
// End of disabled warnings.
27
28
#include <
agxQt/export.h
>
29
#include <
agx/Task.h
>
30
#include <
agx/observer_ptr.h
>
31
#include <
agxSDK/Simulation.h
>
32
33
namespace
agxQt
34
{
35
AGX_DECLARE_POINTER_TYPES
(
GranularImpactsDrawable
);
36
class
AGXQT_EXPORT
GranularImpactsDrawable
:
public
osg::Drawable
37
{
38
public
:
39
GranularImpactsDrawable
(
agx::ParticleSystem
* particleSystem);
40
41
virtual
osg::Object*
cloneType
()
const
{
return
new
GranularImpactsDrawable
(m_particleSystem); }
42
virtual
osg::Object*
clone
(
const
osg::CopyOp&)
const
{
return
new
GranularImpactsDrawable
(*
this
); }
43
virtual
bool
isSameKindAs
(
const
osg::Object* obj)
const
{
return
dynamic_cast<
const
GranularImpactsDrawable
*
>
(obj) !=
nullptr
; }
44
virtual
const
char
*
libraryName
()
const
{
return
"agxOSG"
; }
45
virtual
const
char
*
className
()
const
{
return
"GranularImpactsDrawable"
; }
46
47
49
# if OSG_VERSION_GREATER_OR_EQUAL(3,4,0)
50
virtual
osg::BoundingSphere computeBound()
const
;
51
virtual
osg::BoundingBox computeBoundingBox()
const
;
52
#else
53
virtual
osg::BoundingBox computeBound()
const
;
54
#endif
55
57
virtual
void
drawImplementation(osg::RenderInfo& renderInfo)
const
;
58
59
void
setEnable(
bool
enable);
60
61
bool
getEnable()
const
;
62
63
void
updateDrawable();
64
65
bool
hasParticleSystem()
const
;
66
67
agx::Real
getRenderPointRadius()
const
;
68
69
void
setRenderPointRadius(
agx::Real
radius);
70
71
void
setRenderParticleGeometryImpacts(
bool
enable);
72
73
bool
getRenderParticleGeometryImpacts()
const
;
74
75
void
setRenderParticleParticleImpacts(
bool
enable);
76
77
bool
getRenderParticleParticleImpacts()
const
;
78
79
void
setImpactRenderingEnergyColoringRange(
const
agx::RangeReal
& range);
80
81
agx::RangeReal
getImpactRenderingEnergyColoringRange()
const
;
82
83
void
setImpactRenderingCutoffEnergy(
agx::Real
cutoffEnergy);
84
85
agx::Real
getImpactRenderingCutoffEnergy()
const
;
86
87
void
setUseParticleColorForImpactColoring(
bool
enable);
88
89
void
setImpactRenderingStartTime(
agx::Real
cutoffTime);
90
91
agx::Real
getImpactRenderingStartTime()
const
;
92
93
protected
:
94
virtual
~
GranularImpactsDrawable
();
95
96
void
initColors();
97
99
// Variables
101
protected
:
102
mutable
agxSDK::SimulationObserver
m_simulation
;
103
mutable
agx::ParticleSystemObserver
m_particleSystem
;
104
105
agx::TaskGroupRef
m_renderTask
;
106
mutable
bool
m_firstFrame
;
107
bool
m_enable
;
108
bool
m_hasGranularLicense
;
109
110
bool
m_renderParticleParticle
;
111
bool
m_renderParticleGeometry
;
112
113
bool
m_useParticleColorForImpactColoring
;
114
115
agx::Real
m_contactRadius
;
116
117
osg::ref_ptr<osgSim::ColorRange>
m_colorRange
;
118
agx::Real
m_maxEnergy
;
119
agx::Real
m_minEnergy
;
120
agx::Real
m_cutoffEnergy
;
121
agx::Real
m_renderingStartTime
;
122
123
agxData::BufferRef
m_verticesBuffer
;
124
agxData::BufferRef
m_colorBuffer
;
125
agxData::BufferRef
m_radiusBuffer
;
126
};
127
128
AGX_FORCE_INLINE
bool
GranularImpactsDrawable::getEnable
()
const
{
return
m_enable
; }
129
130
AGX_FORCE_INLINE
void
GranularImpactsDrawable::setEnable
(
bool
enable) {
m_enable
= enable; }
131
132
AGX_FORCE_INLINE
bool
agxQt::GranularImpactsDrawable::hasParticleSystem
()
const
{
return
m_particleSystem !=
nullptr
; }
133
134
AGX_FORCE_INLINE
agx::Real
agxQt::GranularImpactsDrawable::getRenderPointRadius
()
const
{
return
m_contactRadius; }
135
136
AGX_FORCE_INLINE
void
agxQt::GranularImpactsDrawable::setRenderPointRadius
(
agx::Real
radius) { m_contactRadius = radius; }
137
138
AGX_FORCE_INLINE
void
agxQt::GranularImpactsDrawable::setImpactRenderingStartTime
(
agx::Real
startTime){ m_renderingStartTime = startTime; }
139
140
AGX_FORCE_INLINE
agx::Real
agxQt::GranularImpactsDrawable::getImpactRenderingStartTime
()
const
{
return
m_renderingStartTime; }
141
}
142
143
#endif
/* AGXOSG_GRANULARIMPACTDRAWABLE_H */
agxQt::GranularImpactsDrawable::m_contactRadius
agx::Real m_contactRadius
Definition:
GranularImpactsDrawable.h:115
agxQt::GranularImpactsDrawable
Definition:
GranularImpactsDrawable.h:36
agxQt::GranularImpactsDrawable::m_colorBuffer
agxData::BufferRef m_colorBuffer
Definition:
GranularImpactsDrawable.h:124
agxQt::GranularImpactsDrawable::hasParticleSystem
bool hasParticleSystem() const
Definition:
GranularImpactsDrawable.h:132
agxQt::GranularImpactsDrawable::m_renderParticleGeometry
bool m_renderParticleGeometry
Definition:
GranularImpactsDrawable.h:111
agx::Real
double Real
Definition:
Real.h:42
AGXQT_EXPORT
#define AGXQT_EXPORT
agxQt
Contains classes/utility functions for connecting AGX to QT with OSG.
Definition:
AnalysisBoundWidget.h:33
agxQt::GranularImpactsDrawable::m_hasGranularLicense
bool m_hasGranularLicense
Definition:
GranularImpactsDrawable.h:108
Simulation.h
Task.h
agxQt::GranularImpactsDrawable::setImpactRenderingStartTime
void setImpactRenderingStartTime(agx::Real cutoffTime)
Definition:
GranularImpactsDrawable.h:138
agxQt::GranularImpactsDrawable::setEnable
void setEnable(bool enable)
Definition:
GranularImpactsDrawable.h:130
agxQt::GranularImpactsDrawable::m_cutoffEnergy
agx::Real m_cutoffEnergy
Definition:
GranularImpactsDrawable.h:120
export.h
agx::observer_ptr< Simulation >
agxQt::GranularImpactsDrawable::isSameKindAs
virtual bool isSameKindAs(const osg::Object *obj) const
Definition:
GranularImpactsDrawable.h:43
agxQt::GranularImpactsDrawable::setRenderPointRadius
void setRenderPointRadius(agx::Real radius)
Definition:
GranularImpactsDrawable.h:136
agxQt::GranularImpactsDrawable::m_maxEnergy
agx::Real m_maxEnergy
Definition:
GranularImpactsDrawable.h:118
agx::ParticleSystem
A basic particle system that contains all the storages and buffers required for basic operation and a...
Definition:
ParticleSystem.h:67
agx::ref_ptr< TaskGroup >
agxQt::GranularImpactsDrawable::m_radiusBuffer
agxData::BufferRef m_radiusBuffer
Definition:
GranularImpactsDrawable.h:125
agxQt::GranularImpactsDrawable::className
virtual const char * className() const
Definition:
GranularImpactsDrawable.h:45
PushDisableWarnings.h
agxQt::GranularImpactsDrawable::getEnable
bool getEnable() const
Definition:
GranularImpactsDrawable.h:128
agxQt::GranularImpactsDrawable::clone
virtual osg::Object * clone(const osg::CopyOp &) const
Definition:
GranularImpactsDrawable.h:42
agxQt::GranularImpactsDrawable::m_useParticleColorForImpactColoring
bool m_useParticleColorForImpactColoring
Definition:
GranularImpactsDrawable.h:113
agxQt::GranularImpactsDrawable::m_minEnergy
agx::Real m_minEnergy
Definition:
GranularImpactsDrawable.h:119
agxQt::GranularImpactsDrawable::m_verticesBuffer
agxData::BufferRef m_verticesBuffer
Definition:
GranularImpactsDrawable.h:123
observer_ptr.h
agxQt::GranularImpactsDrawable::m_renderParticleParticle
bool m_renderParticleParticle
Definition:
GranularImpactsDrawable.h:110
agxQt::GranularImpactsDrawable::m_simulation
agxSDK::SimulationObserver m_simulation
Definition:
GranularImpactsDrawable.h:102
agxQt::GranularImpactsDrawable::m_colorRange
osg::ref_ptr< osgSim::ColorRange > m_colorRange
Definition:
GranularImpactsDrawable.h:117
agxQt::GranularImpactsDrawable::m_renderTask
agx::TaskGroupRef m_renderTask
Definition:
GranularImpactsDrawable.h:105
AGX_DECLARE_POINTER_TYPES
#define AGX_DECLARE_POINTER_TYPES(type)
Definition:
Referenced.h:248
agxQt::GranularImpactsDrawable::m_renderingStartTime
agx::Real m_renderingStartTime
Definition:
GranularImpactsDrawable.h:121
agxQt::GranularImpactsDrawable::cloneType
virtual osg::Object * cloneType() const
Definition:
GranularImpactsDrawable.h:41
agx::Range< Real >
agxQt::GranularImpactsDrawable::libraryName
virtual const char * libraryName() const
Definition:
GranularImpactsDrawable.h:44
agxQt::GranularImpactsDrawable::m_firstFrame
bool m_firstFrame
Definition:
GranularImpactsDrawable.h:106
agxQt::GranularImpactsDrawable::getImpactRenderingStartTime
agx::Real getImpactRenderingStartTime() const
Definition:
GranularImpactsDrawable.h:140
agxQt::GranularImpactsDrawable::getRenderPointRadius
agx::Real getRenderPointRadius() const
Definition:
GranularImpactsDrawable.h:134
agxQt::GranularImpactsDrawable::m_enable
bool m_enable
Definition:
GranularImpactsDrawable.h:107
agxQt::GranularImpactsDrawable::m_particleSystem
agx::ParticleSystemObserver m_particleSystem
Definition:
GranularImpactsDrawable.h:103
AGX_FORCE_INLINE
#define AGX_FORCE_INLINE
Definition:
macros.h:58
PopDisableWarnings.h
include
agxQt
GranularImpactsDrawable.h
Generated on Fri Feb 10 2023 14:06:10 for AGXDynamics by
1.8.17