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


C# IGraphicsService类代码示例

本文整理汇总了C#中IGraphicsService的典型用法代码示例。如果您正苦于以下问题:C# IGraphicsService类的具体用法?C# IGraphicsService怎么用?C# IGraphicsService使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


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

示例1: ObjectMotionBlur

        //--------------------------------------------------------------
        /// <summary>
        /// Initializes a new instance of the <see cref="ObjectMotionBlur"/> class.
        /// </summary>
        /// <param name="graphicsService">The graphics service.</param>
        /// <exception cref="ArgumentNullException">
        /// <paramref name="graphicsService"/> is <see langword="null"/>.
        /// </exception>
        public ObjectMotionBlur(IGraphicsService graphicsService)
            : base(graphicsService)
        {
            _effect = GraphicsService.Content.Load<Effect>("DigitalRune/PostProcessing/ObjectMotionBlur");
              _viewportSizeParameter = _effect.Parameters["ViewportSize"];
              _sourceTextureParameter = _effect.Parameters["SourceTexture"];
              _numberOfSamplesParameter = _effect.Parameters["NumberOfSamples"];
              _velocityTextureParameter = _effect.Parameters["VelocityTexture"];
              _velocityTexture2Parameter = _effect.Parameters["VelocityTexture2"];
              _maxBlurRadiusParameter = _effect.Parameters["MaxBlurRadius"];
              _sourceSizeParameter = _effect.Parameters["SourceSize"];
              _gBuffer0Parameter = _effect.Parameters["GBuffer0"];
              _jitterTextureParameter = _effect.Parameters["JitterTexture"];
              _softZExtentParameter = _effect.Parameters["SoftZExtent"];
              _singlePass = _effect.CurrentTechnique.Passes["Single"];
              _dualPass = _effect.CurrentTechnique.Passes["Dual"];
              _downsampleMaxParameter = _effect.CurrentTechnique.Passes["DownsampleMax"];
              _downsampleMaxFromFloatBufferParameter = _effect.CurrentTechnique.Passes["DownsampleMaxFromFloatBuffer"];
              _neighborMaxPass = _effect.CurrentTechnique.Passes["NeighborMax"];
              _softEdgePass = _effect.CurrentTechnique.Passes["SoftEdge"];
              _jitterTexture = NoiseHelper.GetGrainTexture(GraphicsService, 128);

              NumberOfSamples = 9;
              MaxBlurRadius = 20;
        }
开发者ID:Zolniu,项目名称:DigitalRune,代码行数:33,代码来源:ObjectMotionBlur.cs

示例2: GradientTextureSkyRenderer

        public GradientTextureSkyRenderer(IGraphicsService graphicsService)
        {
            if (graphicsService == null)
            throw new ArgumentNullException("graphicsService");

              if (graphicsService.GraphicsDevice.GraphicsProfile == GraphicsProfile.Reach)
            throw new NotSupportedException("The GradientTextureSkyRenderer does not support the Reach profile.");

              _effect = graphicsService.Content.Load<Effect>("DigitalRune/Sky/GradientTextureSky");
              _parameterView = _effect.Parameters["View"];
              _parameterProjection = _effect.Parameters["Projection"];
              _parameterSunDirection = _effect.Parameters["SunDirection"];
              _parameterTime = _effect.Parameters["Time"];
              _parameterColor = _effect.Parameters["Color"];
              _parameterFrontTexture = _effect.Parameters["FrontTexture"];
              _parameterBackTexture = _effect.Parameters["BackTexture"];
              _parameterAbcd = _effect.Parameters["Abcd"];
              _parameterEAndStrength = _effect.Parameters["EAndStrength"];
              _passLinear = _effect.Techniques[0].Passes["Linear"];
              _passGamma = _effect.Techniques[0].Passes["Gamma"];
              _passCieLinear = _effect.Techniques[0].Passes["CieLinear"];
              _passCieGamma = _effect.Techniques[0].Passes["CieGamma"];

              _submesh = MeshHelper.GetBox(graphicsService);
        }
