Пример #1
0
        public override void notifyMaterialRender(uint pass_id, OgreDotNet.MaterialPtr mat)
        {
            if (pass_id == 0xDEADBABE)
            {
                // "random_fractions" parameter
                fpParams.Get().setNamedConstant("random_fractions",
                                                new Math3D.Vector4(OgreDotNet.OgreMath.RangeRandom(0.0f, 1.0f),
                                                                   OgreDotNet.OgreMath.RangeRandom(0.0f, 1.0f), 0.0f, 0.0f)
                                                );

                // "depth_modulator" parameter
                float inc = (float)this.timer.getMicroseconds() / 1000.0f;
                if (((float)System.Math.Abs(curr - end) <= 0.001f))
                {
                    // take a new value to reach
                    end   = OgreDotNet.OgreMath.RangeRandom(0.95f, 1.0f);
                    start = curr;
                }
                else
                {
                    if (curr > end)
                    {
                        curr -= inc;
                    }
                    else
                    {
                        curr += inc;
                    }
                }
                timer.reset();

                fpParams.setNamedConstant("depth_modulator", new Math3D.Vector4(curr, 0.0f, 0.0f, 0.0f));
            }
        }
Пример #2
0
 public override void notifyMaterialSetup(uint pass_id, OgreDotNet.MaterialPtr mat)
 {
     if (pass_id == 0xDEADBABE)
     {
         timer.reset();
         fpParams = mat.Get().GetTechnique(0).getPass(0).getFragmentProgramParameters();
     }
 }