private static void RenderPresetsToFiles()
        {
            using (GameWindow gameWindow = OpenTKSharedResources.CreateGameWindowContext(width, height))
            {
                // Resource creation.
                screenVao = ScreenDrawing.CreateScreenTriangleVao();
                shader    = OpenTKSharedResources.shaders["NudSphere"];

                // Skip thumbnail generation if the shader didn't compile.
                if (!shader.ProgramCreatedSuccessfully)
                {
                    return;
                }

                // HACK: This isn't a very clean way to pass resources around.
                NudMatSphereDrawing.LoadMaterialSphereTextures();
                Dictionary <NUD.DummyTextures, Texture> dummyTextures = RenderTools.CreateNudDummyTextures();

                CreateNudSphereShader();

                foreach (string file in Directory.EnumerateFiles(MainForm.executableDir + "\\materials", "*.nmt", SearchOption.AllDirectories))
                {
                    NUD.Material material   = NUDMaterialEditor.ReadMaterialListFromPreset(file)[0];
                    string       presetName = Path.GetFileNameWithoutExtension(file);
                    RenderMaterialPresetToFile(presetName, material, dummyTextures);
                }
            }
        }
Exemplo n.º 2
0
 private static Bitmap DrawTextureToBitmap(Texture2D texture, int width, int height, bool r, bool g, bool b, bool a)
 {
     using (GameWindow gameWindow = OpenTKSharedResources.CreateGameWindowContext(width, height))
     {
         Framebuffer framebuffer = DrawTextureToNewFbo(texture, width, height, r, g, b, a);
         return(framebuffer.ReadImagePixels(a));
     }
 }