This file is indexed.

/usr/include/crystalspace-2.0/ivaria/decal.h is in libcrystalspace-dev 2.0+dfsg-1build1.

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
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
/*
    Crystal Space 3D engine
    Copyright (C) 2000 by Jorrit Tyberghein

    This library is free software; you can redistribute it and/or
    modify it under the terms of the GNU Library General Public
    License as published by the Free Software Foundation; either
    version 2 of the License, or (at your option) any later version.

    This library 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
    Library General Public License for more details.

    You should have received a copy of the GNU Library General Public
    License along with this library; if not, write to the Free
    Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#ifndef __CS_IGEOM_DECAL_H__
#define __CS_IGEOM_DECAL_H__

#include "csutil/scf.h"
#include "csutil/array.h"
#include "ivideo/graph3d.h"
#include "ivideo/rendermesh.h"

struct iSector;
struct iMaterialWrapper;
struct iMeshWrapper;
class csVector3;
class csVector2;
class csPoly3D;
class csColor4;
class csRenderBuffer;

/**\file
 * Decal and Decal manager interfaces
 */

/**
 * \addtogroup geom_utils
 * @{ */

/**\name Decals
 * @{ */
/**
 * A decal created by the iDecalManager. Decals somehow add a piece of geometry projected
 * on a mesh or a group of mesh. It can be used to achieve effects such as bullet holes or
 * shadows under the characters.
 */
struct iDecal
{
};

/**
 * Interface for a decal template which dictates the 
 * appearance of a newly created iDecal.
 */
struct iDecalTemplate : public virtual iBase
{
  SCF_INTERFACE(iDecalTemplate, 2, 0, 0);

  /**
   * Retrieves the time the decal will have to live in seconds before it is 
   * killed.
   *  \return The time to live in seconds.
   */
  virtual float GetTimeToLive () const = 0;

  /**
   * Retrieves the material wrapper to use for this decal.
   *  \return the material wrapper.
   */
  virtual iMaterialWrapper* GetMaterialWrapper () = 0;

  /**
   * Retrieves the rendering priority for this decal
   *  \return the rendering priority.
   */
  virtual CS::Graphics::RenderPriority GetRenderPriority () const = 0;

  /**
   * Retrieves the z-buffer mode for this decal.
   *  \return the z-buffer mode.
   */
  virtual csZBufMode GetZBufMode () const = 0;

  /**
   * Retrieves the polygon normal threshold for this decal.  
   *
   * Values close to 1 will exclude polygons that don't match the decal's 
   * normal closely, and values closer to 0 will be more accepting and allow
   * polygons with a very different normal from the decal's normal.
   *
   * Values between -1 and 0 are acceptable, but will allow polygons that
   * are facing in the opposite direction from the decal to be included.
   *
   *  \return the polygon threshold.
   */
  virtual float GetPolygonNormalThreshold() const = 0;

  /**
   * A decal will be offset a bit from the geometry it wraps around in order
   * to avoid z-buffer fighting issues.
   *
   * The greater this offset is, the less chance there is of z fighting, but
   * if this is too high then the decal will appear to be floating.
   *
   *  \return the decal offset.
   */
  virtual float GetDecalOffset () const = 0;

  /**
   * Determines whether or not this type of decal will have its geometry
   * clipped against a plane above the decal.
   *  \return True if top clipping is enabled.
   */
  virtual bool HasTopClipping () const = 0;

  /**
   * Gets the distance between the decal position and the top clipping plane
   * as a multiple of decal size.
   *  \return The top clipping plane scale.
   */
  virtual float GetTopClippingScale () const = 0;

  /**
   * Determines whether or not this type of decal will have its geometry
   * clipped against a plane below the decal.
   *  \return True if bottom clipping is enabled.
   */
  virtual bool HasBottomClipping () const = 0;

  /**
   * Gets the distance between the decal position and the bottom clipping
   * plane as a multiple of decal size.
   *  \return The bottom clipping plane scale.
   */
  virtual float GetBottomClippingScale () const = 0;
  
  /**
   * The min tex coord is the uv coordinate of the top-left corner of the
   * decal.
   *  \return The min tex coordinate.
   */
  virtual const csVector2& GetMinTexCoord () const = 0;

  /**
   * The main color of the decal.
   *  \return The main color of the decal.
   */
  virtual const csColor4& GetMainColor () const = 0;

  /**
   * The color to give vertices close to the top of the decal.  The color of
   * a vertex between the decal position and the top plane will be interpolated
   * between this color and the main color based on distance from the top plane.
   *  \return The top color of the decal.
   */
  virtual const csColor4& GetTopColor () const = 0;

  /**
   * The color to give vertices close to the bottom of the decal.  The color of
   * a vertex between the decal position and the bottom plane will be interpolated
   * between this color and the main color based on distance from the bottom plane.
   *  \return The top color of the decal.
   */
  virtual const csColor4& GetBottomColor () const = 0;

  /**
   * The max tex coord is the uv coordinate of the bottom-right corner of the
   * decal.
   *  \return The max tex coordinate.
   */
  virtual const csVector2& GetMaxTexCoord () const = 0;

