internal static void GetMaterialSources(MyStringId id, out MyMaterialShaderInfo info)
        {
            if (!MaterialSources.TryGetValue(id, out info))
            {
                info = new MyMaterialShaderInfo();

                info.VertexShaderFilename = Path.Combine(MaterialsFolder, id.ToString(), "Vertex.hlsl");;
                info.VertexShaderFilepath = Path.Combine(MyShaders.ShadersPath, info.VertexShaderFilename);
                info.PixelShaderFilename  = Path.Combine(MaterialsFolder, id.ToString(), "Pixel.hlsl");
                info.PixelShaderFilepath  = Path.Combine(MyShaders.ShadersPath, info.PixelShaderFilename);

                MaterialSources[id] = info;
            }
        }
Ejemplo n.º 2
0
        static void PrefetchMaterialSources(MyStringId id)
        {
            if (!MaterialSources.ContainsKey(id))
            {
                var info = new MyMaterialShaderInfo();

                using (var stream = MyFileSystem.OpenRead(Path.Combine(MyFileSystem.ContentPath, MyShadersDefines.ShadersContentPath, "materials", id.ToString()), "declarations.h"))
                {
                    info.Declarations = new StreamReader(stream).ReadToEnd();
                }
                using (var stream = MyFileSystem.OpenRead(Path.Combine(MyFileSystem.ContentPath, MyShadersDefines.ShadersContentPath, "materials", id.ToString()), "vertex.h"))
                {
                    info.VertexShaderSource = new StreamReader(stream).ReadToEnd();
                }
                using (var stream = MyFileSystem.OpenRead(Path.Combine(MyFileSystem.ContentPath, MyShadersDefines.ShadersContentPath, "materials", id.ToString()), "pixel.h"))
                {
                    info.PixelShaderSource = new StreamReader(stream).ReadToEnd();
                }

                MaterialSources[id] = info;
            }
        }
Ejemplo n.º 3
0
        static void PrefetchMaterialSources(MyStringId id)
        {
            if(!MaterialSources.ContainsKey(id))
            {
                var info = new MyMaterialShaderInfo();

                using (var stream = MyFileSystem.OpenRead(Path.Combine(MyFileSystem.ContentPath, MyShaders.ShadersContentPath, "materials", id.ToString()), "declarations.h"))
                {
                    info.Declarations = new StreamReader(stream).ReadToEnd();
                }
                using (var stream = MyFileSystem.OpenRead(Path.Combine(MyFileSystem.ContentPath, MyShaders.ShadersContentPath, "materials", id.ToString()), "vertex.h"))
                {
                    info.VertexShaderSource = new StreamReader(stream).ReadToEnd();
                }
                using (var stream = MyFileSystem.OpenRead(Path.Combine(MyFileSystem.ContentPath, MyShaders.ShadersContentPath, "materials", id.ToString()), "pixel.h"))
                {
                    info.PixelShaderSource = new StreamReader(stream).ReadToEnd();
                }

                MaterialSources[id] = info;
            }
        }
Ejemplo n.º 4
0
        internal static void GetMaterialSources(MyStringId id, out MyMaterialShaderInfo info)
        {
            if (!MaterialSources.TryGetValue(id, out info))
            {
                info = new MyMaterialShaderInfo();

                info.VertexShaderFilename = Path.Combine(MaterialsFolder, id.ToString(), "Vertex.hlsl"); ;
                info.VertexShaderFilepath = Path.Combine(MyShaders.ShadersPath, info.VertexShaderFilename);
                info.PixelShaderFilename = Path.Combine(MaterialsFolder, id.ToString(), "Pixel.hlsl");
                info.PixelShaderFilepath = Path.Combine(MyShaders.ShadersPath, info.PixelShaderFilename);

                MaterialSources[id] = info;
            }
        }