/usr/share/openwalnut/shaders/WGETextureTools.glsl is in libopenwalnut1 1.2.5-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 | //---------------------------------------------------------------------------
//
// Project: OpenWalnut ( http://www.openwalnut.org )
//
// Copyright 2009 OpenWalnut Community, BSV@Uni-Leipzig and CNCF@MPI-CBS
// For more information see http://www.openwalnut.org/copying
//
// This file is part of OpenWalnut.
//
// OpenWalnut is free software: you can redistribute it and/or modify
// it under the terms of the GNU Lesser General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// OpenWalnut is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public License
// along with OpenWalnut. If not, see <http://www.gnu.org/licenses/>.
//
//---------------------------------------------------------------------------
#ifndef WGETEXTURETOOLS_GLSL
#define WGETEXTURETOOLS_GLSL
#version 120
#include "WGEUtils.glsl"
/**
* Grabs and unscales the value inside the texture and returns it.
*
* \param texture the texture unit to use
* \param point the texture coordinates
* \param minimum the minumum value of all values inside the texture
* \param scale the scaling value for all values inside the texture
*
* \note The minimum and scale values are normally transferred to the shader using uniforms, as the CPU scales the textures
*
* \return the value at the given point
*/
vec4 texture3DUnscaled( sampler3D texture, vec3 point, float minimum, float scale )
{
return ( scale * texture3D( texture, point ) ) + vec4( minimum );
}
/**
* Grabs and unscales the value inside the texture and returns it.
*
* \param texture the texture unit to use
* \param point the texture coordinates
* \param minimum the minumum value of all values inside the texture
* \param scale the scaling value for all values inside the texture
*
* \note The minimum and scale values are normally transferred to the shader using uniforms, as the CPU scales the textures
*
* \return the value at the given point
*/
vec4 texture2DUnscaled( sampler2D texture, vec2 point, float minimum, float scale )
{
return ( scale * texture2D( texture, point ) ) + vec4( minimum );
}
/**
* Grabs and unscales the value inside the texture and returns it.
*
* \param texture the texture unit to use
* \param point the texture coordinates
* \param minimum the minumum value of all values inside the texture
* \param scale the scaling value for all values inside the texture
*
* \note The minimum and scale values are normally transferred to the shader using uniforms, as the CPU scales the textures
*
* \return the value at the given point
*/
vec4 texture1DUnscaled( sampler1D texture, float point, float minimum, float scale )
{
return ( scale * texture1D( texture, point ) ) + vec4( minimum );
}
/**
* This method normalizes a given point/vector in a special way. It scales it so that the largest component is exactly 1.
* This way the other components can profit from the whole precision in textures (where all values are clamped if >1).
*
* \param point the point to scale
*
* \return the scaled point, where max( { point.x, point.y, point.z, point.w } ) = 1
*/
vec4 textureNormalize( vec4 point )
{
return 0.5 + ( 0.5 * scaleMaxToOne( point ) );
}
/**
* This method normalizes a given point/vector in a special way. It scales it so that the largest component is exactly 1.
* This way the other components can profit from the whole precision in textures (where all values are clamped if >1).
*
* \param point the point to scale
*
* \return the scaled point, where max( { point.x, point.y, point.z } ) = 1
*/
vec3 textureNormalize( vec3 point )
{
return 0.5 + ( 0.5 * scaleMaxToOne( point ) );
}
/**
* This method normalizes a given point/vector in a special way. It scales it so that the largest component is exactly 1.
* This way the other components can profit from the whole precision in textures (where all values are clamped if >1).
*
* \param point the point to scale
*
* \return the scaled point, where max( { point.x, point.y, point.z } ) = 1
*/
vec2 textureNormalize( vec2 point )
{
return 0.5 + ( 0.5 * scaleMaxToOne( point ) );
}
#endif // WGETEXTURETOOLS_GLSL
|