예제 #1
0
        private void SetFloat(UniformBlock uniformBlock, MatlEnums.ParamId paramId, float defaultValue)
        {
            var name = paramId.ToString();

            if (floatByParamId.ContainsKey(paramId))
            {
                var value = floatByParamId[paramId];
                uniformBlock.SetValue(name, value);
            }
            else
            {
                uniformBlock.SetValue(name, defaultValue);
            }
        }
예제 #2
0
        private void AddFloat(UniformBlock genericMaterial, MatlEnums.ParamId paramId, float defaultValue)
        {
            var name = paramId.ToString();

            if (floatByParamId.ContainsKey(paramId))
            {
                var value = floatByParamId[paramId];
                genericMaterial.SetValue(name, value);
            }
            else
            {
                genericMaterial.SetValue(name, defaultValue);
            }
        }
예제 #3
0
        private void SetBool(UniformBlock uniformBlock, MatlEnums.ParamId paramId, bool defaultValue)
        {
            var name = paramId.ToString();

            if (boolByParamId.ContainsKey(paramId))
            {
                var value = boolByParamId[paramId];
                uniformBlock.SetValue(name, value ? 1 : 0);
            }
            else
            {
                uniformBlock.SetValue(name, defaultValue ? 1 : 0);
            }
        }
예제 #4
0
        private void AddBool(UniformBlock genericMaterial, MatlEnums.ParamId paramId, bool defaultValue)
        {
            var name = paramId.ToString();

            if (boolByParamId.ContainsKey(paramId))
            {
                var value = boolByParamId[paramId];
                genericMaterial.SetValue(name, value ? 1 : 0);
            }
            else
            {
                genericMaterial.SetValue(name, defaultValue ? 1 : 0);
            }
        }
예제 #5
0
        private void SetVec4(UniformBlock uniformBlock, MatlEnums.ParamId paramId, Vector4 defaultValue, bool isDebug = false)
        {
            // Convert parameters into colors for easier visualization.
            var name = paramId.ToString();

            if (isDebug)
            {
                name = "vec4Param";
            }

            if (Vec4ParamsMaterialAnimation.ContainsKey(paramId))
            {
                var value = Vec4ParamsMaterialAnimation[paramId];
                uniformBlock.SetValue(name, value);
            }
            else if (vec4ByParamId.ContainsKey(paramId))
            {
                var value = vec4ByParamId[paramId];
                uniformBlock.SetValue(name, value);
            }
            else if (boolByParamId.ContainsKey(paramId))
            {
                var value = boolByParamId[paramId];
                if (value)
                {
                    uniformBlock.SetValue(name, new Vector4(1, 0, 1, 0));
                }
                else
                {
                    uniformBlock.SetValue(name, new Vector4(0, 0, 1, 0));
                }
            }
            else if (floatByParamId.ContainsKey(paramId))
            {
                var value = floatByParamId[paramId];
                uniformBlock.SetValue(name, new Vector4(value, value, value, 0));
            }
            else
            {
                uniformBlock.SetValue(name, defaultValue);
            }
        }