当前位置: 首页>>代码示例>>C#>>正文


C# RenderHelper.PopRasterizerState方法代码示例

本文整理汇总了C#中RenderHelper.PopRasterizerState方法的典型用法代码示例。如果您正苦于以下问题:C# RenderHelper.PopRasterizerState方法的具体用法?C# RenderHelper.PopRasterizerState怎么用?C# RenderHelper.PopRasterizerState使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在RenderHelper的用法示例。


在下文中一共展示了RenderHelper.PopRasterizerState方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Draw

        protected override void Draw(Matrix view, Matrix Projection, RenderHelper render, PrimitiveBatch batch)
        {
            if (fill == false)
            {
                render.PushRasterizerState(state);
            }

            batch.Begin(PrimitiveType.TriangleList,view,Projection);
            foreach (var item in point)
            {
                batch.AddVertex(item, color);
            }
            batch.End();

            render.PopRasterizerState();
        }
开发者ID:brunoduartec,项目名称:port-ploobsengine,代码行数:16,代码来源:Triangles.cs

示例2: Draw

        protected override void Draw(Matrix view, Matrix Projection, RenderHelper render, PrimitiveBatch batch)
        {
            if (fill == false)
            {
                render.PushRasterizerState(state);
            }

            if (point.Count < 3)
            {
                throw new InvalidOperationException("Need at least 3 points to make a triangle strip");
            }

            batch.Begin(PrimitiveType.TriangleStrip,view,Projection);
            foreach (var item in point)
            {
                batch.AddVertex(item, color);       
            }
            batch.End();

            if (fill == false)
            {
                render.PopRasterizerState();
            }
        }
开发者ID:brunoduartec,项目名称:port-ploobsengine,代码行数:24,代码来源:TrianglesStrip.cs

示例3: Draw

        /// <summary>
        /// This is called when the screen should draw itself.
        /// </summary>
        /// <param name="gameTime"></param>
        /// <param name="render"></param>
        protected override void Draw(GameTime gameTime, RenderHelper render)
        {
            if (Keyboard.GetState().IsKeyDown(Keys.P))
            {
                MotionBlurPostEffect.Amount = MotionBlurPostEffect.Amount + 1; 
            }
            else if (Keyboard.GetState().IsKeyDown(Keys.O))
            {
                MotionBlurPostEffect.Amount = MotionBlurPostEffect.Amount - 1;
            }

            render.PushRasterizerState(RasterizerState);
            base.Draw(gameTime, render);
            render.PopRasterizerState();

            ///Draw some text on the screen
            render.RenderTextComplete("Demo: PostProcess Motion Blur", new Vector2(10, 15), Color.Red, Matrix.Identity);
            render.RenderTextComplete("Amount (0 to 255): " + MotionBlurPostEffect.Amount, new Vector2(10, 35), Color.Red, Matrix.Identity);
        }
开发者ID:brunoduartec,项目名称:port-ploobsengine,代码行数:24,代码来源:MotionForwardScreen.cs

