neuray API Programmer's Manual

mi::neuraylib::IParticles Class Reference

[Leaf nodes]

Description

Interface representing a collection of particles.

General methods

virtual Uint32 get_particles_element_size() const =0
Returns the number of floats that define a particle of the current particle type. More...
virtual Size get_particles_size() const =0
Returns the number of particles.
virtual Particle_type get_type() const =0
Returns the particle type.
virtual void reserve( Size n) =0
Reserves space for n particles.
virtual void set_type( Particle_type particle_type) =0
Sets the particle type. More...

Methods related to particles

virtual Sint32 add_particle( const Float32* data) =0
Adds a particle. More...
virtual const Float32get_data() const =0
Returns the data of this particle object or NULL if the object is empty.
virtual const Float32get_particle( Size index) const =0
Returns the data of the particle at index or NULL if the object is empty or index is out of bounds.
virtual Sint32 set_data( const Float32* data, Size n) =0
Sets the data for the whole particle object. More...
virtual Sint32 set_particle( Size index, const Float32* data) =0
Sets a particle. More...

Methods related to per-particle attributes

virtual const IAttribute_vectoraccess_attribute_vector( Mesh_attribute_name name) const =0
Returns a particle object attribute. More...
virtual Sint32 attach_attribute_vector( IAttribute_vector* attribute_vector) =0
Attaches an attribute to the particle object. More...
virtual IAttribute_vectorcreate_attribute_vector( Mesh_attribute_name name, Uint32 dim = 1) =0
Creates a particle object attribute. More...
virtual IAttribute_vectoredit_attribute_vector( Mesh_attribute_name name) =0
Detaches and returns a particle object attribute. More...
virtual bool  has_attribute( Mesh_attribute_name name) const =0
Indicates whether the particle object has a particular attribute. More...
virtual Sint32 remove_attribute_vector( Mesh_attribute_name name) =0
Removes a particle object attribute. More...

Methods related to the bounding box

virtual Bbox3_struct get_bbox() const =0
Returns the bounding box of the particle object.
virtual Bbox3_struct get_tight_bbox( const Float64_4_4_struct& transformation_matrix) const =0
Returns the bounding box of the particle object after transformation. More...

Member Functions

virtual const IAttribute_vector* mi::​neuraylib::​IParticles::access_attribute_vector( Mesh_attribute_name name) const [pure virtual]

Returns a particle object attribute.

Parameters

name
The name of the attribute, see above.

Returns

The requested attribute vector, or NULL in case of failure.

virtual Sint32 mi::​neuraylib::​IParticles::add_particle( const Float32* data) [pure virtual]

Adds a particle.

See also:

get_particles_element_size()

Parameters

data
The particle data. The size of the array depends on the particle type. In case of mi::neuraylib::PARTICLE_TYPE_SPHERE four floats need to be provided: the first three define its position and the fourth one its radius.

Returns

  • 0: Success.
  • -1: Invalid input data (NULL or zero-length array).

virtual Sint32 mi::​neuraylib::​IParticles::attach_attribute_vector( IAttribute_vector* attribute_vector) [pure virtual]

Attaches an attribute to the particle object. The attribute vector must not be used any longer after it has been attached.

See also:

create_attribute_vector(), edit_attribute_vector()

Parameters

attribute_vector
The attribute vector to attach.

Returns

  • 0: Success.
  • -1: Invalid parameters (NULL pointer).
  • -3: The attribute vector is not one of the supported types.
  • -4: The number of elements does not match the number of particle of the object
  • -5: An attribute of the same name is already attached to the particle object.

virtual IAttribute_vector* mi::​neuraylib::​IParticles::create_attribute_vector( Mesh_attribute_name name, Uint32 dim = 1) [pure virtual]

Creates a particle object attribute. The attribute is not yet attached to the particle object. It needs to be attached before it is released.

See also:

attach_attribute_vector()

Parameters

name
The name of the attribute, see above.
dim
Dimension of an attribute value. Only used for those attributes that have user specifiable dimensions.

Returns

The requested attribute vector, or NULL in case of failure.

virtual IAttribute_vector* mi::​neuraylib::​IParticles::edit_attribute_vector( Mesh_attribute_name name) [pure virtual]

Detaches and returns a particle object attribute. The attribute needs to be reattached before it is released. Otherwise, the attribute is effectively removed from the particle object.

See also:

attach_attribute_vector()

Parameters

name
The name of the attribute, see above.

Returns

The requested attribute vector, or NULL in case of failure.

virtual Bbox3_struct mi::​neuraylib::​IParticles::get_bbox() const [pure virtual]

Returns the bounding box of the particle object.

virtual const Float32* mi::​neuraylib::​IParticles::get_data() const [pure virtual]

Returns the data of this particle object or NULL if the object is empty.

virtual const Float32* mi::​neuraylib::​IParticles::get_particle( Size index) const [pure virtual]

Returns the data of the particle at index or NULL if the object is empty or index is out of bounds.

virtual Uint32 mi::​neuraylib::​IParticles::get_particles_element_size() const [pure virtual]

Returns the number of floats that define a particle of the current particle type. (mi::neuraylib::Particle_type).

virtual Size mi::​neuraylib::​IParticles::get_particles_size() const [pure virtual]

Returns the number of particles.

virtual Bbox3_struct mi::​neuraylib::​IParticles::get_tight_bbox( const Float64_4_4_struct& transformation_matrix) const [pure virtual]

Returns the bounding box of the particle object after transformation.

Parameters

transformation_matrix
The world-to-object space transformation matrix that is applied to the object before the bounding box is computed.
virtual Particle_type mi::​neuraylib::​IParticles::get_type() const [pure virtual]

Returns the particle type.

virtual bool mi::​neuraylib::​IParticles::has_attribute( Mesh_attribute_name name) const [pure virtual]

Indicates whether the particle object has a particular attribute.

Parameters

name
The name of the attribute to query, see above.

Returns

true if the particle object has this attribute, false otherwise.

virtual Sint32 mi::​neuraylib::​IParticles::remove_attribute_vector( Mesh_attribute_name name) [pure virtual]

Removes a particle object attribute.

Parameters

name
The name of the attribute, see above.

Returns

  • 0: Success.
  • -1: There is no attribute of the given type and name.

virtual void mi::​neuraylib::​IParticles::reserve( Size n) [pure virtual]

Reserves space for n particles.

virtual Sint32 mi::​neuraylib::​IParticles::set_data( const Float32* data, Size n) [pure virtual]

Sets the data for the whole particle object.

See also:

get_particles_element_size()

Parameters

data
An array containing the data needed to describe all particles of this particle object. In case of mi::neuraylib::PARTICLE_TYPE_SPHERE a single particle is given by four floats: the first three define its position and the fourth one its radius, therefore the size of data is 4 * n.
n
The number of particles.

Returns

  • 0: Success.
  • -1: Invalid input data (NULL or zero-length array).

virtual Sint32 mi::​neuraylib::​IParticles::set_particle( Size index, const Float32* data) [pure virtual]

Sets a particle.

See also:

get_particles_element_size()

Parameters

index
Particle index.
data
The particle data. The size of the array depends on the particle type. In case of mi::neuraylib::PARTICLE_TYPE_SPHERE four floats need to be provided: the first three define its position and the fourth one its radius.

Returns

  • 0: Success.
  • -1: Invalid input data (NULL or zero-length array).
  • -2: index is out of bounds.

virtual void mi::​neuraylib::​IParticles::set_type( Particle_type particle_type) [pure virtual]

Sets the particle type. The default type is mi::neuraylib::PARTICLE_TYPE_SPHERE. Currently, no other type is supported.