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


C# ParameterCollection.Set方法代码示例

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


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

示例1: Test1

        public void Test1()
        {
            var container1 = new ParameterCollection("container1");
            var container2 = new ParameterCollection("container2");
            var container3 = new ParameterCollection("container3");
            var container4 = new ParameterCollection("container4");

#pragma warning disable 612 // for ParameterPath and ParameterListener
            var path = new ParameterPath(PropertyContainer, PropertyContainer, PropertyContainer, PropertyFloat);
            var listener = new ParameterListener(container1, path);
#pragma warning restore 612

            int updateCounter = 0;
            object currentValue = null;

            listener.ParameterUpdated += (container, path2, newValue) => { updateCounter++; currentValue = newValue; };

            container1.Set(PropertyContainer, container2);
            container2.Set(PropertyContainer, container2);
            Assert.AreEqual(0, updateCounter);
            Assert.AreEqual(null, currentValue);

            // New value should have been detected (through cycle)
            container2.Set(PropertyFloat, 32.0f);
            Assert.AreEqual(1, updateCounter);
            Assert.AreEqual(32.0f, currentValue);

            // Setting it again should not trigger anything
            container2.Set(PropertyFloat, 32.0f);
            Assert.AreEqual(1, updateCounter);

            // Value should be resetted (because container3 doesn't point on any value)
            container2.Set(PropertyContainer, container3);
            Assert.AreEqual(2, updateCounter);
            Assert.AreEqual(null, currentValue);

            // New value should come from container3->container4
            container3.Set(PropertyContainer, container4);
            container4.Set(PropertyFloat, 48.0f);
            Assert.AreEqual(3, updateCounter);
            Assert.AreEqual(48.0f, currentValue);

            // Value should be again the one from container2
            container2.Set(PropertyContainer, container2);
            Assert.AreEqual(4, updateCounter);
            Assert.AreEqual(32.0f, currentValue);

            // Value should be resetted
            container2.Remove(PropertyFloat);
            Assert.AreEqual(5, updateCounter);
            Assert.AreEqual(null, currentValue);

            container1.Remove(PropertyContainer);
            Assert.AreEqual(5, updateCounter);
            Assert.AreEqual(null, currentValue);
        }
开发者ID:Powerino73,项目名称:paradox,代码行数:56,代码来源:TestParameterPath.cs

示例2: LoadContent

        protected override async Task LoadContent()
        {
            await base.LoadContent();

            var view = Matrix.LookAtRH(new Vector3(2,2,2), new Vector3(0, 0, 0), Vector3.UnitY);
            var projection = Matrix.PerspectiveFovRH((float)Math.PI / 4.0f, (float)GraphicsDevice.BackBuffer.ViewWidth / GraphicsDevice.BackBuffer.ViewHeight, 0.1f, 100.0f);
            worldViewProjection = Matrix.Multiply(view, projection);

            geometry = GeometricPrimitive.Cube.New(GraphicsDevice);
            simpleEffect = new Effect(GraphicsDevice, SpriteEffect.Bytecode);
            parameterCollection = new ParameterCollection();
            parameterCollectionGroup = new EffectParameterCollectionGroup(GraphicsDevice, simpleEffect, new[] { parameterCollection });
            parameterCollection.Set(TexturingKeys.Texture0, UVTexture);
            
            // TODO DisposeBy is not working with device reset
            offlineTarget0 = Texture.New2D(GraphicsDevice, 512, 512, PixelFormat.R8G8B8A8_UNorm, TextureFlags.ShaderResource | TextureFlags.RenderTarget).DisposeBy(this);

            offlineTarget1 = Texture.New2D(GraphicsDevice, 512, 512, PixelFormat.R8G8B8A8_UNorm, TextureFlags.ShaderResource | TextureFlags.RenderTarget).DisposeBy(this);
            offlineTarget2 = Texture.New2D(GraphicsDevice, 512, 512, PixelFormat.R8G8B8A8_UNorm, TextureFlags.ShaderResource | TextureFlags.RenderTarget).DisposeBy(this);

            depthBuffer = Texture.New2D(GraphicsDevice, 512, 512, PixelFormat.D16_UNorm, TextureFlags.DepthStencil).DisposeBy(this);

            width = GraphicsDevice.BackBuffer.ViewWidth;
            height = GraphicsDevice.BackBuffer.ViewHeight;
        }