开发者ID:Zolniu,项目名称:DigitalRune,代码行数:25,代码来源:GradientTextureSkyRenderer.cs

示例3: CubeMapShadowMaskRenderer

        //--------------------------------------------------------------
        /// <summary>
        /// Initializes a new instance of the <see cref="CubeMapShadowMaskRenderer"/> class.
        /// </summary>
        /// <param name="graphicsService">The graphics service.</param>
        /// <exception cref="ArgumentNullException">
        /// <paramref name="graphicsService"/> is <see langword="null"/>.
        /// </exception>
        public CubeMapShadowMaskRenderer(IGraphicsService graphicsService)
        {
            if (graphicsService == null)
            throw new ArgumentNullException("graphicsService");

              _effect = graphicsService.Content.Load<Effect>("DigitalRune/Deferred/CubeMapShadowMask");
              _parameterViewInverse = _effect.Parameters["ViewInverse"];
              _parameterFrustumCorners = _effect.Parameters["FrustumCorners"];
              _parameterGBuffer0 = _effect.Parameters["GBuffer0"];
              _parameterParameters0 = _effect.Parameters["Parameters0"];
              _parameterParameters1 = _effect.Parameters["Parameters1"];
              _parameterParameters2 = _effect.Parameters["Parameters2"];
              _parameterLightPosition = _effect.Parameters["LightPosition"];
              _parameterShadowView = _effect.Parameters["ShadowView"];
              _parameterJitterMap = _effect.Parameters["JitterMap"];
              _parameterShadowMap = _effect.Parameters["ShadowMap"];
              _parameterSamples = _effect.Parameters["Samples"];

              Debug.Assert(_parameterSamples.Elements.Count == _samples.Length);

              // TODO: Use struct parameter. Not yet supported in MonoGame.
              // Struct effect parameters are not yet supported in the MonoGame effect processor.
              //var parameterShadow = _effect.Parameters["ShadowParam"];
              //_parameterNear = parameterShadow.StructureMembers["Near"];
              //...
        }
开发者ID:Zolniu,项目名称:DigitalRune,代码行数:34,代码来源:CubeMapShadowMaskRenderer.cs

示例4: ScatteringSkyRenderer

        public ScatteringSkyRenderer(IGraphicsService graphicsService)
        {
            if (graphicsService == null)
            throw new ArgumentNullException("graphicsService");

              if (graphicsService.GraphicsDevice.GraphicsProfile == GraphicsProfile.Reach)
            throw new NotSupportedException("The ScatteringSkyRenderer does not support the Reach profile.");

              _effect = graphicsService.Content.Load<Effect>("DigitalRune/Sky/ScatteringSky");
              _parameterView = _effect.Parameters["View"];
              _parameterProjection = _effect.Parameters["Projection"];
              _parameterSunDirection = _effect.Parameters["SunDirection"];
              _parameterRadii = _effect.Parameters["Radii"];
              _parameterNumberOfSamples = _effect.Parameters["NumberOfSamples"];
              _parameterBetaRayleigh = _effect.Parameters["BetaRayleigh"];
              _parameterBetaMie = _effect.Parameters["BetaMie"];
              _parameterGMie = _effect.Parameters["GMie"];
              _parameterSunIntensity = _effect.Parameters["SunIntensity"];
              _parameterTransmittance = _effect.Parameters["Transmittance"];
              _parameterBaseHorizonColor = _effect.Parameters["BaseHorizonColor"];
              _parameterBaseZenithColor = _effect.Parameters["BaseZenithColor"];
              _passLinear = _effect.Techniques[0].Passes["Linear"];
              _passGamma = _effect.Techniques[0].Passes["Gamma"];
              _passLinearWithBaseColor = _effect.Techniques[0].Passes["LinearWithBaseColor"];
              _passGammaWithBaseColor = _effect.Techniques[0].Passes["GammaWithBaseColor"];

              _submesh = MeshHelper.GetBox(graphicsService);
        }