示例4: RenderLights

        private void RenderLights(ICamera camera, IWorld world, RenderHelper render, GraphicInfo ginfo)
        {
            _lighting.Parameters["halfPixel"].SetValue(ginfo.HalfPixel);
            _lighting.Parameters["DepthBuffer"].SetValue(_depthBuffer);
            _lighting.Parameters["NormalBuffer"].SetValue(_normalBuffer);
            
            ApplyFrustumCorners(_lighting, -Vector2.One, Vector2.One);
            ApplyFrustumCorners(pointLightEffect, -Vector2.One, Vector2.One);  

            for (int i = 0; i < world.Lights.Count; i++)
            {
                if (world.Lights[i].LightType == LightType.Deferred_Directional)
                {
                    DirectionalLightPE dl = (DirectionalLightPE)world.Lights[i];
                    _lighting.Parameters["LightColor"].SetValue(dl.Color.ToVector4());
                    _lighting.Parameters["LightIntensity"].SetValue(dl.LightIntensity);
                    _lighting.Parameters["LightDir"].SetValue(dl.LightDirection);
                    render.RenderFullScreenQuadVertexPixel(_lighting);
                }

                else if (world.Lights[i].LightType == LightType.Deferred_Point)
                {

                    PointLightPE pl = world.Lights[i] as PointLightPE;
                    Matrix sphereWorldMatrix = Matrix.CreateScale(pl.LightRadius) * Matrix.CreateTranslation(pl.LightPosition);
                    ContainmentType ct = camera.BoundingFrustum.Contains(new BoundingSphere(pl.LightPosition, pl.LightRadius));

                    Vector3 viewSpaceLPos = Vector3.Transform(pl.LightPosition,
                                                            camera.View);
                    
                    pointLightEffect.Parameters["cameraPos"].SetValue(camera.Position);
                    pointLightEffect.Parameters["LightColor"].SetValue(pl.Color.ToVector4());
                    pointLightEffect.Parameters["LightPosition"].SetValue(viewSpaceLPos);
                    pointLightEffect.Parameters["lightRadius"].SetValue(pl.LightRadius);                    
                    
                    pointLightEffect.Parameters["WorldViewProjection"].SetValue(sphereWorldMatrix * camera.ViewProjection);
                    //pointLightEffect.Parameters["FarClip"].SetValue(camera.FarPlane);

                    float _tanFovy = (float)Math.Tan(camera.FieldOfView);
                    //pointLightEffect.Parameters["TanAspect"].SetValue(new Vector2(_tanFovy * camera.AspectRatio, -_tanFovy));
                    pointLightEffect.Parameters["GBufferPixelSize"].SetValue(new Vector2(0.5f / _width, 0.5f / _height));                                        
                    
                    pointLightEffect.Parameters["lightIntensity"].SetValue(pl.LightIntensity);
                                        
                    if (ct == ContainmentType.Contains || ct == ContainmentType.Intersects)
                    {   
                        float cameraToCenter = Vector3.Distance(camera.Position, pl.LightPosition);

                        if (cameraToCenter < pl.LightRadius + camera.NearPlane)
                            render.PushRasterizerState(RasterizerState.CullClockwise);
                        else
                            render.PushRasterizerState(RasterizerState.CullCounterClockwise);

                        render.RenderBatch(sphereModel.GetBatchInformation(0)[0], pointLightEffect);

                        render.PopRasterizerState();
                    }

                }
            }
        }
开发者ID:brunoduartec,项目名称:port-ploobsengine,代码行数:61,代码来源:LightPrePassRenderTechnic.cs

示例5: Draw

            public void Draw(RenderHelper render,ICamera2D cam)
            {
                render.SetSamplerState(SamplerState.AnisotropicWrap,0);
                render.PushRasterizerState(RasterizerState.CullNone);
                _basicEffect.Projection = cam.SimProjection;
                _basicEffect.View = cam.SimView;
                render.RenderUserPrimitive(_basicEffect,PrimitiveType.TriangleList, _borderVerts, 0, 8);

                render.PopRasterizerState();
                
            }        
开发者ID:brunoduartec,项目名称:port-ploobsengine,代码行数:11,代码来源:Border.cs

示例6: PreDraw

        protected override void PreDraw(RenderHelper render,GameTime gt, ref Matrix activeView, ref Matrix activeProjection)
        {
            if (!enable)
                return;

 	        base.PreDraw(render,gt, ref activeView, ref activeProjection);
            
            Matrix x = Matrix.Invert(activeView);
            Vector3 camPos = new Vector3(x.M41, x.M42, x.M43);
            
            effect.CurrentTechnique = effect.Techniques["RenderScene"];
            effect.Parameters["WorldViewProjection"].SetValue(Matrix.CreateTranslation(camPos) * activeView * activeProjection);
            //effect.Parameters["textureDiffuse"].SetValue(texture);
            render.device.Textures[0] = texture;            

            render.PushDepthStencilState(DepthStencilState.None);
            render.PushRasterizerState(RasterizerState.CullNone);

            render.RenderBatch(bi, effect);

            render.PopRasterizerState();
            render.PopDepthStencilState();

        }
