|
Carlos Lopez |
a09598 |
/* === S Y N F I G ========================================================= */
|
|
Carlos Lopez |
a09598 |
/*! \file plant.h
|
|
Carlos Lopez |
a09598 |
** \brief Header file for implementation of the "Plant" layer
|
|
Carlos Lopez |
a09598 |
**
|
|
Carlos Lopez |
a09598 |
** $Id$
|
|
Carlos Lopez |
a09598 |
**
|
|
Carlos Lopez |
a09598 |
** \legal
|
|
Carlos Lopez |
a09598 |
** Copyright (c) 2002-2005 Robert B. Quattlebaum Jr., Adrian Bentley
|
|
Carlos Lopez |
a09598 |
** Copyright (c) 2007, 2008 Chris Moore
|
|
Carlos Lopez |
a09598 |
**
|
|
Carlos Lopez |
a09598 |
** This package is free software; you can redistribute it and/or
|
|
Carlos Lopez |
a09598 |
** modify it under the terms of the GNU General Public License as
|
|
Carlos Lopez |
a09598 |
** published by the Free Software Foundation; either version 2 of
|
|
Carlos Lopez |
a09598 |
** the License, or (at your option) any later version.
|
|
Carlos Lopez |
a09598 |
**
|
|
Carlos Lopez |
a09598 |
** This package is distributed in the hope that it will be useful,
|
|
Carlos Lopez |
a09598 |
** but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
Carlos Lopez |
a09598 |
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
Carlos Lopez |
a09598 |
** General Public License for more details.
|
|
Carlos Lopez |
a09598 |
** \endlegal
|
|
Carlos Lopez |
a09598 |
*/
|
|
Carlos Lopez |
a09598 |
/* ========================================================================= */
|
|
Carlos Lopez |
a09598 |
|
|
Carlos Lopez |
a09598 |
/* === S T A R T =========================================================== */
|
|
Carlos Lopez |
a09598 |
|
|
Carlos Lopez |
a09598 |
#ifndef __SYNFIG_PLANT_H
|
|
Carlos Lopez |
a09598 |
#define __SYNFIG_PLANT_H
|
|
Carlos Lopez |
a09598 |
|
|
Carlos Lopez |
a09598 |
/* === H E A D E R S ======================================================= */
|
|
Carlos Lopez |
a09598 |
|
|
Carlos Lopez |
a09598 |
#include <list></list>
|
|
Carlos Lopez |
a09598 |
#include <vector></vector>
|
|
Diego Barrios Romero |
dcc14d |
#include <synfig layer_composite.h="" layers=""></synfig>
|
|
Carlos Lopez |
a09598 |
#include <synfig segment.h=""></synfig>
|
|
Carlos Lopez |
a09598 |
#include <synfig blinepoint.h=""></synfig>
|
|
Carlos Lopez |
a09598 |
#include <synfig value.h=""></synfig>
|
|
Carlos Lopez |
a09598 |
#include <synfig gradient.h=""></synfig>
|
|
Carlos Lopez |
a09598 |
#include <synfig angle.h=""></synfig>
|
|
Carlos Lopez |
a09598 |
#include "random.h"
|
|
Carlos Lopez |
a09598 |
#include <synfig rect.h=""></synfig>
|
|
Carlos Lopez |
a09598 |
|
|
Carlos Lopez |
a09598 |
/* === M A C R O S ========================================================= */
|
|
Carlos Lopez |
a09598 |
|
|
Carlos Lopez |
a09598 |
/* === T Y P E D E F S ===================================================== */
|
|
Carlos Lopez |
a09598 |
|
|
Carlos Lopez |
a09598 |
/* === C L A S S E S & S T R U C T S ======================================= */
|
|
Carlos Lopez |
a09598 |
|
|
Carlos Lopez |
a09598 |
using namespace synfig;
|
|
Carlos Lopez |
a09598 |
using namespace etl;
|
|
Carlos Lopez |
a09598 |
|
|
Carlos Lopez |
80bfb8 |
class Plant : public Layer_Composite, public Layer_NoDeform
|
|
Carlos Lopez |
a09598 |
{
|
|
Carlos Lopez |
a09598 |
SYNFIG_LAYER_MODULE_EXT
|
|
Carlos Lopez |
a09598 |
private:
|
|
Carlos Lopez |
af09c9 |
//! Parameter: (std::vector<blinepoint>)</blinepoint>
|
|
Carlos Lopez |
af09c9 |
ValueBase param_bline;
|
|
Carlos Lopez |
af09c9 |
//! Parameter: (Point)
|
|
Carlos Lopez |
af09c9 |
ValueBase param_origin;
|
|
Carlos Lopez |
af09c9 |
//!Parameter: (Gradient)
|
|
Carlos Lopez |
af09c9 |
ValueBase param_gradient;
|
|
Carlos Lopez |
af09c9 |
//!Parameter: (Angle)
|
|
Carlos Lopez |
af09c9 |
ValueBase param_split_angle;
|
|
Carlos Lopez |
af09c9 |
//!Parameter: (Vector)
|
|
Carlos Lopez |
af09c9 |
ValueBase param_gravity;
|
|
Carlos Lopez |
af09c9 |
//!Parameter: (Real)
|
|
Carlos Lopez |
af09c9 |
ValueBase param_velocity;
|
|
Carlos Lopez |
af09c9 |
//!Parameter: (Real)
|
|
Carlos Lopez |
af09c9 |
ValueBase param_perp_velocity;
|
|
Carlos Lopez |
af09c9 |
//!Parameter: (Real)
|
|
Carlos Lopez |
af09c9 |
ValueBase param_size;
|
|
Carlos Lopez |
af09c9 |
//!Parameter: (bool)
|
|
Carlos Lopez |
af09c9 |
ValueBase param_size_as_alpha;
|
|
Carlos Lopez |
af09c9 |
//!Parameter: (bool)
|
|
Carlos Lopez |
af09c9 |
ValueBase param_reverse;
|
|
Carlos Lopez |
af09c9 |
//!Parameter: (Real)
|
|
Carlos Lopez |
af09c9 |
ValueBase param_step;
|
|
Carlos Lopez |
af09c9 |
//!Parameter: (Random)
|
|
Carlos Lopez |
af09c9 |
ValueBase param_random;
|
|
Carlos Lopez |
af09c9 |
//!Parameter: (int)
|
|
Carlos Lopez |
af09c9 |
ValueBase param_splits;
|
|
Carlos Lopez |
af09c9 |
//!Parameter: (int)
|
|
Carlos Lopez |
af09c9 |
ValueBase param_sprouts;
|
|
Carlos Lopez |
af09c9 |
//!Parameter: (Real)
|
|
Carlos Lopez |
af09c9 |
ValueBase param_random_factor;
|
|
Carlos Lopez |
af09c9 |
//!Parameter: (Real)
|
|
Carlos Lopez |
af09c9 |
ValueBase param_drag;
|
|
Carlos Lopez |
af09c9 |
//!Parameter: (bool)
|
|
Carlos Lopez |
af09c9 |
ValueBase param_use_width;
|
|
Carlos Lopez |
a09598 |
|
|
Carlos Lopez |
a09598 |
bool bline_loop;
|
|
Carlos Lopez |
a09598 |
|
|
Carlos Lopez |
a09598 |
struct Particle
|
|
Carlos Lopez |
a09598 |
{
|
|
Carlos Lopez |
80bfb8 |
Point point;
|
|
Carlos Lopez |
80bfb8 |
Color color;
|
|
Carlos Lopez |
a09598 |
|
|
Carlos Lopez |
80bfb8 |
Particle(const Point &point,const Color& color):
|
|
Carlos Lopez |
a09598 |
point(point),color(color) { }
|
|
Carlos Lopez |
a09598 |
};
|
|
Carlos Lopez |
a09598 |
|
|
Carlos Lopez |
a09598 |
mutable std::vector<particle> particle_list;</particle>
|
|
Carlos Lopez |
80bfb8 |
mutable Rect bounding_rect;
|
|
Carlos Lopez |
80bfb8 |
Real mass;
|
|
Carlos Lopez |
af09c9 |
|
|
Carlos Lopez |
a09598 |
mutable bool needs_sync_;
|
|
Rodolfo Ribeiro Gomes |
cfe072 |
mutable std::mutex mutex;
|
|
Carlos Lopez |
a09598 |
|
|
Carlos Lopez |
80bfb8 |
void branch(int n, int depth,float t, float stunt_growth, Point position,Vector velocity)const;
|
|
Carlos Lopez |
a09598 |
void sync()const;
|
|
Carlos Lopez |
a09598 |
String version;
|
|
Carlos Lopez |
80bfb8 |
void draw_particles(Surface *surface, const RendDesc &renddesc)const;
|
|
Carlos Lopez |
3ce6bc |
void draw_particles(cairo_t *cr)const;
|
|
Carlos Lopez |
a09598 |
|
|
Carlos Lopez |
a09598 |
public:
|
|
Carlos Lopez |
a09598 |
|
|
Carlos Lopez |
a09598 |
Plant();
|
|
Carlos Lopez |
a09598 |
|
|
Carlos Lopez |
a09598 |
void calc_bounding_rect()const;
|
|
Carlos Lopez |
a09598 |
|
|
Carlos Lopez |
80bfb8 |
virtual bool set_param(const String & param, const ValueBase &value);
|
|
Carlos Lopez |
a09598 |
|
|
Carlos Lopez |
a09598 |
virtual ValueBase get_param(const String & param)const;
|
|
Carlos Lopez |
a09598 |
|
|
Carlos Lopez |
80bfb8 |
virtual bool set_version(const String &ver);
|
|
Carlos Lopez |
a09598 |
|
|
Carlos Lopez |
a09598 |
virtual Vocab get_param_vocab()const;
|
|
Carlos Lopez |
a09598 |
|
|
Carlos Lopez |
80bfb8 |
virtual bool accelerated_render(Context context,Surface *surface,int quality, const RendDesc &renddesc, ProgressCallback *cb)const;
|
|
Carlos Lopez |
3ce6bc |
virtual bool accelerated_cairorender(Context context, cairo_t *cr, int quality, const RendDesc &renddesc, ProgressCallback *cb)const;
|
|
Carlos Lopez |
5e92bb |
using Layer::get_bounding_rect;
|
|
Carlos Lopez |
80bfb8 |
virtual Rect get_bounding_rect(Context context)const;
|
|
Carlos Lopez |
a09598 |
};
|
|
Carlos Lopez |
a09598 |
|
|
Carlos Lopez |
a09598 |
/* === E N D =============================================================== */
|
|
Carlos Lopez |
a09598 |
|
|
Carlos Lopez |
a09598 |
#endif
|