开发者ID:Zolniu,项目名称:DigitalRune,代码行数:28,代码来源:ScatteringSkyRenderer.cs

示例5: SaoFilter

        //--------------------------------------------------------------
        /// <summary>
        /// Initializes a new instance of the <see cref="SsaoFilter"/> class.
        /// </summary>
        /// <param name="graphicsService">The graphics service.</param>
        /// <exception cref="ArgumentNullException">
        /// <paramref name="graphicsService"/> is <see langword="null"/>.
        /// </exception>
        public SaoFilter(IGraphicsService graphicsService)
            : base(graphicsService)
        {
            Effect effect = GraphicsService.Content.Load<Effect>("DigitalRune/PostProcessing/SaoFilter");
              _frustumInfoParameter = effect.Parameters["FrustumInfo"];
              _numberOfAOSamplesParameter = effect.Parameters["NumberOfAOSamples"];
              _aoParameters0 = effect.Parameters["AOParameters0"];
              _aoParameters1 = effect.Parameters["AOParameters1"];
              _aoParameters2 = effect.Parameters["AOParameters2"];
              _sourceTextureParameter = effect.Parameters["SourceTexture"];
              _occlusionTextureParameter = effect.Parameters["OcclusionTexture"];
              _gBuffer0Parameter = effect.Parameters["GBuffer0"];
              //_viewParameter = _effect.Parameters["View"];
              //_gBuffer1Parameter = _effect.Parameters["GBuffer1"];
              _createAOPass = effect.CurrentTechnique.Passes["CreateAO"];
              _blurHorizontalPass = effect.CurrentTechnique.Passes["BlurHorizontal"];
              _blurVerticalPass = effect.CurrentTechnique.Passes["BlurVertical"];
              _blurVerticalAndCombinePass = effect.CurrentTechnique.Passes["BlurVerticalAndCombine"];

              Strength = 1;
              MaxOcclusion = 1;
              Radius = 0.5f;
              MinBias = 0.02f;
              Bias = 0.0004f;
              NumberOfSamples = 11;
              SampleDistribution = 7;
              BlurScale = 2;
              EdgeSoftness = 0.5f;
              CombineWithSource = true;
        }
开发者ID:Zolniu,项目名称:DigitalRune,代码行数:38,代码来源:SaoFilter.cs

示例6: DepthOfFieldFilter

        //--------------------------------------------------------------
        /// <summary>
        /// Initializes a new instance of the <see cref="DepthOfFieldFilter"/> class.
        /// </summary>
        /// <param name="graphicsService">The graphics service.</param>
        /// <exception cref="ArgumentNullException">
        /// <paramref name="graphicsService"/> is <see langword="null"/>.
        /// </exception>
        public DepthOfFieldFilter(IGraphicsService graphicsService)
            : base(graphicsService)
        {
            _effect = GraphicsService.Content.Load<Effect>("DigitalRune/PostProcessing/DepthOfFieldFilter");
              _screenSizeParameter = _effect.Parameters["ScreenSize"];
              _depthTextureParameter = _effect.Parameters["DepthTexture"];
              _nearBlurDistanceParameter = _effect.Parameters["NearBlurDistance"];
              _nearFocusDistanceParameter = _effect.Parameters["NearFocusDistance"];
              _farFocusDistanceParameter = _effect.Parameters["FarFocusDistance"];
              _farBlurDistanceParameter = _effect.Parameters["FarBlurDistance"];
              _farParameter = _effect.Parameters["Far"];
              _blurTextureParameter = _effect.Parameters["BlurTexture"];
              _downsampledDepthTextureParameter = _effect.Parameters["DownsampledDepthTexture"];
              _downsampledCocTextureParameter = _effect.Parameters["DownsampledCocTexture"];
              _offsetsParameter = _effect.Parameters["Offsets"];
              _weightsParameter = _effect.Parameters["Weights"];
              _sceneTextureParameter = _effect.Parameters["SceneTexture"];
              _circleOfConfusionPass = _effect.CurrentTechnique.Passes["CircleOfConfusion"];
              _blurPass = _effect.CurrentTechnique.Passes["Blur"];
              _depthOfFieldPass = _effect.CurrentTechnique.Passes["DepthOfField"];

              _downsampleFilter = PostProcessHelper.GetDownsampleFilter(graphicsService);

              _cocBlur = new Blur(graphicsService);
              _cocBlur.InitializeBoxBlur(5, false);

              NearBlurDistance = 2;
              NearFocusDistance = 5;
              FarFocusDistance = 6;
              FarBlurDistance = 10;
              _downsampleFactor = 2;
              BlurStrength = 1;
        }
