protected override void OnAttach(IRenderTechnique technique)
 {
     lock (lck)
     {
         if (bufferDesc != null)
         {
             modelConstBuffer = technique.ConstantBufferPool.Register(bufferDesc);
             storage          = technique.EffectsManager.StructArrayPool.Register(bufferDesc.StructSize);
             storageId        = storage.GetId();
         }
         IsValid = bufferDesc != null && ModelConstBuffer != null;
     }
 }
示例#2
0
 /// <summary>
 /// Initializes a new instance of the <see cref="MaterialVariable"/> class.
 /// </summary>
 /// <param name="manager">The manager.</param>
 /// <param name="technique">The technique.</param>
 /// <param name="meshMaterialConstantBufferDesc">The Constant Buffer description</param>
 /// <param name="materialCore"></param>
 public MaterialVariable(IEffectsManager manager, IRenderTechnique technique,
                         ConstantBufferDescription meshMaterialConstantBufferDesc,
                         MaterialCore materialCore)
 {
     Technique      = technique;
     EffectsManager = manager;
     if (materialCore != null)
     {
         material = materialCore;
         material.PropertyChanged += MaterialCore_PropertyChanged;
     }
     materialCBDescription = meshMaterialConstantBufferDesc;
     if (manager != null)
     {
         storage   = manager.StructArrayPool.Register(materialCBDescription.StructSize);
         storageId = storage.GetId();
     }
 }