+/* Goom Project
+ * Copyright (C) <2003> iOS-Software
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library 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
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
#include <stdlib.h>
#include "v3d.h"
/* statics from pretty_move */
float distt;
float distt2;
- float rot; /* entre 0 et 2 * M_PI */
+ float rot; /* entre 0 et 2 * G_PI */
int happens;
int rotation;
int lock;
TentacleFXData *data = (TentacleFXData *) malloc (sizeof (TentacleFXData));
- data->enabled_bp = secure_b_param ("Enabled", 1);
- data->params = plugin_parameters ("3D Tentacles", 1);
+ secure_b_param (&data->enabled_bp, "Enabled", 1);
+ plugin_parameters (&data->params, "3D Tentacles", 1);
data->params.params[0] = &data->enabled_bp;
data->cycle = 0.0f;
data->distt = 10.0f;
data->distt2 = 0.0f;
- data->rot = 0.0f; /* entre 0 et 2 * M_PI */
+ data->rot = 0.0f; /* entre 0 et 2 * G_PI */
data->happens = 0;
data->rotation = 0;
free (_this->fx_data);
}
-VisualFX
-tentacle_fx_create (void)
+void
+tentacle_fx_create (VisualFX * fx)
{
- VisualFX fx;
-
- fx.init = tentacle_fx_init;
- fx.apply = tentacle_fx_apply;
- fx.free = tentacle_fx_free;
- return fx;
+ fx->init = tentacle_fx_init;
+ fx->apply = tentacle_fx_apply;
+ fx->free = tentacle_fx_free;
+ fx->fx_data = NULL;
+ fx->params = NULL;
}
/* ----- */
static void
tentacle_free (TentacleFXData * data)
{
- /* TODO : un vrai FREE GRID!! */
+ int tmp;
+
+ /* FREE GRID */
+ for (tmp = 0; tmp < nbgrid; tmp++)
+ grid3d_free (data->grille[tmp]);
free (data->vals);
+
+ goom_plugin_parameters_free (&data->params);
}
static void
*dist = fx_data->distt = (tmp + 3.0f * fx_data->distt) / 4.0f;
if (!fx_data->happens) {
- tmp = M_PI * sin (cycle) / 32 + 3 * M_PI / 2;
+ tmp = G_PI * sin (cycle) / 32 + 3 * G_PI / 2;
} else {
fx_data->rotation =
goom_irand (goomInfo->gRandom,
500) ? fx_data->rotation : goom_irand (goomInfo->gRandom, 2);
if (fx_data->rotation)
- cycle *= 2.0f * M_PI;
+ cycle *= 2.0f * G_PI;
else
- cycle *= -1.0f * M_PI;
- tmp = cycle - (M_PI * 2.0) * floor (cycle / (M_PI * 2.0));
+ cycle *= -1.0f * G_PI;
+ tmp = cycle - (G_PI * 2.0) * floor (cycle / (G_PI * 2.0));
}
- if (abs (tmp - fx_data->rot) > abs (tmp - (fx_data->rot + 2.0 * M_PI))) {
- fx_data->rot = (tmp + 15.0f * (fx_data->rot + 2 * M_PI)) / 16.0f;
- if (fx_data->rot > 2.0 * M_PI)
- fx_data->rot -= 2.0 * M_PI;
+ if (fabs (tmp - fx_data->rot) > fabs (tmp - (fx_data->rot + 2.0 * G_PI))) {
+ fx_data->rot = (tmp + 15.0f * (fx_data->rot + 2 * G_PI)) / 16.0f;
+ if (fx_data->rot > 2.0 * G_PI)
+ fx_data->rot -= 2.0 * G_PI;
*rotangle = fx_data->rot;
- } else if (abs (tmp - fx_data->rot) > abs (tmp - (fx_data->rot - 2.0 * M_PI))) {
- fx_data->rot = (tmp + 15.0f * (fx_data->rot - 2.0 * M_PI)) / 16.0f;
+ } else if (fabs (tmp - fx_data->rot) >
+ fabs (tmp - (fx_data->rot - 2.0 * G_PI))) {
+ fx_data->rot = (tmp + 15.0f * (fx_data->rot - 2.0 * G_PI)) / 16.0f;
if (fx_data->rot < 0.0f)
- fx_data->rot += 2.0 * M_PI;
+ fx_data->rot += 2.0 * G_PI;
*rotangle = fx_data->rot;
} else
*rotangle = fx_data->rot = (tmp + 15.0f * fx_data->rot) / 16.0f;
float val =
(float) (ShiftRight (data[0][goom_irand (goomInfo->gRandom, 511)],
10)) * rapport;
+
fx_data->vals[tmp2] = val;
}