开发者ID:Powerino73,项目名称:paradox,代码行数:25,代码来源:TestRenderToTexture.cs

示例3: LoadContent

        protected override async Task LoadContent()
        {
            await base.LoadContent();

            wireframeState = RasterizerState.New(GraphicsDevice, new RasterizerStateDescription(CullMode.Back) { FillMode = FillMode.Wireframe });

            simpleEffect = new Effect(GraphicsDevice, SpriteEffect.Bytecode);
            parameterCollection = new ParameterCollection();
            parameterCollectionGroup = new EffectParameterCollectionGroup(GraphicsDevice, simpleEffect, new [] { parameterCollection });
            parameterCollection.Set(TexturingKeys.Texture0, UVTexture);

            primitives = new List<GeometricPrimitive>();

            // Creates all primitives
            primitives = new List<GeometricPrimitive>
                             {
                                 GeometricPrimitive.Plane.New(GraphicsDevice),
                                 GeometricPrimitive.Cube.New(GraphicsDevice),
                                 GeometricPrimitive.Sphere.New(GraphicsDevice),
                                 GeometricPrimitive.GeoSphere.New(GraphicsDevice),
                                 GeometricPrimitive.Cylinder.New(GraphicsDevice),
                                 GeometricPrimitive.Torus.New(GraphicsDevice),
                                 GeometricPrimitive.Teapot.New(GraphicsDevice),
                                 GeometricPrimitive.Capsule.New(GraphicsDevice, 0.5f, 0.3f),
                                 GeometricPrimitive.Cone.New(GraphicsDevice)
                             };


            view = Matrix.LookAtRH(new Vector3(0, 0, 5), new Vector3(0, 0, 0), Vector3.UnitY);

            Window.AllowUserResizing = true;
        }
开发者ID:h78hy78yhoi8j,项目名称:xenko,代码行数:32,代码来源:TestGeometricPrimitives.cs

示例4: PrimitiveQuad

 /// <summary>
 /// Initializes a new instance of the <see cref="PrimitiveQuad" /> class with a particular effect.
 /// </summary>
 /// <param name="graphicsDevice">The graphics device.</param>
 /// <param name="effect">The effect.</param>
 public PrimitiveQuad(GraphicsDevice graphicsDevice, Effect effect)
 {
     GraphicsDevice = graphicsDevice;
     simpleEffect = effect;
     parameters = new ParameterCollection();
     parameters.Set(SpriteBaseKeys.MatrixTransform, Matrix.Identity);
     parameterCollectionGroup = new EffectParameterCollectionGroup(graphicsDevice, simpleEffect, new[] { parameters });
     sharedData = GraphicsDevice.GetOrCreateSharedData(GraphicsDeviceSharedDataType.PerDevice, "PrimitiveQuad::VertexBuffer", d => new SharedData(GraphicsDevice, simpleEffect.InputSignature));
 }
开发者ID:Powerino73,项目名称:paradox,代码行数:14,代码来源:PrimitiveQuad.cs

示例5: EnableFixedAmbientLight

 public static void EnableFixedAmbientLight(ParameterCollection parameters, bool enable)
 {
     if (parameters == null) throw new ArgumentNullException("parameters");
     if (enable)
     {
         parameters.Set(EnvironmentLights, DefaultAmbientLighting);
     }
     else
     {
         parameters.Remove(EnvironmentLights);
     }
 }
开发者ID:h78hy78yhoi8j,项目名称:xenko,代码行数:12,代码来源:LightingKeys.cs

