コード例 #1
0
        public MaterialBuilder GetMaterialBuilderByShader(Shader shader)
        {
            var res = (from m in materials where m.Shader.Equals(shader) select m).FirstOrDefault();

            if (res == null)
            {
                var materialBuilder = MaterialCreator.CreateMaterial(shader);

                res = new MaterialAndShader {
                    Shader = shader, MaterialBuilder = materialBuilder
                };
                materials.Add(res);
            }
            return(res.MaterialBuilder);
        }
コード例 #2
0
ファイル: MaterialsCache.cs プロジェクト: xiaolingis/pg2b3dm
        public MaterialBuilder GetMaterialBuilderByColor(string color)
        {
            var res = (from m in materials where m.Color == color select m).FirstOrDefault();

            if (res == null)
            {
                // create and add it to List
                var rgb             = ColorTranslator.FromHtml(color);
                var materialBuilder = MaterialCreator.CreateMaterial(rgb.R, rgb.G, rgb.B);

                res = new MaterialAndColor {
                    Color = color, MaterialBuilder = materialBuilder
                };
                materials.Add(res);
            }
            return(res.MaterialBuilder);
        }