home *** CD-ROM | disk | FTP | other *** search
/ Hackers Magazine 57 / CdHackersMagazineNr57.iso / Software / Multimedia / k3d-setup-0.7.11.0.exe / include / k3d / k3dsdk / render_state_gl.h < prev    next >
C/C++ Source or Header  |  2008-11-07  |  3KB  |  98 lines

  1. #ifndef K3DSDK_RENDER_STATE_GL_H
  2. #define K3DSDK_RENDER_STATE_GL_H
  3.  
  4. // K-3D
  5. // Copyright (c) 1995-2006, Timothy M. Shead
  6. //
  7. // Contact: tshead@k-3d.com
  8. //
  9. // This program is free software; you can redistribute it and/or
  10. // modify it under the terms of the GNU General Public
  11. // License as published by the Free Software Foundation; either
  12. // version 2 of the License, or (at your option) any later version.
  13. //
  14. // This program is distributed in the hope that it will be useful,
  15. // but WITHOUT ANY WARRANTY; without even the implied warranty of
  16. // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  17. // General Public License for more details.
  18. //
  19. // You should have received a copy of the GNU General Public
  20. // License along with this program; if not, write to the Free Software
  21. // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
  22.  
  23. /** \file
  24.     \author Tim Shead (tshead@k-3d.com)
  25. */
  26.  
  27. #include "gl.h"
  28.  
  29. namespace k3d
  30. {
  31.  
  32. class icamera;
  33.  
  34. namespace gl
  35. {
  36.  
  37. /// Used to pass (potentially) useful rendering state from the engine to the object being rendered
  38. class render_state
  39. {
  40. public:
  41.     render_state(icamera& Camera) :
  42.         camera(Camera),
  43.         orthographic(false),
  44.         draw_two_sided(true)
  45.     {
  46.     }
  47.  
  48.     /// Stores the camera used for drawing
  49.     icamera& camera;
  50.  
  51.     /// Set to true iff the OpenGL viewing frustum used for drawing is orthographic
  52.     bool orthographic;
  53.     
  54.     bool draw_two_sided;
  55.     
  56.     //@{
  57.     /** Stores the OpenGL viewing frustum used for drawing (perspective or orthographic).
  58.      * Note: these are the actual values passed to glFrustum() or glOrtho() to fill the
  59.      * render window, in general they will be different from the viewing frustum defined
  60.      * by the camera for rendering. */
  61.     double gl_window_frustum_left;
  62.     double gl_window_frustum_right;
  63.     double gl_window_frustum_top;
  64.     double gl_window_frustum_bottom;
  65.     double gl_window_frustum_near;
  66.     double gl_window_frustum_far;
  67.     //@}
  68.     
  69.     //@{
  70.     /** Stores an imaginary OpenGL viewing frustum that represents the viewing frustum
  71.      * defined by the camera for rendering.  Note that the values may not be the same
  72.      * as those returned by the camera object.  */
  73.     double gl_camera_frustum_left;
  74.     double gl_camera_frustum_right;
  75.     double gl_camera_frustum_top;
  76.     double gl_camera_frustum_bottom;
  77.     double gl_camera_frustum_near;
  78.     double gl_camera_frustum_far;
  79.     //@}
  80.  
  81.     /// Stores the current OpenGL projection matrix
  82.     float gl_projection_matrix[16];
  83.     /// Stores the current OpenGL viewport
  84.     GLint gl_viewport[4];
  85.     
  86.     /// Stores the selection state of the calling node
  87.     double node_selection;
  88.     /// Stores the selection state of the parent of the calling node
  89.     double parent_selection;
  90. };
  91.  
  92. } // namespace gl
  93.  
  94. } // namespace k3d
  95.  
  96. #endif // !K3DSDK_RENDER_STATE_GL_H
  97.  
  98.