开发者ID:brunoduartec,项目名称:port-ploobsengine,代码行数:24,代码来源:Skybox.cs

示例7: Draw

        /// <summary>
        /// This is called when the screen should draw itself.
        /// </summary>
        /// <param name="gameTime"></param>
        /// <param name="render"></param>
        protected override void Draw(GameTime gameTime, RenderHelper render)
        {            

            render.PushRasterizerState(RasterizerState);
            base.Draw(gameTime, render);
            render.PopRasterizerState();

            ///Draw some text on the screen
            render.RenderTextComplete("Demo: PostProcess Demo", new Vector2(10, 15), Color.Red, Matrix.Identity);
            render.RenderTextComplete("MotionBlur Enabled : " + MotionBlurPostEffect.Enabled, new Vector2(10, 35), Color.Red, Matrix.Identity);
            render.RenderTextComplete("Bloom Enabled : " + BloomPostEffect.Enabled, new Vector2(10, 55), Color.Red, Matrix.Identity);
            
        }
开发者ID:brunoduartec,项目名称:port-ploobsengine,代码行数:18,代码来源:PostEffectScreen.cs

示例8: Draw

        protected override void Draw(GameTime gt, IObject obj, RenderHelper render, ICamera camera, IList<Light.ILight> lights)
        {
                float time = (float) gt.TotalGameTime.TotalMilliseconds / timeModulation;

                this._shader.Parameters["specularIntensity"].SetValue(specularIntensity);
                this._shader.Parameters["specularPower"].SetValue(specularPower);
                this._shader.Parameters["View"].SetValue(camera.View);
                this._shader.Parameters["camPos"].SetValue(camera.Position);
                this._shader.Parameters["ReflectionView"].SetValue(reflectiveViewMatrix);
                this._shader.Parameters["RefractionView"].SetValue(camera.View);

                //this._shader.Parameters["ReflectionMap"].SetValue(reflectionMap);
                //this._shader.Parameters["RefractionMap"].SetValue(refractionMap);
                //this._shader.Parameters["normalMap0"].SetValue(normal0);
                //this._shader.Parameters["normalMap1"].SetValue(normal1);
                render.Textures[0] = refractionMap;
                render.Textures[1] = reflectionMap;
                render.Textures[2] = normal0;
                render.Textures[3] = normal1;


                this._shader.Parameters["xWaveLength"].SetValue(waveLength);
                this._shader.Parameters["xWaveHeight"].SetValue(waveHeight);
                this._shader.Parameters["Time"].SetValue(time);
                this._shader.Parameters["WindForce"].SetValue(windForce);
                this._shader.Parameters["waterColor"].SetValue(waterColor);
                this._shader.Parameters["WindDirection"].SetValue(windDirection);
                this._shader.Parameters["Projection"].SetValue(camera.Projection);
                this._shader.Parameters["id"].SetValue(shaderId);

                render.PushRasterizerState(RasterizerState.CullNone);

                SamplerState s0 = render.SetSamplerState(SamplerState.LinearWrap, 0);
                SamplerState s1 = render.SetSamplerState(SamplerState.LinearWrap, 1);

                SamplerState s2 = render.SetSamplerState(SamplerState.LinearWrap, 2);
                SamplerState s3 = render.SetSamplerState(SamplerState.LinearWrap, 3);
                
                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(wld, bi[j].ModelLocalTransformation);
                        this._shader.Parameters["World"].SetValue(w1);
                        render.RenderBatch(bi[j], _shader);
                    }
                }
                render.PopRasterizerState();

                render.SetSamplerState(s0, 0);
                render.SetSamplerState(s1, 1);
                render.SetSamplerState(s2, 2);
                render.SetSamplerState(s3, 3);
        }
开发者ID:brunoduartec,项目名称:port-ploobsengine,代码行数:57,代码来源:DeferredWaterCompleteShader.cs