示例6: TestDynamicValues4

        public void TestDynamicValues4()
        {
            //
            // => Set P and V on Root (1,1,1)
            //
            // ---------------
            // |   V = 1,2,3 | (Root)
            // |   P = 0,1,0 |
            // ---------------
            //        |
            // ---------------
            // |   V = ^,^,^ | (Child 0..10000)    
            // |   P = ^,^,^ |
            // |  VP =  V + P|
            // ---------------
            var collection = new ParameterCollection("Root");
            var paramV = new ParameterKey<Vector3>("View");
            var paramP = new ParameterKey<Vector3>("Proj");

            // Set paramV and paramP
            collection.Set(paramV, new Vector3(1, 2, 3));
            collection.Set(paramP, new Vector3(0, 1, 0));

            var paramViewProjDyn1 = new ParameterKey<Vector3>("ViewProjDyn1");
            var valueViewProjDyn1 = ParameterDynamicValue.New(paramV, paramP, (ref Vector3 paramVArg, ref Vector3 paramPArg, ref Vector3 output) => output = paramVArg + paramPArg);

            var childsCollection = new ParameterCollection[10000];
            for (int i = 0; i < childsCollection.Length; i++)
            {
                var childCollection = new ParameterCollection("Child " + i);
                childCollection.AddSources(collection);
                childCollection.AddDynamic(paramViewProjDyn1, valueViewProjDyn1);
                childsCollection[i] = childCollection;
            }

            for (int i = 0; i < childsCollection.Length; i++)
                Assert.AreEqual(childsCollection[i].Get(paramViewProjDyn1), new Vector3(1, 3, 3));

            //
            // => Modify P on Root
            //
            // ---------------
            // |   V = 1,2,3 | (Root)
            // |   P = 0,4,0 |
            // ---------------
            //        |
            // ---------------
            // |   V = ^,^,^ | (Child 0..10000)    
            // |   P = ^,^,^ |
            // |  VP =  V + P|
            // ---------------
            collection.Set(paramP, new Vector3(0, 4, 0));

            for (int i = 0; i < childsCollection.Length; i++)
                Assert.AreEqual(childsCollection[i].Get(paramViewProjDyn1), new Vector3(1, 6, 3));
        }
开发者ID:Powerino73,项目名称:paradox,代码行数:56,代码来源:TestParameters.cs

示例7: TestBasicValues

        public void TestBasicValues()
        {
            //
            // => Initialize, Set V (1,1,1)
            //
            // ---------------
            // |  V = 1,1,1  | (Test)
            // |             |
            // ---------------
            var collection = new ParameterCollection("Test");

            var paramV = new ParameterKey<Vector3>("View");
            var paramP = new ParameterKey<Vector3>("Proj");
            collection.Set(paramV, new Vector3(1, 1, 1));

            // Verify collection.Count
            Assert.AreEqual(collection.Count, 1);

            // Verify collection.Contains
            Assert.AreEqual(collection.ContainsKey(paramV), true);

            // Verify collection.Keys Enumerator
            int count = 0;
            foreach(var key in collection.Keys)
            {
                Assert.AreEqual(key, paramV);
                count++;
            }
            Assert.AreEqual(count, 1);

            // Verify the Get and returned value
            var value = collection.Get(paramV);
            Assert.AreEqual(value, new Vector3(1,1,1));

            //
            // => Set P (2,2,2)
            //
            // ---------------
            // |  V = 1,1,1  | (Test)
            // |  P = 2,2,2  |
            // ---------------
            collection.Set(paramP, new Vector3(2,2,2));
            Assert.AreEqual(collection.Count, 2);
            Assert.AreEqual(collection.Get(paramP), new Vector3(2, 2, 2));

            //
            // => Remove param V
            //
            // ---------------
            // |             | (Test)
            // |  P = 2,2,2  |
            // ---------------
            collection.Remove(paramV);
            Assert.AreEqual(collection.Count, 1);

            // Check that param
            Assert.AreEqual(collection.Get(paramP), new Vector3(2, 2, 2));

            //
            // => Remove param P
            //
            // ---------------
            // |             | (Test)
            // |             |
            // ---------------
            collection.Remove(paramP);
            Assert.AreEqual(collection.Count, 0);

            //
            // => Set param V
            //
            // ---------------
            // |  V = 2,2,2  | (Test)
            // |             |
            // ---------------
            // Just add same key to test that everything is going fine
            collection.Set(paramV, new Vector3(2, 2, 2));
            Assert.AreEqual(collection.Count, 1);
            Assert.AreEqual(collection.Get(paramV), new Vector3(2, 2, 2));
        }
