Index: branches/atmospheric_engine/src/lib/graphics/effects/cloud_effect.cc
===================================================================
--- branches/atmospheric_engine/src/lib/graphics/effects/cloud_effect.cc	(revision 8050)
+++ branches/atmospheric_engine/src/lib/graphics/effects/cloud_effect.cc	(revision 8052)
@@ -22,4 +22,5 @@
 #include "glincl.h"
 //#include "graphics_engine.h"
+#include "material.h"
 #include <math.h>
 
@@ -69,10 +70,13 @@
 
 	// Generate noise map a
-	CloudEffect::genNoiseMap(cloudMap32_a);
+	//CloudEffect::genNoiseMap(cloudMap32_a);
 	
 	if (this->cloudAnimTimeStep > 0) {
 		// Generate noise map b
-		CloudEffect::genNoiseMap(cloudMap32_b);
+		//CloudEffect::genNoiseMap(cloudMap32_b);
 	}
+
+  this->material = new Material();
+
 }
 
@@ -80,12 +84,6 @@
 {
 	PRINTF(0)( "Activating CloudEffect\n");
-	if (this->cloudAnimTimeStep == 0) {
-		for (int i = 0; i < 32*32; i++)
-			cloudMap32_c[i] = cloudMap32_a[i];
 
-		CloudEffect::overlapOctaves();
-		CloudEffect::expFilter();
-		CloudEffect::genCloudTexture();
-	}
+
 }
 
@@ -95,43 +93,36 @@
 }
 