  /**
   * The mixmode of the decal.
   *  \return The mixmode.
   */
  virtual const uint GetMixMode () const = 0;
  
  /**
   * The perpendicular face threshold specifies which faces are considered
   * to be perpendicular in the decal.  Perpendicular faces will be tapered
   * outwards by an amount relative to the perpendicular face offset.
   *  \return The perpendicular face threshold.
   */
  virtual float GetPerpendicularFaceThreshold () const = 0;

  /**
   * The perpendicular face offset specifies how much perpendicular faces in
   * the decal will taper out.  The bottom of the perpendicular face will
   * taper out by the amount given, but the top of the perpendicular face
   * will not taper at all.
   *  \return The perpendicular face offset.
   */
  virtual float GetPerpendicularFaceOffset () const = 0;
      
  /**
   * Sets the time the decal will have to live in seconds before it is 
   * killed.
   *  \param timeToLive	The time to live in seconds.
   */
  virtual void SetTimeToLive (float timeToLive) = 0;
  
  /**
   * Sets the material wrapper to use for this decal.
   *  \param material	The material wrapper of the decal.
   */
  virtual void SetMaterialWrapper (iMaterialWrapper* material) = 0;

  /**
   * Sets the rendering priority for this decal
   *  \param renderPriority	The render priority of the decal.
   */
  virtual void SetRenderPriority (CS::Graphics::RenderPriority renderPriority) = 0;

  /**
   * Sets the z-buffer mode for this decal.
   *  \param mode	The z-buffer mode for the decal.
   */
  virtual void SetZBufMode (csZBufMode mode) = 0;

  /**
   * Sets the polygon normal threshold for this decal.  
   *
   * Values close to 1 will exclude polygons that don't match the decal's 
   * normal closely, and values closer to 0 will be more accepting and allow
   * polygons with a very different normal from the decal's normal.
   *
   * Values between -1 and 0 are acceptable, but will allow polygons that
   * are facing in the opposite direction from the decal to be included.
   *
   *  \param polygonNormalThreshold	The polygon normal threshold.
   */
  virtual void SetPolygonNormalThreshold (float polygonNormalThreshold) = 0;
  
  /**
   * A decal will be offset a bit from the geometry it wraps around in order
   * to avoid z-buffer fighting issues.
   *
   * The greater this offset is, the less chance there is of z fighting, but
   * if this is too high then the decal will appear to be floating.
   *
   *  \param decalOffset	The distance between decal and the geometry.
   */
  virtual void SetDecalOffset (float decalOffset) = 0;

  /**
   * Enables or disables clipping geometry above the decal.
   *   \param enabled		True if top clipping should be enabled.
   *   \param topPlaneScale	The distance from the decal position to the
   *                            top plane as a multiple of decal size.
   */
  virtual void SetTopClipping (bool enabled, float topPlaneScale = 0.0f) = 0;

  /**
   * Enables or disables clipping geometry below the decal.
   *   \param enabled		True if bottom clipping should be enabled.
   *   \param bottomPlaneScale	The distance from the decal position to the
   *                            bottom plane as a multiple of decal size.
   */
  virtual void SetBottomClipping (bool enabled, float bottomPlaneScale) = 0;

  /**
   * The tex coords are the uv coordinate of the top-left and bottom-right 
   * corner of the decal.
   *  \param min	The top-left corner of the decal.
   *  \param max	The bottom-right corner of the decal.
   */
  virtual void SetTexCoords (const csVector2& min, const csVector2& max) = 0;

  /**
   * The mixmode of the decal.
   *  \param mixMode	 The mixmode of the decal.
   */
  virtual void SetMixMode (uint mixMode) = 0;
  
  /**
   * The perpendicular face threshold specifies which faces are considered
   * to be perpendicular in the decal.  Perpendicular faces will be tapered
   * outwards by an amount relative to the perpendicular face offset.
   *  \param threshold The new perpendicular face threshold.
   */
  virtual void SetPerpendicularFaceThreshold (float threshold) = 0;

  /**
   * The perpendicular face offset specifies how much perpendicular faces in
   * the decal will taper out.  The bottom of the perpendicular face will
   * taper out by the amount given, but the top of the perpendicular face
   * will not taper at all.
   *  \param offset The new perpendicular face offset.
   */
  virtual void SetPerpendicularFaceOffset (float offset) = 0;

  /**
  * The main color of the decal.
  *  \param color The main color of the decal.
  */
  virtual void SetMainColor (const csColor4& color) = 0;

  /**
  * The color to give vertices close to the top of the decal.  The color of
  * a vertex between the decal position and the top plane will be interpolated
  * between this color and the main color based on distance from the top plane.
  *  \param color The top color of the decal.
  */
  virtual void SetTopColor (const csColor4& color) = 0;

  /**
  * The color to give vertices close to the bottom of the decal.  The color of
  * a vertex between the decal position and the bottom plane will be interpolated
  * between this color and the main color based on distance from the bottom plane.
  *  \param color The top color of the decal.
  */
  virtual void SetBottomColor (const csColor4& color) = 0;