开发者ID:Zolniu,项目名称:DigitalRune,代码行数:41,代码来源:DepthOfFieldFilter.cs

示例7: EditorBase

        public EditorBase(Microsoft.Xna.Framework.Game game)
            : base(game)
        {
            // Get services from the global service container.
            var services = (ServiceContainer)ServiceLocator.Current;
            UIContentManager = services.GetInstance<ContentManager>("UIContent");
            InputService = services.GetInstance<IInputService>();
            AnimationService = services.GetInstance<IAnimationService>();
            GraphicsService = services.GetInstance<IGraphicsService>();
            GameObjectService = services.GetInstance<IGameObjectService>();
            UIService = services.GetInstance<IUIService>();

            // Create a local service container which can be modified in samples:
            // The local service container is a child container, i.e. it inherits the
            // services of the global service container. Samples can add new services
            // or override existing entries without affecting the global services container
            // or other samples.
            Services = services.CreateChildContainer();

            // Load a UI theme, which defines the appearance and default values of UI controls.
            Theme theme = UIContentManager.Load<Theme>("BlendBlue/Theme");

            FigureRenderer = new FigureRenderer(GraphicsService, 2000);
            DebugRenderer = new DebugRenderer(GraphicsService, UIContentManager.Load<SpriteFont>("BlendBlue/Default"));
            UIRenderer = new UIRenderer(GraphicsService.GraphicsDevice, theme);

            UIScreen = new UIScreen("Main Screen", UIRenderer)
            {
                Background = Color.TransparentBlack,
            };

            UIService.Screens.Add(UIScreen);

            Scene = new Scene();
        }
开发者ID:mattbettcher,项目名称:kbPCB,代码行数:35,代码来源:EditorBase.cs

示例8: EdgeFilter

        //--------------------------------------------------------------
        /// <summary>
        /// Initializes a new instance of the <see cref="EdgeFilter"/> class.
        /// </summary>
        /// <param name="graphicsService">The graphics service.</param>
        /// <exception cref="ArgumentNullException">
        /// <paramref name="graphicsService"/> is <see langword="null"/>.
        /// </exception>
        public EdgeFilter(IGraphicsService graphicsService)
            : base(graphicsService)
        {
            _effect = GraphicsService.Content.Load<Effect>("DigitalRune/PostProcessing/EdgeFilter");
              _parameterViewportSize = _effect.Parameters["ViewportSize"];
              _parameterHalfEdgeWidth = _effect.Parameters["HalfEdgeWidth"];
              _parameterDepthThreshold = _effect.Parameters["DepthThreshold"];
              _parameterDepthSensitivity = _effect.Parameters["DepthSensitivity"];
              _parameterNormalThreshold = _effect.Parameters["NormalThreshold"];
              _parameterNormalSensitivity = _effect.Parameters["NormalSensitivity"];
              _parameterCameraBackward = _effect.Parameters["CameraBackward"];
              _parameterSourceTexture = _effect.Parameters["SourceTexture"];
              _parameterSilhouetteColor = _effect.Parameters["SilhouetteColor"];
              _parameterCreaseColor = _effect.Parameters["CreaseColor"];
              _parameterGBuffer0 = _effect.Parameters["GBuffer0"];
              _parameterGBuffer1 = _effect.Parameters["GBuffer1"];
              _passEdge = _effect.Techniques[0].Passes["Edge"];
              _passOnePixelEdge = _effect.Techniques[0].Passes["OnePixelEdge"];

              EdgeWidth = 2.0f;
              DepthThreshold = 0.001f;  // = minDistance / farPlaneDistance
              DepthSensitivity = 1000;  // = farPlaneDistance / (maxDistance - minDistance)
              NormalThreshold = 0.1f;
              NormalSensitivity = 2f;
              SilhouetteColor = new Vector4F(0, 0, 0, 1);
              CreaseColor = new Vector4F(0, 0, 0, 1);
        }
