SCM Library
Spherical Cube Map rendering library
 All Classes Files Functions Variables Friends Pages
scm-render.hpp
1 // Copyright (C) 2011-2012 Robert Kooima
2 //
3 // LIBSCM is free software; you can redistribute it and/or modify it under the
4 // terms of the GNU General Public License as published by the Free Software
5 // Foundation; either version 2 of the License, or (at your option) any later
6 // version.
7 //
8 // This program is distributed in the hope that it will be useful, but WITH-
9 // OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
10 // FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
11 // more details.
12 
13 #ifndef SCM_RENDER_HPP
14 #define SCM_RENDER_HPP
15 
16 #include <GL/glew.h>
17 
18 #include "util3d/glsl.h"
19 
20 //------------------------------------------------------------------------------
21 
22 class scm_sphere;
23 class scm_scene;
24 class scm_frame;
25 
26 //------------------------------------------------------------------------------
27 
38 
40 {
41 public:
42 
43  scm_render(int, int);
44  ~scm_render();
45 
46  void set_size(int, int);
47  void set_blur(int);
48  void set_wire(bool);
49 
50  int get_blur() const { return blur; }
51  bool get_wire() const { return wire; }
52 
53  void render(scm_sphere *,
54  scm_scene *,
55  scm_scene *,
56  scm_scene *,
57  scm_scene *,
58  const double *,
59  const double *, int, int, double);
60  void render(scm_sphere *,
61  scm_scene *,
62  scm_scene *,
63  const double *,
64  const double *, int, int);
65 
66 private:
67 
68  bool check_fade(scm_scene *, scm_scene *, scm_scene *, scm_scene *, double);
69  bool check_blur(const double *, const double *, double *, GLfloat *);
70 
71  void init_uniforms(GLuint);
72  void init_matrices();
73  void init_ogl();
74  void free_ogl();
75 
76  int width;
77  int height;
78  int blur;
79  bool wire;
80 
81  scm_frame *frame0;
82  scm_frame *frame1;
83 
84  double A[16];
85  double B[16];
86  double C[16];
87  double D[16];
88 
89  double previous_T[16][16];
90 
91  glsl render_fade;
92  glsl render_blur;
93  glsl render_both;
94 
95  GLint uniform_fade_t, uniform_both_t;
96  GLint uniform_blur_T, uniform_both_T;
97  GLint uniform_blur_n, uniform_both_n;
98 };
99 
100 
101 //------------------------------------------------------------------------------
102 
103 #endif
~scm_render()
Finalize all OpenGL state.
Definition: scm-render.cpp:55
An scm_render manages the rendering of background and foreground spheres.
Definition: scm-render.hpp:39
An scm_scene encapsulates the definition of a sphere and its parameters.
Definition: scm-scene.hpp:40
An scm_sphere generates the adaptive rendered geometry of the 3D sphere.
Definition: scm-sphere.hpp:30
An scm_frame abstracts the OpenGL framebuffer object.
Definition: scm-frame.hpp:22
void set_size(int, int)
Set the size of the off-screen render targets. This entails the destruction and recreation of OpenGL ...
Definition: scm-render.cpp:66
scm_render(int, int)
Create a new render manager. Initialize the necessary OpenGL state framebuffer object state...
Definition: scm-render.cpp:43
void set_blur(int)
Set the motion blur degree. Higher degrees incur greater rendering loads. 8 is an effective value...
Definition: scm-render.cpp:78
void set_wire(bool)
Set the wireframe option.
Definition: scm-render.cpp:85
void render(scm_sphere *, scm_scene *, scm_scene *, scm_scene *, scm_scene *, const double *, const double *, int, int, double)
Render the foreground and background with optional blur and dissolve.
Definition: scm-render.cpp:105