Ejemplo n.º 1
0
        public void Bind(GpuProgramParameters gpuParams)
        {
            if (gpuParams != null)
            {
                Axiom.Graphics.GpuProgramParameters.GpuConstantDefinition def =
                    gpuParams.FindNamedConstantDefinition(_name);

                if (def != null)
                {
                    this._params       = gpuParams;
                    this.physicalIndex = def.PhysicalIndex;
                }
            }
        }
Ejemplo n.º 2
0
        protected void _updateParameter(GpuProgramParameters programParameters, String paramName, Object value,
                                        int sizeInBytes)
        {
            //programParameters.AutoAddParamName = true;
            var idx = programParameters.FindNamedConstantDefinition(paramName).LogicalIndex;

            if (value is Matrix4)
            {
                programParameters.SetConstant(idx, (Matrix4)value);
            }
            else if (value is ColorEx)
            {
                programParameters.SetConstant(idx, (ColorEx)value);
            }
            else if (value is Vector3)
            {
                programParameters.SetConstant(idx, ((Vector3)value));
            }
            else if (value is Vector4)
            {
                programParameters.SetConstant(idx, (Vector4)value);
            }
            else if (value is float[])
            {
                programParameters.SetConstant(idx, (float[])value);
            }
            else if (value is int[])
            {
                programParameters.SetConstant(idx, (int[])value);
            }
            else if (value is float)
            {
                programParameters.SetConstant(idx, new[]
                {
                    (float)value, 0.0f, 0.0f, 0.0f
                });
            }
            else
            {
                programParameters.SetConstant(idx, (float[])value);
            }
        }