private void camera_update() { // camera view for VR PerformanceFetcher.PushMarker("camera_view"); { bool reset_view = false; if (InputManager.Instance.getButton(InputManager.Button.Camera) > 0) { subjective_ = !subjective_; if (subjective_) { reset_view = true; } } if (reset_position_) { reset_view = true; reset_position_ = false; } if (reset_view) { resetView(); } if (subjective_) { camera_holder_transform_.position = (player_go_.transform.position + new Vector3(0, 0.5f, 0f + view_offset_z_)); } else { camera_holder_transform_.position = new Vector3(0, 0, 0); } } PerformanceFetcher.PopMarker(); }
// The Update void Update() { render_tick3_ = stopwatch_.ElapsedTicks - render_start_tick_; PerformanceFetcher.PushMarker("Update"); unity_update(); end_of_frame(); PerformanceFetcher.PopMarker(); render_tick4_ = stopwatch_.ElapsedTicks - render_start_tick_; }
private void unity_update() { beginPerformanceMeter2(); // input phase PerformanceFetcher.PushMarker("input_update"); input_update(); PerformanceFetcher.PopMarker(); // PerformanceFetcher.PushMarker("several render"); double render_time = update_time_ - dt_; render(ref draw_buffer_[rendering_front_]); Debris.Instance.render(rendering_front_, camera_, render_time, flow_speed_, dt_); Spark.Instance.render(rendering_front_, camera_, render_time, flow_speed_); Beam.Instance.render(rendering_front_); Beam2.Instance.render(rendering_front_); Trail.Instance.render(rendering_front_); if (explosion_material_ != null) { Explosion.Instance.render(rendering_front_, camera_, render_time, flow_speed_ * 0.25f); } Hahen.Instance.render(rendering_front_, render_time); Shockwave.Instance.render(rendering_front_, camera_, render_time); Shield.Instance.render(rendering_front_, render_time); Sight.Instance.render(rendering_front_, camera_, render_time); LockonRange.Instance.render(dt_); LockonRangeRenderer.Instance.render(render_time, dt_); TubeScroller.Instance.render(); PerformanceFetcher.PopMarker(); PerformanceFetcher.PushMarker("hud render"); VRSprite.Instance.render(rendering_front_, camera_); MySprite.Instance.render(rendering_front_); MyFont.Instance.render(rendering_front_); PerformanceFetcher.PopMarker(); // memory investigation used_heap_size_ = (long)Profiler.usedHeapSize; mono_heap_size_ = (long)Profiler.GetMonoHeapSize(); mono_used_size_ = (long)Profiler.GetMonoUsedSize(); // frame elapsed_frame_time_ = Time.time - prev_frame_time_; elapsed_frame_time_display_ = Mathf.Lerp(elapsed_frame_time_display_, elapsed_frame_time_, 0.01f); prev_frame_time_ = Time.time; }