  /**
   * Set whether or not the decal will do any clipping. This has to be enabled for
   * SetTopClipping() and SetBottomClipping() being used. Default value is true.
   */
  virtual void SetClipping (bool enabled) = 0;

  /**
   * Get whether or not the decal will do any clipping.
   */
  virtual bool HasClipping () const = 0;
};

/**
 * A decal animation control, to be used by the iMeshObject when the vertices
 * of the decal have to be animated.
 */
struct iDecalAnimationControl
{

  virtual ~iDecalAnimationControl () {}
  /**
   * Update the vertices and normals of the decal.
   * \param decalTemplate The template of the decal
   * \param baseIndex The starting index of the vertices and normals that have
   * to be updated in the render buffers provided.
   * \param indices The indices of the iMeshObject corresponding to the indices
   * of the decal. These are the list of the indices provided in
   * iDecalBuilder::AddStaticPoly().
   * \param vertices The vertices of the decal that need to be updated
   * \param normals The normals of the decal that need to be updated
   */
  virtual void UpdateDecal (iDecalTemplate* decalTemplate,
			    size_t baseIndex,
			    csArray<size_t>& indices,
			    csRenderBuffer& vertices,
			    csRenderBuffer& normals) = 0;
};

/**
 * Interface for mesh objects to use to build decals for
 * their mesh object.
 */
struct iDecalBuilder
{
  virtual ~iDecalBuilder () {}

  /**
   * Adds a static polygon to the decal.  The decal builder
   * will build geometry for this polygon and append it to
   * the mesh's extra rendermesh list.
   * \param polygon The polygon to add to the decal.
   * \param indices The indices of the vertices of the iMeshObject corresponding to
   * the vertices of the given polygon. This has to be provided only if you use an
   * iDecalAnimationControl.
   */
  virtual void AddStaticPoly (const csPoly3D& polygon, csArray<size_t>* indices = 0) = 0;

  /**
   * Set the animation controller for this decal.
   */
  virtual void SetDecalAnimationControl (iDecalAnimationControl* animationControl) = 0;
    
};

/**
 * Creates and manages decals.
 *
 * To create a iDecal, just get access to this plugin using
 * csLoadPluginCheck<iDecalManager>
 *
 * Then, just use one of the decal creation functions:
 * - iDecalManager::CreateDecal()
 */
struct iDecalManager : public virtual iBase
{
  SCF_INTERFACE (iDecalManager, 2, 0, 0);

  /**
   * Creates a decal that can be shared among several meshes.
   * \param decalTemplate The template used to create the decal.
   * \param sector The sector to begin searching for nearby meshes.
   * \param pos The position of the decal in world coordinates.
   * \param up The up direction of the decal in world coordinates.
   * \param normal The overall normal of the decal in world coordinates.
   * \param width The width of the decal.
   * \param height The height of the decal.
   * \param oldDecal An existing decal that can be reused for efficiency
   * (it will therefore disappear from its previous position).
   * \return True if the decal is created.
   */
  virtual iDecal* CreateDecal (iDecalTemplate* decalTemplate, 
    iSector* sector, const csVector3& pos, const csVector3& up, 
    const csVector3& normal, float width = 1.0f, float height = 1.0f,
    iDecal* oldDecal = 0) = 0;

  /**
   * Creates a decal template and fills it with default values.
   *  \param material The material wrapper for this decal template.
   *  \return The newly created decal template.
   */
  virtual csRef<iDecalTemplate> CreateDecalTemplate (
    iMaterialWrapper* material) = 0;

  /**
   * Deletes the given decal.
   *  \param decal The decal to be deleted.
   */
  virtual void DeleteDecal (const iDecal* decal) = 0;
  
  /**
   * Gets the number of decals.
   * \return The number of decals.
   */
  virtual size_t GetDecalCount () const = 0;

  /**
   * Gets the specified decal.
   *  \param idx The index of the decal to get, must be between 0 and
   *    GetDecalCount()-1
   */
  virtual iDecal* GetDecal (size_t idx) const = 0;

  /**
   * Creates a decal on a specific mesh.
   * \param decalTemplate The template used to create the decal.
   * \param mesh The mesh to put the decal on.
   * \param pos The position of the decal in world coordinates.
   * \param up The up direction of the decal in world coordinates.
   * \param normal The overall normal of the decal in world coordinates.
   * \param width The width of the decal.
   * \param height The height of the decal.
   * \param oldDecal An existing decal that can be reused for efficiency
   * (it will therefore disappear from its previous position).
   * \return True if the decal is created.
   */
  virtual iDecal* CreateDecal (iDecalTemplate* decalTemplate, 
    iMeshWrapper* mesh, const csVector3& pos, const csVector3& up, 
    const csVector3& normal, float width = 1.0f, float height = 1.0f,
    iDecal* oldDecal = 0) = 0;
};
/** @} */

/** @} */

#endif // __CS_IGEOM_DECAL_H__