-void CloudEffect::genCloudTexture() {
-	for(int i=0; i<256; i++)
-		for(int j=0; j<256; j++) 
-		{
-			float color = cloudMap256[i*256+j]; 
-			cloudTexture[i][j][0] = (char) color;
-			cloudTexture[i][j][1] = (char) color;
-			cloudTexture[i][j][2] = (char) color;
-		}
-
-	glBindTexture(GL_TEXTURE_2D, texID[0]);
-
-	glTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, 256, 256, GL_RGB, GL_UNSIGNED_BYTE, cloudTexture);
-	gluBuild2DMipmaps(GL_TEXTURE_2D, GL_RGB, 256, 256, GL_RGB, GL_UNSIGNED_BYTE, cloudTexture);
-
-}
-
-void CloudEffect::calcAnimMap(float timer) {
-
-	for (int x=0; x<32*32; x++)
-		cloudMap32_c[x] = (cloudMap32_a[x] * ((this->cloudAnimTimeStep - timer) / this->cloudAnimTimeStep)) + (cloudMap32_b[x] * (timer / this->cloudAnimTimeStep));
-
-}
-
 void CloudEffect::draw() const
 {
+	/* TODO:
+		-Load a texture, for now from an existing image, a cloud texture
+		-Blend / Overlay this with a blue sky like in the tutorial
+		-Make a skybox or whatever....
+		-Animate it (for now move it along the sky)
+	*/
+
 	glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
 
+  this->material->setDiffuseMap("maps/lightning_bolt.png");
+  this->material->select();
+
 	glPushMatrix();
-	glEnable(GL_TEXTURE_2D);
+ 	glEnable(GL_TEXTURE_2D);
 
-	glBindTexture(GL_TEXTURE_2D, texID[0]);
+ 	glBindTexture(GL_TEXTURE_2D, texID[0]);
 
 	// FIXME : Bind this to the sky - how do I do this?
 	glBegin(GL_QUADS);
-		glTexCoord2f(0.0f, 0.0f); glVertex3f(20, 20,  60);	// Bottom Left Of The Texture and Quad
-		glTexCoord2f(1.0f, 0.0f); glVertex3f(60, 20,  60);	// Bottom Right Of The Texture and Quad
-		glTexCoord2f(1.0f, 1.0f); glVertex3f(60, 60,  60);	// Top Right Of The Texture and Quad
-		glTexCoord2f(0.0f, 1.0f); glVertex3f(20, 60,  60);	// Top Left Of The Texture and Quad
+		glTexCoord2f(0.0f, 0.0f);
+		glVertex3f(20, 20,  60);	// Bottom Left Of The Texture and Quad
+
+		glTexCoord2f(1.0f, 0.0f);
+		glVertex3f(60, 20,  60);	// Bottom Right Of The Texture and Quad
+
+		glTexCoord2f(1.0f, 1.0f);
+		glVertex3f(60, 60,  60);	// Top Right Of The Texture and Quad
+
+		glTexCoord2f(0.0f, 1.0f);
+		glVertex3f(20, 60,  60);	// Top Left Of The Texture and Quad
 	glEnd(); 
 
@@ -141,133 +132,4 @@
 void CloudEffect::tick (float dt)
 {
-	if (this->cloudAnimTimeStep > 0) {
-		if (timer >= this->cloudAnimTimeStep) {
-			timer -= this->cloudAnimTimeStep;
-			for (int i = 0; i < 32*32; i++)
-				cloudMap32_a[i] = cloudMap32_b[i];
-			CloudEffect::genNoiseMap(cloudMap32_b);
-		}
-
-		//map32anim = (map32a * (10 - timer)) + (map32b * timer);
-		CloudEffect::calcAnimMap(timer);
-		//CloudEffect::overlapOctaves();
-		//CloudEffect::expFilter();
-		CloudEffect::genCloudTexture();
-
-		timer += dt;
-	}
+	
 }
-
-/* 
-	Random noise generator
-*/
-float CloudEffect::noise(int x, int y, int random)
-{
-		int n = x + y * 57 + random * 131;
-		n = (n<<13) ^ n;
-		return (1.0f - ( (n * (n * n * 15731 + 789221) +
-						1376312589)&0x7fffffff)* 0.000000000931322574615478515625f);
-}
-
-/*
-	Set noise for the 32*32 noise map:
-*/
-void CloudEffect::genNoiseMap(float  *map)
-{
-	float temp[34][34];
-
-	int random = rand() % 5000;
-
-	for (int y = 1; y < 33; y++)
-		for (int x = 1; x < 33; x++)
-			temp[x][y] = 128.0f + CloudEffect::noise(x,  y,  random) * 128.0f;
-
-	// Seamless cloud
-	for (int x=1; x<33; x++)
-	{
-		temp[0][x] = temp[32][x];
-		temp[33][x] = temp[1][x];
-		temp[x][0] = temp[x][32];
-		temp[x][33] = temp[x][1];
-	}
-	temp[0][0] = temp[32][32];
-	temp[33][33] = temp[1][1];
-	temp[0][33] = temp[32][1];
-	temp[33][0] = temp[1][32];
-
-	// We mirror the side and corner elements so our final cloud will be seamless without any ugly borders showing.
-	for (int y=1; y<33; y++)
-		for (int x=1; x<33; x++)
-		{
-			float center = temp[x][y]/4.0f;
-			float sides = (temp[x+1][y] + temp[x-1][y] + temp[x][y+1] + temp[x][y-1])/8.0f;
-			float corners = (temp[x+1][y+1] + temp[x+1][y-1] + temp[x-1][y+1] + temp[x-1][y-1])/16.0f;
-
-			map[((x-1)*32) + (y-1)] = center + sides + corners;
-		}
-}
-
-/*
-	Interpolation - average the value of each pixel value with that of its neighbors' values.
-*/
-float CloudEffect::interpolate(float x, float y, float  *map)
-{
-	int Xint = (int)x;
-	int Yint = (int)y;
-
-	float Xfrac = x - Xint;
-	float Yfrac = y - Yint;
-
-	int X0 = Xint % 32;
-	int Y0 = Yint % 32;
-	int X1 = (Xint + 1) % 32;
-	int Y1 = (Yint + 1) % 32;
-
-	float bot = map[X0*32 + Y0] + Xfrac * (map[X1*32 + Y0] - map[X0*32 + Y0]);
-	float top = map[X0*32 + Y1] + Xfrac * (map[X1*32 +  Y1] - map[X0*32 + Y1]);
-
-	return (bot + Yfrac * (top - bot));
-}
-
-
-/*
-	Octaves are overlapped together to give cloud more turbulence. We will use four octaves for our cloud.
-*/
-void CloudEffect::overlapOctaves()
-{
-	for (int x=0; x<256*256; x++)
-	{
-		cloudMap256[x] = 0;
-	}
-
-	for (int octave=0; octave<4; octave++)
-		for (int x=0; x<256; x++)
-			for (int y=0; y<256; y++)
-			{
-				float scale = 1 / pow(2.0f, (float) 3-octave);
-				float noise = CloudEffect::interpolate(x*scale, y*scale , cloudMap32_c);
-
-				//The octaves are added together with the proper weight factors.
-				//You could replace pow(2, i) with 1<<i for faster computation
-				cloudMap256[(y*256) + x] += noise / pow(2.0f, (float) octave);
-			}
-}
-
-
-/*
-	Filter the noise with exponential function
-*/
-void CloudEffect::expFilter()
-{
-	float cover = 20.0f;
-	float sharpness = 0.95f;
-
-	for (int x=0; x<256*256; x++)
-	{
-		float c = cloudMap256[x] - (255.0f-cover);
-		if (c<0)     c = 0;
-		cloudMap256[x] = 255.0f - ((float)(pow(sharpness, c))*255.0f);
-	}
-}
-
-
Index: branches/atmospheric_engine/src/lib/graphics/effects/cloud_effect.h
===================================================================
--- branches/atmospheric_engine/src/lib/graphics/effects/cloud_effect.h	(revision 8050)
+++ branches/atmospheric_engine/src/lib/graphics/effects/cloud_effect.h	(revision 8052)
@@ -13,4 +13,7 @@
 #include "sound_buffer.h"
 #include "sound_source.h"
+
+class Material;
+
 
 class CloudEffect : public WeatherEffect
@@ -57,4 +60,5 @@
 		void  														genCloudTexture();
 		void  														calcAnimMap(float timer);
+		Material*	material;
 
 };
Index: branches/atmospheric_engine/src/lib/graphics/effects/rain_effect.cc
===================================================================
--- branches/atmospheric_engine/src/lib/graphics/effects/rain_effect.cc	(revision 8050)
+++ branches/atmospheric_engine/src/lib/graphics/effects/rain_effect.cc	(revision 8052)
@@ -35,5 +35,5 @@
 CREATE_FACTORY(RainEffect, CL_RAIN_EFFECT);
 
-// TODO: Dim Light with Rain, Finish preCaching, check out if multiple rain emitters work,  Think about what happens with building poss. to hang movewithcam off, sound volume, benchmark, possible to activate lightening, turn off visibility when in a building, variable emitter size depending on playable, also rain velocity
+// TODO: Dim Light with Rain, Finish preCaching, check out if multiple rain emitters work,  Think about what happens with building poss. to hang movewithcam off, benchmark, possible to activate lightening, turn off visibility when in a building, variable emitter size depending on playable, also rain velocity
 
 RainEffect::RainEffect(const TiXmlElement* root)
@@ -139,7 +139,7 @@
 	this->emitter->setSpread(this->rainWindForce / 50, 0.2);
 	
-	this->soundSource.loop(this->rainBuffer);
+	this->soundSource.loop(this->rainBuffer, 0.8f);
 	if (this->rainWindForce > 0)
-		this->soundSource.loop(this->windBuffer);
+		this->soundSource.loop(this->windBuffer, 0.5f);
 }
 
