]> de.git.xonotic.org Git - xonotic/netradiant.git/blobdiff - contrib/prtview/portals.h
Centralise compile checks
[xonotic/netradiant.git] / contrib / prtview / portals.h
index 8f89bdffc7a0ee106215810c3040ce5410836c25..4865108855fd835a0cdef9322c8c409ef98d093f 100644 (file)
 #ifndef _PORTALS_H_
 #define _PORTALS_H_
 
+#include <glib.h>
+#include "irender.h"
+#include "renderable.h"
+#include "math/vector.h"
+
+
 class CBspPoint {
 public:
 float p[3];
@@ -41,11 +47,23 @@ float fp_color_random[4];
 float min[3];
 float max[3];
 float dist;
-qboolean hint;
+bool hint;
 
-qboolean Build( char *def );
+bool Build( char *def );
 };
 
+#ifdef PATH_MAX
+const int PRTVIEW_PATH_MAX = PATH_MAX;
+#else
+const int PRTVIEW_PATH_MAX = 260;
+#endif
+typedef guint32 PackedColour;
+#define RGB( r, g, b ) ( (guint32)( ( (guint8) ( r ) | ( (guint16) ( g ) << 8 ) ) | ( ( (guint32) (guint8) ( b ) ) << 16 ) ) )
+#define GetRValue( rgb )      ( (guint8)( rgb ) )
+#define GetGValue( rgb )      ( (guint8)( ( (guint16)( rgb ) ) >> 8 ) )
+#define GetBValue( rgb )      ( (guint8)( ( rgb ) >> 16 ) )
+
+
 class CPortals {
 public:
 
@@ -62,68 +80,82 @@ void Purge();
 
 void FixColors();
 
-char fn[_MAX_PATH];
+char fn[PRTVIEW_PATH_MAX];
 
 int zbuffer;
 int polygons;
 int lines;
-qboolean show_3d;
-qboolean aa_3d;
-qboolean fog;
-COLORREF color_3d;
+bool show_3d;
+bool aa_3d;
+bool fog;
+PackedColour color_3d;
 float width_3d;      // in 8'ths
 float fp_color_3d[4];
-COLORREF color_fog;
+PackedColour color_fog;
 float fp_color_fog[4];
 float trans_3d;
 float clip_range;
-qboolean clip;
+bool clip;
 
-qboolean show_2d;
-qboolean aa_2d;
-COLORREF color_2d;
+bool show_2d;
+bool aa_2d;
+PackedColour color_2d;
 float width_2d;      // in 8'ths
 float fp_color_2d[4];
 
 CBspPortal *portal;
 int *portal_sort;
-qboolean hint_flags;
+bool hint_flags;
 //     CBspNode *node;
 
 unsigned int node_count;
 unsigned int portal_count;
 };
 
-class CPortalsRender : public IGL2DWindow, public IGL3DWindow {
+class CubicClipVolume
+{
 public:
+Vector3 cam, min, max;
+};
 
-CPortalsRender();
-virtual ~CPortalsRender();
+class CPortalsDrawSolid : public OpenGLRenderable
+{
+public:
+mutable CubicClipVolume clip;
+void render( RenderStateFlags state ) const;
+};
 
-protected:
+class CPortalsDrawSolidOutline : public OpenGLRenderable
+{
+public:
+mutable CubicClipVolume clip;
+void render( RenderStateFlags state ) const;
+};
 
-int refCount;
-#ifdef _WIN32
-CRITICAL_SECTION protect;
-#endif
+class CPortalsDrawWireframe : public OpenGLRenderable
+{
+public:
+void render( RenderStateFlags state ) const;
+};
 
+class CPortalsRender : public Renderable
+{
 public:
+CPortalsDrawSolid m_drawSolid;
+CPortalsDrawSolidOutline m_drawSolidOutline;
+CPortalsDrawWireframe m_drawWireframe;
 
-// IGL2DWindow IGL3DWindow interface
-void IncRef() { refCount++; }
-void DecRef() {
-       refCount--; if ( refCount <= 0 ) {
-               delete this;
-       }
-}
-void Draw2D( VIEWTYPE vt );
-void Draw3D();
-void Register();
+void renderSolid( Renderer& renderer, const VolumeTest& volume ) const;
+void renderWireframe( Renderer& renderer, const VolumeTest& volume ) const;
 };
 
-// void Sys_Printf (char *text, ...);
-
 extern CPortals portals;
 extern CPortalsRender render;
 
+void Portals_constructShaders();
+void Portals_destroyShaders();
+
+void Portals_shadersChanged();
+
+
 #endif // _PORTALS_H_