示例9: Draw

 protected override void Draw(GameTime gameTime, RenderHelper render)
 {
     if (wireframe)
     {
         render.PushRasterizerState(RasterizerState);
     }
     base.Draw(gameTime, render);
     if (wireframe)
     {
         render.PopRasterizerState();
     }
     
     render.RenderTextComplete("Terrain Sample", new Vector2(10, 15), Color.White, Matrix.Identity);
 }
开发者ID:brunoduartec,项目名称:port-ploobsengine,代码行数:14,代码来源:TerrainScreen.cs

示例10: Draw

        protected override void Draw(GameTime gameTime, RenderHelper render)
        {           
                if (wireframe)
                    render.PushRasterizerState(RasterizerState);
                base.Draw(gameTime, render);
                if (wireframe)
                    render.PopRasterizerState();

            render.RenderTextComplete("PloobsEngine on Windows Phone7", new Vector2(20, 10), Color.Red, Matrix.Identity,null,true
                ,SpriteSortMode.Deferred,SamplerState.LinearClamp);
        }
开发者ID:brunoduartec,项目名称:port-ploobsengine,代码行数:11,代码来源:TechTruthScreen.cs

示例11: Draw

        /// <summary>
        /// This is called when the screen should draw itself.
        /// </summary>
        /// <param name="gameTime"></param>
        /// <param name="render"></param>
        protected override void Draw(GameTime gameTime, RenderHelper render)
        {
            if (wireframe)
            {
                render.PushRasterizerState(RasterizerState);
            }
            base.Draw(gameTime, render);
            if (wireframe)
            {
                render.PopRasterizerState();
            }

            ///Draw some text on the screen
            render.RenderTextComplete("Demo: GeoClipMap Terrain", new Vector2(10, 15), Color.Red, Matrix.Identity);
        }
开发者ID:brunoduartec,项目名称:port-ploobsengine,代码行数:20,代码来源:TerrainGeoClipMap.cs

示例12: Draw

        /// <summary>
        /// Draw
        /// </summary>
        /// <param name="gt"></param>
        /// <param name="obj"></param>
        /// <param name="render">The render.</param>
        /// <param name="cam">The cam.</param>
        /// <param name="lights"></param>
        protected override void  Draw(GameTime gt, IObject obj, RenderHelper render, ICamera cam, IList<Light.ILight> lights)
        {
               this._shader.Parameters["TranslationAmount"].SetValue(translationRate * time);
               this._shader.Parameters["RotationAmount"].SetValue(rotationRate * time);
               this._shader.Parameters["time"].SetValue(time);                        
               this._shader.Parameters["id"].SetValue(shaderId);
               this._shader.Parameters["useParalax"].SetValue(useParalax);
               this._shader.Parameters["useGlow"].SetValue(useGlow);
               this._shader.Parameters["useBump"].SetValue(useBump);
               this._shader.Parameters["useSpecular"].SetValue(useSpecular);                                                   
               this._shader.Parameters["View"].SetValue(cam.View);
               this._shader.Parameters["Projection"].SetValue(cam.Projection);

                if(useParalax)
                    this._shader.Parameters["CameraPos"].SetValue(cam.Position);                               
                
                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._shader.Parameters["Texture"].SetValue(obj.Modelo.getTexture(TextureType.DIFFUSE,i,j));
                        if (useBump)
                        {
                            if (useParalax)
                            {
                                this._shader.Parameters["HeightMap"].SetValue(obj.Modelo.getTexture(TextureType.PARALAX,i,j));
                                this._shader.Parameters["scaleBias"].SetValue(scaleBias);
                            }

                            this._shader.Parameters["NormalMap"].SetValue(obj.Modelo.getTexture(TextureType.BUMP,i,j));

                        }
                        if (useSpecular)
                        {
                            this._shader.Parameters["SpecularMap"].SetValue(obj.Modelo.getTexture(TextureType.SPECULAR, i, j));
                        }
                        else
                        {
                            this._shader.Parameters["specularIntensity"].SetValue(specularIntensity);
                            this._shader.Parameters["specularPower"].SetValue(specularPower);
                            this._shader.Parameters["specularIntensityScale"].SetValue(SpecularIntensityMapScale);
                            this._shader.Parameters["specularPowerScale"].SetValue(SpecularPowerMapScale);
                        }

                        if (useGlow)
                            this._shader.Parameters["glow"].SetValue(obj.Modelo.getTexture(TextureType.GLOW, i, j));


                        Matrix w1 = Matrix.Multiply(bi[j].ModelLocalTransformation, wld);                    
                        this._shader.Parameters["World"].SetValue(w1);
                        this._shader.Parameters["WorldInverseTranspose"].SetValue(Matrix.Transpose(Matrix.Invert(w1)));
                        if (time != 0)
                            render.PushRasterizerState(RasterizerState.CullNone);

                        render.RenderBatch(bi[j],_shader);

                        if (time != 0)
                            render.PopRasterizerState();
                    }
                }               
            }
