1
/************************************************************************************
3
AstroMenace (Hardcore 3D space shooter with spaceship upgrade possibilities)
4
Copyright © 2006-2012 Michael Kurinnoy, Viewizard
7
AstroMenace is free software: you can redistribute it and/or modify
8
it under the terms of the GNU General Public License as published by
9
the Free Software Foundation, either version 3 of the License, or
10
(at your option) any later version.
12
AstroMenace is distributed in the hope that it will be useful,
13
but WITHOUT ANY WARRANTY; without even the implied warranty of
14
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15
GNU General Public License for more details.
17
You should have received a copy of the GNU General Public License
18
along with AstroMenace. If not, see <http://www.gnu.org/licenses/>.
21
Web Site: http://www.viewizard.com/
22
Project: http://sourceforge.net/projects/openastromenace/
23
E-mail: viewizard@viewizard.com
25
*************************************************************************************/
28
/// подключаем нужные файлы
34
//-----------------------------------------------------------------------------
35
// Удаляем все объекты в списке
36
//-----------------------------------------------------------------------------
37
void ReleaseAllObject3D()
40
ReleaseAllSpaceShip();
44
ReleaseAllGroundObject();
46
ReleaseAllProjectile();
47
// космические объекты
48
ReleaseAllSpaceObject();
50
ReleaseAllExplosion();
58
//-----------------------------------------------------------------------------
59
// Прорисовываем все объекты
60
//-----------------------------------------------------------------------------
61
void DrawAllObject3D(int DrawType)
63
// ставим всегда меньше или равно!
64
vw_DepthTest(true, RI_LESSEQUAL);
67
bool ShadowMap = false;
69
if (Setup.ShadowMap > 0)
74
case 1: ShadowMap_StartRenderToFBO(VECTOR3D(50,-5,-120), 120.0f, 500.0f); break;
76
case 2: ShadowMap_StartRenderToFBO(VECTOR3D(0,0,160), 600.0f, 800.0f); break;
79
DrawAllSpaceShip(true, 0);
80
DrawAllWeapon(true, 0);
81
DrawAllGroundObject(true, 0);
82
DrawAllProjectile(true, 0);
83
DrawAllExplosion(true);
84
DrawAllSpaceObject(true, 0);
86
ShadowMap_EndRenderToFBO();
88
// работаем с 3-м стейджем текстур (первые два у нас заняты)
90
ShadowMap_StartFinalRender();
94
// космические объекты
95
DrawAllSpaceObject(false, ShadowMap);
97
DrawAllSpaceShip(false, ShadowMap);
99
DrawAllWeapon(false, ShadowMap);
101
DrawAllGroundObject(false, ShadowMap);
103
DrawAllProjectile(false, ShadowMap);
106
if (Setup.ShadowMap > 0)
108
ShadowMap_EndFinalRender();
112
DrawAllExplosion(false);
115
// эффекты - самые последние в прорисовке!
116
vw_DrawAllParticleSystems();
124
// второй слой тайловой анимации "пыли"
125
StarSystemDrawSecondLayer(DrawType);
127
// эмуляция гаммы, фактически это простой пост эффект, всегда самый последний в прорисовке
128
if( Setup.Brightness != 5 )
132
// RI_2f_XY | RI_1_TEX
133
buff = new float[4*4]; if (buff == 0) return;
143
buff[k++] = Setup.fAspectRatioHeight;
147
buff[k++] = Setup.fAspectRatioWidth;
152
buff[k++] = Setup.fAspectRatioWidth;
153
buff[k++] = Setup.fAspectRatioHeight;
158
eTexture *TileTexture = vw_FindTextureByName("DATA/MENU/whitepoint.tga");
159
vw_SetTexture(0, TileTexture);
161
float BrightnessF = 1.0f + (Setup.Brightness - 5)/5.0f;
163
if( BrightnessF > 1.0f )
165
vw_SetTextureBlend(true, RI_BLEND_DESTCOLOR, RI_BLEND_ONE);
166
vw_SetColor(BrightnessF-1.0f, BrightnessF-1.0f, BrightnessF-1.0f, 1.0f);
170
vw_SetTextureBlend(true, RI_BLEND_ZERO, RI_BLEND_SRCCOLOR);
171
vw_SetColor(BrightnessF, BrightnessF, BrightnessF, 1.0f);
174
vw_Start2DMode(-1,1);
175
vw_SendVertices(RI_TRIANGLE_STRIP, 4, RI_2f_XY | RI_1_TEX, buff, 4*sizeof(float));
178
vw_SetTextureBlend(false, 0, 0);
179
vw_BindTexture(0, 0);
180
if (buff != 0){delete [] buff; buff = 0;}
192
//-----------------------------------------------------------------------------
193
// Проверяем все объекты, обновляем данные
194
//-----------------------------------------------------------------------------
195
void UpdateAllObject3D(float Time)
198
UpdateAllSpaceShip(Time);
199
// проверяем все оружие
200
UpdateAllWeapon(Time);
202
UpdateAllGroundObject(Time);
204
UpdateAllProjectile(Time);
205
// космические объекты
206
UpdateAllSpaceObject(Time);
208
UpdateAllExplosion(Time);