- Timestamp:
- 10/19/08 23:42:15 (16 years ago)
- Location:
- GTP/trunk/App/Demos/Vis/FriendlyCulling/src
- Files:
-
- 2 added
- 11 edited
Legend:
- Unmodified
- Added
- Removed
-
GTP/trunk/App/Demos/Vis/FriendlyCulling/src/Camera.h
r2986 r3045 42 42 { 43 43 friend class ShadowMap; 44 44 45 public: 45 46 … … 76 77 */ 77 78 void GetModelViewMatrix(Matrix4x4 &mat) const; 78 79 /** Returns the view orientation (the model view matrix without the translation) 80 */ 79 81 void GetViewOrientationMatrix(Matrix4x4 &mat) const; 80 82 /** Calculates a frustum from the projection and the modelview matrix. -
GTP/trunk/App/Demos/Vis/FriendlyCulling/src/Material.cpp
r3042 r3045 4 4 #include "glInterface.h" 5 5 #include "RenderState.h" 6 #include "ShaderProgram.h" 6 7 7 8 8 using namespace std; … … 24 24 mCullFaceEnabled = true; 25 25 26 mGPUVertexParameters = NULL; 26 mVertexProgramParameters.Reset(); 27 mFragmentProgramParameters.Reset(); 28 27 29 mVertexProgram = NULL; 28 29 mGPUFragmentParameters = NULL;30 30 mFragmentProgram = NULL; 31 31 } … … 42 42 43 43 44 Technique::~Technique()45 {46 //DEL_PTR(mGPUFragmentParameters);47 //DEL_PTR(mGPUVertexParameters);48 }49 50 51 44 Technique::Technique(const RgbaColor &color): 52 45 mDiffuseColor(color), … … 56 49 { 57 50 InitMaterial(); 51 } 52 53 54 Technique::Technique(const Technique &tech) 55 { 56 mAmbientColor = tech.mAmbientColor; 57 mDiffuseColor = tech.mDiffuseColor; 58 mSpecularColor = tech.mSpecularColor; 59 mEmmisiveColor = tech.mEmmisiveColor; 60 61 mVertexProgram = tech.mVertexProgram; 62 mFragmentProgram = tech.mFragmentProgram; 63 64 mAlphaTestEnabled = tech.mAlphaTestEnabled; 65 mCullFaceEnabled =tech.mCullFaceEnabled; 66 67 mTexture = tech.mTexture; 68 69 mVertexProgramParameters = tech.mVertexProgramParameters; 70 mFragmentProgramParameters = tech.mFragmentProgramParameters; 71 } 72 73 74 Technique::~Technique() 75 { 58 76 } 59 77 … … 74 92 mFragmentProgram = p; 75 93 76 m GPUFragmentParameters->Reset();77 m GPUFragmentParameters->SetProgram(p);94 mFragmentProgramParameters.Reset(); 95 mFragmentProgramParameters.SetProgram(p); 78 96 } 79 97 … … 83 101 mVertexProgram = p; 84 102 85 m GPUVertexParameters->Reset();86 m GPUVertexParameters->SetProgram(p);103 mVertexProgramParameters.Reset(); 104 mVertexProgramParameters.SetProgram(p); 87 105 } 106 107 108 /***********************************************/ 109 /* class Material implementation */ 110 /***********************************************/ 88 111 89 112 90 113 void Material::Render(RenderState *state) 91 114 { 92 mTechniques[0]->Render(state); 115 if (state->GetRenderPassType() == RenderState::DEFERRED) 116 mTechniques[1]->Render(state); 117 else 118 mTechniques[0]->Render(state); 93 119 } 94 120 … … 126 152 127 153 154 void Material::AddTechnique(Technique *tech) 155 { 156 mTechniques.push_back(tech); 128 157 } 158 159 160 } -
GTP/trunk/App/Demos/Vis/FriendlyCulling/src/Material.h
r3042 r3045 4 4 #include "glInterface.h" 5 5 #include "common.h" 6 #include "ShaderProgram.h" 6 7 7 8 … … 22 23 public: 23 24 24 float r, g, b, a;25 26 25 RgbaColor(): r(1), g(1), b(1), a(1) 27 26 {} … … 31 30 32 31 friend RgbaColor RandomColor(float a = 0.0f, float b = 1.0f); 32 33 34 ///////////////////// 35 36 float r, g, b, a; 33 37 }; 34 38 … … 50 54 */ 51 55 Technique(); 56 57 Technique(const Technique &tech); 52 58 53 59 ~Technique(); … … 88 94 ShaderProgram *GetVertexProgram() { return mVertexProgram; } 89 95 90 void SetFragmentProgramParameters(GPUProgramParameters *p) { mGPUFragmentParameters = p; }91 void SetVertexProgramParameters(GPUProgramParameters *p) { mGPUVertexParameters = p; }96 //void SetFragmentProgramParameters(const GPUProgramParameters &p) { mGPUFragmentParameters = p; } 97 //void SetVertexProgramParameters(const GPUProgramParameters &p) { mGPUVertexParameters = p; } 92 98 93 GPUProgramParameters *GetFragmentProgramParameters() { return mGPUFragmentParameters; } 94 GPUProgramParameters *GetVertexProgramParameters() { return mGPUVertexParameters; } 99 /** Each technique has a distict set of parameters. 100 */ 101 GPUProgramParameters * const GetFragmentProgramParameters() { return &mFragmentProgramParameters; } 102 GPUProgramParameters * const GetVertexProgramParameters() { return &mVertexProgramParameters; } 95 103 96 104 … … 109 117 Texture *mTexture; 110 118 111 GPUProgramParameters *mGPUVertexParameters;112 GPUProgramParameters *mGPUFragmentParameters;119 GPUProgramParameters mVertexProgramParameters; 120 GPUProgramParameters mFragmentProgramParameters; 113 121 114 122 ShaderProgram *mFragmentProgram; -
GTP/trunk/App/Demos/Vis/FriendlyCulling/src/ResourceManager.cpp
r3042 r3045 165 165 { 166 166 Shape *shape = *it; 167 167 168 Material *mat = shape->GetMaterial(); 168 Technique *tech = mat->GetDefaultTechnique(); 169 170 tech->SetVertexProgram(sTreeAnimation); 171 172 GPUProgramParameters *vtxParams = tech->GetVertexProgramParameters(); 173 174 vtxParams->SetTimerParam(0); 175 // wind direction 176 static Vector3 windDir = Normalize(Vector3(0.8f, 0.2f, 0.0f)); 177 vtxParams->SetValue3f(1, windDir.x, windDir.y, windDir.z); 178 // amplitude 179 vtxParams->SetValue1f(2, 0.3f); 180 181 AxisAlignedBox3 box = sceneGeom->GetBoundingBox(); 182 vtxParams->SetValue2f(3, box.Min().z, box.Max().z); 183 // frequency 184 vtxParams->SetValue1f(4, 0.1f); 169 170 // add the vertex animation program 171 for (int i = 0; i < 2; ++ i) 172 { 173 Technique *tech = mat->GetTechnique(i); 174 tech->SetVertexProgram(sTreeAnimation); 175 176 GPUProgramParameters *vtxParams = tech->GetVertexProgramParameters(); 177 178 vtxParams->SetTimerParam(0); 179 // wind direction 180 static Vector3 windDir = Normalize(Vector3(0.8f, 0.2f, 0.0f)); 181 vtxParams->SetValue3f(1, windDir.x, windDir.y, windDir.z); 182 // amplitude 183 vtxParams->SetValue1f(2, 0.3f); 184 185 AxisAlignedBox3 box = sceneGeom->GetBoundingBox(); 186 vtxParams->SetValue2f(3, box.Min().z, box.Max().z); 187 // frequency 188 vtxParams->SetValue1f(4, 0.1f); 189 } 185 190 } 186 191 } … … 279 284 } 280 285 281 if (tech->GetTexture()) 282 { 283 tech->mFragmentProgram = mMrtDefaultFragmentTexProgram; 284 285 tech->mGPUFragmentParameters = CreateGPUProgramParameters(tech->mFragmentProgram); 286 tech->mGPUFragmentParameters->SetTexture(0, tech->GetTexture()->GetId()); 286 287 /////////////// 288 //-- add technique for deferred shading 289 290 Technique *deferred = new Technique(*tech); 291 292 if (deferred->GetTexture()) 293 { 294 deferred->SetFragmentProgram(mMrtDefaultFragmentTexProgram); 295 deferred->GetFragmentProgramParameters()->SetViewMatrixParam(0); 296 deferred->GetFragmentProgramParameters()->SetTexture(1, tech->GetTexture()->GetId()); 287 297 } 288 298 else 289 299 { 290 tech->mFragmentProgram = mMrtDefaultFragmentProgram; 291 tech->mGPUFragmentParameters = CreateGPUProgramParameters(tech->mFragmentProgram); 292 } 293 294 tech->mVertexProgram = mMrtDefaultVertexProgram; 295 tech->mGPUVertexParameters = CreateGPUProgramParameters(tech->mVertexProgram); 296 300 deferred->SetFragmentProgram(mMrtDefaultFragmentProgram); 301 deferred->GetFragmentProgramParameters()->SetViewMatrixParam(0); 302 } 303 304 deferred->SetVertexProgram(mMrtDefaultVertexProgram); 305 306 mat->AddTechnique(deferred); 307 297 308 return mat; 298 309 } … … 393 404 394 405 395 GPUProgramParameters *ResourceManager::CreateGPUProgramParameters(ShaderProgram *p) 396 { 397 GPUProgramParameters *gpuParams = new GPUProgramParameters(p); 398 mGPUParameters.push_back(gpuParams); 399 400 return gpuParams; 401 } 402 403 404 ShaderProgram *ResourceManager::CreateFragmentProgram(const std::string &filename, const std::string &funcName) 406 407 ShaderProgram *ResourceManager::CreateFragmentProgram(const std::string &filename, 408 const std::string &funcName) 405 409 { 406 410 const string fullName = "src/shaders/" + filename + ".cg"; … … 460 464 mMrtDefaultFragmentProgram = CreateFragmentProgram("mrt", "frag"); 461 465 mMrtDefaultFragmentTexProgram = CreateFragmentProgram("mrt", "fragtex"); 462 mMrtDefaultFragmentTexProgram->AddParameter("tex", 0); 463 464 sTreeAnimation = CreateVertexProgram("treeanimation", "animateVtx"); 466 467 // provide the current view matrix 468 mMrtDefaultFragmentProgram->AddParameter("viewMatrix", 0); 469 mMrtDefaultFragmentTexProgram->AddParameter("viewMatrix", 0); 470 471 // add a texture parameter 472 mMrtDefaultFragmentTexProgram->AddParameter("tex", 1); 473 474 sTreeAnimation = CreateVertexProgram("treeanimation", "animateVtxMrt"); 465 475 466 476 sTreeAnimation->AddParameter("timer", 0); -
GTP/trunk/App/Demos/Vis/FriendlyCulling/src/ResourceManager.h
r3038 r3045 24 24 class Transform3; 25 25 class ShaderProgram; 26 class GPUProgramParameters;27 26 28 27 -
GTP/trunk/App/Demos/Vis/FriendlyCulling/src/ShaderProgram.cpp
r3043 r3045 2 2 #include "Matrix4x4.h" 3 3 #include "Timer/PerfTimer.h" 4 #include "Vector3.h" 5 #include "Camera.h" 4 6 5 7 … … 9 11 { 10 12 13 ////////// 14 //-- changing shader parameters 11 15 static float sCurrentTimer = 0; 12 13 14 GPUProgramParameters::GPUProgramParameters(ShaderProgram *p) 15 : mProgram(p), mTimer(-1) 16 static Matrix4x4 sCurrentViewMatrix = IdentityMatrix(); 17 static Vector3 sCurrentViewVector = Vector3::UNIT_Y(); 18 19 20 GPUProgramParameters::GPUProgramParameters(ShaderProgram *p): 21 mProgram(p), 22 mTimerParam(-1), 23 mViewVectorParam(-1), 24 mViewMatrixParam(-1) 25 { 26 } 27 28 29 GPUProgramParameters::GPUProgramParameters(): 30 mProgram(NULL), 31 mTimerParam(-1), 32 mViewVectorParam(-1), 33 mViewMatrixParam(-1) 16 34 { 17 35 } … … 25 43 mArrays.clear(); 26 44 27 mTimer = -1; 45 mTimerParam = -1; 46 mViewVectorParam = -1; 47 mViewMatrixParam = -1; 28 48 } 29 49 … … 107 127 void GPUProgramParameters::SetTimerParam(int idx) 108 128 { 109 mTimer = idx; 129 mTimerParam = idx; 130 } 131 132 133 void GPUProgramParameters::SetViewMatrixParam(int idx) 134 { 135 mViewMatrixParam = idx; 136 } 137 138 139 void GPUProgramParameters::SetViewVectorParam(int idx) 140 { 141 mViewVectorParam = idx; 110 142 } 111 143 … … 161 193 void GPUProgramParameters::UpdateParameters() 162 194 { 195 if (!mProgram) return; 196 163 197 for (int i = 0; i < (int)mFloats.size(); ++ i) 164 198 { … … 221 255 } 222 256 223 if (mTimer >= 0) 224 { 225 static PerfTimer mytimer; 226 mProgram->SetValue1f(mTimer, sCurrentTimer); 227 } 228 } 229 230 231 void GPUProgramParameters::InitFrame() 257 if (mTimerParam >= 0) 258 mProgram->SetValue1f(mTimerParam, sCurrentTimer); 259 260 if (mViewVectorParam >= 0) 261 mProgram->SetValue3f(mViewVectorParam, sCurrentViewVector.x, sCurrentViewVector.y, sCurrentViewVector.z); 262 263 if (mViewMatrixParam >= 0) 264 mProgram->SetMatrix(mViewMatrixParam, sCurrentViewMatrix); 265 } 266 267 268 void GPUProgramParameters::InitFrame(Camera *cam) 232 269 { 233 270 static PerfTimer mytimer; 234 271 sCurrentTimer = mytimer.Elapsedms(false) * M_PI / 180.0f; 272 273 cam->GetModelViewMatrix(sCurrentViewMatrix); 274 sCurrentViewVector = cam->GetDirection(); 235 275 } 236 276 -
GTP/trunk/App/Demos/Vis/FriendlyCulling/src/ShaderProgram.h
r3043 r3045 32 32 { 33 33 public: 34 /** Default construction. 35 */ 36 GPUProgramParameters(); 34 37 35 38 /** Constructor which initialized this parameter set for a given program. … … 54 57 void SetArray3f(int idx, float *vals, int numElements); 55 58 56 void SetTimerParam(int idx);57 58 59 /** Sets the texture parameter. 59 60 */ … … 63 64 void SetMatrix(int idx, Matrix4x4 *mat); 64 65 66 //////////// 67 //-- The following parameters are updated and set automatically once per frame. 68 69 /** This parameter is connected to a timer that is updated once per frame. 70 */ 71 void SetTimerParam(int idx); 72 /** This parameter is connected to the current view matrix that is updated 73 once per frame. 74 */ 75 void SetViewMatrixParam(int idx); 76 /** This parameter is connected to the current view vector that is updated 77 once per frame. 78 */ 79 void SetViewVectorParam(int idx); 80 81 65 82 66 83 /////////// … … 84 101 */ 85 102 void UpdateParameters(); 86 87 88 static void InitFrame(); 103 /** Function should be called once per frame to update frame related parameters. 104 */ 105 static void InitFrame(Camera *cam); 106 89 107 90 108 protected: … … 142 160 }; 143 161 144 162 /// the program this parameter set is connected to 145 163 ShaderProgram *mProgram; 146 164 147 int mTimer; 165 int mTimerParam; 166 int mViewVectorParam; 167 int mViewMatrixParam; 168 148 169 std::vector<FloatParam> mFloats; 149 170 std::vector<IntParam> mTextures; -
GTP/trunk/App/Demos/Vis/FriendlyCulling/src/SkyPreetham.cpp
r3043 r3045 80 80 Material *mat = shape->GetMaterial(); 81 81 82 mat->GetDefaultTechnique()->SetFragmentProgram(mSkyFragProgram); 83 mat->GetDefaultTechnique()->SetVertexProgram(mSkyVtxProgram); 82 mat->GetTechnique(0)->SetFragmentProgram(mSkyFragProgram); 83 mat->GetTechnique(0)->SetVertexProgram(mSkyVtxProgram); 84 85 mat->GetTechnique(1)->SetFragmentProgram(mSkyFragProgram); 86 mat->GetTechnique(1)->SetVertexProgram(mSkyVtxProgram); 84 87 } 85 88 … … 115 118 116 119 Material *mat = mSkyDome->GetShape(0)->GetMaterial(); 117 Technique *tech = mat->GetDefaultTechnique(); 120 121 Technique *tech; 122 123 if (state->GetRenderPassType() == RenderState::DEFERRED) 124 tech = mat->GetTechnique(1); 125 else 126 tech = mat->GetTechnique(0); 118 127 119 128 GPUProgramParameters *vtxParams = tech->GetVertexProgramParameters(); … … 140 149 vtxParams->SetValue1f(8, 8e-5f); 141 150 } 142 /* 143 tech->GetVertexProgramParameters()->UpdateParameters(); 144 tech->GetVertexProgram()->Bind(); 145 146 tech->GetFragmentProgramParameters()->UpdateParameters(); 147 tech->GetFragmentProgram()->Bind(); 148 */ 151 149 152 // render sky dome 150 153 mSkyDome->Render(state); -
GTP/trunk/App/Demos/Vis/FriendlyCulling/src/chcdemo.cpp
r3044 r3045 868 868 } 869 869 870 GPUProgramParameters::InitFrame();871 872 870 873 871 if ((!shadowMap || !shadowTraverser) && (showShadowMap || renderLightView)) … … 883 881 // bring eye modelview matrix up-to-date 884 882 SetupEyeView(); 883 884 // set GPU related parameters 885 GPUProgramParameters::InitFrame(camera); 886 885 887 886 888 // hack … … 1857 1859 void RenderSky() 1858 1860 { 1859 //loader->EnableVertexProfile();1860 //loader->EnableFragmentProfile();1861 1862 1861 if ((renderMethod == RENDER_DEFERRED) || (renderMethod == RENDER_DEPTH_PASS_DEFERRED)) 1863 1862 state.SetRenderPassType(RenderState::DEFERRED); -
GTP/trunk/App/Demos/Vis/FriendlyCulling/src/shaders/mrt.cg
r3041 r3045 3 3 { 4 4 float4 position: POSITION; 5 float 3normal: NORMAL;5 float4 normal: NORMAL; 6 6 float4 color: COLOR0; 7 7 float4 texCoord: TEXCOORD0; … … 17 17 float4 color: COLOR0; 18 18 float4 eyePos: TEXCOORD1; // eye position 19 float 3normal: TEXCOORD2;19 float4 normal: TEXCOORD2; 20 20 }; 21 21 … … 30 30 float4 winPos: WPOS; 31 31 float4 eyePos: TEXCOORD1; // eye position 32 float 3normal: TEXCOORD2;32 float4 normal: TEXCOORD2; 33 33 }; 34 34 … … 56 56 OUT.position = mul(glstate.matrix.mvp, IN.position); 57 57 58 OUT.normal = IN.normal;58 OUT.normal = mul(glstate.matrix.invtrans.modelview[0], IN.normal); 59 59 60 60 return OUT; … … 63 63 64 64 pixel fragtex(fragin IN, 65 uniform sampler2D tex 65 uniform sampler2D tex, 66 uniform float4x4 viewMatrix 66 67 ) 67 68 { … … 76 77 // hack: use combination of emmisive + diffuse (emmisive used as constant ambient term) 77 78 pix.col = (glstate.material.emission + glstate.material.diffuse) * texColor; 78 // save world space normal in rt 79 pix.norm = IN.normal; 79 // save world space normal in rt => transform back into world space by 80 // multiplying with inverse view. since transforming normal with T means to 81 // multiply with the inverse transpose of T, we multiple with Transp(Inv(Inv(view))) = Transp(view) 82 pix.norm = mul(transpose(viewMatrix), IN.normal); 80 83 // compute eye linear depth 81 84 pix.col.w = length(IN.eyePos.xyz); … … 87 90 88 91 89 pixel frag(fragin IN )92 pixel frag(fragin IN, uniform float4x4 viewMatrix) 90 93 { 91 94 pixel pix; 92 95 // hack: use comination of emmisive + diffuse (emmisive used as constant ambient term) 93 96 pix.col = glstate.material.diffuse + glstate.material.emission; 94 // save world space normal in rt 95 pix.norm = IN.normal; 97 // save world space normal in rt => transform back into world space by 98 // multiplying with inverse view. since transforming normal with T means to 99 // multiply with the inverse transpose of T, we multiple with Transp(Inv(Inv(view))) = Transp(view) 100 pix.norm = mul(transpose(viewMatrix), IN.normal); 96 101 // eye space depth 97 102 pix.col.w = length(IN.eyePos.xyz); -
GTP/trunk/App/Demos/Vis/FriendlyCulling/src/shaders/treeanimation.cg
r3044 r3045 1 / /--------------------------------------------------------------------------------------2 / / Input and Output structs3 / /--------------------------------------------------------------------------------------1 /***********************************************/ 2 /* Vertex shaders for tree animation */ 3 /***********************************************/ 4 4 5 5 … … 7 7 { 8 8 float4 position: POSITION; 9 float3 normal: NORMAL; 9 float4 normal: NORMAL; 10 10 11 float4 color: COLOR; 12 //float4 color1: COLOR1; 13 11 14 float4 texCoord: TEXCOORD0; 12 15 }; … … 19 22 20 23 float4 color: COLOR0; 24 //float4 color1: COLOR1; 21 25 float4 eyePos: TEXCOORD1; // eye position 22 26 float3 normal: TEXCOORD2; … … 24 28 25 29 26 //-------------------------------------------------------------------------------------- 27 // Vertex Shaders 28 //-------------------------------------------------------------------------------------- 29 30 30 /** Vertex shader which conducts an simple tree animation 31 that bends the tree depending quadratically on the height 32 */ 31 33 vtxout animateVtx(vtxin IN, 32 34 uniform float3 windDir, … … 34 36 uniform float frequency, 35 37 uniform float2 minMaxPos, 36 uniform float timer) 38 uniform float timer, 39 uniform float3 lightDir) 37 40 { 38 41 vtxout OUT; 39 42 40 OUT.color = float4(0);//IN.color; 43 /* 44 // Transform vertex position into homogenous clip-space. 45 OUT.HPosition = mul(ModelViewProj, IN.Position); 46 // Transform normal from model-space to view-space. 47 float3 normalVec = normalize(mul(ModelViewIT, 48 IN.Normal).xyz); 49 // Store normalized light vector. 50 float3 lightVec = normalize(LightVec.xyz); 51 // Calculate half angle vector. 52 float3 eyeVec = float3(0.0, 0.0, 1.0); 53 float3 halfVec = normalize(lightVec + eyeVec); 54 // Calculate diffuse component. 55 float diffuse = dot(normalVec, lightVec); 56 // Calculate specular component. 57 float specular = dot(normalVec, halfVec); 58 // Use the lit function to compute lighting vector from 59 // diffuse and specular values. 60 float4 lighting = lit(diffuse, specular, 32); 61 // Blue diffuse material 62 float3 diffuseMaterial = float3(0.0, 0.0, 1.0); 63 // White specular material 64 float3 specularMaterial = float3(1.0, 1.0, 1.0); 65 // Combine diffuse and specular contributions and 66 // output final vertex color. 67 OUT.Color.rgb = lighting.y * diffuseMaterial + 68 lighting.z * specularMaterial; 69 OUT.Color.a = 1.0; 70 return OUT; 71 } 72 */ 41 73 OUT.texCoord = IN.texCoord; 42 74 43 75 const float pos = (minMaxPos.x - IN.position.z) / (minMaxPos.x - minMaxPos.y); 76 float factor = pos * pos * windStrength * sin(timer * frequency); 44 77 78 // transform the vertex position into post projection space 79 OUT.position = mul(glstate.matrix.mvp, IN.position); 80 // displace the input position 81 OUT.position += float4(factor * windDir, 0); 82 83 OUT.normal = mul(glstate.matrix.invtrans.modelview[0], IN.normal); 84 85 Out.color = IN.color * max(0, dot(OUT.normal, lightDir)); 86 //OUT.color1 = IN.color1; 87 88 return OUT; 89 } 90 91 /** vertex shader which conducts an simple tree animation 92 that bends the tree depending quadratically on the height 93 This version of the shader is used for deferred shading and thus only 94 displaces the vertices and outputs the color, put does not do any shading. 95 */ 96 vtxout animateVtxMrt(vtxin IN, 97 uniform float3 windDir, 98 uniform float windStrength, 99 uniform float frequency, 100 uniform float2 minMaxPos, 101 uniform float timer) 102 { 103 vtxout OUT; 104 105 OUT.color = IN.color; 106 //OUT.color1 = IN.color1; 107 108 OUT.texCoord = IN.texCoord; 109 110 const float pos = (minMaxPos.x - IN.position.z) / (minMaxPos.x - minMaxPos.y); 45 111 float factor = pos * pos * windStrength * sin(timer * frequency); 46 112 … … 54 120 OUT.eyePos += float4(factor * windDir, 0); 55 121 56 OUT.normal = IN.normal;57 122 OUT.normal = mul(glstate.matrix.invtrans.modelview[0], IN.normal); 123 58 124 return OUT; 59 125 }
Note: See TracChangeset
for help on using the changeset viewer.