private static void RenderPresetsToFiles() { using (GameWindow gameWindow = OpenTkSharedResources.CreateGameWindowContext(width, height)) { // Resource creation. screenTriangle = ScreenDrawing.CreateScreenTriangle(); shader = OpenTkSharedResources.shaders["NudSphere"]; // Skip thumbnail generation if the shader didn't compile. if (!shader.LinkStatusIsOk) { return; } // HACK: This isn't a very clean way to pass resources around. NudMatSphereDrawing.LoadMaterialSphereTextures(); Dictionary <NudEnums.DummyTexture, 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); } } }
public static void LoadTextures() { dummyTextures = CreateNudDummyTextures(); NudMatSphereDrawing.LoadMaterialSphereTextures(); // Helpful textures. uvTestPattern = new Texture2D(); uvTestPattern.LoadImageData(Properties.Resources.UVPattern); uvTestPattern.TextureWrapS = TextureWrapMode.Repeat; uvTestPattern.TextureWrapT = TextureWrapMode.Repeat; // TODO: Simplify this conversion. Dds specularSdr = new Dds(new FileData(Properties.Resources.specularSDR)); specularPbr = NUT.CreateTextureCubeMap(specularSdr.ToNutTexture()); Dds diffuseSdr = new Dds(new FileData(Properties.Resources.diffuseSDR)); diffusePbr = NUT.CreateTextureCubeMap(diffuseSdr.ToNutTexture()); // Don't use mipmaps. diffusePbr.MinFilter = TextureMinFilter.Linear; diffusePbr.MagFilter = TextureMagFilter.Linear; boneWeightGradient = new Texture2D(); boneWeightGradient.LoadImageData(Properties.Resources.boneWeightGradient); boneWeightGradient2 = new Texture2D(); boneWeightGradient2.LoadImageData(Properties.Resources.boneWeightGradient2); defaultTex = new Texture2D(); defaultTex.LoadImageData(Resources.Resources.DefaultTexture); try { floorTexture = new Texture2D(); floorTexture.LoadImageData(new Bitmap(Runtime.floorTexFilePath)); backgroundTexture = new Texture2D(); backgroundTexture.LoadImageData(new Bitmap(Runtime.backgroundTexFilePath)); } catch (Exception) { // File paths are incorrect or never set. } }