Esempio n. 1
0
        /// <inheritdoc/>
        protected override void InitializeCore()
        {
            renderModelObjectInfoKey = RootRenderFeature.RenderData.CreateObjectKey <Matrix[]>();
            skinningInfoKey          = RootRenderFeature.RenderData.CreateStaticObjectKey <SkinningInfo>();
            renderEffectKey          = ((RootEffectRenderFeature)RootRenderFeature).RenderEffectKey;

            blendMatrices = ((RootEffectRenderFeature)RootRenderFeature).CreateDrawCBufferOffsetSlot(TransformationSkinningKeys.BlendMatrixArray.Name);
        }
Esempio n. 2
0
        public VisibilityGroup(RenderSystem renderSystem)
        {
            Tags = new PropertyContainer(this);

            RenderSystem  = renderSystem;
            RenderObjects = new RenderObjectCollection(this);
            RenderData.Initialize(ComputeDataArrayExpectedSize);

            // Create RenderStageMask key, and keep track of number of RenderStages.Count for future resizing
            RenderStageMaskKey = RenderData.CreateStaticObjectKey <uint>(null, stageMaskMultiplier = (RenderSystem.RenderStages.Count + RenderStageMaskSizePerEntry - 1) / RenderStageMaskSizePerEntry);
            Array.Resize(ref viewRenderStageMask, stageMaskMultiplier);

            RenderSystem.RenderStages.CollectionChanged   += RenderStages_CollectionChanged;
            RenderSystem.RenderStageSelectorsChanged      += RenderSystem_RenderStageSelectorsChanged;
            RenderSystem.RenderFeatures.CollectionChanged += RenderFeatures_CollectionChanged;
        }
Esempio n. 3
0
        protected override void InitializeCore()
        {
            if (TransformRenderFeature == null)
            {
                TransformRenderFeature = ((MeshRenderFeature)RootRenderFeature).RenderFeatures.OfType <TransformRenderFeature>().FirstOrDefault();
                if (TransformRenderFeature == null)
                {
                    throw new ArgumentNullException(nameof(TransformRenderFeature));
                }
            }

            previousTransformationInfoKey     = RootRenderFeature.RenderData.CreateStaticObjectKey <StaticObjectInfo>();
            previousTransformationViewInfoKey = RootRenderFeature.RenderData.CreateViewObjectKey <PreviousObjectViewInfo>();
            renderModelObjectInfoKey          = TransformRenderFeature.RenderModelObjectInfoKey;

            previousWorldViewProjection = ((RootEffectRenderFeature)RootRenderFeature).CreateDrawCBufferOffsetSlot(MeshVelocityKeys.PreviousWorldViewProjection.Name);
        }
Esempio n. 4
0
        /// <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);
            }
        }
Esempio n. 5
0
 /// <inheritdoc/>
 protected override void InitializeCore()
 {
     renderObjectInstancingDataInfoKey = RootRenderFeature.RenderData.CreateStaticObjectKey <InstancingData>();
     renderEffectKey            = ((RootEffectRenderFeature)RootRenderFeature).RenderEffectKey;
     instancingResourceGroupKey = ((RootEffectRenderFeature)RootRenderFeature).CreateDrawLogicalGroup("Instancing");
 }