AGX Dynamics  2.35.0.1
RockGenerator.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_ROCKGENERATOR_H
18 #define AGXOSG_ROCKGENERATOR_H
19 
20 #include <agxOSG/export.h>
21 #include <agx/Referenced.h>
22 #include <agx/Vec3.h>
23 
24 #include <agx/PushDisableWarnings.h> // Disabling warnings. Include agx/PopDisableWarnings.h below!
25 #include <osg/Node>
26 #include <agx/PopDisableWarnings.h> // End of disabled warnings.
27 
28 namespace agxOSG {
29  class Node;
30 }
31 
32 namespace agxCollide {
33  class Space;
34 }
35 
36 namespace agx {
37  class Material;
38  class RigidBody;
39 }
40 
41 namespace agxSDK {
42  class Assembly;
43 }
44 
45 namespace agxOSG
46 {
48  {
49  public:
50  enum RockType
51  {
59  NUM_ROCK_TYPES
60  };
61 
63 
65  agxCollide::Space *space,
66  int numRocks,
67  osg::Group *visualRoot,
68  agx::Real emitterRadius,
69  agx::Real elementRadius,
70  agx::Material *rockMaterial,
71  agx::Real emitVelocityMagnitude = 0.0,
72  agx::Real elementPositionJitter = 0.5,
73  agx::Real elementRadiusJitter = 0.5,
74  agx::Real elementSpacing = 0.0 );
75 
76 
77  protected:
78  virtual ~RockGenerator();
79 
80  agx::RigidBody *generateRock(osg::Group *visualRoot, RockType type, agx::Real elementRadius, agx::Real elementPositionJitter, agx::Real elementRadiusJitter, agx::Real elementSpacing, agx::Material *rockMaterial);
81  void generateMayaRock(osg::Group *visualRoot, RockType type, agx::RigidBody *body, agx::Real elementRadius, agx::Real elementPositionJitter, agx::Material *rockMaterial);
82  void addSphereElement(agx::RigidBody *body, osg::Group *visualRoot, const agx::Vec3& localOffset, agx::Real elementRadius, agx::Real elementPositionJitter, agx::Real elementRadiusJitter, agx::Material *rockMaterial);
83 
84  private:
85  osg::ref_ptr<osg::Node> m_visualRock1;
86  osg::ref_ptr<osg::Node> m_visualRock2;
87  osg::ref_ptr<osg::Node> m_visualRock3;
88  };
89 
91 }
92 
93 #endif /* AGXOSG_ROCKGENERATOR_H */
#define AGXOSG_EXPORT
This class contains all Geometries and performs Broad Phase and Narrow Phase collision detection to c...
Definition: Space.h:82
void addSphereElement(agx::RigidBody *body, osg::Group *visualRoot, const agx::Vec3 &localOffset, agx::Real elementRadius, agx::Real elementPositionJitter, agx::Real elementRadiusJitter, agx::Material *rockMaterial)
void generateMayaRock(osg::Group *visualRoot, RockType type, agx::RigidBody *body, agx::Real elementRadius, agx::Real elementPositionJitter, agx::Material *rockMaterial)
void generateRocks(agxSDK::Assembly *root, agxCollide::Space *space, int numRocks, osg::Group *visualRoot, agx::Real emitterRadius, agx::Real elementRadius, agx::Material *rockMaterial, agx::Real emitVelocityMagnitude=0.0, agx::Real elementPositionJitter=0.5, agx::Real elementRadiusJitter=0.5, agx::Real elementSpacing=0.0)
agx::RigidBody * generateRock(osg::Group *visualRoot, RockType type, agx::Real elementRadius, agx::Real elementPositionJitter, agx::Real elementRadiusJitter, agx::Real elementSpacing, agx::Material *rockMaterial)
An assembly is a collection of basic simulation objects, such as rigid bodies, constraints,...
Definition: Assembly.h:67
Main material class which acts as a holder of a Surface Material and a Bulk material.
Definition: Material.h:388
Base class providing referencing counted objects.
Definition: Referenced.h:114
The rigid body class, combining a geometric model and a frame of reference.
Definition: RigidBody.h:55
Smart pointer for handling referenced counted objects.
Definition: ref_ptr.h:30
This namespace consists of a set of classes for handling geometric intersection tests including boole...
The agxOSG namespace provides functionality for visualizing AGX simulations with OpenSceneGraph.
agx::ref_ptr< RockGenerator > RockGeneratorRef
Definition: RockGenerator.h:90
The agxSDK namespace contain classes to bridge the collision detection system and the dynamical simul...
Definition: Constraint.h:31
The agx namespace contains the dynamics/math part of the AGX Dynamics API.
AGXCORE_EXPORT Component * root()
double Real
Definition: Real.h:42