开发者ID:Powerino73,项目名称:paradox,代码行数:80,代码来源:TestParameters.cs

示例8: TestDynamicValues2

        public void TestDynamicValues2()
        {
            //
            // => Initialize
            //
            // ------------------------
            // |  V = 1,2,3           | (Test)
            // |  VDyn = V + (1,1,1)  |
            // ------------------------
            // VDyn = (2,3,4)
            var collection = new ParameterCollection("Test");
            var paramV = new ParameterKey<Vector3>("View");
            var paramViewDyn = new ParameterKey<Vector3>("ViewDyn");

            // Set paramV and paramViewDyn1
            collection.Set(paramV, new Vector3(1,2,3));
            collection.AddDynamic(paramViewDyn, ParameterDynamicValue.New(paramV, (ref Vector3 paramVArg, ref Vector3 output) => output = paramVArg + new Vector3(1, 1, 1)));

            // Check that value is correctly updated
            Assert.AreEqual(collection.Get(paramViewDyn), new Vector3(2, 3, 4));

            //
            // => Set V to (3, 2, 1)
            //
            // ------------------------
            // |  V = 3,2,1           | (Test)
            // |  VDyn = V + (1,1,1)  |
            // ------------------------
            // VDyn = (4,3,2)
            collection.Set(paramV, new Vector3(3, 2, 1));
            Assert.AreEqual(collection.Get(paramViewDyn), new Vector3(4, 3, 2));

            //
            // => Set VDyn = V + (2,2,2)
            //
            // ------------------------
            // |  V = 3,2,1           | (Test)
            // |  VDyn = V + (2,2,2)  |
            // ------------------------
            // VDyn = (5,4,3)
            collection.AddDynamic(paramViewDyn, ParameterDynamicValue.New(paramV, (ref Vector3 paramVArg, ref Vector3 output) => output = paramVArg + new Vector3(2, 2, 2)));

            Assert.AreEqual(collection.Get(paramViewDyn), new Vector3(5, 4, 3));

            // Should throw an InvalidOperationException, as paramV is used by paramViewDyn and
            // cannot be removed
            //Assert.Throws(typeof(InvalidOperationException), () => collection.Remove(paramV));

            // Remove all variables
            collection.Remove(paramViewDyn);
            collection.Remove(paramV);

            //
            // => Remove V and VDyn
            //
            // ------------------------
            // |                      | (Test)
            // |                      |
            // ------------------------
            Assert.AreEqual(collection.Count, 0);
        }
开发者ID:Powerino73,项目名称:paradox,代码行数:61,代码来源:TestParameters.cs

示例9: TestDynamicValues3

        public void TestDynamicValues3()
        {
            //
            // => Initialize, set V and P
            //
            // ------------------------
            // |  V = 1,2,3           | (Test)
            // |  P = 0,1,0           |
            // ------------------------
            var collection = new ParameterCollection("Test");
            var paramV = new ParameterKey<Vector3>("View");
            var paramP = new ParameterKey<Vector3>("Proj");

            // Set paramV and paramP
            collection.Set(paramV, new Vector3(1, 2, 3));
            collection.Set(paramP, new Vector3(0, 1, 0));

            //
            // => Set VDyn1 and VDyn2
            //
            // ------------------------
            // |  V = 1,2,3           | (Test)
            // |  P = 0,1,0           |
            // |  VDyn1 = V + P       |
            // |  VDyn2 = V - P       |
            // ------------------------
            // VDyn1 = (1,3,3)
            // VDyn2 = (1,1,3)
            var paramViewProjDyn1 = new ParameterKey<Vector3>("ViewProjDyn1");
            var paramViewProjDyn2 = new ParameterKey<Vector3>("ViewProjDyn2");
            var valueViewProjDyn1 = ParameterDynamicValue.New(paramV, paramP, (ref Vector3 paramVArg, ref Vector3 paramPArg, ref Vector3 output) => output = paramVArg + paramPArg);
            collection.AddDynamic(paramViewProjDyn1, valueViewProjDyn1);

            // paramViewProjDyn2 = paramV - paramP
            collection.AddDynamic(paramViewProjDyn2, ParameterDynamicValue.New(paramP, paramV, (ref Vector3 paramPArg, ref Vector3 paramVArg, ref Vector3 output) => output = paramVArg - paramPArg));

            Assert.AreEqual(collection.Get(paramViewProjDyn1), new Vector3(1, 3, 3));
            Assert.AreEqual(collection.Get(paramViewProjDyn2), new Vector3(1, 1, 3));

            //
            // => Set VDyn1 and VDyn2
            //
            // ------------------------
            // |  V = 1,2,3           | (Test)
            // |  P = 0,1,0           |
            // |  VDyn1 = V + P       |
            // |  VDyn2 = V + P       |
            // ------------------------
            // VDyn1 = (1,3,3)
            // VDyn2 = (1,3,3)
            collection.AddDynamic(paramViewProjDyn2, valueViewProjDyn1);
            Assert.AreEqual(collection.Get(paramViewProjDyn2), new Vector3(1, 3, 3));

            //
            // => Remove all variables
            //
            // ------------------------
            // |                      | (Test)
            // |                      |
            // ------------------------
            collection.Remove(paramViewProjDyn1);
            collection.Remove(paramViewProjDyn2);
            collection.Remove(paramV);
            collection.Remove(paramP);

            Assert.AreEqual(collection.Count, 0);
        }
