Minor portability fixes.

1999-08-31  Tor Lillqvist  <tml@iki.fi>

* plug-ins/common/spheredesigner.c: Minor portability fixes.

* plug-ins/makefile.{cygwin,msc}: Add spheredesigner.
This commit is contained in:
Tor Lillqvist
1999-08-31 16:49:46 +00:00
committed by Tor Lillqvist
parent 0b52355fda
commit 2eafd14351
5 changed files with 27 additions and 9 deletions

View File

@ -1,3 +1,9 @@
1999-08-31 Tor Lillqvist <tml@iki.fi>
* plug-ins/common/spheredesigner.c: Minor portability fixes.
* plug-ins/makefile.{cygwin,msc}: Add spheredesigner.
Tue Aug 31 14:25:50 CET 1999 vidar@prosalg.no (Vidar Madsen)
* plug-ins/common/Makefile.am

View File

@ -541,6 +541,8 @@ gih_save_dialog ()
gtk_combo_set_popdown_strings (GTK_COMBO (cb), cbitems);
if (gihparms.selection[i])
gtk_entry_set_text (GTK_ENTRY (GTK_COMBO (cb)->entry), gihparms.selection[i]);
else
gtk_entry_set_text (GTK_ENTRY (GTK_COMBO (cb)->entry), "random");
gtk_entry_set_editable (GTK_ENTRY (GTK_COMBO (cb)->entry), FALSE);
gtk_box_pack_start (GTK_BOX (box), cb, FALSE, TRUE, 2);

View File

@ -1,13 +1,23 @@
#include "config.h"
#include <stdio.h>
#include <string.h>
#include <gtk/gtk.h>
#include <sys/time.h>
#ifdef HAVE_UNISTD_H
#include <unistd.h>
#endif
#include <stdlib.h>
#include <math.h>
#include <string.h>
#include <time.h>
#include <libgimp/gimp.h>
#ifndef G_PI /* G_PI will be in GLib eventually */
#define G_PI 3.14159265358979323846
#endif
#define PREVIEWSIZE 150
#define MAXOBJECT 100
@ -250,11 +260,11 @@ void init(void)
/* Create an array of random gradient vectors uniformly on the unit sphere */
srandom(1);
SRAND_FUNC(time(NULL));
for (i = 0 ; i < B ; i++) {
do { /* Choose uniformly in a cube */
for (j=0 ; j<3 ; j++)
v[j] = (double)((random() % (B + B)) - B) / B;
v[j] = (double)((RAND_FUNC() % (B + B)) - B) / B;
s = DOT(v,v);
} while (s > 1.0); /* If not in sphere try again */
s = sqrt(s);
@ -268,7 +278,7 @@ void init(void)
p[i] = i;
for (i = B ; i > 0 ; i -= 2) {
k = p[i];
p[i] = p[j = random() % B];
p[i] = p[j = RAND_FUNC() % B];
p[j] = k;
}
@ -419,7 +429,7 @@ inline void vnorm(vector *a, double v)
inline void vrotate(vector *axis, double ang, vector *vector)
{
double rad = ang / 180.0 * M_PI;
double rad = ang / 180.0 * G_PI;
double ax = vector->x;
double ay = vector->y;
double az = vector->z;
@ -840,7 +850,7 @@ void spiral(vector *q, vector *col, texture *t)
vcopy(&p, q);
transformpoint(&p, t);
f = fabs(atan2(p.x, p.z)/M_PI/2 + p.y + 99999);
f = fabs(atan2(p.x, p.z)/G_PI/2 + p.y + 99999);
f = f - (int)f;
f = pow(f, t->exp);
@ -865,7 +875,7 @@ void spots(vector *q, vector *col, texture *t)
vset(&r, (int)(p.x+0.5), (int)(p.y+0.5), (int)(p.z+0.5));
f = vdist(&p,&r);
f = cos(f*M_PI);
f = cos(f*G_PI);
if(f < 0.0) f = 0.0;
else if(f > 1.0) f = 1.0;
f = pow(f, t->exp);
@ -919,7 +929,7 @@ void imagepixel(vector *q, vector *col, texture *t)
double frand(double v)
{
return (rand() / (double)RAND_MAX - 0.5) * v;
return (RAND_FUNC() / (double)RAND_MAX - 0.5) * v;
}
int traceray(ray *r, vector *col, int level, double imp);

View File

@ -26,7 +26,7 @@ COMMON1 = CEL CML_explorer align_layers animationplay animoptimize apply_lens au
COMMON2 = decompose deinterlace depthmerge despeckle destripe diffraction displace edge emboss engrave exchange film flarefx fractaltrace
COMMON3 = gauss_iir gauss_rle gbr gee gicon gif gifload glasstile gpb gqbist gradmap grid gtm guillotine gz header hot hrz illusion iwarp jigsaw jpeg laplace lic
COMMON4 = mapcolor max_rgb mblur newsprint nlfilt noisify normalize nova oilify palette papertile pat pcx pix pixelize plasma plugindetails png pnm polar ps psd psp randomize ripple rotate rotators
COMMON5 = sample_colorize scatter_hsv semiflatten sharpen shift smooth_palette snoise sobel sparkle spread sunras tga threshold_alpha tiff tile tileit tiler video vinvert vpropagate waves whirlpinch winclipboard wind winprint wmf xbm xwd zealouscrop
COMMON5 = sample_colorize scatter_hsv semiflatten sharpen shift smooth_palette snoise sobel sparkle spheredesigner spread sunras tga threshold_alpha tiff tile tileit tiler video vinvert vpropagate waves whirlpinch winclipboard wind winprint wmf xbm xwd zealouscrop
# These have own subdirectories each
SEPARATE = AlienMap FractalExplorer Lighting MapObject bmp borderaverage dbbrowser faxg3 fits flame fp gfig gfli gimpressionist ifscompose maze mosaic pagecurl rcm sel2path sgi sinus struc twain unsharp winsnap

View File

@ -25,7 +25,7 @@ COMMON1 = CEL CML_explorer align_layers animationplay animoptimize apply_lens au
COMMON2 = decompose deinterlace depthmerge despeckle destripe diffraction displace edge emboss engrave exchange film flarefx fractaltrace
COMMON3 = gauss_iir gauss_rle gbr gee gicon gif gifload glasstile gpb gqbist gradmap grid gtm guillotine gz header hot hrz illusion iwarp jigsaw jpeg laplace lic
COMMON4 = mapcolor max_rgb mblur newsprint nlfilt noisify normalize nova oilify palette papertile pat pcx pix pixelize plasma plugindetails png pnm polar ps psd randomize ripple rotate rotators
COMMON5 = sample_colorize scatter_hsv semiflatten sharpen shift smooth_palette snoise sobel sparkle spread sunras tga threshold_alpha tiff tile tileit tiler video vinvert vpropagate waves whirlpinch winclipboard wind winprint wmf xbm xwd zealouscrop
COMMON5 = sample_colorize scatter_hsv semiflatten sharpen shift smooth_palette snoise sobel sparkle spheredesigner spread sunras tga threshold_alpha tiff tile tileit tiler video vinvert vpropagate waves whirlpinch winclipboard wind winprint wmf xbm xwd zealouscrop
# These have own subdirectories each
SEPARATE = AlienMap FractalExplorer Lighting MapObject bmp borderaverage dbbrowser faxg3 fits flame fp gfig gfli gimpressionist ifscompose maze mosaic pagecurl rcm sel2path sgi sinus struc twain unsharp winsnap