~ubuntu-branches/ubuntu/maverick/cairo-dock/maverick

« back to all changes in this revision

Viewing changes to src/gldit/cairo-dock-particle-system.h

  • Committer: Bazaar Package Importer
  • Author(s): Matthieu Baerts (matttbe)
  • Date: 2010-08-09 23:26:12 UTC
  • mfrom: (1.1.10 upstream)
  • Revision ID: james.westby@ubuntu.com-20100809232612-yp4c6ig3jt1bzpdv
Tags: 2.2.0~0beta4-0ubuntu1
* New Upstream Version (LP: #614624)
* Fixed a few bugs on LP:
 - LP: #518453: Dock appears under all windows
                 (Compiz - fullscreen window)
 - LP: #521369: Separator are not removed when closing
                 grouped windows
 - LP: #521762: Some sentences are not correct
 - LP: #526466: Icons of apps with same class shouldn't
                 be stacked by default
 - LP: #535083: Dialogues looks ugly when a lot of them
                 appears at the same time
 - More details on the 'ChangeLog' file
* debian/rules:
 - Autotools has been replaced by CMake
 - Man pages are now included in the source code
* debian/copyright:
 - Updated with the new pathes and new files
* debian/control:
 - Autotools has been replaced by CMake
 - Added libcurl4-gnutls-dev as Build-deps
 - Bump Standard-Version to 3.9.1
* debian/cairo-dock-core.install:
 - Man pages are now included in the source code
 - All sonames are now installed into lib32 or lib64
* debian/cairo-dock-dev.install:
 - pkgconfig is now installed into lib32 or lib64

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*
 
2
* This file is a part of the Cairo-Dock project
 
3
*
 
4
* Copyright : (C) see the 'copyright' file.
 
5
* E-mail    : see the 'copyright' file.
 
6
*
 
7
* This program is free software; you can redistribute it and/or
 
8
* modify it under the terms of the GNU General Public License
 
9
* as published by the Free Software Foundation; either version 3
 
10
* of the License, or (at your option) any later version.
 
11
*
 
12
* This program is distributed in the hope that it will be useful,
 
13
* but WITHOUT ANY WARRANTY; without even the implied warranty of
 
14
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
15
* GNU General Public License for more details.
 
16
* You should have received a copy of the GNU General Public License
 
17
* along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
18
*/
 
19
 
 
20
 
 
21
#ifndef __CAIRO_DOCK_PARTICLE_SYSTEM__
 
22
#define  __CAIRO_DOCK_PARTICLE_SYSTEM__
 
23
 
 
24
#include <glib.h>
 
25
 
 
26
/**
 
27
*@file cairo-dock-particle-system.h A particle system is a set of particles that evolve according to a given model. Each particle will see its parameters change with time : direction, speed, oscillation, color, size, etc.
 
28
* Particle Systems fully take advantage of OpenGL and are able to render many thousand of particles at a high frequency refresh.
 
29
 
30
*/
 
31
 
 
32
/// A particle of a particle system.
 
33
typedef struct _CairoParticle {
 
34
        /// horizontal position, in fraction of the particle system's width, and relatively to the center of the particle system. So it is comprised between -1 and 1.
 
35
        GLfloat x;
 
36
        /// vertical position, in fraction of the particle system's height, and relatively to the bottom of the particle system. So it is comprised between 0 and 1.
 
37
        GLfloat y;
 
38
        /// depth of the particle, negative to be "behind". 0 means it is at the same depth as icons.
 
39
        GLfloat z;
 
40
        /// horizontal speed
 
41
        GLfloat vx;
 
42
        /// vertical speed
 
43
        GLfloat vy;
 
44
        /// size
 
45
        GLfloat fWidth, fHeight;
 
46
        /// color r,g,b,a
 
47
        GLfloat color[4];
 
48
        /// phase of the oscillations.
 
49
        GLfloat fOscillation;
 
50
        /// oscillation variation speed.
 
51
        GLfloat fOmega;
 
52
        /// current size factor
 
53
        GLfloat fSizeFactor;
 
54
        /// size variation speed.
 
55
        GLfloat fResizeSpeed;
 
56
        /// current life time, decreased by 1 at each step.
 
57
        gint iLife;
 
58
        /// total life time.
 
59
        gint iInitialLife;
 
60
        } CairoParticle;
 
61
 
 
62
/// A particle system.
 
63
typedef struct _CairoParticleSystem {
 
64
        CairoParticle *pParticles;
 
65
        gint iNbParticles;
 
66
        GLuint iTexture;
 
67
        GLfloat *pVertices;
 
68
        GLfloat *pCoords;
 
69
        GLfloat *pColors;
 
70
        GLfloat fWidth, fHeight;
 
71
        double dt;
 
72
        gboolean bDirectionUp;
 
73
        gboolean bAddLuminance;
 
74
        gboolean bAddLight;
 
75
        } CairoParticleSystem;
 
76
 
 
77
/// Function that re-initializes a particle when its life is over.
 
78
typedef void (CairoDockRewindParticleFunc) (CairoParticle *pParticle, double dt);
 
79
 
 
80
/** Render all the particles of a particle system with a given depth.
 
81
*@param pParticleSystem the particle system.
 
82
*@param iDepth depth of the particles that will be rendered. If set to -1, only particles with a negative z will be rendered, if set to 1, only particles with a positive z will be rendered, if set to 0, all the particles will be rendered.
 
83
*/
 
84
void cairo_dock_render_particles_full (CairoParticleSystem *pParticleSystem, int iDepth);
 
85
/** Render all the particles of a particle system.
 
86
*@param pParticleSystem the particle system.
 
87
*/
 
88
#define cairo_dock_render_particles(pParticleSystem) cairo_dock_render_particles_full (pParticleSystem, 0)
 
89
 
 
90
/**  Create a particle system.
 
91
*@param iNbParticles number of particles of the system.
 
92
*@param iTexture texture to map on each particle.
 
93
*@param fWidth width of the system.
 
94
*@param fHeight height of the system.
 
95
*@return a newly allocated particle system.
 
96
*/
 
97
CairoParticleSystem *cairo_dock_create_particle_system (int iNbParticles, GLuint iTexture, double fWidth, double fHeight);
 
98
 
 
99
/** Destroy a particle system, freeing all the ressources it was using.
 
100
*@param pParticleSystem the particle system.
 
101
*/
 
102
void cairo_dock_free_particle_system (CairoParticleSystem *pParticleSystem);
 
103
 
 
104
/** Update a particle system to the next step with a generic particle behavior model. You can write your own model depending on your needs.
 
105
*@param pParticleSystem the particle system.
 
106
*@param pRewindParticle function called on a particle when its life is over.
 
107
*@return TRUE if some particles are still alive.
 
108
*/
 
109
gboolean cairo_dock_update_default_particle_system (CairoParticleSystem *pParticleSystem, CairoDockRewindParticleFunc pRewindParticle);
 
110
 
 
111
 
 
112
#endif