1 /***********************************************************************
2 ElevationColorMap - Class to represent elevation color maps for
4 Copyright (c) 2014-2016 Oliver Kreylos
6 This file is part of the Augmented Reality Sandbox (SARndbox).
8 The Augmented Reality Sandbox is free software; you can redistribute it
9 and/or modify it under the terms of the GNU General Public License as
10 published by the Free Software Foundation; either version 2 of the
11 License, or (at your option) any later version.
13 The Augmented Reality Sandbox is distributed in the hope that it will be
14 useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 General Public License for more details.
18 You should have received a copy of the GNU General Public License along
19 with the Augmented Reality Sandbox; if not, write to the Free Software
20 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
21 ***********************************************************************/
23 #ifndef ELEVATIONCOLORMAP_INCLUDED
24 #define ELEVATIONCOLORMAP_INCLUDED
27 #include <GL/GLColorMap.h>
28 #include <GL/GLTextureObject.h>
32 /* Forward declarations: */
33 class DepthImageRenderer
;
35 class ElevationColorMap
: public GLColorMap
, public GLTextureObject
{
38 GLfloat texturePlaneEq
[4]; // Texture mapping plane equation in GLSL-compatible format
40 /* Constructors and destructors: */
42 ElevationColorMap(const char*
43 heightMapName
); // Creates an elevation color map by loading the given height map file
45 /* Methods from GLObject: */
46 virtual void initContext(GLContextData
& contextData
) const;
50 heightMapName
); // Overrides elevation color map by loading the given height map file
51 void calcTexturePlane(const Plane
&
52 basePlane
); // Calculates the texture mapping plane for the given base plane equation
53 void calcTexturePlane(const DepthImageRenderer
*
54 depthImageRenderer
); // Calculates the texture mapping plane for the given depth image renderer
55 void bindTexture(GLContextData
& contextData
)
56 const; // Binds the elevation color map texture object to the currently active texture unit
57 void uploadTexturePlane(GLint location
)
58 const; // Uploads the texture mapping plane equation into the GLSL 4-vector at the given uniform location