/// <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); }
/// <inheritdoc/> protected override void InitializeCore() { RenderModelObjectInfoKey = RootRenderFeature.RenderData.CreateObjectKey <RenderModelFrameInfo>(); RenderModelViewInfoKey = RootRenderFeature.RenderData.CreateViewObjectKey <RenderModelViewInfo>(); time = ((RootEffectRenderFeature)RootRenderFeature).CreateFrameCBufferOffsetSlot(GlobalKeys.Time.Name); view = ((RootEffectRenderFeature)RootRenderFeature).CreateViewCBufferOffsetSlot(TransformationKeys.View.Name); camera = ((RootEffectRenderFeature)RootRenderFeature).CreateViewCBufferOffsetSlot(CameraKeys.NearClipPlane.Name); world = ((RootEffectRenderFeature)RootRenderFeature).CreateDrawCBufferOffsetSlot(TransformationKeys.World.Name); worldInverse = ((RootEffectRenderFeature)RootRenderFeature).CreateDrawCBufferOffsetSlot(TransformationKeys.WorldInverse.Name); }
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); }
public ConstantBufferOffsetReference CreateViewCBufferOffsetSlot(string variable) { // TODO: Handle duplicates var slotReference = new ConstantBufferOffsetReference(-1); for (int index = 0; index < viewCBufferOffsetSlots.Count; index++) { var slot = viewCBufferOffsetSlots[index]; if (slot.Variable == null) { // Empty slot, reuse it slotReference = new ConstantBufferOffsetReference(index); } } // Need a new slot if (slotReference.Index == -1) { slotReference = new ConstantBufferOffsetReference(viewCBufferOffsetSlots.Count); viewCBufferOffsetSlots.Add(new NamedSlotDefinition(variable)); } // Update existing instantiated buffers foreach (var viewResourceLayoutEntry in viewResourceLayouts) { var resourceGroupLayout = viewResourceLayoutEntry.Value; // Ensure there is enough space if (resourceGroupLayout.ConstantBufferOffsets == null || resourceGroupLayout.ConstantBufferOffsets.Length < viewCBufferOffsetSlots.Count) { Array.Resize(ref resourceGroupLayout.ConstantBufferOffsets, viewCBufferOffsetSlots.Count); } ResolveCBufferOffset(resourceGroupLayout, slotReference.Index, variable); } return(slotReference); }
public ConstantBufferOffsetReference CreateDrawCBufferOffsetSlot(string variable) { // TODO: Handle duplicates, and allow removal var slotReference = new ConstantBufferOffsetReference(drawCBufferOffsetSlots.Count); drawCBufferOffsetSlots.Add(new NamedSlotDefinition(variable)); // Update existing instantiated buffers foreach (var effect in InstantiatedEffects) { var resourceGroupLayout = effect.Value.PerDrawLayout; // Ensure there is enough space if (resourceGroupLayout.ConstantBufferOffsets == null || resourceGroupLayout.ConstantBufferOffsets.Length < drawCBufferOffsetSlots.Count) { Array.Resize(ref resourceGroupLayout.ConstantBufferOffsets, drawCBufferOffsetSlots.Count); } ResolveCBufferOffset(resourceGroupLayout, slotReference.Index, variable); } return(slotReference); }
public ConstantBufferOffsetReference CreateFrameCBufferOffsetSlot(string variable) { // TODO: Handle duplicates, and allow removal var slotReference = new ConstantBufferOffsetReference(frameCBufferOffsetSlots.Count); frameCBufferOffsetSlots.Add(new NamedSlotDefinition(variable)); // Update existing instantiated buffers foreach (var frameResourceLayoutEntry in frameResourceLayouts) { var resourceGroupLayout = frameResourceLayoutEntry.Value; // Ensure there is enough space if (resourceGroupLayout.ConstantBufferOffsets == null || resourceGroupLayout.ConstantBufferOffsets.Length < frameCBufferOffsetSlots.Count) { Array.Resize(ref resourceGroupLayout.ConstantBufferOffsets, frameCBufferOffsetSlots.Count); } ResolveCBufferOffset(resourceGroupLayout, slotReference.Index, variable); } return(slotReference); }
public int GetConstantBufferOffset(ConstantBufferOffsetReference offsetReference) { return(ConstantBufferOffsets[offsetReference.Index]); }
public void RemoveViewCBufferOffsetSlot(ConstantBufferOffsetReference cbufferOffsetSlot) { viewCBufferOffsetSlots[cbufferOffsetSlot.Index] = new NamedSlotDefinition(null); }