开发者ID:Zolniu,项目名称:DigitalRune,代码行数:35,代码来源:EdgeFilter.cs

示例9: CloudMapRenderer

        public CloudMapRenderer(IGraphicsService graphicsService)
        {
            if (graphicsService == null)
            throw new ArgumentNullException("graphicsService");

              if (graphicsService.GraphicsDevice.GraphicsProfile == GraphicsProfile.Reach)
            throw new NotSupportedException("The CloudMapRenderer does not support the Reach profile.");

              // One 512x512 noise texture is used for all layers. Each layer which does not have
              // a user defined texture uses a part of this texture.
              _noiseTexture = NoiseHelper.GetGrainTexture(graphicsService, 512);

              _effect = graphicsService.Content.Load<Effect>("DigitalRune/Sky/CloudLayer");
              _parameterViewportSize = _effect.Parameters["ViewportSize"];
              _parameterTexture0Parameters = _effect.Parameters["Texture0Parameters"];
              _parameterTexture1Parameters = _effect.Parameters["Texture1Parameters"];
              _parameterLerp = _effect.Parameters["LerpParameter"];

              _parameterTextures = new EffectParameter[LayeredCloudMap.NumberOfTextures];
              _parameterDensities = new EffectParameter[LayeredCloudMap.NumberOfTextures];
              _parameterMatrices = new EffectParameter[LayeredCloudMap.NumberOfTextures];
              for (int i = 0; i < LayeredCloudMap.NumberOfTextures; i++)
              {
            _parameterTextures[i] = _effect.Parameters["NoiseTexture" + i];
            _parameterDensities[i] = _effect.Parameters["Density" + i];
            _parameterMatrices[i] = _effect.Parameters["Matrix" + i];
              }

              _parameterCoverage = _effect.Parameters["Coverage"];
              _parameterDensity = _effect.Parameters["Density"];

              _passLerp = _effect.Techniques[0].Passes["Lerp"];
              _passDensity = _effect.Techniques[0].Passes["Density"];
        }
开发者ID:Zolniu,项目名称:DigitalRune,代码行数:34,代码来源:CloudMapRenderer.cs

示例10: LuminanceFilter

        //--------------------------------------------------------------
        /// <summary>
        /// Initializes a new instance of the <see cref="LuminanceFilter"/> class.
        /// </summary>
        /// <param name="graphicsService">The graphics service.</param>
        /// <exception cref="ArgumentNullException">
        /// <paramref name="graphicsService"/> is <see langword="null"/>.
        /// </exception>
        public LuminanceFilter(IGraphicsService graphicsService)
            : base(graphicsService)
        {
            _effect = GraphicsService.Content.Load<Effect>("DigitalRune/PostProcessing/LuminanceFilter");
              _useGeometricMeanParameter = _effect.Parameters["UseGeometricMean"];
              _useAdaptionParameter = _effect.Parameters["UseAdaption"];
              _deltaTimeParameter = _effect.Parameters["DeltaTime"];
              _adaptionSpeedParameter = _effect.Parameters["AdaptionSpeed"];
              _lastLuminanceTextureParameter = _effect.Parameters["LastLuminanceTexture"];
              _textureParameter = _effect.Parameters["SourceTexture"];
              _sourceSizeParameter = _effect.Parameters["SourceSize"];
              _targetSizeParameter = _effect.Parameters["TargetSize"];
              _createPass = _effect.CurrentTechnique.Passes["Create"];
              _downsamplePass = _effect.CurrentTechnique.Passes["Downsample"];
              _finalPass = _effect.CurrentTechnique.Passes["Final"];

              _downsampleFilter = PostProcessHelper.GetDownsampleFilter(graphicsService);
              _copyFilter = PostProcessHelper.GetCopyFilter(graphicsService);

              UseGeometricMean = true;
              UseAdaption = true;
              AdaptionSpeed = 0.02f;

              DefaultTargetFormat = new RenderTargetFormat(1, 1, false, SurfaceFormat.HalfVector4, DepthFormat.None);
        }
