/usr/include/compiz/animationaddon/animationaddon.h is in compiz-plugins-extra 0.9.7.0~bzr9-0ubuntu6.
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 | #ifndef _COMPIZ_ANIMATIONADDON_H
#define _COMPIZ_ANIMATIONADDON_H
#define ANIMATIONADDON_ABI 20091206
#include <core/pluginclasshandler.h>
#include <vector>
#include <boost/ptr_container/ptr_vector.hpp>
using namespace::std;
class PrivateAnimAddonScreen;
class AnimAddonScreen :
public PluginClassHandler<AnimAddonScreen, CompScreen, ANIMATIONADDON_ABI>,
public CompOption::Class
{
public:
AnimAddonScreen (CompScreen *);
~AnimAddonScreen ();
CompOption::Vector &getOptions ();
bool setOption (const CompString &name, CompOption::Value &value);
int getIntenseTimeStep ();
private:
PrivateAnimAddonScreen *priv;
};
/// Base class for all polygon- and particle-based animations
class BaseAddonAnim :
virtual public Animation
{
public:
BaseAddonAnim (CompWindow *w,
WindowEvent curWindowEvent,
float duration,
const AnimEffect info,
const CompRect &icon);
~BaseAddonAnim () {}
bool needsDepthTest () { return mDoDepthTest; }
protected:
/// Gets info about the extension plugin that implements this animation.
ExtensionPluginInfo *getExtensionPluginInfo ();
int mIntenseTimeStep;
CompositeScreen *mCScreen;
GLScreen *mGScreen;
bool mDoDepthTest; ///< Whether depth testing should be used in the effect
};
// Particle stuff
class Particle
{
public:
Particle () : life (0.0f) {}
float life; ///< particle life
float fade; ///< fade speed
float width; ///< particle width
float height; ///< particle height
float w_mod; ///< particle size modification during life
float h_mod; ///< particle size modification during life
float r; ///< red value
float g; ///< green value
float b; ///< blue value
float a; ///< alpha value
float x; ///< X position
float y; ///< Y position
float z; ///< Z position
float xi; ///< X direction
float yi; ///< Y direction
float zi; ///< Z direction
float xg; ///< X gravity
float yg; ///< Y gravity
float zg; ///< Z gravity
float xo; ///< orginal X position
float yo; ///< orginal Y position
float zo; ///< orginal Z position
};
class ParticleSystem
{
friend class ParticleAnim;
public:
ParticleSystem (int numParticles,
float slowdown,
float darkenAmount,
GLuint blendMode);
~ParticleSystem ();
void draw (int offsetX = 0, int offsetY = 0);
void update (float time);
vector<Particle> &particles () { return mParticles; }
void activate () { mActive = true; }
bool active () { return mActive; }
void setOrigin (int x, int y) { mX = x; mY = y; }
protected:
CompWindow *mWindow;
vector<Particle> mParticles;
float mSlowDown;
float mDarkenAmount;
GLuint mBlendMode;
GLuint mTex;
bool mActive;
int mX, mY;
GLScreen *mGScreen;
vector<GLfloat> mVerticesCache;
vector<GLfloat> mCoordsCache;
vector<GLfloat> mColorsCache;
vector<GLfloat> mDColorsCache;
};
class ParticleAnim :
public BaseAddonAnim,
public PartialWindowAnim
{
public:
ParticleAnim (CompWindow *w,
WindowEvent curWindowEvent,
float duration,
const AnimEffect info,
const CompRect &icon);
~ParticleAnim () {}
void postPaintWindow ();
bool postPaintWindowUsed () { return true; }
void updateBB (CompOutput &output);
bool updateBBUsed () { return true; }
bool prePreparePaint (int msSinceLastPaint);
void initLightDarkParticles (int numLightParticles,
int numDarkParticles,
float lightSlowDown,
float darkSlowDown);
protected:
boost::ptr_vector<ParticleSystem> mParticleSystems;
};
// Polygon stuff
typedef enum
{
CorrectPerspectiveNone = 0,
CorrectPerspectivePolygon,
CorrectPerspectiveWindow
} CorrectPerspective;
/// Base class for per-PolygonObject effect parameter classes
class PolygonEffectParameters
{
};
/// This is intended to be a closed 3D piece of a window with convex polygon
/// faces and quad-strip sides. Since decoration texture is separate from
/// the window texture, it is more complicated than it would be with a single
/// texture: we use glClipPlane with the rectangles (clips) to clip 3D space
/// to the region falling within that clip.
/// If the polygon is on an edge/corner, it also has 2D shadow quad(s)
/// (to be faded out at the beginning of 3D animation if necessary).
class PolygonObject
{
public:
int nVertices; ///< number of total vertices (front + back)
int nSides; ///< number of sides
GLfloat *vertices; ///< Positions of vertices relative to center
GLushort *sideIndices; ///< Indices of quad strip for "sides"
GLfloat *normals; ///< Surface normals for 2+nSides faces
Boxf boundingBox; ///< Bound. box to test intersection with clips
// Animation effect parameters
Point3d centerPosStart; ///< Starting position of center
float rotAngleStart; ///< Starting rotation angle
Point3d centerPos; ///< Position of center
Vector3d rotAxis; ///< Rotation axis vector
float rotAngle; ///< Rotation angle
Point3d rotAxisOffset; ///< Rotation axis translate amount
Point centerRelPos; ///< Relative pos of center within the window
Vector3d finalRelPos; ///< Velocity factor for scripted movement
float finalRotAng; ///< Final rotation angle around rotAxis
float moveStartTime; ///< Movement starts at this time ([0-1] range)
float moveDuration; ///< Movement lasts this long ([0-1] range)
float fadeStartTime; ///< Fade out starts at this time ([0,1] range)
float fadeDuration; ///< Duration of fade out ([0,1] range)
/** Pointer to a struct that can contain
custom parameters for an individual effect */
PolygonEffectParameters *effectParameters;
float boundSphereRadius; ///< Radius of bounding sphere
};
/// Info about intersection of a polygon and clip
class PolygonClipInfo
{
public:
PolygonClipInfo (const PolygonObject *p);
const PolygonObject *p; ///< the intersecting polygon-object
/// Texture coord.s for each vertex of the polygon-object
/// ordered as: Front v1.x, y, v2.x, y, ...,
/// followed by back vertex texture coordinates.
vector<GLfloat> vertexTexCoords;
};
class Clip4Polygons ///< Rectangular clips
{ ///< (to hold clips passed to AddWindowGeometry)
public:
CompRect box; ///< Coords
Boxf boxf; ///< Float coords (for small clipping adjustment)
GLTexture::Matrix texMatrix;///< Corresponding texture coord. matrix
/// True if this clip likely intersects all polygons
/// (for the window-contents clip). Used for optimization purposes.
bool intersectsMostPolygons;
/// For polygons that intersect this clip.
/// Only used when intersectsMostPolygons is false.
list<PolygonClipInfo *> intersectingPolygonInfos;
/// Texture coord.s for each vertex of each polygon-object
/// ordered as: Front p1.v1.x, y, p1.v2.x, .y, p2.v1.x, .y, ...,
/// followed by back vertex texture coordinates.
/// Only used when intersectsMostPolygons is true.
vector<GLfloat> polygonVertexTexCoords;
};
class PolygonAnim :
virtual public Animation,
public BaseAddonAnim
{
public:
PolygonAnim (CompWindow *w,
WindowEvent curWindowEvent,
float duration,
const AnimEffect info,
const CompRect &icon);
~PolygonAnim ();
void step ();
void prePaintWindow ();
void postPaintWindow ();
bool postPaintWindowUsed () { return true; }
void addGeometry (const GLTexture::MatrixList &matrix,
const CompRegion ®ion,
const CompRegion &clipRegion,
unsigned int maxGridWidth,
unsigned int maxGridHeight);
void drawGeometry ();
virtual void updateBB (CompOutput &output);
bool updateBBUsed () { return true; }
bool prePreparePaint (int msSinceLastPaint);
bool moveUpdate (int dx, int dy);
virtual void stepPolygon (PolygonObject *p,
float forwardProgress);
virtual void transformPolygon (const PolygonObject *p) {}
/// For effects that have decel. motion
virtual bool deceleratingMotion () { return false; }
bool tessellateIntoRectangles (int gridSizeX,
int gridSizeY,
float thickness);
bool tessellateIntoHexagons (int gridSizeX,
int gridSizeY,
float thickness);
bool tessellateIntoGlass (int gridSizeX,
int gridSizeY,
float thickness);
void prePaintOutput (CompOutput *output);
void deceleratingAnimStepPolygon (PolygonObject *p,
float forwardProgress);
protected:
void getPerspectiveCorrectionMat (const PolygonObject *p,
GLfloat *mat,
GLMatrix *matf,
const CompOutput &output);
void processIntersectingPolygons ();
virtual void freePolygonObjects ();
void freeClipsPolygons ();
void prepareDrawingForAttrib (GLFragment::Attrib &attrib);
int mNumDrawGeometryCalls;
int mNumClipsPassed; /**< # of clips passed to animAddWindowGeometry so far
in this draw step */
bool mClipsUpdated; ///< whether stored clips are updated in this anim step
vector<Clip4Polygons> mClips;///< Rect. clips collected in addGeometries
int mFirstNondrawnClip;
vector<int> mLastClipInGroup;/**< Index of the last clip in each group of clips
drawn in drawGeometry func. */
bool mDoLighting; ///< Whether lighting should be used in the effect
CorrectPerspective mCorrectPerspective;
vector<PolygonObject *> mPolygons; ///< The polygons in this set
float mThickness; ///< Window thickness (depth along z axis)
int mNumTotalFrontVertices; ///< Total # of polygon vertices on front faces
float mBackAndSidesFadeDur; ///< How long side and back faces should fade in/out
float mAllFadeDuration; /**< Duration of fade out at the end in [0,1] range
when all polygons fade out at the same time.
If >-1, this overrides fadeDuration in PolygonObject */
bool mIncludeShadows; ///< Whether to include shadows in polygon
private:
inline void drawPolygonClipIntersection (const PolygonObject *p,
const Clip4Polygons &c,
const GLfloat *vertexTexCoords,
int pass,
float forwardProgress,
GLdouble clipPlane[4][4],
const CompOutput &output,
float newOpacity,
bool decelerates,
GLfloat skewMat[16]);
};
#endif
|