Exemplo n.º 1
0
 protected override void Draw(Microsoft.Xna.Framework.GameTime gt, PloobsEngine.SceneControl.IObject obj, PloobsEngine.SceneControl.RenderHelper render, PloobsEngine.Cameras.ICamera cam, IList<PloobsEngine.Light.ILight> lights)
 {
        render.PushBlendState(laser_blends);
        effect.CurrentTechnique = effect_technique;                            
        world.SetValue(obj.WorldMatrix);
        wvp.SetValue(shader_matrices_combined[1] = obj.WorldMatrix * cam.View * cam.Projection);
        effect_color.SetValue(color.ToVector4());
        effect_center_to_viewer.SetValue(cam.Position);
        render.RenderBatch(obj.Modelo.GetBatchInformation(0)[0], effect);
        render.PopBlendState();
 }
 public override void PosDrawPhase(GameTime gt, PloobsEngine.SceneControl.IObject obj, PloobsEngine.SceneControl.RenderHelper render, PloobsEngine.Cameras.ICamera cam, IList<PloobsEngine.Light.ILight> lights)
 {
     Matrix wld = obj.WorldMatrix;
     for (int i = 0; i < obj.Modelo.MeshNumber; i++)
     {
         BatchInformation[] bi = obj.Modelo.GetBatchInformation(i);
         for (int j = 0; j < bi.Count(); j++)
         {                                       
             this._shader2.Parameters["DiffuseMap"].SetValue(obj.Modelo.GetTextureInformation(i)[j].getTexture(TextureType.DIFFUSE));
             Matrix w1 = Matrix.Multiply(bi[j].ModelLocalTransformation, wld);
             this._shader2.Parameters["worldViewProjection"].SetValue(w1 * cam.ViewProjection);
             this._shader2.Parameters["lightSamplerBuffer"].SetValue(render[PrincipalConstants.lightRt]);
             this._shader2.Parameters["LightBufferPixelSize"].SetValue(new Vector2(0.5f / render[PrincipalConstants.lightRt].Width, 0.5f / render[PrincipalConstants.lightRt].Height));
             render.RenderBatch(bi[j], _shader2);
         }
     }       
 }
        protected override void Draw(Microsoft.Xna.Framework.GameTime gt, PloobsEngine.SceneControl.IObject obj, PloobsEngine.SceneControl.RenderHelper render, PloobsEngine.Cameras.ICamera cam, IList<PloobsEngine.Light.ILight> lights)
        {
            this._shader.Parameters["FarClip"].SetValue(cam.FarPlane);
            this._shader.Parameters["View"].SetValue(cam.View);
            this._shader.Parameters["Projection"].SetValue(cam.Projection);            

            Matrix wld = obj.WorldMatrix;
            for (int i = 0; i < obj.Modelo.MeshNumber; i++)
            {
                BatchInformation[] bi = obj.Modelo.GetBatchInformation(i);
                for (int j = 0; j < bi.Count(); j++)
                {
                    
                    Matrix w1 = Matrix.Multiply(bi[j].ModelLocalTransformation, wld);
                    this._shader.Parameters["World"].SetValue(w1);
                    this._shader.Parameters["VPIT"].SetValue(Matrix.Transpose(Matrix.Invert(w1 * cam.View)));
                    render.RenderBatch(bi[j], _shader);
                }
            }
        }
        public override void PosDrawPhase(GameTime gt, PloobsEngine.SceneControl.IObject obj, PloobsEngine.SceneControl.RenderHelper render, PloobsEngine.Cameras.ICamera cam, IList<PloobsEngine.Light.ILight> lights)
        {
            render.PushRasterizerState(cullMode);
            render.PushBlendState(BlendState.NonPremultiplied);
            alphagradative.Parameters["camCenter"].SetValue(cam.Position);

            for (int i = 0; i < obj.Modelo.MeshNumber; i++)
            {
                BatchInformation[] bi = obj.Modelo.GetBatchInformation(i);

                for (int j = 0; j < bi.Count(); j++)
                {
                    alphagradative.Parameters["colorMap"].SetValue(obj.Modelo.getTexture(TextureType.DIFFUSE, i, j));
                    Matrix w1 = Matrix.Multiply(obj.WorldMatrix, bi[j].ModelLocalTransformation);
                    alphagradative.Parameters["wvp"].SetValue(w1 * cam.ViewProjection);
                    alphagradative.Parameters["w"].SetValue(w1);

                    render.RenderBatch(bi[j], alphagradative);
                }
            }
            render.PopBlendState();
            render.PopRasterizerState();         
        }