Render Rec Tweak

Just change a very simple selement to this scene by adding sound reactive movement to the scrolling renders in this scene.
It appears that sounda and soundb are values below and above zero so I have regualted this so you only get possitive values I did this in a very crude way of mysound variable.
if((sounda+soundb)<0) mysound=0; else mysound = sounda+soundb;
simpily if teh left and right channels (I presume a and b are these) are below 0 then make it 0 else add them together.
soundtotal is the movement speed of the top bank of reapeated medusas.
I made it always movement to theright and on biig sound boosts move quicker in the same direction.
soundtotal = soundtotal + 0.025*(1+mysound*mysound);
The bottom set of medusas only moves when there is some sound. This is variable soundtotal
soundtotal2 = soundtotal2 + 0.01*((1+mysound)*(1+mysound)*mysound);
Using multiples of mytest (in a expernational or powers way) to simultae more intense values.
Not much has chnaged but subtle improvements(?). But hopefully displaying the thought process behind tweaking the scenes for other authors.
Feel free to bundle with R4 not really good/changed enough for a sepearate scene.
scene (
"name" = "Render RECT Example (Remix)";
"author" = "John Baker & Gordon Williams";
SOLID black();
TEXTURE pic();
MEDUSA med(black,pic);
INVERT inv(med);
RENDER r(inv,med);
)
int x;
float o;
float soundtotal;
float soundtotal2;
float mysound;
void init () {
black.col = 0;
strncpy(pic.filename,"envmap_sky.jpg",256);
strncpy(r.type,"RECTS_XY",256);
strncpy(r.shader,"T0;B10;",256);
soundtotal =0;
soundtotal2 =0;
}
void render() {
if((sounda+soundb)<0) mysound=0; else mysound = sounda+soundb;
soundtotal = soundtotal + 0.025*(1+mysound*mysound);
r.count = 40;
o = (frac(soundtotal)*0.5) -1.5;
for (x=0;x<20;x=x+4) {
r.data[x] = o;
r.data[x+1] = 0.5;
r.data[x+2] = o+0.5;
r.data[x+3] = 1.0;
o = o + 0.5;
}
soundtotal2 = soundtotal2 + 0.01*((1+mysound)*(1+mysound)*mysound);
o = (-frac(soundtotal2)*0.5) - 1.0;
for (x=20;x<40;x=x+4) {
r.data[x] = o;
r.data[x+1] = -1.0;
r.data[x+2] = o+0.5;
r.data[x+3] = -0.5;
o = o + 0.5;
}
}
void reset() {}
It appears that sounda and soundb are values below and above zero so I have regualted this so you only get possitive values I did this in a very crude way of mysound variable.
if((sounda+soundb)<0) mysound=0; else mysound = sounda+soundb;
simpily if teh left and right channels (I presume a and b are these) are below 0 then make it 0 else add them together.
soundtotal is the movement speed of the top bank of reapeated medusas.
I made it always movement to theright and on biig sound boosts move quicker in the same direction.
soundtotal = soundtotal + 0.025*(1+mysound*mysound);
The bottom set of medusas only moves when there is some sound. This is variable soundtotal
soundtotal2 = soundtotal2 + 0.01*((1+mysound)*(1+mysound)*mysound);
Using multiples of mytest (in a expernational or powers way) to simultae more intense values.
Not much has chnaged but subtle improvements(?). But hopefully displaying the thought process behind tweaking the scenes for other authors.
Feel free to bundle with R4 not really good/changed enough for a sepearate scene.
scene (
"name" = "Render RECT Example (Remix)";
"author" = "John Baker & Gordon Williams";
SOLID black();
TEXTURE pic();
MEDUSA med(black,pic);
INVERT inv(med);
RENDER r(inv,med);
)
int x;
float o;
float soundtotal;
float soundtotal2;
float mysound;
void init () {
black.col = 0;
strncpy(pic.filename,"envmap_sky.jpg",256);
strncpy(r.type,"RECTS_XY",256);
strncpy(r.shader,"T0;B10;",256);
soundtotal =0;
soundtotal2 =0;
}
void render() {
if((sounda+soundb)<0) mysound=0; else mysound = sounda+soundb;
soundtotal = soundtotal + 0.025*(1+mysound*mysound);
r.count = 40;
o = (frac(soundtotal)*0.5) -1.5;
for (x=0;x<20;x=x+4) {
r.data[x] = o;
r.data[x+1] = 0.5;
r.data[x+2] = o+0.5;
r.data[x+3] = 1.0;
o = o + 0.5;
}
soundtotal2 = soundtotal2 + 0.01*((1+mysound)*(1+mysound)*mysound);
o = (-frac(soundtotal2)*0.5) - 1.0;
for (x=20;x<40;x=x+4) {
r.data[x] = o;
r.data[x+1] = -1.0;
r.data[x+2] = o+0.5;
r.data[x+3] = -0.5;
o = o + 0.5;
}
}
void reset() {}