AGX Dynamics 2.42.1.1
Loading...
Searching...
No Matches
utils.h
Go to the documentation of this file.
1/*
2Copyright 2007-2025. Algoryx Simulation AB.
3
4All AGX source code, intellectual property, documentation, sample code,
5tutorials, scene files and technical white papers, are copyrighted, proprietary
6and confidential material of Algoryx Simulation AB. You may not download, read,
7store, distribute, publish, copy or otherwise disseminate, use or expose this
8material unless having a written signed agreement with Algoryx Simulation AB, or having been
9advised so by Algoryx Simulation AB for a time limited evaluation, or having purchased a
10valid commercial license from Algoryx Simulation AB.
11
12Algoryx Simulation AB disclaims all responsibilities for loss or damage caused
13from using this software, unless otherwise stated in written agreements with
14Algoryx Simulation AB.
15*/
16
17#pragma once
18
19#include <agxOSG/export.h>
20#include <agx/Vec4.h>
21
22#include <agxUtil/agxUtil.h>
23#include <agxUtil/Statistic.h>
24#include <agxOSG/Node.h>
30
32
33#include <agxRender/Color.h>
34
35
36#include <agx/PushDisableWarnings.h> // Disabling warnings. Include agx/PopDisableWarnings.h below!
37#include <osg/observer_ptr>
38#include <osgGA/NodeTrackerManipulator>
39
40#include <agx/PopDisableWarnings.h> // End of disabled warnings.
41
43
44
45namespace agx
46{
47 class RigidBody;
48 class ParticleSystem;
49
50 class RigidBodyEmitter;
51}
52
53namespace agxSDK
54{
55 class Simulation;
56}
57
58namespace agxCollide
59{
60 class Geometry;
61}
62
63namespace agxUtil
64{
65 class ExponentialMovingAverageStatistic;
66}
67
68namespace agxModel
69{
70 class FractureGenerator;
71 class DeformableObject;
72}
73
75
76
77namespace osg {
78 class Geometry;
79 class Node;
80 class Texture2D;
81}
82
83namespace osgSim
84{
85 class ColorRange;
86}
87
88namespace osgText
89{
90 class Text;
91}
93
94namespace agxOSG
95{
96 class GeometryNode;
97 class FrameTrajectoryDrawable;
98 class TerrainVoxelRenderer;
99
101 {
110 };
111
116 AGXOSG_EXPORT GeometryNode* findGeometryNode( const agxCollide::Geometry* geometry, osg::Group* rootNode );
117
123
139 AGXOSG_EXPORT bool setCubeMapTexture(osg::Node *node, const std::string& imagePath, const std::string& imageType = ".dds");
140
146 AGXOSG_EXPORT void setEnvMapReflectionCoefficient(osg::Node* node, float coeff);
147
159 AGXOSG_EXPORT bool setTexture(const agxCollide::Geometry* geometry, osg::Group* rootNode, const std::string& imagePath, bool repeat = false, TextureMode mode = DIFFUSE_TEXTURE);
160
173 const agx::RigidBody* rigidBody, osg::Group* rootNode, const std::string& imagePath,
174 bool repeat = false, TextureMode mode = DIFFUSE_TEXTURE);
175
187 osg::Node* node, const std::string& imagePath, bool repeat = false, TextureMode mode = DIFFUSE_TEXTURE,
188 float scaleU = 1.0f, float scaleV = 1.0f);
189
191 osg::Node* node, const agxCollide::TextureDataRef data, bool repeat = false, TextureMode mode = DIFFUSE_TEXTURE,
192 float scaleU = 1.0f, float scaleV = 1.0f);
193
194
199 AGXOSG_EXPORT osg::Texture2D* createTexture(const std::string& filename);
200
201
202 AGXOSG_EXPORT osg::Texture2D* createTexture(const agxCollide::TextureDataRef data, bool linear);
203
215 osg::Node *node, osg::Texture2D *texture, bool repeat = false, TextureMode mode = DIFFUSE_TEXTURE,
216 float scaleU = 1.0f, float scaleV = 1.0f);
217
228 AGXOSG_EXPORT bool setTexture(osg::Node *node, agxOSG::Texture2D *texture, bool repeat = false, TextureMode mode = DIFFUSE_TEXTURE, float scaleU = 1.0f, float scaleV = 1.0f);
229
230
241 AGXOSG_EXPORT bool setTexture(agxOSG::GeometryNode *node, agxOSG::Texture2D *texture, bool repeat = false, TextureMode mode = DIFFUSE_TEXTURE, float scaleU = 1.0f, float scaleV = 1.0f);
242
243 template <typename T>
244 void setUniform( osg::Node *node, const std::string& name, T value)
245 {
246 if ( node == nullptr )
247 return;
248
249 node->getOrCreateStateSet()->addUniform( new osg::Uniform(name.c_str(), value));
250 }
251
279 osg::Group* root,
280 const std::string& text,
281 const agx::Vec3& relPosition = agx::Vec3(0, 0, 0),
282 const agx::Vec4f& color = agxRender::Color::Yellow(),
283 agx::Real size = 0.2,
284 int alignment = 6);
285
299 AGXOSG_EXPORT osg::Geode* createCubeLines( const agx::Vec3& position,
300 const agx::Vec3& boxHalfVec3,
302 const agx::Real lineWidth = 2.0f );
303
312 AGXOSG_EXPORT osg::Geode* createText(const std::string& text,
313 const agx::Vec3& relPosition = agx::Vec3(0,0,0),
314 const agx::Vec4f& color = agxRender::Color::Yellow(),
315 agx::Real size = 0.2);
316
317
326 AGXOSG_EXPORT bool removeText(const agxCollide::Geometry* geometry, osg::Group * root, size_t index = 0);
327
336 AGXOSG_EXPORT osgText::Text* findText( const agxCollide::Geometry* geometry, osg::Group* root, size_t index = 0 );
337
352 AGXOSG_EXPORT osg::Geometry* createGrid(
353 unsigned int resU,
354 unsigned int resV,
355 const osg::Vec3& origin,
356 const osg::Vec3& endPointX,
357 const osg::Vec3& endPointY,
358 bool wireFrameMode = false);
359
374 unsigned int resU,
375 unsigned int resV,
376 const agx::Vec3& origin,
377 const agx::Vec3& endPointX,
378 const agx::Vec3& endPointY,
379 osg::Group* root);
380
381
401 unsigned int resU,
402 unsigned int resV,
403 unsigned int resW,
404 const osg::Vec3& origin,
405 const osg::Vec3& endPointX,
406 const osg::Vec3& endPointY,
407 const osg::Vec3& endPointZ,
408 float width
409 );
410
428 unsigned int resU,
429 unsigned int resV,
430 unsigned int resW,
431 const agx::Vec3& origin,
432 const agx::Vec3& endPointX,
433 const agx::Vec3& endPointY,
434 const agx::Vec3& endPointZ,
435 float width);
436
437
446 AGXOSG_EXPORT osg::Geode* createSphere(const agx::Vec3& center, const agx::Vec4& color, float radius);
447
457 AGXOSG_EXPORT osg::MatrixTransform* createCylinder( const agx::AffineMatrix4x4& transform, const agx::Vec4& color, float radius, float height );
458
467 AGXOSG_EXPORT osg::Geode* createLine(const agx::Vec3& p1, const agx::Vec3& p2, const agx::Vec4& color, float width);
468
477 AGXOSG_EXPORT osg::Geode* createPolyline(const agx::Vec3Vector& points, const agx::Vec4& color, float width);
478
486 AGXOSG_EXPORT osg::MatrixTransform* createAxes(float scale=1, float width=3);
487
495 AGXOSG_EXPORT osg::MatrixTransform* createAxes(agxCollide::Geometry* geometry, agx::Frame* relativeTransform, osg::Group* root, float scale = 1, float width=3);
496
504 AGXOSG_EXPORT osg::MatrixTransform* createAxes(agxCollide::Geometry* geometry, agx::AffineMatrix4x4 relativeTransform, osg::Group* root, float scale = 1, float width = 3);
505
519 AGXOSG_EXPORT osg::MatrixTransform* createAxes(agx::RigidBody* rb, agx::Frame* relativeTransform, osg::Group* root, float scale = 1, float width = 3);
520
529 AGXOSG_EXPORT osg::MatrixTransform* createAxes(agx::RigidBody* rb, agx::AffineMatrix4x4 relativeTransform, osg::Group* root, float scale = 1, float width = 3);
530
531
539 AGXOSG_EXPORT osg::MatrixTransform* createAxes(agx::AffineMatrix4x4 absoluteTransform, osg::Group* root, float scale = 1, float width = 3);
540
548 AGXOSG_EXPORT bool createAxes( agx::Constraint* constraint, osg::Group* root, float scale = 1, float width = 3);
549
557 AGXOSG_EXPORT void setSpecularColor( osg::Node * node, const agx::Vec4f& color, bool override = false);
558
565 AGXOSG_EXPORT void setShininess( osg::Node *node, float shininess, bool override = false);
566
575 AGXOSG_EXPORT void setGamma(osg::Node* node, float gamma, bool override = false);
576
583 AGXOSG_EXPORT void setRoughness(osg::Node* node, float roughness, bool override = false);
584
592 AGXOSG_EXPORT void setMetallic(osg::Node* node, float metallic, bool override = false);
593
601 AGXOSG_EXPORT void setAmbientColor( osg::Node * node, const agx::Vec4f& color, bool override = false);
602
610 AGXOSG_EXPORT void setAlpha( osg::Node * node, float alpha, bool override = false);
611
619 AGXOSG_EXPORT void setDiffuseColor( osg::Node* node, const agx::Vec4f& color, bool override = false );
620
621
626 AGXOSG_EXPORT void setDiffuseColor( agx::RigidBody* rb, const agx::Vec4f& color, osg::Group* root );
627
632 AGXOSG_EXPORT void setDiffuseColor( agxCollide::Geometry* geometry, const agx::Vec4f& color, osg::Group* root );
633
642 AGXOSG_EXPORT agxOSG::GeometryNode *createVisual( const agxCollide::Geometry* geometry, osg::Group* root, float detailRatio = 1.0f, bool createAxes = false, bool evenIfSensor=true );
643
648
650
652
653 AGXOSG_EXPORT osg::Group *createVisual( agx::RigidBodyEmitter* emitter, osg::Group* root);
654
655 AGXOSG_EXPORT osg::Group *createVisual(agx::Emitter* emitter, osg::Group* root);
656
657#if AGX_USE_AGXTERRAIN()
658
673#endif
674
678 AGXOSG_EXPORT osg::MatrixTransform *createVisual(agx::ObserverFrame *frame, osg::Group* root, float scale = 1);
679
680
684 AGXOSG_EXPORT osg::Geode *createParticleContactGraph(agx::ParticleSystem* particleSystem, osg::Group* root, agx::Real minForce, agx::Real maxForce);
685
691 AGXOSG_EXPORT osg::Geode *createParticleTrajectoriesVisual(agx::ParticleSystem* particleSystem, osg::Group* root, agx::Real sampling, agx::UInt numPositions);
692
698 AGXOSG_EXPORT osg::Geode *createRigidBodyTrajectoriesVisual(agxSDK::Simulation * simulation, osg::Group* root, agx::Real sampling, agx::UInt numPositions, ScalarColorMap* scalarColorMap = nullptr );
699
700 AGXOSG_EXPORT osg::Geode *createFrameTrajectoryDrawable(agxSDK::Simulation * simulation, osg::Group* root, agx::UInt numPositions, const agx::Vec4f& defaultColor = agx::Vec4f(0.5, 0.5, 0.5, 1.0));
701
703
707 AGXOSG_EXPORT osg::Group *createVisual( agx::RigidBody* rb, osg::Group* root, float detailRatio = 1.0f, bool createAxes = false );
708
714 AGXOSG_EXPORT std::tuple<osg::Group*, std::vector<size_t>> createVisualWithGeometryConnection(agx::RigidBody* rb, osg::Group* root, float detailRatio = 1.0f, bool createAxes = false);
715
719 AGXOSG_EXPORT osg::Group *createVisual( agxSDK::Assembly *parent, osg::Group* root, float detailRatio = 1.0f, bool createAxes = false );
720
724 AGXOSG_EXPORT osg::Group* createVisualTemplateCaching( agxSDK::Assembly* parent, osg::Group* root, agxOSG::RigidBodyRenderCache* cache = nullptr, float detailRatio = 1.0f, bool createAxes = false );
725
733
737 AGXOSG_EXPORT osg::Group *createVisual(agxSDK::Simulation *simulation, osg::Group* root, float detailRatio = 1.0f, bool createAxes = false);
738
739 AGXOSG_EXPORT bool setEnableOutline(osg::Node *node, bool enabled, const agxRender::Color& color=agxRender::Color(1,1,0,1), float width = 2.0);
740 AGXOSG_EXPORT bool getEnableOutline(osg::Node *node);
741
749 AGXOSG_EXPORT size_t smoothNormals( osg::Node* node, float creaseAngle = 1.48353f);
750
751 AGXOSG_EXPORT void setEnableLight( bool enable, int lightNum, osg::Node* node );
752
762 AGXOSG_EXPORT void getNearFarPoints(const osg::Camera* camera, float x, float y, agx::Vec3& near, agx::Vec3& far);
763
773
774 AGXOSG_EXPORT bool setEnableWireFrameMode(osg::Node* node, bool flag);
775
776 AGXOSG_EXPORT bool forceWireFrameModeOn( osg::Node* node );
777
778 AGXOSG_EXPORT bool toggleWireFrameMode(osg::Node* node);
779
780 AGXOSG_EXPORT bool setOrbitCamera(osgViewer::Viewer* viewer,
781 osg::Group* node,
782 const agx::Vec3& eye,
783 const agx::Vec3& center,
784 const agx::Vec3& up,
785 int trackerMode=osgGA::NodeTrackerManipulator::NODE_CENTER);
786
787
788
792 AGXOSG_EXPORT bool loadCubeMapImages(const std::string& imagename, const std::string& filetype, agx::Vector<osg::ref_ptr<osg::Image> >& images);
793
797 AGXOSG_EXPORT osg::TextureCubeMap * createTextureCubeMap(agx::Vector<osg::ref_ptr<osg::Image> >& images);
798 AGXOSG_EXPORT osg::TextureCubeMap * createTextureCubeMap(const std::string& imagename, const std::string& filetype);
799
804
810
816
831 osg::Group* root,
833 bool colorSurfaceStress = false,
834 const agxRender::Color& maxStressColor = agxRender::Color::Red(),
835 agx::Real maxStressLimit = 6.0E4 );
836
844 osg::Group* root );
845}
#define DEFAULT_PARTICLE_RENDERING_MODE
#define AGXOSG_EXPORT
The geometry representation used by the collision detection engine.
Definition: Geometry.h:92
This class contains all Geometries and performs Broad Phase and Narrow Phase collision detection to c...
Definition: Space.h:86
Triangle mesh for geometric intersection tests.
Definition: Trimesh.h:40
Deformable object containing a tetrahedron mesh and a set of algorithms.
Renders the surface mesh of a deformable object.
A node that can be associated with a collision geometry so that the transformation of this node is up...
Definition: GeometryNode.h:42
RigidBodyRenderCache is used to cache generated visuals and lookup mappings of RigidBodies cloned fro...
Class that represents a linear scalar color map that converts a scalar interval to a specified color ...
Rendering class for the agxTerrain::Terrain.
Utility color class with "common colors".
Definition: Color.h:48
static agxRender::Color Red()
Definition: Color.h:217
static agxRender::Color BlueViolet()
Definition: Color.h:307
static agxRender::Color Yellow()
Definition: Color.h:257
static agxRender::Color DarkOliveGreen()
Definition: Color.h:286
An assembly is a collection of basic simulation objects, such as rigid bodies, constraints,...
Definition: Assembly.h:70
An EventListener can be associated to a Simulation and triggered upon various events.
Definition: EventListener.h:40
Simulation is a class that bridges the collision space agxCollide::Space and the dynamic simulation s...
Definition: Simulation.h:131
agxTerrain::Terrain instance in a simulation, receiving step and contact callbacks in a controllable ...
The base class for a constraint.
Definition: Constraint.h:89
Spawns new bodys inside a given volume.
Definition: Emitter.h:45
The object defining a frame of reference and providing transformations operations.
Definition: agx/Frame.h:68
With this class you can attach an ObserverFrame object relative to a RigidBody.
Definition: ObserverFrame.h:42
A basic particle system that contains all the storages and buffers required for basic operation and a...
Spawns new Rigid Bodies inside a volume given to the Emitter.
The rigid body class, combining a geometric model and a frame of reference.
Definition: RigidBody.h:49
A class holding 4 dimensional vectors and providing basic arithmetic.
Definition: Vec4Template.h:35
Templated vector class.
Definition: agx/Vector.h:53
Smart pointer for handling referenced counted objects.
Definition: ref_ptr.h:30
#define DOXYGEN_END_INTERNAL_BLOCK()
Definition: macros.h:89
#define DOXYGEN_START_INTERNAL_BLOCK()
Definition: macros.h:88
This namespace consists of a set of classes for handling geometric intersection tests including boole...
Contain classes for higher level modeling primitives, such as Tree, Terrain etc.
Definition: Space.h:63
The agxOSG namespace provides functionality for visualizing AGX simulations with OpenSceneGraph.
AGXOSG_EXPORT osg::Texture2D * createTexture(const std::string &filename)
Create a Texture2D object that can be assigned to nodes.
AGXOSG_EXPORT agx::Vector< GeometryNode * > findGeometryNodes(const agxCollide::Geometry *geometry, osg::Group *rootNode)
Finds the geometry nodes associated to a geometry, if multiple are present in the specified root grap...
AGXOSG_EXPORT bool setEnableWireFrameMode(osg::Node *node, bool flag)
AGXOSG_EXPORT osg::Geometry * create3DGrid(unsigned int resU, unsigned int resV, unsigned int resW, const osg::Vec3 &origin, const osg::Vec3 &endPointX, const osg::Vec3 &endPointY, const osg::Vec3 &endPointZ, float width)
Create a uniform grid and adds it to a root.
AGXOSG_EXPORT GeometryNode * findGeometryNode(const agxCollide::Geometry *geometry, osg::Group *rootNode)
Finds the geometry node associated to a geometry.
AGXOSG_EXPORT void setEnableLight(bool enable, int lightNum, osg::Node *node)
AGXOSG_EXPORT bool removeText(const agxCollide::Geometry *geometry, osg::Group *root, size_t index=0)
Remove text from a geometry.
AGXOSG_EXPORT agxOSG::ParticleSystemDrawable * findParticleSystemDrawable(osg::Group *root)
AGXOSG_EXPORT bool addText(const agxCollide::Geometry *geometry, osg::Group *root, const std::string &text, const agx::Vec3 &relPosition=agx::Vec3(0, 0, 0), const agx::Vec4f &color=agxRender::Color::Yellow(), agx::Real size=0.2, int alignment=6)
Add text relative to an geometry.
AGXOSG_EXPORT osgText::Text * findText(const agxCollide::Geometry *geometry, osg::Group *root, size_t index=0)
Finds a text object already added to the geometry (so the text can be changed).
AGXOSG_EXPORT osg::MatrixTransform * createAxes(float scale=1, float width=3)
Create a x, y and z arrow with the size 1.
AGXOSG_EXPORT void setAlpha(osg::Node *node, float alpha, bool override=false)
Set the alpha part of the material for a node.
AGXOSG_EXPORT bool toggleWireFrameMode(osg::Node *node)
AGXOSG_EXPORT void setAmbientColor(osg::Node *node, const agx::Vec4f &color, bool override=false)
Set the ambient part of a material for a node.
AGXOSG_EXPORT agxOSG::RigidBodySystemDrawable * findRigidBodySystemDrawable(osg::Group *root)
AGXOSG_EXPORT bool loadCubeMapImages(const std::string &imagename, const std::string &filetype, agx::Vector< osg::ref_ptr< osg::Image > > &images)
Internal function to load images into an array.
AGXOSG_EXPORT bool getEnableOutline(osg::Node *node)
AGXOSG_EXPORT void setEnvMapReflectionCoefficient(osg::Node *node, float coeff)
Specifies the amount of reflection that should be used (if CubeMap or SphereMap is assigned to the no...
AGXOSG_EXPORT agxOSG::FrameTrajectoryDrawable * findFrameTrajectoryDrawable(osg::Group *root)
AGXOSG_EXPORT osg::Geode * createParticleTrajectoriesVisual(agx::ParticleSystem *particleSystem, osg::Group *root, agx::Real sampling, agx::UInt numPositions)
Creates a visual of the particle position trajectories.
AGXOSG_EXPORT void setShininess(osg::Node *node, float shininess, bool override=false)
Set the shininess exponent for the Phong specular model.
AGXOSG_EXPORT agxSDK::EventListener * createVisualUpdater(agxSDK::EventListener *listener, osg::Group *root)
Given some specific classes inheriting from EventListener, this function can handle custom visual rep...
AGXOSG_EXPORT void getNearFarPoints(const osg::Camera *camera, float x, float y, agx::Vec3 &near, agx::Vec3 &far)
Get the near and far points of the current window, given a camera and x and y position.
AGXOSG_EXPORT agxOSG::GeometryNode * createVisual(const agxCollide::Geometry *geometry, osg::Group *root, float detailRatio=1.0f, bool createAxes=false, bool evenIfSensor=true)
Given a geometry, this function create visual representation of the shape.
AGXOSG_EXPORT osg::Geode * createPolyline(const agx::Vec3Vector &points, const agx::Vec4 &color, float width)
Create and return a new Polyine to render.
AGXOSG_EXPORT osg::Geode * createParticleContactGraph(agx::ParticleSystem *particleSystem, osg::Group *root, agx::Real minForce, agx::Real maxForce)
Creates a visual of the particle contact network, which colors contacts depending on contact force.
AGXOSG_EXPORT osg::Geometry * createGrid(unsigned int resU, unsigned int resV, const osg::Vec3 &origin, const osg::Vec3 &endPointX, const osg::Vec3 &endPointY, bool wireFrameMode=false)
Create a uniform grid.
AGXOSG_EXPORT std::tuple< osg::Group *, std::vector< size_t > > createVisualWithGeometryConnection(agx::RigidBody *rb, osg::Group *root, float detailRatio=1.0f, bool createAxes=false)
Given a rigid body, this function creates visual representation of all the geometries.
AGXOSG_EXPORT osg::Geode * createRigidBodyTrajectoriesVisual(agxSDK::Simulation *simulation, osg::Group *root, agx::Real sampling, agx::UInt numPositions, ScalarColorMap *scalarColorMap=nullptr)
Creates a visual of the rigid body position trajectories.
AGXOSG_EXPORT void addRenderCallbackToFracture(agxModel::FractureGenerator *listener, osg::Group *root)
Adds default createVisual callback to a FractureGenerator when new fragments are created that copies ...
AGXOSG_EXPORT bool setOrbitCamera(osgViewer::Viewer *viewer, osg::Group *node, const agx::Vec3 &eye, const agx::Vec3 &center, const agx::Vec3 &up, int trackerMode=osgGA::NodeTrackerManipulator::NODE_CENTER)
AGXOSG_EXPORT bool setEnableOutline(osg::Node *node, bool enabled, const agxRender::Color &color=agxRender::Color(1, 1, 0, 1), float width=2.0)
AGXOSG_EXPORT osg::TextureCubeMap * createTextureCubeMap(agx::Vector< osg::ref_ptr< osg::Image > > &images)
Create a TextureCubeMap from 6 images with a 90x90 fov.
TextureMode
Definition: utils.h:101
@ SHADOW_TEXTURE
Definition: utils.h:103
@ ROUGHNESS_TEXTURE
Definition: utils.h:107
@ CUBEMAP_TEXTURE
Definition: utils.h:108
@ METALLIC_TEXTURE
Definition: utils.h:109
@ DIFFUSE_TEXTURE
Definition: utils.h:102
@ NORMALMAP_TEXTURE
Definition: utils.h:105
@ HEIGHTMAP_TEXTURE
Definition: utils.h:106
@ SHADOW_JITTER_TEXTURE
Definition: utils.h:104
AGXOSG_EXPORT bool setCubeMapTexture(osg::Node *node, const std::string &imagePath, const std::string &imageType=".dds")
Assigns a Cubemap texture to the specified node.
AGXOSG_EXPORT void addRenderColorCallbackToFracture(agxModel::FractureGenerator *listener, osg::Group *root, const agx::Vec4f &color)
Adds createVisual callback to a FractureGenerator when new fragments are created that sets a specific...
AGXOSG_EXPORT void setGamma(osg::Node *node, float gamma, bool override=false)
Set the gamma that will be used to transform Physical color to monitor color.
AGXOSG_EXPORT agxOSG::DeformableRenderer * findDeformableRenderer(const agxModel::DeformableObject *deformable, osg::Group *root)
Searches for renderer of deformable in root.
AGXOSG_EXPORT osg::Geode * createFrameTrajectoryDrawable(agxSDK::Simulation *simulation, osg::Group *root, agx::UInt numPositions, const agx::Vec4f &defaultColor=agx::Vec4f(0.5, 0.5, 0.5, 1.0))
AGXOSG_EXPORT osg::Geode * createLine(const agx::Vec3 &p1, const agx::Vec3 &p2, const agx::Vec4 &color, float width)
Create and return a new Line to render.
AGXOSG_EXPORT osg::Geode * createText(const std::string &text, const agx::Vec3 &relPosition=agx::Vec3(0, 0, 0), const agx::Vec4f &color=agxRender::Color::Yellow(), agx::Real size=0.2)
Create a text object.
AGXOSG_EXPORT osg::Group * createVisualTemplateCaching(agxSDK::Assembly *parent, osg::Group *root, agxOSG::RigidBodyRenderCache *cache=nullptr, float detailRatio=1.0f, bool createAxes=false)
Given an Assembly, this function creates visual representation of all the geometries.
AGXOSG_EXPORT bool setTexture(const agxCollide::Geometry *geometry, osg::Group *rootNode, const std::string &imagePath, bool repeat=false, TextureMode mode=DIFFUSE_TEXTURE)
Read an image from disk and apply to the specified geometry as a 2D Texture in OVERRIDE|PROTECTED mod...
AGXOSG_EXPORT osg::Geode * createCubeLines(const agx::Vec3 &position, const agx::Vec3 &boxHalfVec3, const agxRender::Color &color=agxRender::Color::BlueViolet(), const agx::Real lineWidth=2.0f)
This function generates a cube using line segments and returns an osg::Geode node,...
AGXOSG_EXPORT osg::Geode * createSphere(const agx::Vec3 &center, const agx::Vec4 &color, float radius)
Create and return a new Sphere to render.
AGXOSG_EXPORT void setMetallic(osg::Node *node, float metallic, bool override=false)
Set the metallic:ness of the material.
AGXOSG_EXPORT bool forceWireFrameModeOn(osg::Node *node)
AGXOSG_EXPORT osg::MatrixTransform * createCylinder(const agx::AffineMatrix4x4 &transform, const agx::Vec4 &color, float radius, float height)
Create and return a new Cylinder to render.
AGXOSG_EXPORT void setSpecularColor(osg::Node *node, const agx::Vec4f &color, bool override=false)
Set the specular part of a material for a node.
AGXOSG_EXPORT agxCollide::LocalGeometryContact getHoveredGeometryContact(const osg::Camera *camera, agxCollide::Space *space, float x, float y)
Get a geometry contact given the current camera and a position in the camera window.
AGXOSG_EXPORT void setDiffuseColor(osg::Node *node, const agx::Vec4f &color, bool override=false)
Set the diffuse part of a material for a node.
AGXOSG_EXPORT agxCollide::Trimesh * createTrimesh(osg::Node *node)
Extracts mesh data from an osg::Node, creates an agxCollide::Trimesh from it and returns the result.
AGXOSG_EXPORT size_t smoothNormals(osg::Node *node, float creaseAngle=1.48353f)
Smoothes the normals of all meshes in osg::Geometries using agxUtil::SmoothingVisitor found under the...
AGXOSG_EXPORT void setRoughness(osg::Node *node, float roughness, bool override=false)
Set the roughness of the material.
void setUniform(osg::Node *node, const std::string &name, T value)
Definition: utils.h:244
The agxSDK namespace contain classes to bridge the collision detection system and the dynamical simul...
Definition: Constraint.h:31
The agxUtil namespace contain classes and methods for utility functionality.
The agx namespace contains the dynamics/math part of the AGX Dynamics API.
uint64_t UInt
Definition: Integer.h:27
double Real
Definition: Real.h:41