1 /*
2  * This program is free software; you can redistribute it and/or
3  * modify it under the terms of the GNU General Public License
4  * as published by the Free Software Foundation; either version 2
5  * of the License, or (at your option) any later version.
6  *
7  * This program is distributed in the hope that it will be useful,
8  * but WITHOUT ANY WARRANTY; without even the implied warranty of
9  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
10  * GNU General Public License for more details.
11  *
12  * You should have received a copy of the GNU General Public License
13  * along with this program; if not, write to the Free Software Foundation,
14  * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
15  *
16  * The Original Code is Copyright (C) 2009 by Janne Karhu.
17  * All rights reserved.
18  */
19 
20 #pragma once
21 
22 /** \file
23  * \ingroup bke
24  */
25 
26 #include "DNA_boid_types.h"
27 #include "DNA_particle_types.h"
28 
29 #ifdef __cplusplus
30 extern "C" {
31 #endif
32 
33 struct RNG;
34 
35 typedef struct BoidBrainData {
36   struct ParticleSimulationData *sim;
37   struct ParticleSettings *part;
38   float timestep, cfra, dfra;
39   float wanted_co[3], wanted_speed;
40 
41   /* Goal stuff */
42   struct Object *goal_ob;
43   float goal_co[3];
44   float goal_nor[3];
45   float goal_priority;
46 
47   struct RNG *rng;
48 } BoidBrainData;
49 
50 void boids_precalc_rules(struct ParticleSettings *part, float cfra);
51 void boid_brain(BoidBrainData *bbd, int p, struct ParticleData *pa);
52 void boid_body(BoidBrainData *bbd, struct ParticleData *pa);
53 void boid_default_settings(BoidSettings *boids);
54 BoidRule *boid_new_rule(int type);
55 BoidState *boid_new_state(BoidSettings *boids);
56 BoidState *boid_duplicate_state(BoidSettings *boids, BoidState *state);
57 void boid_free_settings(BoidSettings *boids);
58 BoidSettings *boid_copy_settings(const BoidSettings *boids);
59 BoidState *boid_get_current_state(BoidSettings *boids);
60 
61 #ifdef __cplusplus
62 }
63 #endif
64