00001 /* 00002 RenderStack Support library for OpenGL 3+ 00003 Copyright (C) 2010 Timo Suoranta 00004 00005 This library is free software; you can redistribute it and/or 00006 modify it under the terms of the GNU Lesser General Public 00007 License as published by the Free Software Foundation; either 00008 version 2.1 of the License, or (at your option) any later version. 00009 00010 This library is distributed in the hope that it will be useful, 00011 but WITHOUT ANY WARRANTY; without even the implied warranty of 00012 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00013 Lesser General Public License for more details. 00014 00015 You should have received a copy of the GNU Lesser General Public 00016 License along with this library; if not, write to the Free Software 00017 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 00018 */ 00019 00027 #ifndef FRAME_HPP 00028 #define FRAME_HPP 00029 00030 #include "renderstack/rs.h" 00031 #include "renderstack/matrix.hpp" 00032 #include "renderstack/uniform_bindings.hpp" 00033 00034 namespace renderstack { 00035 00037 class frame 00038 : public uniform_source 00039 { 00040 public: 00041 frame(); 00042 00043 void translate_in_world(vec3 const &v); 00044 void rotate_in_world (vec3 const &axis, float angle_radians); 00045 void set_hpb_xyz (vec3 const &hpb, vec3 const &xyz); 00046 00047 matrix &local_to_world(){ return m_local_to_world; } 00048 matrix &world_to_local(){ return m_world_to_local; } 00049 matrix const &local_to_world() const { return m_local_to_world; } 00050 matrix const &world_to_local() const { return m_world_to_local; } 00051 00052 vec3 position_in_world(){ return m_local_to_world.column3(3); } 00053 00054 public: 00055 bool connect(uniform_bindings &bindings, enum logical_uniform uniform, int slot); 00056 00057 public: 00058 static class frame identity; 00059 00060 private: 00061 matrix m_local_to_world; 00062 matrix m_world_to_local; 00063 }; 00064 00065 } 00066 00067 #endif 00068