Пример #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();
 }
        protected override void PosWithDepthDraw(PloobsEngine.SceneControl.RenderHelper render, Microsoft.Xna.Framework.GameTime gt, ref Microsoft.Xna.Framework.Matrix activeView, ref Microsoft.Xna.Framework.Matrix activeProjection)
        {                        
            effect.Parameters["InvProj"].SetValue(Matrix.Invert(activeView * activeProjection));
            effect.Parameters["halfPixel"].SetValue(GraphicInfo.HalfPixel);
            effect.Parameters["DepthBuffer"].SetValue(render[PrincipalConstants.DephRT]);

            render.PushBlendState(BlendState.AlphaBlend);
            foreach (var item in Decals)
            {
                effect.Parameters["ProjectedTexture"].SetValue(item.tex);
                effect.Parameters["ProjectorViewProjection"].SetValue(item.view * item.Projection);
                render.RenderFullScreenQuadVertexPixel(effect);
            }
            render.PopBlendState();

            base.PosWithDepthDraw(render, gt, ref activeView, ref activeProjection);
        }
        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();         
        }