Depsgraph: Comb code to a better state all over
[blender.git] / source / blender / depsgraph / DEG_depsgraph_physics.h
1 /*
2  * ***** BEGIN GPL LICENSE BLOCK *****
3  *
4  * This program is free software; you can redistribute it and/or
5  * modify it under the terms of the GNU General Public License
6  * as published by the Free Software Foundation; either version 2
7  * of the License, or (at your option) any later version.
8  *
9  * This program is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12  * GNU General Public License for more details.
13  *
14  * You should have received a copy of the GNU General Public License
15  * along with this program; if not, write to the Free Software Foundation,
16  * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
17  *
18  * The Original Code is Copyright (C) 2018 Blender Foundation.
19  * All rights reserved.
20  *
21  * ***** END GPL LICENSE BLOCK *****
22  */
23
24 /** \file blender/depsgraph/DEG_depsgraph_physics.h
25  *  \ingroup depsgraph
26  *
27  * Physics utilities for effectors and collision.
28  */
29
30 #ifndef __DEG_DEPSGRAPH_PHYSICS_H__
31 #define __DEG_DEPSGRAPH_PHYSICS_H__
32
33 #include "DEG_depsgraph.h"
34
35 struct DepsNodeHandle;
36 struct Depsgraph;
37 struct EffectorWeights;
38 struct ListBase;
39 struct Object;
40
41 #ifdef __cplusplus
42 extern "C" {
43 #endif
44
45 typedef enum ePhysicsRelationType {
46         DEG_PHYSICS_EFFECTOR        = 0,
47         DEG_PHYSICS_COLLISION       = 1,
48         DEG_PHYSICS_SMOKE_COLLISION = 2,
49         DEG_PHYSICS_DYNAMIC_BRUSH   = 3,
50         DEG_PHYSICS_RELATIONS_NUM   = 4,
51 } ePhysicsRelationType;
52
53 /* Get collision/effector relations from collection or entire scene. These
54  * created during depsgraph relations building and should only be accessed
55  * during evaluation. */
56 struct ListBase *DEG_get_effector_relations(const struct Depsgraph *depsgraph,
57                                             struct Collection *collection);
58 struct ListBase *DEG_get_collision_relations(const struct Depsgraph *depsgraph,
59                                              struct Collection *collection,
60                                              unsigned int modifier_type);
61
62
63 /* Build collision/effector relations for depsgraph. */
64 typedef bool (*DEG_CollobjFilterFunction)(struct Object *obj,
65                                           struct ModifierData *md);
66
67 void DEG_add_collision_relations(struct DepsNodeHandle *handle,
68                                  struct Object *object,
69                                  struct Collection *collection,
70                                  unsigned int modifier_type,
71                                  DEG_CollobjFilterFunction filter_function,
72                                  const char *name);
73 void DEG_add_forcefield_relations(struct DepsNodeHandle *handle,
74                                   struct Object *object,
75                                   struct EffectorWeights *eff,
76                                   bool add_absorption,
77                                   int skip_forcefield,
78                                   const char *name);
79
80 #ifdef __cplusplus
81 } /* extern "C" */
82 #endif
83
84 #endif  /* __DEG_DEPSGRAPH_PHYSICS_H__ */