public LogPipe(LogStore logStore) { _logStore = logStore; _stream = new LogStream(LogStreamCallback); _stream.Attach(); }
private void FetchLogEntriesFromScene() { var sceneName = (string)comboBoxSource.SelectedItem; var scene = (from tab in MainWindow.UiState.Tabs where tab.File == sceneName select tab.ActiveScene).FirstOrDefault(); if (scene == null) { richTextBox.Text = Resources.LogViewer_FetchLogEntriesFromScene_No_scene_loaded; return; } _currentLogStore = scene.LogStore; BuildRtf(); }
private string LogEntryToPlainText(LogStore.Entry entry) { string s; switch (entry.Cat) { case LogStore.Category.Info: s = "Info: "; break; case LogStore.Category.Warn: s = "Warn: "; break; case LogStore.Category.Error: s = "Error: "; break; case LogStore.Category.Debug: s = "Debug: "; break; case LogStore.Category.System: s = "System: "; break; default: throw new ArgumentOutOfRangeException(); } return entry.ThreadId.ToString(CultureInfo.InvariantCulture).PadLeft(4) + "|" + entry.Time.ToString(CultureInfo.InvariantCulture).PadLeft(10,'0') + " " + s + entry.Message; }
/// <summary> /// Construct a scene given a file name, throw if loading fails /// </summary> /// <param name="file">File name to be loaded</param> public Scene(string file) { _file = file; _baseDir = Path.GetDirectoryName(file); _logStore = new LogStore(); var stopwatch = new Stopwatch(); stopwatch.Start(); try { using (var imp = new AssimpContext()) { LogStream.IsVerboseLoggingEnabled = true; using (var pipe = new LogPipe(_logStore)) { // Assimp configuration: // - if no normals are present, generate them using a threshold // angle of 66 degrees. imp.SetConfig(new NormalSmoothingAngleConfig(66.0f)); // start with TargetRealTimeMaximumQuality and add/remove flags // according to the import configuration var postprocess = GetPostProcessStepsFlags(); // - request lots of post processing steps, the details of which // can be found in the TargetRealTimeMaximumQuality docs. _raw = imp.ImportFile(file, postprocess); if (_raw == null) { Dispose(); throw new Exception("failed to read file: " + file); } _incomplete = _raw.SceneFlags.HasFlag(SceneFlags.Incomplete); } } } catch (AssimpException ex) { Dispose(); throw new Exception("failed to read file: " + file + " (" + ex.Message + ")"); } stopwatch.Stop(); _loadingTime = stopwatch.ElapsedMilliseconds; _animator = new SceneAnimator(this); _textureSet = new TextureSet(BaseDir); LoadTextures(); // compute a bounding box (AABB) for the scene we just loaded ComputeBoundingBox(out _sceneMin, out _sceneMax, out _sceneCenter); _pivot = _sceneCenter; CountVertsAndFaces(out _totalVertexCount, out _totalTriangleCount, out _totalLineCount, out _totalPointCount); CreateRenderingBackend(); }
/// <summary> /// Construct a scene given a file name, throw if loading fails /// </summary> /// <param name="file">File name to be loaded</param> public Scene(string file) { _file = file; _baseDir = Path.GetDirectoryName(file); _logStore = new LogStore(); var stopwatch = new Stopwatch(); stopwatch.Start(); try { using (var imp = new AssimpContext()) { LogStream.IsVerboseLoggingEnabled = true; using(var pipe = new LogPipe(_logStore)) { // Assimp configuration: // - if no normals are present, generate them using a threshold // angle of 66 degrees. imp.SetConfig(new NormalSmoothingAngleConfig(66.0f)); // start with TargetRealTimeMaximumQuality and add/remove flags // according to the import configuration var postprocess = GetPostProcessStepsFlags(); // - request lots of post processing steps, the details of which // can be found in the TargetRealTimeMaximumQuality docs. _raw = imp.ImportFile(file, postprocess); if (_raw == null) { Dispose(); throw new Exception("failed to read file: " + file); } _incomplete = _raw.SceneFlags.HasFlag(SceneFlags.Incomplete); } } } catch(AssimpException ex) { Dispose(); throw new Exception("failed to read file: " + file + " (" + ex.Message + ")"); } stopwatch.Stop(); _loadingTime = stopwatch.ElapsedMilliseconds; _animator = new SceneAnimator(this); _textureSet = new TextureSet(BaseDir); LoadTextures(); // compute a bounding box (AABB) for the scene we just loaded ComputeBoundingBox(out _sceneMin, out _sceneMax, out _sceneCenter); _pivot = _sceneCenter; CountVertsAndFaces(out _totalVertexCount, out _totalTriangleCount, out _totalLineCount, out _totalPointCount); CreateRenderingBackend(); }