예제 #1
0
            public void Render(Camera camera, Effect effect, EffectCache cache)
            {
                BoundingSphere bound = new BoundingSphere(WorldCenter, Radius);

                if (Frustum.CullResult.TotallyOutside != camera.Frustum.CullTest(bound))
                {
                    float bloom = Age;
                    bloom *= bloom * bloom;
                    bloom  = 1.0f - bloom;
                    bloom *= 0.2f;
                    ShaderGlobals.FixExplicitBloom(bloom);


                    GraphicsDevice device = BokuGame.bokuGame.GraphicsDevice;

                    Sphere sphere = Sphere.GetInstance();

                    sphere.PreDraw(device);

                    /// Set effect parameters here.
                    float ageParm = 2.0f - 2.0f / (Age + 1.0f);
                    Parameter(EffectParams.Age).SetValue(ageParm);
                    Parameter(EffectParams.Center).SetValue(new Vector4(WorldCenter, Radius));
                    Parameter(EffectParams.TexU).SetValue(TexU);
                    Parameter(EffectParams.TexV).SetValue(TexV);
                    Parameter(EffectParams.TexW).SetValue(TexW);

                    float colorParm = 1.0f - Age;
                    colorParm *= colorParm * colorParm;
                    colorParm  = 1.0f - colorParm;
                    Vector4 tint0 = new Vector4(0.5f * Tint.X, 1.0f * Tint.Y, 0.6f * Tint.Z, 1.0f);
                    Vector4 tint1 = new Vector4(Tint, 1.0f);
                    Vector4 tint  = tint0 + (tint1 - tint0) * colorParm;
                    Parameter(EffectParams.Tint0).SetValue(tint);
                    Parameter(EffectParams.Tint1).SetValue(tint);

                    sphere.DrawPrim(effect);
                }
            }