private void Initialize() { //Based on Kronal Vessel Viewer CoM axes rendering if (_rendererMaterial == null) { Material lineMaterial; if (!FARAssets.materialDict.TryGetValue("FARGraphMaterial", out lineMaterial)) { //TODO: definitely replace this with a proper shader when we can FARLogger.Warning("Could not load cross-section shader; using fallback shader"); lineMaterial = new Material(Shader.Find("Sprites/Default")); } _rendererMaterial = new Material(lineMaterial); _rendererMaterial.hideFlags = HideFlags.HideAndDontSave; _rendererMaterial.shader.hideFlags = HideFlags.HideAndDontSave; _rendererMaterial.renderQueue = 4500; } FARLogger.Debug("Creating renderers with material " + _rendererMaterial); FARLogger.Debug("Area color: " + _crossSectionColor + ", Deriv: " + _derivColor + ", Coeff: " + Color.cyan + ", Marking: " + _axisColor); _areaRenderer = CreateNewRenderer(_crossSectionColor, 0.1f, _rendererMaterial); _derivRenderer = CreateNewRenderer(_derivColor, 0.1f, _rendererMaterial); _coeffRenderer = CreateNewRenderer(Color.cyan, 0.1f, _rendererMaterial); _markingRenderers = new List <LineRenderer>(); _markingRenderers.Add(CreateNewRenderer(_axisColor, 0.1f, _rendererMaterial)); }
private void Initialize() { //Based on Kronal Vessel Viewer CoM axes rendering if (_rendererMaterial == null) { Material lineMaterial = FARAssets.Instance.Shaders.LineRenderer; _rendererMaterial = new Material(lineMaterial) { hideFlags = HideFlags.HideAndDontSave, shader = { hideFlags = HideFlags.HideAndDontSave }, renderQueue = 4500 }; } FARLogger.Debug("Creating renderers with material " + _rendererMaterial); FARLogger.Debug("Area color: " + _crossSectionColor + ", Deriv: " + _derivColor + ", Coeff: " + Color.cyan + ", Marking: " + _axisColor); _areaRenderer = CreateNewRenderer(_crossSectionColor, 0.1f, _rendererMaterial); _derivRenderer = CreateNewRenderer(_derivColor, 0.1f, _rendererMaterial); _coeffRenderer = CreateNewRenderer(Color.cyan, 0.1f, _rendererMaterial); _markingRenderers = new List <LineRenderer> { CreateNewRenderer(_axisColor, 0.1f, _rendererMaterial) }; }
public void Print(Part p) { var sb = new StringBuilder(); sb.Append($"{p.name} - mesh build info:"); if (meshes.Count > 0) { sb.Append("\n Meshes: "); sb.Append(string.Join(", ", meshes.ToArray())); } if (colliders.Count > 0) { sb.Append("\n Colliders: "); sb.Append(string.Join(", ", colliders.ToArray())); } if (noRenderer.Count > 0) { sb.Append("\n No renderer found: "); sb.Append(string.Join(", ", noRenderer.ToArray())); } FARLogger.Debug(sb.ToStringAndRelease()); }
private void OpenFile() { if (writer.IsOpen) { FARLogger.Debug($"Continuing logging to {FileName}"); return; } string directory = Path.GetDirectoryName(FileName); if (!string.IsNullOrEmpty(directory) && !Directory.Exists(directory)) { FARLogger.Debug($"Logs directory {directory} does not exist, creating"); Directory.CreateDirectory(directory); } else if (File.Exists(FileName)) { FARLogger.Info($"Appending logs to {FileName}"); } else { FARLogger.Info($"Starting logging to {FileName}"); } writer.Open(); }
public void PauseLogging() { if (!IsActive) { return; } FARLogger.Debug($"Pausing logging to {FileName}"); StopCoroutine(coroutine); coroutine = null; }
private void Awake() { FARLogger.Debug("Setting up debug voxel submesh"); Mesh = new Mesh(); meshFilter = GetComponent <MeshFilter>(); MeshRenderer = GetComponent <MeshRenderer>(); meshFilter.mesh = Mesh; MeshRenderer.material = FARAssets.ShaderCache.DebugVoxels.Material; MeshRenderer.material.mainTexture = FARAssets.TextureCache.VoxelTexture; SetupMeshRenderer(); }
public void StopLogging() { if (!IsActive) { return; } FARLogger.Debug($"Stopping logging to {FileName}"); StopCoroutine(coroutine); writer.Close(); coroutine = null; }
private void QueueMainThreadTask(Action action) { if (VoxelizationThreadpool.Instance.inMainThread) { FARLogger.Debug("In main thread, not queueing " + action.Method.Name); action(); } else { ThreadSafeDebugLogger.Instance.RegisterDebugMessage("Running " + action.Method.Name + " in main thread"); VoxelizationThreadpool.Instance.RunOnMainThread(action); } }
private void UpdateDebug() { if (_debugMessages.Count > 0) { System.Text.StringBuilder sB = new System.Text.StringBuilder(); for (int i = 0; i < _debugMessages.Count; i++) { sB.AppendLine(_debugMessages[i]); } _debugMessages.Clear(); FARLogger.Debug("" + sB.ToString()); } }
private void UpdateDebug() { if (_debugMessages.Count <= 0) { return; } var sB = new StringBuilder(); foreach (string message in _debugMessages) { sB.AppendLine(message); } _debugMessages.Clear(); FARLogger.Debug("" + sB); }
private void Awake() { FARLogger.Debug("Setting up debug voxel mesh"); Mesh = new Mesh(); Use32BitIndices = FARSettingsScenarioModule.VoxelSettings.use32BitIndices; Filter = GetComponent <MeshFilter>(); Renderer = GetComponent <MeshRenderer>(); Filter.mesh = Mesh; // voxel mesh should not be affected by lights Renderer.lightProbeUsage = LightProbeUsage.Off; Renderer.reflectionProbeUsage = ReflectionProbeUsage.Off; Renderer.shadowCastingMode = ShadowCastingMode.Off; Renderer.receiveShadows = false; Renderer.motionVectorGenerationMode = MotionVectorGenerationMode.ForceNoMotion; }
private IEnumerator LoadAssets() { FARLogger.Debug("Loading all assets"); if (ShaderLoader.NeedsReload) { yield return(ShaderLoader.Load()); } while (ShaderLoader.State == Progress.InProgress) { yield return(null); } yield return(DoReloadAssets()); Completed = true; loaded = true; }
private void SetupMainThread() { _mainThread = Thread.CurrentThread; FARLogger.Debug("Main thread: " + _mainThread.Name); }
public GraphData RunTransientSimLongitudinal(StabilityDerivOutput vehicleData, double endTime, double initDt, double[] InitCond) { SimMatrix A = new SimMatrix(4, 4); int i = 0; int j = 0; double[] Derivs = new double[27]; vehicleData.stabDerivs.CopyTo(Derivs, 0); double MAC2u = vehicleData.MAC / (2 * vehicleData.nominalVelocity); double effg = _instantCondition.CalculateEffectiveGravity(vehicleData.body, vehicleData.altitude, vehicleData.nominalVelocity); FARLogger.Info("MAC/(2u)= " + MAC2u + " IGNORED!"); FARLogger.Info("effg= " + effg); // Rodhern: For possible backward compability the rotation (moment) derivatives can be // scaled by "mac/(2u)" (pitch) and "b/(2u)" (roll and yaw). //for (int h = 9; h <= 11; h++) // Derivs[h] = Derivs[h] * MAC2u; Derivs[9] = Derivs[9] + vehicleData.nominalVelocity; for (int k = 3; k < 15 && k < Derivs.Length; k++) { double f = Derivs[k]; if (i <= 2) { FARLogger.Info("A[" + i + "," + j + "]= f_" + k + " = " + f); A.Add(f, i, j); } else { FARLogger.Debug("Ignore B[0," + j + "]= " + f); } if (j < 2) { j++; } else { j = 0; i++; } } A.Add(-effg, 3, 1); A.Add(1, 2, 3); A.PrintToConsole(); //We should have an array that looks like this: /* i ---------------> * j [ Z w , Z u , Z q + u, 0 ] * | [ X w , X u , X q , -g ] * | [ M w , M u , M q , 0 ] * \ / [ 0 , 0 , 1 , 0 ] * V */ //And one that looks like this: (Unused) /* * [ Z e ] * [ X e ] * [ M e ] * [ 0 ] * */ RungeKutta4 transSolve = new RungeKutta4(endTime, initDt, A, InitCond); transSolve.Solve(); GraphData lines = new GraphData(); lines.xValues = transSolve.time; double[] yVal = transSolve.GetSolution(0); ScaleAndClampValues(yVal, 1, 50); lines.AddData(yVal, GUIColors.GetColor(3), "w", true); yVal = transSolve.GetSolution(1); ScaleAndClampValues(yVal, 1, 50); lines.AddData(yVal, GUIColors.GetColor(2), "u", true); yVal = transSolve.GetSolution(2); ScaleAndClampValues(yVal, 180 / Math.PI, 50); lines.AddData(yVal, GUIColors.GetColor(1), "q", true); yVal = transSolve.GetSolution(3); ScaleAndClampValues(yVal, 180 / Math.PI, 50); lines.AddData(yVal, GUIColors.GetColor(0), "θ", true); /*graph.SetBoundaries(0, endTime, -10, 10); * graph.SetGridScaleUsingValues(1, 5); * graph.horizontalLabel = "time"; * graph.verticalLabel = "value"; * graph.Update();*/ return(lines); }