19#include <osg/MatrixTransform>
20#include <osg/Geometry>
28 struct ShaderGeometry;
160 bool bind(
size_t location, osg::Array* array, std::string name =
"" );
167 template<
typename VertexArrayType>
168 VertexArrayType* getVertexAttributeArray( std::string name =
"" )
const;
205 template<
typename VertexArrayType>
210 for (
unsigned i = 1u; i < getNumVertexAttribArrays(); ++i ) {
211 auto array = getVertexAttribArray( i );
212 if (
auto arrayOfType =
dynamic_cast<const VertexArrayType*
>( array ) )
213 if ( arrayOfType->getName() == name )
214 return const_cast<VertexArrayType*
>( arrayOfType );
The agxOSG namespace provides functionality for visualizing AGX simulations with OpenSceneGraph.
osg::ref_ptr< ShaderGeometry > OsgShaderGeometryRef
std::vector< OsgShaderGeometryRef > OsgShaderGeometryRefVector
This will determine the render order of the shaders, e.g., render faces before edges.
Empty geometry which can load vertex, geometry and fragment shaders, or create a custom osg::Program.
virtual void update()
Called on frame update when the deformable data is dirty.
osg::ref_ptr< osg::Vec3Array > OsgVec3ArrayRef
virtual bool initialize()
Initialize shaders and attributes.
static OsgShaderGeometryRefVector getSorted(const OsgShaderGeometryRefVector &in)
Sort in given render priority EARLY -> LATE.
bool loadShaders(std::string_view sourcePath)
Path and name, e.g., "data/shaders/foo" and "foo.vert", "foo.geom", "foo.frag" will be searched for i...
virtual ~ShaderGeometry()=default
void createVertexBuffer(size_t size, int renderMode=-1)
Creates the vertex buffer and binds it to: layout(location = 0) in vec3 in_vertex.
osg::ref_ptr< osg::Shader > OsgShaderRef
static void insertSorted(OsgShaderGeometryRefVector &v, OsgShaderGeometryRef shaderGeometry)
Inserts shaderGeometry such that v is still sorted on render order.
ShaderGeometry(agx::UInt16 renderOrder)
bool bind(size_t location, osg::Array *array, std::string name="")
Bind array to location.
VertexArrayType * getVertexAttributeArray(std::string name="") const
Finds the vertex attribute array of the given type and name.
osg::ref_ptr< osg::Vec4Array > OsgVec4ArrayRef