mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-23 10:11:08 +00:00
6eb6d5b9ac
Original commit message from CVS: * gst/goom/Makefile.am: * gst/goom/README: * gst/goom/config_param.c: * gst/goom/convolve_fx.c: * gst/goom/drawmethods.c: * gst/goom/drawmethods.h: * gst/goom/filters.c: * gst/goom/filters_mmx.s: * gst/goom/flying_stars_fx.c: * gst/goom/goom.h: * gst/goom/goom_config.h: * gst/goom/goom_config_param.h: * gst/goom/goom_core.c: * gst/goom/goom_filters.h: * gst/goom/goom_fx.h: * gst/goom/goom_graphic.h: * gst/goom/goom_plugin_info.h: * gst/goom/goom_tools.c: * gst/goom/goom_tools.h: * gst/goom/goom_typedefs.h: * gst/goom/goom_visual_fx.h: * gst/goom/graphic.c: * gst/goom/ifs.c: * gst/goom/ifs.h: * gst/goom/lines.c: * gst/goom/lines.h: * gst/goom/mathtools.c: * gst/goom/mathtools.h: * gst/goom/mmx.c: * gst/goom/motif_goom1.h: * gst/goom/motif_goom2.h: * gst/goom/plugin_info.c: * gst/goom/ppc_drawings.h: * gst/goom/ppc_zoom_ultimate.h: * gst/goom/sound_tester.c: * gst/goom/sound_tester.h: * gst/goom/surf3d.c: * gst/goom/surf3d.h: * gst/goom/tentacle3d.c: * gst/goom/tentacle3d.h: * gst/goom/v3d.c: * gst/goom/v3d.h: * gst/goom/xmmx.c: Add license headers in all source files. Remove filter.c from EXTRA_DIST, as its in SOURCES already. Mention the files in the REDME which are not used right now. Fixes #557709.
152 lines
3.4 KiB
C
152 lines
3.4 KiB
C
/* 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., 59 Temple Place - Suite 330,
|
|
* Boston, MA 02111-1307, USA.
|
|
*/
|
|
#include "surf3d.h"
|
|
#include "goom_plugin_info.h"
|
|
#include <stdlib.h>
|
|
#include <stdio.h>
|
|
#include <string.h>
|
|
|
|
grid3d *
|
|
grid3d_new (int sizex, int defx, int sizez, int defz, v3d center)
|
|
{
|
|
int x = defx;
|
|
int y = defz;
|
|
grid3d *g = malloc (sizeof (grid3d));
|
|
surf3d *s = &(g->surf);
|
|
|
|
s->nbvertex = x * y;
|
|
s->vertex = malloc (x * y * sizeof (v3d));
|
|
s->svertex = malloc (x * y * sizeof (v3d));
|
|
s->center = center;
|
|
|
|
g->defx = defx;
|
|
g->sizex = sizex;
|
|
g->defz = defz;
|
|
g->sizez = sizez;
|
|
g->mode = 0;
|
|
|
|
while (y) {
|
|
--y;
|
|
x = defx;
|
|
while (x) {
|
|
--x;
|
|
s->vertex[x + defx * y].x = (float) (x - defx / 2) * sizex / defx;
|
|
s->vertex[x + defx * y].y = 0;
|
|
s->vertex[x + defx * y].z = (float) (y - defz / 2) * sizez / defz;
|
|
}
|
|
}
|
|
return g;
|
|
}
|
|
|
|
void
|
|
grid3d_free (grid3d * g)
|
|
{
|
|
surf3d *s = &(g->surf);
|
|
|
|
free (s->vertex);
|
|
free (s->svertex);
|
|
|
|
free (g);
|
|
}
|
|
|
|
void
|
|
grid3d_draw (PluginInfo * plug, grid3d * g, int color, int colorlow,
|
|
int dist, Pixel * buf, Pixel * back, int W, int H)
|
|
{
|
|
|
|
int x;
|
|
v2d v2, v2x;
|
|
|
|
v2d *v2_array = malloc (g->surf.nbvertex * sizeof (v2d));
|
|
|
|
v3d_to_v2d (g->surf.svertex, g->surf.nbvertex, W, H, dist, v2_array);
|
|
|
|
for (x = 0; x < g->defx; x++) {
|
|
int z;
|
|
|
|
v2x = v2_array[x];
|
|
|
|
for (z = 1; z < g->defz; z++) {
|
|
v2 = v2_array[z * g->defx + x];
|
|
if (((v2.x != -666) || (v2.y != -666))
|
|
&& ((v2x.x != -666) || (v2x.y != -666))) {
|
|
plug->methods.draw_line (buf, v2x.x, v2x.y, v2.x, v2.y, colorlow, W, H);
|
|
plug->methods.draw_line (back, v2x.x, v2x.y, v2.x, v2.y, color, W, H);
|
|
}
|
|
v2x = v2;
|
|
}
|
|
}
|
|
|
|
free (v2_array);
|
|
}
|
|
|
|
void
|
|
surf3d_rotate (surf3d * s, float angle)
|
|
{
|
|
int i;
|
|
float cosa;
|
|
float sina;
|
|
|
|
SINCOS (angle, sina, cosa);
|
|
for (i = 0; i < s->nbvertex; i++) {
|
|
Y_ROTATE_V3D (s->vertex[i], s->svertex[i], cosa, sina);
|
|
}
|
|
}
|
|
|
|
void
|
|
surf3d_translate (surf3d * s)
|
|
{
|
|
int i;
|
|
|
|
for (i = 0; i < s->nbvertex; i++) {
|
|
TRANSLATE_V3D (s->center, s->svertex[i]);
|
|
}
|
|
}
|
|
|
|
void
|
|
grid3d_update (grid3d * g, float angle, float *vals, float dist)
|
|
{
|
|
int i;
|
|
float cosa;
|
|
float sina;
|
|
surf3d *s = &(g->surf);
|
|
v3d cam = s->center;
|
|
|
|
cam.z += dist;
|
|
|
|
SINCOS ((angle / 4.3f), sina, cosa);
|
|
cam.y += sina * 2.0f;
|
|
SINCOS (angle, sina, cosa);
|
|
|
|
if (g->mode == 0) {
|
|
if (vals)
|
|
for (i = 0; i < g->defx; i++)
|
|
s->vertex[i].y = s->vertex[i].y * 0.2 + vals[i] * 0.8;
|
|
|
|
for (i = g->defx; i < s->nbvertex; i++) {
|
|
s->vertex[i].y *= 0.255f;
|
|
s->vertex[i].y += (s->vertex[i - g->defx].y * 0.777f);
|
|
}
|
|
}
|
|
|
|
for (i = 0; i < s->nbvertex; i++) {
|
|
Y_ROTATE_V3D (s->vertex[i], s->svertex[i], cosa, sina);
|
|
TRANSLATE_V3D (cam, s->svertex[i]);
|
|
}
|
|
}
|