// Copyright (C) 2002-2003 Gideon May (gideon@computer.org) // // Permission to copy, use, sell and distribute this software is granted // provided this copyright notice appears in all copies. // Permission to modify the code and to distribute modified code is granted // provided this copyright notice appears in all copies, and a notice // that the code was modified is included with the copyright notice. // // This software is provided "as is" without express or implied warranty, // and with no claim as to its suitability for any purpose. // #include #include #include #include #include #include "held_ptr.hpp" using namespace boost::python; namespace PyOSGParticle { void init_ParticleSystem() { class_, bases, boost::noncopyable > particleSystem("ParticleSystem", "The heart of this class library; its purpose is to hold a set of particles and manage particle creation, update, rendering and destruction." "You can add this drawable to any Geode as you usually do with other" "Drawable classes. Each instance of ParticleSystem is a separate set of" "particles; it provides the interface for creating particles and iterating" "through them (see the Emitter and Program classes).", no_init); scope particleSystem_scope(particleSystem); particleSystem.def(init<>()); particleSystem.def("getParticleAlignment", &osgParticle::ParticleSystem::getParticleAlignment, "Get the alignment type of particles."); particleSystem.def("setParticleAlignment", &osgParticle::ParticleSystem::setParticleAlignment, "Set the alignment type of particles."); particleSystem.def("getAlignVectorX", &osgParticle::ParticleSystem::getAlignVectorX, "Get the X-axis alignment vector.", return_internal_reference<>()); particleSystem.def("setAlignVectorX", &osgParticle::ParticleSystem::setAlignVectorX, "Set the X-axis alignment vector."); particleSystem.def("getAlignVectorY", &osgParticle::ParticleSystem::getAlignVectorY, "Get the Y-axis alignment vector.", return_internal_reference<>()); particleSystem.def("setAlignVectorY", &osgParticle::ParticleSystem::setAlignVectorY, "Set the Y-axis alignment vector."); particleSystem.def("setAlignVectors", &osgParticle::ParticleSystem::setAlignVectors, "Set the alignment vectors."); particleSystem.def("getDefaultBoundingBox", &osgParticle::ParticleSystem::getDefaultBoundingBox, "Get the default bounding box", return_internal_reference<>()); particleSystem.def("setDefaultBoundingBox", &osgParticle::ParticleSystem::setDefaultBoundingBox, "Set the default bounding box." "The default bounding box is used when a real bounding box cannot be computed, for example" "because no particles has been updated yet."); particleSystem.def("getDoublePassRendering", &osgParticle::ParticleSystem::getDoublePassRendering, "Get the double pass rendering flag."); particleSystem.def("setDoublePassRendering", &osgParticle::ParticleSystem::setDoublePassRendering, "Set the double pass rendering flag." "Double pass rendering avoids overdraw problems between particle systems" "and other opaque objects. If you can render all the particle systems after" "the opaque objects, then double pass is not necessary and can be turned off (best choice)." "If you set the default attributes with setDefaultAttributes, then the particle" "system will fall into a transparent bin."); particleSystem.def("isFrozen", &osgParticle::ParticleSystem::isFrozen, "Return true if the particle system is frozen."); particleSystem.def("setFrozen", &osgParticle::ParticleSystem::setFrozen, "Set or reset the frozen state." "When the particle system is frozen, emitters and programs won't do anything on it."); particleSystem.def("numParticles", &osgParticle::ParticleSystem::numParticles, "Get the number of allocated particles (alive + dead)."); particleSystem.def("numDeadParticles", &osgParticle::ParticleSystem::numDeadParticles, "Get the number of dead particles."); particleSystem.def("getParticle", (osgParticle::Particle*(osgParticle::ParticleSystem::*)(int))&osgParticle::ParticleSystem::getParticle, "Get a pointer to the i-th particle.", return_internal_reference<>()); particleSystem.def("createParticle", &osgParticle::ParticleSystem::createParticle, "Create a new particle from the specified template (or the default one if ptemplate is null).", return_internal_reference<>()); particleSystem.def("destroyParticle", &osgParticle::ParticleSystem::destroyParticle, "Destroy the i-th particle."); particleSystem.def("getLastFrameNumber", &osgParticle::ParticleSystem::getLastFrameNumber, "Get the last frame number."); particleSystem.def("getDefaultParticleTemplate", (osgParticle::Particle& (osgParticle::ParticleSystem::*)()) &osgParticle::ParticleSystem::getDefaultParticleTemplate, "Get a reference to the default particle template.", return_internal_reference<>()); particleSystem.def("setDefaultParticleTemplate", &osgParticle::ParticleSystem::setDefaultParticleTemplate, "Set the default particle template (particle is copied)."); particleSystem.def("getFreezeOnCull", &osgParticle::ParticleSystem::getFreezeOnCull, "Get whether the particle system can freeze when culled"); particleSystem.def("setFreezeOnCull", &osgParticle::ParticleSystem::setFreezeOnCull, "Set whether the particle system can freeze when culled (default is true)"); particleSystem.def("setDefaultAttributes", &osgParticle::ParticleSystem::setDefaultAttributes, "A useful method to set the most common StateAttribute's in one call." "If texturefile is empty, then texturing is turned off."); particleSystem.def("getLevelOfDetail", &osgParticle::ParticleSystem::getLevelOfDetail, "(EXPERIMENTAL) Get the level of detail."); particleSystem.def("setLevelOfDetail", &osgParticle::ParticleSystem::setLevelOfDetail, "(EXPERIMENTAL) Set the level of detail. The total number of particles is divided by the detail value to" "get the actual number of particles to be drawn. This value must be greater than zero."); enum_ alignment("Alignment"); # define OSG_ENUM(VALUE) \ (alignment.value(#VALUE, osgParticle::ParticleSystem::VALUE), \ particleSystem.def(#VALUE, object(osgParticle::ParticleSystem::VALUE))) OSG_ENUM(BILLBOARD); OSG_ENUM(FIXED); scope(); } }