开发者ID:Zolniu,项目名称:DigitalRune,代码行数:33,代码来源:LuminanceFilter.cs

示例11: FigurePickerObject

        public FigurePickerObject(IGraphicsService graphicsService, Scene scene, Editor2DCameraObject cameraObject, DebugRenderer debugRenderer)
        {
            _cameraObject = cameraObject;
            _scene = scene;
            _debugRenderer = debugRenderer;

            // Create a collision domain which manages all collision objects used for
            // picking: the picking object and the collision objects for figure nodes.
            _collisionDomain = new CollisionDomain(new CollisionDetection());

            // Create the picking object:
            // The picking object represents the mouse cursor or the reticle. Usually 
            // a ray is used, but in this example we want to use a cylinder/cone. This 
            // allows to check which objects within a certain radius of the reticle. A 
            // picking cylinder/cone is helpful for touch devices where the picking is 
            // done with an imprecise input method like the human finger.

            // We want to pick objects in 10 pixel radius around the reticle. To determine 
            // the world space size of the required cylinder/cone, we can use the projection
            // and the viewport. 
            const float pickingRadius = 0.25f;
            var projection = _cameraObject.CameraNode.Camera.Projection;
            var viewport = graphicsService.GraphicsDevice.Viewport;

            Shape pickingShape;
            if (projection is OrthographicProjection)
            {
                // Use cylinder for orthographic projections:
                // The cylinder is centered at the camera position and reaches from the 
                // camera position to the camera far plane. A TransformedShape is used
                // to rotate and translate the cylinder.
                float radius = projection.Width / viewport.Width * pickingRadius;
                pickingShape = new TransformedShape(
                  new GeometricObject(
                    new CylinderShape(radius, projection.Far),
                    new Pose(new Vector3F(0, 0, -projection.Far / 2), Matrix33F.CreateRotationX(ConstantsF.PiOver2))));
            }
            else
            {
                // Use cone for perspective projections:
                // The cone tip is at the camera position and the cone base is at the 
                // camera far plane. 

                // Compute the radius at the far plane that projects to 10 pixels in screen space.
                float radius = viewport.Unproject(
                  new Vector3(viewport.Width / 2.0f + pickingRadius, viewport.Height / 2.0f, 1),
                  (Matrix)_cameraObject.CameraNode.Camera.Projection.ToMatrix44F(),
                  Matrix.Identity,
                  Matrix.Identity).X;

                // A transformed shape is used to rotate and translate the cone.
                pickingShape = new TransformedShape(
                  new GeometricObject(
                    new ConeShape(radius, projection.Far),
                    new Pose(new Vector3F(0, 0, -projection.Far), Matrix33F.CreateRotationX(ConstantsF.PiOver2))));
            }

            // Create collision object with the picking shape.
            _pickingObject = new CollisionObject(new GeometricObject(pickingShape, _cameraObject.CameraNode.PoseWorld));
        }
开发者ID:mattbettcher,项目名称:kbPCB,代码行数:60,代码来源:FigurePickerObject.cs

