public static void Main(string[] args) { if (!Debugger.IsAttached) { AppDomain.CurrentDomain.UnhandledException += ReportUnhandledException; } var commandLineParser = new CommandLineApplication(false); var archiveOption = commandLineParser.Option("--content", "content directory", CommandOptionType.SingleValue); commandLineParser.Execute(args); string contentPath; if (archiveOption.HasValue()) { contentPath = archiveOption.Value(); } else { contentPath = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "content"); } var contentDir = new DirectoryInfo(contentPath); List <IArchiveDirectory> contentArchiveDirs = new List <IArchiveDirectory>(); foreach (var archiveDir in contentDir.GetDirectories()) { contentArchiveDirs.Add(UnpackedArchiveDirectory.Make(archiveDir)); } foreach (var archiveFile in contentDir.GetFiles("*.archive")) { var archive = new PackedArchive(archiveFile); contentArchiveDirs.Add(archive.Root); } var unionedArchiveDir = UnionArchiveDirectory.Join("content", contentArchiveDirs); LeakTracking.Setup(); string title = Application.ProductName + " " + Application.ProductVersion; try { using (VRApp app = new VRApp(unionedArchiveDir, title)) { app.Run(); } } catch (VRInitException e) { string text = String.Join("\n\n", String.Format("OpenVR initialization failed: {0}", e.Message), "Please make sure SteamVR is installed and running, and VR headset is connected."); string caption = "OpenVR Initialization Error"; MessageBox.Show(text, caption, MessageBoxButtons.OK, MessageBoxIcon.Error); } LeakTracking.Finish(); }
public static void Main(string[] args) { if (!Debugger.IsAttached) { AppDomain.CurrentDomain.UnhandledException += ReportUnhandledException; } var commandLineParser = new CommandLineApplication(false); var archiveOption = commandLineParser.Option("--data", "path to archive file or directory", CommandOptionType.SingleValue); commandLineParser.Execute(args); string archivePath; if (archiveOption.HasValue()) { archivePath = archiveOption.Value(); } else { archivePath = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "data.archive"); } IArchiveDirectory dataDir; var archiveAsDirectory = new DirectoryInfo(archivePath); if (archiveAsDirectory.Exists) { dataDir = UnpackedArchiveDirectory.Make(archiveAsDirectory); } else { var archive = new PackedArchive(new FileInfo(archivePath)); dataDir = archive.Root; } LeakTracking.Setup(); string title = Application.ProductName + " " + Application.ProductVersion; try { using (VRApp app = new VRApp(dataDir, title)) { app.Run(); } } catch (VRInitException e) { string text = String.Join("\n\n", String.Format("OpenVR initialization failed: {0}", e.Message), "Please make sure SteamVR is installed and running, and VR headset is connected."); string caption = "OpenVR Initialization Error"; MessageBox.Show(text, caption, MessageBoxButtons.OK, MessageBoxIcon.Error); } LeakTracking.Finish(); }
public static void Main(string[] args) { LeakTracking.Setup(); using (var app = Make(args)) { Process.GetCurrentProcess().PriorityClass = ProcessPriorityClass.Idle; app.Run(args); Process.GetCurrentProcess().PriorityClass = ProcessPriorityClass.Normal; } LeakTracking.Finish(); }
public void Run() { LeakTracking.Setup(); var device = new Device(DriverType.Hardware, DeviceCreationFlags.Debug, FeatureLevel.Level_11_1); var shaderCache = new ShaderCache(device); var fileLocator = new ContentFileLocator(); var objectLocator = new DsonObjectLocator(fileLocator); var contentPackConfs = ContentPackImportConfiguration.LoadAll(CommonPaths.ConfDir); var pathManager = ImporterPathManager.Make(contentPackConfs); var loader = new FigureRecipeLoader(fileLocator, objectLocator, pathManager); var figureRecipe = loader.LoadFigureRecipe("genesis-3-female", null); var figure = figureRecipe.Bake(fileLocator, null); var geometry = figure.Geometry; var ldChannelInputs = figure.ChannelSystem.MakeDefaultChannelInputs(); figure.ChannelsByName["PBMNavel?value"].SetValue(ldChannelInputs, 1); figure.ChannelsByName["PBMNipples?value"].SetValue(ldChannelInputs, 1); figure.ChannelsByName["CTRLRune7?value"].SetValue(ldChannelInputs, 1); var hdChannelInputs = figure.ChannelSystem.MakeDefaultChannelInputs(); figure.ChannelsByName["PBMNavel?value"].SetValue(hdChannelInputs, 1); figure.ChannelsByName["PBMNipples?value"].SetValue(hdChannelInputs, 1); figure.ChannelsByName["CTRLRune7?value"].SetValue(hdChannelInputs, 1); figure.ChannelsByName["CTRLRune7HD?value"].SetValue(hdChannelInputs, 1); var converter = new HdMorphToNormalMapConverter(device, shaderCache, figure); var mapRenderer = converter.MakeNormalMapRenderer(ldChannelInputs, hdChannelInputs, figure.UvSets["Rune 7"]); string character = "rune"; var faceMap = mapRenderer.Render(new HashSet <int> { 9, 13, 5, 6 }); faceMap.Save(CommonPaths.WorkDir.File(character + "-face.png")); faceMap.Dispose(); var torsoMap = mapRenderer.Render(new HashSet <int> { 12 }); torsoMap.Save(CommonPaths.WorkDir.File(character + "-torso.png")); torsoMap.Dispose(); var legsMap = mapRenderer.Render(new HashSet <int> { 11, 2 }); legsMap.Save(CommonPaths.WorkDir.File(character + "-legs.png")); legsMap.Dispose(); var armsMap = mapRenderer.Render(new HashSet <int> { 16, 1 }); armsMap.Save(CommonPaths.WorkDir.File(character + "-arms.png")); armsMap.Dispose(); mapRenderer.Dispose(); shaderCache.Dispose(); device.Dispose(); LeakTracking.Finish(); }