Example #1
0
 public virtual void SetPerFrameCBuffer()
 {
     if (this.EffectManager.DefaultEffect == null ||
         this.EffectManager.DefaultEffect.IsValid == false)
     {
         return;
     }
     if (mPerFrameCBuffer == null)
     {
         var idx = this.EffectManager.DefaultEffect.ShaderProgram.FindCBuffer("cbPerFrame");
         if ((int)idx > 0)
         {
             mPerFrameCBuffer              = this.RenderContext.CreateConstantBuffer(this.EffectManager.DefaultEffect.ShaderProgram, idx);
             mPerFrameCBVarTable.TimeId    = mPerFrameCBuffer.FindVar("Time");
             mPerFrameCBVarTable.TimeSinId = mPerFrameCBuffer.FindVar("TimeSin");
             mPerFrameCBVarTable.TimeCosId = mPerFrameCBuffer.FindVar("TimeCos");
         }
     }
     else
     {
         float time = (float)this.EngineTime / 1000.0f;
         mPerFrameCBuffer.SetValue(mPerFrameCBVarTable.TimeId, time, 0);
         mPerFrameCBuffer.SetValue(mPerFrameCBVarTable.TimeSinId, (float)System.Math.Sin((double)time), 0);
         mPerFrameCBuffer.SetValue(mPerFrameCBVarTable.TimeCosId, (float)System.Math.Cos((double)time), 0);
     }
 }
Example #2
0
        public void BindCBuffer(CShaderProgram shaderProgram, UInt32 index, CConstantBuffer cbuffer)
        {
            if (cbuffer == null)
            {
                return;
            }

            SDK_IPass_BindCBuffAll(CoreObject, shaderProgram.CoreObject, index, cbuffer.CoreObject);
        }
Example #3
0
        public void BindCBuffer(CShaderProgram shaderProgram, string name, CConstantBuffer cbuffer)
        {
            if (cbuffer == null)
            {
                return;
            }
            var index = shaderProgram.FindCBuffer(name);

            SDK_IPass_BindCBuffAll(CoreObject, shaderProgram.CoreObject, index, cbuffer.CoreObject);
        }
Example #4
0
        public CConstantBuffer FindCBufferPS(string name)
        {
            var ptr = SDK_IPass_FindCBufferPS(CoreObject, name);

            if (ptr.GetPointer() == IntPtr.Zero)
            {
                return(null);
            }
            var result = new CConstantBuffer(ptr);

            result.Core_AddRef();
            return(result);
        }
Example #5
0
 public void CSSetConstantBuffer(UInt32 Index, CConstantBuffer cbuffer)
 {
     SDK_ICommandList_CSSetConstantBuffer(CoreObject, Index, cbuffer.CoreObject);
 }
Example #6
0
 public void BindCBufferPS(UInt32 Index, CConstantBuffer CBuffer)
 {
     SDK_IPass_BindCBufferPS(CoreObject, Index, CBuffer.CoreObject);
 }