开发者ID:brunoduartec,项目名称:port-ploobsengine,代码行数:72,代码来源:DeferredShatterCustomShader.cs

示例13: DrawnSpotLight

        protected void DrawnSpotLight(ICamera camera, IList<ILight> lights, IDeferredGBuffer DeferredGBuffer,RenderHelper render)
        {
            render.PushRasterizerState(RasterizerState.CullNone);
            render.PushDepthStencilState(DepthStencilState.None);            
                        
            render.Textures[1] = DeferredGBuffer[GBufferTypes.NORMAL];
            render.Textures[2] = DeferredGBuffer[GBufferTypes.DEPH];
            SamplerState s2 = render.SetSamplerState(SamplerState.PointClamp, 2);

            spotLightEffect.Parameters["View"].SetValue(camera.View);
            spotLightEffect.Parameters["Projection"].SetValue(camera.Projection);
            spotLightEffect.Parameters["cameraPosition"].SetValue(camera.Position);

            ApplyFrustumCorners(directionalLightEffect.Parameters["FrustumCorners"], -Vector2.One, Vector2.One);            
            
            foreach (ILight item in lights)
            {
                if (item.LightType == LightType.Deferred_Spot && item.Enabled == true)
                {
                    SpotLightPE sl = item as SpotLightPE;
                    Vector3 viewSpaceLPos = Vector3.Transform(sl.Position, camera.View);
                    Vector3 viewSpaceLDir = Vector3.Transform(sl.Direction, camera.View);

                    spotLightEffect.Parameters["lightPosition"].SetValue(viewSpaceLPos);
                    spotLightEffect.Parameters["lightDirection"].SetValue(viewSpaceLDir);
                    spotLightEffect.Parameters["lightRadius"].SetValue(sl.LightRadius);
                    spotLightEffect.Parameters["lightDecayExponent"].SetValue(sl.ConeDecay);
                    spotLightEffect.Parameters["Color"].SetValue(sl.Color.ToVector3());
                    spotLightEffect.Parameters["lightAngleCosine"].SetValue(sl.LightAngleCosine);
                    spotLightEffect.Parameters["lightIntensity"].SetValue(sl.LightIntensity);                    

                    render.RenderFullScreenQuadVertexPixel(spotLightEffect);                    
                }
            }

            render.PopDepthStencilState();
            render.PopRasterizerState();
            render.SetSamplerState(s2, 2);
        }       
开发者ID:brunoduartec,项目名称:port-ploobsengine,代码行数:39,代码来源:PreLightMap.cs

