Giter Club home page Giter Club logo

sersolmaz / partio Goto Github PK

View Code? Open in Web Editor NEW

This project forked from wdas/partio

0.0 1.0 0.0 960 KB

C++ (with python bindings) library for easily reading/writing/manipulating common animation particle formats such as PDB, BGEO, PTC. See the discussion group @ http://groups.google.com/group/partio-discuss

Home Page: http://partio.us

License: Other

CMake 1.39% Makefile 0.18% GLSL 0.03% TeX 0.47% C++ 29.89% Objective-C 63.00% C 0.35% Python 4.69%

partio's Introduction

Partio - A library for particle IO and manipulation

This is the initial source code release of partio a tool we used for particle reading/writing. It started out as an abstraction for the commonalities in particle models (i.e. accessing many attributes associated with an index or entity).

Super impatient building guide

# Install Location ~ adjust accordingly
prefix=$HOME/local
# Partio depends on SeExpr v2.11
git clone https://github.com/wdas/seexpr.git
pushd seexpr
  git checkout v2.11
  make -j prefix=$prefix install
popd
git clone https://github.com/wdas/partio.git
cd partio
make -j prefix=$prefix RP_SeExpr=$prefix install

Getting Started

CMake is used to build the project, but we provide a top-level Makefile for convenience that takes care of all the steps.

See the Makefile for the user-tweakable variables and corresponding cmake options.

The typical usage for an installation into /usr/local with a temporary staging directory of /tmp/stage is:

make DESTDIR=/tmp/stage RP_SeExpr=/usr/local prefix=/usr/local install

SeExpr

Partio depends on SeExpr v2 (current v2.11). SeExpr v2 and v3 can co-exist, so you can have v2 for building partio installed alongside SeExpr v3+ (master).

SeExpr is not strictly required. SeExpr support is disabled when RP_SeExpr is not specified to the Makefile. In CMake, the corresponding variables are -DSEEXPR_BASE=<path> for the SeExpr location, and -DPARTIO_SE_ENABLED=1 to enable the PartioSe class.

Source code overview

src/ lib/ Library code (public API in root) lib/core Core library (KDtree traversal, data representations) lib/io Input/Output (Different file formats) py/ SWIG based python bindings doc/ Doxygen documentation and (the start of) a manual tests/ Start of regression tests (I need more) tools/ Useful tools partconvert partinfo partview

Class Model

The goal of the library is to abstract the particle interface from the data representation. That is why Partio represents particles using three classes that inherit and provide more functionality

ParticlesInfo - Information about # of particles and attributes ParticlesData - Read only access to all particle data ParticlesDataMutable - Read/write access to all particle data

The functions used to get particle access are these:

readHeaders() returns ParticlesInfo reads only the minimum data necessary to get number of particles and attributes

readCached() returns ParticlesData For multiple users in different threads using the same particle file ParticlesData

create() and read() returns ParticlesDataMutable
allows read/write access

Behind the scenes you could implement these classes however you like. Headers only representation is called core/ParticleHeader.{h,cpp}. Simple non-interleaved attributes is core/ParticleSimple.{h,cpp}.

Attribute Data Model

All particles have the same data attributes. They have the model that they are of three basic types with a count of how many scalar values they have.

VECTOR[3]
FLOAT[d] INT[d]

VECTOR[3] and FLOAT[3] have the same data representations. VECTOR[4] is invalid however FLOAT[4] is valid as is FLOAT[1...infinity]

This seems to encompass the most common file formats for particles

Iterating

There are multiple ways to access data in the API. Here are some tips

  • Use SIMD functions when possible prefer dataAsFloat(),data(arrayOfIndices) as opposed to data(int singleIndex) which accesses multiple pieces of data at once

  • Cache ParticleAttributes for quick access instead of calling attributeInfo() over a loop of particles

  • Use iterators to do linear operations over all particles They are much more optimized than both data() and the dataAsFloat or

Backends

Behind the scenes there are SimpleParticles, ParticleHeaders, and SimpleParticlesInterleaved. In the future I would like to write a disk-based cached back end that can dynamically only load the data that is necessary. create(), read() and readCached could be augmented to create different structures in these cases.

Readers/Writers

New readers and writers can be added in the io/ directory. You simply need to implement the interface ParticlesInfo, ParticlesData and ParticlesDataMutable (or as many as you need). Editing the io/readers.h to add prototypes and io/ParticleIO.cpp to add file extension bindings should be easy.

  • Andrew Selle, Walt Disney Animation Studios

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.