0e66433c4cb90d6b7b6b1e9de5782b3274f7afc9
[supertux.git] / src / video / gl / gl_renderer.cpp
1 //  SuperTux
2 //  Copyright (C) 2006 Matthias Braun <matze@braunis.de>
3 //
4 //  This program is free software: you can redistribute it and/or modify
5 //  it under the terms of the GNU General Public License as published by
6 //  the Free Software Foundation, either version 3 of the License, or
7 //  (at your option) any later version.
8 //
9 //  This program is distributed in the hope that it will be useful,
10 //  but WITHOUT ANY WARRANTY; without even the implied warranty of
11 //  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12 //  GNU General Public License for more details.
13 //
14 //  You should have received a copy of the GNU General Public License
15 //  along with this program.  If not, see <http://www.gnu.org/licenses/>.
16
17 #include "video/gl/gl_renderer.hpp"
18
19 #include <iomanip>
20 #include <iostream>
21 #include <physfs.h>
22
23 #include "supertux/gameconfig.hpp"
24 #include "supertux/globals.hpp"
25 #include "video/drawing_request.hpp"
26 #include "video/gl/gl_surface_data.hpp"
27 #include "video/gl/gl_texture.hpp"
28 #define LIGHTMAP_DIV 5
29
30 #ifdef GL_VERSION_ES_CM_1_0
31 #  define glOrtho glOrthof
32 #endif
33
34 GLRenderer::GLRenderer() :
35   desktop_size(-1, -1),
36   screen_size(-1, -1),
37   fullscreen_active(false),
38   last_texture(static_cast<GLuint> (-1))
39 {
40   Renderer::instance_ = this;
41
42 #if SDL_MAJOR_VERSION > 1 || SDL_MINOR_VERSION > 2 || (SDL_MINOR_VERSION == 2 && SDL_PATCHLEVEL >= 10)
43   // unfortunately only newer SDLs have these infos.
44   // This must be called before SDL_SetVideoMode() or it will return
45   // the window size instead of the desktop size.
46   const SDL_VideoInfo *info = SDL_GetVideoInfo();
47   if (info)
48   {
49     desktop_size = Size(info->current_w, info->current_h);
50   }
51 #endif
52
53   if(texture_manager != 0)
54     texture_manager->save_textures();
55
56 #ifdef SDL_GL_SWAP_CONTROL
57   if(config->try_vsync) {
58     /* we want vsync for smooth scrolling */
59     SDL_GL_SetAttribute(SDL_GL_SWAP_CONTROL, 1);
60   }
61 #endif
62
63   SDL_GL_SetAttribute(SDL_GL_DOUBLEBUFFER, 1);
64
65   // FIXME: Hu? 16bit rendering?
66   SDL_GL_SetAttribute(SDL_GL_RED_SIZE,   5);
67   SDL_GL_SetAttribute(SDL_GL_GREEN_SIZE, 5);
68   SDL_GL_SetAttribute(SDL_GL_BLUE_SIZE,  5);
69
70   if(g_config->use_fullscreen)
71   {
72     apply_video_mode(g_config->fullscreen_size, true);
73   }
74   else
75   {
76     apply_video_mode(g_config->window_size, false);
77   }
78
79   // setup opengl state and transform
80   glDisable(GL_DEPTH_TEST);
81   glDisable(GL_CULL_FACE);
82   glEnable(GL_TEXTURE_2D);
83   glEnable(GL_BLEND);
84   glEnableClientState(GL_VERTEX_ARRAY);
85   glEnableClientState(GL_TEXTURE_COORD_ARRAY);
86   glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
87
88   // Init the projection matrix, viewport and stuff
89   apply_config();
90   
91   if(texture_manager == 0)
92     texture_manager = new TextureManager();
93   else
94     texture_manager->reload_textures();
95   
96 #ifndef GL_VERSION_ES_CM_1_0
97   GLenum err = glewInit();
98   if (GLEW_OK != err)
99   {
100     std::ostringstream out;
101     out << "GLRenderer: " << glewGetErrorString(err);
102     throw std::runtime_error(out.str());
103   }
104   log_info << "Using GLEW " << glewGetString(GLEW_VERSION) << std::endl;
105   log_info << "GLEW_ARB_texture_non_power_of_two: " << static_cast<int>(GLEW_ARB_texture_non_power_of_two) << std::endl;
106 #endif
107 }
108
109 GLRenderer::~GLRenderer()
110 {
111 }
112
113 void
114 GLRenderer::draw_surface(const DrawingRequest& request)
115 {
116   const Surface* surface = (const Surface*) request.request_data;
117   GLTexture* gltexture = static_cast<GLTexture*>(surface->get_texture().get());
118   GLSurfaceData *surface_data = static_cast<GLSurfaceData*>(surface->get_surface_data());
119
120   GLuint th = gltexture->get_handle();
121   if (th != last_texture) {
122     last_texture = th;
123     glBindTexture(GL_TEXTURE_2D, th);
124   }
125   intern_draw(request.pos.x, request.pos.y,
126               request.pos.x + surface->get_width(),
127               request.pos.y + surface->get_height(),
128               surface_data->get_uv_left(),
129               surface_data->get_uv_top(),
130               surface_data->get_uv_right(),
131               surface_data->get_uv_bottom(),
132               request.angle,
133               request.alpha,
134               request.color,
135               request.blend,
136               request.drawing_effect);
137 }
138
139 void
140 GLRenderer::draw_surface_part(const DrawingRequest& request)
141 {
142   const SurfacePartRequest* surfacepartrequest
143     = (SurfacePartRequest*) request.request_data;
144   const Surface* surface = surfacepartrequest->surface;
145   boost::shared_ptr<GLTexture> gltexture = boost::dynamic_pointer_cast<GLTexture>(surface->get_texture());
146   GLSurfaceData *surface_data = reinterpret_cast<GLSurfaceData *>(surface->get_surface_data());
147
148   float uv_width = surface_data->get_uv_right() - surface_data->get_uv_left();
149   float uv_height = surface_data->get_uv_bottom() - surface_data->get_uv_top();
150
151   float uv_left = surface_data->get_uv_left() + (uv_width * surfacepartrequest->source.x) / surface->get_width();
152   float uv_top = surface_data->get_uv_top() + (uv_height * surfacepartrequest->source.y) / surface->get_height();
153   float uv_right = surface_data->get_uv_left() + (uv_width * (surfacepartrequest->source.x + surfacepartrequest->size.x)) / surface->get_width();
154   float uv_bottom = surface_data->get_uv_top() + (uv_height * (surfacepartrequest->source.y + surfacepartrequest->size.y)) / surface->get_height();
155
156   GLuint th = gltexture->get_handle();
157   if (th != last_texture) {
158     last_texture = th;
159     glBindTexture(GL_TEXTURE_2D, th);
160   }
161   intern_draw(request.pos.x, request.pos.y,
162               request.pos.x + surfacepartrequest->size.x,
163               request.pos.y + surfacepartrequest->size.y,
164               uv_left,
165               uv_top,
166               uv_right,
167               uv_bottom,
168               0.0,
169               request.alpha,
170               request.color,
171               Blend(),
172               request.drawing_effect);
173 }
174
175 void
176 GLRenderer::draw_gradient(const DrawingRequest& request)
177 {
178   const GradientRequest* gradientrequest 
179     = (GradientRequest*) request.request_data;
180   const Color& top = gradientrequest->top;
181   const Color& bottom = gradientrequest->bottom;
182
183   glDisable(GL_TEXTURE_2D);
184   glDisableClientState(GL_TEXTURE_COORD_ARRAY);
185   glEnableClientState(GL_COLOR_ARRAY);
186
187   float vertices[] = {
188     0, 0,
189     float(SCREEN_WIDTH), 0,
190     float(SCREEN_WIDTH), float(SCREEN_HEIGHT),
191     0, float(SCREEN_HEIGHT)
192   };
193   glVertexPointer(2, GL_FLOAT, 0, vertices);
194
195   float colors[] = {
196     top.red, top.green, top.blue, top.alpha,
197     top.red, top.green, top.blue, top.alpha,
198     bottom.red, bottom.green, bottom.blue, bottom.alpha,
199     bottom.red, bottom.green, bottom.blue, bottom.alpha,
200   };
201   glColorPointer(4, GL_FLOAT, 0, colors);
202
203   glDrawArrays(GL_TRIANGLE_FAN, 0, 4);
204
205   glDisableClientState(GL_COLOR_ARRAY);
206   glEnableClientState(GL_TEXTURE_COORD_ARRAY);
207
208   glEnable(GL_TEXTURE_2D);
209   glColor4f(1, 1, 1, 1);
210 }
211
212 void
213 GLRenderer::draw_filled_rect(const DrawingRequest& request)
214 {
215   const FillRectRequest* fillrectrequest
216     = (FillRectRequest*) request.request_data;
217
218   glDisable(GL_TEXTURE_2D);
219   glColor4f(fillrectrequest->color.red, fillrectrequest->color.green,
220             fillrectrequest->color.blue, fillrectrequest->color.alpha);
221   glDisableClientState(GL_TEXTURE_COORD_ARRAY);
222   
223   if (fillrectrequest->radius != 0.0f)
224   {
225     // draw round rect
226     // Keep radius in the limits, so that we get a circle instead of
227     // just graphic junk
228     float radius = std::min(fillrectrequest->radius,
229                             std::min(fillrectrequest->size.x/2,
230                                      fillrectrequest->size.y/2));
231
232     // inner rectangle
233     Rectf irect(request.pos.x    + radius,
234                request.pos.y    + radius,
235                request.pos.x + fillrectrequest->size.x - radius,
236                request.pos.y + fillrectrequest->size.y - radius);
237
238     int n = 8;
239     int p = 0;
240     std::vector<float> vertices((n+1) * 4 * 2);
241
242     for(int i = 0; i <= n; ++i)
243     {
244       float x = sinf(i * (M_PI/2) / n) * radius;
245       float y = cosf(i * (M_PI/2) / n) * radius;
246
247       vertices[p++] = irect.get_left() - x;
248       vertices[p++] = irect.get_top()  - y;
249
250       vertices[p++] = irect.get_right() + x;
251       vertices[p++] = irect.get_top()   - y;
252     }
253
254     for(int i = 0; i <= n; ++i)
255     {
256       float x = cosf(i * (M_PI/2) / n) * radius;
257       float y = sinf(i * (M_PI/2) / n) * radius;
258
259       vertices[p++] = irect.get_left()   - x;
260       vertices[p++] = irect.get_bottom() + y;
261
262       vertices[p++] = irect.get_right()  + x;
263       vertices[p++] = irect.get_bottom() + y;
264     }
265
266     glVertexPointer(2, GL_FLOAT, 0, &*vertices.begin());
267     glDrawArrays(GL_TRIANGLE_STRIP, 0,  vertices.size()/2);
268   }
269   else
270   {
271     float x = request.pos.x;
272     float y = request.pos.y;
273     float w = fillrectrequest->size.x;
274     float h = fillrectrequest->size.y;
275
276     float vertices[] = {
277       x,   y,
278       x+w, y,
279       x+w, y+h,
280       x,   y+h
281     };
282     glVertexPointer(2, GL_FLOAT, 0, vertices);
283
284     glDrawArrays(GL_TRIANGLE_FAN, 0, 4);
285   }
286
287   glEnableClientState(GL_TEXTURE_COORD_ARRAY);
288   glEnable(GL_TEXTURE_2D);
289   glColor4f(1, 1, 1, 1);
290 }
291
292 void
293 GLRenderer::draw_inverse_ellipse(const DrawingRequest& request)
294 {
295   const InverseEllipseRequest* ellipse = (InverseEllipseRequest*)request.request_data;
296
297   glDisable(GL_TEXTURE_2D);
298   glColor4f(ellipse->color.red,  ellipse->color.green,
299             ellipse->color.blue, ellipse->color.alpha);
300     
301   float x = request.pos.x;
302   float y = request.pos.y;
303   float w = ellipse->size.x/2.0f;
304   float h = ellipse->size.y/2.0f;
305
306   static const int slices = 16;
307   static const int points = (slices+1) * 12;
308
309   float vertices[points * 2];
310   int   p = 0;
311
312   // Bottom
313   vertices[p++] = SCREEN_WIDTH; vertices[p++] = SCREEN_HEIGHT;
314   vertices[p++] = 0;            vertices[p++] = SCREEN_HEIGHT;
315   vertices[p++] = x;            vertices[p++] = y+h;
316
317   // Top
318   vertices[p++] = SCREEN_WIDTH; vertices[p++] = 0;
319   vertices[p++] = 0;            vertices[p++] = 0;
320   vertices[p++] = x;            vertices[p++] = y-h;
321
322   // Left
323   vertices[p++] = SCREEN_WIDTH; vertices[p++] = 0;
324   vertices[p++] = SCREEN_WIDTH; vertices[p++] = SCREEN_HEIGHT;
325   vertices[p++] = x+w;          vertices[p++] = y;
326
327   // Right
328   vertices[p++] = 0;            vertices[p++] = 0;
329   vertices[p++] = 0;            vertices[p++] = SCREEN_HEIGHT;
330   vertices[p++] = x-w;          vertices[p++] = y;
331
332   for(int i = 0; i < slices; ++i)
333   {
334     float ex1 = sinf(M_PI/2 / slices * i) * w;
335     float ey1 = cosf(M_PI/2 / slices * i) * h;
336
337     float ex2 = sinf(M_PI/2 / slices * (i+1)) * w;
338     float ey2 = cosf(M_PI/2 / slices * (i+1)) * h;
339
340     // Bottom/Right
341     vertices[p++] = SCREEN_WIDTH; vertices[p++] = SCREEN_HEIGHT;
342     vertices[p++] = x + ex1;      vertices[p++] = y + ey1;
343     vertices[p++] = x + ex2;      vertices[p++] = y + ey2;
344
345     // Top/Left
346     vertices[p++] = 0;            vertices[p++] = 0;
347     vertices[p++] = x - ex1;      vertices[p++] = y - ey1;
348     vertices[p++] = x - ex2;      vertices[p++] = y - ey2;
349
350     // Top/Right
351     vertices[p++] = SCREEN_WIDTH; vertices[p++] = 0;
352     vertices[p++] = x + ex1;      vertices[p++] = y - ey1;
353     vertices[p++] = x + ex2;      vertices[p++] = y - ey2;
354
355     // Bottom/Left
356     vertices[p++] = 0;            vertices[p++] = SCREEN_HEIGHT;
357     vertices[p++] = x - ex1;      vertices[p++] = y + ey1;
358     vertices[p++] = x - ex2;      vertices[p++] = y + ey2;
359   }
360
361   glDisableClientState(GL_TEXTURE_COORD_ARRAY);
362   glVertexPointer(2, GL_FLOAT, 0, vertices);
363
364   glDrawArrays(GL_TRIANGLES, 0, points);
365
366   glEnableClientState(GL_TEXTURE_COORD_ARRAY);
367
368   glEnable(GL_TEXTURE_2D);
369   glColor4f(1, 1, 1, 1);    
370 }
371
372 void 
373 GLRenderer::do_take_screenshot()
374 {
375   // [Christoph] TODO: Yes, this method also takes care of the actual disk I/O. Split it?
376
377   SDL_Surface *shot_surf;
378   // create surface to hold screenshot
379 #if SDL_BYTEORDER == SDL_BIG_ENDIAN
380   shot_surf = SDL_CreateRGBSurface(SDL_SWSURFACE, SCREEN_WIDTH, SCREEN_HEIGHT, 24, 0x00FF0000, 0x0000FF00, 0x000000FF, 0);
381 #else
382   shot_surf = SDL_CreateRGBSurface(SDL_SWSURFACE, SCREEN_WIDTH, SCREEN_HEIGHT, 24, 0x000000FF, 0x0000FF00, 0x00FF0000, 0);
383 #endif
384   if (!shot_surf) {
385     log_warning << "Could not create RGB Surface to contain screenshot" << std::endl;
386     return;
387   }
388
389   // read pixels into array
390   char* pixels = new char[3 * SCREEN_WIDTH * SCREEN_HEIGHT];
391   if (!pixels) {
392     log_warning << "Could not allocate memory to store screenshot" << std::endl;
393     SDL_FreeSurface(shot_surf);
394     return;
395   }
396   glPixelStorei(GL_PACK_ALIGNMENT, 1);
397   glReadPixels(0, 0, SCREEN_WIDTH, SCREEN_HEIGHT, GL_RGB, GL_UNSIGNED_BYTE, pixels);
398
399   // copy array line-by-line
400   for (int i = 0; i < SCREEN_HEIGHT; i++) {
401     char* src = pixels + (3 * SCREEN_WIDTH * (SCREEN_HEIGHT - i - 1));
402     if(SDL_MUSTLOCK(shot_surf))
403     {
404       SDL_LockSurface(shot_surf);
405     }
406     char* dst = ((char*)shot_surf->pixels) + i * shot_surf->pitch;
407     memcpy(dst, src, 3 * SCREEN_WIDTH);
408     if(SDL_MUSTLOCK(shot_surf))
409     {
410       SDL_UnlockSurface(shot_surf);
411     }
412   }
413
414   // free array
415   delete[](pixels);
416
417   // save screenshot
418   static const std::string writeDir = PHYSFS_getWriteDir();
419   static const std::string dirSep = PHYSFS_getDirSeparator();
420   static const std::string baseName = "screenshot";
421   static const std::string fileExt = ".bmp";
422   std::string fullFilename;
423   for (int num = 0; num < 1000; num++) {
424     std::ostringstream oss;
425     oss << baseName;
426     oss << std::setw(3) << std::setfill('0') << num;
427     oss << fileExt;
428     std::string fileName = oss.str();
429     fullFilename = writeDir + dirSep + fileName;
430     if (!PHYSFS_exists(fileName.c_str())) {
431       SDL_SaveBMP(shot_surf, fullFilename.c_str());
432       log_debug << "Wrote screenshot to \"" << fullFilename << "\"" << std::endl;
433       SDL_FreeSurface(shot_surf);
434       return;
435     }
436   }
437   log_warning << "Did not save screenshot, because all files up to \"" << fullFilename << "\" already existed" << std::endl;
438   SDL_FreeSurface(shot_surf);
439 }
440
441 void
442 GLRenderer::flip()
443 {
444   assert_gl("drawing");
445   SDL_GL_SwapBuffers();
446 }
447
448 void
449 GLRenderer::resize(int w, int h)
450 {
451   // This causes the screen to go black, which is annoying, but seems
452   // unavoidable with SDL at the moment
453   SDL_SetVideoMode(w, h, 0, SDL_OPENGL | SDL_RESIZABLE);
454
455   g_config->window_size = Size(w, h);
456
457   apply_config();
458 }
459
460 void
461 GLRenderer::apply_config()
462 {    
463   if (false)
464   {
465     log_info << "Applying Config:" 
466              << "\n  Desktop: " << desktop_size.width << "x" << desktop_size.height
467              << "\n  Window:  " << g_config->window_size
468              << "\n  FullRes: " << g_config->fullscreen_size
469              << "\n  Aspect:  " << g_config->aspect_size
470              << "\n  Magnif:  " << g_config->magnification
471              << std::endl;
472   }
473
474   float target_aspect = static_cast<float>(desktop_size.width) / static_cast<float>(desktop_size.height);
475   if (g_config->aspect_size != Size(0, 0))
476   {
477     target_aspect = float(g_config->aspect_size.width) / float(g_config->aspect_size.height);
478   }
479
480   float desktop_aspect = 4.0f / 3.0f; // random default fallback guess
481   if (desktop_size.width != -1 && desktop_size.height != -1)
482   {
483     desktop_aspect = float(desktop_size.width) / float(desktop_size.height);
484   }
485
486   Size screen_size;
487
488   // Get the screen width
489   if (g_config->use_fullscreen)
490   {
491     screen_size = g_config->fullscreen_size;
492     desktop_aspect = float(screen_size.width) / float(screen_size.height);
493   }
494   else
495   {
496     screen_size = g_config->window_size;
497   }
498
499   apply_video_mode(screen_size, g_config->use_fullscreen);
500
501   if (target_aspect > 1.0f)
502   {
503     SCREEN_WIDTH  = static_cast<int>(screen_size.width * (target_aspect / desktop_aspect));
504     SCREEN_HEIGHT = static_cast<int>(screen_size.height);
505   }
506   else
507   {
508     SCREEN_WIDTH  = static_cast<int>(screen_size.width);
509     SCREEN_HEIGHT = static_cast<int>(screen_size.height  * (target_aspect / desktop_aspect));
510   }
511
512   Size max_size(1280, 800);
513   Size min_size(640, 480);
514
515   if (g_config->magnification == 0.0f) // Magic value that means 'minfill'
516   {
517     // This scales SCREEN_WIDTH/SCREEN_HEIGHT so that they never excede
518     // max_size.width/max_size.height resp. min_size.width/min_size.height
519     if (SCREEN_WIDTH > max_size.width || SCREEN_HEIGHT > max_size.height)
520     {
521       float scale1  = float(max_size.width)/SCREEN_WIDTH;
522       float scale2  = float(max_size.height)/SCREEN_HEIGHT;
523       float scale   = (scale1 < scale2) ? scale1 : scale2;
524       SCREEN_WIDTH  = static_cast<int>(SCREEN_WIDTH  * scale);
525       SCREEN_HEIGHT = static_cast<int>(SCREEN_HEIGHT * scale);
526     } 
527     else if (SCREEN_WIDTH < min_size.width || SCREEN_HEIGHT < min_size.height)
528     {
529       float scale1  = float(min_size.width)/SCREEN_WIDTH;
530       float scale2  = float(min_size.height)/SCREEN_HEIGHT;
531       float scale   = (scale1 < scale2) ? scale1 : scale2;
532       SCREEN_WIDTH  = static_cast<int>(SCREEN_WIDTH  * scale);
533       SCREEN_HEIGHT = static_cast<int>(SCREEN_HEIGHT * scale);
534     }
535    
536
537     glViewport(0, 0, screen_size.width, screen_size.height);
538   }
539   else
540   {
541     SCREEN_WIDTH  = static_cast<int>(SCREEN_WIDTH  / g_config->magnification);
542     SCREEN_HEIGHT = static_cast<int>(SCREEN_HEIGHT / g_config->magnification);
543
544     // This works by adding black borders around the screen to limit
545     // SCREEN_WIDTH/SCREEN_HEIGHT to max_size.width/max_size.height
546     Size new_size = screen_size;
547
548     if (SCREEN_WIDTH > max_size.width)
549     {
550       new_size.width = static_cast<int>((float) new_size.width * float(max_size.width)/SCREEN_WIDTH);
551       SCREEN_WIDTH = static_cast<int>(max_size.width);
552     }
553
554     if (SCREEN_HEIGHT > max_size.height)
555     {
556       new_size.height = static_cast<int>((float) new_size.height * float(max_size.height)/SCREEN_HEIGHT);
557       SCREEN_HEIGHT = static_cast<int>(max_size.height);
558     }
559
560     // Clear both buffers so that we get a clean black border without junk
561     glClear(GL_COLOR_BUFFER_BIT);
562     SDL_GL_SwapBuffers();
563     glClear(GL_COLOR_BUFFER_BIT);
564     SDL_GL_SwapBuffers();
565
566     glViewport(std::max(0, (screen_size.width  - new_size.width)  / 2),
567                std::max(0, (screen_size.height - new_size.height) / 2),
568                std::min(new_size.width,  screen_size.width),
569                std::min(new_size.height, screen_size.height));
570   }
571
572   glMatrixMode(GL_PROJECTION);
573   glLoadIdentity();
574
575   glOrtho(0, SCREEN_WIDTH, SCREEN_HEIGHT, 0, -1, 1);
576
577   glMatrixMode(GL_MODELVIEW);
578   glLoadIdentity();
579   glTranslatef(0, 0, 0);
580   check_gl_error("Setting up view matrices");
581 }
582
583 void
584 GLRenderer::apply_video_mode(const Size& size, bool fullscreen)
585 {
586   // Only change video mode when its different from the current one
587   if (screen_size != size || fullscreen_active != fullscreen)
588   {
589     int flags = SDL_OPENGL;
590
591     if (fullscreen)
592     {
593       flags |= SDL_FULLSCREEN;
594     }
595     else
596     {
597       flags |= SDL_RESIZABLE;
598     }
599
600     if (SDL_Surface *screen = SDL_SetVideoMode(size.width, size.height, 0, flags))
601     {
602       screen_size = Size(screen->w, screen->h);
603       fullscreen_active = fullscreen; 
604     }
605     else
606     {
607       std::ostringstream msg;
608       msg << "Couldn't set video mode " << size.width << "x" << size.height << ": " << SDL_GetError();
609       throw std::runtime_error(msg.str());
610     }
611   }
612 }
613
614 /* EOF */