// pseudo-ctor public static void Init() { // load shader mat = Lib.GetShader("FullPointParticle"); // create mesh mesh = new Mesh(); mesh.MarkDynamic(); }
// pseudo-ctor public static void init() { // load shader mat = Lib.GetShader("full_point_particle"); // create mesh mesh = new Mesh(); mesh.MarkDynamic(); }
// pseudo-ctor public static void Init() { // load shader mat = Lib.GetShader("AntiAliasedLine"); }
// render the fields of the interesting body public static void Render() { // get interesting body CelestialBody body = Interesting_body(); // maintain visualization modes if (body == null) { show_inner = false; show_outer = false; show_pause = false; } else { if (Input.GetKeyDown(KeyCode.Keypad0)) { if (show_inner || show_outer || show_pause) { show_inner = false; show_outer = false; show_pause = false; } else { show_inner = true; show_outer = true; show_pause = true; } } if (Input.GetKeyDown(KeyCode.Keypad1)) { show_inner = true; show_outer = false; show_pause = false; } if (Input.GetKeyDown(KeyCode.Keypad2)) { show_inner = false; show_outer = true; show_pause = false; } if (Input.GetKeyDown(KeyCode.Keypad3)) { show_inner = false; show_outer = false; show_pause = true; } } // if there is an active body, and at least one of the modes is active if (body != null && (show_inner || show_outer || show_pause)) { // if we don't know if preprocessing is completed if (preprocess_thread != null) { // if the preprocess thread has not done yet if (preprocess_thread.IsAlive) { // disable all modes show_inner = false; show_outer = false; show_pause = false; // tell the user and do nothing Message.Post("<color=#00ffff><b>Fitting particles to signed distance fields</b></color>", "Come back in a minute"); return; } // wait for particle-fitting thread to cleanup preprocess_thread.Join(); // preprocessing is complete preprocess_thread = null; } // load and configure shader if (mat == null) { if (!Settings.LowQualityRendering) { // load shader mat = Lib.GetShader("MiniParticle"); // configure shader mat.SetColor("POINT_COLOR", new Color(0.33f, 0.33f, 0.33f, 0.1f)); } else { // load shader mat = Lib.GetShader("PointParticle"); // configure shader mat.SetColor("POINT_COLOR", new Color(0.33f, 0.33f, 0.33f, 0.1f)); mat.SetFloat("POINT_SIZE", 4.0f); } } // generate radii-normalized GMS space RadiationBody rb = Info(body); Space gsm = Gsm_space(rb.body, FlightGlobals.Bodies[rb.reference]); #if DEBUG // show axis LineRenderer.Commit(gsm.origin, gsm.origin + gsm.x_axis * gsm.scale * 5.0f, Color.red); LineRenderer.Commit(gsm.origin, gsm.origin + gsm.y_axis * gsm.scale * 5.0f, Color.green); LineRenderer.Commit(gsm.origin, gsm.origin + gsm.z_axis * gsm.scale * 5.0f, Color.blue); #endif // get magnetic field data RadiationModel mf = Info(body).model; // enable material mat.SetPass(0); // render active body fields Matrix4x4 m = gsm.Look_at(); if (show_inner && mf.has_inner) { mf.inner_pmesh.Render(m); } if (show_outer && mf.has_outer) { mf.outer_pmesh.Render(m); } if (show_pause && mf.has_pause) { mf.pause_pmesh.Render(m); } } }
// pseudo-ctor public static void init() { // load shader mat = Lib.GetShader("aa_line"); }