SCIRun  5.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
SRCommonUniforms.h
Go to the documentation of this file.
1 /*
2  For more information, please see: http://software.sci.utah.edu
3 
4  The MIT License
5 
6  Copyright (c) 2013 Scientific Computing and Imaging Institute,
7  University of Utah.
8 
9 
10  Permission is hereby granted, free of charge, to any person obtaining a
11  copy of this software and associated documentation files (the "Software"),
12  to deal in the Software without restriction, including without limitation
13  the rights to use, copy, modify, merge, publish, distribute, sublicense,
14  and/or sell copies of the Software, and to permit persons to whom the
15  Software is furnished to do so, subject to the following conditions:
16 
17  The above copyright notice and this permission notice shall be included
18  in all copies or substantial portions of the Software.
19 
20  THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
21  OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
22  FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
23  THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
24  LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
25  FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
26  DEALINGS IN THE SOFTWARE.
27 */
28 
29 /// \author James Hughes
30 /// \date March 2013
31 
32 #ifndef SPIRE_APPSPECIFIC_SCIRUN_SRCOMMONUNIFORMS_H
33 #define SPIRE_APPSPECIFIC_SCIRUN_SRCOMMONUNIFORMS_H
34 
35 #include <tuple>
36 
38 
39 #include "spire/src/ShaderUniformStateManTemplates.h"
40 
41 namespace SCIRun {
42 namespace Gui {
43 
44 /// Common uniforms used by Spire.
45 /// \todo Look into the ability to rename these uniforms in the future. This is
46 /// so that Spire can adapt to other code bases.
48 {
49 public:
51  virtual ~SRCommonUniforms() {}
52 
53  //----------------------------------------------------------------------------
54  // Camera Uniforms (View)
55  //----------------------------------------------------------------------------
56 
57  /// Inverse view to world matrix.
58  static std::string getToCameraToProjectionName() {return "uProjIV";}
59  static spire::UNIFORM_TYPE getToCameraToProjectionType() {return spire::UNIFORM_FLOAT_MAT4;}
60 
61  /// Projection matrix.
62  static std::string getToProjectionName() {return "uProj";}
63  static spire::UNIFORM_TYPE getToProjectionType() {return spire::UNIFORM_FLOAT_MAT4;}
64 
65  /// View to world.
66  static std::string getCameraToWorldName() {return "uView";}
67  static spire::UNIFORM_TYPE getCameraToWorldType() {return spire::UNIFORM_FLOAT_MAT4;}
68 
69  /// Viewing vector for the camera (used in lighting calculations).
70  /// Depends on the projection matrix -- in world space.
71  static std::string getCameraViewVecName() {return "uCamViewVec";}
72  static spire::UNIFORM_TYPE getCameraViewVecType() {return spire::UNIFORM_FLOAT_VEC3;}
73 
74  /// 'Up' vector for the camera -- in world space.
75  static std::string getCameraUpVecName() {return "uCamUp";}
76  static spire::UNIFORM_TYPE getCameraUpVecType() {return spire::UNIFORM_FLOAT_VEC3;}
77 
78  //----------------------------------------------------------------------------
79  // Object and Combined Object/Camera Uniforms
80  //----------------------------------------------------------------------------
81  /// Object -> World -> Camera -> Projection
82  static std::string getObjectToCameraToProjectionName() {return "uProjIVObject";}
83  static spire::UNIFORM_TYPE getObjectToCameraToProjectionType() {return spire::UNIFORM_FLOAT_MAT4;}
84 
85  /// Object -> World to view transformation.
86  static std::string getObjectToViewName() {return "uViewObject";}
87  static spire::UNIFORM_TYPE getObjectToViewType() {return spire::UNIFORM_FLOAT_MAT4;}
88 
89  /// Object -> World transformformation.
90  static std::string getObjectName() {return "uObject";}
91  static spire::UNIFORM_TYPE getObjectType() {return spire::UNIFORM_FLOAT_MAT4;}
92 
93 };
94 
95 } // namespace Gui
96 } // namespace SCIRun
97 
98 #endif
SRCommonUniforms()
Definition: SRCommonUniforms.h:50
static spire::UNIFORM_TYPE getCameraToWorldType()
Definition: SRCommonUniforms.h:67
static spire::UNIFORM_TYPE getCameraViewVecType()
Definition: SRCommonUniforms.h:72
static spire::UNIFORM_TYPE getObjectToViewType()
Definition: SRCommonUniforms.h:87
static std::string getCameraUpVecName()
&#39;Up&#39; vector for the camera – in world space.
Definition: SRCommonUniforms.h:75
Definition: SRCommonUniforms.h:47
static std::string getToProjectionName()
Projection matrix.
Definition: SRCommonUniforms.h:62
virtual ~SRCommonUniforms()
Definition: SRCommonUniforms.h:51
static std::string getCameraViewVecName()
Definition: SRCommonUniforms.h:71
static spire::UNIFORM_TYPE getToProjectionType()
Definition: SRCommonUniforms.h:63
static std::string getObjectToViewName()
Object -&gt; World to view transformation.
Definition: SRCommonUniforms.h:86
static spire::UNIFORM_TYPE getCameraUpVecType()
Definition: SRCommonUniforms.h:76
static std::string getObjectToCameraToProjectionName()
Object -&gt; World -&gt; Camera -&gt; Projection.
Definition: SRCommonUniforms.h:82
static std::string getObjectName()
Object -&gt; World transformformation.
Definition: SRCommonUniforms.h:90
static std::string getCameraToWorldName()
View to world.
Definition: SRCommonUniforms.h:66
static spire::UNIFORM_TYPE getToCameraToProjectionType()
Definition: SRCommonUniforms.h:59
static std::string getToCameraToProjectionName()
Inverse view to world matrix.
Definition: SRCommonUniforms.h:58
static spire::UNIFORM_TYPE getObjectType()
Definition: SRCommonUniforms.h:91
static spire::UNIFORM_TYPE getObjectToCameraToProjectionType()
Definition: SRCommonUniforms.h:83