2011-02-18 14:05:18 +01:00
|
|
|
/*
|
Particles
=========
Merge of the famous particle patch by Janne Karhu, a full rewrite
of the Blender particle system. This includes:
- Emitter, Hair and Reactor particle types.
- Newtonian, Keyed and Boids physics.
- Various particle visualisation and rendering types.
- Vertex group and texture control for various properties.
- Interpolated child particles from parents.
- Hair editing with combing, growing, cutting, .. .
- Explode modifier.
- Harmonic, Magnetic fields, and multiple falloff types.
.. and lots of other things, some more info is here:
http://wiki.blender.org/index.php/BlenderDev/Particles_Rewrite
http://wiki.blender.org/index.php/BlenderDev/Particles_Rewrite_Doc
The new particle system cannot be backwards compatible. Old particle
systems are being converted to the new system, but will require
tweaking to get them looking the same as before.
Point Cache
===========
The new system to replace manual baking, based on automatic caching
on disk. This is currently used by softbodies and the particle system.
See the Cache API section on:
http://wiki.blender.org/index.php/BlenderDev/PhysicsSprint
Documentation
=============
These new features still need good docs for the release logs, help
for this is appreciated.
2007-11-26 23:09:57 +01:00
|
|
|
* This program is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU General Public License
|
|
|
|
* as published by the Free Software Foundation; either version 2
|
2008-04-17 00:40:48 +02:00
|
|
|
* of the License, or (at your option) any later version.
|
Particles
=========
Merge of the famous particle patch by Janne Karhu, a full rewrite
of the Blender particle system. This includes:
- Emitter, Hair and Reactor particle types.
- Newtonian, Keyed and Boids physics.
- Various particle visualisation and rendering types.
- Vertex group and texture control for various properties.
- Interpolated child particles from parents.
- Hair editing with combing, growing, cutting, .. .
- Explode modifier.
- Harmonic, Magnetic fields, and multiple falloff types.
.. and lots of other things, some more info is here:
http://wiki.blender.org/index.php/BlenderDev/Particles_Rewrite
http://wiki.blender.org/index.php/BlenderDev/Particles_Rewrite_Doc
The new particle system cannot be backwards compatible. Old particle
systems are being converted to the new system, but will require
tweaking to get them looking the same as before.
Point Cache
===========
The new system to replace manual baking, based on automatic caching
on disk. This is currently used by softbodies and the particle system.
See the Cache API section on:
http://wiki.blender.org/index.php/BlenderDev/PhysicsSprint
Documentation
=============
These new features still need good docs for the release logs, help
for this is appreciated.
2007-11-26 23:09:57 +01:00
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with this program; if not, write to the Free Software Foundation,
|
2010-02-12 14:34:04 +01:00
|
|
|
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
Particles
=========
Merge of the famous particle patch by Janne Karhu, a full rewrite
of the Blender particle system. This includes:
- Emitter, Hair and Reactor particle types.
- Newtonian, Keyed and Boids physics.
- Various particle visualisation and rendering types.
- Vertex group and texture control for various properties.
- Interpolated child particles from parents.
- Hair editing with combing, growing, cutting, .. .
- Explode modifier.
- Harmonic, Magnetic fields, and multiple falloff types.
.. and lots of other things, some more info is here:
http://wiki.blender.org/index.php/BlenderDev/Particles_Rewrite
http://wiki.blender.org/index.php/BlenderDev/Particles_Rewrite_Doc
The new particle system cannot be backwards compatible. Old particle
systems are being converted to the new system, but will require
tweaking to get them looking the same as before.
Point Cache
===========
The new system to replace manual baking, based on automatic caching
on disk. This is currently used by softbodies and the particle system.
See the Cache API section on:
http://wiki.blender.org/index.php/BlenderDev/PhysicsSprint
Documentation
=============
These new features still need good docs for the release logs, help
for this is appreciated.
2007-11-26 23:09:57 +01:00
|
|
|
*
|
|
|
|
* The Original Code is Copyright (C) 2007 by Janne Karhu.
|
|
|
|
* All rights reserved.
|
2012-12-14 05:57:26 +01:00
|
|
|
* Adaptive time step
|
|
|
|
* Classical SPH
|
|
|
|
* Copyright 2011-2012 AutoCRC
|
Particles
=========
Merge of the famous particle patch by Janne Karhu, a full rewrite
of the Blender particle system. This includes:
- Emitter, Hair and Reactor particle types.
- Newtonian, Keyed and Boids physics.
- Various particle visualisation and rendering types.
- Vertex group and texture control for various properties.
- Interpolated child particles from parents.
- Hair editing with combing, growing, cutting, .. .
- Explode modifier.
- Harmonic, Magnetic fields, and multiple falloff types.
.. and lots of other things, some more info is here:
http://wiki.blender.org/index.php/BlenderDev/Particles_Rewrite
http://wiki.blender.org/index.php/BlenderDev/Particles_Rewrite_Doc
The new particle system cannot be backwards compatible. Old particle
systems are being converted to the new system, but will require
tweaking to get them looking the same as before.
Point Cache
===========
The new system to replace manual baking, based on automatic caching
on disk. This is currently used by softbodies and the particle system.
See the Cache API section on:
http://wiki.blender.org/index.php/BlenderDev/PhysicsSprint
Documentation
=============
These new features still need good docs for the release logs, help
for this is appreciated.
2007-11-26 23:09:57 +01:00
|
|
|
*/
|
|
|
|
|
2012-02-17 19:59:41 +01:00
|
|
|
#pragma once
|
Particles
=========
Merge of the famous particle patch by Janne Karhu, a full rewrite
of the Blender particle system. This includes:
- Emitter, Hair and Reactor particle types.
- Newtonian, Keyed and Boids physics.
- Various particle visualisation and rendering types.
- Vertex group and texture control for various properties.
- Interpolated child particles from parents.
- Hair editing with combing, growing, cutting, .. .
- Explode modifier.
- Harmonic, Magnetic fields, and multiple falloff types.
.. and lots of other things, some more info is here:
http://wiki.blender.org/index.php/BlenderDev/Particles_Rewrite
http://wiki.blender.org/index.php/BlenderDev/Particles_Rewrite_Doc
The new particle system cannot be backwards compatible. Old particle
systems are being converted to the new system, but will require
tweaking to get them looking the same as before.
Point Cache
===========
The new system to replace manual baking, based on automatic caching
on disk. This is currently used by softbodies and the particle system.
See the Cache API section on:
http://wiki.blender.org/index.php/BlenderDev/PhysicsSprint
Documentation
=============
These new features still need good docs for the release logs, help
for this is appreciated.
2007-11-26 23:09:57 +01:00
|
|
|
|
2019-02-17 22:08:12 +01:00
|
|
|
/** \file
|
|
|
|
* \ingroup bke
|
2011-02-18 14:05:18 +01:00
|
|
|
*/
|
|
|
|
|
2019-10-26 10:06:19 +02:00
|
|
|
#include "BLI_buffer.h"
|
2020-03-19 09:33:03 +01:00
|
|
|
#include "BLI_utildefines.h"
|
2014-03-07 10:25:56 +01:00
|
|
|
|
2020-03-19 09:33:03 +01:00
|
|
|
#include "DNA_particle_types.h"
|
Particles
=========
Merge of the famous particle patch by Janne Karhu, a full rewrite
of the Blender particle system. This includes:
- Emitter, Hair and Reactor particle types.
- Newtonian, Keyed and Boids physics.
- Various particle visualisation and rendering types.
- Vertex group and texture control for various properties.
- Interpolated child particles from parents.
- Hair editing with combing, growing, cutting, .. .
- Explode modifier.
- Harmonic, Magnetic fields, and multiple falloff types.
.. and lots of other things, some more info is here:
http://wiki.blender.org/index.php/BlenderDev/Particles_Rewrite
http://wiki.blender.org/index.php/BlenderDev/Particles_Rewrite_Doc
The new particle system cannot be backwards compatible. Old particle
systems are being converted to the new system, but will require
tweaking to get them looking the same as before.
Point Cache
===========
The new system to replace manual baking, based on automatic caching
on disk. This is currently used by softbodies and the particle system.
See the Cache API section on:
http://wiki.blender.org/index.php/BlenderDev/PhysicsSprint
Documentation
=============
These new features still need good docs for the release logs, help
for this is appreciated.
2007-11-26 23:09:57 +01:00
|
|
|
|
2020-03-02 15:07:49 +01:00
|
|
|
#ifdef __cplusplus
|
|
|
|
extern "C" {
|
|
|
|
#endif
|
|
|
|
|
Particles
=========
Merge of the famous particle patch by Janne Karhu, a full rewrite
of the Blender particle system. This includes:
- Emitter, Hair and Reactor particle types.
- Newtonian, Keyed and Boids physics.
- Various particle visualisation and rendering types.
- Vertex group and texture control for various properties.
- Interpolated child particles from parents.
- Hair editing with combing, growing, cutting, .. .
- Explode modifier.
- Harmonic, Magnetic fields, and multiple falloff types.
.. and lots of other things, some more info is here:
http://wiki.blender.org/index.php/BlenderDev/Particles_Rewrite
http://wiki.blender.org/index.php/BlenderDev/Particles_Rewrite_Doc
The new particle system cannot be backwards compatible. Old particle
systems are being converted to the new system, but will require
tweaking to get them looking the same as before.
Point Cache
===========
The new system to replace manual baking, based on automatic caching
on disk. This is currently used by softbodies and the particle system.
See the Cache API section on:
http://wiki.blender.org/index.php/BlenderDev/PhysicsSprint
Documentation
=============
These new features still need good docs for the release logs, help
for this is appreciated.
2007-11-26 23:09:57 +01:00
|
|
|
struct ParticleKey;
|
Point Cache Refactoring
=======================
Caching and Baking:
- The point cache is now cleared on DAG_object_flush_update(), and not cleared for time dependency graph updates.
- There is now a Bake button instead of Protect. Also cache start and end frames were added to softbody and particles.
- The cloth autoprotect feature was removed.
- The Ctrl+B menu now also bakes cloth and particles next to softbody and fluids. Additionally there are now frree bake and free cache menu entries.
- The point cache api has been changed. There is now a PTCacheID struct for each point cache type that can be filled and then used to call the point cache functions.
- PointCache struct was added to DNA and is automatically allocated for each physics type.
- Soft body now supports Bake Editing just like cloth.
- Tried to make the systems deal consistently with time ipo's and offsets. Still not sure it all works correct, but too complicated to solve completely now.
Library Linking:
- Added some more warnings to prevent editing settings on library linked objects.
- Linked objects now read from the cache located next to the original library file, and never write to it. This restores old behavior for softbodies. For local simulation the mesh and not the object should be linked.
- Dupligroups and proxies can't create local point caches at the moment, how to implement that I'm not sure. We probably need a proxy point cache for that to work (ugh).
Physics UI:
- Renamed deflection panel to collision for consistency and reorganized the buttons. Also removed some softbody collision buttons from the softbody panel that were duplicated in this panel for cloth.
- Tweaked field panel buttons to not jump around when changing options.
- Tabbing e.g. Soft Body Collision into the Soft Body panel, it now only shows Collision to make the panel names readable.
- I tried to make enabled/disabling physics more consistent, since all three system did things different. Now the two modifier buttons to enable the modifier for the viewport and rendering are also duplicated in the physics panels. Toggling the Soft Body and Cloth buttons now both remove their modifiers.
- Fixed modifier error drawing glitch.
Particles:
- Particles are now recalculated more often than before. Previously it did partial updates based on the changes, but that doesn't work well with DAG_object_flush_update() ..
- Fixed memory leak loading keyed particle system. Now keys are not written to file anymore but always created after loading.
- Make particle threads work with autothreads.
Continue Physics:
- The timeline play now has a Continue Physics option in the playback menu, which keeps the simulations going without writing them to the cache.
- This doesn't always work that well, some changes are not immediately updated, but this can be improved later. Still it's fun to get a feel for the physics.
Todo:
- Point cache can get out of sync with and undo and changing a file without saving it.
- Change the point cache file format to store a version (so old point cache files can be either converted or at least ignored), and to do correct endian conversion.
- Menu item and/or buttons for Ctrl+B.
- A system("rm ..") was changed to remove() since the former is very slow for clearing point caches. These system() calls were already giving trouble in a bug in the tracker, but really most use of this system("") should be changed and tested.
- The Soft Body Collision and Clot Collision panel titles don't mention there's point cache settings there too, doing that makes them unreadable with the default panel setup.. but may need to make the names longer anyway.
2008-04-10 13:39:20 +02:00
|
|
|
struct ParticleSettings;
|
2019-01-28 11:08:24 +01:00
|
|
|
struct ParticleSystem;
|
|
|
|
struct ParticleSystemModifierData;
|
Particles
=========
Merge of the famous particle patch by Janne Karhu, a full rewrite
of the Blender particle system. This includes:
- Emitter, Hair and Reactor particle types.
- Newtonian, Keyed and Boids physics.
- Various particle visualisation and rendering types.
- Vertex group and texture control for various properties.
- Interpolated child particles from parents.
- Hair editing with combing, growing, cutting, .. .
- Explode modifier.
- Harmonic, Magnetic fields, and multiple falloff types.
.. and lots of other things, some more info is here:
http://wiki.blender.org/index.php/BlenderDev/Particles_Rewrite
http://wiki.blender.org/index.php/BlenderDev/Particles_Rewrite_Doc
The new particle system cannot be backwards compatible. Old particle
systems are being converted to the new system, but will require
tweaking to get them looking the same as before.
Point Cache
===========
The new system to replace manual baking, based on automatic caching
on disk. This is currently used by softbodies and the particle system.
See the Cache API section on:
http://wiki.blender.org/index.php/BlenderDev/PhysicsSprint
Documentation
=============
These new features still need good docs for the release logs, help
for this is appreciated.
2007-11-26 23:09:57 +01:00
|
|
|
|
2019-01-28 11:08:24 +01:00
|
|
|
struct BVHTreeRay;
|
|
|
|
struct BVHTreeRayHit;
|
2020-11-06 00:29:00 +01:00
|
|
|
struct BlendDataReader;
|
|
|
|
struct BlendLibReader;
|
2020-12-16 06:26:23 +01:00
|
|
|
struct BlendWriter;
|
Refactor CDData masks, to have one mask per mesh elem type.
We already have different storages for cddata of verts, edges etc.,
'simply' do the same for the mask flags we use all around Blender code
to request some data, or limit some operation to some layers, etc.
Reason we need this is that some cddata types (like Normals) are
actually shared between verts/polys/loops, and we don’t want to generate
clnors everytime we request vnors!
As a side note, this also does final fix to T59338, which was the
trigger for this patch (need to request computed loop normals for
another mesh than evaluated one).
Reviewers: brecht, campbellbarton, sergey
Differential Revision: https://developer.blender.org/D4407
2019-03-07 11:13:40 +01:00
|
|
|
struct CustomData_MeshMasks;
|
2018-04-08 09:28:52 +02:00
|
|
|
struct Depsgraph;
|
2019-01-28 11:08:24 +01:00
|
|
|
struct EdgeHash;
|
2019-03-19 14:46:33 +01:00
|
|
|
struct KDTree_3d;
|
2019-01-28 11:08:24 +01:00
|
|
|
struct LatticeDeformData;
|
|
|
|
struct LinkNode;
|
2008-02-17 23:42:03 +01:00
|
|
|
struct MCol;
|
Particles
=========
Merge of the famous particle patch by Janne Karhu, a full rewrite
of the Blender particle system. This includes:
- Emitter, Hair and Reactor particle types.
- Newtonian, Keyed and Boids physics.
- Various particle visualisation and rendering types.
- Vertex group and texture control for various properties.
- Interpolated child particles from parents.
- Hair editing with combing, growing, cutting, .. .
- Explode modifier.
- Harmonic, Magnetic fields, and multiple falloff types.
.. and lots of other things, some more info is here:
http://wiki.blender.org/index.php/BlenderDev/Particles_Rewrite
http://wiki.blender.org/index.php/BlenderDev/Particles_Rewrite_Doc
The new particle system cannot be backwards compatible. Old particle
systems are being converted to the new system, but will require
tweaking to get them looking the same as before.
Point Cache
===========
The new system to replace manual baking, based on automatic caching
on disk. This is currently used by softbodies and the particle system.
See the Cache API section on:
http://wiki.blender.org/index.php/BlenderDev/PhysicsSprint
Documentation
=============
These new features still need good docs for the release logs, help
for this is appreciated.
2007-11-26 23:09:57 +01:00
|
|
|
struct MFace;
|
2019-01-28 11:08:24 +01:00
|
|
|
struct MTFace;
|
Particles
=========
Merge of the famous particle patch by Janne Karhu, a full rewrite
of the Blender particle system. This includes:
- Emitter, Hair and Reactor particle types.
- Newtonian, Keyed and Boids physics.
- Various particle visualisation and rendering types.
- Vertex group and texture control for various properties.
- Interpolated child particles from parents.
- Hair editing with combing, growing, cutting, .. .
- Explode modifier.
- Harmonic, Magnetic fields, and multiple falloff types.
.. and lots of other things, some more info is here:
http://wiki.blender.org/index.php/BlenderDev/Particles_Rewrite
http://wiki.blender.org/index.php/BlenderDev/Particles_Rewrite_Doc
The new particle system cannot be backwards compatible. Old particle
systems are being converted to the new system, but will require
tweaking to get them looking the same as before.
Point Cache
===========
The new system to replace manual baking, based on automatic caching
on disk. This is currently used by softbodies and the particle system.
See the Cache API section on:
http://wiki.blender.org/index.php/BlenderDev/PhysicsSprint
Documentation
=============
These new features still need good docs for the release logs, help
for this is appreciated.
2007-11-26 23:09:57 +01:00
|
|
|
struct MVert;
|
2019-01-28 11:08:24 +01:00
|
|
|
struct Main;
|
|
|
|
struct ModifierData;
|
|
|
|
struct Object;
|
2007-12-04 14:57:28 +01:00
|
|
|
struct RNG;
|
2019-01-28 11:08:24 +01:00
|
|
|
struct Scene;
|
Particles
=========
Merge of the famous particle patch by Janne Karhu, a full rewrite
of the Blender particle system. This includes:
- Emitter, Hair and Reactor particle types.
- Newtonian, Keyed and Boids physics.
- Various particle visualisation and rendering types.
- Vertex group and texture control for various properties.
- Interpolated child particles from parents.
- Hair editing with combing, growing, cutting, .. .
- Explode modifier.
- Harmonic, Magnetic fields, and multiple falloff types.
.. and lots of other things, some more info is here:
http://wiki.blender.org/index.php/BlenderDev/Particles_Rewrite
http://wiki.blender.org/index.php/BlenderDev/Particles_Rewrite_Doc
The new particle system cannot be backwards compatible. Old particle
systems are being converted to the new system, but will require
tweaking to get them looking the same as before.
Point Cache
===========
The new system to replace manual baking, based on automatic caching
on disk. This is currently used by softbodies and the particle system.
See the Cache API section on:
http://wiki.blender.org/index.php/BlenderDev/PhysicsSprint
Documentation
=============
These new features still need good docs for the release logs, help
for this is appreciated.
2007-11-26 23:09:57 +01:00
|
|
|
|
2016-07-22 17:55:37 +02:00
|
|
|
#define PARTICLE_COLLISION_MAX_COLLISIONS 10
|
|
|
|
|
2018-10-10 23:49:28 +02:00
|
|
|
#define PARTICLE_P \
|
|
|
|
ParticleData *pa; \
|
|
|
|
int p
|
2012-05-12 22:39:39 +02:00
|
|
|
#define LOOP_PARTICLES for (p = 0, pa = psys->particles; p < psys->totpart; p++, pa++)
|
|
|
|
#define LOOP_EXISTING_PARTICLES \
|
|
|
|
for (p = 0, pa = psys->particles; p < psys->totpart; p++, pa++) \
|
|
|
|
if (!(pa->flag & PARS_UNEXIST))
|
|
|
|
#define LOOP_SHOWN_PARTICLES \
|
|
|
|
for (p = 0, pa = psys->particles; p < psys->totpart; p++, pa++) \
|
|
|
|
if (!(pa->flag & (PARS_UNEXIST | PARS_NO_DISP)))
|
2012-01-02 13:10:50 +01:00
|
|
|
/* OpenMP: Can only advance one variable within loop definition. */
|
2012-05-12 22:39:39 +02:00
|
|
|
#define LOOP_DYNAMIC_PARTICLES \
|
|
|
|
for (p = 0; p < psys->totpart; p++) \
|
|
|
|
if ((pa = psys->particles + p)->state.time > 0.0f)
|
2009-09-18 00:00:49 +02:00
|
|
|
|
2021-06-26 13:35:18 +02:00
|
|
|
/* Fast but sure way to get the modifier. */
|
2018-10-10 23:49:28 +02:00
|
|
|
#define PARTICLE_PSMD \
|
|
|
|
ParticleSystemModifierData *psmd = sim->psmd ? sim->psmd : psys_get_modifier(sim->ob, sim->psys)
|
2009-09-18 00:00:49 +02:00
|
|
|
|
|
|
|
/* common stuff that many particle functions need */
|
|
|
|
typedef struct ParticleSimulationData {
|
2018-04-06 12:07:27 +02:00
|
|
|
struct Depsgraph *depsgraph;
|
2009-09-18 00:00:49 +02:00
|
|
|
struct Scene *scene;
|
|
|
|
struct Object *ob;
|
|
|
|
struct ParticleSystem *psys;
|
|
|
|
struct ParticleSystemModifierData *psmd;
|
Unified effector functionality for particles, cloth and softbody
* Unified scene wide gravity (currently in scene buttons)
instead of each simulation having it's own gravity.
* Weight parameters for all effectors and an effector group
setting.
* Every effector can use noise.
* Most effectors have "shapes" point, plane, surface, every point.
- "Point" is most like the old effectors and uses the
effector location as the effector point.
- "Plane" uses the closest point on effectors local xy-plane
as the effector point.
- "Surface" uses the closest point on an effector object's
surface as the effector point.
- "Every Point" uses every point in a mesh effector object
as an effector point.
- The falloff is calculated from this point, so for example
with "surface" shape and "use only negative z axis" it's
possible to apply force only "inside" the effector object.
* Spherical effector is now renamed as "force" as it's no longer
just spherical.
* New effector parameter "flow", which makes the effector act as
surrounding air velocity, so the resulting force is
proportional to the velocity difference of the point and "air
velocity". For example a wind field with flow=1.0 results in
proper non-accelerating wind.
* New effector fields "turbulence", which creates nice random
flow paths, and "drag", which slows the points down.
* Much improved vortex field.
* Effectors can now effect particle rotation as well as location.
* Use full, or only positive/negative z-axis to apply force
(note. the z-axis is the surface normal in the case of
effector shape "surface")
* New "force field" submenu in add menu, which adds an empty
with the chosen effector (curve object for corve guides).
* Other dynamics should be quite easy to add to the effector
system too if wanted.
* "Unified" doesn't mean that force fields give the exact same results for
particles, softbody & cloth, since their final effect depends on many external
factors, like for example the surface area of the effected faces.
Code changes
* Subversion bump for correct handling of global gravity.
* Separate ui py file for common dynamics stuff.
* Particle settings updating is flushed with it's id through
DAG_id_flush_update(..).
Known issues
* Curve guides don't yet have all ui buttons in place, but they
should work none the less.
* Hair dynamics don't yet respect force fields.
Other changes
* Particle emission defaults now to frames 1-200 with life of 50
frames to fill the whole default timeline.
* Many particles drawing related crashes fixed.
* Sometimes particles didn't update on first frame properly.
* Hair with object/group visualization didn't work properly.
* Memory leaks with PointCacheID lists (Genscher, remember to
free pidlists after use :).
2009-10-01 00:10:14 +02:00
|
|
|
struct ListBase *colliders;
|
2011-09-25 13:51:28 +02:00
|
|
|
/* Courant number. This is used to implement an adaptive time step. Only the
|
2012-03-03 21:19:11 +01:00
|
|
|
* maximum value per time step is important. Only sph_integrate makes use of
|
|
|
|
* this at the moment. Other solvers could, too. */
|
2011-09-25 13:51:28 +02:00
|
|
|
float courant_num;
|
2018-06-12 16:36:43 +02:00
|
|
|
/* Only valid during dynamics_step(). */
|
2018-06-14 22:44:53 +02:00
|
|
|
struct RNG *rng;
|
2009-09-18 00:00:49 +02:00
|
|
|
} ParticleSimulationData;
|
2009-09-05 01:06:15 +02:00
|
|
|
|
2012-12-14 05:57:26 +01:00
|
|
|
typedef struct SPHData {
|
|
|
|
ParticleSystem *psys[10];
|
|
|
|
ParticleData *pa;
|
|
|
|
float mass;
|
|
|
|
struct EdgeHash *eh;
|
|
|
|
float *gravity;
|
|
|
|
float hfac;
|
2019-06-12 01:04:10 +02:00
|
|
|
/* Average distance to neighbors (other particles in the support domain),
|
2013-02-02 05:58:03 +01:00
|
|
|
* for calculating the Courant number (adaptive time step). */
|
2012-12-14 05:57:26 +01:00
|
|
|
int pass;
|
|
|
|
float element_size;
|
|
|
|
float flow[3];
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2019-10-26 10:06:19 +02:00
|
|
|
/* Temporary thread-local buffer for springs created during this step. */
|
|
|
|
BLI_Buffer new_springs;
|
|
|
|
|
2012-12-14 05:57:26 +01:00
|
|
|
/* Integrator callbacks. This allows different SPH implementations. */
|
|
|
|
void (*force_cb)(void *sphdata_v, ParticleKey *state, float *force, float *impulse);
|
2016-03-19 07:16:50 +01:00
|
|
|
void (*density_cb)(void *rangedata_v, int index, const float co[3], float squared_dist);
|
2012-12-14 05:57:26 +01:00
|
|
|
} SPHData;
|
|
|
|
|
2012-04-21 15:37:26 +02:00
|
|
|
typedef struct ParticleTexture {
|
2012-05-12 22:39:39 +02:00
|
|
|
float ivel; /* used in reset */
|
|
|
|
float time, life, exist, size; /* used in init */
|
|
|
|
float damp, gravity, field; /* used in physics */
|
2015-01-14 12:29:19 +01:00
|
|
|
float length, clump, kink_freq, kink_amp, effector; /* used in path caching */
|
2012-05-12 22:39:39 +02:00
|
|
|
float rough1, rough2, roughe; /* used in path caching */
|
2018-02-14 16:46:29 +01:00
|
|
|
float twist; /* used in path caching */
|
Particles
=========
Merge of the famous particle patch by Janne Karhu, a full rewrite
of the Blender particle system. This includes:
- Emitter, Hair and Reactor particle types.
- Newtonian, Keyed and Boids physics.
- Various particle visualisation and rendering types.
- Vertex group and texture control for various properties.
- Interpolated child particles from parents.
- Hair editing with combing, growing, cutting, .. .
- Explode modifier.
- Harmonic, Magnetic fields, and multiple falloff types.
.. and lots of other things, some more info is here:
http://wiki.blender.org/index.php/BlenderDev/Particles_Rewrite
http://wiki.blender.org/index.php/BlenderDev/Particles_Rewrite_Doc
The new particle system cannot be backwards compatible. Old particle
systems are being converted to the new system, but will require
tweaking to get them looking the same as before.
Point Cache
===========
The new system to replace manual baking, based on automatic caching
on disk. This is currently used by softbodies and the particle system.
See the Cache API section on:
http://wiki.blender.org/index.php/BlenderDev/PhysicsSprint
Documentation
=============
These new features still need good docs for the release logs, help
for this is appreciated.
2007-11-26 23:09:57 +01:00
|
|
|
} ParticleTexture;
|
|
|
|
|
2012-04-21 15:37:26 +02:00
|
|
|
typedef struct ParticleSeam {
|
Particles
=========
Merge of the famous particle patch by Janne Karhu, a full rewrite
of the Blender particle system. This includes:
- Emitter, Hair and Reactor particle types.
- Newtonian, Keyed and Boids physics.
- Various particle visualisation and rendering types.
- Vertex group and texture control for various properties.
- Interpolated child particles from parents.
- Hair editing with combing, growing, cutting, .. .
- Explode modifier.
- Harmonic, Magnetic fields, and multiple falloff types.
.. and lots of other things, some more info is here:
http://wiki.blender.org/index.php/BlenderDev/Particles_Rewrite
http://wiki.blender.org/index.php/BlenderDev/Particles_Rewrite_Doc
The new particle system cannot be backwards compatible. Old particle
systems are being converted to the new system, but will require
tweaking to get them looking the same as before.
Point Cache
===========
The new system to replace manual baking, based on automatic caching
on disk. This is currently used by softbodies and the particle system.
See the Cache API section on:
http://wiki.blender.org/index.php/BlenderDev/PhysicsSprint
Documentation
=============
These new features still need good docs for the release logs, help
for this is appreciated.
2007-11-26 23:09:57 +01:00
|
|
|
float v0[3], v1[3];
|
|
|
|
float nor[3], dir[3], tan[3];
|
|
|
|
float length2;
|
|
|
|
} ParticleSeam;
|
|
|
|
|
2012-04-21 15:37:26 +02:00
|
|
|
typedef struct ParticleCacheKey {
|
Particles
=========
Merge of the famous particle patch by Janne Karhu, a full rewrite
of the Blender particle system. This includes:
- Emitter, Hair and Reactor particle types.
- Newtonian, Keyed and Boids physics.
- Various particle visualisation and rendering types.
- Vertex group and texture control for various properties.
- Interpolated child particles from parents.
- Hair editing with combing, growing, cutting, .. .
- Explode modifier.
- Harmonic, Magnetic fields, and multiple falloff types.
.. and lots of other things, some more info is here:
http://wiki.blender.org/index.php/BlenderDev/Particles_Rewrite
http://wiki.blender.org/index.php/BlenderDev/Particles_Rewrite_Doc
The new particle system cannot be backwards compatible. Old particle
systems are being converted to the new system, but will require
tweaking to get them looking the same as before.
Point Cache
===========
The new system to replace manual baking, based on automatic caching
on disk. This is currently used by softbodies and the particle system.
See the Cache API section on:
http://wiki.blender.org/index.php/BlenderDev/PhysicsSprint
Documentation
=============
These new features still need good docs for the release logs, help
for this is appreciated.
2007-11-26 23:09:57 +01:00
|
|
|
float co[3];
|
|
|
|
float vel[3];
|
2007-12-20 17:35:27 +01:00
|
|
|
float rot[4];
|
2008-03-26 19:34:24 +01:00
|
|
|
float col[3];
|
2009-08-29 17:20:36 +02:00
|
|
|
float time;
|
2015-01-13 17:24:20 +01:00
|
|
|
int segments;
|
Particles
=========
Merge of the famous particle patch by Janne Karhu, a full rewrite
of the Blender particle system. This includes:
- Emitter, Hair and Reactor particle types.
- Newtonian, Keyed and Boids physics.
- Various particle visualisation and rendering types.
- Vertex group and texture control for various properties.
- Interpolated child particles from parents.
- Hair editing with combing, growing, cutting, .. .
- Explode modifier.
- Harmonic, Magnetic fields, and multiple falloff types.
.. and lots of other things, some more info is here:
http://wiki.blender.org/index.php/BlenderDev/Particles_Rewrite
http://wiki.blender.org/index.php/BlenderDev/Particles_Rewrite_Doc
The new particle system cannot be backwards compatible. Old particle
systems are being converted to the new system, but will require
tweaking to get them looking the same as before.
Point Cache
===========
The new system to replace manual baking, based on automatic caching
on disk. This is currently used by softbodies and the particle system.
See the Cache API section on:
http://wiki.blender.org/index.php/BlenderDev/PhysicsSprint
Documentation
=============
These new features still need good docs for the release logs, help
for this is appreciated.
2007-11-26 23:09:57 +01:00
|
|
|
} ParticleCacheKey;
|
|
|
|
|
2007-12-04 14:57:28 +01:00
|
|
|
typedef struct ParticleThreadContext {
|
|
|
|
/* shared */
|
2009-09-18 00:00:49 +02:00
|
|
|
struct ParticleSimulationData sim;
|
2018-05-15 13:26:40 +02:00
|
|
|
struct Mesh *mesh;
|
2007-12-04 14:57:28 +01:00
|
|
|
struct Material *ma;
|
|
|
|
|
|
|
|
/* distribution */
|
2019-03-19 14:46:33 +01:00
|
|
|
struct KDTree_3d *tree;
|
2007-12-04 14:57:28 +01:00
|
|
|
|
|
|
|
struct ParticleSeam *seams;
|
|
|
|
int totseam;
|
|
|
|
|
|
|
|
float *jit, *jitoff, *weight;
|
|
|
|
float maxweight;
|
2018-04-08 09:28:52 +02:00
|
|
|
int *index, jitlevel;
|
2007-12-04 14:57:28 +01:00
|
|
|
|
2014-10-28 17:09:45 +01:00
|
|
|
int cfrom, distr;
|
2007-12-04 14:57:28 +01:00
|
|
|
|
2007-12-18 17:55:09 +01:00
|
|
|
struct ParticleData *tpars;
|
|
|
|
|
2007-12-04 14:57:28 +01:00
|
|
|
/* path caching */
|
2016-06-22 23:53:49 +02:00
|
|
|
bool editupdate;
|
|
|
|
int between, segments, extra_segments;
|
2009-04-20 17:06:46 +02:00
|
|
|
int totchild, totparent, parent_pass;
|
2007-12-04 14:57:28 +01:00
|
|
|
|
|
|
|
float cfra;
|
|
|
|
|
|
|
|
float *vg_length, *vg_clump, *vg_kink;
|
|
|
|
float *vg_rough1, *vg_rough2, *vg_roughe;
|
2008-02-15 13:54:43 +01:00
|
|
|
float *vg_effector;
|
2018-02-14 16:46:29 +01:00
|
|
|
float *vg_twist;
|
2016-02-02 15:01:58 +01:00
|
|
|
|
|
|
|
struct CurveMapping *clumpcurve;
|
|
|
|
struct CurveMapping *roughcurve;
|
2018-02-14 14:33:53 +01:00
|
|
|
struct CurveMapping *twistcurve;
|
2007-12-04 14:57:28 +01:00
|
|
|
} ParticleThreadContext;
|
|
|
|
|
2014-10-06 18:58:41 +02:00
|
|
|
typedef struct ParticleTask {
|
2007-12-04 14:57:28 +01:00
|
|
|
ParticleThreadContext *ctx;
|
|
|
|
struct RNG *rng, *rng_path;
|
2014-10-06 18:58:41 +02:00
|
|
|
int begin, end;
|
|
|
|
} ParticleTask;
|
2007-12-04 14:57:28 +01:00
|
|
|
|
2012-05-12 22:39:39 +02:00
|
|
|
typedef struct ParticleCollisionElement {
|
2011-03-18 16:31:32 +01:00
|
|
|
/* pointers to original data */
|
2015-07-31 06:00:07 +02:00
|
|
|
float *x[3], *v[3];
|
2011-03-18 16:31:32 +01:00
|
|
|
|
2021-06-26 13:35:18 +02:00
|
|
|
/* Values interpolated from original data. */
|
2011-03-18 16:31:32 +01:00
|
|
|
float x0[3], x1[3], x2[3], p[3];
|
2018-06-17 17:05:51 +02:00
|
|
|
|
2011-03-18 16:31:32 +01:00
|
|
|
/* results for found intersection point */
|
|
|
|
float nor[3], vel[3], uv[2];
|
|
|
|
|
|
|
|
/* count of original data (1-4) */
|
|
|
|
int tot;
|
|
|
|
|
2011-03-29 12:27:31 +02:00
|
|
|
/* index of the collision face */
|
|
|
|
int index;
|
|
|
|
|
2011-03-18 16:31:32 +01:00
|
|
|
/* flags for inversed normal / particle already inside element at start */
|
|
|
|
short inv_nor, inside;
|
|
|
|
} ParticleCollisionElement;
|
|
|
|
|
2019-05-01 03:09:22 +02:00
|
|
|
/** Container for moving data between deflet_particle and particle_intersect_face. */
|
2012-05-12 22:39:39 +02:00
|
|
|
typedef struct ParticleCollision {
|
2011-03-18 16:31:32 +01:00
|
|
|
struct Object *current;
|
|
|
|
struct Object *hit;
|
2017-03-11 16:40:04 +01:00
|
|
|
struct Object *skip[PARTICLE_COLLISION_MAX_COLLISIONS + 1];
|
2011-03-18 16:31:32 +01:00
|
|
|
struct Object *emitter;
|
|
|
|
|
2019-05-01 03:09:22 +02:00
|
|
|
/** Collision modifier for current object. */
|
|
|
|
struct CollisionModifierData *md;
|
2011-03-18 16:31:32 +01:00
|
|
|
|
2020-08-04 13:26:21 +02:00
|
|
|
/** Time factor of previous collision, needed for subtracting face velocity. */
|
2019-05-01 03:09:22 +02:00
|
|
|
float f;
|
2011-03-18 16:31:32 +01:00
|
|
|
float fac1, fac2;
|
|
|
|
|
|
|
|
float cfra, old_cfra;
|
|
|
|
|
2019-05-01 03:09:22 +02:00
|
|
|
/** Original length of co2-co1, needed for collision time evaluation. */
|
|
|
|
float original_ray_length;
|
2011-03-18 16:31:32 +01:00
|
|
|
|
2016-07-22 17:55:37 +02:00
|
|
|
int skip_count;
|
2011-03-18 16:31:32 +01:00
|
|
|
|
|
|
|
ParticleCollisionElement pce;
|
|
|
|
|
2013-02-19 03:24:52 +01:00
|
|
|
/* total_time is the amount of time in this subframe
|
|
|
|
* inv_total_time is the opposite
|
|
|
|
* inv_timestep is the inverse of the amount of time in this frame */
|
|
|
|
float total_time, inv_total_time, inv_timestep;
|
2011-03-18 16:31:32 +01:00
|
|
|
|
|
|
|
float radius;
|
|
|
|
float co1[3], co2[3];
|
|
|
|
float ve1[3], ve2[3];
|
|
|
|
|
|
|
|
float acc[3], boid_z;
|
|
|
|
|
|
|
|
int boid;
|
2009-09-18 00:00:49 +02:00
|
|
|
} ParticleCollision;
|
|
|
|
|
|
|
|
typedef struct ParticleDrawData {
|
2012-05-12 22:39:39 +02:00
|
|
|
float *vdata, *vd; /* vertice data */
|
|
|
|
float *ndata, *nd; /* normal data */
|
|
|
|
float *cdata, *cd; /* color data */
|
|
|
|
float *vedata, *ved; /* velocity data */
|
2011-11-26 04:13:54 +01:00
|
|
|
float *ma_col;
|
2018-01-15 06:57:26 +01:00
|
|
|
int totpart, partsize;
|
|
|
|
int flag;
|
2009-09-18 00:00:49 +02:00
|
|
|
int totpoint, totve;
|
|
|
|
} ParticleDrawData;
|
|
|
|
|
|
|
|
#define PARTICLE_DRAW_DATA_UPDATED 1
|
2009-07-21 01:52:53 +02:00
|
|
|
|
2014-03-07 10:25:56 +01:00
|
|
|
#define PSYS_FRAND_COUNT 1024
|
2014-03-07 13:18:15 +01:00
|
|
|
extern unsigned int PSYS_FRAND_SEED_OFFSET[PSYS_FRAND_COUNT];
|
|
|
|
extern unsigned int PSYS_FRAND_SEED_MULTIPLIER[PSYS_FRAND_COUNT];
|
|
|
|
extern float PSYS_FRAND_BASE[PSYS_FRAND_COUNT];
|
2014-03-07 10:25:56 +01:00
|
|
|
|
2020-11-06 06:43:09 +01:00
|
|
|
void BKE_particle_init_rng(void);
|
2014-03-07 10:25:56 +01:00
|
|
|
|
|
|
|
BLI_INLINE float psys_frand(ParticleSystem *psys, unsigned int seed)
|
|
|
|
{
|
|
|
|
/* XXX far from ideal, this simply scrambles particle random numbers a bit
|
|
|
|
* to avoid obvious correlations.
|
|
|
|
* Can't use previous psys->frand arrays because these require initialization
|
2020-04-09 02:51:34 +02:00
|
|
|
* inside psys_check_enabled, which wreaks havoc in multi-threaded depsgraph updates.
|
2014-03-07 10:25:56 +01:00
|
|
|
*/
|
|
|
|
unsigned int offset = PSYS_FRAND_SEED_OFFSET[psys->seed % PSYS_FRAND_COUNT];
|
|
|
|
unsigned int multiplier = PSYS_FRAND_SEED_MULTIPLIER[psys->seed % PSYS_FRAND_COUNT];
|
|
|
|
return PSYS_FRAND_BASE[(offset + seed * multiplier) % PSYS_FRAND_COUNT];
|
|
|
|
}
|
|
|
|
|
|
|
|
BLI_INLINE void psys_frand_vec(ParticleSystem *psys, unsigned int seed, float vec[3])
|
|
|
|
{
|
|
|
|
unsigned int offset = PSYS_FRAND_SEED_OFFSET[psys->seed % PSYS_FRAND_COUNT];
|
|
|
|
unsigned int multiplier = PSYS_FRAND_SEED_MULTIPLIER[psys->seed % PSYS_FRAND_COUNT];
|
|
|
|
vec[0] = PSYS_FRAND_BASE[(offset + (seed + 0) * multiplier) % PSYS_FRAND_COUNT];
|
|
|
|
vec[1] = PSYS_FRAND_BASE[(offset + (seed + 1) * multiplier) % PSYS_FRAND_COUNT];
|
|
|
|
vec[2] = PSYS_FRAND_BASE[(offset + (seed + 2) * multiplier) % PSYS_FRAND_COUNT];
|
|
|
|
}
|
|
|
|
|
Particles
=========
Merge of the famous particle patch by Janne Karhu, a full rewrite
of the Blender particle system. This includes:
- Emitter, Hair and Reactor particle types.
- Newtonian, Keyed and Boids physics.
- Various particle visualisation and rendering types.
- Vertex group and texture control for various properties.
- Interpolated child particles from parents.
- Hair editing with combing, growing, cutting, .. .
- Explode modifier.
- Harmonic, Magnetic fields, and multiple falloff types.
.. and lots of other things, some more info is here:
http://wiki.blender.org/index.php/BlenderDev/Particles_Rewrite
http://wiki.blender.org/index.php/BlenderDev/Particles_Rewrite_Doc
The new particle system cannot be backwards compatible. Old particle
systems are being converted to the new system, but will require
tweaking to get them looking the same as before.
Point Cache
===========
The new system to replace manual baking, based on automatic caching
on disk. This is currently used by softbodies and the particle system.
See the Cache API section on:
http://wiki.blender.org/index.php/BlenderDev/PhysicsSprint
Documentation
=============
These new features still need good docs for the release logs, help
for this is appreciated.
2007-11-26 23:09:57 +01:00
|
|
|
/* ----------- functions needed outside particlesystem ---------------- */
|
|
|
|
/* particle.c */
|
2021-12-07 07:19:15 +01:00
|
|
|
|
|
|
|
/* Few helpers for count-all etc. */
|
|
|
|
|
Particles
=========
Merge of the famous particle patch by Janne Karhu, a full rewrite
of the Blender particle system. This includes:
- Emitter, Hair and Reactor particle types.
- Newtonian, Keyed and Boids physics.
- Various particle visualisation and rendering types.
- Vertex group and texture control for various properties.
- Interpolated child particles from parents.
- Hair editing with combing, growing, cutting, .. .
- Explode modifier.
- Harmonic, Magnetic fields, and multiple falloff types.
.. and lots of other things, some more info is here:
http://wiki.blender.org/index.php/BlenderDev/Particles_Rewrite
http://wiki.blender.org/index.php/BlenderDev/Particles_Rewrite_Doc
The new particle system cannot be backwards compatible. Old particle
systems are being converted to the new system, but will require
tweaking to get them looking the same as before.
Point Cache
===========
The new system to replace manual baking, based on automatic caching
on disk. This is currently used by softbodies and the particle system.
See the Cache API section on:
http://wiki.blender.org/index.php/BlenderDev/PhysicsSprint
Documentation
=============
These new features still need good docs for the release logs, help
for this is appreciated.
2007-11-26 23:09:57 +01:00
|
|
|
int count_particles(struct ParticleSystem *psys);
|
|
|
|
int count_particles_mod(struct ParticleSystem *psys, int totgr, int cur);
|
|
|
|
|
2018-04-08 09:28:52 +02:00
|
|
|
int psys_get_child_number(struct Scene *scene,
|
|
|
|
struct ParticleSystem *psys,
|
|
|
|
const bool use_render_params);
|
|
|
|
int psys_get_tot_child(struct Scene *scene,
|
|
|
|
struct ParticleSystem *psys,
|
|
|
|
const bool use_render_params);
|
2014-10-28 16:29:33 +01:00
|
|
|
|
2021-12-07 07:19:15 +01:00
|
|
|
/**
|
|
|
|
* Get object's active particle system safely.
|
|
|
|
*/
|
Particles
=========
Merge of the famous particle patch by Janne Karhu, a full rewrite
of the Blender particle system. This includes:
- Emitter, Hair and Reactor particle types.
- Newtonian, Keyed and Boids physics.
- Various particle visualisation and rendering types.
- Vertex group and texture control for various properties.
- Interpolated child particles from parents.
- Hair editing with combing, growing, cutting, .. .
- Explode modifier.
- Harmonic, Magnetic fields, and multiple falloff types.
.. and lots of other things, some more info is here:
http://wiki.blender.org/index.php/BlenderDev/Particles_Rewrite
http://wiki.blender.org/index.php/BlenderDev/Particles_Rewrite_Doc
The new particle system cannot be backwards compatible. Old particle
systems are being converted to the new system, but will require
tweaking to get them looking the same as before.
Point Cache
===========
The new system to replace manual baking, based on automatic caching
on disk. This is currently used by softbodies and the particle system.
See the Cache API section on:
http://wiki.blender.org/index.php/BlenderDev/PhysicsSprint
Documentation
=============
These new features still need good docs for the release logs, help
for this is appreciated.
2007-11-26 23:09:57 +01:00
|
|
|
struct ParticleSystem *psys_get_current(struct Object *ob);
|
2021-12-07 07:19:15 +01:00
|
|
|
|
|
|
|
/* For RNA API. */
|
|
|
|
|
Particles
=========
Merge of the famous particle patch by Janne Karhu, a full rewrite
of the Blender particle system. This includes:
- Emitter, Hair and Reactor particle types.
- Newtonian, Keyed and Boids physics.
- Various particle visualisation and rendering types.
- Vertex group and texture control for various properties.
- Interpolated child particles from parents.
- Hair editing with combing, growing, cutting, .. .
- Explode modifier.
- Harmonic, Magnetic fields, and multiple falloff types.
.. and lots of other things, some more info is here:
http://wiki.blender.org/index.php/BlenderDev/Particles_Rewrite
http://wiki.blender.org/index.php/BlenderDev/Particles_Rewrite_Doc
The new particle system cannot be backwards compatible. Old particle
systems are being converted to the new system, but will require
tweaking to get them looking the same as before.
Point Cache
===========
The new system to replace manual baking, based on automatic caching
on disk. This is currently used by softbodies and the particle system.
See the Cache API section on:
http://wiki.blender.org/index.php/BlenderDev/PhysicsSprint
Documentation
=============
These new features still need good docs for the release logs, help
for this is appreciated.
2007-11-26 23:09:57 +01:00
|
|
|
short psys_get_current_num(struct Object *ob);
|
2020-12-15 00:47:58 +01:00
|
|
|
void psys_set_current_num(struct Object *ob, int index);
|
2013-04-03 17:04:24 +02:00
|
|
|
/* UNUSED */
|
|
|
|
// struct Object *psys_find_object(struct Scene *scene, struct ParticleSystem *psys);
|
2009-09-18 00:00:49 +02:00
|
|
|
|
2013-08-19 12:11:48 +02:00
|
|
|
struct LatticeDeformData *psys_create_lattice_deform_data(struct ParticleSimulationData *sim);
|
2009-09-18 00:00:49 +02:00
|
|
|
|
2021-12-07 07:19:15 +01:00
|
|
|
/**
|
|
|
|
* For a given evaluated particle system get its original.
|
2019-01-04 14:28:47 +01:00
|
|
|
*
|
2021-12-07 07:19:15 +01:00
|
|
|
* If this input is an original particle system already, the return value is the same as the input.
|
|
|
|
*/
|
2018-05-15 14:50:24 +02:00
|
|
|
struct ParticleSystem *psys_orig_get(struct ParticleSystem *psys);
|
2019-01-04 14:28:47 +01:00
|
|
|
|
2021-12-07 07:19:15 +01:00
|
|
|
/**
|
|
|
|
* For a given original object and its particle system,
|
|
|
|
* get evaluated particle system within a given dependency graph.
|
|
|
|
*/
|
2019-01-04 14:28:47 +01:00
|
|
|
struct ParticleSystem *psys_eval_get(struct Depsgraph *depsgraph,
|
|
|
|
struct Object *object,
|
|
|
|
struct ParticleSystem *psys);
|
|
|
|
|
2018-10-08 01:43:34 +02:00
|
|
|
bool psys_in_edit_mode(struct Depsgraph *depsgraph, const struct ParticleSystem *psys);
|
2016-06-22 23:53:49 +02:00
|
|
|
bool psys_check_enabled(struct Object *ob,
|
|
|
|
struct ParticleSystem *psys,
|
|
|
|
const bool use_render_params);
|
2015-02-20 09:54:28 +01:00
|
|
|
bool psys_check_edited(struct ParticleSystem *psys);
|
Particles
=========
Merge of the famous particle patch by Janne Karhu, a full rewrite
of the Blender particle system. This includes:
- Emitter, Hair and Reactor particle types.
- Newtonian, Keyed and Boids physics.
- Various particle visualisation and rendering types.
- Vertex group and texture control for various properties.
- Interpolated child particles from parents.
- Hair editing with combing, growing, cutting, .. .
- Explode modifier.
- Harmonic, Magnetic fields, and multiple falloff types.
.. and lots of other things, some more info is here:
http://wiki.blender.org/index.php/BlenderDev/Particles_Rewrite
http://wiki.blender.org/index.php/BlenderDev/Particles_Rewrite_Doc
The new particle system cannot be backwards compatible. Old particle
systems are being converted to the new system, but will require
tweaking to get them looking the same as before.
Point Cache
===========
The new system to replace manual baking, based on automatic caching
on disk. This is currently used by softbodies and the particle system.
See the Cache API section on:
http://wiki.blender.org/index.php/BlenderDev/PhysicsSprint
Documentation
=============
These new features still need good docs for the release logs, help
for this is appreciated.
2007-11-26 23:09:57 +01:00
|
|
|
|
2018-06-28 14:29:54 +02:00
|
|
|
void psys_find_group_weights(struct ParticleSettings *part);
|
2009-10-05 15:25:56 +02:00
|
|
|
void psys_check_group_weights(struct ParticleSettings *part);
|
2009-12-30 16:58:59 +01:00
|
|
|
int psys_uses_gravity(struct ParticleSimulationData *sim);
|
2018-06-04 17:55:19 +02:00
|
|
|
void BKE_particlesettings_fluid_default_settings(struct ParticleSettings *part);
|
2009-10-05 15:25:56 +02:00
|
|
|
|
2021-12-07 07:19:15 +01:00
|
|
|
/**
|
|
|
|
* Free cache path.
|
|
|
|
*/
|
2009-08-29 17:20:36 +02:00
|
|
|
void psys_free_path_cache(struct ParticleSystem *psys, struct PTCacheEdit *edit);
|
2021-12-07 07:19:15 +01:00
|
|
|
/**
|
|
|
|
* Free everything.
|
|
|
|
*/
|
2012-05-12 22:39:39 +02:00
|
|
|
void psys_free(struct Object *ob, struct ParticleSystem *psys);
|
2021-12-07 07:19:15 +01:00
|
|
|
/**
|
|
|
|
* Copy.
|
|
|
|
*/
|
2018-06-19 11:40:09 +02:00
|
|
|
void psys_copy_particles(struct ParticleSystem *psys_dst, struct ParticleSystem *psys_src);
|
|
|
|
|
2014-04-01 02:34:00 +02:00
|
|
|
bool psys_render_simplify_params(struct ParticleSystem *psys,
|
|
|
|
struct ChildParticle *cpa,
|
|
|
|
float *params);
|
2007-12-18 17:55:09 +01:00
|
|
|
|
2011-11-06 15:00:55 +01:00
|
|
|
void psys_interpolate_uvs(const struct MTFace *tface, int quad, const float w[4], float uvco[2]);
|
|
|
|
void psys_interpolate_mcol(const struct MCol *mcol, int quad, const float w[4], struct MCol *mc);
|
Particles
=========
Merge of the famous particle patch by Janne Karhu, a full rewrite
of the Blender particle system. This includes:
- Emitter, Hair and Reactor particle types.
- Newtonian, Keyed and Boids physics.
- Various particle visualisation and rendering types.
- Vertex group and texture control for various properties.
- Interpolated child particles from parents.
- Hair editing with combing, growing, cutting, .. .
- Explode modifier.
- Harmonic, Magnetic fields, and multiple falloff types.
.. and lots of other things, some more info is here:
http://wiki.blender.org/index.php/BlenderDev/Particles_Rewrite
http://wiki.blender.org/index.php/BlenderDev/Particles_Rewrite_Doc
The new particle system cannot be backwards compatible. Old particle
systems are being converted to the new system, but will require
tweaking to get them looking the same as before.
Point Cache
===========
The new system to replace manual baking, based on automatic caching
on disk. This is currently used by softbodies and the particle system.
See the Cache API section on:
http://wiki.blender.org/index.php/BlenderDev/PhysicsSprint
Documentation
=============
These new features still need good docs for the release logs, help
for this is appreciated.
2007-11-26 23:09:57 +01:00
|
|
|
|
|
|
|
void copy_particle_key(struct ParticleKey *to, struct ParticleKey *from, int time);
|
|
|
|
|
Refactor CDData masks, to have one mask per mesh elem type.
We already have different storages for cddata of verts, edges etc.,
'simply' do the same for the mask flags we use all around Blender code
to request some data, or limit some operation to some layers, etc.
Reason we need this is that some cddata types (like Normals) are
actually shared between verts/polys/loops, and we don’t want to generate
clnors everytime we request vnors!
As a side note, this also does final fix to T59338, which was the
trigger for this patch (need to request computed loop normals for
another mesh than evaluated one).
Reviewers: brecht, campbellbarton, sergey
Differential Revision: https://developer.blender.org/D4407
2019-03-07 11:13:40 +01:00
|
|
|
void psys_emitter_customdata_mask(struct ParticleSystem *psys,
|
|
|
|
struct CustomData_MeshMasks *r_cddata_masks);
|
2012-10-20 10:02:18 +02:00
|
|
|
void psys_particle_on_emitter(struct ParticleSystemModifierData *psmd,
|
2020-09-04 20:59:13 +02:00
|
|
|
int from,
|
2012-10-20 10:02:18 +02:00
|
|
|
int index,
|
|
|
|
int index_dmcache,
|
|
|
|
float fuv[4],
|
|
|
|
float foffset,
|
|
|
|
float vec[3],
|
|
|
|
float nor[3],
|
Remove Blender Internal and legacy viewport from Blender 2.8.
Brecht authored this commit, but he gave me the honours to actually
do it. Here it goes; Blender Internal. Bye bye, you did great!
* Point density, voxel data, ocean, environment map textures were removed,
as these only worked within BI rendering. Note that the ocean modifier
and the Cycles point density shader node continue to work.
* Dynamic paint using material shading was removed, as this only worked
with BI. If we ever wanted to support this again probably it should go
through the baking API.
* GPU shader export through the Python API was removed. This only worked
for the old BI GLSL shaders, which no longer exists. Doing something
similar for Eevee would be significantly more complicated because it
uses a lot of multiplass rendering and logic outside the shader, it's
probably impractical.
* Collada material import / export code is mostly gone, as it only worked
for BI materials. We need to add Cycles / Eevee material support at some
point.
* The mesh noise operator was removed since it only worked with BI
material texture slots. A displacement modifier can be used instead.
* The delete texture paint slot operator was removed since it only worked
for BI material texture slots. Could be added back with node support.
* Not all legacy viewport features are supported in the new viewport, but
their code was removed. If we need to bring anything back we can look at
older git revisions.
* There is some legacy viewport code that I could not remove yet, and some
that I probably missed.
* Shader node execution code was left mostly intact, even though it is not
used anywhere now. We may eventually use this to replace the texture
nodes with Cycles / Eevee shader nodes.
* The Cycles Bake panel now includes settings for baking multires normal
and displacement maps. The underlying code needs to be merged properly,
and we plan to add back support for multires AO baking and add support
to Cycles baking for features like vertex color, displacement, and other
missing baking features.
* This commit removes DNA and the Python API for BI material, lamp, world
and scene settings. This breaks a lot of addons.
* There is more DNA that can be removed or renamed, where Cycles or Eevee
are reusing some old BI properties but the names are not really correct
anymore.
* Texture slots for materials, lamps and world were removed. They remain
for brushes, particles and freestyle linestyles.
* 'BLENDER_RENDER' remains in the COMPAT_ENGINES of UI panels. Cycles and
other renderers use this to find all panels to show, minus a few panels
that they have their own replacement for.
2018-04-19 17:34:44 +02:00
|
|
|
float utan[3],
|
|
|
|
float vtan[3],
|
|
|
|
float orco[3]);
|
Particles
=========
Merge of the famous particle patch by Janne Karhu, a full rewrite
of the Blender particle system. This includes:
- Emitter, Hair and Reactor particle types.
- Newtonian, Keyed and Boids physics.
- Various particle visualisation and rendering types.
- Vertex group and texture control for various properties.
- Interpolated child particles from parents.
- Hair editing with combing, growing, cutting, .. .
- Explode modifier.
- Harmonic, Magnetic fields, and multiple falloff types.
.. and lots of other things, some more info is here:
http://wiki.blender.org/index.php/BlenderDev/Particles_Rewrite
http://wiki.blender.org/index.php/BlenderDev/Particles_Rewrite_Doc
The new particle system cannot be backwards compatible. Old particle
systems are being converted to the new system, but will require
tweaking to get them looking the same as before.
Point Cache
===========
The new system to replace manual baking, based on automatic caching
on disk. This is currently used by softbodies and the particle system.
See the Cache API section on:
http://wiki.blender.org/index.php/BlenderDev/PhysicsSprint
Documentation
=============
These new features still need good docs for the release logs, help
for this is appreciated.
2007-11-26 23:09:57 +01:00
|
|
|
struct ParticleSystemModifierData *psys_get_modifier(struct Object *ob,
|
|
|
|
struct ParticleSystem *psys);
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2018-06-13 10:57:10 +02:00
|
|
|
struct ModifierData *object_add_particle_system(struct Main *bmain,
|
|
|
|
struct Scene *scene,
|
|
|
|
struct Object *ob,
|
|
|
|
const char *name);
|
2020-07-09 11:44:11 +02:00
|
|
|
struct ModifierData *object_copy_particle_system(struct Main *bmain,
|
|
|
|
struct Scene *scene,
|
|
|
|
struct Object *ob,
|
|
|
|
const struct ParticleSystem *psys_orig);
|
2021-08-24 18:38:28 +02:00
|
|
|
void object_remove_particle_system(struct Main *bmain,
|
|
|
|
struct Scene *scene,
|
|
|
|
struct Object *ob,
|
|
|
|
struct ParticleSystem *psys);
|
2018-06-13 10:57:10 +02:00
|
|
|
struct ParticleSettings *BKE_particlesettings_add(struct Main *bmain, const char *name);
|
Point Cache Refactoring
=======================
Caching and Baking:
- The point cache is now cleared on DAG_object_flush_update(), and not cleared for time dependency graph updates.
- There is now a Bake button instead of Protect. Also cache start and end frames were added to softbody and particles.
- The cloth autoprotect feature was removed.
- The Ctrl+B menu now also bakes cloth and particles next to softbody and fluids. Additionally there are now frree bake and free cache menu entries.
- The point cache api has been changed. There is now a PTCacheID struct for each point cache type that can be filled and then used to call the point cache functions.
- PointCache struct was added to DNA and is automatically allocated for each physics type.
- Soft body now supports Bake Editing just like cloth.
- Tried to make the systems deal consistently with time ipo's and offsets. Still not sure it all works correct, but too complicated to solve completely now.
Library Linking:
- Added some more warnings to prevent editing settings on library linked objects.
- Linked objects now read from the cache located next to the original library file, and never write to it. This restores old behavior for softbodies. For local simulation the mesh and not the object should be linked.
- Dupligroups and proxies can't create local point caches at the moment, how to implement that I'm not sure. We probably need a proxy point cache for that to work (ugh).
Physics UI:
- Renamed deflection panel to collision for consistency and reorganized the buttons. Also removed some softbody collision buttons from the softbody panel that were duplicated in this panel for cloth.
- Tweaked field panel buttons to not jump around when changing options.
- Tabbing e.g. Soft Body Collision into the Soft Body panel, it now only shows Collision to make the panel names readable.
- I tried to make enabled/disabling physics more consistent, since all three system did things different. Now the two modifier buttons to enable the modifier for the viewport and rendering are also duplicated in the physics panels. Toggling the Soft Body and Cloth buttons now both remove their modifiers.
- Fixed modifier error drawing glitch.
Particles:
- Particles are now recalculated more often than before. Previously it did partial updates based on the changes, but that doesn't work well with DAG_object_flush_update() ..
- Fixed memory leak loading keyed particle system. Now keys are not written to file anymore but always created after loading.
- Make particle threads work with autothreads.
Continue Physics:
- The timeline play now has a Continue Physics option in the playback menu, which keeps the simulations going without writing them to the cache.
- This doesn't always work that well, some changes are not immediately updated, but this can be improved later. Still it's fun to get a feel for the physics.
Todo:
- Point cache can get out of sync with and undo and changing a file without saving it.
- Change the point cache file format to store a version (so old point cache files can be either converted or at least ignored), and to do correct endian conversion.
- Menu item and/or buttons for Ctrl+B.
- A system("rm ..") was changed to remove() since the former is very slow for clearing point caches. These system() calls were already giving trouble in a bug in the tracker, but really most use of this system("") should be changed and tested.
- The Soft Body Collision and Clot Collision panel titles don't mention there's point cache settings there too, doing that makes them unreadable with the default panel setup.. but may need to make the names longer anyway.
2008-04-10 13:39:20 +02:00
|
|
|
void psys_reset(struct ParticleSystem *psys, int mode);
|
|
|
|
|
2016-06-22 23:53:49 +02:00
|
|
|
void psys_find_parents(struct ParticleSimulationData *sim, const bool use_render_params);
|
Particles
=========
Merge of the famous particle patch by Janne Karhu, a full rewrite
of the Blender particle system. This includes:
- Emitter, Hair and Reactor particle types.
- Newtonian, Keyed and Boids physics.
- Various particle visualisation and rendering types.
- Vertex group and texture control for various properties.
- Interpolated child particles from parents.
- Hair editing with combing, growing, cutting, .. .
- Explode modifier.
- Harmonic, Magnetic fields, and multiple falloff types.
.. and lots of other things, some more info is here:
http://wiki.blender.org/index.php/BlenderDev/Particles_Rewrite
http://wiki.blender.org/index.php/BlenderDev/Particles_Rewrite_Doc
The new particle system cannot be backwards compatible. Old particle
systems are being converted to the new system, but will require
tweaking to get them looking the same as before.
Point Cache
===========
The new system to replace manual baking, based on automatic caching
on disk. This is currently used by softbodies and the particle system.
See the Cache API section on:
http://wiki.blender.org/index.php/BlenderDev/PhysicsSprint
Documentation
=============
These new features still need good docs for the release logs, help
for this is appreciated.
2007-11-26 23:09:57 +01:00
|
|
|
|
2019-03-05 15:24:54 +01:00
|
|
|
void psys_unique_name(struct Object *object, struct ParticleSystem *psys, const char *defname);
|
|
|
|
|
2021-12-07 07:19:15 +01:00
|
|
|
/**
|
|
|
|
* Calculates paths ready for drawing/rendering
|
|
|
|
* - Useful for making use of opengl vertex arrays for super fast strand drawing.
|
|
|
|
* - Makes child strands possible and creates them too into the cache.
|
|
|
|
* - Cached path data is also used to determine cut position for the edit-mode tool.
|
|
|
|
*/
|
2016-06-22 23:53:49 +02:00
|
|
|
void psys_cache_paths(struct ParticleSimulationData *sim,
|
|
|
|
float cfra,
|
|
|
|
const bool use_render_params);
|
2018-04-06 12:07:27 +02:00
|
|
|
void psys_cache_edit_paths(struct Depsgraph *depsgraph,
|
|
|
|
struct Scene *scene,
|
|
|
|
struct Object *ob,
|
|
|
|
struct PTCacheEdit *edit,
|
|
|
|
float cfra,
|
|
|
|
const bool use_render_params);
|
2016-06-22 23:53:49 +02:00
|
|
|
void psys_cache_child_paths(struct ParticleSimulationData *sim,
|
|
|
|
float cfra,
|
|
|
|
const bool editupdate,
|
|
|
|
const bool use_render_params);
|
2018-04-06 12:07:27 +02:00
|
|
|
int do_guides(struct Depsgraph *depsgraph,
|
|
|
|
struct ParticleSettings *part,
|
|
|
|
struct ListBase *effectors,
|
|
|
|
ParticleKey *state,
|
2020-09-04 20:59:13 +02:00
|
|
|
int index,
|
2018-04-06 12:07:27 +02:00
|
|
|
float time);
|
Unified effector functionality for particles, cloth and softbody
* Unified scene wide gravity (currently in scene buttons)
instead of each simulation having it's own gravity.
* Weight parameters for all effectors and an effector group
setting.
* Every effector can use noise.
* Most effectors have "shapes" point, plane, surface, every point.
- "Point" is most like the old effectors and uses the
effector location as the effector point.
- "Plane" uses the closest point on effectors local xy-plane
as the effector point.
- "Surface" uses the closest point on an effector object's
surface as the effector point.
- "Every Point" uses every point in a mesh effector object
as an effector point.
- The falloff is calculated from this point, so for example
with "surface" shape and "use only negative z axis" it's
possible to apply force only "inside" the effector object.
* Spherical effector is now renamed as "force" as it's no longer
just spherical.
* New effector parameter "flow", which makes the effector act as
surrounding air velocity, so the resulting force is
proportional to the velocity difference of the point and "air
velocity". For example a wind field with flow=1.0 results in
proper non-accelerating wind.
* New effector fields "turbulence", which creates nice random
flow paths, and "drag", which slows the points down.
* Much improved vortex field.
* Effectors can now effect particle rotation as well as location.
* Use full, or only positive/negative z-axis to apply force
(note. the z-axis is the surface normal in the case of
effector shape "surface")
* New "force field" submenu in add menu, which adds an empty
with the chosen effector (curve object for corve guides).
* Other dynamics should be quite easy to add to the effector
system too if wanted.
* "Unified" doesn't mean that force fields give the exact same results for
particles, softbody & cloth, since their final effect depends on many external
factors, like for example the surface area of the effected faces.
Code changes
* Subversion bump for correct handling of global gravity.
* Separate ui py file for common dynamics stuff.
* Particle settings updating is flushed with it's id through
DAG_id_flush_update(..).
Known issues
* Curve guides don't yet have all ui buttons in place, but they
should work none the less.
* Hair dynamics don't yet respect force fields.
Other changes
* Particle emission defaults now to frames 1-200 with life of 50
frames to fill the whole default timeline.
* Many particles drawing related crashes fixed.
* Sometimes particles didn't update on first frame properly.
* Hair with object/group visualization didn't work properly.
* Memory leaks with PointCacheID lists (Genscher, remember to
free pidlists after use :).
2009-10-01 00:10:14 +02:00
|
|
|
void precalc_guides(struct ParticleSimulationData *sim, struct ListBase *effectors);
|
2009-09-18 00:00:49 +02:00
|
|
|
float psys_get_timestep(struct ParticleSimulationData *sim);
|
2009-07-04 05:50:12 +02:00
|
|
|
float psys_get_child_time(struct ParticleSystem *psys,
|
|
|
|
struct ChildParticle *cpa,
|
|
|
|
float cfra,
|
|
|
|
float *birthtime,
|
|
|
|
float *dietime);
|
2007-12-04 14:57:28 +01:00
|
|
|
float psys_get_child_size(struct ParticleSystem *psys,
|
|
|
|
struct ChildParticle *cpa,
|
|
|
|
float cfra,
|
|
|
|
float *pa_time);
|
2021-12-07 07:19:15 +01:00
|
|
|
/**
|
|
|
|
* Gets hair (or keyed) particles state at the "path time" specified in `state->time`.
|
|
|
|
*/
|
2014-04-01 02:34:00 +02:00
|
|
|
void psys_get_particle_on_path(struct ParticleSimulationData *sim,
|
|
|
|
int pa_num,
|
|
|
|
struct ParticleKey *state,
|
|
|
|
const bool vel);
|
2021-12-07 07:19:15 +01:00
|
|
|
/**
|
|
|
|
* Gets particle's state at a time.
|
2021-12-07 08:14:39 +01:00
|
|
|
* \return true if particle exists and can be seen and false if not.
|
2021-12-07 07:19:15 +01:00
|
|
|
*/
|
2021-12-07 08:14:39 +01:00
|
|
|
bool psys_get_particle_state(struct ParticleSimulationData *sim,
|
|
|
|
int p,
|
|
|
|
struct ParticleKey *state,
|
|
|
|
const bool always);
|
2009-09-18 00:00:49 +02:00
|
|
|
|
2021-12-07 07:19:15 +01:00
|
|
|
/* Child paths. */
|
|
|
|
|
2015-01-09 14:24:19 +01:00
|
|
|
void BKE_particlesettings_clump_curve_init(struct ParticleSettings *part);
|
2015-01-09 15:58:18 +01:00
|
|
|
void BKE_particlesettings_rough_curve_init(struct ParticleSettings *part);
|
2018-02-14 14:33:53 +01:00
|
|
|
void BKE_particlesettings_twist_curve_init(struct ParticleSettings *part);
|
2015-01-09 11:31:00 +01:00
|
|
|
void psys_apply_child_modifiers(struct ParticleThreadContext *ctx,
|
|
|
|
struct ListBase *modifiers,
|
Remove Blender Internal and legacy viewport from Blender 2.8.
Brecht authored this commit, but he gave me the honours to actually
do it. Here it goes; Blender Internal. Bye bye, you did great!
* Point density, voxel data, ocean, environment map textures were removed,
as these only worked within BI rendering. Note that the ocean modifier
and the Cycles point density shader node continue to work.
* Dynamic paint using material shading was removed, as this only worked
with BI. If we ever wanted to support this again probably it should go
through the baking API.
* GPU shader export through the Python API was removed. This only worked
for the old BI GLSL shaders, which no longer exists. Doing something
similar for Eevee would be significantly more complicated because it
uses a lot of multiplass rendering and logic outside the shader, it's
probably impractical.
* Collada material import / export code is mostly gone, as it only worked
for BI materials. We need to add Cycles / Eevee material support at some
point.
* The mesh noise operator was removed since it only worked with BI
material texture slots. A displacement modifier can be used instead.
* The delete texture paint slot operator was removed since it only worked
for BI material texture slots. Could be added back with node support.
* Not all legacy viewport features are supported in the new viewport, but
their code was removed. If we need to bring anything back we can look at
older git revisions.
* There is some legacy viewport code that I could not remove yet, and some
that I probably missed.
* Shader node execution code was left mostly intact, even though it is not
used anywhere now. We may eventually use this to replace the texture
nodes with Cycles / Eevee shader nodes.
* The Cycles Bake panel now includes settings for baking multires normal
and displacement maps. The underlying code needs to be merged properly,
and we plan to add back support for multires AO baking and add support
to Cycles baking for features like vertex color, displacement, and other
missing baking features.
* This commit removes DNA and the Python API for BI material, lamp, world
and scene settings. This breaks a lot of addons.
* There is more DNA that can be removed or renamed, where Cycles or Eevee
are reusing some old BI properties but the names are not really correct
anymore.
* Texture slots for materials, lamps and world were removed. They remain
for brushes, particles and freestyle linestyles.
* 'BLENDER_RENDER' remains in the COMPAT_ENGINES of UI panels. Cycles and
other renderers use this to find all panels to show, minus a few panels
that they have their own replacement for.
2018-04-19 17:34:44 +02:00
|
|
|
struct ChildParticle *cpa,
|
|
|
|
struct ParticleTexture *ptex,
|
|
|
|
const float orco[3],
|
|
|
|
float hairmat[4][4],
|
2015-01-12 16:03:12 +01:00
|
|
|
struct ParticleCacheKey *keys,
|
|
|
|
struct ParticleCacheKey *parent_keys,
|
|
|
|
const float parent_orco[3]);
|
2015-01-09 11:31:00 +01:00
|
|
|
|
2012-12-14 05:57:26 +01:00
|
|
|
void psys_sph_init(struct ParticleSimulationData *sim, struct SPHData *sphdata);
|
2020-05-28 08:42:31 +02:00
|
|
|
void psys_sph_finalize(struct SPHData *sphdata);
|
2021-12-07 07:19:15 +01:00
|
|
|
/**
|
|
|
|
* Sample the density field at a point in space.
|
|
|
|
*/
|
2013-01-19 07:12:25 +01:00
|
|
|
void psys_sph_density(struct BVHTree *tree, struct SPHData *data, float co[3], float vars[2]);
|
2012-12-14 05:57:26 +01:00
|
|
|
|
2021-12-07 07:19:15 +01:00
|
|
|
/* For anim.c */
|
|
|
|
|
2012-10-20 10:02:18 +02:00
|
|
|
void psys_get_dupli_texture(struct ParticleSystem *psys,
|
|
|
|
struct ParticleSettings *part,
|
|
|
|
struct ParticleSystemModifierData *psmd,
|
|
|
|
struct ParticleData *pa,
|
|
|
|
struct ChildParticle *cpa,
|
|
|
|
float uv[2],
|
|
|
|
float orco[3]);
|
|
|
|
void psys_get_dupli_path_transform(struct ParticleSimulationData *sim,
|
|
|
|
struct ParticleData *pa,
|
|
|
|
struct ChildParticle *cpa,
|
2012-12-11 15:29:01 +01:00
|
|
|
struct ParticleCacheKey *cache,
|
|
|
|
float mat[4][4],
|
|
|
|
float *scale);
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2021-12-07 07:19:15 +01:00
|
|
|
/**
|
|
|
|
* Threaded child particle distribution and path caching.
|
|
|
|
*/
|
2014-10-06 18:58:41 +02:00
|
|
|
void psys_thread_context_init(struct ParticleThreadContext *ctx,
|
|
|
|
struct ParticleSimulationData *sim);
|
2015-01-08 12:40:27 +01:00
|
|
|
void psys_thread_context_free(struct ParticleThreadContext *ctx);
|
2015-03-25 18:34:52 +01:00
|
|
|
void psys_tasks_create(struct ParticleThreadContext *ctx,
|
|
|
|
int startpart,
|
|
|
|
int endpart,
|
|
|
|
struct ParticleTask **r_tasks,
|
|
|
|
int *r_numtasks);
|
2014-10-06 18:58:41 +02:00
|
|
|
void psys_tasks_free(struct ParticleTask *tasks, int numtasks);
|
2007-12-04 14:57:28 +01:00
|
|
|
|
2018-04-06 12:07:27 +02:00
|
|
|
void psys_apply_hair_lattice(struct Depsgraph *depsgraph,
|
|
|
|
struct Scene *scene,
|
|
|
|
struct Object *ob,
|
|
|
|
struct ParticleSystem *psys);
|
2009-04-20 17:06:46 +02:00
|
|
|
|
Particles
=========
Merge of the famous particle patch by Janne Karhu, a full rewrite
of the Blender particle system. This includes:
- Emitter, Hair and Reactor particle types.
- Newtonian, Keyed and Boids physics.
- Various particle visualisation and rendering types.
- Vertex group and texture control for various properties.
- Interpolated child particles from parents.
- Hair editing with combing, growing, cutting, .. .
- Explode modifier.
- Harmonic, Magnetic fields, and multiple falloff types.
.. and lots of other things, some more info is here:
http://wiki.blender.org/index.php/BlenderDev/Particles_Rewrite
http://wiki.blender.org/index.php/BlenderDev/Particles_Rewrite_Doc
The new particle system cannot be backwards compatible. Old particle
systems are being converted to the new system, but will require
tweaking to get them looking the same as before.
Point Cache
===========
The new system to replace manual baking, based on automatic caching
on disk. This is currently used by softbodies and the particle system.
See the Cache API section on:
http://wiki.blender.org/index.php/BlenderDev/PhysicsSprint
Documentation
=============
These new features still need good docs for the release logs, help
for this is appreciated.
2007-11-26 23:09:57 +01:00
|
|
|
/* particle_system.c */
|
2021-12-07 07:19:15 +01:00
|
|
|
|
2009-07-21 01:52:53 +02:00
|
|
|
struct ParticleSystem *psys_get_target_system(struct Object *ob, struct ParticleTarget *pt);
|
2021-12-07 07:19:15 +01:00
|
|
|
/**
|
|
|
|
* Counts valid keyed targets.
|
|
|
|
*/
|
2009-09-18 00:00:49 +02:00
|
|
|
void psys_count_keyed_targets(struct ParticleSimulationData *sim);
|
Unified effector functionality for particles, cloth and softbody
* Unified scene wide gravity (currently in scene buttons)
instead of each simulation having it's own gravity.
* Weight parameters for all effectors and an effector group
setting.
* Every effector can use noise.
* Most effectors have "shapes" point, plane, surface, every point.
- "Point" is most like the old effectors and uses the
effector location as the effector point.
- "Plane" uses the closest point on effectors local xy-plane
as the effector point.
- "Surface" uses the closest point on an effector object's
surface as the effector point.
- "Every Point" uses every point in a mesh effector object
as an effector point.
- The falloff is calculated from this point, so for example
with "surface" shape and "use only negative z axis" it's
possible to apply force only "inside" the effector object.
* Spherical effector is now renamed as "force" as it's no longer
just spherical.
* New effector parameter "flow", which makes the effector act as
surrounding air velocity, so the resulting force is
proportional to the velocity difference of the point and "air
velocity". For example a wind field with flow=1.0 results in
proper non-accelerating wind.
* New effector fields "turbulence", which creates nice random
flow paths, and "drag", which slows the points down.
* Much improved vortex field.
* Effectors can now effect particle rotation as well as location.
* Use full, or only positive/negative z-axis to apply force
(note. the z-axis is the surface normal in the case of
effector shape "surface")
* New "force field" submenu in add menu, which adds an empty
with the chosen effector (curve object for corve guides).
* Other dynamics should be quite easy to add to the effector
system too if wanted.
* "Unified" doesn't mean that force fields give the exact same results for
particles, softbody & cloth, since their final effect depends on many external
factors, like for example the surface area of the effected faces.
Code changes
* Subversion bump for correct handling of global gravity.
* Separate ui py file for common dynamics stuff.
* Particle settings updating is flushed with it's id through
DAG_id_flush_update(..).
Known issues
* Curve guides don't yet have all ui buttons in place, but they
should work none the less.
* Hair dynamics don't yet respect force fields.
Other changes
* Particle emission defaults now to frames 1-200 with life of 50
frames to fill the whole default timeline.
* Many particles drawing related crashes fixed.
* Sometimes particles didn't update on first frame properly.
* Hair with object/group visualization didn't work properly.
* Memory leaks with PointCacheID lists (Genscher, remember to
free pidlists after use :).
2009-10-01 00:10:14 +02:00
|
|
|
void psys_update_particle_tree(struct ParticleSystem *psys, float cfra);
|
2021-12-07 07:19:15 +01:00
|
|
|
/**
|
|
|
|
* System type has changed so set sensible defaults and clear non applicable flags.
|
|
|
|
*/
|
2014-02-05 13:53:34 +01:00
|
|
|
void psys_changed_type(struct Object *ob, struct ParticleSystem *psys);
|
Particles
=========
Merge of the famous particle patch by Janne Karhu, a full rewrite
of the Blender particle system. This includes:
- Emitter, Hair and Reactor particle types.
- Newtonian, Keyed and Boids physics.
- Various particle visualisation and rendering types.
- Vertex group and texture control for various properties.
- Interpolated child particles from parents.
- Hair editing with combing, growing, cutting, .. .
- Explode modifier.
- Harmonic, Magnetic fields, and multiple falloff types.
.. and lots of other things, some more info is here:
http://wiki.blender.org/index.php/BlenderDev/Particles_Rewrite
http://wiki.blender.org/index.php/BlenderDev/Particles_Rewrite_Doc
The new particle system cannot be backwards compatible. Old particle
systems are being converted to the new system, but will require
tweaking to get them looking the same as before.
Point Cache
===========
The new system to replace manual baking, based on automatic caching
on disk. This is currently used by softbodies and the particle system.
See the Cache API section on:
http://wiki.blender.org/index.php/BlenderDev/PhysicsSprint
Documentation
=============
These new features still need good docs for the release logs, help
for this is appreciated.
2007-11-26 23:09:57 +01:00
|
|
|
|
2009-07-13 01:38:47 +02:00
|
|
|
void psys_make_temp_pointcache(struct Object *ob, struct ParticleSystem *psys);
|
2009-09-18 00:00:49 +02:00
|
|
|
void psys_get_pointcache_start_end(struct Scene *scene,
|
|
|
|
ParticleSystem *psys,
|
|
|
|
int *sfra,
|
|
|
|
int *efra);
|
2009-06-21 12:16:52 +02:00
|
|
|
|
2009-07-21 01:52:53 +02:00
|
|
|
void psys_check_boid_data(struct ParticleSystem *psys);
|
|
|
|
|
2015-01-04 04:20:31 +01:00
|
|
|
void psys_get_birth_coords(struct ParticleSimulationData *sim,
|
|
|
|
struct ParticleData *pa,
|
|
|
|
struct ParticleKey *state,
|
|
|
|
float dtime,
|
|
|
|
float cfra);
|
2011-06-12 13:09:39 +02:00
|
|
|
|
2021-12-07 07:19:15 +01:00
|
|
|
/**
|
|
|
|
* Main particle update call, checks that things are ok on the large scale and
|
|
|
|
* then advances in to actual particle calculations depending on particle type.
|
|
|
|
*/
|
2018-04-06 12:07:27 +02:00
|
|
|
void particle_system_update(struct Depsgraph *depsgraph,
|
|
|
|
struct Scene *scene,
|
|
|
|
struct Object *ob,
|
|
|
|
struct ParticleSystem *psys,
|
|
|
|
const bool use_render_params);
|
Particles
=========
Merge of the famous particle patch by Janne Karhu, a full rewrite
of the Blender particle system. This includes:
- Emitter, Hair and Reactor particle types.
- Newtonian, Keyed and Boids physics.
- Various particle visualisation and rendering types.
- Vertex group and texture control for various properties.
- Interpolated child particles from parents.
- Hair editing with combing, growing, cutting, .. .
- Explode modifier.
- Harmonic, Magnetic fields, and multiple falloff types.
.. and lots of other things, some more info is here:
http://wiki.blender.org/index.php/BlenderDev/Particles_Rewrite
http://wiki.blender.org/index.php/BlenderDev/Particles_Rewrite_Doc
The new particle system cannot be backwards compatible. Old particle
systems are being converted to the new system, but will require
tweaking to get them looking the same as before.
Point Cache
===========
The new system to replace manual baking, based on automatic caching
on disk. This is currently used by softbodies and the particle system.
See the Cache API section on:
http://wiki.blender.org/index.php/BlenderDev/PhysicsSprint
Documentation
=============
These new features still need good docs for the release logs, help
for this is appreciated.
2007-11-26 23:09:57 +01:00
|
|
|
|
2021-12-07 07:19:15 +01:00
|
|
|
/**
|
|
|
|
* Callback format for performing operations on ID-pointers for particle systems.
|
|
|
|
*/
|
2017-01-31 10:41:25 +01:00
|
|
|
typedef void (*ParticleSystemIDFunc)(struct ParticleSystem *psys,
|
|
|
|
struct ID **idpoin,
|
|
|
|
void *userdata,
|
|
|
|
int cb_flag);
|
2015-10-08 14:56:20 +02:00
|
|
|
|
|
|
|
void BKE_particlesystem_id_loop(struct ParticleSystem *psys,
|
|
|
|
ParticleSystemIDFunc func,
|
|
|
|
void *userdata);
|
|
|
|
|
2021-12-07 07:19:15 +01:00
|
|
|
/**
|
|
|
|
* Reset all particle systems in the given object.
|
|
|
|
*/
|
2019-01-31 16:53:19 +01:00
|
|
|
void BKE_particlesystem_reset_all(struct Object *object);
|
|
|
|
|
Particles
=========
Merge of the famous particle patch by Janne Karhu, a full rewrite
of the Blender particle system. This includes:
- Emitter, Hair and Reactor particle types.
- Newtonian, Keyed and Boids physics.
- Various particle visualisation and rendering types.
- Vertex group and texture control for various properties.
- Interpolated child particles from parents.
- Hair editing with combing, growing, cutting, .. .
- Explode modifier.
- Harmonic, Magnetic fields, and multiple falloff types.
.. and lots of other things, some more info is here:
http://wiki.blender.org/index.php/BlenderDev/Particles_Rewrite
http://wiki.blender.org/index.php/BlenderDev/Particles_Rewrite_Doc
The new particle system cannot be backwards compatible. Old particle
systems are being converted to the new system, but will require
tweaking to get them looking the same as before.
Point Cache
===========
The new system to replace manual baking, based on automatic caching
on disk. This is currently used by softbodies and the particle system.
See the Cache API section on:
http://wiki.blender.org/index.php/BlenderDev/PhysicsSprint
Documentation
=============
These new features still need good docs for the release logs, help
for this is appreciated.
2007-11-26 23:09:57 +01:00
|
|
|
/* ----------- functions needed only inside particlesystem ------------ */
|
2021-12-07 07:19:15 +01:00
|
|
|
|
Particles
=========
Merge of the famous particle patch by Janne Karhu, a full rewrite
of the Blender particle system. This includes:
- Emitter, Hair and Reactor particle types.
- Newtonian, Keyed and Boids physics.
- Various particle visualisation and rendering types.
- Vertex group and texture control for various properties.
- Interpolated child particles from parents.
- Hair editing with combing, growing, cutting, .. .
- Explode modifier.
- Harmonic, Magnetic fields, and multiple falloff types.
.. and lots of other things, some more info is here:
http://wiki.blender.org/index.php/BlenderDev/Particles_Rewrite
http://wiki.blender.org/index.php/BlenderDev/Particles_Rewrite_Doc
The new particle system cannot be backwards compatible. Old particle
systems are being converted to the new system, but will require
tweaking to get them looking the same as before.
Point Cache
===========
The new system to replace manual baking, based on automatic caching
on disk. This is currently used by softbodies and the particle system.
See the Cache API section on:
http://wiki.blender.org/index.php/BlenderDev/PhysicsSprint
Documentation
=============
These new features still need good docs for the release logs, help
for this is appreciated.
2007-11-26 23:09:57 +01:00
|
|
|
/* particle.c */
|
2021-12-07 07:19:15 +01:00
|
|
|
|
2009-09-18 00:00:49 +02:00
|
|
|
void psys_disable_all(struct Object *ob);
|
|
|
|
void psys_enable_all(struct Object *ob);
|
|
|
|
|
|
|
|
void free_hair(struct Object *ob, struct ParticleSystem *psys, int dynamics);
|
|
|
|
void free_keyed_keys(struct ParticleSystem *psys);
|
|
|
|
void psys_free_particles(struct ParticleSystem *psys);
|
|
|
|
void psys_free_children(struct ParticleSystem *psys);
|
|
|
|
|
2014-10-29 14:59:29 +01:00
|
|
|
void psys_interpolate_particle(
|
|
|
|
short type, struct ParticleKey keys[4], float dt, struct ParticleKey *result, bool velocity);
|
2018-05-15 13:26:40 +02:00
|
|
|
void psys_vec_rot_to_face(struct Mesh *mesh, struct ParticleData *pa, float vec[3]);
|
|
|
|
void psys_mat_hair_to_object(struct Object *ob,
|
|
|
|
struct Mesh *mesh,
|
|
|
|
short from,
|
|
|
|
struct ParticleData *pa,
|
|
|
|
float hairmat[4][4]);
|
|
|
|
void psys_mat_hair_to_global(struct Object *ob,
|
|
|
|
struct Mesh *mesh,
|
|
|
|
short from,
|
|
|
|
struct ParticleData *pa,
|
|
|
|
float hairmat[4][4]);
|
|
|
|
void psys_mat_hair_to_orco(struct Object *ob,
|
|
|
|
struct Mesh *mesh,
|
|
|
|
short from,
|
|
|
|
struct ParticleData *pa,
|
|
|
|
float hairmat[4][4]);
|
Particles
=========
Merge of the famous particle patch by Janne Karhu, a full rewrite
of the Blender particle system. This includes:
- Emitter, Hair and Reactor particle types.
- Newtonian, Keyed and Boids physics.
- Various particle visualisation and rendering types.
- Vertex group and texture control for various properties.
- Interpolated child particles from parents.
- Hair editing with combing, growing, cutting, .. .
- Explode modifier.
- Harmonic, Magnetic fields, and multiple falloff types.
.. and lots of other things, some more info is here:
http://wiki.blender.org/index.php/BlenderDev/Particles_Rewrite
http://wiki.blender.org/index.php/BlenderDev/Particles_Rewrite_Doc
The new particle system cannot be backwards compatible. Old particle
systems are being converted to the new system, but will require
tweaking to get them looking the same as before.
Point Cache
===========
The new system to replace manual baking, based on automatic caching
on disk. This is currently used by softbodies and the particle system.
See the Cache API section on:
http://wiki.blender.org/index.php/BlenderDev/PhysicsSprint
Documentation
=============
These new features still need good docs for the release logs, help
for this is appreciated.
2007-11-26 23:09:57 +01:00
|
|
|
|
2010-09-02 12:26:19 +02:00
|
|
|
float psys_get_dietime_from_cache(struct PointCache *cache, int index);
|
|
|
|
|
2009-09-18 00:00:49 +02:00
|
|
|
void psys_free_pdd(struct ParticleSystem *psys);
|
|
|
|
|
2018-05-15 13:26:40 +02:00
|
|
|
float *psys_cache_vgroup(struct Mesh *mesh, struct ParticleSystem *psys, int vgroup);
|
2015-02-14 16:40:57 +01:00
|
|
|
void psys_get_texture(struct ParticleSimulationData *sim,
|
|
|
|
struct ParticleData *pa,
|
|
|
|
struct ParticleTexture *ptex,
|
|
|
|
int event,
|
|
|
|
float cfra);
|
2021-12-07 07:19:15 +01:00
|
|
|
/**
|
|
|
|
* Interpolate a location on a face based on face coordinates.
|
|
|
|
*/
|
2012-10-20 10:02:18 +02:00
|
|
|
void psys_interpolate_face(struct MVert *mvert,
|
|
|
|
struct MFace *mface,
|
|
|
|
struct MTFace *tface,
|
|
|
|
float (*orcodata)[3],
|
|
|
|
float w[4],
|
|
|
|
float vec[3],
|
|
|
|
float nor[3],
|
|
|
|
float utan[3],
|
|
|
|
float vtan[3],
|
Remove Blender Internal and legacy viewport from Blender 2.8.
Brecht authored this commit, but he gave me the honours to actually
do it. Here it goes; Blender Internal. Bye bye, you did great!
* Point density, voxel data, ocean, environment map textures were removed,
as these only worked within BI rendering. Note that the ocean modifier
and the Cycles point density shader node continue to work.
* Dynamic paint using material shading was removed, as this only worked
with BI. If we ever wanted to support this again probably it should go
through the baking API.
* GPU shader export through the Python API was removed. This only worked
for the old BI GLSL shaders, which no longer exists. Doing something
similar for Eevee would be significantly more complicated because it
uses a lot of multiplass rendering and logic outside the shader, it's
probably impractical.
* Collada material import / export code is mostly gone, as it only worked
for BI materials. We need to add Cycles / Eevee material support at some
point.
* The mesh noise operator was removed since it only worked with BI
material texture slots. A displacement modifier can be used instead.
* The delete texture paint slot operator was removed since it only worked
for BI material texture slots. Could be added back with node support.
* Not all legacy viewport features are supported in the new viewport, but
their code was removed. If we need to bring anything back we can look at
older git revisions.
* There is some legacy viewport code that I could not remove yet, and some
that I probably missed.
* Shader node execution code was left mostly intact, even though it is not
used anywhere now. We may eventually use this to replace the texture
nodes with Cycles / Eevee shader nodes.
* The Cycles Bake panel now includes settings for baking multires normal
and displacement maps. The underlying code needs to be merged properly,
and we plan to add back support for multires AO baking and add support
to Cycles baking for features like vertex color, displacement, and other
missing baking features.
* This commit removes DNA and the Python API for BI material, lamp, world
and scene settings. This breaks a lot of addons.
* There is more DNA that can be removed or renamed, where Cycles or Eevee
are reusing some old BI properties but the names are not really correct
anymore.
* Texture slots for materials, lamps and world were removed. They remain
for brushes, particles and freestyle linestyles.
* 'BLENDER_RENDER' remains in the COMPAT_ENGINES of UI panels. Cycles and
other renderers use this to find all panels to show, minus a few panels
that they have their own replacement for.
2018-04-19 17:34:44 +02:00
|
|
|
float orco[3]);
|
2018-05-15 13:26:40 +02:00
|
|
|
float psys_particle_value_from_verts(struct Mesh *mesh,
|
|
|
|
short from,
|
|
|
|
struct ParticleData *pa,
|
|
|
|
float *values);
|
2012-10-20 10:02:18 +02:00
|
|
|
void psys_get_from_key(
|
|
|
|
struct ParticleKey *key, float loc[3], float vel[3], float rot[4], float *time);
|
Particles
=========
Merge of the famous particle patch by Janne Karhu, a full rewrite
of the Blender particle system. This includes:
- Emitter, Hair and Reactor particle types.
- Newtonian, Keyed and Boids physics.
- Various particle visualisation and rendering types.
- Vertex group and texture control for various properties.
- Interpolated child particles from parents.
- Hair editing with combing, growing, cutting, .. .
- Explode modifier.
- Harmonic, Magnetic fields, and multiple falloff types.
.. and lots of other things, some more info is here:
http://wiki.blender.org/index.php/BlenderDev/Particles_Rewrite
http://wiki.blender.org/index.php/BlenderDev/Particles_Rewrite_Doc
The new particle system cannot be backwards compatible. Old particle
systems are being converted to the new system, but will require
tweaking to get them looking the same as before.
Point Cache
===========
The new system to replace manual baking, based on automatic caching
on disk. This is currently used by softbodies and the particle system.
See the Cache API section on:
http://wiki.blender.org/index.php/BlenderDev/PhysicsSprint
Documentation
=============
These new features still need good docs for the release logs, help
for this is appreciated.
2007-11-26 23:09:57 +01:00
|
|
|
|
2021-12-07 07:19:15 +01:00
|
|
|
/**
|
|
|
|
* Callback for #BVHTree near test.
|
|
|
|
*/
|
2011-03-18 16:31:32 +01:00
|
|
|
void BKE_psys_collision_neartest_cb(void *userdata,
|
|
|
|
int index,
|
|
|
|
const struct BVHTreeRay *ray,
|
|
|
|
struct BVHTreeRayHit *hit);
|
2021-12-07 07:19:15 +01:00
|
|
|
/**
|
|
|
|
* Interprets particle data to get a point on a mesh in object space.
|
|
|
|
*/
|
2018-05-15 13:26:40 +02:00
|
|
|
void psys_particle_on_dm(struct Mesh *mesh_final,
|
|
|
|
int from,
|
|
|
|
int index,
|
|
|
|
int index_dmcache,
|
2012-10-20 10:02:18 +02:00
|
|
|
const float fw[4],
|
|
|
|
float foffset,
|
|
|
|
float vec[3],
|
|
|
|
float nor[3],
|
|
|
|
float utan[3],
|
|
|
|
float vtan[3],
|
Remove Blender Internal and legacy viewport from Blender 2.8.
Brecht authored this commit, but he gave me the honours to actually
do it. Here it goes; Blender Internal. Bye bye, you did great!
* Point density, voxel data, ocean, environment map textures were removed,
as these only worked within BI rendering. Note that the ocean modifier
and the Cycles point density shader node continue to work.
* Dynamic paint using material shading was removed, as this only worked
with BI. If we ever wanted to support this again probably it should go
through the baking API.
* GPU shader export through the Python API was removed. This only worked
for the old BI GLSL shaders, which no longer exists. Doing something
similar for Eevee would be significantly more complicated because it
uses a lot of multiplass rendering and logic outside the shader, it's
probably impractical.
* Collada material import / export code is mostly gone, as it only worked
for BI materials. We need to add Cycles / Eevee material support at some
point.
* The mesh noise operator was removed since it only worked with BI
material texture slots. A displacement modifier can be used instead.
* The delete texture paint slot operator was removed since it only worked
for BI material texture slots. Could be added back with node support.
* Not all legacy viewport features are supported in the new viewport, but
their code was removed. If we need to bring anything back we can look at
older git revisions.
* There is some legacy viewport code that I could not remove yet, and some
that I probably missed.
* Shader node execution code was left mostly intact, even though it is not
used anywhere now. We may eventually use this to replace the texture
nodes with Cycles / Eevee shader nodes.
* The Cycles Bake panel now includes settings for baking multires normal
and displacement maps. The underlying code needs to be merged properly,
and we plan to add back support for multires AO baking and add support
to Cycles baking for features like vertex color, displacement, and other
missing baking features.
* This commit removes DNA and the Python API for BI material, lamp, world
and scene settings. This breaks a lot of addons.
* There is more DNA that can be removed or renamed, where Cycles or Eevee
are reusing some old BI properties but the names are not really correct
anymore.
* Texture slots for materials, lamps and world were removed. They remain
for brushes, particles and freestyle linestyles.
* 'BLENDER_RENDER' remains in the COMPAT_ENGINES of UI panels. Cycles and
other renderers use this to find all panels to show, minus a few panels
that they have their own replacement for.
2018-04-19 17:34:44 +02:00
|
|
|
float orco[3]);
|
Particles
=========
Merge of the famous particle patch by Janne Karhu, a full rewrite
of the Blender particle system. This includes:
- Emitter, Hair and Reactor particle types.
- Newtonian, Keyed and Boids physics.
- Various particle visualisation and rendering types.
- Vertex group and texture control for various properties.
- Interpolated child particles from parents.
- Hair editing with combing, growing, cutting, .. .
- Explode modifier.
- Harmonic, Magnetic fields, and multiple falloff types.
.. and lots of other things, some more info is here:
http://wiki.blender.org/index.php/BlenderDev/Particles_Rewrite
http://wiki.blender.org/index.php/BlenderDev/Particles_Rewrite_Doc
The new particle system cannot be backwards compatible. Old particle
systems are being converted to the new system, but will require
tweaking to get them looking the same as before.
Point Cache
===========
The new system to replace manual baking, based on automatic caching
on disk. This is currently used by softbodies and the particle system.
See the Cache API section on:
http://wiki.blender.org/index.php/BlenderDev/PhysicsSprint
Documentation
=============
These new features still need good docs for the release logs, help
for this is appreciated.
2007-11-26 23:09:57 +01:00
|
|
|
|
|
|
|
/* particle_system.c */
|
2021-12-07 07:19:15 +01:00
|
|
|
|
2014-10-28 16:29:33 +01:00
|
|
|
void distribute_particles(struct ParticleSimulationData *sim, int from);
|
2021-12-07 07:19:15 +01:00
|
|
|
/**
|
|
|
|
* Set particle parameters that don't change during particle's life.
|
|
|
|
*/
|
2020-08-01 05:02:21 +02:00
|
|
|
void init_particle(struct ParticleSimulationData *sim, struct ParticleData *pa);
|
2018-05-25 21:44:33 +02:00
|
|
|
void psys_calc_dmcache(struct Object *ob,
|
|
|
|
struct Mesh *mesh_final,
|
|
|
|
struct Mesh *mesh_original,
|
|
|
|
struct ParticleSystem *psys);
|
2021-12-07 07:19:15 +01:00
|
|
|
/**
|
|
|
|
* Find the final derived mesh tessface for a particle, from its original tessface index.
|
|
|
|
* This is slow and can be optimized but only for many lookups.
|
|
|
|
*
|
|
|
|
* \param mesh_final: Final mesh, it may not have the same topology as original mesh.
|
|
|
|
* \param mesh_original: Original mesh, use for accessing #MPoly to #MFace mapping.
|
|
|
|
* \param findex_orig: The input tessface index.
|
|
|
|
* \param fw: Face weights (position of the particle inside the \a findex_orig tessface).
|
|
|
|
* \param poly_nodes: May be NULL, otherwise an array of linked list,
|
|
|
|
* one for each final \a mesh_final polygon, containing all its tessfaces indices.
|
|
|
|
* \return The \a mesh_final tessface index.
|
|
|
|
*/
|
2018-05-25 21:44:33 +02:00
|
|
|
int psys_particle_dm_face_lookup(struct Mesh *mesh_final,
|
|
|
|
struct Mesh *mesh_original,
|
2021-12-14 08:35:23 +01:00
|
|
|
int findex_orig,
|
2018-05-25 21:44:33 +02:00
|
|
|
const float fw[4],
|
|
|
|
struct LinkNode **poly_nodes);
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2021-12-07 07:19:15 +01:00
|
|
|
/**
|
|
|
|
* Sets particle to the emitter surface with initial velocity & rotation.
|
|
|
|
*/
|
2009-09-18 00:00:49 +02:00
|
|
|
void reset_particle(struct ParticleSimulationData *sim,
|
|
|
|
struct ParticleData *pa,
|
|
|
|
float dtime,
|
|
|
|
float cfra);
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2018-04-08 09:28:52 +02:00
|
|
|
float psys_get_current_display_percentage(struct ParticleSystem *psys,
|
|
|
|
const bool use_render_params);
|
2014-10-28 17:16:59 +01:00
|
|
|
|
Point Cache Refactoring
=======================
Caching and Baking:
- The point cache is now cleared on DAG_object_flush_update(), and not cleared for time dependency graph updates.
- There is now a Bake button instead of Protect. Also cache start and end frames were added to softbody and particles.
- The cloth autoprotect feature was removed.
- The Ctrl+B menu now also bakes cloth and particles next to softbody and fluids. Additionally there are now frree bake and free cache menu entries.
- The point cache api has been changed. There is now a PTCacheID struct for each point cache type that can be filled and then used to call the point cache functions.
- PointCache struct was added to DNA and is automatically allocated for each physics type.
- Soft body now supports Bake Editing just like cloth.
- Tried to make the systems deal consistently with time ipo's and offsets. Still not sure it all works correct, but too complicated to solve completely now.
Library Linking:
- Added some more warnings to prevent editing settings on library linked objects.
- Linked objects now read from the cache located next to the original library file, and never write to it. This restores old behavior for softbodies. For local simulation the mesh and not the object should be linked.
- Dupligroups and proxies can't create local point caches at the moment, how to implement that I'm not sure. We probably need a proxy point cache for that to work (ugh).
Physics UI:
- Renamed deflection panel to collision for consistency and reorganized the buttons. Also removed some softbody collision buttons from the softbody panel that were duplicated in this panel for cloth.
- Tweaked field panel buttons to not jump around when changing options.
- Tabbing e.g. Soft Body Collision into the Soft Body panel, it now only shows Collision to make the panel names readable.
- I tried to make enabled/disabling physics more consistent, since all three system did things different. Now the two modifier buttons to enable the modifier for the viewport and rendering are also duplicated in the physics panels. Toggling the Soft Body and Cloth buttons now both remove their modifiers.
- Fixed modifier error drawing glitch.
Particles:
- Particles are now recalculated more often than before. Previously it did partial updates based on the changes, but that doesn't work well with DAG_object_flush_update() ..
- Fixed memory leak loading keyed particle system. Now keys are not written to file anymore but always created after loading.
- Make particle threads work with autothreads.
Continue Physics:
- The timeline play now has a Continue Physics option in the playback menu, which keeps the simulations going without writing them to the cache.
- This doesn't always work that well, some changes are not immediately updated, but this can be improved later. Still it's fun to get a feel for the physics.
Todo:
- Point cache can get out of sync with and undo and changing a file without saving it.
- Change the point cache file format to store a version (so old point cache files can be either converted or at least ignored), and to do correct endian conversion.
- Menu item and/or buttons for Ctrl+B.
- A system("rm ..") was changed to remove() since the former is very slow for clearing point caches. These system() calls were already giving trouble in a bug in the tracker, but really most use of this system("") should be changed and tested.
- The Soft Body Collision and Clot Collision panel titles don't mention there's point cache settings there too, doing that makes them unreadable with the default panel setup.. but may need to make the names longer anyway.
2008-04-10 13:39:20 +02:00
|
|
|
/* psys_reset */
|
2012-05-12 22:39:39 +02:00
|
|
|
#define PSYS_RESET_ALL 1
|
|
|
|
#define PSYS_RESET_DEPSGRAPH 2
|
|
|
|
/* #define PSYS_RESET_CHILDREN 3 */ /*UNUSED*/
|
|
|
|
#define PSYS_RESET_CACHE_MISS 4
|
Point Cache Refactoring
=======================
Caching and Baking:
- The point cache is now cleared on DAG_object_flush_update(), and not cleared for time dependency graph updates.
- There is now a Bake button instead of Protect. Also cache start and end frames were added to softbody and particles.
- The cloth autoprotect feature was removed.
- The Ctrl+B menu now also bakes cloth and particles next to softbody and fluids. Additionally there are now frree bake and free cache menu entries.
- The point cache api has been changed. There is now a PTCacheID struct for each point cache type that can be filled and then used to call the point cache functions.
- PointCache struct was added to DNA and is automatically allocated for each physics type.
- Soft body now supports Bake Editing just like cloth.
- Tried to make the systems deal consistently with time ipo's and offsets. Still not sure it all works correct, but too complicated to solve completely now.
Library Linking:
- Added some more warnings to prevent editing settings on library linked objects.
- Linked objects now read from the cache located next to the original library file, and never write to it. This restores old behavior for softbodies. For local simulation the mesh and not the object should be linked.
- Dupligroups and proxies can't create local point caches at the moment, how to implement that I'm not sure. We probably need a proxy point cache for that to work (ugh).
Physics UI:
- Renamed deflection panel to collision for consistency and reorganized the buttons. Also removed some softbody collision buttons from the softbody panel that were duplicated in this panel for cloth.
- Tweaked field panel buttons to not jump around when changing options.
- Tabbing e.g. Soft Body Collision into the Soft Body panel, it now only shows Collision to make the panel names readable.
- I tried to make enabled/disabling physics more consistent, since all three system did things different. Now the two modifier buttons to enable the modifier for the viewport and rendering are also duplicated in the physics panels. Toggling the Soft Body and Cloth buttons now both remove their modifiers.
- Fixed modifier error drawing glitch.
Particles:
- Particles are now recalculated more often than before. Previously it did partial updates based on the changes, but that doesn't work well with DAG_object_flush_update() ..
- Fixed memory leak loading keyed particle system. Now keys are not written to file anymore but always created after loading.
- Make particle threads work with autothreads.
Continue Physics:
- The timeline play now has a Continue Physics option in the playback menu, which keeps the simulations going without writing them to the cache.
- This doesn't always work that well, some changes are not immediately updated, but this can be improved later. Still it's fun to get a feel for the physics.
Todo:
- Point cache can get out of sync with and undo and changing a file without saving it.
- Change the point cache file format to store a version (so old point cache files can be either converted or at least ignored), and to do correct endian conversion.
- Menu item and/or buttons for Ctrl+B.
- A system("rm ..") was changed to remove() since the former is very slow for clearing point caches. These system() calls were already giving trouble in a bug in the tracker, but really most use of this system("") should be changed and tested.
- The Soft Body Collision and Clot Collision panel titles don't mention there's point cache settings there too, doing that makes them unreadable with the default panel setup.. but may need to make the names longer anyway.
2008-04-10 13:39:20 +02:00
|
|
|
|
Particles
=========
Merge of the famous particle patch by Janne Karhu, a full rewrite
of the Blender particle system. This includes:
- Emitter, Hair and Reactor particle types.
- Newtonian, Keyed and Boids physics.
- Various particle visualisation and rendering types.
- Vertex group and texture control for various properties.
- Interpolated child particles from parents.
- Hair editing with combing, growing, cutting, .. .
- Explode modifier.
- Harmonic, Magnetic fields, and multiple falloff types.
.. and lots of other things, some more info is here:
http://wiki.blender.org/index.php/BlenderDev/Particles_Rewrite
http://wiki.blender.org/index.php/BlenderDev/Particles_Rewrite_Doc
The new particle system cannot be backwards compatible. Old particle
systems are being converted to the new system, but will require
tweaking to get them looking the same as before.
Point Cache
===========
The new system to replace manual baking, based on automatic caching
on disk. This is currently used by softbodies and the particle system.
See the Cache API section on:
http://wiki.blender.org/index.php/BlenderDev/PhysicsSprint
Documentation
=============
These new features still need good docs for the release logs, help
for this is appreciated.
2007-11-26 23:09:57 +01:00
|
|
|
/* index_dmcache */
|
2012-05-12 22:39:39 +02:00
|
|
|
#define DMCACHE_NOTFOUND -1
|
|
|
|
#define DMCACHE_ISCHILD -2
|
Particles
=========
Merge of the famous particle patch by Janne Karhu, a full rewrite
of the Blender particle system. This includes:
- Emitter, Hair and Reactor particle types.
- Newtonian, Keyed and Boids physics.
- Various particle visualisation and rendering types.
- Vertex group and texture control for various properties.
- Interpolated child particles from parents.
- Hair editing with combing, growing, cutting, .. .
- Explode modifier.
- Harmonic, Magnetic fields, and multiple falloff types.
.. and lots of other things, some more info is here:
http://wiki.blender.org/index.php/BlenderDev/Particles_Rewrite
http://wiki.blender.org/index.php/BlenderDev/Particles_Rewrite_Doc
The new particle system cannot be backwards compatible. Old particle
systems are being converted to the new system, but will require
tweaking to get them looking the same as before.
Point Cache
===========
The new system to replace manual baking, based on automatic caching
on disk. This is currently used by softbodies and the particle system.
See the Cache API section on:
http://wiki.blender.org/index.php/BlenderDev/PhysicsSprint
Documentation
=============
These new features still need good docs for the release logs, help
for this is appreciated.
2007-11-26 23:09:57 +01:00
|
|
|
|
2015-05-12 10:57:11 +02:00
|
|
|
/* **** Depsgraph evaluation **** */
|
|
|
|
|
2018-04-06 12:07:27 +02:00
|
|
|
struct Depsgraph;
|
2015-05-12 10:57:11 +02:00
|
|
|
|
2018-12-10 15:09:46 +01:00
|
|
|
void BKE_particle_settings_eval_reset(struct Depsgraph *depsgraph,
|
|
|
|
struct ParticleSettings *particle_settings);
|
|
|
|
|
2018-04-06 12:07:27 +02:00
|
|
|
void BKE_particle_system_eval_init(struct Depsgraph *depsgraph, struct Object *object);
|
2015-05-12 10:57:11 +02:00
|
|
|
|
2017-05-09 16:23:47 +02:00
|
|
|
/* Draw Cache */
|
|
|
|
enum {
|
|
|
|
BKE_PARTICLE_BATCH_DIRTY_ALL = 0,
|
|
|
|
};
|
2020-10-09 07:25:43 +02:00
|
|
|
void BKE_particle_batch_cache_dirty_tag(struct ParticleSystem *psys, int mode);
|
2017-05-09 16:23:47 +02:00
|
|
|
void BKE_particle_batch_cache_free(struct ParticleSystem *psys);
|
2019-01-09 22:46:38 +01:00
|
|
|
|
2020-10-09 07:25:43 +02:00
|
|
|
extern void (*BKE_particle_batch_cache_dirty_tag_cb)(struct ParticleSystem *psys, int mode);
|
2019-02-23 02:58:39 +01:00
|
|
|
extern void (*BKE_particle_batch_cache_free_cb)(struct ParticleSystem *psys);
|
|
|
|
|
2020-10-30 13:43:22 +01:00
|
|
|
/* .blend file I/O */
|
2021-12-07 07:19:15 +01:00
|
|
|
|
2020-10-30 13:43:22 +01:00
|
|
|
void BKE_particle_partdeflect_blend_read_data(struct BlendDataReader *reader,
|
|
|
|
struct PartDeflect *pd);
|
|
|
|
void BKE_particle_partdeflect_blend_read_lib(struct BlendLibReader *reader,
|
|
|
|
struct ID *id,
|
|
|
|
struct PartDeflect *pd);
|
2020-11-06 15:58:27 +01:00
|
|
|
void BKE_particle_system_blend_write(struct BlendWriter *writer, struct ListBase *particles);
|
|
|
|
void BKE_particle_system_blend_read_data(struct BlendDataReader *reader,
|
|
|
|
struct ListBase *particles);
|
|
|
|
void BKE_particle_system_blend_read_lib(struct BlendLibReader *reader,
|
|
|
|
struct Object *ob,
|
|
|
|
struct ID *id,
|
|
|
|
struct ListBase *particles);
|
2020-10-30 13:43:22 +01:00
|
|
|
|
2020-03-02 15:07:49 +01:00
|
|
|
#ifdef __cplusplus
|
|
|
|
}
|
|
|
|
#endif
|