2 PrtView plugin for GtkRadiant
3 Copyright (C) 2001 Geoffrey Dewan, Loki software and qeradiant.com
5 This library is free software; you can redistribute it and/or
6 modify it under the terms of the GNU Lesser General Public
7 License as published by the Free Software Foundation; either
8 version 2.1 of the License, or (at your option) any later version.
10 This library is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 Lesser General Public License for more details.
15 You should have received a copy of the GNU Lesser General Public
16 License along with this library; if not, write to the Free Software
17 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
25 #include "renderable.h"
26 #include "math/vector.h"
46 CBspPoint *inner_point;
47 float fp_color_random[4];
53 bool Build(char *def);
57 const int PRTVIEW_PATH_MAX = PATH_MAX;
59 const int PRTVIEW_PATH_MAX = 260;
61 typedef guint32 PackedColour;
62 #define RGB(r, g, b) ( (guint32)( ( (guint8) ( r ) | ( (guint16) ( g ) << 8 ) ) | ( ( (guint32) (guint8) ( b ) ) << 16 ) ) )
63 #define GetRValue(rgb) ( (guint8)( rgb ) )
64 #define GetGValue(rgb) ( (guint8)( ( (guint16)( rgb ) ) >> 8 ) )
65 #define GetBValue(rgb) ( (guint8)( ( rgb ) >> 16 ) )
80 void Load(); // use filename in fn
85 char fn[PRTVIEW_PATH_MAX];
93 PackedColour color_3d;
94 float width_3d; // in 8'ths
96 PackedColour color_fog;
97 float fp_color_fog[4];
104 PackedColour color_2d;
105 float width_2d; // in 8'ths
106 float fp_color_2d[4];
113 unsigned int node_count;
114 unsigned int portal_count;
117 class CubicClipVolume {
119 Vector3 cam, min, max;
122 class CPortalsDrawSolid : public OpenGLRenderable {
124 mutable CubicClipVolume clip;
126 void render(OpenGLBinding &GL, RenderStateFlags state) const;
129 class CPortalsDrawSolidOutline : public OpenGLRenderable {
131 mutable CubicClipVolume clip;
133 void render(OpenGLBinding &GL, RenderStateFlags state) const;
136 class CPortalsDrawWireframe : public OpenGLRenderable {
138 void render(OpenGLBinding &GL, RenderStateFlags state) const;
141 class CPortalsRender : public Renderable {
143 CPortalsDrawSolid m_drawSolid;
144 CPortalsDrawSolidOutline m_drawSolidOutline;
145 CPortalsDrawWireframe m_drawWireframe;
147 void renderSolid(Renderer &renderer, const VolumeTest &volume) const;
149 void renderWireframe(Renderer &renderer, const VolumeTest &volume) const;
152 extern CPortals portals;
153 extern CPortalsRender render;
155 void Portals_constructShaders();
157 void Portals_destroyShaders();
159 void Portals_shadersChanged();
162 #endif // _PORTALS_H_