示例12: TerrainRoadLayer

        //--------------------------------------------------------------
        /// <overloads>
        /// <summary>
        /// Initializes a new instance of the <see cref="TerrainRoadLayer"/> class.
        /// </summary>
        /// </overloads>
        /// 
        /// <summary>
        /// Initializes a new instance of the <see cref="TerrainRoadLayer"/> class with the default
        /// material.
        /// </summary>
        /// <param name="graphicService">The graphic service.</param>
        /// <exception cref="ArgumentNullException">
        /// <paramref name="graphicService"/> is <see langword="null"/>.
        /// </exception>
        public TerrainRoadLayer(IGraphicsService graphicService)
        {
            if (graphicService == null)
            throw new ArgumentNullException("graphicService");

              var effect = graphicService.Content.Load<Effect>("DigitalRune/Terrain/TerrainRoadLayer");
              Material = new Material
              {
            { "Detail", new EffectBinding(graphicService, effect, null, EffectParameterHint.Material) }
              };

              FadeOutStart = int.MaxValue;
              FadeOutEnd = int.MaxValue;
              TileSize = 1;
              DiffuseColor = new Vector3F(1, 1, 1);
              SpecularColor = new Vector3F(1, 1, 1);
              SpecularPower = 10;
              Alpha = 1;
              DiffuseTexture = graphicService.GetDefaultTexture2DWhite();
              SpecularTexture = graphicService.GetDefaultTexture2DBlack();
              NormalTexture = graphicService.GetDefaultNormalTexture();
              HeightTextureScale = 1;
              HeightTexture = graphicService.GetDefaultTexture2DBlack();
              RoadLength = 1;
        }
开发者ID:Zolniu,项目名称:DigitalRune,代码行数:40,代码来源:TerrainRoadLayer.cs

示例13: CloudLayerRenderer

        public CloudLayerRenderer(IGraphicsService graphicsService)
        {
            if (graphicsService == null)
            throw new ArgumentNullException("graphicsService");

              if (graphicsService.GraphicsDevice.GraphicsProfile == GraphicsProfile.Reach)
            throw new NotSupportedException("The CloudLayerRenderer does not support the Reach profile.");

              _effect = graphicsService.Content.Load<Effect>("DigitalRune/Sky/CloudLayer");
              _parameterView = _effect.Parameters["View"];
              _parameterProjection = _effect.Parameters["Projection"];
              _parameterSunDirection = _effect.Parameters["SunDirection"];
              _parameterSkyCurvature = _effect.Parameters["SkyCurvature"];
              _parameterTextureMatrix = _effect.Parameters["Matrix0"];
              _parameterNumberOfSamples = _effect.Parameters["NumberOfSamples"];
              _parameterSampleDistance = _effect.Parameters["SampleDistance"];
              _parameterScatterParameters = _effect.Parameters["ScatterParameters"];
              _parameterHorizonFade = _effect.Parameters["HorizonFade"];
              _parameterSunLight = _effect.Parameters["SunLight"];
              _parameterAmbientLight = _effect.Parameters["AmbientLight"];
              _parameterTexture = _effect.Parameters["NoiseTexture0"];
              _passCloudRgbLinear = _effect.Techniques[0].Passes["CloudRgbLinear"];
              _passCloudAlphaLinear = _effect.Techniques[0].Passes["CloudAlphaLinear"];
              _passCloudRgbGamma = _effect.Techniques[0].Passes["CloudRgbGamma"];
              _passCloudAlphaGamma = _effect.Techniques[0].Passes["CloudAlphaGamma"];
              _passOcclusionRgb = _effect.Techniques[0].Passes["OcclusionRgb"];
              _passOcclusionAlpha = _effect.Techniques[0].Passes["OcclusionAlpha"];

              // We render a spherical patch into the sky. But any mesh which covers the top
              // hemisphere works too.
              //_submesh = MeshHelper.CreateSpherePatch(graphicsService.GraphicsDevice, 1, 1.1f, 10);
              _submesh = MeshHelper.CreateBox(graphicsService.GraphicsDevice);

              _queryGeometry = new Vector3F[4];
        }
