Skip to content

Commit

Permalink
Merge pull request uniconproject#463 from Jafaral/win3d-rebase
Browse files Browse the repository at this point in the history
Partially revert RR uniconproject#125 OpenGL2D"
  • Loading branch information
Jafaral authored May 23, 2024
2 parents f701243 + 54e16eb commit 086054e
Show file tree
Hide file tree
Showing 22 changed files with 765 additions and 2,918 deletions.
2 changes: 1 addition & 1 deletion src/common/uconsole.c
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@ FILE *OpenConsole()
*/
if ((hp = alclist(0, MinListSlots)) == NULL) return NULL;

ConsoleBinding = wopen(ConsoleTitle, hp, attrs, 3, &eindx,0,0);
ConsoleBinding = wopen(ConsoleTitle, hp, attrs, 3, &eindx,0);
if ( !(ConsoleFlags & StdInRedirect ))
k_input.fd.fp = ConsoleBinding;
if ( !(ConsoleFlags & StdOutRedirect ))
Expand Down
1 change: 0 additions & 1 deletion src/h/config.h
Original file line number Diff line number Diff line change
Expand Up @@ -943,7 +943,6 @@ Deliberate Syntax Error

#if HAVE_LIBGL
#define Graphics3D 1
#define GraphicsGL 1
#else /* HAVE_LIBGL */
#if HAVE_FTGL
#undef HAVE_FTGL
Expand Down
4 changes: 0 additions & 4 deletions src/h/feature.h
Original file line number Diff line number Diff line change
Expand Up @@ -140,10 +140,6 @@
Feature(1, "_3D_GRAPHICS", "3D graphics")
#endif /* Graphics */

#ifdef GraphicsGL
Feature(1, "_GL_GRAPHICS", "OpenGL graphics")
#endif /* GraphicsGL */

#ifdef XWindows
Feature(1, "_X_WINDOW_SYSTEM", "X Windows")
#endif /* XWindows */
Expand Down
140 changes: 39 additions & 101 deletions src/h/graphics.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
#include "../h/mswin.h"
#endif /* MSWindows */

#if Graphics3D || GraphicsGL
#if Graphics3D
#if HAVE_LIBGL
#include "../h/opengl.h"
#else /* HAVE_LIBGL */
Expand Down Expand Up @@ -80,7 +80,7 @@
#define GL3D_ENDMARK REDRAW_ENDMARK
#define GL3D_MESHMODE REDRAW_MESHMODE

#endif /* Graphics3D || GraphicsGL */
#endif /* Graphics3D */

#ifndef MAXXOBJS
#define MAXXOBJS 256
Expand Down Expand Up @@ -250,20 +250,13 @@ typedef struct _wfont {
#endif /* HAVE_XFT */
#endif /* XWindows */
#ifdef MSWindows
char *name; /* name for WAttrib and fontsearch */
char * name; /* name for WAttrib and fontsearch */
HFONT font;
LONG ascent;
LONG descent;
LONG charwidth;
LONG height;
#endif /* MSWindows */
#ifdef GraphicsGL
#if HAVE_LIBFREETYPE
FT_Library library;
FT_Face face;
#endif /* HAVE_LIBFREETYPE */
struct fontsymbol chars[256];
#endif /* GraphicsGL */
} wfont, *wfp;

/*
Expand Down Expand Up @@ -296,9 +289,6 @@ struct imgdata { /* image loaded from a file */

