AGX Dynamics 2.42.1.1
Loading...
Searching...
No Matches
PointSpriteDrawable.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#ifndef AGXOSG_POINTSPRITEDRAWABLE_H
18#define AGXOSG_POINTSPRITEDRAWABLE_H
19
20#include <agxOSG/export.h>
21
22#include <agx/PushDisableWarnings.h> // Disabling warnings. Include agx/PopDisableWarnings.h below!
23#include <osg/Drawable>
24#include <osg/Version>
25#include <agx/PopDisableWarnings.h> // End of disabled warnings.
26
27#include <agx/Task.h>
28#include <agxData/Buffer.h>
29#include <agxData/Value.h>
30#include <agxData/Array.h>
31// #include <agx/Bound.h>
32#include <agx/Vec3.h>
33#include <agx/Vec4.h>
34
35namespace agxOSG
36{
37 class AGXOSG_EXPORT PointSpriteDrawable : public osg::Drawable
38 {
39 public:
41 agxData::Buffer *colors, agxData::Buffer *enableRendering,
42 agxData::Value *bound, agx::Component *context);
43
44 // void set( agxData::Array<agx::Vec3> positions, agxData::Array<agx::Real> radii, agx::Bound3 bound );
45
46 void setColor(const agx::Vec4& color);
47 void setEnable(bool flag);
48
49
51# if OSG_VERSION_GREATER_OR_EQUAL(3,4,0)
52 virtual osg::BoundingSphere computeBound() const;
53 virtual osg::BoundingBox computeBoundingBox() const;
54#else
55 virtual osg::BoundingBox computeBound() const;
56#endif
57
59 virtual void drawImplementation(osg::RenderInfo& renderInfo) const;
60
61 public:
62 virtual osg::Object* cloneType() const { return new PointSpriteDrawable (m_positions, m_rotations, m_radii, m_colors, m_enableRendering, m_bound, m_renderTask->getContext()->as<agx::Component>()); }
63 virtual osg::Object* clone(const osg::CopyOp&) const { return new PointSpriteDrawable (*this); }
64 virtual bool isSameKindAs(const osg::Object* obj) const { return dynamic_cast<const PointSpriteDrawable *>(obj)!=nullptr; }
65 virtual const char* libraryName() const { return "agxOSG"; }
66 virtual const char* className() const { return "PointSpriteDrawable"; }
67
68 protected:
70
71 private:
72 agx::TaskRef m_renderTask;
73 agxData::BufferRef m_positions;
74 agxData::BufferRef m_rotations;
75 agxData::BufferRef m_radii;
76 agxData::BufferRef m_colors;
77 agxData::BufferRef m_enableRendering;
78 agxData::ValueRef m_bound;
79 bool m_enabled;
80
81 // agxData::Array< agx::Vec3 > m_positions;
82 // agxData::Array< agx::Real > m_radii;
83 // agx::Bound3 m_bound;
84 };
85
86 typedef osg::ref_ptr<PointSpriteDrawable> PointSpriteDrawableRef;
87}
88
89
90#endif /* AGXOSG_POINTSPRITEDRAWABLE_H */
#define AGXOSG_EXPORT
Abstract representation of a data buffer.
Definition: Buffer.h:56
Abstract representation of a value.
Definition: Value.h:49
virtual void drawImplementation(osg::RenderInfo &renderInfo) const
The actual draw method for the particle system.
virtual const char * className() const
void setColor(const agx::Vec4 &color)
virtual osg::BoundingBox computeBound() const
Compute the bounding box around Drawables's geometry.
virtual osg::Object * clone(const osg::CopyOp &) const
PointSpriteDrawable(agxData::Buffer *positions, agxData::Buffer *rotations, agxData::Buffer *radii, agxData::Buffer *colors, agxData::Buffer *enableRendering, agxData::Value *bound, agx::Component *context)
virtual osg::Object * cloneType() const
virtual bool isSameKindAs(const osg::Object *obj) const
virtual const char * libraryName() const
A component is an object containing other objects, enabling hierarchical structuring.
Definition: Component.h:39
A class holding 4 dimensional vectors and providing basic arithmetic.
Definition: Vec4Template.h:35
The agxOSG namespace provides functionality for visualizing AGX simulations with OpenSceneGraph.
osg::ref_ptr< PointSpriteDrawable > PointSpriteDrawableRef