开发者ID:Powerino73,项目名称:paradox,代码行数:67,代码来源:TestParameters.cs

示例10: ApplyViewParameters

            public override void ApplyViewParameters(RenderDrawContext context, int viewIndex, ParameterCollection parameters)
            {
                base.ApplyViewParameters(context, viewIndex, parameters);

                parameters.Set(ambientLightKey, AmbientColor[viewIndex]);
            }
开发者ID:Kryptos-FR,项目名称:xenko-reloaded,代码行数:6,代码来源:LightAmbientRenderer.cs

示例11: ApplyDrawParameters

            public override void ApplyDrawParameters(RenderDrawContext context, int viewIndex, ParameterCollection parameters, ref BoundingBoxExt boundingBox)
            {
                CurrentLights.Clear();
                var lightRange = LightRanges[viewIndex];
                for (int i = lightRange.Start; i < lightRange.End; ++i)
                    CurrentLights.Add(Lights[i]);

                base.ApplyDrawParameters(context, viewIndex, parameters, ref boundingBox);

                // TODO: Octree structure to select best lights quicker
                var boundingBox2 = (BoundingBox)boundingBox;
                foreach (var lightEntry in CurrentLights)
                {
                    var light = lightEntry.Light;

                    if (light.BoundingBox.Intersects(ref boundingBox2))
                    {
                        var spotLight = (LightSpot)light.Type;
                        lightsData.Add(new SpotLightData
                        {
                            PositionWS = light.Position,
                            DirectionWS = light.Direction,
                            AngleOffsetAndInvSquareRadius = new Vector3(spotLight.LightAngleScale, spotLight.LightAngleOffset, spotLight.InvSquareRange),
                            Color = light.Color,
                        });

                        // Did we reach max number of simultaneous lights?
                        // TODO: Still collect everything but sort by importance and remove the rest?
                        if (lightsData.Count >= LightCurrentCount)
                            break;
                    }
                }

                parameters.Set(countKey, lightsData.Count);
                parameters.Set(lightsKey, lightsData.Count, ref lightsData.Items[0]);
                lightsData.Clear();
            }
开发者ID:cg123,项目名称:xenko,代码行数:37,代码来源:LightSpotGroupRenderer.cs

示例12: Enumerate

        public XmlDocument Enumerate(ParameterCollection parameters, bool getAll)
        {
            XmlDocument result = new XmlDocument();
            string query = PrepareQuery(Action.Query, parameters);
            Parameter parameter = null;

            while (true)
            {
                try
                {
                    parameter = FillDocumentWithQueryResults(query, result);
                }
                catch (WebException e)
                {
                    throw new WikiException("Enumerating failed", e);
                }
                if (parameter == null || !getAll)
                {
                    break;
                }
                string limitName = parameter.Name.Substring(0, 2) + "limit";
                ParameterCollection localParameters = new ParameterCollection(parameters);
                localParameters.Set(parameter.Name, parameter.Value);
                localParameters.Set(limitName, "max");
                query = PrepareQuery(Action.Query, localParameters);
            }
            return result;
        }
