Particle Model
Opening a Particle Model
The simplest way to open a particle dataset is to provide a file path. The component will select the appropriate reader
based on the file extension (.ptfx or .vtp):
#include "CeeParticleModel/ParticleModel.h"
cee::pt::Error error;
cee::PtrRef<cee::pt::ParticleModel> model = new cee::pt::ParticleModel;
if (!model->open("C:/data/particles.ptfx", &error))
{
// Handle error - see Error Handling section below
}
After a successful call to open(), the model is ready for frame iteration
and visualization.
Adding the Model to a View
Since ParticleModel extends vis::Model, you add it to a
View just like any other model:
cee::PtrRef<cee::vis::View> view = /* your view */;
view->addModel(model.get());
// The model renders as a point cloud; size & color are configurable
model->setParticleSize(3.0f);
model->updateVisualization();
view->requestRedraw();
Model Lifecycle
You can query whether a model is open with isOpen() and explicitly close it
with close():
if (model->isOpen())
{
// Model has an active dataset
size_t frames = model->frameCount();
}
// Explicitly release the dataset and free resources
model->close();
Calling close() releases the reader, clears cached frames, and removes any renderables. The model can be
reopened with a different file afterwards.