/usr/include/OGRE/OgreShadowVolumeExtrudeProgram.h is in libogre-dev 1.7.4+dfsg1-7.
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 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 | /*
-----------------------------------------------------------------------------
This source file is part of OGRE
(Object-oriented Graphics Rendering Engine)
For the latest info, see http://www.ogre3d.org/
Copyright (c) 2000-2011 Torus Knot Software Ltd
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
-----------------------------------------------------------------------------
*/
#ifndef __SHADOWVOLUMEEXTRUDEPROGRAM_H__
#define __SHADOWVOLUMEEXTRUDEPROGRAM_H__
#include "OgrePrerequisites.h"
#include "OgreLight.h"
namespace Ogre {
/** \addtogroup Core
* @{
*/
/** \addtogroup Scene
* @{
*/
/** Static class containing source for vertex programs for extruding shadow volumes
@remarks
This exists so we don't have to be dependent on an external media files.
Assembler is used so we don't have to rely on particular plugins.
The assembler contents of this file were generated from the following Cg:
@code
// Point light shadow volume extrude
void shadowVolumeExtrudePointLight_vp (
float4 position : POSITION,
float wcoord : TEXCOORD0,
out float4 oPosition : POSITION,
uniform float4x4 worldViewProjMatrix,
uniform float4 lightPos // homogeneous, object space
)
{
// extrusion in object space
// vertex unmodified if w==1, extruded if w==0
float4 newpos =
(wcoord.xxxx * lightPos) +
float4(position.xyz - lightPos.xyz, 0);
oPosition = mul(worldViewProjMatrix, newpos);
}
// Directional light extrude
void shadowVolumeExtrudeDirLight_vp (
float4 position : POSITION,
float wcoord : TEXCOORD0,
out float4 oPosition : POSITION,
uniform float4x4 worldViewProjMatrix,
uniform float4 lightPos // homogenous, object space
)
{
// extrusion in object space
// vertex unmodified if w==1, extruded if w==0
float4 newpos =
(wcoord.xxxx * (position + lightPos)) - lightPos;
oPosition = mul(worldViewProjMatrix, newpos);
}
// Point light shadow volume extrude - FINITE
void shadowVolumeExtrudePointLightFinite_vp (
float4 position : POSITION,
float wcoord : TEXCOORD0,
out float4 oPosition : POSITION,
uniform float4x4 worldViewProjMatrix,
uniform float4 lightPos, // homogeneous, object space
uniform float extrusionDistance // how far to extrude
)
{
// extrusion in object space
// vertex unmodified if w==1, extruded if w==0
float3 extrusionDir = position.xyz - lightPos.xyz;
extrusionDir = normalize(extrusionDir);
float4 newpos = float4(position.xyz +
((1 - wcoord.x) * extrusionDistance * extrusionDir), 1);
oPosition = mul(worldViewProjMatrix, newpos);
}
// Directional light extrude - FINITE
void shadowVolumeExtrudeDirLightFinite_vp (
float4 position : POSITION,
float wcoord : TEXCOORD0,
out float4 oPosition : POSITION,
uniform float4x4 worldViewProjMatrix,
uniform float4 lightPos, // homogeneous, object space
uniform float extrusionDistance // how far to extrude
)
{
// extrusion in object space
// vertex unmodified if w==1, extruded if w==0
// -ve lightPos is direction
float4 newpos = float4(position.xyz -
(wcoord.x * extrusionDistance * lightPos.xyz), 1);
oPosition = mul(worldViewProjMatrix, newpos);
}
@endcode
*/
class _OgreExport ShadowVolumeExtrudeProgram : public ShadowDataAlloc
{
private:
static String mPointArbvp1;
static String mPointVs_1_1;
static String mPointVs_4_0;
static String mDirArbvp1;
static String mDirVs_1_1;
static String mDirVs_4_0;
// same as above, except the color is set to 1 to enable debug volumes to be seen
static String mPointArbvp1Debug;
static String mPointVs_1_1Debug;
static String mPointVs_4_0Debug;
static String mDirArbvp1Debug;
static String mDirVs_1_1Debug;
static String mDirVs_4_0Debug;
static String mPointArbvp1Finite;
static String mPointVs_1_1Finite;
static String mPointVs_4_0Finite;
static String mDirArbvp1Finite;
static String mDirVs_1_1Finite;
static String mDirVs_4_0Finite;
// same as above, except the color is set to 1 to enable debug volumes to be seen
static String mPointArbvp1FiniteDebug;
static String mPointVs_1_1FiniteDebug;
static String mPointVs_4_0FiniteDebug;
static String mDirArbvp1FiniteDebug;
static String mDirVs_1_1FiniteDebug;
static String mDirVs_4_0FiniteDebug;
static String mGeneralFs_4_0;
static bool mInitialised;
public:
#define OGRE_NUM_SHADOW_EXTRUDER_PROGRAMS 8
enum Programs
{
// Point light extruder, infinite distance
POINT_LIGHT = 0,
// Point light extruder, infinite distance, debug mode
POINT_LIGHT_DEBUG = 1,
// Directional light extruder, infinite distance
DIRECTIONAL_LIGHT = 2,
// Directional light extruder, infinite distance, debug mode
DIRECTIONAL_LIGHT_DEBUG = 3,
// Point light extruder, finite distance
POINT_LIGHT_FINITE = 4,
// Point light extruder, finite distance, debug mode
POINT_LIGHT_FINITE_DEBUG = 5,
// Directional light extruder, finite distance
DIRECTIONAL_LIGHT_FINITE = 6,
// Directional light extruder, finite distance, debug mode
DIRECTIONAL_LIGHT_FINITE_DEBUG = 7
};
static const String programNames[OGRE_NUM_SHADOW_EXTRUDER_PROGRAMS];
static String frgProgramName;
/// Initialise the creation of these vertex programs
static void initialise(void);
/// Shutdown & destroy the vertex programs
static void shutdown(void);
/// Get extruder program source for point lights, compatible with arbvp1
static const String& getPointLightExtruderArbvp1(void) { return mPointArbvp1; }
/// Get extruder program source for point lights, compatible with vs_1_1
static const String& getPointLightExtruderVs_1_1(void) { return mPointVs_1_1; }
/// Get extruder program source for point lights, compatible with vs_4_0
static const String& getPointLightExtruderVs_4_0(void) { return mPointVs_4_0; }
/// Get extruder program source for directional lights, compatible with arbvp1
static const String& getDirectionalLightExtruderArbvp1(void) { return mDirArbvp1; }
/// Get extruder program source for directional lights, compatible with vs_1_1
static const String& getDirectionalLightExtruderVs_1_1(void) { return mDirVs_1_1; }
/// Get extruder program source for directional lights, compatible with vs_4_0
static const String& getDirectionalLightExtruderVs_4_0(void) { return mDirVs_4_0; }
/// Get extruder program source for debug point lights, compatible with arbvp1
static const String& getPointLightExtruderArbvp1Debug(void) { return mPointArbvp1Debug; }
/// Get extruder program source for debug point lights, compatible with vs_1_1
static const String& getPointLightExtruderVs_1_1Debug(void) { return mPointVs_1_1Debug; }
/// Get extruder program source for debug point lights, compatible with vs_4_0
static const String& getPointLightExtruderVs_4_0Debug(void) { return mPointVs_4_0Debug; }
/// Get extruder program source for debug directional lights, compatible with arbvp1
static const String& getDirectionalLightExtruderArbvp1Debug(void) { return mDirArbvp1Debug; }
/// Get extruder program source for debug directional lights, compatible with vs_1_1
static const String& getDirectionalLightExtruderVs_1_1Debug(void) { return mDirVs_1_1Debug; }
/// Get extruder program source for debug directional lights, compatible with vs_4_0
static const String& getDirectionalLightExtruderVs_4_0Debug(void) { return mDirVs_4_0Debug; }
/// General purpose method to get any of the program sources
static const String& getProgramSource(Light::LightTypes lightType, const String syntax,
bool finite, bool debug);
static const String& getProgramName(Light::LightTypes lightType, bool finite, bool debug);
/// Get FINITE extruder program source for point lights, compatible with arbvp1
static const String& getPointLightExtruderArbvp1Finite(void) { return mPointArbvp1Finite; }
/// Get FINITE extruder program source for point lights, compatible with vs_1_1
static const String& getPointLightExtruderVs_1_1Finite(void) { return mPointVs_1_1Finite; }
/// Get FINITE extruder program source for point lights, compatible with vs_4_0
static const String& getPointLightExtruderVs_4_0Finite(void) { return mPointVs_4_0Finite; }
/// Get FINITE extruder program source for directional lights, compatible with arbvp1
static const String& getDirectionalLightExtruderArbvp1Finite(void) { return mDirArbvp1Finite; }
/// Get FINITE extruder program source for directional lights, compatible with vs_1_1
static const String& getDirectionalLightExtruderVs_1_1Finite(void) { return mDirVs_1_1Finite; }
/// Get FINITE extruder program source for directional lights, compatible with vs_4_0
static const String& getDirectionalLightExtruderVs_4_0Finite(void) { return mDirVs_4_0Finite; }
/// Get FINITE extruder program source for debug point lights, compatible with arbvp1
static const String& getPointLightExtruderArbvp1FiniteDebug(void) { return mPointArbvp1FiniteDebug; }
/// Get extruder program source for debug point lights, compatible with vs_1_1
static const String& getPointLightExtruderVs_1_1FiniteDebug(void) { return mPointVs_1_1FiniteDebug; }
/// Get extruder program source for debug point lights, compatible with vs_4_0
static const String& getPointLightExtruderVs_4_0FiniteDebug(void) { return mPointVs_4_0FiniteDebug; }
/// Get FINITE extruder program source for debug directional lights, compatible with arbvp1
static const String& getDirectionalLightExtruderArbvp1FiniteDebug(void) { return mDirArbvp1FiniteDebug; }
/// Get FINITE extruder program source for debug directional lights, compatible with vs_1_1
static const String& getDirectionalLightExtruderVs_1_1FiniteDebug(void) { return mDirVs_1_1FiniteDebug; }
/// Get FINITE extruder program source for debug directional lights, compatible with vs_4_0
static const String& getDirectionalLightExtruderVs_4_0FiniteDebug(void) { return mDirVs_4_0FiniteDebug; }
};
/** @} */
/** @} */
}
#endif
|