示例14: DrawPointLight

        protected void DrawPointLight(ICamera camera, IList<ILight> lights, IDeferredGBuffer DeferredGBuffer,RenderHelper render)
        {            
            render.Textures[1] = DeferredGBuffer[GBufferTypes.NORMAL];
            render.Textures[2] = DeferredGBuffer[GBufferTypes.DEPH];
            SamplerState s2 = render.SetSamplerState(SamplerState.PointClamp, 2);
            PointcameraPosition.SetValue(camera.Position);
            
            float _tanFovy = (float)Math.Tan(camera.FieldOfView /2);
            pointLightEffect.Parameters["TanAspect"].SetValue(new Vector2(_tanFovy * camera.AspectRatio, -_tanFovy));
            pointLightEffect.Parameters["farPlane"].SetValue(camera.FarPlane);
            
            foreach (ILight item in lights)
            {
                if (item.LightType == LightType.Deferred_Point && item.Enabled == true)
                {
                    PointLightPE pl = item as PointLightPE;
                    Matrix sphereWorldMatrix = Matrix.CreateScale(pl.LightRadius) * Matrix.CreateTranslation(pl.LightPosition);
                    
                    ContainmentType ct = ContainmentType.Contains;
                    if(cullPointLight)
                        ct = camera.BoundingFrustum.Contains(new BoundingSphere(pl.LightPosition, pl.LightRadius ));
                    if (ct == ContainmentType.Contains || ct == ContainmentType.Intersects)
                    {

                        //convert light position into viewspace
                        Vector3 viewSpaceLPos = Vector3.Transform(pl.LightPosition,camera.View);

                        PointWordViewProjection.SetValue(sphereWorldMatrix * camera.ViewProjection);
                        PointlightPosition.SetValue(viewSpaceLPos);
                        PointColor.SetValue(pl.Color.ToVector3());
                        PointlightRadius.SetValue(pl.LightRadius);
                        PointlightIntensity.SetValue(pl.LightIntensity);
                        Pointquadratic.SetValue(pl.UsePointLightQuadraticAttenuation);

                        float cameraToCenter = Vector3.Distance(camera.Position, pl.LightPosition);

                        if (cameraToCenter < pl.LightRadius + camera.NearPlane)
                            render.PushRasterizerState(RasterizerState.CullClockwise);
                        else
                            render.PushRasterizerState(RasterizerState.CullCounterClockwise);

                        render.RenderBatch(sphereModel.GetBatchInformation(0)[0], pointLightEffect);

                        render.PopRasterizerState();
                    }
                  
                }
            }
            render.SetSamplerState(s2, 2);
        }
开发者ID:brunoduartec,项目名称:port-ploobsengine,代码行数:50,代码来源:PreLightMap.cs

示例15: Draw

        protected override void Draw(GameTime gt, IObject obj, RenderHelper render, ICamera cam, IList<ILight> lights)
        {
            Vector3 dir = cam.Target - cam.Position;
            dir.Normalize();
            _shader.Parameters["forward"].SetValue(dir);
            _shader.Parameters["camUp"].SetValue(cam.Up);
            _shader.Parameters["scaleX"].SetValue(scale.X);
            _shader.Parameters["scaleY"].SetValue(scale.Y);
            _shader.Parameters["xWorld"].SetValue(obj.PhysicObject.WorldMatrix);
            _shader.Parameters["xView"].SetValue(cam.View);
            _shader.Parameters["xProjection"].SetValue(cam.Projection);                        
            //_shader.Parameters["xBillboardTexture"].SetValue(obj.Modelo.getTexture(TextureType.DIFFUSE,0,0));
            render.Textures[0] = obj.Modelo.getTexture(TextureType.DIFFUSE, 0, 0);
            _shader.Parameters["atenuation"].SetValue(atenuation);

            render.PushRasterizerState(RasterizerState.CullNone);

            BatchInformation batchInfo = obj.Modelo.GetBatchInformation(0)[0];            
            {
                _shader.Parameters["alphaTest"].SetValue(alphaTestLimit);
                render.RenderBatch(batchInfo, _shader);
            }

            render.PopRasterizerState();
        }
开发者ID:brunoduartec,项目名称:port-ploobsengine,代码行数:25,代码来源:DeferredSphericalBilboardShader.cs


注:本文中的RenderHelper.PopRasterizerState方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。