开发者ID:Claymore,项目名称:SharpMediaWiki,代码行数:28,代码来源:Wiki.cs

示例13: TestCollections2

        public void TestCollections2()
        {
            //
            // => Initialize
            //
            // ---------------                
            // |  P = 1,1,1  | (Root1)        
            // |  V = 2,2,2  |                
            // |  VP = V+P   |                
            // ---------------                
            //        
            // ---------------           ---------------
            // |  P = 3,3,3  | (Root2)   |  P = 5,5,5  | (Root3)    
            // |             |           |  V = P      |
            // |             |           |             |
            // ---------------           ---------------         
            var root1Collection = new ParameterCollection("Root1");
            var root2Collection = new ParameterCollection("Root2");
            var root3Collection = new ParameterCollection("Root3");

            var paramV = new ParameterKey<Vector3>("View");
            var paramP = new ParameterKey<Vector3>("Proj");
            var paramVP = new ParameterKey<Vector3>("ViewProj");

            root1Collection.Set(paramP, new Vector3(1, 1, 1));
            root1Collection.Set(paramV, new Vector3(2, 2, 2));
            root1Collection.AddDynamic(paramVP, ParameterDynamicValue.New(paramV, paramP, (ref Vector3 paramVArg, ref Vector3 paramPArg, ref Vector3 output) => output = paramVArg + paramPArg));

            root2Collection.Set(paramP, new Vector3(3, 3, 3));

            root3Collection.Set(paramP, new Vector3(5, 5, 5));
            root3Collection.AddDynamic(paramV, ParameterDynamicValue.New(paramP, (ref Vector3 paramPArg, ref Vector3 paramVArg) => paramVArg = paramPArg));

            //
            // => Add Root1 as a source of Root2
            //
            // ---------------                
            // |  P = 1,1,1  | (Root1)        
            // |  V = 2,2,2  |                
            // |  VP = V+P   |                
            // ---------------                
            //        |
            // ---------------           ---------------
            // |  P = 3,3,3  | (Root2)   |  P = 5,5,5  | (Root3)    
            // |  V = ^,^,^  |           |  V = P      |
            // |  VP= ^,^,^  |           |             |
            // ---------------           ---------------
            //
            // Root1: VP = 3,3,3
            // Root2: VP = 5,5,5
            //
            // Number of registered Dynamic Values: 3
            // Root1: 1 => VP = Root1.V + Root1.P 
            // Root2: 1 => VP = Root1.V + Root2.P
            // Root3: 1 => V = Root3.P
            root2Collection.AddSources(root1Collection);

            //
            // => Add Root2 and Root3 as source of child collection
            //
            // ---------------                
            // |  P = 1,1,1  | (Root1)        
            // |  V = 2,2,2  |                
            // |  VP = V+P   |                
            // ---------------                
            //        |
            // ---------------           ---------------
            // |  P = 3,3,3  | (Root2)   |  P = 5,5,5  | (Root3)    
            // |  V = ^,^,^  |         / |  V = P      |
            // |  VP= ^,^,^  |        /  |             |
            // ---------------       /   ---------------
            //        |             /
            // ---------------
            // |  P = ^,^,^  | (Child)    
            // |  V = ^,^,^  |
            // |  VP =^,^,^  |
            // ---------------
            //
            // Root1: VP = 3,3,3
            // Root2: VP = 5,5,5
            // Root3: V = 5,5,5
            // Child: VP = 10,10,10
            //
            // Number of registered Dynamic Values: 4
            // Root1: 1 => VP = Root1.V + Root1.P 
            // Root2: 1 => VP = Root1.V + Root2.P
            // Root3: 1 => V = Root3.P
            // Child: 1 => VP = Root3.V + Root3.P
            var childCollection = new ParameterCollection("Child");
            childCollection.AddSources(root2Collection, root3Collection);

            Assert.AreEqual(childCollection.Get(paramVP), new Vector3(10, 10, 10));

            //
            // => Overrides P in child
            //
            // ---------------                
            // |  P = 1,1,1  | (Root1)        
            // |  V = 2,2,2  |                
            // |  VP = V+P   |                
//.........这里部分代码省略.........
开发者ID:Powerino73,项目名称:paradox,代码行数:101,代码来源:TestParameters.cs

示例14: ApplyDrawParameters

            public void ApplyDrawParameters(RenderDrawContext context, ParameterCollection parameters, FastListStruct<LightDynamicEntry> currentLights, ref BoundingBoxExt boundingBox)
            {
                for (int lightIndex = 0; lightIndex < currentLights.Count; ++lightIndex)
                {
                    var lightEntry = currentLights[lightIndex];

                    var singleLightData = (LightSpotShadowMapShaderData)lightEntry.ShadowMapTexture.ShaderData;
                    worldToShadowCascadeUV[lightIndex] = singleLightData.WorldToShadowCascadeUV;

                    depthBiases[lightIndex] = singleLightData.DepthBias;
                    offsetScales[lightIndex] = singleLightData.OffsetScale;

                    // TODO: should be setup just once at creation time
                    if (lightIndex == 0)
                    {
                        shadowMapTexture = singleLightData.Texture;
                        if (shadowMapTexture != null)
                        {
                            shadowMapTextureSize = new Vector2(shadowMapTexture.Width, shadowMapTexture.Height);
                            shadowMapTextureTexelSize = 1.0f / shadowMapTextureSize;
                        }
                    }
                }

                parameters.Set(shadowMapTextureKey, shadowMapTexture);
                parameters.Set(shadowMapTextureSizeKey, shadowMapTextureSize);
                parameters.Set(shadowMapTextureTexelSizeKey, shadowMapTextureTexelSize);
                parameters.Set(worldToShadowCascadeUVsKey, worldToShadowCascadeUV);
                parameters.Set(depthBiasesKey, depthBiases);
                parameters.Set(offsetScalesKey, offsetScales);
            }
开发者ID:cg123,项目名称:xenko,代码行数:31,代码来源:LightSpotShadowMapRenderer.cs

示例15: ApplyViewParameters

            public void ApplyViewParameters(RenderDrawContext context, ParameterCollection parameters, FastListStruct<LightDynamicEntry> currentLights)
            {
                for (int lightIndex = 0; lightIndex < currentLights.Count; ++lightIndex)
                {
                    var lightEntry = currentLights[lightIndex];

                    var singleLightData = (LightDirectionalShadowMapShaderData)lightEntry.ShadowMapTexture.ShaderData;
                    var splits = singleLightData.CascadeSplits;
                    var matrices = singleLightData.WorldToShadowCascadeUV;
                    int splitIndex = lightIndex * cascadeCount;
                    for (int i = 0; i < splits.Length; i++)
                    {
                        cascadeSplits[splitIndex + i] = splits[i];
                        worldToShadowCascadeUV[splitIndex + i] = matrices[i];
                    }

                    depthBiases[lightIndex] = singleLightData.DepthBias;
                    offsetScales[lightIndex] = singleLightData.OffsetScale;

                    // TODO: should be setup just once at creation time
                    if (lightIndex == 0)
                    {
                        shadowMapTexture = singleLightData.Texture;
                        if (shadowMapTexture != null)
                        {
                            shadowMapTextureSize = new Vector2(shadowMapTexture.Width, shadowMapTexture.Height);
                            shadowMapTextureTexelSize = 1.0f/shadowMapTextureSize;
                        }
                    }
                }

                parameters.Set(shadowMapTextureKey, shadowMapTexture);
                parameters.Set(shadowMapTextureSizeKey, shadowMapTextureSize);
                parameters.Set(shadowMapTextureTexelSizeKey, shadowMapTextureTexelSize);
                parameters.Set(cascadeSplitsKey, cascadeSplits);
                parameters.Set(worldToShadowCascadeUVsKey, worldToShadowCascadeUV);
                parameters.Set(depthBiasesKey, depthBiases);
                parameters.Set(offsetScalesKey, offsetScales);
            }
开发者ID:cg123,项目名称:xenko,代码行数:39,代码来源:LightDirectionalShadowMapRenderer.cs


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