| 1 |
/* Libvisual-plugins - Standard plugins for libvisual |
| 2 |
* |
| 3 |
* Copyright (C) 2000, 2001 Richard Ashburn <[email protected]> |
| 4 |
* |
| 5 |
* Authors: Richard Ashburn <[email protected]> |
| 6 |
* Jean-Christophe Hoelt <[email protected]> |
| 7 |
* Dennis Smit <[email protected]> |
| 8 |
* |
| 9 |
* $Id: corona.h,v 1.3 2005/12/20 18:49:13 synap Exp $ |
| 10 |
* |
| 11 |
* This program is free software; you can redistribute it and/or modify |
| 12 |
* it under the terms of the GNU General Public License as |
| 13 |
* published by the Free Software Foundation; either version 2 |
| 14 |
* of the License, or (at your option) any later version. |
| 15 |
* |
| 16 |
* This program is distributed in the hope that it will be useful, |
| 17 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 18 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 19 |
* GNU General Public License for more details. |
| 20 |
* |
| 21 |
* You should have received a copy of the GNU General Public License |
| 22 |
* along with this program; if not, write to the Free Software |
| 23 |
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
| 24 |
*/ |
| 25 |
|
| 26 |
///////////////////////////////////////////////////////////////////////////// |
| 27 |
// |
| 28 |
// corona.h : Declaration of the Corona class |
| 29 |
// |
| 30 |
///////////////////////////////////////////////////////////////////////////// |
| 31 |
|
| 32 |
#ifndef __CORONA_H_ |
| 33 |
#define __CORONA_H_ |
| 34 |
|
| 35 |
#include "corona_types.h" |
| 36 |
|
| 37 |
// presets |
| 38 |
enum { |
| 39 |
PRESET_CORONA = 0, |
| 40 |
PRESET_BLAZE, |
| 41 |
PRESET_COUNT |
| 42 |
}; |
| 43 |
|
| 44 |
// The particles |
| 45 |
struct Particle |
| 46 |
{ |
| 47 |
double x, y, xvel, yvel; |
| 48 |
}; |
| 49 |
|
| 50 |
// The background swirl |
| 51 |
struct Swirl |
| 52 |
{ |
| 53 |
double x; |
| 54 |
double y; |
| 55 |
double tightness; |
| 56 |
double pull; |
| 57 |
}; |
| 58 |
|
| 59 |
|
| 60 |
///////////////////////////////////////////////////////////////////////////// |
| 61 |
// |
| 62 |
// Core Class of the Corona Visual FX |
| 63 |
// |
| 64 |
///////////////////////////////////////////////////////////////////////////// |
| 65 |
|
| 66 |
class Corona |
| 67 |
{ |
| 68 |
private: |
| 69 |
int m_clrForeground; // foreground color |
| 70 |
int m_nPreset; |
| 71 |
|
| 72 |
Particle *m_particles; |
| 73 |
int nbParticules; |
| 74 |
|
| 75 |
// The off-screen buffer |
| 76 |
unsigned char* m_image; |
| 77 |
unsigned char* m_real_image; |
| 78 |
|
| 79 |
int m_width; |
| 80 |
int m_height; |
| 81 |
int m_real_height; |
| 82 |
|
| 83 |
Swirl m_swirl; |
| 84 |
unsigned char** m_deltafield; |
| 85 |
|
| 86 |
// Particle movement info |
| 87 |
int m_swirltime; |
| 88 |
Swirl m_movement; |
| 89 |
|
| 90 |
bool m_testing; |
| 91 |
bool m_silent; |
| 92 |
|
| 93 |
// Beat detection |
| 94 |
double m_avg; |
| 95 |
double m_oldval; |
| 96 |
int m_pos; |
| 97 |
|
| 98 |
// Waves |
| 99 |
double m_waveloop; |
| 100 |
int *m_reflArray; |
| 101 |
|
| 102 |
// Implementation functions |
| 103 |
double random(double min, double max) const; |
| 104 |
// void setUpPalette(); |
| 105 |
void drawLine(int x0, int y0, int x1, int y1, unsigned char col); |
| 106 |
void drawParticules(); |
| 107 |
void drawParticulesWithShift(); |
| 108 |
void blurImage(); |
| 109 |
void drawReflected(); |
| 110 |
|
| 111 |
void chooseRandomSwirl(); |
| 112 |
void setPointDelta(int x, int y); |
| 113 |
void applyDeltaField(bool heavy); |
| 114 |
int getBeatVal(TimedLevel *tl); |
| 115 |
void getAvgParticlePos(double& x, double& y) const; |
| 116 |
void genReflectedWaves(double loop); |
| 117 |
|
| 118 |
|
| 119 |
public: |
| 120 |
Corona(); |
| 121 |
~Corona(); |
| 122 |
|
| 123 |
bool setUpSurface(int width, int height); |
| 124 |
void update(TimedLevel *pLevels); |
| 125 |
unsigned char *getSurface() const { return m_real_image; } |
| 126 |
|
| 127 |
int getWidth() const { return m_width; } |
| 128 |
int getHeight() const { return m_real_height; } |
| 129 |
}; |
| 130 |
|
| 131 |
#endif //__CORONA_H_ |