/// <inheritdoc/>
        protected override void InitializeCore()
        {
            base.InitializeCore();

            renderEffectKey = RenderEffectKey;

            // The offset starts with the first element in the buffer
            perViewCBufferOffset = CreateViewCBufferOffsetSlot(ParticleUtilitiesKeys.ViewMatrix.Name);

            perMaterialDescriptorSetSlot = GetOrCreateEffectDescriptorSetSlot("PerMaterial");
        }
Esempio n. 2
0
        /// <inheritdoc/>
        protected override void InitializeCore()
        {
            base.InitializeCore();

            MutablePipeline = new MutablePipelineState(Context.GraphicsDevice);

            // Create RenderEffectKey
            RenderEffectKey = RenderData.CreateStaticObjectKey <RenderEffect>(null, EffectPermutationSlotCount);

            // TODO: Assign weights so that PerDraw is always last? (we usually most custom user ones to be between PerView and PerDraw)
            perFrameDescriptorSetSlot = GetOrCreateEffectDescriptorSetSlot("PerFrame");
            perViewDescriptorSetSlot  = GetOrCreateEffectDescriptorSetSlot("PerView");
            perDrawDescriptorSetSlot  = GetOrCreateEffectDescriptorSetSlot("PerDraw");

            RenderSystem.RenderStages.CollectionChanged += RenderStages_CollectionChanged;

            // Create effect slots
            Array.Resize(ref effectSlots, RenderSystem.RenderStages.Count);
            for (int index = 0; index < RenderSystem.RenderStages.Count; index++)
            {
                var renderStage = RenderSystem.RenderStages[index];
                effectSlots[index] = CreateEffectPermutationSlot(renderStage.EffectSlotName);
            }
        }
        /// <inheritdoc/>
        protected override void InitializeCore()
        {
            base.InitializeCore();

            prepareThreadContext = new ThreadLocal<PrepareThreadContext>(() => new PrepareThreadContext(Context));

            // Create RenderEffectKey
            RenderEffectKey = RenderData.CreateStaticObjectKey<RenderEffect>(null, EffectPermutationSlotCount);

            // TODO: Assign weights so that PerDraw is always last? (we usually most custom user ones to be between PerView and PerDraw)
            perFrameDescriptorSetSlot = GetOrCreateEffectDescriptorSetSlot("PerFrame");
            perViewDescriptorSetSlot = GetOrCreateEffectDescriptorSetSlot("PerView");
            perDrawDescriptorSetSlot = GetOrCreateEffectDescriptorSetSlot("PerDraw");

            RenderSystem.RenderStages.CollectionChanged += RenderStages_CollectionChanged;

            // Create effect slots
            Array.Resize(ref effectSlots, RenderSystem.RenderStages.Count);
            for (int index = 0; index < RenderSystem.RenderStages.Count; index++)
            {
                var renderStage = RenderSystem.RenderStages[index];
                effectSlots[index] = CreateEffectPermutationSlot(renderStage.EffectSlotName);
            }
        }