예제 #1
0
 public virtual void updateEffects(Effect effect)
 {
     if (effectContainer == null || effect == null)
     {
         return;
     }
     effectContainer.updateMutable(this);
     effectContainer.drawMutable(effect);
 }
예제 #2
0
        public void render()
        {
            //just needed if shader effect
            EffectContainer.updateMutable(landscape);
            EffectContainer.drawMutable();
            foreach (EffectPass pass in EffectContainer.getEffect().CurrentTechnique.Passes)
            {
                pass.Apply();
                //just needed if BasicEffect
                if (EffectContainer.getEffect().GetType() == typeof(BasicEffect))
                {
                    ((BasicEffect)EffectContainer.getEffect()).EnableDefaultLighting();
                    ((BasicEffect)EffectContainer.getEffect()).LightingEnabled        = true;
                    ((BasicEffect)EffectContainer.getEffect()).PreferPerPixelLighting = true;

                    ((BasicEffect)EffectContainer.getEffect()).DirectionalLight0.Enabled       = true;
                    ((BasicEffect)EffectContainer.getEffect()).DirectionalLight0.DiffuseColor  = new Vector3(0.5f, 0, 0);
                    ((BasicEffect)EffectContainer.getEffect()).DirectionalLight0.SpecularColor = new Vector3(0, 1, 0);
                    ((BasicEffect)EffectContainer.getEffect()).DirectionalLight0.Direction     = new Vector3(1, -1, -1);
                    ((BasicEffect)EffectContainer.getEffect()).AmbientLightColor = new Vector3(0.5f, 0.7f, 0.7f);
                    ((BasicEffect)EffectContainer.getEffect()).EmissiveColor     = new Vector3(1, 0, 0);

                    landscape.Scene.Game.GraphicsDevice.Textures[0] = landscape.Scene.TextureManager.getTexture("base");
                }
                landscape.Scene.Game.GraphicsDevice.DrawIndexedPrimitives(PrimitiveType.TriangleList, 0, (patchSize / mapDetail) * (patchSize / mapDetail) * 6 * patchIndex, ((patchSize / mapDetail) + 1) * ((patchSize / mapDetail) + 1), (patchSize / mapDetail) * (patchSize / mapDetail) * 6 * patchIndex, (patchSize / mapDetail) * (patchSize / mapDetail) * 2);
                //device.DrawIndexedPrimitives(PrimitiveType.TriangleList, 0, (patchSize / mapDetail) * (patchSize / mapDetail) * 6, ((patchSize / mapDetail) + 1) * ((patchSize / mapDetail) + 1), (patchSize / mapDetail) * (patchSize / mapDetail) * 6, (patchSize / mapDetail) * (patchSize / mapDetail) * 2);
            }
        }