struct imgmem {
int x, y, width, height;
#ifdef GraphicsGL
unsigned short *pixmap;
#endif /* GraphicsGL */
#ifdef XWindows
XImage *im;
#endif /* XWindows */
Expand Down Expand Up @@ -351,8 +341,7 @@ typedef struct _wtexture {
*/
typedef struct _wdisplay {
int refcount;
int serial; /* serial # */
int numFonts;
int serial; /* serial # */

#ifdef MSWindows
char name[MAXDISPLAYNAME];
Expand All @@ -363,40 +352,26 @@ typedef struct _wdisplay {
Display * display;
GC icongc;
Colormap cmap;
#ifdef GraphicsGL
int nConfigs;
GLXFBConfig *configs;
XVisualInfo *vis;
GLXContext sharedCtx; /* shared context for texture sharing */
GLXContext currCtx; /* keeps track of current context */
#endif /* GraphicsGL */
#ifdef HAVE_XFT
XFontStruct *xfont;
#endif /* HAVE_XFT */
#ifdef Graphics3D
XVisualInfo *vis;
#endif /* Graphics3D */
Cursor cursors[NUMCURSORSYMS];
int numColors; /* allocated color info */
int sizColors; /* # elements of alloc. color array */
int numColors; /* allocated color info */
int sizColors; /* # elements of alloc. color array */
struct wcolor *colors;
int screen;
int numFonts;
wfp fonts;
int buckets[16384]; /* hash table for quicker lookups */
int buckets[16384]; /* hash table for quicker lookups */
#endif /* XWindows */
#ifdef GraphicsGL
unsigned int stdPatTexIds[16]; /* array of std pattern texture ids */
unsigned int *texIds;
unsigned int numTexIds;
unsigned int maxTexIds;
wfp glfonts; /* For OpenGL & X11 to live happily together */
int numMclrs;
int muteIdCount;
struct color *mclrs;
#endif /* GraphicsGL */
#ifdef Graphics3D

int ntextures; /* # textures actually used */
int nalced; /* number allocated */
wtp stex;
int maxstex;
int ntextures; /* # textures actually used */
int nalced; /* number allocated */
wtp stex;
int maxstex;
#endif /* Graphics3D */
double gamma;
struct _wdisplay *previous, *next;
Expand All @@ -422,24 +397,13 @@ typedef struct _wcontext {
double gamma; /* gamma correction value */
int bits; /* context bits */

#ifdef GraphicsGL
struct color glfg, glbg;
int reverse;
double alpha;
int linestyle;
int linewidth;
int leading; /* inter-line leading */
#endif /* GraphicsGL */

wdp display;
#ifdef XWindows
GC gc; /* X graphics context */
GC gc; /* X graphics context */
int fg, bg;
#ifndef GraphicsGL
int linestyle;
int linewidth;
int leading; /* inter-line leading */
#endif /* GraphicsGL */
#endif /* XWindows */
#ifdef MSWindows
LOGPEN pen;
Expand All @@ -450,16 +414,22 @@ typedef struct _wcontext {
HBITMAP pattern;
SysColor fg, bg;
char *fgname, *bgname;
#ifdef GraphicsGL
int bkmode;
#else /* GraphicsGL */
int leading, bkmode;
#endif /* GraphicsGL */
#endif /* MSWindows*/

#ifdef Graphics3D

#if HAVE_LIBGL
#ifdef XWindows
GLXContext ctx; /* context for "gl" windows */
#endif /* XWindows */
#ifdef MSWindows
HGLRC ctx;
#endif /* MSWindows */
#endif /* HAVE_LIBGL */

int dim; /* # of coordinates per vertex */
int rendermode; /* flag for 3D windows */
int is_3D; /* flag for 3D windows */
char buffermode; /* 3D buffering flag */
char meshmode; /* fillpolygon mesh mode */

Expand All @@ -475,17 +445,23 @@ typedef struct _wcontext {
int selectionnamelistsize; /* current available size */
int app_use_selection3D; /* the application uses 3D selection */

double eyeupx, eyeupy, eyeupz; /* eye up vector */
double eyedirx, eyediry, eyedirz; /* eye direction vector */
double eyeposx, eyeposy, eyeposz; /* eye position */

double fov; /* field of view angle */

struct b_realarray *normals; /* vertex normals data */

int normode; /* normals on, off or auto */
int numnormals; /* # of normals used */
int numnormals; /* # of normals used */

int autogen; /* flag to automatically generate texture coordinate */
int texmode; /* textures on or off */
int texmode; /* textures on or off */
int numtexcoords; /* # of texture coordinates used */
struct b_realarray *texcoords; /* texture coordinates */
struct b_realarray *texcoords; /* texture coordinates */

int curtexture; /* subscript of current texture */
int curtexture; /* subscript of current texture */
#endif /* Graphics3D */
} wcontext, *wcp;

Expand Down Expand Up @@ -535,10 +511,6 @@ typedef struct _wstate {
#ifdef Graphics3D
int type;
int texindex;
double eyeupx, eyeupy, eyeupz; /* eye up vector */
double eyedirx, eyediry, eyedirz; /* eye direction vector */
double eyeposx, eyeposy, eyeposz; /* eye position */
double fov; /* field of view angle */
#endif /* Graphics3D */

int inputmask; /* user input mask */
Expand Down Expand Up @@ -566,31 +538,7 @@ typedef struct _wstate {
struct descrip filep, listp; /* icon values for this window */
struct wbind_list *children;
struct _wbinding *parent;
wdp display;

#ifdef GraphicsGL
#ifdef XWindows
GLXContext ctx; /* context for "gl" windows */
GLXPbuffer pbuf; /* offscreen render surface */
#endif /* XWindows */
#ifdef MSWindows
HGLRC ctx;
#endif /* MSWindows */

struct _wcontext wcrender, wcdef; /* render & default/init contexts */
int lastwcserial; /* remembers the last context used */
unsigned char updateRC; /* render context flag, default:0 */
unsigned char initAttrs; /* initialize attribs falg, default:0 */
unsigned char resize; /* window resize flag */
unsigned char is_gl; /* flag for coexisting with Xlib */
unsigned char dx_flag, dy_flag;
unsigned char stencil_mask; /* bitmask for stencil buffer */
int rendermode; /* 2D/3D rendering attrib */
int projection; /* viewing volume projection attrib */
double camwidth; /* viewing volume cam width attrib */
#endif /* GraphicsGL */


wdp display;
#ifdef XWindows
Window win; /* X window */
Pixmap pix; /* current screen state */
Expand Down Expand Up @@ -636,12 +584,6 @@ typedef struct _wstate {
int is_3D; /* flag for 3D windows */
struct descrip funclist; /* descriptor to hold list of 3d functions */
#endif /* Graphics3D */
#ifdef GraphicsGL
struct descrip funclist2d; /* descriptor to hold list of 2d functions */
unsigned char redraw_flag;
unsigned char busy_flag;
unsigned char buffermode;
#endif /* GraphicsGL */
int no; /* new field added for child windows */
} wstate, *wsp;

Expand Down Expand Up @@ -765,11 +707,7 @@ struct wbind_list {
#define A_GLVERSION 86
#define A_GLVENDOR 87
#define A_GLRENDERER 88
#define A_ALPHA 89
#define A_RENDERMODE 90
#define A_PROJECTION 91
#define A_CAMWIDTH 92

#define NUMATTRIBS 92
#define NUMATTRIBS 88

#define XICONSLEEP 20 /* milliseconds */
11 changes: 2 additions & 9 deletions src/h/grttin.h
Original file line number Diff line number Diff line change
Expand Up @@ -385,13 +385,6 @@ typedef int va_list, siptr;
typedef int XRectangle, XPoint, XSegment, XArc, SysColor, LinearColor;
typedef int LONG, SHORT;

#ifdef GraphicsGL
#ifdef HAVE_LIBFREETYPE
typedef int FT_Library, FT_Face, FT_CharMap, FT_GlyphSlot, FT_Bitmap;
typedef int FT_Matrix, FT_Vector;
#endif /* HAVE_LIBFREETYPE */
#endif /* GraphicsGL */

#ifdef XWindows
typedef int Atom, Time, XSelectionEvent, XErrorEvent, XErrorHandler;
typedef int XGCValues, XColor, XFontStruct, XWindowAttributes, XEvent;
Expand Down Expand Up @@ -553,7 +546,7 @@ typedef int LOGPEN, LOGBRUSH, LPVOID, MCI_PLAY_PARMS, MCIDEVICEID;
*/
#begdef EnsureWindow3D(w)
{
if (w->context->rendermode == UGL2D) {
if (w->context->is_3D == 0) {
if (warg == 0)
runerr(150, kywd_xwin[XKey_Window]);
else
Expand Down Expand Up @@ -600,7 +593,7 @@ typedef int LOGPEN, LOGBRUSH, LPVOID, MCI_PLAY_PARMS, MCIDEVICEID;
typedef int GLdouble, GLint, GLfloat, GLsizei, Status, GLboolean, GLenum;
typedef int XWindowChanges, XStandardColormap, XMappingEvent, _GLUfuncptr;
typedef int GLXContext, GLUquadricObj, GLUtesselator, GLubyte, GLuint;
typedef int GLXFBConfig, GLXWindow, GLXPixmap, GLXPbuffer;
typedef int GLXFBConfig, GLXWindow;
#ifdef MSWindows
typedef int HGLRC, PIXELFORMATDESCRIPTOR;
#endif
Expand Down
3 changes: 0 additions & 3 deletions src/h/rmacros.h
Original file line number Diff line number Diff line change
Expand Up @@ -98,9 +98,6 @@
#define Fs_Pty 040000000 /* pty */
#endif

#ifdef GraphicsGL
#define Fs_WinGL2D 0100000000 /* for OpenGL 2D window */
#endif /* GraphicsGL */

/*
* Thread status flags in status field of coexpr blocks.
Expand Down
Loading

0 comments on commit 086054e

Please sign in to comment.