|
Momentum Scripting v1
|
#include <DataBufferAccessor.h>
Public Member Functions | |
| bool | commitParticleBuffer (const std::string &bufferName) |
| unsigned int | getParticleIdFromIndex (unsigned int arrayIndex) const |
A class that is used as an interface to access low level buffer data for read/write in Momentum objects, such as GranularBody and Granular Contact data.
Beware that accessing data at a low level exposes the user to the underlying data structure which require knowledge about it to use effectively. When the data data accessed, it is structured in N x M matrices where N is the number of particles and M is the dimension of the data set for each particle, including eventual padding.
For example: GranularBody position data is structured in N x 4 matrices where column elements 0,1,2 denotes the positions in each dimension while the fourth element is padding for data alignment. Rotation data is also packed in N x 4 matrices but here all four elements contains quaternion data which can be used with a Quat objects. Mass is stored in a N x 1 matrix where the column element denotes the mass. The structure of the data is documented in the methods.
| bool MOMENTUM_NAMESPACE::DataBufferAccessor::commitParticleBuffer | ( | const std::string & | bufferName | ) |
Updates the particle data buffer according to specified buffer name.
This is needed in order to signal to the simulation system that the buffer is updated. This is needed in some cases in order to make sure the journal properly records the buffer data and also during journal playback to ensure that the visuals are update accordingly ( for example, when changing the color buffer).
Examples:
bufferAccessor->commitParticlebuffer("color");
| bufferName | - the specified name of the buffer to commit. |
| unsigned int MOMENTUM_NAMESPACE::DataBufferAccessor::getParticleIdFromIndex | ( | unsigned int | arrayIndex | ) | const |
Get particle id from low level array index.
| the | array index used to access particle data. |