mirror of
https://github.com/id-Software/GtkRadiant.git
synced 2026-03-19 16:39:26 +01:00
The GtkRadiant sources as originally released under the GPL license.
This commit is contained in:
4
contrib/gtkgensurf/.cvsignore
Normal file
4
contrib/gtkgensurf/.cvsignore
Normal file
@@ -0,0 +1,4 @@
|
||||
Debug
|
||||
*.plg
|
||||
*.BAK
|
||||
*.d
|
||||
73
contrib/gtkgensurf/CHANGES
Normal file
73
contrib/gtkgensurf/CHANGES
Normal file
@@ -0,0 +1,73 @@
|
||||
05/14/2001
|
||||
^Fishman
|
||||
===============
|
||||
bitmap.cpp
|
||||
Added Hydra's snap to grid code.
|
||||
===============
|
||||
dec.cpp
|
||||
Modified to support the new max size for the maps(Q3 1.27).
|
||||
===============
|
||||
face.cpp
|
||||
Modified to support the new max size for the maps(Q3 1.27).
|
||||
===============
|
||||
font.cpp
|
||||
Changed the fonts color to green, part of the new theme.
|
||||
===============
|
||||
gendlgs.cpp
|
||||
Added a label and textbox for the snap to grid feature.
|
||||
Added a checkbox for adding terrain key to func_group.
|
||||
Added a checkbox for antialiased lines in the preview window.
|
||||
Modified a textbox to support the new max size for the maps(Q3 1.27).
|
||||
Modified the About dialog.
|
||||
===============
|
||||
genmap.cpp
|
||||
Modified to support the new max size for the maps(Q3 1.27).
|
||||
Added code for adding terrain key to func_group.
|
||||
===============
|
||||
gensurf.cpp
|
||||
Added code to save the settings of the antialiasing checkbox status and the terrain key checkbox status.
|
||||
Modified version number.
|
||||
===============
|
||||
view.cpp
|
||||
Modified code for the new Green/Black theme.
|
||||
Added code to antialiase lines in the preview window
|
||||
|
||||
12/18/2000
|
||||
MrHyde
|
||||
===============
|
||||
bitmap.cpp
|
||||
Corrected a substitution error that would prevent code from reading a selected bitmap on the first pass, and possibly leave the bitmap file open.
|
||||
Checks to ensure that main window has been created before updating the preview (which might be done if a bitmap filename was saved to ini file). Previous failure to do this resulted in Radiant console error messages.
|
||||
===============
|
||||
gendlgs.cpp
|
||||
One tooltip was goofed up ("preview" instead of "main_preview"), resulting in "invalid cast from (NULL) pointer to GtkObject" in Radiant console.
|
||||
Tooltips - oops. Use wave_radios[] rather than string constants.
|
||||
Moved check for game type from SetDlgValues to GenSurfInit in gensurf.cpp. Since the game type presumably won't change while GenSurf is active this only needs to be checked once (and if it IS possible to change the game while GenSurf is active then quite a bit more needs to be changed).
|
||||
Worked around strange bug in SetDlgValues. In release dll (not debug), the 2nd pass through the set_sensitive loop for game_radios crashed. Since the state of those radio buttons won't ever change during a single session, the state is only set once now. Sure would like to know what's going on there, though.
|
||||
===============
|
||||
view.cpp
|
||||
Elevation and azimuth labels are right-justified.
|
||||
|
||||
TODO:
|
||||
Check out Fix Points on Voodoo2 again. Previous attempt caused entire preview to be redrawn when moving mouse (GL_SCISSOR_TEST failed?)
|
||||
|
||||
12/17/2000
|
||||
MrHyde
|
||||
- tooltips
|
||||
- reformatted the source to use spaces instead of tabs
|
||||
- fixes to update mechanism in bitmap tab
|
||||
|
||||
12/13/2000
|
||||
MrHyde
|
||||
===============
|
||||
gendlgs.cpp
|
||||
In ReadDlgValues, reads wavelength, amplitude, and roughness text boxes (previously ignored).
|
||||
In create_main_dialog, set a "focus_out_event" for the above and added a "value_changed" for RandomSeed.
|
||||
In main_go, added call to WriteIni
|
||||
===============
|
||||
gensurf.cpp
|
||||
Set gszIni to "plugins/gensurf.ini" to get past assert error
|
||||
ported WriteIni
|
||||
===============
|
||||
view.cpp
|
||||
In DrawPreview, changed 2 occurrences of GL_LINE_LOOP to GL_LINE_STRIP for patches
|
||||
434
contrib/gtkgensurf/bitmap.cpp
Normal file
434
contrib/gtkgensurf/bitmap.cpp
Normal file
@@ -0,0 +1,434 @@
|
||||
/*
|
||||
GenSurf plugin for GtkRadiant
|
||||
Copyright (C) 2001 David Hyde, Loki software and qeradiant.com
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Lesser General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2.1 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
|
||||
Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser 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 <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <math.h>
|
||||
#include "gensurf.h"
|
||||
|
||||
void GenerateBitmapMapping ()
|
||||
{
|
||||
double value;
|
||||
double C0, C1;
|
||||
double x, y;
|
||||
int i, j;
|
||||
int O00,O01,O10,O11;
|
||||
int r0, r1, c0, c1;
|
||||
int color;
|
||||
unsigned char *colors;
|
||||
|
||||
if (!gbmp.colors)
|
||||
return;
|
||||
|
||||
colors = gbmp.colors;
|
||||
|
||||
for (j=0; j<=NV; j++)
|
||||
{
|
||||
y = (double)(j*(gbmp.height-1))/(double)NV;
|
||||
r0 = (int)floor(y);
|
||||
r1 = (int)ceil(y);
|
||||
for (i=0; i<=NH; i++)
|
||||
{
|
||||
x = (double)(i*(gbmp.width-1))/(double)NH;
|
||||
c0 = (int)floor(x);
|
||||
c1 = (int)ceil(x);
|
||||
O00 = r0*gbmp.width + c0;
|
||||
O01 = r0*gbmp.width + c1;
|
||||
O10 = r1*gbmp.width + c0;
|
||||
O11 = r1*gbmp.width + c1;
|
||||
C0 = (double)colors[O00] + (double)(colors[O01]-colors[O00])*(x-(double)c0);
|
||||
C1 = (double)colors[O10] + (double)(colors[O11]-colors[O10])*(x-(double)c0);
|
||||
color = (int)(C0 + (C1-C0)*(y-r0));
|
||||
|
||||
value = CalculateSnapValue(gbmp.black_value + color*((gbmp.white_value-gbmp.black_value)/255.));
|
||||
|
||||
switch(Plane)
|
||||
{
|
||||
case PLANE_XZ0:
|
||||
case PLANE_XZ1:
|
||||
xyz[i][j].p[1] = value;
|
||||
break;
|
||||
case PLANE_YZ0:
|
||||
case PLANE_YZ1:
|
||||
xyz[i][j].p[0] = value;
|
||||
break;
|
||||
default:
|
||||
xyz[i][j].p[2] = value;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static unsigned char* OpenBitmapFile ()
|
||||
{
|
||||
int bmWidth;
|
||||
int bmHeight;
|
||||
unsigned char bmPlanes;
|
||||
unsigned char bmBitsPixel;
|
||||
unsigned char m1,m2;
|
||||
unsigned long sizeimage;
|
||||
short res1,res2;
|
||||
long filesize, pixoff;
|
||||
long bmisize, compression;
|
||||
long xscale, yscale;
|
||||
long colors, impcol;
|
||||
unsigned long m_bytesRead = 0;
|
||||
unsigned char *image;
|
||||
FILE *fp;
|
||||
|
||||
fp = fopen (gbmp.name, "rb");
|
||||
if (fp == NULL)
|
||||
return NULL;
|
||||
|
||||
long rc;
|
||||
rc = fread(&m1, 1, 1, fp);
|
||||
m_bytesRead++;
|
||||
if (rc == -1)
|
||||
{
|
||||
fclose(fp);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
rc = fread(&m2, 1, 1, fp);
|
||||
m_bytesRead++;
|
||||
if ((m1 != 'B') || (m2 != 'M'))
|
||||
{
|
||||
fclose(fp);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
rc = fread((long*)&(filesize),4,1,fp); m_bytesRead+=4;
|
||||
if (rc != 1) { fclose(fp); return NULL; }
|
||||
|
||||
rc = fread((int*)&(res1),2,1,fp); m_bytesRead+=2;
|
||||
if (rc != 1) { fclose(fp); return NULL; }
|
||||
|
||||
rc = fread((int*)&(res2),2,1,fp); m_bytesRead+=2;
|
||||
if (rc != 1) { fclose(fp); return NULL; }
|
||||
|
||||
rc = fread((long*)&(pixoff),4,1,fp); m_bytesRead+=4;
|
||||
if (rc != 1) { fclose(fp); return NULL; }
|
||||
|
||||
rc = fread((long*)&(bmisize),4,1,fp); m_bytesRead+=4;
|
||||
if (rc != 1) { fclose(fp); return NULL; }
|
||||
|
||||
rc = fread((long *)&(bmWidth),4,1,fp); m_bytesRead+=4;
|
||||
if (rc != 1) { fclose(fp); return NULL; }
|
||||
|
||||
rc = fread((long*)&(bmHeight),4,1,fp); m_bytesRead+=4;
|
||||
if (rc != 1) { fclose(fp); return NULL; }
|
||||
|
||||
rc = fread((int*)&(bmPlanes),2,1,fp); m_bytesRead+=2;
|
||||
if (rc != 1) { fclose(fp); return NULL; }
|
||||
|
||||
rc = fread((int*)&(bmBitsPixel),2,1,fp); m_bytesRead+=2;
|
||||
if (rc != 1) { fclose(fp); return NULL; }
|
||||
|
||||
rc = fread((long*)&(compression),4,1,fp); m_bytesRead+=4;
|
||||
if (rc != 1) { fclose(fp); return NULL; }
|
||||
|
||||
rc = fread((long*)&(sizeimage),4,1,fp); m_bytesRead+=4;
|
||||
if (rc != 1) {fclose(fp); return NULL; }
|
||||
|
||||
rc = fread((long*)&(xscale),4,1,fp); m_bytesRead+=4;
|
||||
if (rc != 1) { fclose(fp); return NULL; }
|
||||
|
||||
rc = fread((long*)&(yscale),4,1,fp); m_bytesRead+=4;
|
||||
if (rc != 1) { fclose(fp); return NULL; }
|
||||
|
||||
rc = fread((long*)&(colors),4,1,fp); m_bytesRead+=4;
|
||||
if (rc != 1) { fclose(fp); return NULL; }
|
||||
|
||||
rc = fread((long*)&(impcol),4,1,fp); m_bytesRead+=4;
|
||||
if (rc != 1) { fclose(fp); return NULL; }
|
||||
|
||||
if (bmBitsPixel != 8)
|
||||
{
|
||||
g_FuncTable.m_pfnMessageBox (g_pWnd, "This is not an 8-bit image. GenSurf can't use it.",
|
||||
"Bitmap", eMB_OK, eMB_ICONWARNING);
|
||||
fclose(fp);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (colors == 0)
|
||||
colors = 1 << bmBitsPixel;
|
||||
|
||||
if (bmBitsPixel != 24)
|
||||
{
|
||||
int i;
|
||||
for (i = 0; i < colors; i++)
|
||||
{
|
||||
unsigned char r ,g, b, dummy;
|
||||
|
||||
rc = fread(&b, 1, 1, fp);
|
||||
m_bytesRead++;
|
||||
if (rc!=1)
|
||||
{
|
||||
fclose(fp);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
rc = fread(&g, 1, 1, fp);
|
||||
m_bytesRead++;
|
||||
if (rc!=1)
|
||||
{
|
||||
fclose(fp);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
rc = fread(&r, 1, 1, fp);
|
||||
m_bytesRead++;
|
||||
if (rc != 1)
|
||||
{
|
||||
fclose(fp);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
rc = fread(&dummy, 1, 1, fp);
|
||||
m_bytesRead++;
|
||||
if (rc != 1)
|
||||
{
|
||||
fclose(fp);
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ((long)m_bytesRead > pixoff)
|
||||
{
|
||||
fclose(fp);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
while ((long)m_bytesRead < pixoff)
|
||||
{
|
||||
char dummy;
|
||||
fread(&dummy,1,1,fp);
|
||||
m_bytesRead++;
|
||||
}
|
||||
|
||||
int w = bmWidth;
|
||||
int h = bmHeight;
|
||||
|
||||
// set the output params
|
||||
image = (unsigned char*)malloc(w*h);
|
||||
|
||||
if (image != NULL)
|
||||
{
|
||||
gbmp.width = w;
|
||||
gbmp.height = h;
|
||||
unsigned char* outbuf = image;
|
||||
long row = 0;
|
||||
long rowOffset = 0;
|
||||
|
||||
if (compression == 0) // BI_RGB
|
||||
{
|
||||
for (row = 0; row < bmHeight; row++)
|
||||
{
|
||||
// which row are we working on?
|
||||
rowOffset = (long unsigned)row*w;
|
||||
|
||||
{
|
||||
// pixels are packed as 1 , 4 or 8 bit vals. need to unpack them
|
||||
int bit_count = 0;
|
||||
unsigned long mask = (1 << bmBitsPixel) - 1;
|
||||
unsigned char inbyte = 0;
|
||||
|
||||
for (int col=0;col<w;col++)
|
||||
{
|
||||
int pix = 0;
|
||||
|
||||
// if we need another byte
|
||||
if (bit_count <= 0)
|
||||
{
|
||||
bit_count = 8;
|
||||
if (fread(&inbyte,1,1,fp) != 1)
|
||||
{
|
||||
free(image);
|
||||
fclose(fp);
|
||||
return NULL;
|
||||
}
|
||||
m_bytesRead++;
|
||||
}
|
||||
|
||||
// keep track of where we are in the bytes
|
||||
bit_count -= bmBitsPixel;
|
||||
pix = ( inbyte >> bit_count) & mask;
|
||||
|
||||
// lookup the color from the colormap - stuff it in our buffer
|
||||
// swap red and blue
|
||||
*(outbuf + rowOffset + col) = pix;
|
||||
}
|
||||
|
||||
// read DWORD padding
|
||||
while ((m_bytesRead-pixoff)&3)
|
||||
{
|
||||
char dummy;
|
||||
if (fread(&dummy,1,1,fp)!=1)
|
||||
{
|
||||
free(image);
|
||||
fclose(fp);
|
||||
return NULL;
|
||||
}
|
||||
m_bytesRead++;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else // compression != 0
|
||||
{
|
||||
int i, x = 0;
|
||||
unsigned char c, c1 = 0, *pp;
|
||||
row = 0;
|
||||
pp = outbuf;
|
||||
|
||||
if (bmBitsPixel == 8)
|
||||
{
|
||||
while (row < bmHeight)
|
||||
{
|
||||
c = getc(fp);
|
||||
|
||||
if (c)
|
||||
{
|
||||
// encoded mode
|
||||
c1 = getc(fp);
|
||||
for (i = 0; i < c; x++, i++)
|
||||
{
|
||||
*pp = c1; pp++;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// c==0x00, escape codes
|
||||
c = getc(fp);
|
||||
|
||||
if (c == 0x00) // end of line
|
||||
{
|
||||
row++;
|
||||
x = 0;
|
||||
pp = outbuf + row*bmWidth;
|
||||
}
|
||||
else if (c == 0x01)
|
||||
break; // end of pic
|
||||
else if (c == 0x02) // delta
|
||||
{
|
||||
c = getc(fp);
|
||||
x += c;
|
||||
c = getc(fp);
|
||||
row += c;
|
||||
pp = outbuf + x + row*bmWidth;
|
||||
}
|
||||
else // absolute mode
|
||||
{
|
||||
for (i = 0; i < c; x++, i++)
|
||||
{
|
||||
c1 = getc(fp);
|
||||
*pp = c1; pp++;
|
||||
}
|
||||
|
||||
if (c & 1)
|
||||
getc(fp); // odd length run: read an extra pad byte
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (bmBitsPixel == 4)
|
||||
{
|
||||
while (row < bmHeight)
|
||||
{
|
||||
c = getc(fp);
|
||||
|
||||
if (c)
|
||||
{
|
||||
// encoded mode
|
||||
c1 = getc(fp);
|
||||
for (i = 0; i < c; x++, i++)
|
||||
{
|
||||
*pp = (i&1) ? (c1 & 0x0f) : ((c1>>4)&0x0f); pp++;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// c==0x00, escape codes
|
||||
c = getc(fp);
|
||||
|
||||
if (c == 0x00) // end of line
|
||||
{
|
||||
row++;
|
||||
x = 0;
|
||||
pp = outbuf + bmHeight*bmWidth;
|
||||
}
|
||||
else if (c == 0x01)
|
||||
break; // end of pic
|
||||
else if (c == 0x02) // delta
|
||||
{
|
||||
c = getc(fp);
|
||||
x += c;
|
||||
c = getc(fp);
|
||||
row += c;
|
||||
pp = outbuf + x + row*bmWidth;
|
||||
}
|
||||
else // absolute mode
|
||||
{
|
||||
for (i = 0; i < c; x++, i++)
|
||||
{
|
||||
if ((i&1) == 0)
|
||||
c1 = getc(fp);
|
||||
*pp = (i&1) ? (c1 & 0x0f) : ((c1>>4)&0x0f); pp++;
|
||||
}
|
||||
|
||||
if (((c&3) == 1) || ((c&3) == 2))
|
||||
getc(fp); // odd length run: read an extra pad byte
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
fclose(fp);
|
||||
return image;
|
||||
}
|
||||
|
||||
bool OpenBitmap ()
|
||||
{
|
||||
if (gbmp.colors)
|
||||
free (gbmp.colors);
|
||||
|
||||
gbmp.colors = OpenBitmapFile ();
|
||||
|
||||
if (!gbmp.colors)
|
||||
{
|
||||
char Text[256];
|
||||
|
||||
sprintf (Text, "Error opening %s", gbmp.name);
|
||||
g_FuncTable.m_pfnMessageBox (g_pWnd, Text, "Bitmap", eMB_OK, eMB_ICONWARNING);
|
||||
strcpy (gbmp.name, "");
|
||||
}
|
||||
|
||||
if (g_pWnd)
|
||||
{
|
||||
gtk_entry_set_text (GTK_ENTRY (g_object_get_data (G_OBJECT (g_pWnd), "bmp_file")), gbmp.name);
|
||||
gtk_widget_set_sensitive (GTK_WIDGET (g_object_get_data (G_OBJECT (g_pWnd), "bmp_reload")),
|
||||
strlen (gbmp.name) ? TRUE : FALSE);
|
||||
|
||||
UpdatePreview (true);
|
||||
}
|
||||
|
||||
return (gbmp.colors != NULL);
|
||||
}
|
||||
1328
contrib/gtkgensurf/dec.cpp
Normal file
1328
contrib/gtkgensurf/dec.cpp
Normal file
File diff suppressed because it is too large
Load Diff
452
contrib/gtkgensurf/face.cpp
Normal file
452
contrib/gtkgensurf/face.cpp
Normal file
@@ -0,0 +1,452 @@
|
||||
/*
|
||||
GenSurf plugin for GtkRadiant
|
||||
Copyright (C) 2001 David Hyde, Loki software and qeradiant.com
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Lesser General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2.1 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
|
||||
Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser 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 <stdlib.h>
|
||||
#include <math.h>
|
||||
#include "gensurf.h"
|
||||
|
||||
#define MAX_FACES 128 // Maximum number of faces on a brush
|
||||
#define MAX_POINTS_ON_WINDING 64
|
||||
#define SIDE_FRONT 0
|
||||
#define SIDE_ON 2
|
||||
#define SIDE_BACK 1
|
||||
#define SIDE_CROSS -2
|
||||
|
||||
//vec3 vec3_origin = {0,0,0};
|
||||
|
||||
void PlaneFromPoints (float *p0, float *p1, float *p2, PLANE *plane)
|
||||
{
|
||||
vec3 t1, t2;
|
||||
vec length;
|
||||
|
||||
VectorSubtract (p0, p1, t1);
|
||||
VectorSubtract (p2, p1, t2);
|
||||
plane->normal[0] = t1[1]*t2[2] - t1[2]*t2[1];
|
||||
plane->normal[1] = t1[2]*t2[0] - t1[0]*t2[2];
|
||||
plane->normal[2] = t1[0]*t2[1] - t1[1]*t2[0];
|
||||
|
||||
length = (vec)(sqrt(plane->normal[0]*plane->normal[0] +
|
||||
plane->normal[1]*plane->normal[1] +
|
||||
plane->normal[2]*plane->normal[2] ));
|
||||
if (length == 0)
|
||||
{
|
||||
VectorClear(plane->normal);
|
||||
}
|
||||
else
|
||||
{
|
||||
plane->normal[0] /= length;
|
||||
plane->normal[1] /= length;
|
||||
plane->normal[2] /= length;
|
||||
}
|
||||
plane->dist = DotProduct (p0, plane->normal);
|
||||
}
|
||||
/*
|
||||
void VectorMA (vec3 va, vec scale, vec3 vb, vec3 vc)
|
||||
{
|
||||
vc[0] = va[0] + scale*vb[0];
|
||||
vc[1] = va[1] + scale*vb[1];
|
||||
vc[2] = va[2] + scale*vb[2];
|
||||
}
|
||||
|
||||
void CrossProduct (vec3 v1, vec3 v2, vec3 cross)
|
||||
{
|
||||
cross[0] = v1[1]*v2[2] - v1[2]*v2[1];
|
||||
cross[1] = v1[2]*v2[0] - v1[0]*v2[2];
|
||||
cross[2] = v1[0]*v2[1] - v1[1]*v2[0];
|
||||
}
|
||||
*/
|
||||
/*
|
||||
=============
|
||||
AllocWinding
|
||||
=============
|
||||
*/
|
||||
MY_WINDING *AllocWinding (int points)
|
||||
{
|
||||
MY_WINDING *w;
|
||||
int s;
|
||||
|
||||
s = sizeof(vec)*3*points + sizeof(int);
|
||||
w = (MY_WINDING*)malloc (s);
|
||||
memset (w, 0, s);
|
||||
return w;
|
||||
}
|
||||
/*
|
||||
vec VectorNormalize (vec3 in, vec3 out)
|
||||
{
|
||||
vec length, ilength;
|
||||
|
||||
length = (vec)(sqrt (in[0]*in[0] + in[1]*in[1] + in[2]*in[2]));
|
||||
if (length == 0)
|
||||
{
|
||||
VectorClear (out);
|
||||
return 0;
|
||||
}
|
||||
|
||||
ilength = (vec)1.0/length;
|
||||
out[0] = in[0]*ilength;
|
||||
out[1] = in[1]*ilength;
|
||||
out[2] = in[2]*ilength;
|
||||
|
||||
return length;
|
||||
}
|
||||
*/
|
||||
|
||||
/*
|
||||
=================
|
||||
BaseWindingForPlane
|
||||
=================
|
||||
*/
|
||||
MY_WINDING *BaseWindingForPlane (vec3 normal, vec dist)
|
||||
{
|
||||
int i, x;
|
||||
vec max, v;
|
||||
vec3 org, vright, vup;
|
||||
MY_WINDING *w;
|
||||
|
||||
// find the major axis
|
||||
|
||||
max = -BOGUS_RANGE;
|
||||
x = -1;
|
||||
for (i=0 ; i<3; i++)
|
||||
{
|
||||
v = (vec)(fabs(normal[i]));
|
||||
if (v > max)
|
||||
{
|
||||
x = i;
|
||||
max = v;
|
||||
}
|
||||
}
|
||||
if (x==-1) x = 2;
|
||||
|
||||
VectorCopy(vec3_origin,vup);
|
||||
switch (x)
|
||||
{
|
||||
case 0:
|
||||
case 1:
|
||||
vup[2] = 1;
|
||||
break;
|
||||
case 2:
|
||||
vup[0] = 1;
|
||||
break;
|
||||
}
|
||||
|
||||
v = DotProduct (vup, normal);
|
||||
VectorMA (vup, -v, normal, vup);
|
||||
VectorNormalize (vup, vup);
|
||||
|
||||
VectorScale (normal, dist, org);
|
||||
|
||||
CrossProduct (vup, normal, vright);
|
||||
|
||||
VectorScale (vup, 65536, vup);
|
||||
VectorScale (vright, 65536, vright);
|
||||
|
||||
// project a really big axis aligned box onto the plane
|
||||
w = AllocWinding (4);
|
||||
|
||||
VectorSubtract (org, vright, w->p[0]);
|
||||
VectorAdd (w->p[0], vup, w->p[0]);
|
||||
|
||||
VectorAdd (org, vright, w->p[1]);
|
||||
VectorAdd (w->p[1], vup, w->p[1]);
|
||||
|
||||
VectorAdd (org, vright, w->p[2]);
|
||||
VectorSubtract (w->p[2], vup, w->p[2]);
|
||||
|
||||
VectorSubtract (org, vright, w->p[3]);
|
||||
VectorSubtract (w->p[3], vup, w->p[3]);
|
||||
|
||||
w->numpoints = 4;
|
||||
|
||||
return w;
|
||||
}
|
||||
|
||||
void FreeWinding (MY_WINDING *w)
|
||||
{
|
||||
if (*(unsigned *)w == 0xdeaddead)
|
||||
// Error ("FreeWinding: freed a freed winding");
|
||||
return;
|
||||
*(unsigned *)w = 0xdeaddead;
|
||||
|
||||
free (w);
|
||||
}
|
||||
|
||||
/*
|
||||
=============
|
||||
ChopWindingInPlace
|
||||
=============
|
||||
*/
|
||||
void ChopWindingInPlace (MY_WINDING **inout, vec3 normal, vec dist, vec epsilon)
|
||||
{
|
||||
MY_WINDING *in;
|
||||
vec dists[MAX_POINTS_ON_WINDING+4];
|
||||
int sides[MAX_POINTS_ON_WINDING+4];
|
||||
int counts[3];
|
||||
static vec dot; // VC 4.2 optimizer bug if not static
|
||||
int i, j;
|
||||
vec *p1, *p2;
|
||||
vec3 mid;
|
||||
MY_WINDING *f;
|
||||
int maxpts;
|
||||
|
||||
in = *inout;
|
||||
counts[0] = counts[1] = counts[2] = 0;
|
||||
|
||||
// determine sides for each point
|
||||
for (i=0 ; i<in->numpoints ; i++)
|
||||
{
|
||||
dot = DotProduct (in->p[i], normal);
|
||||
dot -= dist;
|
||||
dists[i] = dot;
|
||||
if (dot > epsilon)
|
||||
sides[i] = SIDE_FRONT;
|
||||
else if (dot < -epsilon)
|
||||
sides[i] = SIDE_BACK;
|
||||
else
|
||||
{
|
||||
sides[i] = SIDE_ON;
|
||||
}
|
||||
counts[sides[i]]++;
|
||||
}
|
||||
sides[i] = sides[0];
|
||||
dists[i] = dists[0];
|
||||
|
||||
if (!counts[0])
|
||||
{
|
||||
FreeWinding(in);
|
||||
*inout = NULL;
|
||||
return;
|
||||
}
|
||||
if (!counts[1])
|
||||
return; // inout stays the same
|
||||
|
||||
maxpts = in->numpoints+4; // cant use counts[0]+2 because
|
||||
// of fp grouping errors
|
||||
|
||||
f = AllocWinding (maxpts);
|
||||
|
||||
for (i=0 ; i<in->numpoints ; i++)
|
||||
{
|
||||
p1 = in->p[i];
|
||||
|
||||
if (sides[i] == SIDE_ON)
|
||||
{
|
||||
VectorCopy (p1, f->p[f->numpoints]);
|
||||
f->numpoints++;
|
||||
continue;
|
||||
}
|
||||
|
||||
if (sides[i] == SIDE_FRONT)
|
||||
{
|
||||
VectorCopy (p1, f->p[f->numpoints]);
|
||||
f->numpoints++;
|
||||
}
|
||||
|
||||
if (sides[i+1] == SIDE_ON || sides[i+1] == sides[i])
|
||||
continue;
|
||||
|
||||
// generate a split point
|
||||
p2 = in->p[(i+1)%in->numpoints];
|
||||
|
||||
dot = dists[i] / (dists[i]-dists[i+1]);
|
||||
for (j=0 ; j<3 ; j++)
|
||||
{ // avoid round off error when possible
|
||||
if (normal[j] == 1)
|
||||
mid[j] = dist;
|
||||
else if (normal[j] == -1)
|
||||
mid[j] = -dist;
|
||||
else
|
||||
mid[j] = p1[j] + dot*(p2[j]-p1[j]);
|
||||
}
|
||||
|
||||
VectorCopy (mid, f->p[f->numpoints]);
|
||||
f->numpoints++;
|
||||
}
|
||||
|
||||
// if (f->numpoints > maxpts)
|
||||
// Error ("ClipWinding: points exceeded estimate");
|
||||
// if (f->numpoints > MAX_POINTS_ON_WINDING)
|
||||
// Error ("ClipWinding: MAX_POINTS_ON_WINDING");
|
||||
|
||||
FreeWinding(in);
|
||||
*inout = f;
|
||||
}
|
||||
|
||||
void UseFaceBounds()
|
||||
{
|
||||
LPVOID vp;
|
||||
float Dot, BestDot;
|
||||
float planepts[3][3];
|
||||
int BestFace;
|
||||
int i, j;
|
||||
int NumFaces;
|
||||
vec3 SurfNormal;
|
||||
vec3 vmin,vmax;
|
||||
PLANE plane[MAX_FACES*2];
|
||||
PLANE pface;
|
||||
MY_WINDING *w;
|
||||
|
||||
switch(Plane)
|
||||
{
|
||||
case PLANE_XY1:
|
||||
SurfNormal[0] = 0.0;
|
||||
SurfNormal[1] = 0.0;
|
||||
SurfNormal[2] =-1.0;
|
||||
break;
|
||||
case PLANE_XZ0:
|
||||
SurfNormal[0] = 0.0;
|
||||
SurfNormal[1] = 1.0;
|
||||
SurfNormal[2] = 0.0;
|
||||
break;
|
||||
case PLANE_XZ1:
|
||||
SurfNormal[0] = 0.0;
|
||||
SurfNormal[1] =-1.0;
|
||||
SurfNormal[2] = 0.0;
|
||||
break;
|
||||
case PLANE_YZ0:
|
||||
SurfNormal[0] = 1.0;
|
||||
SurfNormal[1] = 0.0;
|
||||
SurfNormal[2] = 0.0;
|
||||
break;
|
||||
case PLANE_YZ1:
|
||||
SurfNormal[0] =-1.0;
|
||||
SurfNormal[1] = 0.0;
|
||||
SurfNormal[2] = 0.0;
|
||||
break;
|
||||
default:
|
||||
SurfNormal[0] = 0.0;
|
||||
SurfNormal[1] = 0.0;
|
||||
SurfNormal[2] = 1.0;
|
||||
}
|
||||
|
||||
#if 0
|
||||
i = g_FuncTable.m_pfnAllocateSelectedBrushHandles();
|
||||
vp = g_FuncTable.m_pfnGetSelectedBrushHandle(0);
|
||||
NumFaces = g_FuncTable.m_pfnGetFaceCount(vp);
|
||||
|
||||
BestFace = -1;
|
||||
BestDot = 0.0;
|
||||
|
||||
for(i=0; i<NumFaces; i++)
|
||||
{
|
||||
_QERFaceData* QERFaceData = g_FuncTable.m_pfnGetFaceData(vp,i);
|
||||
planepts[0][0] = QERFaceData->m_v1[0];
|
||||
planepts[0][1] = QERFaceData->m_v1[1];
|
||||
planepts[0][2] = QERFaceData->m_v1[2];
|
||||
planepts[1][0] = QERFaceData->m_v2[0];
|
||||
planepts[1][1] = QERFaceData->m_v2[1];
|
||||
planepts[1][2] = QERFaceData->m_v2[2];
|
||||
planepts[2][0] = QERFaceData->m_v3[0];
|
||||
planepts[2][1] = QERFaceData->m_v3[1];
|
||||
planepts[2][2] = QERFaceData->m_v3[2];
|
||||
|
||||
PlaneFromPoints (planepts[0], planepts[1], planepts[2], &plane[2*i]);
|
||||
VectorSubtract (vec3_origin, plane[2*i].normal, plane[2*i+1].normal);
|
||||
plane[2*i+1].dist = -plane[2*i].dist;
|
||||
|
||||
Dot = DotProduct(plane[2*i].normal,SurfNormal);
|
||||
if(Dot > BestDot)
|
||||
{
|
||||
BestDot = Dot;
|
||||
BestFace = i;
|
||||
if(strlen(QERFaceData->m_TextureName))
|
||||
strcpy(Texture[Game][0],QERFaceData->m_TextureName);
|
||||
}
|
||||
}
|
||||
for(i=0; i<NumFaces; i++)
|
||||
{
|
||||
if(i==BestFace) continue;
|
||||
_QERFaceData* QERFaceData = g_FuncTable.m_pfnGetFaceData(vp,i);
|
||||
if(strlen(QERFaceData->m_TextureName))
|
||||
{
|
||||
if(strcmp(Texture[Game][0],QERFaceData->m_TextureName))
|
||||
strcpy(Texture[Game][1],QERFaceData->m_TextureName);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
g_FuncTable.m_pfnReleaseSelectedBrushHandles();
|
||||
|
||||
w = BaseWindingForPlane (plane[BestFace*2].normal, plane[BestFace*2].dist);
|
||||
|
||||
for (i=0 ; i<NumFaces && w; i++)
|
||||
{
|
||||
if (BestFace == i)
|
||||
continue;
|
||||
ChopWindingInPlace (&w, plane[i*2+1].normal, plane[i*2+1].dist, 0);
|
||||
}
|
||||
if(!w) return;
|
||||
|
||||
// Get bounding box for this face
|
||||
vmin[0] = vmax[0] = w->p[0][0];
|
||||
vmin[1] = vmax[1] = w->p[0][1];
|
||||
vmin[2] = vmax[2] = w->p[0][2];
|
||||
for(j=1; j<w->numpoints; j++)
|
||||
{
|
||||
vmin[0] = min(vmin[0],w->p[j][0]);
|
||||
vmin[1] = min(vmin[1],w->p[j][1]);
|
||||
vmin[2] = min(vmin[2],w->p[j][2]);
|
||||
vmax[0] = max(vmax[0],w->p[j][0]);
|
||||
vmax[1] = max(vmax[1],w->p[j][1]);
|
||||
vmax[2] = max(vmax[2],w->p[j][2]);
|
||||
}
|
||||
|
||||
FreeWinding(w);
|
||||
|
||||
VectorCopy(plane[BestFace*2].normal,pface.normal);
|
||||
pface.dist = plane[BestFace*2].dist;
|
||||
switch(Plane)
|
||||
{
|
||||
case PLANE_XZ0:
|
||||
case PLANE_XZ1:
|
||||
if(pface.normal[1] == 0.) return;
|
||||
Hll = vmin[0];
|
||||
Hur = vmax[0];
|
||||
Vll = vmin[2];
|
||||
Vur = vmax[2];
|
||||
Z00 = (pface.dist - pface.normal[0]*Hll - pface.normal[2]*Vll)/pface.normal[1];
|
||||
Z01 = (pface.dist - pface.normal[0]*Hll - pface.normal[2]*Vur)/pface.normal[1];
|
||||
Z10 = (pface.dist - pface.normal[0]*Hur - pface.normal[2]*Vll)/pface.normal[1];
|
||||
Z11 = (pface.dist - pface.normal[0]*Hur - pface.normal[2]*Vur)/pface.normal[1];
|
||||
break;
|
||||
case PLANE_YZ0:
|
||||
case PLANE_YZ1:
|
||||
if(pface.normal[0] == 0.) return;
|
||||
Hll = vmin[1];
|
||||
Hur = vmax[1];
|
||||
Vll = vmin[2];
|
||||
Vur = vmax[2];
|
||||
Z00 = (pface.dist - pface.normal[1]*Hll - pface.normal[2]*Vll)/pface.normal[0];
|
||||
Z01 = (pface.dist - pface.normal[1]*Hll - pface.normal[2]*Vur)/pface.normal[0];
|
||||
Z10 = (pface.dist - pface.normal[1]*Hur - pface.normal[2]*Vll)/pface.normal[0];
|
||||
Z11 = (pface.dist - pface.normal[1]*Hur - pface.normal[2]*Vur)/pface.normal[0];
|
||||
break;
|
||||
default:
|
||||
if(pface.normal[2] == 0.) return;
|
||||
Hll = vmin[0];
|
||||
Hur = vmax[0];
|
||||
Vll = vmin[1];
|
||||
Vur = vmax[1];
|
||||
Z00 = (pface.dist - pface.normal[0]*Hll - pface.normal[1]*Vll)/pface.normal[2];
|
||||
Z01 = (pface.dist - pface.normal[0]*Hll - pface.normal[1]*Vur)/pface.normal[2];
|
||||
Z10 = (pface.dist - pface.normal[0]*Hur - pface.normal[1]*Vll)/pface.normal[2];
|
||||
Z11 = (pface.dist - pface.normal[0]*Hur - pface.normal[1]*Vur)/pface.normal[2];
|
||||
}
|
||||
#endif
|
||||
}
|
||||
270
contrib/gtkgensurf/font.cpp
Normal file
270
contrib/gtkgensurf/font.cpp
Normal file
@@ -0,0 +1,270 @@
|
||||
/*
|
||||
GenSurf plugin for GtkRadiant
|
||||
Copyright (C) 2001 David Hyde, Loki software and qeradiant.com
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Lesser General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2.1 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
|
||||
Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser 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
|
||||
*/
|
||||
|
||||
//
|
||||
// Texture Font
|
||||
//
|
||||
// Taken from LeoCAD (www.leocad.org) and used in GtkGenSurf
|
||||
// with permission from the author.
|
||||
//
|
||||
// Leonardo Zide (leo@lokigames.com)
|
||||
//
|
||||
|
||||
#include <stdlib.h>
|
||||
#include "gensurf.h"
|
||||
|
||||
static const unsigned char data[2048] = {
|
||||
255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
|
||||
255, 207, 255, 255, 159, 255, 31, 255, 231, 159, 153, 63, 255, 255, 255, 255,
|
||||
255, 207, 255, 255, 159, 255, 207, 255, 231, 159, 153, 63, 255, 255, 255, 255,
|
||||
255, 207, 255, 255, 159, 255, 207, 255, 231, 255, 159, 63, 255, 255, 255, 255,
|
||||
7, 78, 252, 240, 145, 135, 3, 71, 38, 158, 153, 51, 19, 227, 196, 255,
|
||||
243, 140, 121, 230, 140, 51, 207, 51, 198, 156, 153, 57, 99, 204, 152, 255,
|
||||
255, 204, 51, 111, 158, 121, 206, 121, 230, 153, 153, 60, 115, 206, 60, 255,
|
||||
31, 204, 51, 127, 158, 121, 206, 121, 230, 153, 25, 62, 115, 206, 60, 255,
|
||||
199, 204, 51, 127, 158, 1, 206, 121, 230, 153, 25, 62, 115, 206, 60, 255,
|
||||
243, 204, 51, 127, 158, 249, 207, 121, 230, 153, 153, 60, 115, 206, 60, 255,
|
||||
243, 204, 51, 111, 158, 249, 207, 121, 230, 153, 153, 57, 115, 206, 60, 255,
|
||||
243, 140, 121, 230, 140, 115, 206, 51, 230, 153, 153, 51, 115, 206, 60, 255,
|
||||
7, 73, 252, 240, 145, 7, 207, 71, 230, 153, 153, 39, 115, 206, 60, 255,
|
||||
255, 255, 255, 255, 255, 255, 255, 127, 254, 255, 249, 255, 255, 255, 255, 255,
|
||||
255, 255, 255, 255, 255, 255, 255, 127, 254, 255, 249, 255, 255, 255, 255, 255,
|
||||
255, 255, 255, 255, 255, 255, 255, 57, 255, 255, 249, 255, 255, 255, 255, 255,
|
||||
255, 255, 255, 255, 255, 255, 255, 131, 255, 255, 252, 255, 255, 255, 255, 255,
|
||||
255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
|
||||
255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
|
||||
255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
|
||||
255, 255, 255, 255, 255, 255, 249, 255, 255, 255, 255, 255, 255, 255, 227, 255,
|
||||
255, 255, 255, 255, 255, 255, 249, 255, 255, 255, 255, 255, 255, 255, 201, 255,
|
||||
255, 255, 255, 255, 255, 255, 249, 255, 255, 255, 255, 255, 255, 255, 156, 255,
|
||||
15, 79, 252, 200, 196, 96, 32, 79, 62, 252, 15, 15, 159, 192, 156, 255,
|
||||
103, 142, 121, 198, 112, 206, 57, 79, 62, 60, 15, 15, 159, 207, 156, 255,
|
||||
243, 204, 51, 207, 120, 254, 57, 207, 156, 57, 103, 102, 206, 231, 156, 255,
|
||||
243, 204, 51, 207, 124, 252, 57, 207, 156, 25, 230, 112, 206, 231, 156, 255,
|
||||
243, 204, 51, 207, 252, 224, 57, 207, 156, 25, 230, 121, 206, 243, 156, 255,
|
||||
243, 204, 51, 207, 252, 199, 57, 207, 201, 211, 242, 240, 228, 249, 156, 255,
|
||||
243, 204, 51, 207, 252, 207, 57, 207, 201, 195, 112, 230, 228, 249, 156, 255,
|
||||
103, 142, 121, 198, 124, 206, 121, 198, 227, 231, 57, 207, 241, 252, 201, 255,
|
||||
15, 79, 252, 200, 252, 224, 227, 200, 227, 231, 57, 207, 241, 192, 227, 255,
|
||||
255, 207, 255, 207, 255, 255, 255, 255, 255, 255, 255, 255, 249, 255, 255, 255,
|
||||
255, 207, 255, 207, 255, 255, 255, 255, 255, 255, 255, 255, 249, 255, 255, 255,
|
||||
255, 207, 255, 207, 255, 255, 255, 255, 255, 255, 255, 255, 252, 255, 255, 255,
|
||||
255, 207, 255, 207, 255, 255, 255, 255, 255, 255, 255, 127, 254, 255, 255, 255,
|
||||
255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
|
||||
255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
|
||||
255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
|
||||
159, 15, 30, 252, 57, 224, 225, 128, 131, 7, 255, 254, 128, 127, 240, 255,
|
||||
135, 231, 204, 249, 57, 255, 252, 159, 57, 115, 126, 252, 60, 63, 231, 255,
|
||||
159, 247, 236, 249, 56, 127, 254, 159, 57, 115, 126, 252, 124, 158, 207, 255,
|
||||
159, 255, 252, 249, 56, 127, 254, 207, 57, 115, 62, 249, 124, 158, 207, 255,
|
||||
159, 255, 252, 121, 56, 112, 254, 207, 57, 115, 62, 249, 60, 207, 255, 255,
|
||||
159, 127, 62, 60, 57, 103, 224, 231, 131, 115, 158, 243, 128, 207, 255, 255,
|
||||
159, 63, 255, 57, 249, 103, 206, 231, 57, 7, 158, 243, 60, 207, 255, 255,
|
||||
159, 159, 255, 153, 249, 103, 206, 231, 57, 127, 206, 231, 124, 206, 255, 255,
|
||||
159, 207, 255, 25, 240, 103, 206, 243, 57, 127, 14, 224, 124, 158, 207, 255,
|
||||
159, 231, 239, 249, 185, 103, 206, 243, 57, 127, 230, 207, 124, 158, 207, 255,
|
||||
159, 231, 207, 249, 57, 103, 206, 243, 57, 63, 231, 207, 60, 63, 231, 255,
|
||||
159, 7, 28, 252, 121, 240, 224, 243, 131, 135, 231, 207, 128, 127, 240, 255,
|
||||
255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
|
||||
255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
|
||||
255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
|
||||
255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
|
||||
255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
|
||||
255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
|
||||
255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
|
||||
7, 126, 128, 3, 124, 240, 249, 156, 63, 231, 57, 255, 252, 57, 159, 255,
|
||||
231, 124, 254, 243, 63, 231, 249, 156, 63, 231, 60, 255, 252, 57, 159, 255,
|
||||
231, 121, 254, 243, 159, 207, 249, 156, 63, 103, 62, 255, 248, 56, 158, 255,
|
||||
231, 121, 254, 243, 159, 207, 249, 156, 63, 39, 63, 255, 248, 56, 156, 255,
|
||||
231, 115, 254, 243, 207, 255, 249, 156, 63, 135, 63, 255, 112, 56, 152, 255,
|
||||
231, 115, 192, 3, 206, 255, 1, 156, 63, 199, 63, 255, 112, 56, 153, 255,
|
||||
231, 115, 254, 243, 207, 193, 249, 156, 63, 135, 63, 255, 36, 57, 147, 255,
|
||||
231, 115, 254, 243, 207, 207, 249, 156, 63, 39, 63, 255, 36, 57, 131, 255,
|
||||
231, 121, 254, 243, 159, 207, 249, 156, 57, 103, 62, 255, 140, 57, 135, 255,
|
||||
231, 121, 254, 243, 159, 199, 249, 156, 57, 231, 60, 255, 140, 57, 143, 255,
|
||||
231, 124, 254, 243, 63, 199, 249, 156, 147, 231, 57, 255, 220, 57, 159, 255,
|
||||
7, 126, 128, 243, 127, 208, 249, 156, 199, 231, 51, 192, 220, 57, 159, 255,
|
||||
255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
|
||||
255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
|
||||
255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
|
||||
255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
|
||||
255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
|
||||
255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
|
||||
255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
|
||||
63, 252, 128, 63, 252, 128, 63, 28, 128, 249, 204, 79, 254, 39, 63, 255,
|
||||
159, 249, 60, 159, 249, 60, 159, 249, 249, 249, 204, 79, 158, 39, 63, 255,
|
||||
207, 243, 124, 206, 243, 124, 206, 243, 249, 249, 156, 103, 158, 103, 158, 255,
|
||||
207, 243, 124, 206, 243, 124, 206, 255, 249, 249, 156, 231, 156, 243, 204, 255,
|
||||
231, 231, 124, 230, 231, 124, 158, 255, 249, 249, 156, 231, 12, 243, 225, 255,
|
||||
231, 231, 60, 231, 231, 60, 63, 252, 249, 249, 60, 243, 12, 243, 243, 255,
|
||||
231, 231, 128, 231, 231, 128, 255, 249, 249, 249, 60, 243, 105, 249, 243, 255,
|
||||
231, 231, 252, 103, 230, 60, 255, 243, 249, 249, 124, 251, 97, 248, 225, 255,
|
||||
207, 243, 252, 207, 240, 124, 254, 243, 249, 249, 124, 248, 97, 248, 204, 255,
|
||||
207, 243, 252, 207, 241, 124, 206, 243, 249, 249, 124, 248, 243, 124, 158, 255,
|
||||
159, 249, 252, 159, 241, 124, 158, 249, 249, 115, 254, 252, 243, 60, 63, 255,
|
||||
63, 252, 252, 63, 228, 252, 60, 252, 249, 7, 255, 252, 243, 60, 63, 255,
|
||||
255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
|
||||
255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
|
||||
255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
|
||||
255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
|
||||
255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
|
||||
255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
|
||||
255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
|
||||
243, 19, 192, 255, 252, 255, 255, 127, 14, 127, 248, 15, 252, 247, 227, 231,
|
||||
243, 243, 207, 255, 252, 255, 153, 127, 102, 62, 243, 227, 241, 193, 201, 243,
|
||||
231, 249, 231, 255, 252, 255, 60, 127, 242, 156, 231, 249, 231, 148, 201, 249,
|
||||
207, 252, 243, 255, 204, 124, 126, 126, 254, 156, 231, 57, 230, 148, 201, 252,
|
||||
207, 252, 243, 255, 204, 60, 255, 60, 255, 156, 231, 156, 204, 244, 99, 254,
|
||||
31, 254, 249, 255, 252, 159, 255, 57, 127, 158, 231, 204, 204, 244, 63, 255,
|
||||
31, 254, 252, 255, 252, 207, 255, 51, 63, 159, 231, 204, 204, 193, 159, 255,
|
||||
63, 127, 254, 255, 252, 159, 255, 57, 159, 207, 207, 204, 204, 151, 207, 248,
|
||||
63, 127, 254, 255, 252, 63, 255, 156, 159, 159, 231, 204, 228, 151, 103, 242,
|
||||
63, 63, 255, 255, 255, 127, 126, 158, 255, 159, 231, 25, 241, 148, 115, 242,
|
||||
63, 159, 127, 230, 204, 252, 60, 159, 159, 159, 231, 249, 255, 148, 121, 242,
|
||||
63, 31, 64, 230, 204, 252, 153, 159, 159, 159, 231, 227, 255, 193, 252, 248,
|
||||
255, 255, 63, 255, 231, 255, 255, 255, 255, 159, 231, 15, 252, 247, 255, 255,
|
||||
255, 255, 255, 255, 255, 255, 255, 255, 255, 63, 243, 255, 255, 255, 255, 255,
|
||||
255, 255, 255, 255, 255, 255, 255, 255, 255, 127, 248, 255, 255, 255, 255, 255,
|
||||
255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
|
||||
63, 254, 255, 195, 255, 255, 255, 255, 3, 252, 147, 255, 255, 255, 255, 255,
|
||||
159, 252, 255, 153, 255, 255, 255, 255, 243, 252, 147, 255, 255, 255, 255, 255,
|
||||
159, 252, 255, 153, 255, 243, 255, 255, 243, 252, 147, 255, 255, 255, 255, 255,
|
||||
159, 252, 204, 60, 255, 243, 255, 255, 243, 252, 0, 255, 255, 255, 255, 255,
|
||||
63, 254, 204, 60, 255, 243, 128, 255, 243, 252, 201, 255, 255, 255, 255, 255,
|
||||
63, 254, 225, 60, 255, 243, 255, 255, 243, 252, 201, 255, 255, 255, 255, 255,
|
||||
31, 126, 128, 60, 127, 128, 255, 255, 243, 252, 201, 255, 255, 255, 255, 255,
|
||||
159, 228, 225, 60, 193, 243, 128, 255, 243, 252, 201, 255, 255, 255, 255, 255,
|
||||
207, 240, 204, 60, 255, 243, 255, 255, 243, 124, 128, 255, 255, 255, 255, 255,
|
||||
207, 249, 204, 60, 255, 243, 255, 255, 243, 252, 228, 255, 255, 255, 255, 255,
|
||||
207, 240, 255, 60, 255, 243, 255, 255, 243, 252, 228, 255, 255, 255, 255, 255,
|
||||
31, 242, 255, 60, 255, 255, 255, 255, 243, 252, 228, 255, 255, 255, 255, 255,
|
||||
255, 255, 255, 60, 255, 255, 255, 255, 243, 252, 255, 255, 255, 255, 255, 255,
|
||||
255, 255, 255, 153, 255, 255, 255, 0, 242, 252, 255, 255, 255, 255, 255, 255,
|
||||
255, 255, 255, 153, 255, 255, 255, 255, 243, 252, 255, 255, 255, 255, 255, 255,
|
||||
255, 255, 255, 195, 255, 255, 255, 255, 3, 252, 255, 255, 255, 255, 255, 255
|
||||
};
|
||||
|
||||
typedef struct
|
||||
{
|
||||
unsigned char width;
|
||||
float left, right, top, bottom;
|
||||
} LC_TXFVERT;
|
||||
|
||||
static LC_TXFVERT glyphs[93];
|
||||
static GLuint texture;
|
||||
|
||||
void texfont_init ()
|
||||
{
|
||||
if (texture != 0)
|
||||
return;
|
||||
|
||||
int i, j, x, y;
|
||||
float inv = 1.0f/128;
|
||||
char *charlines[16] = {
|
||||
"abcdefghijklmn", "opqrstuvwxyz0", "123456789ABC", "DEFGHIJKLMN",
|
||||
"OPQRSTUVWX", "YZ,.!;:<>/?{}@$%", "&*()-+=_[] #" };
|
||||
unsigned char lefts[7][17] = {
|
||||
{ 1, 11, 21, 30, 40, 50, 56, 66, 76, 80, 84, 93, 97, 111, 121 },
|
||||
{ 1, 11, 21, 31, 38, 47, 53, 63, 72, 86, 94, 103, 111, 120 },
|
||||
{ 1, 10, 19, 28, 37, 46, 55, 64, 73, 82, 94, 106, 118, },
|
||||
{ 1, 13, 24, 34, 47, 59, 64, 73, 84, 94, 108, 120 },
|
||||
{ 1, 14, 25, 38, 50, 61, 71, 83, 94, 109, 120 },
|
||||
{ 1, 12, 22, 26, 30, 35, 39, 43, 52, 61, 65, 75, 81, 87, 103, 112, 125 },
|
||||
{ 3, 14, 23, 28, 33, 38, 47, 56, 65, 70, 75, 79, 88 } };
|
||||
// tops = 1 20 39 58 77 96 112 (+16)
|
||||
memset(glyphs, 0, sizeof(glyphs));
|
||||
|
||||
// ASCII 32-125
|
||||
for (i = 32; i < 126; i++)
|
||||
for (x = 0; x < 7; x++)
|
||||
for (y = 0; charlines[x][y]; y++)
|
||||
if (charlines[x][y] == i)
|
||||
{
|
||||
glyphs[i-32].width = lefts[x][y+1] - lefts[x][y];
|
||||
glyphs[i-32].left = (float)lefts[x][y]*inv;
|
||||
glyphs[i-32].right = (float)(lefts[x][y+1])*inv;
|
||||
|
||||
if (x != 6)
|
||||
glyphs[i-32].top = (float)(1 + 19*x);
|
||||
else
|
||||
glyphs[i-32].top = 112;
|
||||
glyphs[i-32].bottom = glyphs[i-32].top + 16;
|
||||
glyphs[i-32].top *= inv;
|
||||
glyphs[i-32].bottom *= inv;
|
||||
}
|
||||
|
||||
g_GLTable.m_pfn_qglGenTextures (1, &texture);
|
||||
g_GLTable.m_pfn_qglBindTexture (GL_TEXTURE_2D, texture);
|
||||
g_GLTable.m_pfn_qglDisable (GL_TEXTURE_GEN_S);
|
||||
g_GLTable.m_pfn_qglDisable (GL_TEXTURE_GEN_T);
|
||||
g_GLTable.m_pfn_qglTexParameteri (GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT);
|
||||
g_GLTable.m_pfn_qglTexParameteri (GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT);
|
||||
g_GLTable.m_pfn_qglTexParameteri (GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
|
||||
g_GLTable.m_pfn_qglTexParameteri (GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
|
||||
// g_GLTable.m_pfn_qglPixelStorei (GL_UNPACK_ALIGNMENT, 1);
|
||||
|
||||
unsigned char *buf = (unsigned char*)malloc (128*128);
|
||||
memset (buf, 255, 128*128);
|
||||
|
||||
for (i = 0; i < 2048; i++)
|
||||
for (j = 0; j < 8; j++)
|
||||
if ((data[i] & (1 << j)) != 0)
|
||||
buf[i*8+j] = 0;
|
||||
|
||||
g_GLTable.m_pfn_qglTexImage2D (GL_TEXTURE_2D, 0, GL_INTENSITY4, 128, 128, 0,
|
||||
GL_LUMINANCE, GL_UNSIGNED_BYTE, buf);
|
||||
free (buf);
|
||||
}
|
||||
|
||||
void texfont_write (const char *text, int l, int t)
|
||||
{
|
||||
if (texture == 0)
|
||||
return;
|
||||
|
||||
g_GLTable.m_pfn_qglColor3f (0, 1, 0);
|
||||
g_GLTable.m_pfn_qglBindTexture (GL_TEXTURE_2D, texture);
|
||||
g_GLTable.m_pfn_qglEnable (GL_TEXTURE_2D);
|
||||
// g_GLTable.m_pfn_qglTexEnvi (GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE);
|
||||
g_GLTable.m_pfn_qglAlphaFunc (GL_GREATER, 0.0625);
|
||||
g_GLTable.m_pfn_qglEnable (GL_ALPHA_TEST);
|
||||
|
||||
g_GLTable.m_pfn_qglBegin (GL_QUADS);
|
||||
for (const char* p = text; *p; p++)
|
||||
{
|
||||
if (*p < 32 || *p > 125)
|
||||
continue;
|
||||
if (glyphs[*p-32].width == 0)
|
||||
continue;
|
||||
|
||||
g_GLTable.m_pfn_qglTexCoord2f (glyphs[*p-32].left, glyphs[*p-32].top);
|
||||
g_GLTable.m_pfn_qglVertex2i (l, t);
|
||||
g_GLTable.m_pfn_qglTexCoord2f (glyphs[*p-32].left, glyphs[*p-32].bottom);
|
||||
g_GLTable.m_pfn_qglVertex2i (l, t-16);
|
||||
g_GLTable.m_pfn_qglTexCoord2f (glyphs[*p-32].right, glyphs[*p-32].bottom);
|
||||
g_GLTable.m_pfn_qglVertex2i (l + glyphs[*p-32].width, t-16);
|
||||
g_GLTable.m_pfn_qglTexCoord2f (glyphs[*p-32].right, glyphs[*p-32].top);
|
||||
g_GLTable.m_pfn_qglVertex2i (l + glyphs[*p-32].width, t);
|
||||
l += glyphs[*p-32].width;
|
||||
}
|
||||
g_GLTable.m_pfn_qglEnd ();
|
||||
|
||||
g_GLTable.m_pfn_qglDisable (GL_ALPHA_TEST);
|
||||
g_GLTable.m_pfn_qglDisable (GL_TEXTURE_2D);
|
||||
g_GLTable.m_pfn_qglBindTexture (GL_TEXTURE_2D, 0);
|
||||
}
|
||||
2364
contrib/gtkgensurf/gendlgs.cpp
Normal file
2364
contrib/gtkgensurf/gendlgs.cpp
Normal file
File diff suppressed because it is too large
Load Diff
151
contrib/gtkgensurf/gendlgs.h
Normal file
151
contrib/gtkgensurf/gendlgs.h
Normal file
@@ -0,0 +1,151 @@
|
||||
/*
|
||||
GenSurf plugin for GtkRadiant
|
||||
Copyright (C) 2001 David Hyde, Loki software and qeradiant.com
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Lesser General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2.1 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
|
||||
Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser 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
|
||||
*/
|
||||
|
||||
#define DLG_PLANE_XY0 100
|
||||
#define DLG_PLANE_XY1 101
|
||||
#define DLG_PLANE_YZ0 102
|
||||
#define DLG_PLANE_XZ0 103
|
||||
#define DLG_PLANE_YZ1 104
|
||||
#define DLG_PLANE_XZ1 105
|
||||
#define DLG_WAVE_01 106
|
||||
#define DLG_WAVE_02 107
|
||||
#define DLG_WAVE_03 108
|
||||
#define DLG_WAVE_04 109
|
||||
#define DLG_WAVE_05 110
|
||||
#define DLG_WAVE_06 111
|
||||
#define DLG_LAMBDA 112
|
||||
#define DLG_LAMBDA_TEXT 113
|
||||
#define DLG_AMP 114
|
||||
#define DLG_AMP_TEXT 115
|
||||
#define DLG_ROUGH 116
|
||||
#define DLG_ROUGH_TEXT 117
|
||||
#define DLG_LINEARBORDER 118
|
||||
#define DLG_FILE 119
|
||||
#define DLG_FILE_BROWSE 120
|
||||
#define DLG_PREVIEW 121
|
||||
#define DLG_GO 122
|
||||
#define DLG_ABOUT 123
|
||||
#define DLG_NH_TEXT 124
|
||||
#define DLG_NH 125
|
||||
#define DLG_NH_SPIN 126
|
||||
#define DLG_NV_TEXT 127
|
||||
#define DLG_NV 128
|
||||
#define DLG_NV_SPIN 129
|
||||
#define DLG_HMIN_TEXT 130
|
||||
#define DLG_HMIN 131
|
||||
#define DLG_HMAX_TEXT 132
|
||||
#define DLG_HMAX 133
|
||||
#define DLG_VMIN_TEXT 134
|
||||
#define DLG_VMIN 135
|
||||
#define DLG_VMAX_TEXT 136
|
||||
#define DLG_VMAX 137
|
||||
#define DLG_Z00_TEXT 138
|
||||
#define DLG_Z00 139
|
||||
#define DLG_Z01_TEXT 140
|
||||
#define DLG_Z01 141
|
||||
#define DLG_Z10_TEXT 142
|
||||
#define DLG_Z10 143
|
||||
#define DLG_Z11_TEXT 144
|
||||
#define DLG_Z11 145
|
||||
#define DLG_TEXTURE 146
|
||||
#define DLG_SKYBOX 147
|
||||
#define DLG_AUTOOVERWRITE 148
|
||||
#define DLG_DETAIL 149
|
||||
#define DLG_ARGHRAD2 150
|
||||
#define DLG_ARGHRAD2_SPIN 151
|
||||
#define DLG_APPEND 152
|
||||
#define DLG_REFRESH 153
|
||||
#define DLG_TEXOFFSETX 154
|
||||
#define DLG_TEXOFFSETY 155
|
||||
#define DLG_TEXSCALEX 156
|
||||
#define DLG_TEXSCALEY 157
|
||||
#define DLG_FIXPOINTS 158
|
||||
#define DLG_TEXTURE_BROWSE 159
|
||||
#define DLG_AZIMUTH 162
|
||||
#define DLG_AZIMUTH_SPIN 163
|
||||
#define DLG_ELEVATION 164
|
||||
#define DLG_ELEVATION_SPIN 165
|
||||
#define DLG_RANDOMSEED 166
|
||||
#define DLG_RANDOMSEED_SPIN 167
|
||||
#define DLG_BITMAP 168
|
||||
#define DLG_SAVE 169
|
||||
#define DLG_OPEN 170
|
||||
#define DLG_TAB 171
|
||||
#define DLG_TEXTURE2 172
|
||||
#define DLG_TEXTURE2_BROWSE 173
|
||||
#define DLG_LADDER 174
|
||||
#define DLG_ARGHRAD2_TEXT 175
|
||||
#define DLG_FILE_TEXT 176
|
||||
#define DLG_DECIMATE 177
|
||||
#define DLG_DECIMATE_TEXT 178
|
||||
#define DLG_HIDEBACKFACES 179
|
||||
#define DLG_DEFAULTS 180
|
||||
#define DLG_ABOUT_APP 200
|
||||
#define DLG_ABOUT_ICON 201
|
||||
#define DLG_BMP_FILE 202
|
||||
#define DLG_BMP_FILE_BROWSE 203
|
||||
#define DLG_BMP_BLACK 204
|
||||
#define DLG_BMP_WHITE 205
|
||||
#define DLG_BMP_TEXT1 206
|
||||
#define DLG_BMP_TEXT2 207
|
||||
#define DLG_BMP_TEXT3 208
|
||||
#define DLG_BMP_NOTE 209
|
||||
#define DLG_BMP_RELOAD 210
|
||||
#define DLG_ABOUT_URL 211
|
||||
#define DLG_ABOUT_BOARD 212
|
||||
#define DLG_FIX_FREE 300
|
||||
#define DLG_FIX_FREEALL 301
|
||||
#define DLG_FIX_VALUE_TEXT 302
|
||||
#define DLG_FIX_VALUE 303
|
||||
#define DLG_FIX_VALUE_SPIN 304
|
||||
#define DLG_FIX_DONE 305
|
||||
#define DLG_FIX_RANGE_TEXT 306
|
||||
#define DLG_FIX_RANGE 307
|
||||
#define DLG_FIX_NOTE 308
|
||||
#define DLG_FIX_RATE_TEXT 309
|
||||
#define DLG_FIX_RATE 310
|
||||
#define DLG_USE_PATCHES 311
|
||||
#define DLG_DECIMATE_LABEL 312
|
||||
#define DLG_HINT 350
|
||||
#define DLG_GAME_00 400
|
||||
#define DLG_GAME_01 401
|
||||
#define DLG_GAME_02 402
|
||||
#define DLG_GAME_03 403
|
||||
#define DLG_GAME_04 404
|
||||
#define DLG_GAME_05 405
|
||||
#define DLG_GAME_06 406
|
||||
#define DLG_GAME_07 407
|
||||
#define DLG_GAME_08 408
|
||||
#define DLG_GAME_09 409
|
||||
#define DLG_TEX_USEPAK 420
|
||||
#define DLG_TEX_PAK_TEXT 421
|
||||
#define DLG_TEX_PAKFILE 422
|
||||
#define DLG_TEX_PAK_BROWSE 423
|
||||
#define DLG_TEX_LIST1 424
|
||||
#define DLG_TEX_LIST2 425
|
||||
#define DLG_TEX_LIST3 426
|
||||
#define DLG_TEXTURE3 427
|
||||
#define DLG_TEXTURE3_BROWSE 428
|
||||
#define DLG_TEX_SLANT_TEXT 429
|
||||
#define DLG_TEX_SLANT 430
|
||||
#define DLG_TEX_SLANT_SPIN 431
|
||||
#define DLG_EXCEL_FUNC 500
|
||||
#define DLG_EXCEL_FUNC_TEXT 501
|
||||
#define DLG_PREVIEW_ANTIALIASING 502 // ^Fishman - Antializing for the preview window.
|
||||
#define DLG_SNAP_TO_GRID 503 // Hydra : snap to grid
|
||||
2040
contrib/gtkgensurf/genmap.cpp
Normal file
2040
contrib/gtkgensurf/genmap.cpp
Normal file
File diff suppressed because it is too large
Load Diff
467
contrib/gtkgensurf/gensurf.cpp
Normal file
467
contrib/gtkgensurf/gensurf.cpp
Normal file
@@ -0,0 +1,467 @@
|
||||
/*
|
||||
GenSurf plugin for GtkRadiant
|
||||
Copyright (C) 2001 David Hyde, Loki software and qeradiant.com
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Lesser General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2.1 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
|
||||
Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser 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 <gtk/gtk.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
/*
|
||||
#include <string.h>
|
||||
#include <tchar.h>
|
||||
#include <math.h>
|
||||
*/
|
||||
#include "gensurf.h"
|
||||
|
||||
char gszAppDir[NAME_MAX];
|
||||
char gszCaption[64];
|
||||
char gszIni[NAME_MAX];
|
||||
char gszHelpFile[NAME_MAX];
|
||||
char gszMapFile[NAME_MAX];
|
||||
char gszVersion[64];
|
||||
double Amplitude;
|
||||
double Roughness;
|
||||
double TexOffset[2];
|
||||
double TexScale[2];
|
||||
double WaveLength;
|
||||
double Hll, Hur, Vll, Vur;
|
||||
double Z00, Z01, Z10, Z11;
|
||||
ELEMENT Vertex[(MAX_ROWS+1)*(MAX_ROWS+1)];
|
||||
int AddHints;
|
||||
int ArghRad2;
|
||||
int AutoOverwrite;
|
||||
int Decimate=0;
|
||||
int SnapToGrid=0; // 0, or the grid size to snap to. // Hydra : snap to grid
|
||||
int FileAppend=0;
|
||||
int FixBorders;
|
||||
int HideBackFaces=0;
|
||||
int NH, NV;
|
||||
int NumVerticesSelected;
|
||||
int Plane;
|
||||
int Preview;
|
||||
int RandomSeed=1;
|
||||
int Skybox;
|
||||
int UseDetail;
|
||||
int UseLadder;
|
||||
int VertexMode=0;
|
||||
int WaveType;
|
||||
int gNumNodes=0;
|
||||
int gNumTris=0;
|
||||
int vid_x, vid_y;
|
||||
int view_x, view_y;
|
||||
int view_cx, view_cy;
|
||||
int UsePatches;
|
||||
int SlantAngle;
|
||||
int GimpHints;
|
||||
int Antialiasing; // ^Fishman - Antializing for the preview window.
|
||||
int AddTerrainKey; // ^Fishman - Add terrain key to func_group.
|
||||
int SP; // ^Fishman - Snap to grid.
|
||||
|
||||
GtkWidget *g_pWnd; // ghwnd;
|
||||
GtkWidget *g_pRadiantWnd; // ghwnd_main;
|
||||
/*HWND ghwndAngles;
|
||||
*/GtkWidget *g_pWndPreview;
|
||||
GtkWidget *g_pPreviewWidget;
|
||||
MYBITMAP gbmp;
|
||||
NODE *gNode=(NODE *)NULL;
|
||||
TRI *gTri=(TRI *)NULL;
|
||||
|
||||
int Game;
|
||||
bounding_box PlayerBox[NUMGAMES] = { {{-16., 16.}, {-16., 16.}, {-24., 32.}}, // Quake2
|
||||
{{-16., 16.}, {-16., 16.}, {-36., 36.}}, // Half-Life
|
||||
{{-16., 16.}, {-16., 16.}, {-32., 32.}}, // SiN
|
||||
{{-16., 16.}, {-16., 16.}, {-24., 32.}}, // Heretic2 (guess)
|
||||
{{-16., 16.}, {-16., 16.}, {-24., 32.}}, // KingPin (guess)
|
||||
{{-30., 30.}, {-30., 30.}, {-10.,160.}}, // Genesis3D (no idea)
|
||||
{{-16., 16.}, {-16., 16.}, {-24., 32.}}}; // Quake3 (not sure)
|
||||
//char gszOutputDir[NUMGAMES][NAME_MAX];
|
||||
//char gszTextureDir[NUMGAMES][NAME_MAX];
|
||||
char Texture[NUMGAMES][3][64];
|
||||
//char pakfile[NUMGAMES][NAME_MAX];
|
||||
//char lastpakfile[NUMGAMES][NAME_MAX];
|
||||
//int UsePak[NUMGAMES];
|
||||
//char GameDir[NUMGAMES][NAME_MAX];
|
||||
|
||||
char GameName[NUMGAMES][16] = {"Quake2", "Half-Life", "SiN", "Heretic2", "Kingpin", "Genesis3D", "Quake3" };
|
||||
|
||||
|
||||
bool GenSurfInit ()
|
||||
{
|
||||
strcpy (gszVersion, "1.05");
|
||||
strcpy (gszCaption, "GtkGenSurf");
|
||||
if (strlen (gszVersion))
|
||||
{
|
||||
strcat (gszCaption, " v");
|
||||
strcat (gszCaption, gszVersion);
|
||||
}
|
||||
|
||||
strcpy (gszIni, g_FuncTable.m_pfnProfileGetDirectory ());
|
||||
strcat (gszIni, "gensurf.ini");
|
||||
|
||||
/*if (g_FuncTable.m_pfnReadProjectKey != NULL)
|
||||
{
|
||||
char *basepath;
|
||||
|
||||
basepath = g_FuncTable.m_pfnReadProjectKey("basepath");
|
||||
if (basepath)
|
||||
{
|
||||
g_strdown (basepath);
|
||||
if (strstr(basepath,"baseq3"))
|
||||
Game = QUAKE3;
|
||||
else if (strstr (basepath,"baseq2"))
|
||||
Game = QUAKE2;
|
||||
else // Gotta have a game, might as well be Quake3
|
||||
Game = QUAKE3;
|
||||
}
|
||||
else
|
||||
Game = QUAKE3;
|
||||
}
|
||||
else */
|
||||
Game = QUAKE3;
|
||||
|
||||
ReadIniFile (gszIni);
|
||||
|
||||
if (g_pWnd == NULL)
|
||||
g_pWnd = create_main_dialog ();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
// Reads default values
|
||||
|
||||
#define OPTS_SECTION "Options"
|
||||
|
||||
void ReadIniFile (const char *file)
|
||||
{
|
||||
char *Text;
|
||||
float x1,x2,x3,x4;
|
||||
int i;
|
||||
|
||||
Text = g_FuncTable.m_pfnProfileLoadString (file, OPTS_SECTION, "Amplitude", "");
|
||||
if (strlen (Text))
|
||||
Amplitude = atof (Text);
|
||||
else
|
||||
Amplitude = 128;
|
||||
|
||||
Text = g_FuncTable.m_pfnProfileLoadString (file, OPTS_SECTION, "Roughness", "");
|
||||
if (strlen (Text))
|
||||
Roughness = atof (Text);
|
||||
else
|
||||
Roughness = 16;
|
||||
|
||||
Text = g_FuncTable.m_pfnProfileLoadString (file, OPTS_SECTION, "WaveLength", "");
|
||||
if (strlen (Text))
|
||||
WaveLength = atof (Text);
|
||||
else
|
||||
WaveLength = 1024;
|
||||
|
||||
Text = g_FuncTable.m_pfnProfileLoadString (file, OPTS_SECTION, "Extents", "");
|
||||
if (strlen (Text))
|
||||
{
|
||||
sscanf(Text,"%f,%f,%f,%f",&x1,&x2,&x3,&x4);
|
||||
Hll = x1;
|
||||
Vll = x2;
|
||||
Hur = x3;
|
||||
Vur = x4;
|
||||
}
|
||||
else
|
||||
{
|
||||
Hll = -512;
|
||||
Vll = -512;
|
||||
Hur = 512;
|
||||
Vur = 512;
|
||||
}
|
||||
|
||||
Text = g_FuncTable.m_pfnProfileLoadString (file, OPTS_SECTION, "CornerValues", "");
|
||||
if (strlen (Text))
|
||||
{
|
||||
sscanf(Text,"%f,%f,%f,%f",&x1,&x2,&x3,&x4);
|
||||
Z00 = x1;
|
||||
Z01 = x2;
|
||||
Z10 = x3;
|
||||
Z11 = x4;
|
||||
}
|
||||
else
|
||||
{
|
||||
Z00 = 0.;
|
||||
Z01 = 0.;
|
||||
Z10 = 0.;
|
||||
Z11 = 0.;
|
||||
}
|
||||
|
||||
Text = g_FuncTable.m_pfnProfileLoadString (file, OPTS_SECTION, "TextureOffset", "");
|
||||
if (strlen (Text))
|
||||
{
|
||||
sscanf(Text,"%f,%f",&x1,&x2);
|
||||
TexOffset[0] = x1;
|
||||
TexOffset[1] = x2;
|
||||
}
|
||||
else
|
||||
{
|
||||
TexOffset[0] = 0.;
|
||||
TexOffset[1] = 0.;
|
||||
}
|
||||
|
||||
Text = g_FuncTable.m_pfnProfileLoadString (file, OPTS_SECTION,"TextureScale","");
|
||||
if (strlen (Text))
|
||||
{
|
||||
sscanf(Text,"%f,%f",&x1,&x2);
|
||||
TexScale[0] = x1;
|
||||
TexScale[1] = x2;
|
||||
if(TexScale[0] == 0.) TexScale[0] = 1.0;
|
||||
if(TexScale[1] == 0.) TexScale[1] = 1.0;
|
||||
}
|
||||
else
|
||||
{
|
||||
TexScale[0] = 1.;
|
||||
TexScale[1] = 1.;
|
||||
}
|
||||
|
||||
NH = g_FuncTable.m_pfnProfileLoadInt (file, OPTS_SECTION,"NH",8);
|
||||
NH = max(1,min(NH,MAX_ROWS));
|
||||
NV = g_FuncTable.m_pfnProfileLoadInt (file, OPTS_SECTION,"NV",8);
|
||||
NV = max(1,min(NV,MAX_ROWS));
|
||||
|
||||
// Decimate = GetPrivateProfileInt(OPTS_SECTION,"Decimate",0,file);
|
||||
// Decimate = max(0,min(Decimate,100));
|
||||
|
||||
AddHints = g_FuncTable.m_pfnProfileLoadInt (file, OPTS_SECTION,"AddHints",0);
|
||||
ArghRad2 = g_FuncTable.m_pfnProfileLoadInt (file, OPTS_SECTION,"ArghRad2",0);
|
||||
AutoOverwrite = g_FuncTable.m_pfnProfileLoadInt (file, OPTS_SECTION,"AutoOverwrite",0);
|
||||
FixBorders = g_FuncTable.m_pfnProfileLoadInt (file, OPTS_SECTION,"FixBorders",1);
|
||||
HideBackFaces = g_FuncTable.m_pfnProfileLoadInt (file, OPTS_SECTION,"HideBackFaces",0);
|
||||
Plane = g_FuncTable.m_pfnProfileLoadInt (file, OPTS_SECTION,"Plane",0);
|
||||
Preview = g_FuncTable.m_pfnProfileLoadInt (file, OPTS_SECTION,"Preview", 0);
|
||||
Antialiasing = g_FuncTable.m_pfnProfileLoadInt (file, OPTS_SECTION,"Antialiasing",0); // ^Fishman - Antializing for the preview window.
|
||||
RandomSeed = g_FuncTable.m_pfnProfileLoadInt (file, OPTS_SECTION,"RandomSeed",1);
|
||||
Skybox = g_FuncTable.m_pfnProfileLoadInt (file, OPTS_SECTION,"Skybox",0);
|
||||
UseDetail = g_FuncTable.m_pfnProfileLoadInt (file, OPTS_SECTION,"UseDetail",0);
|
||||
AddTerrainKey = g_FuncTable.m_pfnProfileLoadInt (file, OPTS_SECTION,"AddTerrainKey",0); // ^Fishman - Add terrain key to func_group.
|
||||
UseLadder = g_FuncTable.m_pfnProfileLoadInt (file, OPTS_SECTION,"UseLadder",0);
|
||||
WaveType = g_FuncTable.m_pfnProfileLoadInt (file, OPTS_SECTION,"WaveType",0);
|
||||
vid_x = g_FuncTable.m_pfnProfileLoadInt (file, OPTS_SECTION,"vid_x", 0);
|
||||
vid_y = g_FuncTable.m_pfnProfileLoadInt (file, OPTS_SECTION,"vid_y", 0);
|
||||
view_x = g_FuncTable.m_pfnProfileLoadInt (file, OPTS_SECTION,"view_x",0);
|
||||
view_y = g_FuncTable.m_pfnProfileLoadInt (file, OPTS_SECTION,"view_y",0);
|
||||
view_cx = g_FuncTable.m_pfnProfileLoadInt (file, OPTS_SECTION,"view_cx",0);
|
||||
view_cy = g_FuncTable.m_pfnProfileLoadInt (file, OPTS_SECTION,"view_cy",0);
|
||||
|
||||
UsePatches = g_FuncTable.m_pfnProfileLoadInt (file, OPTS_SECTION,"UsePatches",0);
|
||||
|
||||
SlantAngle = g_FuncTable.m_pfnProfileLoadInt (file, OPTS_SECTION,"SlantAngle",60);
|
||||
GimpHints = g_FuncTable.m_pfnProfileLoadInt (file, OPTS_SECTION,"GimpHints",0);
|
||||
|
||||
for(i=0; i<NUMGAMES; i++)
|
||||
{
|
||||
// strcpy (gszOutputDir[i], g_FuncTable.m_pfnProfileLoadString (file, GameName[i],"OutputDir",""));
|
||||
strcpy (Texture[i][0], g_FuncTable.m_pfnProfileLoadString (file, GameName[i], "Texture", ""));
|
||||
strcpy (Texture[i][1], g_FuncTable.m_pfnProfileLoadString (file, GameName[i], "Texture2", ""));
|
||||
strcpy (Texture[i][2], g_FuncTable.m_pfnProfileLoadString (file, GameName[i], "Texture3", ""));
|
||||
// strcpy (gszTextureDir[i], g_FuncTable.m_pfnProfileLoadString (file, GameName[i],"TextureDir",""));
|
||||
// UsePak[i] = GetPrivateProfileInt(GameName[i],"UsePak",0);
|
||||
// strcpy (pakfile[i], g_FuncTable.m_pfnProfileLoadString (file, GameName[i],"PakFile",""));
|
||||
// strcpy (lastpakfile[i], g_FuncTable.m_pfnProfileLoadString (file, GameName[i],"LastPakFile",""));
|
||||
// strcpy (GameDir[i], g_FuncTable.m_pfnProfileLoadString (file, GameName[i],"GameDir","\0"));
|
||||
}
|
||||
/*
|
||||
if(!strlen(gszTextureDir[QUAKE2]))
|
||||
strcpy(gszTextureDir[QUAKE2],"c:\\quake2\\baseq2\\textures\\");
|
||||
if(!strlen(gszTextureDir[KINGPIN]))
|
||||
strcpy(gszTextureDir[KINGPIN],"c:\\kingpin\\main\\textures\\");
|
||||
*/
|
||||
if(!strlen(Texture[QUAKE2][0])) strcpy(Texture[QUAKE2][0], "textures/e1u1/grass1_4");
|
||||
if(!strlen(Texture[HALFLIFE][0])) strcpy(Texture[HALFLIFE][0], "textures/OUT_GRND1");
|
||||
if(!strlen(Texture[SIN][0])) strcpy(Texture[SIN][0], "textures/generic/floor_organic/fl_grass");
|
||||
if(!strlen(Texture[HERETIC2][0])) strcpy(Texture[HERETIC2][0], "textures/canyon/canyon05");
|
||||
if(!strlen(Texture[KINGPIN][0])) strcpy(Texture[KINGPIN][0], "textures/bricks/s_sr_m3");
|
||||
if(!strlen(Texture[GENESIS3D][0])) strcpy(Texture[GENESIS3D][0],"textures/rock13");
|
||||
if(!strlen(Texture[QUAKE3][0])) strcpy(Texture[QUAKE3][0], "textures/organics/grass3");
|
||||
if(!strlen(Texture[QUAKE3][1])) strcpy(Texture[QUAKE3][1], "textures/common/caulk");
|
||||
|
||||
strcpy (gbmp.name, g_FuncTable.m_pfnProfileLoadString (file, "Bitmap","Filename",""));
|
||||
|
||||
if (strlen(gbmp.name))
|
||||
OpenBitmap ();
|
||||
|
||||
strcpy (gbmp.defpath, g_FuncTable.m_pfnProfileLoadString (file, "Bitmap","DefaultPath",""));
|
||||
|
||||
Text = g_FuncTable.m_pfnProfileLoadString (file, "Bitmap","BlackValue","");
|
||||
if (strlen (Text))
|
||||
gbmp.black_value = atof (Text);
|
||||
else
|
||||
gbmp.black_value = 0;
|
||||
|
||||
Text = g_FuncTable.m_pfnProfileLoadString (file, "Bitmap","WhiteValue","");
|
||||
if (strlen (Text))
|
||||
gbmp.white_value = atof (Text);
|
||||
else
|
||||
gbmp.white_value = 256.;
|
||||
}
|
||||
|
||||
/*
|
||||
============
|
||||
va
|
||||
|
||||
does a varargs printf into a temp buffer, so I don't need to have
|
||||
varargs versions of all text functions.
|
||||
FIXME: make this buffer size safe someday
|
||||
============
|
||||
*/
|
||||
char *va (char *format, ...)
|
||||
{
|
||||
va_list argptr;
|
||||
static char string[1024];
|
||||
|
||||
va_start (argptr, format);
|
||||
vsprintf (string, format,argptr);
|
||||
va_end (argptr);
|
||||
|
||||
return string;
|
||||
}
|
||||
|
||||
|
||||
// Writes current values to INI file
|
||||
void WriteIniFile(const char *file)
|
||||
{
|
||||
int i;
|
||||
|
||||
g_FuncTable.m_pfnProfileSaveString (file, OPTS_SECTION, "Amplitude", va("%g",Amplitude));
|
||||
g_FuncTable.m_pfnProfileSaveString (file, OPTS_SECTION, "Roughness", va("%g",Roughness));
|
||||
g_FuncTable.m_pfnProfileSaveString (file, OPTS_SECTION, "WaveLength", va("%g",WaveLength));
|
||||
g_FuncTable.m_pfnProfileSaveString (file, OPTS_SECTION, "Extents", va("%g,%g,%g,%g",Hll,Vll,Hur,Vur));
|
||||
g_FuncTable.m_pfnProfileSaveString (file, OPTS_SECTION, "CornerValues", va("%g,%g,%g,%g",Z00,Z01,Z10,Z11));
|
||||
g_FuncTable.m_pfnProfileSaveString (file, OPTS_SECTION, "TextureOffset",va("%g,%g",TexOffset[0],TexOffset[1]));
|
||||
g_FuncTable.m_pfnProfileSaveString (file, OPTS_SECTION, "TextureScale", va("%g,%g",TexScale[0],TexScale[1]));
|
||||
g_FuncTable.m_pfnProfileSaveInt (file, OPTS_SECTION, "NH", NH);
|
||||
g_FuncTable.m_pfnProfileSaveInt (file, OPTS_SECTION, "NV", NV);
|
||||
g_FuncTable.m_pfnProfileSaveInt (file, OPTS_SECTION, "AddHints", AddHints);
|
||||
g_FuncTable.m_pfnProfileSaveInt (file, OPTS_SECTION, "ArghRad2", ArghRad2);
|
||||
g_FuncTable.m_pfnProfileSaveInt (file, OPTS_SECTION, "AutoOverwrite", AutoOverwrite);
|
||||
g_FuncTable.m_pfnProfileSaveInt (file, OPTS_SECTION, "FixBorders", FixBorders);
|
||||
g_FuncTable.m_pfnProfileSaveInt (file, OPTS_SECTION, "Plane", Plane);
|
||||
g_FuncTable.m_pfnProfileSaveInt (file, OPTS_SECTION, "Preview", Preview);
|
||||
g_FuncTable.m_pfnProfileSaveInt (file, OPTS_SECTION, "Antialiasing", Antialiasing); // ^Fishman - Antializing for the preview window.
|
||||
g_FuncTable.m_pfnProfileSaveInt (file, OPTS_SECTION, "RandomSeed", RandomSeed);
|
||||
g_FuncTable.m_pfnProfileSaveInt (file, OPTS_SECTION, "Skybox", Skybox);
|
||||
g_FuncTable.m_pfnProfileSaveInt (file, OPTS_SECTION, "UseDetail", UseDetail);
|
||||
g_FuncTable.m_pfnProfileSaveInt (file, OPTS_SECTION, "AddTerrainKey", AddTerrainKey); // ^Fishman - Add terrain key to func_group.
|
||||
g_FuncTable.m_pfnProfileSaveInt (file, OPTS_SECTION, "UseLadder", UseLadder);
|
||||
g_FuncTable.m_pfnProfileSaveInt (file, OPTS_SECTION, "WaveType", WaveType);
|
||||
g_FuncTable.m_pfnProfileSaveInt (file, OPTS_SECTION, "vid_x", vid_x);
|
||||
g_FuncTable.m_pfnProfileSaveInt (file, OPTS_SECTION, "vid_y", vid_y);
|
||||
g_FuncTable.m_pfnProfileSaveInt (file, OPTS_SECTION, "view_x", view_x);
|
||||
g_FuncTable.m_pfnProfileSaveInt (file, OPTS_SECTION, "view_y", view_y);
|
||||
g_FuncTable.m_pfnProfileSaveInt (file, OPTS_SECTION, "view_cx", view_cx);
|
||||
g_FuncTable.m_pfnProfileSaveInt (file, OPTS_SECTION, "view_cy", view_cy);
|
||||
g_FuncTable.m_pfnProfileSaveInt (file, OPTS_SECTION, "UsePatches", UsePatches);
|
||||
g_FuncTable.m_pfnProfileSaveInt (file, OPTS_SECTION, "SlantAngle", SlantAngle);
|
||||
for(i=0; i<NUMGAMES; i++)
|
||||
{
|
||||
g_FuncTable.m_pfnProfileSaveString (file, GameName[i], "Texture", Texture[i][0] );
|
||||
g_FuncTable.m_pfnProfileSaveString (file, GameName[i], "Texture2", Texture[i][1] );
|
||||
g_FuncTable.m_pfnProfileSaveString (file, GameName[i], "Texture3", Texture[i][2] );
|
||||
}
|
||||
|
||||
g_FuncTable.m_pfnProfileSaveString (file, "Bitmap", "Filename", gbmp.name );
|
||||
g_FuncTable.m_pfnProfileSaveString (file, "Bitmap", "DefaultPath", gbmp.defpath );
|
||||
g_FuncTable.m_pfnProfileSaveString (file, "Bitmap", "BlackValue", va("%g",gbmp.black_value));
|
||||
g_FuncTable.m_pfnProfileSaveString (file, "Bitmap", "WhiteValue", va("%g",gbmp.white_value));
|
||||
//g_FuncTable.m_pfnProfileSaveString (file, "Formula", "Formula", ExcelFunc );
|
||||
}
|
||||
|
||||
void UpdatePreview (bool DataChange)
|
||||
{
|
||||
if (g_pWndPreview && GTK_WIDGET_VISIBLE (g_pWndPreview))
|
||||
{
|
||||
if (DataChange)
|
||||
GenerateXYZ ();
|
||||
|
||||
gtk_widget_draw (g_pPreviewWidget, NULL);
|
||||
}
|
||||
}
|
||||
|
||||
void SaveSetup (GtkWidget *parent)
|
||||
{
|
||||
const char *name = g_FuncTable.m_pfnFileDialog (parent, false, "Save GenSurf Settings",
|
||||
g_FuncTable.m_pfnProfileGetDirectory ());
|
||||
|
||||
if (name != NULL)
|
||||
{
|
||||
char key[32], text[32];
|
||||
int i, j;
|
||||
|
||||
WriteIniFile (name);
|
||||
g_FuncTable.m_pfnProfileSaveString (name, OPTS_SECTION,"MapFile",gszMapFile);
|
||||
sprintf(text,"0x%04x",FileAppend);
|
||||
g_FuncTable.m_pfnProfileSaveString (name, OPTS_SECTION,"Append",text);
|
||||
sprintf(text,"0x%04x",Decimate);
|
||||
g_FuncTable.m_pfnProfileSaveString (name, OPTS_SECTION,"Decimate",text);
|
||||
for(i=0; i<=NH; i++)
|
||||
{
|
||||
for(j=0; j<=NV; j++)
|
||||
{
|
||||
if(xyz[i][j].fixed)
|
||||
{
|
||||
sprintf(key,"I%dJ%d",i,j);
|
||||
sprintf(text,"%g %g %g", xyz[i][j].fixed_value, xyz[i][j].range, xyz[i][j].rate);
|
||||
g_FuncTable.m_pfnProfileSaveString (name, "FixedPoints",key,text);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void OpenSetup (GtkWidget *parent, int UseDefaults)
|
||||
{
|
||||
const char *name;
|
||||
char key[32], *text;
|
||||
float value,range,rate;
|
||||
int i, j;
|
||||
|
||||
if (UseDefaults)
|
||||
name = g_strdup ("plugins/defaults.srf"); // dummy string
|
||||
else
|
||||
name = g_FuncTable.m_pfnFileDialog (parent, true, "Open GenSurf Settings",
|
||||
g_FuncTable.m_pfnProfileGetDirectory ());
|
||||
|
||||
if(name != NULL)
|
||||
{
|
||||
ReadIniFile (name);
|
||||
Decimate = g_FuncTable.m_pfnProfileLoadInt (name, OPTS_SECTION,"Decimate",0);
|
||||
Decimate = max(0,min(Decimate,100));
|
||||
|
||||
for (i=0; i<=NH; i++)
|
||||
{
|
||||
for (j=0; j<=NV; j++)
|
||||
{
|
||||
sprintf(key,"I%dJ%d",i,j);
|
||||
text = g_FuncTable.m_pfnProfileLoadString (name, "FixedPoints", key, "");
|
||||
if (strlen (text))
|
||||
{
|
||||
xyz[i][j].fixed = 1;
|
||||
xyz[i][j].rate = 0.;
|
||||
sscanf(text,"%g %g %g",&value,&range,&rate);
|
||||
xyz[i][j].fixed_value = value;
|
||||
xyz[i][j].range = range;
|
||||
xyz[i][j].rate = rate;
|
||||
}
|
||||
else
|
||||
xyz[i][j].fixed = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
8
contrib/gtkgensurf/gensurf.def
Normal file
8
contrib/gtkgensurf/gensurf.def
Normal file
@@ -0,0 +1,8 @@
|
||||
; gensurf.def : Declares the module parameters for the DLL.
|
||||
|
||||
LIBRARY "gensurf"
|
||||
DESCRIPTION 'gensurf Windows Dynamic Link Library'
|
||||
|
||||
EXPORTS
|
||||
; Explicit exports can go here
|
||||
Synapse_EnumerateInterfaces @1
|
||||
432
contrib/gtkgensurf/gensurf.h
Normal file
432
contrib/gtkgensurf/gensurf.h
Normal file
@@ -0,0 +1,432 @@
|
||||
/*
|
||||
GenSurf plugin for GtkRadiant
|
||||
Copyright (C) 2001 David Hyde, Loki software and qeradiant.com
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Lesser General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2.1 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
|
||||
Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser 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
|
||||
*/
|
||||
|
||||
#ifndef _GENSURF_H_
|
||||
#define _GENSURF_H_
|
||||
|
||||
#include <string.h>
|
||||
#include "qertypes.h"
|
||||
#include <stdio.h>
|
||||
|
||||
#include "mathlib.h"
|
||||
#include "iscenegraph.h"
|
||||
#define USE_QERTABLE_DEFINE
|
||||
#include "qerplugin.h"
|
||||
extern _QERFuncTable_1 g_FuncTable;
|
||||
|
||||
#include "irender.h"
|
||||
#include "iselection.h"
|
||||
|
||||
#define USE_ENTITYTABLE_DEFINE
|
||||
#include "ientity.h"
|
||||
extern _QEREntityTable __ENTITYTABLENAME;
|
||||
|
||||
#define USE_PATCHTABLE_DEFINE
|
||||
#include "ipatch.h"
|
||||
extern _QERPatchTable __PATCHTABLENAME;
|
||||
|
||||
#define USE_BRUSHTABLE_DEFINE
|
||||
#include "ibrush.h"
|
||||
extern _QERBrushTable __BRUSHTABLENAME;
|
||||
|
||||
#include "igl.h"
|
||||
#include "ientity.h"
|
||||
|
||||
#include <gtk/gtk.h>
|
||||
|
||||
#include "iui_gtk.h"
|
||||
|
||||
#include "gendlgs.h"
|
||||
|
||||
|
||||
#define PLUGIN
|
||||
#define Q3RADIANT
|
||||
|
||||
//#if defined(__linux__) || defined(__APPLE__)
|
||||
#if 1
|
||||
#include <algorithm>
|
||||
#else
|
||||
template <class T>
|
||||
inline T min (T x, T y) { return (x < y) ? x : y; }
|
||||
template <class T>
|
||||
inline T max (T x, T y) { return (x > y) ? x : y; }
|
||||
#endif
|
||||
|
||||
typedef struct { long x, y; } Point;
|
||||
typedef struct { long left, top, right, bottom; } Rect;
|
||||
|
||||
#define NAME_MAX 255
|
||||
|
||||
typedef void* LPVOID;
|
||||
typedef char* LPSTR;
|
||||
|
||||
//#endif
|
||||
inline bool PtInRect (Rect *rc, Point pt)
|
||||
{
|
||||
if (pt.x < rc->left) return false;
|
||||
if (pt.x > rc->right) return false;
|
||||
if (pt.y < rc->bottom) return false;
|
||||
if (pt.y > rc->top) return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
#define NUMGAMES 7
|
||||
|
||||
#define CONTENTS_SOLID 0x00000001
|
||||
#define CONTENTS_DETAIL 0x08000000 // brushes to be added after vis leafs
|
||||
#define CONTENTS_LADDER 0x20000000
|
||||
#define SURF_HINT 0x100 // make a primary bsp splitter
|
||||
#define SURF_SKIP 0x200 // completely ignore, allowing non-closed brushes
|
||||
#define HINT_OFFSET 96
|
||||
|
||||
#define PI 3.14159265358979224
|
||||
#define RadiansToDegrees(a) (floor(a*57.2957795 - 0.5)+1.)
|
||||
#define DegreesToRadians(a) (a/57.2957795)
|
||||
|
||||
#define BOGUS_RANGE 65536
|
||||
/*
|
||||
#define DotProduct(x,y) (x[0]*y[0]+x[1]*y[1]+x[2]*y[2])
|
||||
#define VectorAdd(a,b,c) {c[0]=a[0]+b[0];c[1]=a[1]+b[1];c[2]=a[2]+b[2];}
|
||||
#define VectorClear(x) {x[0] = x[1] = x[2] = 0;}
|
||||
#define VectorCopy(a,b) {b[0]=a[0];b[1]=a[1];b[2]=a[2];}
|
||||
#define VectorScale(a,b,c) {c[0]=b*a[0];c[1]=b*a[1];c[2]=b*a[2];}
|
||||
#define VectorSubtract(a,b,c) {c[0]=a[0]-b[0];c[1]=a[1]-b[1];c[2]=a[2]-b[2];}
|
||||
*/
|
||||
#define XYZVectorSubtract(a,b,c) {c[0]=(float)a[0]-(float)b[0];c[1]=(float)a[1]-(float)b[1];c[2]=(float)a[2]-(float)b[2];}
|
||||
#define side(u1,v1,u2,v2,u3,v3) (v3-v1)*(u2-u1) - (u3-u1)*(v2-v1)
|
||||
|
||||
#define QUAKE2 0
|
||||
#define HALFLIFE 1
|
||||
#define SIN 2
|
||||
#define HERETIC2 3
|
||||
#define KINGPIN 4
|
||||
#define GENESIS3D 5
|
||||
#define QUAKE3 6
|
||||
|
||||
#define MAX_FACES_PER_BRUSH 6
|
||||
#define SLIVER_ANGLE DegreesToRadians(20)
|
||||
#define MAX_NODES (MAX_ROWS+1)*(MAX_ROWS+1)
|
||||
#define MAX_TRIS (MAX_ROWS)*(MAX_ROWS)
|
||||
|
||||
typedef float vec;
|
||||
typedef vec vec3[3];
|
||||
typedef vec vec2[2];
|
||||
|
||||
typedef struct
|
||||
{
|
||||
vec3 v[3];
|
||||
char texture[64];
|
||||
float Shift[2];
|
||||
float Rotate;
|
||||
float Scale[2];
|
||||
int Contents;
|
||||
int Surface;
|
||||
int Value;
|
||||
} FACE;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
vec3 normal;
|
||||
vec dist;
|
||||
} PLANE;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
int numpoints;
|
||||
vec3 p[4]; // variable sized
|
||||
} MY_WINDING;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
int Number;
|
||||
int NumFaces;
|
||||
FACE face[MAX_FACES_PER_BRUSH];
|
||||
} BRUSH;
|
||||
|
||||
typedef struct tagXYZ
|
||||
{
|
||||
int fixed;
|
||||
int done;
|
||||
double p[3];
|
||||
double pp[3]; // these used only for general 3D projection (not isometric)
|
||||
double fixed_value;
|
||||
double range;
|
||||
double rate;
|
||||
} XYZ;
|
||||
|
||||
// Q2 PAK file structures
|
||||
typedef struct
|
||||
{
|
||||
char id[4]; // Should be 'PACK'
|
||||
int dstart; // Offest in the file to the directory
|
||||
int dsize; // Size in bytes of the directory, same as num_items*64
|
||||
} pak_header_t;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
char name[56]; // The name of the item, normal C string
|
||||
int start; // Offset in .pak file to start of item
|
||||
int size; // Size of item in bytes
|
||||
} pak_item_t;
|
||||
|
||||
// SiN .SIN structures
|
||||
#define SINPAKHEADER (('K'<<24)+('A'<<16)+('P'<<8)+'S')
|
||||
#define MAX_PAK_FILENAME_LENGTH 120
|
||||
|
||||
typedef struct
|
||||
{
|
||||
char name[MAX_PAK_FILENAME_LENGTH];
|
||||
int filepos, filelen;
|
||||
} dpackfile_t;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
int ident; // == IDPAKHEADER
|
||||
int dirofs;
|
||||
int dirlen;
|
||||
} dpackheader_t;
|
||||
|
||||
// Half-Life WAD file structures
|
||||
typedef struct
|
||||
{
|
||||
char identification[4]; // should be WAD2 or 2DAW
|
||||
int numlumps;
|
||||
int infotableofs;
|
||||
} wadinfo_t;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
int filepos;
|
||||
int disksize;
|
||||
int size; // uncompressed
|
||||
char type;
|
||||
char compression;
|
||||
char pad1, pad2;
|
||||
char name[16]; // must be null terminated
|
||||
} lumpinfo_t;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
int signature;
|
||||
short version;
|
||||
short bitflag;
|
||||
short compression_method;
|
||||
short modfiletime;
|
||||
short modfiledate;
|
||||
int crc;
|
||||
int compressed_size;
|
||||
int uncompressed_size;
|
||||
short filename_size;
|
||||
short extra_size;
|
||||
} zipheader_t;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
double x[2];
|
||||
double y[2];
|
||||
double z[2];
|
||||
} bounding_box;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
float p[3];
|
||||
int used;
|
||||
int tri;
|
||||
float error;
|
||||
int fixed;
|
||||
} NODE;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
int v[3];
|
||||
int n[3]; // indices of neighboring triangles
|
||||
PLANE plane;
|
||||
int flag;
|
||||
float min[3];
|
||||
float max[3];
|
||||
} TRI;
|
||||
|
||||
//--------------- bitmap.c -----------------------------
|
||||
bool OpenBitmap ();
|
||||
double CalculateSnapValue(double value);
|
||||
void GenerateBitmapMapping ();
|
||||
//--------------- face.c -------------------------------
|
||||
void PlaneFromPoints (float *, float *, float *, PLANE *);
|
||||
//void CrossProduct (vec3 v1, vec3 v2, vec3 cross);
|
||||
//vec VectorNormalize (vec3 in, vec3 out);
|
||||
//--------------- gendlg.c -----------------------------
|
||||
GtkWidget* create_main_dialog ();
|
||||
void About (GtkWidget *parent);
|
||||
//--------------- genmap.c -----------------------------
|
||||
double AtLeast(double,double);
|
||||
bool CanEdit(int, int);
|
||||
void CloseFuncGroup();
|
||||
bool FixedPoint(int,int);
|
||||
void GenerateMap();
|
||||
void GenerateXYZ();
|
||||
double LessThan(double,double);
|
||||
void MakeBrush(BRUSH *);
|
||||
double MoreThan(double,double);
|
||||
double Nearest(double,double);
|
||||
double NoMoreThan(double,double);
|
||||
void OpenFuncGroup();
|
||||
void PlasmaCloud();
|
||||
int PlayerStartZ(double,double);
|
||||
void SubdividePlasma(int,int,int,int);
|
||||
bool ValidSurface();
|
||||
void XYZtoV(XYZ *, vec3 *);
|
||||
scene::Node* MakePatch(void);
|
||||
|
||||
//---------------- gensurf.c ---------------------------
|
||||
bool GenSurfInit ();
|
||||
void ReadIniFile (const char *);
|
||||
void WriteIniFile (const char *);
|
||||
void OpenSetup (GtkWidget*,int);
|
||||
void SaveSetup (GtkWidget*);
|
||||
//---------------- heretic.c ---------------------------
|
||||
int GetDefSurfaceProps(char *);
|
||||
//---------------- view.c ------------------------------
|
||||
void CreateViewWindow ();
|
||||
void DrawGrid(Rect);
|
||||
void DrawPreview(Rect);
|
||||
void evaluate();
|
||||
void GetScaleFactor(Rect);
|
||||
void project(XYZ *);
|
||||
void Scale(Rect,XYZ,Point *);
|
||||
void ShowPreview ();
|
||||
void UpdatePreview (bool);
|
||||
|
||||
//---------------- plugin.c -----------------------------
|
||||
void UseFaceBounds();
|
||||
|
||||
extern _QERFuncTable_1 g_FuncTable;
|
||||
extern _QERQglTable g_GLTable;
|
||||
extern _QERUIGtkTable g_UIGtkTable;
|
||||
extern _QEREntityTable g_EntityTable;
|
||||
//#define MAX_ROWS 64
|
||||
#define MAX_ROWS 128
|
||||
|
||||
#define PLANE_XY0 0
|
||||
#define PLANE_XY1 1
|
||||
#define PLANE_YZ0 2
|
||||
#define PLANE_XZ0 3
|
||||
#define PLANE_YZ1 4
|
||||
#define PLANE_XZ1 5
|
||||
|
||||
#define WAVE_COS_SIN 0
|
||||
#define WAVE_HCYLINDER 1
|
||||
#define WAVE_VCYLINDER 2
|
||||
#define WAVE_BITMAP 3
|
||||
#define WAVE_ROUGH_ONLY 4
|
||||
#define WAVE_FORMULA 5
|
||||
#define WAVE_FIRST WAVE_COS_SIN
|
||||
#define WAVE_LAST WAVE_FORMULA
|
||||
#define DLG_WAVE_LAST DLG_WAVE_01+WAVE_LAST-WAVE_FIRST
|
||||
|
||||
#define MSG_VERTEX_SELECTED WM_USER+1
|
||||
|
||||
typedef struct tagMYBITMAP
|
||||
{
|
||||
char name[NAME_MAX];
|
||||
char defpath[NAME_MAX];
|
||||
double black_value;
|
||||
double white_value;
|
||||
int width, height;
|
||||
unsigned char* colors;
|
||||
} MYBITMAP;
|
||||
|
||||
typedef struct tagELEMENT {
|
||||
int i;
|
||||
int j;
|
||||
} ELEMENT;
|
||||
|
||||
extern char gszAppDir[NAME_MAX];
|
||||
extern char gszCaption[64];
|
||||
extern char gszHelpFile[NAME_MAX];
|
||||
extern char gszIni[NAME_MAX];
|
||||
extern char gszMapFile[NAME_MAX];
|
||||
extern char gszVersion[64];
|
||||
extern double Amplitude;
|
||||
extern double Roughness;
|
||||
extern double TexOffset[2];
|
||||
extern double TexScale[2];
|
||||
extern double WaveLength;
|
||||
extern double Hll, Hur, Vll, Vur;
|
||||
extern double Z00, Z01, Z10, Z11;
|
||||
extern double yaw, pitch, roll;
|
||||
extern ELEMENT Vertex[(MAX_ROWS+1)*(MAX_ROWS+1)];
|
||||
extern int AddHints;
|
||||
extern int ArghRad2;
|
||||
extern int AutoOverwrite;
|
||||
extern int Decimate;
|
||||
extern int FileAppend;
|
||||
extern int FixBorders;
|
||||
extern int HideBackFaces;
|
||||
extern int NH, NV;
|
||||
extern int NumVerticesSelected;
|
||||
extern int Plane;
|
||||
extern int Preview;
|
||||
extern int RandomSeed;
|
||||
extern int Skybox;
|
||||
extern int UseDetail;
|
||||
extern int UseLadder;
|
||||
extern int VertexMode;
|
||||
extern int vid_x, vid_y;
|
||||
extern int WaveType;
|
||||
extern int gNumNodes;
|
||||
extern int gNumTris;
|
||||
extern int view_x, view_y;
|
||||
extern int view_cx, view_cy;
|
||||
extern int UsePatches;
|
||||
extern int SlantAngle;
|
||||
extern int GimpHints;
|
||||
extern int Antialiasing; // ^Fishman - Antializing for the preview window.
|
||||
extern int AddTerrainKey; // ^Fishman - Add terrain key to func_group.
|
||||
extern int SnapToGrid; // Hydra : snap to grid
|
||||
extern int SP; // ^Fishman - Snap to grid.
|
||||
|
||||
|
||||
/*extern HCURSOR ghCursorCurrent;
|
||||
extern HCURSOR ghCursorDefault;
|
||||
extern HCURSOR ghCursorVertex;
|
||||
extern HINSTANCE ghInst;*/
|
||||
extern GtkWidget *g_pRadiantWnd;
|
||||
extern GtkWidget *g_pWnd;
|
||||
/*extern HWND ghwndAngles;
|
||||
extern HWND ghwndFix;
|
||||
*/extern GtkWidget *g_pWndPreview;
|
||||
extern GtkWidget *g_pPreviewWidget;
|
||||
extern MYBITMAP gbmp;
|
||||
extern NODE *gNode;
|
||||
extern TRI *gTri;
|
||||
extern XYZ xyz[MAX_ROWS+1][MAX_ROWS+1];
|
||||
|
||||
extern int Game;
|
||||
extern bounding_box PlayerBox[NUMGAMES];
|
||||
//extern char gszOutputDir[NUMGAMES][NAME_MAX];
|
||||
extern char Texture[NUMGAMES][3][64];
|
||||
//extern char gszTextureDir[NUMGAMES][NAME_MAX];
|
||||
extern char GameName[NUMGAMES][16];
|
||||
//extern char pakfile[NUMGAMES][NAME_MAX];
|
||||
//extern char lastpakfile[NUMGAMES][NAME_MAX];
|
||||
//extern int UsePak[NUMGAMES];
|
||||
//extern char GameDir[NUMGAMES][NAME_MAX];
|
||||
//extern char ExcelFunc[1024];
|
||||
|
||||
#endif // _GENSURF_H_
|
||||
172
contrib/gtkgensurf/gtkgensurf.dsp
Normal file
172
contrib/gtkgensurf/gtkgensurf.dsp
Normal file
@@ -0,0 +1,172 @@
|
||||
# Microsoft Developer Studio Project File - Name="gtkgensurf" - Package Owner=<4>
|
||||
# Microsoft Developer Studio Generated Build File, Format Version 6.00
|
||||
# ** DO NOT EDIT **
|
||||
|
||||
# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102
|
||||
|
||||
CFG=gtkgensurf - Win32 Debug
|
||||
!MESSAGE This is not a valid makefile. To build this project using NMAKE,
|
||||
!MESSAGE use the Export Makefile command and run
|
||||
!MESSAGE
|
||||
!MESSAGE NMAKE /f "gtkgensurf.mak".
|
||||
!MESSAGE
|
||||
!MESSAGE You can specify a configuration when running NMAKE
|
||||
!MESSAGE by defining the macro CFG on the command line. For example:
|
||||
!MESSAGE
|
||||
!MESSAGE NMAKE /f "gtkgensurf.mak" CFG="gtkgensurf - Win32 Debug"
|
||||
!MESSAGE
|
||||
!MESSAGE Possible choices for configuration are:
|
||||
!MESSAGE
|
||||
!MESSAGE "gtkgensurf - Win32 Release" (based on "Win32 (x86) Dynamic-Link Library")
|
||||
!MESSAGE "gtkgensurf - Win32 Debug" (based on "Win32 (x86) Dynamic-Link Library")
|
||||
!MESSAGE
|
||||
|
||||
# Begin Project
|
||||
# PROP AllowPerConfigDependencies 0
|
||||
# PROP Scc_ProjName "gtkgensurf"
|
||||
# PROP Scc_LocalPath "."
|
||||
CPP=cl.exe
|
||||
MTL=midl.exe
|
||||
RSC=rc.exe
|
||||
|
||||
!IF "$(CFG)" == "gtkgensurf - Win32 Release"
|
||||
|
||||
# PROP BASE Use_MFC 0
|
||||
# PROP BASE Use_Debug_Libraries 0
|
||||
# PROP BASE Output_Dir "Release"
|
||||
# PROP BASE Intermediate_Dir "Release"
|
||||
# PROP BASE Target_Dir ""
|
||||
# PROP Use_MFC 0
|
||||
# PROP Use_Debug_Libraries 0
|
||||
# PROP Output_Dir "Release"
|
||||
# PROP Intermediate_Dir "Release"
|
||||
# PROP Ignore_Export_Lib 0
|
||||
# PROP Target_Dir ""
|
||||
F90=df.exe
|
||||
# ADD BASE F90 /include:"Release/"
|
||||
# ADD F90 /include:"Release/"
|
||||
# ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "GTKGENSURF_EXPORTS" /YX /FD /c
|
||||
# ADD CPP /nologo /MD /W3 /O2 /I "..\..\libs" /I "..\..\include" /I "..\..\..\gtk2-win32\include\glib-2.0" /I "..\..\..\gtk2-win32\lib\glib-2.0\include" /I "..\..\..\gtk2-win32\lib\gtk-2.0\include" /I "..\..\..\gtk2-win32\include\gtk-2.0" /I "..\..\..\gtk2-win32\include\gtk-2.0\gdk" /I "..\..\..\gtk2-win32\include\pango-1.0" /I "..\..\..\gtk2-win32\include\atk-1.0" /I "..\..\..\stlport\stlport" /I "..\..\..\libxml2\include" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "GTKGENSURF_EXPORTS" /FR /YX /FD /c
|
||||
# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
|
||||
# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
|
||||
# ADD BASE RSC /l 0x409 /d "NDEBUG"
|
||||
# ADD RSC /l 0x409 /d "NDEBUG"
|
||||
BSC32=bscmake.exe
|
||||
# ADD BASE BSC32 /nologo
|
||||
# ADD BSC32 /nologo
|
||||
LINK32=link.exe
|
||||
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386
|
||||
# ADD LINK32 glib-2.0.lib gobject-2.0.lib gdk-win32-2.0.lib gtk-win32-2.0.lib pango-1.0.lib /nologo /dll /machine:I386 /def:".\gensurf.def" /out:"Release/gensurf.dll" /libpath:"..\..\..\src\glib" /libpath:"..\..\..\src\gtk+\gtk" /libpath:"..\..\..\src\gtk+\gdk" /libpath:"../../libs/synapse/debug" /libpath:"..\..\..\gtk2-win32\lib"
|
||||
# SUBTRACT LINK32 /pdb:none
|
||||
|
||||
!ELSEIF "$(CFG)" == "gtkgensurf - Win32 Debug"
|
||||
|
||||
# PROP BASE Use_MFC 0
|
||||
# PROP BASE Use_Debug_Libraries 1
|
||||
# PROP BASE Output_Dir "Debug"
|
||||
# PROP BASE Intermediate_Dir "Debug"
|
||||
# PROP BASE Target_Dir ""
|
||||
# PROP Use_MFC 0
|
||||
# PROP Use_Debug_Libraries 1
|
||||
# PROP Output_Dir "Debug"
|
||||
# PROP Intermediate_Dir "Debug"
|
||||
# PROP Ignore_Export_Lib 0
|
||||
# PROP Target_Dir ""
|
||||
F90=df.exe
|
||||
# ADD BASE F90 /include:"Debug/"
|
||||
# ADD F90 /include:"Debug/"
|
||||
# ADD BASE CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "GTKGENSURF_EXPORTS" /YX /FD /GZ /c
|
||||
# ADD CPP /nologo /MDd /W3 /Gm /ZI /Od /I "..\..\libs" /I "..\..\include" /I "..\..\..\gtk2-win32\include\glib-2.0" /I "..\..\..\gtk2-win32\lib\glib-2.0\include" /I "..\..\..\gtk2-win32\lib\gtk-2.0\include" /I "..\..\..\gtk2-win32\include\gtk-2.0" /I "..\..\..\gtk2-win32\include\gtk-2.0\gdk" /I "..\..\..\gtk2-win32\include\pango-1.0" /I "..\..\..\gtk2-win32\include\atk-1.0" /I "..\..\..\stlport\stlport" /I "..\..\..\libxml2\include" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "GTKGENSURF_EXPORTS" /FR /YX /FD /GZ /c
|
||||
# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32
|
||||
# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32
|
||||
# ADD BASE RSC /l 0x409 /d "_DEBUG"
|
||||
# ADD RSC /l 0x409 /d "_DEBUG"
|
||||
BSC32=bscmake.exe
|
||||
# ADD BASE BSC32 /nologo
|
||||
# ADD BSC32 /nologo
|
||||
LINK32=link.exe
|
||||
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /pdbtype:sept
|
||||
# ADD LINK32 glib-2.0.lib gobject-2.0.lib gdk-win32-2.0.lib gtk-win32-2.0.lib pango-1.0.lib /nologo /dll /debug /machine:I386 /def:".\gensurf.def" /out:"Debug/gensurf.dll" /pdbtype:sept /libpath:"..\..\..\src\glib" /libpath:"..\..\..\src\gtk+\gtk" /libpath:"..\..\..\src\gtk+\gdk" /libpath:"../../libs/synapse/debug" /libpath:"..\..\..\gtk2-win32\lib"
|
||||
# SUBTRACT LINK32 /pdb:none
|
||||
|
||||
!ENDIF
|
||||
|
||||
# Begin Target
|
||||
|
||||
# Name "gtkgensurf - Win32 Release"
|
||||
# Name "gtkgensurf - Win32 Debug"
|
||||
# Begin Group "Source Files"
|
||||
|
||||
# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\bitmap.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\dec.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\face.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\font.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\gendlgs.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\genmap.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\gensurf.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\gensurf.def
|
||||
# PROP Exclude_From_Build 1
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\heretic.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\plugin.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\triangle.c
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\view.cpp
|
||||
# End Source File
|
||||
# End Group
|
||||
# Begin Group "Header Files"
|
||||
|
||||
# PROP Default_Filter "h;hpp;hxx;hm;inl"
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\gendlgs.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\gensurf.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\triangle.h
|
||||
# End Source File
|
||||
# End Group
|
||||
# Begin Group "Resource Files"
|
||||
|
||||
# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
|
||||
# End Group
|
||||
# End Target
|
||||
# End Project
|
||||
194
contrib/gtkgensurf/gtkgensurf.vcproj
Normal file
194
contrib/gtkgensurf/gtkgensurf.vcproj
Normal file
@@ -0,0 +1,194 @@
|
||||
<?xml version="1.0" encoding = "Windows-1252"?>
|
||||
<VisualStudioProject
|
||||
ProjectType="Visual C++"
|
||||
Version="7.00"
|
||||
Name="gtkgensurf">
|
||||
<Platforms>
|
||||
<Platform
|
||||
Name="Win32"/>
|
||||
</Platforms>
|
||||
<Configurations>
|
||||
<Configuration
|
||||
Name="Release|Win32"
|
||||
OutputDirectory=".\Release"
|
||||
IntermediateDirectory=".\Release"
|
||||
ConfigurationType="2"
|
||||
UseOfMFC="0"
|
||||
ATLMinimizesCRunTimeLibraryUsage="FALSE"
|
||||
CharacterSet="2">
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
InlineFunctionExpansion="1"
|
||||
AdditionalIncludeDirectories="..\..\libs,..\..\include,..\..\..\gtk2-win32\include\glib-2.0,..\..\..\gtk2-win32\lib\glib-2.0\include,..\..\..\gtk2-win32\lib\gtk-2.0\include,..\..\..\gtk2-win32\include\gtk-2.0,..\..\..\gtk2-win32\include\gtk-2.0\gdk,..\..\..\gtk2-win32\include\pango-1.0,..\..\..\gtk2-win32\include\atk-1.0,..\..\..\stlport\stlport,..\..\..\libxml2\include"
|
||||
PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_USRDLL;GTKGENSURF_EXPORTS"
|
||||
StringPooling="TRUE"
|
||||
RuntimeLibrary="2"
|
||||
EnableFunctionLevelLinking="TRUE"
|
||||
UsePrecompiledHeader="2"
|
||||
PrecompiledHeaderFile=".\Release/gtkgensurf.pch"
|
||||
AssemblerListingLocation=".\Release/"
|
||||
ObjectFile=".\Release/"
|
||||
ProgramDataBaseFileName=".\Release/"
|
||||
BrowseInformation="1"
|
||||
WarningLevel="3"
|
||||
SuppressStartupBanner="TRUE"
|
||||
CompileAs="0"/>
|
||||
<Tool
|
||||
Name="VCCustomBuildTool"/>
|
||||
<Tool
|
||||
Name="VCLinkerTool"
|
||||
AdditionalOptions="/MACHINE:I386"
|
||||
AdditionalDependencies="glib-2.0.lib gobject-2.0.lib gdk-win32-2.0.lib gtk-win32-2.0.lib pango-1.0.lib"
|
||||
OutputFile="Release/gensurf.dll"
|
||||
LinkIncremental="1"
|
||||
SuppressStartupBanner="TRUE"
|
||||
AdditionalLibraryDirectories="..\..\..\src\glib,..\..\..\src\gtk+\gtk,..\..\..\src\gtk+\gdk,../../libs/synapse/debug,..\..\..\gtk2-win32\lib"
|
||||
ModuleDefinitionFile=".\gensurf.def"
|
||||
ProgramDatabaseFile=".\Release/gensurf.pdb"
|
||||
ImportLibrary=".\Release/gensurf.lib"/>
|
||||
<Tool
|
||||
Name="VCMIDLTool"
|
||||
PreprocessorDefinitions="NDEBUG"
|
||||
MkTypLibCompatible="TRUE"
|
||||
SuppressStartupBanner="TRUE"
|
||||
TargetEnvironment="1"
|
||||
TypeLibraryName=".\Release/gtkgensurf.tlb"/>
|
||||
<Tool
|
||||
Name="VCPostBuildEventTool"/>
|
||||
<Tool
|
||||
Name="VCPreBuildEventTool"/>
|
||||
<Tool
|
||||
Name="VCPreLinkEventTool"/>
|
||||
<Tool
|
||||
Name="VCResourceCompilerTool"
|
||||
PreprocessorDefinitions="NDEBUG"
|
||||
Culture="1033"/>
|
||||
<Tool
|
||||
Name="VCWebServiceProxyGeneratorTool"/>
|
||||
<Tool
|
||||
Name="VCWebDeploymentTool"/>
|
||||
</Configuration>
|
||||
<Configuration
|
||||
Name="Debug|Win32"
|
||||
OutputDirectory=".\Debug"
|
||||
IntermediateDirectory=".\Debug"
|
||||
ConfigurationType="2"
|
||||
UseOfMFC="0"
|
||||
ATLMinimizesCRunTimeLibraryUsage="FALSE"
|
||||
CharacterSet="2">
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
Optimization="0"
|
||||
AdditionalIncludeDirectories="..\..\libs,..\..\include,..\..\..\gtk2-win32\include\glib-2.0,..\..\..\gtk2-win32\lib\glib-2.0\include,..\..\..\gtk2-win32\lib\gtk-2.0\include,..\..\..\gtk2-win32\include\gtk-2.0,..\..\..\gtk2-win32\include\gtk-2.0\gdk,..\..\..\gtk2-win32\include\pango-1.0,..\..\..\gtk2-win32\include\atk-1.0,..\..\..\stlport\stlport,..\..\..\libxml2\include"
|
||||
PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_USRDLL;GTKGENSURF_EXPORTS"
|
||||
BasicRuntimeChecks="3"
|
||||
RuntimeLibrary="3"
|
||||
UsePrecompiledHeader="2"
|
||||
PrecompiledHeaderFile=".\Debug/gtkgensurf.pch"
|
||||
AssemblerListingLocation=".\Debug/"
|
||||
ObjectFile=".\Debug/"
|
||||
ProgramDataBaseFileName=".\Debug/"
|
||||
BrowseInformation="1"
|
||||
WarningLevel="3"
|
||||
SuppressStartupBanner="TRUE"
|
||||
DebugInformationFormat="4"
|
||||
CompileAs="0"/>
|
||||
<Tool
|
||||
Name="VCCustomBuildTool"/>
|
||||
<Tool
|
||||
Name="VCLinkerTool"
|
||||
AdditionalOptions="/MACHINE:I386"
|
||||
AdditionalDependencies="glib-2.0.lib gobject-2.0.lib gdk-win32-2.0.lib gtk-win32-2.0.lib pango-1.0.lib"
|
||||
OutputFile="Debug/gensurf.dll"
|
||||
LinkIncremental="2"
|
||||
SuppressStartupBanner="TRUE"
|
||||
AdditionalLibraryDirectories="..\..\..\src\glib,..\..\..\src\gtk+\gtk,..\..\..\src\gtk+\gdk,../../libs/synapse/debug,..\..\..\gtk2-win32\lib"
|
||||
ModuleDefinitionFile=".\gensurf.def"
|
||||
GenerateDebugInformation="TRUE"
|
||||
ProgramDatabaseFile=".\Debug/gensurf.pdb"
|
||||
ImportLibrary=".\Debug/gensurf.lib"/>
|
||||
<Tool
|
||||
Name="VCMIDLTool"
|
||||
PreprocessorDefinitions="_DEBUG"
|
||||
MkTypLibCompatible="TRUE"
|
||||
SuppressStartupBanner="TRUE"
|
||||
TargetEnvironment="1"
|
||||
TypeLibraryName=".\Debug/gtkgensurf.tlb"/>
|
||||
<Tool
|
||||
Name="VCPostBuildEventTool"/>
|
||||
<Tool
|
||||
Name="VCPreBuildEventTool"/>
|
||||
<Tool
|
||||
Name="VCPreLinkEventTool"/>
|
||||
<Tool
|
||||
Name="VCResourceCompilerTool"
|
||||
PreprocessorDefinitions="_DEBUG"
|
||||
Culture="1033"/>
|
||||
<Tool
|
||||
Name="VCWebServiceProxyGeneratorTool"/>
|
||||
<Tool
|
||||
Name="VCWebDeploymentTool"/>
|
||||
</Configuration>
|
||||
</Configurations>
|
||||
<Files>
|
||||
<Filter
|
||||
Name="Source Files"
|
||||
Filter="cpp;c;cxx;rc;def;r;odl;idl;hpj;bat">
|
||||
<File
|
||||
RelativePath=".\bitmap.cpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\dec.cpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\face.cpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\font.cpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\gendlgs.cpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\genmap.cpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\gensurf.cpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\gensurf.def">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\heretic.cpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\plugin.cpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\triangle.c">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\view.cpp">
|
||||
</File>
|
||||
</Filter>
|
||||
<Filter
|
||||
Name="Header Files"
|
||||
Filter="h;hpp;hxx;hm;inl">
|
||||
<File
|
||||
RelativePath=".\gendlgs.h">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\gensurf.h">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\triangle.h">
|
||||
</File>
|
||||
</Filter>
|
||||
<Filter
|
||||
Name="Resource Files"
|
||||
Filter="ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe">
|
||||
</Filter>
|
||||
</Files>
|
||||
<Globals>
|
||||
</Globals>
|
||||
</VisualStudioProject>
|
||||
150
contrib/gtkgensurf/heretic.cpp
Normal file
150
contrib/gtkgensurf/heretic.cpp
Normal file
@@ -0,0 +1,150 @@
|
||||
/*
|
||||
GenSurf plugin for GtkRadiant
|
||||
Copyright (C) 2001 David Hyde, Loki software and qeradiant.com
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Lesser General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2.1 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
|
||||
Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser 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 <stdlib.h>
|
||||
#include <math.h>
|
||||
#include <stdio.h>
|
||||
#include "gensurf.h"
|
||||
|
||||
// Heretic 2 - specific routines
|
||||
|
||||
typedef struct palette_s
|
||||
{
|
||||
guint8 r,g,b;
|
||||
} palette_t;
|
||||
|
||||
#define MIP_VERSION 2
|
||||
#define PAL_SIZE 256
|
||||
#define MIPLEVELS 16
|
||||
|
||||
typedef struct miptex_s
|
||||
{
|
||||
int version;
|
||||
char name[32];
|
||||
unsigned width[MIPLEVELS], height[MIPLEVELS];
|
||||
unsigned offsets[MIPLEVELS]; // four mip maps stored
|
||||
char animname[32]; // next frame in animation chain
|
||||
palette_t palette[PAL_SIZE];
|
||||
int flags;
|
||||
int contents;
|
||||
int value;
|
||||
} miptex_t;
|
||||
|
||||
//=============================================================
|
||||
int GetDefSurfaceProps(char *Tex)
|
||||
{
|
||||
return 0; // leo: only used for Heretic 2, fix later
|
||||
/*
|
||||
char path[NAME_MAX];
|
||||
char *p;
|
||||
int flags;
|
||||
miptex_t *mt;
|
||||
FILE *f;
|
||||
int length;
|
||||
int pos;
|
||||
|
||||
if(Game != HERETIC2) return 0;
|
||||
if(!strlen(Tex)) return 0;
|
||||
|
||||
mt = NULL;
|
||||
flags = 0;
|
||||
if(UsePak[Game])
|
||||
{
|
||||
FILE *fpak;
|
||||
pak_header_t pakheader;
|
||||
pak_item_t pakitem;
|
||||
int i;
|
||||
int num;
|
||||
int numitems;
|
||||
|
||||
if (NULL != (fpak = fopen(pakfile[Game], "rb")))
|
||||
{
|
||||
sprintf(path,"textures/%s.m8",Tex);
|
||||
g_strdown(path);
|
||||
num=fread(&pakheader,1,sizeof(pak_header_t),fpak);
|
||||
if((size_t)num < sizeof(pak_header_t))
|
||||
{
|
||||
fclose(fpak);
|
||||
return 0;
|
||||
}
|
||||
if(strncmp(pakheader.id,"PACK",4))
|
||||
{
|
||||
fclose(fpak);
|
||||
return 0;
|
||||
}
|
||||
numitems = pakheader.dsize/sizeof(pak_item_t);
|
||||
fseek(fpak,pakheader.dstart,SEEK_SET);
|
||||
for(i=0; i<numitems; i++)
|
||||
{
|
||||
fread(&pakitem,1,sizeof(pak_item_t),fpak);
|
||||
if(strstr(pakitem.name,path))
|
||||
{
|
||||
fseek(fpak,pakitem.start,SEEK_SET);
|
||||
if((mt = (miptex_t*)malloc(sizeof(miptex_t)))==NULL)
|
||||
{
|
||||
fclose(fpak);
|
||||
return 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
fread(mt, 1, sizeof(miptex_t), fpak);
|
||||
flags = mt->flags;
|
||||
free(mt);
|
||||
}
|
||||
}
|
||||
}
|
||||
fclose(fpak);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// Assume .map will be output to gamedir/maps, then back up
|
||||
// to the gamedir and append /textures. Ugly but it should work
|
||||
strcpy(path,gszMapFile);
|
||||
g_strdown(path);
|
||||
p = strstr(path,"maps");
|
||||
if(!p) return 0;
|
||||
p[0] = '\0';
|
||||
strcat(path,"textures/");
|
||||
strcat(path,Tex);
|
||||
strcat(path,".m8");
|
||||
f = fopen (path, "rb");
|
||||
if (!f)
|
||||
flags = 0;
|
||||
else
|
||||
{
|
||||
pos = ftell (f);
|
||||
fseek (f, 0, SEEK_END);
|
||||
length = ftell (f);
|
||||
fseek (f, pos, SEEK_SET);
|
||||
if((mt = (miptex_t*)malloc(length+1))==NULL)
|
||||
flags = 0;
|
||||
else
|
||||
{
|
||||
((char *)mt)[length] = 0;
|
||||
fread(mt, 1, length, f);
|
||||
fclose (f);
|
||||
flags = mt->flags;
|
||||
free(mt);
|
||||
}
|
||||
}
|
||||
}
|
||||
return flags;
|
||||
*/
|
||||
}
|
||||
224
contrib/gtkgensurf/plugin.cpp
Normal file
224
contrib/gtkgensurf/plugin.cpp
Normal file
@@ -0,0 +1,224 @@
|
||||
/*
|
||||
GenSurf plugin for GtkRadiant
|
||||
Copyright (C) 2001 David Hyde, Loki software and qeradiant.com
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Lesser General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2.1 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
|
||||
Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser 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 "gensurf.h"
|
||||
|
||||
// Global plugin FuncTable
|
||||
_QERFuncTable_1 g_FuncTable;
|
||||
_QERQglTable g_GLTable;
|
||||
_QERUIGtkTable g_UIGtkTable;
|
||||
_QEREntityTable __ENTITYTABLENAME;
|
||||
_QERBrushTable __BRUSHTABLENAME;
|
||||
_QERPatchTable __PATCHTABLENAME;
|
||||
bool SingleBrushSelected;
|
||||
bool g_bInitDone;
|
||||
|
||||
#include "iplugin.h"
|
||||
|
||||
const char* QERPlug_Init(void* hApp, void* pMainWidget)
|
||||
{
|
||||
g_pRadiantWnd = (GtkWidget*)pMainWidget;
|
||||
|
||||
return "GenSurf for Q3Radiant";
|
||||
}
|
||||
|
||||
const char* QERPlug_GetName ()
|
||||
{
|
||||
return "GtkGenSurf";
|
||||
}
|
||||
|
||||
const char* QERPlug_GetCommandList ()
|
||||
{
|
||||
return "Wall facing 270...;Wall facing 180...;Wall facing 90...;Wall facing 0...;"
|
||||
"Ceiling...;Ground surface...;-;About...";
|
||||
}
|
||||
|
||||
// vMin/vMax provide the bounds of the selection, they are zero if there is no selection
|
||||
// if there is a selection, bSingleBrush will be true if a single brush is selected
|
||||
// if so, typical plugin behaviour (such as primitive creation) would use the bounds as
|
||||
// a rule to create the primitive, then delete the selection
|
||||
void QERPlug_Dispatch (const char *p, vec3_t vMin, vec3_t vMax, bool bSingleBrush)
|
||||
{
|
||||
bool Generate = false;
|
||||
|
||||
if (!g_bInitDone)
|
||||
{
|
||||
if (GenSurfInit ())
|
||||
g_bInitDone = true;
|
||||
}
|
||||
|
||||
if (!strcmp (p, "Ground surface..."))
|
||||
{
|
||||
SingleBrushSelected = bSingleBrush;
|
||||
Plane = PLANE_XY0;
|
||||
if (SingleBrushSelected)
|
||||
{
|
||||
Hll = vMin[0];
|
||||
Vll = vMin[1];
|
||||
Hur = vMax[0];
|
||||
Vur = vMax[1];
|
||||
Z00 = Z01 = Z10 = Z11 = vMax[2];
|
||||
}
|
||||
Generate = true;
|
||||
}
|
||||
else if (!strcmp (p, "Ceiling..."))
|
||||
{
|
||||
SingleBrushSelected = bSingleBrush;
|
||||
Plane = PLANE_XY1;
|
||||
if(SingleBrushSelected)
|
||||
{
|
||||
Hll = vMin[0];
|
||||
Vll = vMin[1];
|
||||
Hur = vMax[0];
|
||||
Vur = vMax[1];
|
||||
Z00 = Z01 = Z10 = Z11 = vMin[2];
|
||||
}
|
||||
Generate = true;
|
||||
}
|
||||
else if (!strcmp (p, "Wall facing 0..."))
|
||||
{
|
||||
SingleBrushSelected = bSingleBrush;
|
||||
Plane = PLANE_YZ0;
|
||||
if (SingleBrushSelected)
|
||||
{
|
||||
Hll = vMin[1];
|
||||
Vll = vMin[2];
|
||||
Hur = vMax[1];
|
||||
Vur = vMax[2];
|
||||
Z00 = Z01 = Z10 = Z11 = vMax[0];
|
||||
}
|
||||
Generate = true;
|
||||
}
|
||||
else if (!strcmp (p, "Wall facing 90..."))
|
||||
{
|
||||
SingleBrushSelected = bSingleBrush;
|
||||
Plane = PLANE_XZ0;
|
||||
if (SingleBrushSelected)
|
||||
{
|
||||
Hll = vMin[0];
|
||||
Vll = vMin[2];
|
||||
Hur = vMax[0];
|
||||
Vur = vMax[2];
|
||||
Z00 = Z01 = Z10 = Z11 = vMax[1];
|
||||
}
|
||||
Generate = true;
|
||||
}
|
||||
else if (!strcmp (p, "Wall facing 180..."))
|
||||
{
|
||||
SingleBrushSelected = bSingleBrush;
|
||||
Plane = PLANE_YZ1;
|
||||
if (SingleBrushSelected)
|
||||
{
|
||||
Hll = vMin[1];
|
||||
Vll = vMin[2];
|
||||
Hur = vMax[1];
|
||||
Vur = vMax[2];
|
||||
Z00 = Z01 = Z10 = Z11 = vMin[0];
|
||||
}
|
||||
Generate = true;
|
||||
}
|
||||
else if (!strcmp (p, "Wall facing 270..."))
|
||||
{
|
||||
SingleBrushSelected = bSingleBrush;
|
||||
Plane = PLANE_XZ1;
|
||||
if (SingleBrushSelected)
|
||||
{
|
||||
Hll = vMin[0];
|
||||
Vll = vMin[2];
|
||||
Hur = vMax[0];
|
||||
Vur = vMax[2];
|
||||
Z00 = Z01 = Z10 = Z11 = vMin[1];
|
||||
}
|
||||
Generate = true;
|
||||
}
|
||||
else if (!strcmp(p,"About..."))
|
||||
About (g_pRadiantWnd);
|
||||
|
||||
if (Generate)
|
||||
{
|
||||
if (SingleBrushSelected)
|
||||
UseFaceBounds ();
|
||||
|
||||
gtk_widget_show (g_pWnd);
|
||||
}
|
||||
}
|
||||
|
||||
// =============================================================================
|
||||
// SYNAPSE
|
||||
|
||||
#include "synapse.h"
|
||||
|
||||
class GenSurfSynapseClient : public CSynapseClient
|
||||
{
|
||||
public:
|
||||
// CSynapseClient API
|
||||
bool RequestAPI(APIDescriptor_t *pAPI);
|
||||
const char* GetInfo();
|
||||
|
||||
GenSurfSynapseClient() { }
|
||||
virtual ~GenSurfSynapseClient() { }
|
||||
};
|
||||
|
||||
CSynapseServer* g_pSynapseServer = NULL;
|
||||
GenSurfSynapseClient g_SynapseClient;
|
||||
|
||||
extern "C" CSynapseClient* SYNAPSE_DLL_EXPORT Synapse_EnumerateInterfaces (const char *version, CSynapseServer *pServer)
|
||||
{
|
||||
if (strcmp(version, SYNAPSE_VERSION))
|
||||
{
|
||||
Syn_Printf("ERROR: synapse API version mismatch: should be '" SYNAPSE_VERSION "', got '%s'\n", version);
|
||||
return NULL;
|
||||
}
|
||||
g_pSynapseServer = pServer;
|
||||
g_pSynapseServer->IncRef();
|
||||
Set_Syn_Printf(g_pSynapseServer->Get_Syn_Printf());
|
||||
|
||||
g_SynapseClient.AddAPI(PLUGIN_MAJOR, "gtkgensurf", sizeof(_QERPluginTable));
|
||||
|
||||
g_SynapseClient.AddAPI(RADIANT_MAJOR, NULL, sizeof(_QERFuncTable_1), SYN_REQUIRE, &g_FuncTable);
|
||||
g_SynapseClient.AddAPI(UIGTK_MAJOR, NULL, sizeof(_QERUIGtkTable), SYN_REQUIRE, &g_UIGtkTable);
|
||||
g_SynapseClient.AddAPI(QGL_MAJOR, NULL, sizeof(_QERQglTable), SYN_REQUIRE, &g_GLTable);
|
||||
g_SynapseClient.AddAPI(ENTITY_MAJOR, NULL, sizeof(_QEREntityTable), SYN_REQUIRE, &g_EntityTable);
|
||||
|
||||
return &g_SynapseClient;
|
||||
}
|
||||
|
||||
bool GenSurfSynapseClient::RequestAPI(APIDescriptor_t *pAPI)
|
||||
{
|
||||
if (!strcmp(pAPI->major_name, PLUGIN_MAJOR))
|
||||
{
|
||||
_QERPluginTable* pTable= static_cast<_QERPluginTable*>(pAPI->mpTable);
|
||||
|
||||
pTable->m_pfnQERPlug_Init = QERPlug_Init;
|
||||
pTable->m_pfnQERPlug_GetName = QERPlug_GetName;
|
||||
pTable->m_pfnQERPlug_GetCommandList = QERPlug_GetCommandList;
|
||||
pTable->m_pfnQERPlug_Dispatch = QERPlug_Dispatch;
|
||||
return true;
|
||||
}
|
||||
|
||||
Syn_Printf("ERROR: RequestAPI( '%s' ) not found in '%s'\n", pAPI->major_name, GetInfo());
|
||||
return false;
|
||||
}
|
||||
|
||||
#include "version.h"
|
||||
|
||||
const char* GenSurfSynapseClient::GetInfo()
|
||||
{
|
||||
return "GtkGenSurf - built " __DATE__ " " RADIANT_VERSION;
|
||||
}
|
||||
13236
contrib/gtkgensurf/triangle.c
Normal file
13236
contrib/gtkgensurf/triangle.c
Normal file
File diff suppressed because it is too large
Load Diff
288
contrib/gtkgensurf/triangle.h
Normal file
288
contrib/gtkgensurf/triangle.h
Normal file
@@ -0,0 +1,288 @@
|
||||
/*****************************************************************************/
|
||||
/* */
|
||||
/* (triangle.h) */
|
||||
/* */
|
||||
/* Include file for programs that call Triangle. */
|
||||
/* */
|
||||
/* Accompanies Triangle Version 1.3 */
|
||||
/* July 19, 1996 */
|
||||
/* */
|
||||
/* Copyright 1996 */
|
||||
/* Jonathan Richard Shewchuk */
|
||||
/* School of Computer Science */
|
||||
/* Carnegie Mellon University */
|
||||
/* 5000 Forbes Avenue */
|
||||
/* Pittsburgh, Pennsylvania 15213-3891 */
|
||||
/* jrs@cs.cmu.edu */
|
||||
/* */
|
||||
/*****************************************************************************/
|
||||
|
||||
/*****************************************************************************/
|
||||
/* */
|
||||
/* How to call Triangle from another program */
|
||||
/* */
|
||||
/* */
|
||||
/* If you haven't read Triangle's instructions (run "triangle -h" to read */
|
||||
/* them), you won't understand what follows. */
|
||||
/* */
|
||||
/* Triangle must be compiled into an object file (triangle.o) with the */
|
||||
/* TRILIBRARY symbol defined (preferably by using the -DTRILIBRARY compiler */
|
||||
/* switch). The makefile included with Triangle will do this for you if */
|
||||
/* you run "make trilibrary". The resulting object file can be called via */
|
||||
/* the procedure triangulate(). */
|
||||
/* */
|
||||
/* If the size of the object file is important to you, you may wish to */
|
||||
/* generate a reduced version of triangle.o. The REDUCED symbol gets rid */
|
||||
/* of all features that are primarily of research interest. Specifically, */
|
||||
/* the -DREDUCED switch eliminates Triangle's -i, -F, -s, and -C switches. */
|
||||
/* The CDT_ONLY symbol gets rid of all meshing algorithms above and beyond */
|
||||
/* constrained Delaunay triangulation. Specifically, the -DCDT_ONLY switch */
|
||||
/* eliminates Triangle's -r, -q, -a, -S, and -s switches. */
|
||||
/* */
|
||||
/* IMPORTANT: These definitions (TRILIBRARY, REDUCED, CDT_ONLY) must be */
|
||||
/* made in the makefile or in triangle.c itself. Putting these definitions */
|
||||
/* in this file will not create the desired effect. */
|
||||
/* */
|
||||
/* */
|
||||
/* The calling convention for triangulate() follows. */
|
||||
/* */
|
||||
/* void triangulate(triswitches, in, out, vorout) */
|
||||
/* char *triswitches; */
|
||||
/* struct triangulateio *in; */
|
||||
/* struct triangulateio *out; */
|
||||
/* struct triangulateio *vorout; */
|
||||
/* */
|
||||
/* `triswitches' is a string containing the command line switches you wish */
|
||||
/* to invoke. No initial dash is required. Some suggestions: */
|
||||
/* */
|
||||
/* - You'll probably find it convenient to use the `z' switch so that */
|
||||
/* points (and other items) are numbered from zero. This simplifies */
|
||||
/* indexing, because the first item of any type always starts at index */
|
||||
/* [0] of the corresponding array, whether that item's number is zero or */
|
||||
/* one. */
|
||||
/* - You'll probably want to use the `Q' (quiet) switch in your final code, */
|
||||
/* but you can take advantage of Triangle's printed output (including the */
|
||||
/* `V' switch) while debugging. */
|
||||
/* - If you are not using the `q' or `a' switches, then the output points */
|
||||
/* will be identical to the input points, except possibly for the */
|
||||
/* boundary markers. If you don't need the boundary markers, you should */
|
||||
/* use the `N' (no nodes output) switch to save memory. (If you do need */
|
||||
/* boundary markers, but need to save memory, a good nasty trick is to */
|
||||
/* set out->pointlist equal to in->pointlist before calling triangulate(),*/
|
||||
/* so that Triangle overwrites the input points with identical copies.) */
|
||||
/* - The `I' (no iteration numbers) and `g' (.off file output) switches */
|
||||
/* have no effect when Triangle is compiled with TRILIBRARY defined. */
|
||||
/* */
|
||||
/* `in', `out', and `vorout' are descriptions of the input, the output, */
|
||||
/* and the Voronoi output. If the `v' (Voronoi output) switch is not used, */
|
||||
/* `vorout' may be NULL. `in' and `out' may never be NULL. */
|
||||
/* */
|
||||
/* Certain fields of the input and output structures must be initialized, */
|
||||
/* as described below. */
|
||||
/* */
|
||||
/*****************************************************************************/
|
||||
|
||||
/*****************************************************************************/
|
||||
/* */
|
||||
/* The `triangulateio' structure. */
|
||||
/* */
|
||||
/* Used to pass data into and out of the triangulate() procedure. */
|
||||
/* */
|
||||
/* */
|
||||
/* Arrays are used to store points, triangles, markers, and so forth. In */
|
||||
/* all cases, the first item in any array is stored starting at index [0]. */
|
||||
/* However, that item is item number `1' unless the `z' switch is used, in */
|
||||
/* which case it is item number `0'. Hence, you may find it easier to */
|
||||
/* index points (and triangles in the neighbor list) if you use the `z' */
|
||||
/* switch. Unless, of course, you're calling Triangle from a Fortran */
|
||||
/* program. */
|
||||
/* */
|
||||
/* Description of fields (except the `numberof' fields, which are obvious): */
|
||||
/* */
|
||||
/* `pointlist': An array of point coordinates. The first point's x */
|
||||
/* coordinate is at index [0] and its y coordinate at index [1], followed */
|
||||
/* by the coordinates of the remaining points. Each point occupies two */
|
||||
/* REALs. */
|
||||
/* `pointattributelist': An array of point attributes. Each point's */
|
||||
/* attributes occupy `numberofpointattributes' REALs. */
|
||||
/* `pointmarkerlist': An array of point markers; one int per point. */
|
||||
/* */
|
||||
/* `trianglelist': An array of triangle corners. The first triangle's */
|
||||
/* first corner is at index [0], followed by its other two corners in */
|
||||
/* counterclockwise order, followed by any other nodes if the triangle */
|
||||
/* represents a nonlinear element. Each triangle occupies */
|
||||
/* `numberofcorners' ints. */
|
||||
/* `triangleattributelist': An array of triangle attributes. Each */
|
||||
/* triangle's attributes occupy `numberoftriangleattributes' REALs. */
|
||||
/* `trianglearealist': An array of triangle area constraints; one REAL per */
|
||||
/* triangle. Input only. */
|
||||
/* `neighborlist': An array of triangle neighbors; three ints per */
|
||||
/* triangle. Output only. */
|
||||
/* */
|
||||
/* `segmentlist': An array of segment endpoints. The first segment's */
|
||||
/* endpoints are at indices [0] and [1], followed by the remaining */
|
||||
/* segments. Two ints per segment. */
|
||||
/* `segmentmarkerlist': An array of segment markers; one int per segment. */
|
||||
/* */
|
||||
/* `holelist': An array of holes. The first hole's x and y coordinates */
|
||||
/* are at indices [0] and [1], followed by the remaining holes. Two */
|
||||
/* REALs per hole. Input only, although the pointer is copied to the */
|
||||
/* output structure for your convenience. */
|
||||
/* */
|
||||
/* `regionlist': An array of regional attributes and area constraints. */
|
||||
/* The first constraint's x and y coordinates are at indices [0] and [1], */
|
||||
/* followed by the regional attribute and index [2], followed by the */
|
||||
/* maximum area at index [3], followed by the remaining area constraints. */
|
||||
/* Four REALs per area constraint. Note that each regional attribute is */
|
||||
/* used only if you select the `A' switch, and each area constraint is */
|
||||
/* used only if you select the `a' switch (with no number following), but */
|
||||
/* omitting one of these switches does not change the memory layout. */
|
||||
/* Input only, although the pointer is copied to the output structure for */
|
||||
/* your convenience. */
|
||||
/* */
|
||||
/* `edgelist': An array of edge endpoints. The first edge's endpoints are */
|
||||
/* at indices [0] and [1], followed by the remaining edges. Two ints per */
|
||||
/* edge. Output only. */
|
||||
/* `edgemarkerlist': An array of edge markers; one int per edge. Output */
|
||||
/* only. */
|
||||
/* `normlist': An array of normal vectors, used for infinite rays in */
|
||||
/* Voronoi diagrams. The first normal vector's x and y magnitudes are */
|
||||
/* at indices [0] and [1], followed by the remaining vectors. For each */
|
||||
/* finite edge in a Voronoi diagram, the normal vector written is the */
|
||||
/* zero vector. Two REALs per edge. Output only. */
|
||||
/* */
|
||||
/* */
|
||||
/* Any input fields that Triangle will examine must be initialized. */
|
||||
/* Furthermore, for each output array that Triangle will write to, you */
|
||||
/* must either provide space by setting the appropriate pointer to point */
|
||||
/* to the space you want the data written to, or you must initialize the */
|
||||
/* pointer to NULL, which tells Triangle to allocate space for the results. */
|
||||
/* The latter option is preferable, because Triangle always knows exactly */
|
||||
/* how much space to allocate. The former option is provided mainly for */
|
||||
/* people who need to call Triangle from Fortran code, though it also makes */
|
||||
/* possible some nasty space-saving tricks, like writing the output to the */
|
||||
/* same arrays as the input. */
|
||||
/* */
|
||||
/* Triangle will not free() any input or output arrays, including those it */
|
||||
/* allocates itself; that's up to you. */
|
||||
/* */
|
||||
/* Here's a guide to help you decide which fields you must initialize */
|
||||
/* before you call triangulate(). */
|
||||
/* */
|
||||
/* `in': */
|
||||
/* */
|
||||
/* - `pointlist' must always point to a list of points; `numberofpoints' */
|
||||
/* and `numberofpointattributes' must be properly set. */
|
||||
/* `pointmarkerlist' must either be set to NULL (in which case all */
|
||||
/* markers default to zero), or must point to a list of markers. If */
|
||||
/* `numberofpointattributes' is not zero, `pointattributelist' must */
|
||||
/* point to a list of point attributes. */
|
||||
/* - If the `r' switch is used, `trianglelist' must point to a list of */
|
||||
/* triangles, and `numberoftriangles', `numberofcorners', and */
|
||||
/* `numberoftriangleattributes' must be properly set. If */
|
||||
/* `numberoftriangleattributes' is not zero, `triangleattributelist' */
|
||||
/* must point to a list of triangle attributes. If the `a' switch is */
|
||||
/* used (with no number following), `trianglearealist' must point to a */
|
||||
/* list of triangle area constraints. `neighborlist' may be ignored. */
|
||||
/* - If the `p' switch is used, `segmentlist' must point to a list of */
|
||||
/* segments, `numberofsegments' must be properly set, and */
|
||||
/* `segmentmarkerlist' must either be set to NULL (in which case all */
|
||||
/* markers default to zero), or must point to a list of markers. */
|
||||
/* - If the `p' switch is used without the `r' switch, then */
|
||||
/* `numberofholes' and `numberofregions' must be properly set. If */
|
||||
/* `numberofholes' is not zero, `holelist' must point to a list of */
|
||||
/* holes. If `numberofregions' is not zero, `regionlist' must point to */
|
||||
/* a list of region constraints. */
|
||||
/* - If the `p' switch is used, `holelist', `numberofholes', */
|
||||
/* `regionlist', and `numberofregions' is copied to `out'. (You can */
|
||||
/* nonetheless get away with not initializing them if the `r' switch is */
|
||||
/* used.) */
|
||||
/* - `edgelist', `edgemarkerlist', `normlist', and `numberofedges' may be */
|
||||
/* ignored. */
|
||||
/* */
|
||||
/* `out': */
|
||||
/* */
|
||||
/* - `pointlist' must be initialized (NULL or pointing to memory) unless */
|
||||
/* the `N' switch is used. `pointmarkerlist' must be initialized */
|
||||
/* unless the `N' or `B' switch is used. If `N' is not used and */
|
||||
/* `in->numberofpointattributes' is not zero, `pointattributelist' must */
|
||||
/* be initialized. */
|
||||
/* - `trianglelist' must be initialized unless the `E' switch is used. */
|
||||
/* `neighborlist' must be initialized if the `n' switch is used. If */
|
||||
/* the `E' switch is not used and (`in->numberofelementattributes' is */
|
||||
/* not zero or the `A' switch is used), `elementattributelist' must be */
|
||||
/* initialized. `trianglearealist' may be ignored. */
|
||||
/* - `segmentlist' must be initialized if the `p' or `c' switch is used, */
|
||||
/* and the `P' switch is not used. `segmentmarkerlist' must also be */
|
||||
/* initialized under these circumstances unless the `B' switch is used. */
|
||||
/* - `edgelist' must be initialized if the `e' switch is used. */
|
||||
/* `edgemarkerlist' must be initialized if the `e' switch is used and */
|
||||
/* the `B' switch is not. */
|
||||
/* - `holelist', `regionlist', `normlist', and all scalars may be ignored.*/
|
||||
/* */
|
||||
/* `vorout' (only needed if `v' switch is used): */
|
||||
/* */
|
||||
/* - `pointlist' must be initialized. If `in->numberofpointattributes' */
|
||||
/* is not zero, `pointattributelist' must be initialized. */
|
||||
/* `pointmarkerlist' may be ignored. */
|
||||
/* - `edgelist' and `normlist' must both be initialized. */
|
||||
/* `edgemarkerlist' may be ignored. */
|
||||
/* - Everything else may be ignored. */
|
||||
/* */
|
||||
/* After a call to triangulate(), the valid fields of `out' and `vorout' */
|
||||
/* will depend, in an obvious way, on the choice of switches used. Note */
|
||||
/* that when the `p' switch is used, the pointers `holelist' and */
|
||||
/* `regionlist' are copied from `in' to `out', but no new space is */
|
||||
/* allocated; be careful that you don't free() the same array twice. On */
|
||||
/* the other hand, Triangle will never copy the `pointlist' pointer (or any */
|
||||
/* others); new space is allocated for `out->pointlist', or if the `N' */
|
||||
/* switch is used, `out->pointlist' remains uninitialized. */
|
||||
/* */
|
||||
/* All of the meaningful `numberof' fields will be properly set; for */
|
||||
/* instance, `numberofedges' will represent the number of edges in the */
|
||||
/* triangulation whether or not the edges were written. If segments are */
|
||||
/* not used, `numberofsegments' will indicate the number of boundary edges. */
|
||||
/* */
|
||||
/*****************************************************************************/
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
struct triangulateio {
|
||||
REAL *pointlist; /* In / out */
|
||||
REAL *pointattributelist; /* In / out */
|
||||
int *pointmarkerlist; /* In / out */
|
||||
int numberofpoints; /* In / out */
|
||||
int numberofpointattributes; /* In / out */
|
||||
|
||||
int *trianglelist; /* In / out */
|
||||
REAL *triangleattributelist; /* In / out */
|
||||
REAL *trianglearealist; /* In only */
|
||||
int *neighborlist; /* Out only */
|
||||
int numberoftriangles; /* In / out */
|
||||
int numberofcorners; /* In / out */
|
||||
int numberoftriangleattributes; /* In / out */
|
||||
|
||||
int *segmentlist; /* In / out */
|
||||
int *segmentmarkerlist; /* In / out */
|
||||
int numberofsegments; /* In / out */
|
||||
|
||||
REAL *holelist; /* In / pointer to array copied out */
|
||||
int numberofholes; /* In / copied out */
|
||||
|
||||
REAL *regionlist; /* In / pointer to array copied out */
|
||||
int numberofregions; /* In / copied out */
|
||||
|
||||
int *edgelist; /* Out only */
|
||||
int *edgemarkerlist; /* Not used with Voronoi diagram; out only */
|
||||
REAL *normlist; /* Used only with Voronoi diagram; out only */
|
||||
int numberofedges; /* Out only */
|
||||
};
|
||||
|
||||
void triangulate(char *, struct triangulateio *, struct triangulateio *,
|
||||
struct triangulateio *);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
1287
contrib/gtkgensurf/view.cpp
Normal file
1287
contrib/gtkgensurf/view.cpp
Normal file
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user