Clone of Bael'Zharon's Respite @ https://github.com/boardwalk/bzr

Renderer.h 2.0KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  1. /*
  2. * Bael'Zharon's Respite
  3. * Copyright (C) 2014 Daniel Skorupski
  4. *
  5. * This program is free software; you can redistribute it and/or modify
  6. * it under the terms of the GNU General Public License as published by
  7. * the Free Software Foundation; either version 2 of the License, or
  8. * (at your option) any later version.
  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 along
  15. * with this program; if not, write to the Free Software Foundation, Inc.,
  16. * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
  17. */
  18. #ifndef BZR_GRAPHICS_RENDERER_H
  19. #define BZR_GRAPHICS_RENDERER_H
  20. #include "Noncopyable.h"
  21. #ifdef OCULUSVR
  22. #include <OVR_CAPI.h>
  23. #include <OVR_CAPI_GL.h>
  24. #endif
  25. class LandRenderer;
  26. class ModelRenderer;
  27. class SkyRenderer;
  28. class StructureRenderer;
  29. class Renderer : Noncopyable
  30. {
  31. public:
  32. Renderer();
  33. ~Renderer();
  34. void init();
  35. void render(fp_t interp);
  36. GLenum textureMinFilter() const;
  37. GLfloat textureMaxAnisotropy() const;
  38. bool renderHitGeometry() const;
  39. private:
  40. void createWindow();
  41. #ifdef OCULUSVR
  42. void initOVR();
  43. void cleanupOVR();
  44. void renderOVR(fp_t interp);
  45. #endif
  46. fp_t fieldOfView_;
  47. GLenum textureMinFilter_;
  48. GLfloat textureMaxAnisotropy_;
  49. bool renderHitGeometry_;
  50. bool videoInit_;
  51. SDL_Window* window_;
  52. SDL_GLContext context_;
  53. #ifdef OCULUSVR
  54. ovrHmd hmd_;
  55. ovrSizei renderTexSize_;
  56. ovrRecti eyeViewport_[ovrEye_Count];
  57. ovrGLTexture eyeTexture_[ovrEye_Count];
  58. ovrEyeRenderDesc eyeRenderDesc_[ovrEye_Count];
  59. GLuint renderTex_;
  60. GLuint depthTex_;
  61. GLuint framebuffer_;
  62. #endif
  63. unique_ptr<SkyRenderer> skyRenderer_;
  64. unique_ptr<LandRenderer> landRenderer_;
  65. unique_ptr<StructureRenderer> structureRenderer_;
  66. unique_ptr<ModelRenderer> modelRenderer_;
  67. };
  68. #endif