From 0d7ca272a9c3a0bf0bc37bb0d844eeff940967e6 Mon Sep 17 00:00:00 2001 From: psperl Date: Fri, 27 Jun 2008 23:43:09 +0000 Subject: [PATCH] Textures verified git-svn-id: https://projectm.svn.sourceforge.net/svnroot/projectm/trunk@1063 6778bc44-b910-0410-a7a0-be141de4315d --- src/projectM-engine/Filters.cpp | 8 +- src/projectM-engine/Filters.hpp | 12 +- src/projectM-engine/MstressJuppyDancer.hpp | 213 +++++++++++++++++++++ src/projectM-engine/RovastarDarkSecret.hpp | 153 +++++++++++++++ 4 files changed, 378 insertions(+), 8 deletions(-) create mode 100644 src/projectM-engine/MstressJuppyDancer.hpp create mode 100644 src/projectM-engine/RovastarDarkSecret.hpp diff --git a/src/projectM-engine/Filters.cpp b/src/projectM-engine/Filters.cpp index 5393205fd..3ac101062 100644 --- a/src/projectM-engine/Filters.cpp +++ b/src/projectM-engine/Filters.cpp @@ -19,7 +19,7 @@ #include "Filters.hpp" -void Brighten::Draw() +void Brighten::Draw(RenderContext &context) { float points[4][2] = {{-0.5, -0.5}, {-0.5, 0.5}, @@ -41,7 +41,7 @@ void Brighten::Draw() glDisableClientState(GL_VERTEX_ARRAY); } -void Darken::Draw() +void Darken::Draw(RenderContext &context) { float points[4][2] = {{-0.5, -0.5}, {-0.5, 0.5}, @@ -57,7 +57,7 @@ void Darken::Draw() glDisableClientState(GL_VERTEX_ARRAY); } -void Invert::Draw() +void Invert::Draw(RenderContext &context) { float points[4][2] = {{-0.5, -0.5}, {-0.5, 0.5}, @@ -74,7 +74,7 @@ void Invert::Draw() glDisableClientState(GL_VERTEX_ARRAY); } -void Solarize::Draw() +void Solarize::Draw(RenderContext &context) { float points[4][2] = {{-0.5, -0.5}, {-0.5, 0.5}, diff --git a/src/projectM-engine/Filters.hpp b/src/projectM-engine/Filters.hpp index 824204d12..6ce64da13 100644 --- a/src/projectM-engine/Filters.hpp +++ b/src/projectM-engine/Filters.hpp @@ -12,26 +12,30 @@ class Brighten : public RenderItem { +public: Brighten(){} - void Draw(); + void Draw(RenderContext &context); }; class Darken : public RenderItem { +public: Darken(){} - void Draw(); + void Draw(RenderContext &context); }; class Invert : public RenderItem { +public: Invert(){} - void Draw(); + void Draw(RenderContext &context); }; class Solarize : public RenderItem { +public: Solarize(){} - void Draw(); + void Draw(RenderContext &context); }; #endif /* FILTERS_HPP_ */ diff --git a/src/projectM-engine/MstressJuppyDancer.hpp b/src/projectM-engine/MstressJuppyDancer.hpp new file mode 100644 index 000000000..89cd91bb4 --- /dev/null +++ b/src/projectM-engine/MstressJuppyDancer.hpp @@ -0,0 +1,213 @@ + + +#include "Pipeline.hpp" +#include "Transformation.hpp" +#include "MilkdropCompatability.hpp" +#include "Waveform.hpp" + +class Dancer : public Waveform +{ +public: + + float meanbass; + float meanmid; + float meantreb; + float mi2_prg; + float gam; + float mi_prg; + float ba_prg; + float tr_prg; + + float dim; + float xpos; + float ypos; + + + float rand_offset1; + float rand_offset2; + float rand_offset3; + + + Dancer():Waveform(16) + { + thick = true; + smoothing = 0.5; + + meanbass = 0; + meanmid = 0; + meantreb = 0; + mi2_prg = 0; + gam = 0; + mi_prg = 0; + ba_prg = 0; + tr_prg = 0; + + dim = (rand()%20)*.01; + //dim *= 0.5; + dim += 0.4; + + + ypos = ((rand()%60)*.01)-0.3; + xpos = ((rand()%60)*.01)-0.3; + xpos+=(1-dim) * 0.5; + ypos+=(1-dim) * 0.5; + + rand_offset1= (rand()%200)*.01; + rand_offset2= (rand()%400)*.01; + rand_offset3= (rand()%600)*.01; + + } + + ColoredPoint PerPoint(ColoredPoint p, const float sample, const BeatDetect &music) + { + + + meanbass = 0.01*(meanbass*99+music.bass); + meantreb = 0.01*(meantreb*99+music.treb); + meanmid = 0.01*(meanmid*99+music.mid); + float bassdiff = (music.bass - meanbass)*15; + float trebdiff = (music.treb - meantreb)*15; + float middiff = (music.mid - meanmid)*15; + float ba = min(above(bassdiff,0)*bassdiff*.005,.11); + float tr = min(above(trebdiff,0)*trebdiff*.005,.11); + float mi = min(above(middiff,0)*middiff*.005,.11); + + mi2_prg = mi2_prg+mi; + gam = abs(gam-above(mi2_prg,5)); + mi2_prg= if_milk(above(mi2_prg,5),0,mi2_prg); + + float s = sample * 15; + //Gambe + p.x= if_milk(equal(int(s),1),.4,.4); + p.y= if_milk(equal(int(s),1),.2+((ba+tr)*.5)*gam,.2+((ba+tr)*.5)*gam); + + p.x= if_milk(equal(int(s),2),.5+sin(ba*100)*.03,p.x); + p.y= if_milk(equal(int(s),2),.4,p.y); + + p.x= if_milk(equal(int(s),3),.6,p.x); + p.y= if_milk(equal(int(s),3),.2+((ba+tr)*.5)*(1-gam),p.y); + + p.x= if_milk(equal(int(s),4),.5+sin(ba*100)*.03,p.x); + p.y= if_milk(equal(int(s),4),.4,p.y); + + //Corpo + p.x= if_milk(equal(int(s),5),.5,p.x); + p.y= if_milk(equal(int(s),5),.6,p.y); + + //Braccia + p.x= if_milk(equal(int(s),6),.4-mi*.23,p.x); + p.y= if_milk(equal(int(s),6),.5+mi,p.y); + + p.x= if_milk(equal(int(s),7),.5,p.x); + p.y= if_milk(equal(int(s),7),.6,p.y); + + p.x= if_milk(equal(int(s),8),.6+tr*.23,p.x); + p.y= if_milk(equal(int(s),8),.5+tr,p.y); + + p.x= if_milk(equal(int(s),9),.5,p.x); + p.y= if_milk(equal(int(s),9),.6,p.y); + + //Testa + p.x= if_milk(equal(int(s),10),.5,p.x); + p.y= if_milk(equal(int(s),10),.62,p.y); + + p.x= if_milk(equal(int(s),11),.47-ba*.23,p.x); + p.y= if_milk(equal(int(s),11),.62,p.y); + p.x= if_milk(equal(int(s),12),.47-ba*.23,p.x); + p.y= if_milk(equal(int(s),12),.67+ba*.23,p.y); + + p.x= if_milk(equal(int(s),13),.53+ba*.23,p.x); + p.y= if_milk(equal(int(s),13),.67+ba*.23,p.y); + + p.x= if_milk(equal(int(s),14),.53+ba*.23,p.x); + p.y= if_milk(equal(int(s),14),.62,p.y); + + p.x= if_milk(equal(int(s),15),.50,p.x); + p.y= if_milk(equal(int(s),15),.62,p.y); + + + + mi_prg= if_milk(above(mi_prg,5),0,mi_prg+mi*.1); + ba_prg= if_milk(above(ba_prg,5),0,ba_prg+ba*.1); + tr_prg= if_milk(above(tr_prg,5),0,tr_prg+tr*.1); + + float temp_dim = dim + 0.2 * sin(mi_prg + rand_offset1); + float temp_xpos = xpos + 0.2 * cos(ba_prg + rand_offset2); + float temp_ypos = ypos + 0.2* sin(tr_prg + rand_offset3); + + p.x=p.x*temp_dim+temp_xpos; + p.y=p.y*temp_dim+temp_ypos; + + float hm=sample+mi2_prg; + float ht=sample+tr_prg; + float hb=sample+ba_prg; + + p.r=hm; + p.g=ht; + p.b=hb; + p.a=.8; + return p; + } +}; + +class MstressJuppyDancer : public Pipeline +{ +public: + Dancer dancer[10]; + + float dx, dy, cx, cy, time; + + float q1,meanmid,middiff,mi_prg,gam, bass; + + MstressJuppyDancer() : Pipeline() + { + + for(int x = 0; x< 10; x++) + drawables.push_back(&dancer[x]); + + textureWrap = false; + screenDecay = 0.3; + + videoEchoOrientation = 0; + videoEchoZoom = 1.0; + videoEchoAlpha = 1.0; + + q1 = 0; + meanmid = 0; + middiff = 0; + mi_prg = 0; + gam = 0; + + } + + virtual void Render(const BeatDetect &music, const PipelineContext &context) + { + meanmid = 0.01*(meanmid*99+music.mid); + middiff = (music.mid - meanmid)*15; + float mi = min(above(middiff,0)*middiff*.005,.11); + mi_prg = mi_prg+mi; + gam = abs(gam-above(mi_prg,.5)); + mi_prg= if_milk(above(mi_prg,.5),0,mi_prg); + q1 = gam; + bass = music.bass; + } + + virtual Point PerPixel(Point p, const PerPixelContext context) + { + + float sx = -below(p.y,0.8)*.001; + float dx = .01*bass*(1-q1*2)*below(p.y,0.8); + float rot=rot+.051*below(p.y,0.8); + float cx=trunc(p.x*16)/16; + float cy=trunc(p.y*16)/16; + + Transforms::Scale(p,context,sx,1,cx,cy); + Transforms::Rotate(p,context,rot,cx,cy); + Transforms::Transform(p,context,dx,0); + + return p; + } + +}; + + diff --git a/src/projectM-engine/RovastarDarkSecret.hpp b/src/projectM-engine/RovastarDarkSecret.hpp new file mode 100644 index 000000000..de8b32457 --- /dev/null +++ b/src/projectM-engine/RovastarDarkSecret.hpp @@ -0,0 +1,153 @@ +/* + * RovastarFractopiaFrantic.hpp + * + * Created on: Jun 18, 2008 + * Author: pete + */ + +#include "Pipeline.hpp" +#include "MilkdropCompatability.hpp" +#include "Transformation.hpp" +#include "MilkdropWaveform.hpp" +#include "Filters.hpp" + +class RovastarDarkSecret : public Pipeline +{ +public: + + Shape shape1, shape2, shape3, shape4; + Border border; + Invert invert; + + RovastarDarkSecret() : Pipeline() + { + screenDecay = 0.9; + textureWrap = true; + + videoEchoOrientation = 0; + videoEchoZoom = 1.0; + videoEchoAlpha = 1.0; + + drawables.push_back(&border); + drawables.push_back(&shape1); + drawables.push_back(&shape2); + drawables.push_back(&shape3); + drawables.push_back(&shape4); + + compositeDrawables.push_back(&invert); + + border.outer_size = 0.015; + border.inner_size = 0.010; + border.outer_a = 1.0; + border.inner_a = 1.0; + + shape1.sides = 4; + shape1.additive = true; + shape1.radius=1.621747; + shape1.textured = true; + shape1.tex_zoom=0.424973; + shape1.a = 1; + shape1.border_a = 0.0; + shape1.r = 1; + shape1.g = 0; + shape1.b = 0; + shape1.a2 = 0; + + shape2.sides = 4; + shape2.additive = true; + shape2.radius=1.621747; + shape2.textured = true; + shape2.tex_zoom = 0.424973; + shape2.a = 1; + shape2.border_a = 0.0; + shape2.r = 1; + shape2.g = 0; + shape2.b = 1; + shape2.a2 = 0; + + + shape3.sides = 4; + shape3.additive = true; + shape3.radius=1.621747; + shape3.textured = true; + shape3.tex_zoom = 0.424973; + shape3.a = 1; + shape3.border_a = 0.0; + shape3.r = 0; + shape3.g = 1; + shape3.b = 1; + shape3.a2 = 0; + + shape4.sides = 4; + shape4.additive = false; + shape4.radius=1.621747; + shape4.textured = true; + shape4.tex_zoom = 0.424973; + shape4.a = 1; + shape4.border_a = 0.0; + shape4.r = 1; + shape4.g = 1; + shape4.b = 1; + shape4.a2 = 0; + + + q8 = 0; + q7 = 0; + oldq7 = 0; + } + + float q8, oldq8, q7, oldq7, q6; + float dx, dy; + + virtual void Render(const BeatDetect &music, const PipelineContext &context) + { + + float wave_r = 0.5+ 0.2*(music.bass-1); + float wave_g = 0.5+ 0.2*(music.mid-1.2); + float wave_b = 0.5+ 0.2*(music.treb-.5); + + border.outer_r = 1-wave_r; + border.outer_g = 1-wave_g; + border.outer_b = 1-wave_b; + + border.inner_r = 0.75 + 0.25*sin(context.time*0.4123); + border.inner_g = 0.25 + 0.25*cos(context.time*0.87); + border.inner_b = 0.5+0.5*sin(1.23*context.time); + + float val = 1.2*music.bass+0.4*music.bass_att+0.1*music.treb+0.1*music.treb_att+0.1*music.mid+0.1*music.mid_att; + + q8 = oldq8 +0.003*(((pow(val,6)/context.fps) + (pow(val,5)/context.fps) + (pow(val,4)/context.fps) + (pow(val,3)/context.fps) + (pow(val,2)/context.fps) +(val)/context.fps)); + oldq8 = q8; + q7 =oldq7+ 0.001*(pow(val,7)/context.fps); + oldq7 = q7; + + dy = 0.5 + 0.01*(sin(0.786*q7)); + dx = 0.1*sin(1.143*q8); + q6 = 15+0.1*(((pow(val,6)/context.fps) + (pow(val,5)/context.fps) + (pow(val,4)/context.fps) + (pow(val,3)/context.fps) + (pow(val,2)/context.fps) +(val)/context.fps)); + + shape1.x = 0.5 + 0.1*sin(q7*0.986); + shape1.y = 0.5 + 0.1*sin(q7*0.846); + shape1.tex_ang = 3.1515 + 3.1415*sin(q7*0.4521) +0.05*sin(context.time); + + shape2.x = 0.5 + 0.1*sin(q7*0.986); + shape2.y = 0.5 + 0.1*sin(q7*0.846); + shape2.tex_ang = 3.1515 + 3.1415*sin(q7*0.4521) +0.1*sin(context.time); + + shape3.x = 0.5 + 0.1*sin(q7*0.986); + shape3.y = 0.5 + 0.1*sin(q7*0.846); + shape3.tex_ang = 3.1515 + 3.1415*sin(q7*0.4521) +0.15*sin(context.time); + + shape4.x = 0.5 + 0.1*sin(q7*0.986); + shape4.y = 0.5 + 0.1*sin(q7*0.846); + shape4.tex_ang = 3.1515 + 3.1415*sin(q7*0.4521) +0.2*sin(context.time);; + + } + + virtual Point PerPixel(Point p, const PerPixelContext context) + { + float pdy=dy+0.008*cos((p.x-0.5 - 0.1*sin(q7))*(q6)); + Transforms::Zoom(p,context,13.290894,1); + Transforms::Transform(p,context,dx,pdy); + return p; + } +};