00001 00007 #ifndef PLASMASHADER_H 00008 #define PLASMASHADER_H PLASMASHADER_H 00009 00010 #include "Shader.h" 00011 #include "PerlinNoise3D.h" 00012 00017 class PlasmaShader : public Shader 00018 { 00019 private: 00024 PerlinNoise3D pnoise; 00025 00026 public: 00027 00032 PlasmaShader(Scene *scene) 00033 : Shader(scene) 00034 {}; 00035 00042 ColorRGBA Shade(Ray &ray) 00043 { 00044 PAIR uv = ray.hit->GetUV(ray); 00045 00046 float x = uv.first * 50.0; 00047 float y = uv.second * 25.0; 00048 float z = scene->timer.GetTime() * 0.01; 00049 float total = pnoise.noise(x,y,z); 00050 00051 if (total < 0) total = 0; 00052 if (total > 1) total = 1; 00053 00054 ColorRGBA result = ColorRGBA(0).interpolated(ColorRGBA(ray.hit->GetNormal(ray).Abs()),total); 00055 return result; 00056 }; 00057 }; 00058 00059 #endif