Commit 87750d99 authored by Mikael Magnusson's avatar Mikael Magnusson

plug-ins: tabs to spaces in map-object

parent 0f1da667
......@@ -96,7 +96,7 @@ ArcBall_Init (void)
void
ArcBall_Place (HVect Center,
double Radius)
double Radius)
{
center = Center;
radius = Radius;
......@@ -134,10 +134,10 @@ ArcBall_Update (void)
if (dragging)
{
if (axisSet!=NoAxes)
{
vFrom = ConstrainToAxis(vFrom, set[axisIndex]);
vTo = ConstrainToAxis(vTo, set[axisIndex]);
}
{
vFrom = ConstrainToAxis(vFrom, set[axisIndex]);
vTo = ConstrainToAxis(vTo, set[axisIndex]);
}
qDrag = Qt_FromBallPoints(vFrom, vTo);
qNow = Qt_Mul(qDrag, qDown);
}
......@@ -163,8 +163,8 @@ ArcBall_Value (HMatrix m_Now)
void
ArcBall_Values (double *alpha,
double *beta,
double *gamma)
double *beta,
double *gamma)
{
if ((*beta=asin(-mNow[0][2]))!=0.0)
{
......@@ -211,7 +211,7 @@ ArcBall_EndDrag (void)
static Quat
Qt_Mul (Quat qL,
Quat qR)
Quat qR)
{
Quat qq;
qq.w = qL.w*qR.w - qL.x*qR.x - qL.y*qR.y - qL.z*qR.z;
......@@ -229,14 +229,14 @@ Qt_Mul (Quat qL,
static void
Qt_ToMatrix (Quat q,
HMatrix out)
HMatrix out)
{
double Nq = q.x*q.x + q.y*q.y + q.z*q.z + q.w*q.w;
double s = (Nq > 0.0) ? (2.0 / Nq) : 0.0;
double xs = q.x*s, ys = q.y*s, zs = q.z*s;
double wx = q.w*xs, wy = q.w*ys, wz = q.w*zs;
double xx = q.x*xs, xy = q.x*ys, xz = q.x*zs;
double yy = q.y*ys, yz = q.y*zs, zz = q.z*zs;
double xs = q.x*s, ys = q.y*s, zs = q.z*s;
double wx = q.w*xs, wy = q.w*ys, wz = q.w*zs;
double xx = q.x*xs, xy = q.x*ys, xz = q.x*zs;
double yy = q.y*ys, yz = q.y*zs, zz = q.z*zs;
out[X][X] = 1.0 - (yy + zz); out[Y][X] = xy + wz; out[Z][X] = xz - wy;
out[X][Y] = xy - wz; out[Y][Y] = 1.0 - (xx + zz); out[Z][Y] = yz + wx;
out[X][Z] = xz + wy; out[Y][Z] = yz - wx; out[Z][Z] = 1.0 - (xx + yy);
......@@ -295,7 +295,7 @@ V3_Unit (HVect v)
static HVect
V3_Scale (HVect v,
double s)
double s)
{
HVect u;
u.x = s*v.x; u.y = s*v.y; u.z = s*v.z; u.w = v.w;
......@@ -318,7 +318,7 @@ V3_Negate (HVect v)
/*
static HVect
V3_Add (HVect v1,
HVect v2)
HVect v2)
{
static HVect v = {0, 0, 0, 0};
v.x = v1.x+v2.x; v.y = v1.y+v2.y; v.z = v1.z+v2.z;
......@@ -330,7 +330,7 @@ V3_Add (HVect v1,
static HVect
V3_Sub (HVect v1,
HVect v2)
HVect v2)
{
static HVect v = {0, 0, 0, 0};
v.x = v1.x-v2.x; v.y = v1.y-v2.y; v.z = v1.z-v2.z;
......@@ -342,7 +342,7 @@ V3_Sub (HVect v1,
/*
static HVect
V3_Bisect (HVect v0,
HVect v1)
HVect v1)
{
HVect v = {0, 0, 0, 0};
double Nv;
......@@ -360,7 +360,7 @@ V3_Bisect (HVect v0,
static double
V3_Dot (HVect v1,
HVect v2)
HVect v2)
{
return (v1.x*v2.x + v1.y*v2.y + v1.z*v2.z);
}
......@@ -371,7 +371,7 @@ V3_Dot (HVect v1,
/*
static HVect
V3_Cross (HVect v1,
HVect v2)
HVect v2)
{
static HVect v = {0, 0, 0, 0};
v.x = v1.y*v2.z-v1.z*v2.y;
......@@ -383,16 +383,16 @@ V3_Cross (HVect v1,
void
ArcBall_CopyMat (HMatrix inm,
HMatrix outm)
HMatrix outm)
{
int x=0,y=0;
for (x=0;x<4;x++)
{
for (y=0;y<4;y++)
{
outm[y][x]=inm[y][x];
}
{
outm[y][x]=inm[y][x];
}
}
}
......@@ -405,8 +405,8 @@ ArcBall_CopyMat (HMatrix inm,
static HVect
MouseOnSphere (HVect mouse,
HVect ballCenter,
double ballRadius)
HVect ballCenter,
double ballRadius)
{
HVect ballMouse;
register double mag;
......@@ -430,7 +430,7 @@ MouseOnSphere (HVect mouse,
static Quat
Qt_FromBallPoints (HVect from,
HVect to)
HVect to)
{
Quat qu;
qu.x = from.y*to.z - from.z*to.y;
......@@ -445,8 +445,8 @@ Qt_FromBallPoints (HVect from,
static void
Qt_ToBallPoints (Quat q,
HVect *arcFrom,
HVect *arcTo)
HVect *arcFrom,
HVect *arcTo)
{
double s;
......@@ -464,7 +464,7 @@ Qt_ToBallPoints (Quat q,
static HVect
ConstrainToAxis (HVect loose,
HVect axis)
HVect axis)
{
HVect onPlane;
register double norm;
......@@ -489,8 +489,8 @@ ConstrainToAxis (HVect loose,
static int
NearestConstraintAxis (HVect loose,
HVect *axes,
int nAxes)
HVect *axes,
int nAxes)
{
HVect onPlane;
register double max, dot;
......@@ -502,9 +502,9 @@ NearestConstraintAxis (HVect loose,
onPlane = ConstrainToAxis(loose, axes[i]);
dot = V3_Dot(onPlane, loose);
if (dot>max)
{
max = dot; nearest = i;
}
{
max = dot; nearest = i;
}
}
return (nearest);
}
......@@ -34,17 +34,17 @@ extern Quat qOne;
void ArcBall_Init (void);
void ArcBall_Place (HVect Center,
double Radius);
double Radius);
void ArcBall_UseSet (AxisSet axis_Set);
void ArcBall_Update (void);
void ArcBall_Value (HMatrix m_Now);
void ArcBall_Values (double *alpha,
double *beta,
double *gamma);
double *beta,
double *gamma);
void ArcBall_BeginDrag (void);
void ArcBall_EndDrag (void);
void ArcBall_Mouse (HVect v_Now);
void ArcBall_CopyMat (HMatrix inm,
HMatrix outm);
HMatrix outm);
#endif /* __ARCBALL_H__ */
......@@ -43,13 +43,13 @@ init_compute (void)
gimp_vector3_set (&mapvals.secondaxis, 0.0, 1.0, 0.0);
gimp_vector3_rotate (&mapvals.firstaxis,
gimp_deg_to_rad (mapvals.alpha),
gimp_deg_to_rad (mapvals.beta),
gimp_deg_to_rad (mapvals.gamma));
gimp_deg_to_rad (mapvals.alpha),
gimp_deg_to_rad (mapvals.beta),
gimp_deg_to_rad (mapvals.gamma));
gimp_vector3_rotate (&mapvals.secondaxis,
gimp_deg_to_rad (mapvals.alpha),
gimp_deg_to_rad (mapvals.beta),
gimp_deg_to_rad (mapvals.gamma));
gimp_deg_to_rad (mapvals.alpha),
gimp_deg_to_rad (mapvals.beta),
gimp_deg_to_rad (mapvals.gamma));
/* Compute the 2D bounding box of the sphere spanned by the axis */
/* ============================================================= */
......@@ -70,16 +70,16 @@ init_compute (void)
gimp_vector3_set (&mapvals.normal, 0.0, 0.0, 1.0);
gimp_vector3_rotate (&mapvals.firstaxis,
gimp_deg_to_rad (mapvals.alpha),
gimp_deg_to_rad (mapvals.beta),
gimp_deg_to_rad (mapvals.gamma));
gimp_deg_to_rad (mapvals.alpha),
gimp_deg_to_rad (mapvals.beta),
gimp_deg_to_rad (mapvals.gamma));
gimp_vector3_rotate (&mapvals.secondaxis,
gimp_deg_to_rad (mapvals.alpha),
gimp_deg_to_rad (mapvals.beta),
gimp_deg_to_rad (mapvals.gamma));
gimp_deg_to_rad (mapvals.alpha),
gimp_deg_to_rad (mapvals.beta),
gimp_deg_to_rad (mapvals.gamma));
mapvals.normal = gimp_vector3_cross_product (&mapvals.firstaxis,
&mapvals.secondaxis);
&mapvals.secondaxis);
if (mapvals.normal.z < 0.0)
gimp_vector3_mul (&mapvals.normal, -1.0);
......@@ -133,12 +133,12 @@ init_compute (void)
for (i = 0; i < 6; i++)
{
box_drawables[i] = gimp_drawable_get (mapvals.boxmap_id[i]);
box_drawables[i] = gimp_drawable_get (mapvals.boxmap_id[i]);
gimp_pixel_rgn_init (&box_regions[i], box_drawables[i],
gimp_pixel_rgn_init (&box_regions[i], box_drawables[i],
0, 0,
box_drawables[i]->width,
box_drawables[i]->height,
box_drawables[i]->height,
FALSE, FALSE);
}
......@@ -174,13 +174,13 @@ init_compute (void)
for (i = 0; i < 2; i++)
{
cylinder_drawables[i] =
gimp_drawable_get (mapvals.cylindermap_id[i]);
cylinder_drawables[i] =
gimp_drawable_get (mapvals.cylindermap_id[i]);
gimp_pixel_rgn_init (&cylinder_regions[i], cylinder_drawables[i],
gimp_pixel_rgn_init (&cylinder_regions[i], cylinder_drawables[i],
0, 0,
cylinder_drawables[i]->width,
cylinder_drawables[i]->height,
cylinder_drawables[i]->height,
FALSE, FALSE);
}
......@@ -192,9 +192,9 @@ init_compute (void)
static void
render (gdouble x,
gdouble y,
GimpRGB *col,
gpointer data)
gdouble y,
GimpRGB *col,
gpointer data)
{
GimpVector3 pos;
......@@ -207,9 +207,9 @@ render (gdouble x,
static void
show_progress (gint min,
gint max,
gint curr,
gpointer data)
gint max,
gint curr,
gpointer data)
{
gimp_progress_update ((gdouble) curr / (gdouble) max);
}
......@@ -264,7 +264,7 @@ compute_image (void)
}
gimp_pixel_rgn_init (&dest_region, output_drawable,
0, 0, width, height, TRUE, TRUE);
0, 0, width, height, TRUE, TRUE);
switch (mapvals.maptype)
{
......@@ -294,22 +294,22 @@ compute_image (void)
if ((progress_counter++ % width) == 0)
gimp_progress_update ((gdouble) progress_counter /
(gdouble) maxcounter);
(gdouble) maxcounter);
}
}
}
else
{
gimp_adaptive_supersample_area (0, 0,
width - 1, height - 1,
max_depth,
mapvals.pixeltreshold,
render,
NULL,
poke,
NULL,
show_progress,
NULL);
width - 1, height - 1,
max_depth,
mapvals.pixeltreshold,
render,
NULL,
poke,
NULL,
show_progress,
NULL);
}
/* Update the region */
......
......@@ -78,8 +78,8 @@ peek (gint x,
static GimpRGB
peek_box_image (gint image,
gint x,
gint y)
gint x,
gint y)
{
static guchar data[4];
......@@ -108,8 +108,8 @@ peek_box_image (gint image,
static GimpRGB
peek_cylinder_image (gint image,
gint x,
gint y)
gint x,
gint y)
{
static guchar data[4];
......@@ -151,7 +151,7 @@ poke (gint x,
gint
checkbounds (gint x,
gint y)
gint y)
{
if (x < border_x1 || y < border_y1 || x >= border_x2 || y >= border_y2)
return FALSE;
......@@ -161,8 +161,8 @@ checkbounds (gint x,
static gint
checkbounds_box_image (gint image,
gint x,
gint y)
gint x,
gint y)
{
gint w, h;
......@@ -177,8 +177,8 @@ checkbounds_box_image (gint image,
static gint
checkbounds_cylinder_image (gint image,
gint x,
gint y)
gint x,
gint y)
{
gint w, h;
......@@ -193,7 +193,7 @@ checkbounds_cylinder_image (gint image,
GimpVector3
int_to_pos (gint x,
gint y)
gint y)
{
GimpVector3 pos;
......@@ -206,9 +206,9 @@ int_to_pos (gint x,
void
pos_to_int (gdouble x,
gdouble y,
gint *scr_x,
gint *scr_y)
gdouble y,
gint *scr_x,
gint *scr_y)
{
*scr_x = (gint) ((x * (gdouble) width));
*scr_y = (gint) ((y * (gdouble) height));
......@@ -221,8 +221,8 @@ pos_to_int (gdouble x,
GimpRGB
get_image_color (gdouble u,
gdouble v,
gint *inside)
gdouble v,
gint *inside)
{
gint x1, y1, x2, y2;
GimpRGB p[4];
......@@ -279,8 +279,8 @@ get_image_color (gdouble u,
GimpRGB
get_box_image_color (gint image,
gdouble u,
gdouble v)
gdouble u,
gdouble v)
{
gint w, h;
gint x1, y1, x2, y2;
......@@ -311,8 +311,8 @@ get_box_image_color (gint image,
GimpRGB
get_cylinder_image_color (gint image,
gdouble u,
gdouble v)
gdouble u,
gdouble v)
{
gint w, h;
gint x1, y1, x2, y2;
......@@ -347,13 +347,13 @@ get_cylinder_image_color (gint image,
gint
image_setup (GimpDrawable *drawable,
gint interactive)
gint interactive)
{
/* Set the tile cache size */
/* ======================= */
gimp_tile_cache_ntiles ((drawable->width + gimp_tile_width() - 1) /
gimp_tile_width ());
gimp_tile_width ());
/* Get some useful info on the input drawable */
/* ========================================== */
......@@ -362,13 +362,13 @@ image_setup (GimpDrawable *drawable,
output_drawable = drawable;
gimp_drawable_mask_bounds (drawable->drawable_id,
&border_x1, &border_y1, &border_x2, &border_y2);
&border_x1, &border_y1, &border_x2, &border_y2);
width = input_drawable->width;
height = input_drawable->height;
gimp_pixel_rgn_init (&source_region, input_drawable,
0, 0, width, height, FALSE, FALSE);
0, 0, width, height, FALSE, FALSE);
maxcounter = (glong) width * (glong) height;
......
......@@ -30,34 +30,34 @@ extern GimpTile *current_in_tile, *current_out_tile;
/* ============================ */
extern gint image_setup (GimpDrawable *drawable,
gint interactive);
gint interactive);
extern glong in_xy_to_index (gint x,
gint y);
gint y);
extern glong out_xy_to_index (gint x,
gint y);
gint y);
extern gint checkbounds (gint x,
gint y);
gint y);
extern GimpRGB peek (gint x,
gint y);
gint y);
extern void poke (gint x,
gint y,
GimpRGB *color,
gpointer data);
gint y,
GimpRGB *color,
gpointer data);
extern GimpVector3 int_to_pos (gint x,
gint y);
gint y);
extern void pos_to_int (gdouble x,
gdouble y,
gint *scr_x,
gint *scr_y);
gdouble y,
gint *scr_x,
gint *scr_y);
extern GimpRGB get_image_color (gdouble u,
gdouble v,
gint *inside);
gdouble v,
gint *inside);
extern GimpRGB get_box_image_color (gint image,
gdouble u,
gdouble v);
gdouble u,
gdouble v);
extern GimpRGB get_cylinder_image_color (gint image,
gdouble u,
gdouble v);
gdouble u,
gdouble v);
#endif /* __MAPOBJECT_IMAGE_H__ */
......@@ -111,7 +111,7 @@ check_drawables (GimpDrawable *drawable)
for (i = 0; i < 6; i++)
{
if (mapvals.boxmap_id[i] == -1 ||
!gimp_item_is_valid (mapvals.boxmap_id[i]) ||
!gimp_item_is_valid (mapvals.boxmap_id[i]) ||
gimp_drawable_is_gray (mapvals.boxmap_id[i]))
mapvals.boxmap_id[i] = drawable->drawable_id;
}
......@@ -185,16 +185,16 @@ query (void)
};
gimp_install_procedure (PLUG_IN_PROC,
N_("Map the image to an object (plane, sphere, box or cylinder)"),
"No help yet",
"Tom Bech & Federico Mena Quintero",
"Tom Bech & Federico Mena Quintero",
"Version 1.2.0, July 16 1998",
N_("Map _Object..."),
"RGB*",
GIMP_PLUGIN,
G_N_ELEMENTS (args), 0,
args, NULL);
N_("Map the image to an object (plane, sphere, box or cylinder)"),
"No help yet",
"Tom Bech & Federico Mena Quintero",
"Tom Bech & Federico Mena Quintero",
"Version 1.2.0, July 16 1998",
N_("Map _Object..."),
"RGB*",
GIMP_PLUGIN,
G_N_ELEMENTS (args), 0,
args, NULL);
gimp_plugin_menu_register (PLUG_IN_PROC, "<Image>/Filters/Map");
}
......@@ -243,11 +243,11 @@ run (const gchar *name,
gimp_get_data ("plug_in_map_object", &mapvals);
check_drawables (drawable);
if (main_dialog (drawable))
{
compute_image ();
{
compute_image ();
gimp_set_data (PLUG_IN_PROC, &mapvals, sizeof (MapObjectValues));
}
gimp_set_data (PLUG_IN_PROC, &mapvals, sizeof (MapObjectValues));
}
break;
case GIMP_RUN_WITH_LAST_VALS:
......@@ -259,9 +259,9 @@ run (const gchar *name,
case GIMP_RUN_NONINTERACTIVE:
if (nparams != 50)
{
status = GIMP_PDB_CALLING_ERROR;
}
{
status = GIMP_PDB_CALLING_ERROR;
}
else
{
mapvals.maptype = (MapType) param[3].data.d_int32;
......@@ -281,7 +281,7 @@ run (const gchar *name,
mapvals.beta = param[17].data.d_float;
mapvals.gamma = param[18].data.d_float;
mapvals.lightsource.type = (LightType) param[19].data.d_int32;
mapvals.lightsource.color = param[20].data.d_color;
mapvals.lightsource.color = param[20].data.d_color;
mapvals.lightsource.position.x = param[21].data.d_float;
mapvals.lightsource.position.y = param[22].data.d_float;
mapvals.lightsource.position.z = param[23].data.d_float;
......
......@@ -31,18 +31,18 @@ static void compute_preview (gint x,
gint ph);
static void draw_light_marker (cairo_t *cr,
gint xpos,
gint ypos);
gint ypos);
static void draw_line (cairo_t *cr,
gint startx,
gint starty,
gint pw,
gint ph,
gdouble cx1,
gdouble cy1,
gdouble cx2,
gdouble cy2,
GimpVector3 a,
GimpVector3 b);
gint startx,
gint starty,
gint pw,
gint ph,
gdouble cx1,
gdouble cy1,
gdouble cx2,
gdouble cy2,
GimpVector3 a,
GimpVector3 b);
static void draw_wireframe (cairo_t *cr,
gint startx,
gint starty,
......@@ -51,24 +51,24 @@ static void draw_wireframe (cairo_t *cr,
static void draw_preview_wireframe (cairo_t *cr);
static void draw_wireframe_plane (cairo_t *cr,
gint startx,
gint starty,
gint pw,
gint ph);
gint starty,
gint pw,
gint ph);
static void draw_wireframe_sphere (cairo_t *cr,
gint startx,
gint starty,
gint pw,
gint ph);
gint starty,
gint pw,
gint ph);
static void draw_wireframe_box (cairo_t *cr,
gint startx,
gint starty,
gint pw,
gint ph);
gint starty,
gint pw,
gint ph);
static void draw_wireframe_cylinder (cairo_t *cr,
gint startx,
gint starty,
gint pw,
gint ph);
gint starty,
gint pw,
gint ph);
/**************************************************************/
/* Computes a preview of the rectangle starting at (x,y) with */
......@@ -77,11 +77,11 @@ static void draw_wireframe_cylinder (cairo_t *cr,
static void
compute_preview (gint x,
gint y,
gint w,
gint h,
gint pw,
gint ph)
gint y,
gint w,
gint h,
gint pw,
gint ph)
{
gdouble xpostab[PREVIEW_WIDTH];
gdouble ypostab[PREVIEW_HEIGHT];
......@@ -125,9 +125,9 @@ compute_preview (gint x,
}
gimp_rgba_set (&lightcheck,
GIMP_CHECK_LIGHT, GIMP_CHECK_LIGHT, GIMP_CHECK_LIGHT, 1.0);
GIMP_CHECK_LIGHT, GIMP_CHECK_LIGHT, GIMP_CHECK_LIGHT, 1.0);
gimp_rgba_set (&darkcheck,
GIMP_CHECK_DARK, GIMP_CHECK_DARK, GIMP_CHECK_DARK, 1.0);
GIMP_CHECK_DARK, GIMP_CHECK_DARK, GIMP_CHECK_DARK, 1.0);
gimp_vector3_set (&p2, -1.0, -1.0, 0.0);
cairo_surface_flush (preview_surface);
......@@ -152,22 +152,22 @@ compute_preview (gint x,
if (f1)
{
if (color.a == 0.0)
color = lightcheck;
color = lightcheck;
else
gimp_rgb_composite (&color, &lightcheck,
GIMP_RGB_COMPOSITE_BEHIND);
gimp_rgb_composite (&color, &lightcheck,