Exemplo n.º 1
0
        //TODO: @Investigate: What if multiple delegates are bound to the same event?
        public void InvokeVertexLayoutGeneration()
        {
            // Base vertex geometry
            VertexLayouts[0]           = CallVertexLayoutGeneration.Invoke();
            VertexPreEffectsLayouts[0] = CallVertexLayoutGeneration.Invoke();

            // Instancing data i.e. position, view matrices
            var instancingEventKeys = InstancingEventHandlerKeys.GetKeys();
            var flagIndex           = InstancingDataFlags.GetArrayIndexForFlag(InstancingDataFlag);

            if (flagIndex >= 0)
            {
                var instancingEventKey = instancingEventKeys[flagIndex];
                var instancingVertexInstanceDeletegate = (VertexInstanceLayoutGenerationList[instancingEventKey] as Func <VertexLayoutDescription>);
                VertexLayouts[flagIndex + 1] = instancingVertexInstanceDeletegate.Invoke();
            }

            // Instancing effects data
            var preEffectsEventKeys = PreEffectEventHandlerKeys.GetKeys();
            var preEffectsflagIndex = RenderFlags.GetPreEffectArrayIndexForFlag(PreEffectsInstancingFlag);

            if (preEffectsflagIndex >= 0)
            {
                var preEffectsEventKey       = preEffectsEventKeys[preEffectsflagIndex];
                var vertexInstanceDeletegate = (VertexPreEffectsInstanceLayoutGenerationList[preEffectsEventKey] as Func <VertexLayoutDescription>);
                VertexPreEffectsLayouts[preEffectsflagIndex + 1] = vertexInstanceDeletegate.Invoke();
            }
        }
Exemplo n.º 2
0
        public void AddPreEffectsVertexInstanceDelegate(uint id, Func <VertexLayoutDescription> vertexLayoutDelegate)
        {
            var flagIndex = RenderFlags.GetPreEffectArrayIndexForFlag(PreEffectsInstancingFlag);

            VertexPreEffectsInstanceLayoutGenerationList.AddHandler(PreEffectEventHandlerKeys.GetKeys()[flagIndex], vertexLayoutDelegate);
        }