|
@@ -30,73 +30,6 @@
|
30
|
30
|
#include "OpenRaider.h"
|
31
|
31
|
#include "Render.h"
|
32
|
32
|
|
33
|
|
-ViewVolume gViewVolume; /* View volume for frustum culling */
|
34
|
|
-
|
35
|
|
-void Render::drawLoadScreen()
|
36
|
|
-{
|
37
|
|
- float x = 0.0f, y = 0.0f, z = -160.0f;
|
38
|
|
- float w = 500.0f, h = 500.0f;
|
39
|
|
-
|
40
|
|
-
|
41
|
|
- if (mTexture.getTextureCount() <= 0)
|
42
|
|
- return;
|
43
|
|
-
|
44
|
|
- // Mongoose 2002.01.01, Rendered while game is loading...
|
45
|
|
- //! \fixme seperate logo/particle coor later
|
46
|
|
- glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
|
47
|
|
- glLoadIdentity();
|
48
|
|
-
|
49
|
|
- glColor3fv(WHITE);
|
50
|
|
-
|
51
|
|
- if (mFlags & Render::fGL_Lights)
|
52
|
|
- glDisable(GL_LIGHTING);
|
53
|
|
-
|
54
|
|
- // Mongoose 2002.01.01, Draw logo/load screen
|
55
|
|
- glTranslatef(0.0f, 0.0f, -2000.0f);
|
56
|
|
- glRotatef(180.0f, 1.0f, 0.0f, 0.0f);
|
57
|
|
-
|
58
|
|
- glBindTexture(GL_TEXTURE_2D, 2);
|
59
|
|
-
|
60
|
|
- glBegin(GL_TRIANGLE_STRIP);
|
61
|
|
- glTexCoord2f(1.0, 1.0);
|
62
|
|
- glVertex3f(x + w, y + h, z);
|
63
|
|
- glTexCoord2f(0.0, 1.0);
|
64
|
|
- glVertex3f(x - w, y + h, z);
|
65
|
|
- glTexCoord2f(1.0, 0.0);
|
66
|
|
- glVertex3f(x + w, y - h, z);
|
67
|
|
- glTexCoord2f(0.0, 0.0);
|
68
|
|
- glVertex3f(x - w, y - h, z);
|
69
|
|
- glEnd();
|
70
|
|
-
|
71
|
|
- if (mFlags & Render::fGL_Lights)
|
72
|
|
- glEnable(GL_LIGHTING);
|
73
|
|
-
|
74
|
|
-#ifdef USING_EMITTER
|
75
|
|
- // Mongoose 2002.01.01, Test particle prototype on load screen
|
76
|
|
- if (mEmitter && mFlags & Render::fParticles)
|
77
|
|
- {
|
78
|
|
- glPushMatrix();
|
79
|
|
- glLoadIdentity();
|
80
|
|
-
|
81
|
|
- glEnable(GL_BLEND);
|
82
|
|
- glRotatef(180.0, 1.0, 0.0, 0.0);
|
83
|
|
- glTranslatef(0.0, -820.0, 575.0);
|
84
|
|
- glScalef(80.0, 80.0, 80.0);
|
85
|
|
-
|
86
|
|
- // Update view volume for vising
|
87
|
|
- updateViewVolume();
|
88
|
|
- gViewVolume.getFrustum(mEmitter->mFrustum);
|
89
|
|
- mEmitter->Flags(Emitter::fUseDepthSorting, true);
|
90
|
|
- mEmitter->Draw();
|
91
|
|
-
|
92
|
|
- glPopMatrix();
|
93
|
|
- }
|
94
|
|
-#endif
|
95
|
|
-
|
96
|
|
- glFlush();
|
97
|
|
-}
|
98
|
|
-
|
99
|
|
-
|
100
|
33
|
bool compareEntites(const void *voidA, const void *voidB)
|
101
|
34
|
{
|
102
|
35
|
entity_t *a = (entity_t *)voidA, *b = (entity_t *)voidB;
|
|
@@ -105,11 +38,11 @@ bool compareEntites(const void *voidA, const void *voidB)
|
105
|
38
|
if (!a || !b)
|
106
|
39
|
return false; // error really
|
107
|
40
|
|
108
|
|
- distA = gViewVolume.getDistToSphereFromNear(a->pos[0],
|
|
41
|
+ distA = gOpenRaider->mGame->mRender->mViewVolume.getDistToSphereFromNear(a->pos[0],
|
109
|
42
|
a->pos[1],
|
110
|
43
|
a->pos[2],
|
111
|
44
|
1.0f);
|
112
|
|
- distB = gViewVolume.getDistToSphereFromNear(b->pos[0],
|
|
45
|
+ distB = gOpenRaider->mGame->mRender->mViewVolume.getDistToSphereFromNear(b->pos[0],
|
113
|
46
|
b->pos[1],
|
114
|
47
|
b->pos[2],
|
115
|
48
|
1.0f);
|
|
@@ -126,11 +59,11 @@ bool compareStaticModels(const void *voidA, const void *voidB)
|
126
|
59
|
if (!a || !b)
|
127
|
60
|
return false; // error really
|
128
|
61
|
|
129
|
|
- distA = gViewVolume.getDistToSphereFromNear(a->pos[0],
|
|
62
|
+ distA = gOpenRaider->mGame->mRender->mViewVolume.getDistToSphereFromNear(a->pos[0],
|
130
|
63
|
a->pos[1],
|
131
|
64
|
a->pos[2],
|
132
|
65
|
128.0f);
|
133
|
|
- distB = gViewVolume.getDistToSphereFromNear(b->pos[0],
|
|
66
|
+ distB = gOpenRaider->mGame->mRender->mViewVolume.getDistToSphereFromNear(b->pos[0],
|
134
|
67
|
b->pos[1],
|
135
|
68
|
b->pos[2],
|
136
|
69
|
128.0f);
|
|
@@ -830,6 +763,74 @@ void Render::Display()
|
830
|
763
|
glFlush();
|
831
|
764
|
}
|
832
|
765
|
|
|
766
|
+void Render::drawLoadScreen()
|
|
767
|
+{
|
|
768
|
+ float x = 0.0f, y = 0.0f, z = -160.0f;
|
|
769
|
+ float w, h;
|
|
770
|
+
|
|
771
|
+ if (gOpenRaider->mWindow->mWidth < gOpenRaider->mWindow->mHeight)
|
|
772
|
+ w = h = (float)gOpenRaider->mWindow->mWidth;
|
|
773
|
+ else
|
|
774
|
+ w = h = (float)gOpenRaider->mWindow->mHeight;
|
|
775
|
+
|
|
776
|
+
|
|
777
|
+ if (mTexture.getTextureCount() <= 0)
|
|
778
|
+ return;
|
|
779
|
+
|
|
780
|
+ // Mongoose 2002.01.01, Rendered while game is loading...
|
|
781
|
+ //! \fixme seperate logo/particle coor later
|
|
782
|
+ glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
|
|
783
|
+ glLoadIdentity();
|
|
784
|
+
|
|
785
|
+ glColor3fv(WHITE);
|
|
786
|
+
|
|
787
|
+ if (mFlags & Render::fGL_Lights)
|
|
788
|
+ glDisable(GL_LIGHTING);
|
|
789
|
+
|
|
790
|
+ // Mongoose 2002.01.01, Draw logo/load screen
|
|
791
|
+ glTranslatef(0.0f, 0.0f, -2000.0f);
|
|
792
|
+ glRotatef(180.0f, 1.0f, 0.0f, 0.0f);
|
|
793
|
+
|
|
794
|
+ glBindTexture(GL_TEXTURE_2D, 2); //! \fixme store texture id somewhere
|
|
795
|
+
|
|
796
|
+ glBegin(GL_TRIANGLE_STRIP);
|
|
797
|
+ glTexCoord2f(1.0, 1.0);
|
|
798
|
+ glVertex3f(x + w, y + h, z);
|
|
799
|
+ glTexCoord2f(0.0, 1.0);
|
|
800
|
+ glVertex3f(x - w, y + h, z);
|
|
801
|
+ glTexCoord2f(1.0, 0.0);
|
|
802
|
+ glVertex3f(x + w, y - h, z);
|
|
803
|
+ glTexCoord2f(0.0, 0.0);
|
|
804
|
+ glVertex3f(x - w, y - h, z);
|
|
805
|
+ glEnd();
|
|
806
|
+
|
|
807
|
+ if (mFlags & Render::fGL_Lights)
|
|
808
|
+ glEnable(GL_LIGHTING);
|
|
809
|
+
|
|
810
|
+#ifdef USING_EMITTER
|
|
811
|
+ // Mongoose 2002.01.01, Test particle prototype on load screen
|
|
812
|
+ if (mEmitter && mFlags & Render::fParticles)
|
|
813
|
+ {
|
|
814
|
+ glPushMatrix();
|
|
815
|
+ glLoadIdentity();
|
|
816
|
+
|
|
817
|
+ glEnable(GL_BLEND);
|
|
818
|
+ glRotatef(180.0, 1.0, 0.0, 0.0);
|
|
819
|
+ glTranslatef(0.0, -820.0, 575.0);
|
|
820
|
+ glScalef(80.0, 80.0, 80.0);
|
|
821
|
+
|
|
822
|
+ // Update view volume for vising
|
|
823
|
+ updateViewVolume();
|
|
824
|
+ mViewVolume.getFrustum(mEmitter->mFrustum);
|
|
825
|
+ mEmitter->Flags(Emitter::fUseDepthSorting, true);
|
|
826
|
+ mEmitter->Draw();
|
|
827
|
+
|
|
828
|
+ glPopMatrix();
|
|
829
|
+ }
|
|
830
|
+#endif
|
|
831
|
+
|
|
832
|
+ glFlush();
|
|
833
|
+}
|
833
|
834
|
|
834
|
835
|
void Render::newRoomRenderList(int index)
|
835
|
836
|
{
|
|
@@ -880,7 +881,7 @@ void Render::newRoomRenderList(int index)
|
880
|
881
|
continue;
|
881
|
882
|
|
882
|
883
|
//room->dist =
|
883
|
|
- //gViewVolume.getDistToBboxFromNear(room->room->bbox_min,
|
|
884
|
+ //mViewVolume.getDistToBboxFromNear(room->room->bbox_min,
|
884
|
885
|
// room->room->bbox_max);
|
885
|
886
|
|
886
|
887
|
mRoomRenderList.push_back(room);
|
|
@@ -919,7 +920,7 @@ void Render::buildRoomRenderList(RenderRoom *rRoom)
|
919
|
920
|
}
|
920
|
921
|
|
921
|
922
|
//rRoom->dist =
|
922
|
|
- //gViewVolume.getDistToBboxFromNear(rRoom->room->bbox_min,
|
|
923
|
+ //mViewVolume.getDistToBboxFromNear(rRoom->room->bbox_min,
|
923
|
924
|
// rRoom->room->bbox_max);
|
924
|
925
|
|
925
|
926
|
/* Add current room to list */
|
|
@@ -1894,7 +1895,7 @@ void Render::updateViewVolume()
|
1894
|
1895
|
|
1895
|
1896
|
glGetFloatv(GL_PROJECTION_MATRIX, proj);
|
1896
|
1897
|
glGetFloatv(GL_MODELVIEW_MATRIX, mdl);
|
1897
|
|
- gViewVolume.updateFrame(proj, mdl);
|
|
1898
|
+ mViewVolume.updateFrame(proj, mdl);
|
1898
|
1899
|
}
|
1899
|
1900
|
|
1900
|
1901
|
|
|
@@ -1913,7 +1914,7 @@ bool Render::isVisible(float bbox_min[3], float bbox_max[3])
|
1913
|
1914
|
draw_bbox_color(bbox_min, bbox_max, true, PINK, RED);
|
1914
|
1915
|
}
|
1915
|
1916
|
|
1916
|
|
- return gViewVolume.isBboxInFrustum(bbox_min, bbox_max);
|
|
1917
|
+ return mViewVolume.isBboxInFrustum(bbox_min, bbox_max);
|
1917
|
1918
|
}
|
1918
|
1919
|
|
1919
|
1920
|
|
|
@@ -1929,7 +1930,7 @@ bool Render::isVisible(float x, float y, float z)
|
1929
|
1930
|
glEnd();
|
1930
|
1931
|
}
|
1931
|
1932
|
|
1932
|
|
- return (gViewVolume.isPointInFrustum(x, y, z));
|
|
1933
|
+ return (mViewVolume.isPointInFrustum(x, y, z));
|
1933
|
1934
|
}
|
1934
|
1935
|
|
1935
|
1936
|
|
|
@@ -1945,5 +1946,5 @@ bool Render::isVisible(float x, float y, float z, float radius)
|
1945
|
1946
|
glEnd();
|
1946
|
1947
|
}
|
1947
|
1948
|
|
1948
|
|
- return (gViewVolume.isSphereInFrustum(x, y, z, radius));
|
|
1949
|
+ return (mViewVolume.isSphereInFrustum(x, y, z, radius));
|
1949
|
1950
|
}
|