开发者ID:Zolniu,项目名称:DigitalRune,代码行数:35,代码来源:CloudLayerRenderer.cs

示例14: GodRayFilter

        //--------------------------------------------------------------
        /// <summary>
        /// Initializes a new instance of the <see cref="GodRayFilter"/> class.
        /// </summary>
        /// <param name="graphicsService">The graphics service.</param>
        /// <exception cref="ArgumentNullException">
        /// <paramref name="graphicsService"/> is <see langword="null"/>.
        /// </exception>
        public GodRayFilter(IGraphicsService graphicsService)
            : base(graphicsService)
        {
            Effect effect = GraphicsService.Content.Load<Effect>("DigitalRune/PostProcessing/GodRayFilter");
              _viewportSizeParameter = effect.Parameters["ViewportSize"];
              _parameters0Parameter = effect.Parameters["Parameters0"];
              _parameters1Parameter = effect.Parameters["Parameters1"];
              _intensityParameter = effect.Parameters["Intensity"];
              _numberOfSamplesParameter = effect.Parameters["NumberOfSamples"];
              _sourceTextureParameter = effect.Parameters["SourceTexture"];
              _gBuffer0Parameter = effect.Parameters["GBuffer0"];
              _rayTextureParameter = effect.Parameters["RayTexture"];
              _createMaskPass = effect.CurrentTechnique.Passes["CreateMask"];
              _blurPass = effect.CurrentTechnique.Passes["Blur"];
              _combinePass = effect.CurrentTechnique.Passes["Combine"];

              _downsampleFilter = graphicsService.GetDownsampleFilter();

              Scale = 1;
              LightDirection = new Vector3F(0, -1, 0);
              LightRadius = 0.2f;
              Intensity = new Vector3F(1, 1, 1);
              DownsampleFactor = 4;
              NumberOfSamples = 8;
              NumberOfPasses = 2;
              Softness = 1;
        }
开发者ID:Zolniu,项目名称:DigitalRune,代码行数:35,代码来源:GodRayFilter.cs

示例15: SkyObjectRenderer

        public SkyObjectRenderer(IGraphicsService graphicsService)
        {
            if (graphicsService == null)
            throw new ArgumentNullException("graphicsService");

              if (graphicsService.GraphicsDevice.GraphicsProfile == GraphicsProfile.Reach)
            throw new NotSupportedException("The SkyObjectRenderer does not support the Reach profile.");

              // Load effect.
              _effect = graphicsService.Content.Load<Effect>("DigitalRune/Sky/SkyObject");
              _effectParameterViewProjection = _effect.Parameters["ViewProjection"];
              _effectParameterUp = _effect.Parameters["Up"];
              _effectParameterRight = _effect.Parameters["Right"];
              _effectParameterNormal = _effect.Parameters["Normal"];
              _effectParameterSunDirection = _effect.Parameters["SunDirection"];
              _effectParameterSunLight = _effect.Parameters["SunLight"];
              _effectParameterAmbientLight = _effect.Parameters["AmbientLight"];
              _effectParameterObjectTexture = _effect.Parameters["ObjectTexture"];
              _effectParameterTextureParameters = _effect.Parameters["TextureParameters"];
              _effectParameterLightWrapSmoothness = _effect.Parameters["LightWrapSmoothness"];
              _effectParameterGlow0 = _effect.Parameters["Glow0"];
              _effectParameterGlow1 = _effect.Parameters["Glow1"];
              _effectPassObjectLinear = _effect.Techniques[0].Passes["ObjectLinear"];
              _effectPassObjectGamma = _effect.Techniques[0].Passes["ObjectGamma"];
              _effectPassGlowLinear = _effect.Techniques[0].Passes["GlowLinear"];
              _effectPassGlowGamma = _effect.Techniques[0].Passes["GlowGamma"];
        }
开发者ID:Zolniu,项目名称:DigitalRune,代码行数:27,代码来源:SkyObjectRenderer.cs


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