AGX Dynamics  2.37.2.0
RockGenerator.h
Go to the documentation of this file.
1 /*
2 Copyright 2007-2024. 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 
62  RockGenerator();
63 
64  void generateRocks( agxSDK::Assembly *root,
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 namespace consists of a set of classes for handling geometric intersection tests including boole...
Base class providing referencing counted objects.
Definition: Referenced.h:119
This class contains all Geometries and performs Broad Phase and Narrow Phase collision detection to c...
Definition: Space.h:81
The agx namespace contains the dynamics/math part of the AGX Dynamics API.
The agxOSG namespace provides functionality for visualizing AGX simulations with OpenSceneGraph.
Smart pointer for handling referenced counted objects.
Definition: ref_ptr.h:29
The rigid body class, combining a geometric model and a frame of reference.
Definition: RigidBody.h:54
Main material class which acts as a holder of a Surface Material and a Bulk material.
Definition: Material.h:375
agx::ref_ptr< RockGenerator > RockGeneratorRef
Definition: RockGenerator.h:90
double Real
Definition: Real.h:42
AGXCORE_EXPORT Component * root()
The agxSDK namespace contain classes to bridge the collision detection system and the dynamical simul...
Definition: Constraint.h:30
An assembly is a collection of basic simulation objects, such as rigid bodies, constraints, geometries.
Definition: Assembly.h:66