1 // $Id: gl_surface_data.hpp 4063 2006-07-21 21:05:23Z anmaster $
4 // Copyright (C) 2006 Matthias Braun <matze@braunis.de>
6 // This program is free software; you can redistribute it and/or
7 // modify it under the terms of the GNU General Public License
8 // as published by the Free Software Foundation; either version 2
9 // of the License, or (at your option) any later version.
11 // This program is distributed in the hope that it will be useful,
12 // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 // GNU General Public License for more details.
16 // You should have received a copy of the GNU General Public License
17 // along with this program; if not, write to the Free Software
18 // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
23 #ifndef __GL_SURFACE_DATA_HPP__
24 #define __GL_SURFACE_DATA_HPP__
26 #include "surface.hpp"
33 const Surface &surface;
40 SurfaceData(const Surface &surface) :
43 uv_left = (float) surface.get_x() / surface.get_texture()->get_texture_width();
44 uv_top = (float) surface.get_y() / surface.get_texture()->get_texture_height();
45 uv_right = (float) (surface.get_x() + surface.get_width()) / surface.get_texture()->get_texture_width();
46 uv_bottom = (float) (surface.get_y() + surface.get_height()) / surface.get_texture()->get_texture_height();
49 float get_uv_left() const
51 return surface.get_flipx() ? uv_right : uv_left;
54 float get_uv_top() const
59 float get_uv_right() const
61 return surface.get_flipx() ? uv_left : uv_right;
64 float get_uv_bottom() const