in unity/Assets/Scripts/Logic/InteractiveLogic.cs [86:145]
void Update() {
switch (current_state_) {
case State.Init:
current_state_ = State.MainLoop;
local_scene_instance_ = scene_manager_.CreateSceneInstance();
Orrb.RendererConfig renderer_config = LoadConfig(renderer_config_path_);
// If the renderer config contains model and mapping paths, use them.
if (renderer_config.ModelXmlPath.Length > 0) {
model_xml_path_ = renderer_config.ModelXmlPath;
}
if (renderer_config.ModelMappingPath.Length > 0) {
model_mapping_path_ = renderer_config.ModelMappingPath;
}
local_scene_instance_.Initialize(model_xml_path_, model_mapping_path_, asset_basedir_);
foreach (Orrb.RendererComponent renderer_component in renderer_config.Components) {
local_scene_instance_.GetComponentManager().AddComponent(
renderer_component.Type,
renderer_component.Name,
renderer_component.Path,
renderer_component.Config,
mode_ == Mode.Server // Enable by default in server mode.
);
}
if (mode_ == Mode.Server) {
// In server mode: resize the useless window, start the GRPC
// server and turn on capture.
Screen.SetResolution(50, 50, false);
render_server_.Initialize(recorder_, local_scene_instance_);
recorder_.Initialize(render_server_);
} else {
// In interactive mode: load state from files, set up active
// cameras.
local_scene_instance_.GetStateLoader().InitializeStateStream(model_state_path_);
scene_cameras_ = local_scene_instance_.GetCameras();
ToggleCamera(current_camera_);
}
if (parent_pid_ != -1) {
// If parent pid was provided start a parent watchdog coroutine.
StartCoroutine(ParentProcessWatch());
}
break;
case State.MainLoop:
default:
if (mode_ == Mode.Server) {
render_server_.ProcessRequests();
} else {
local_scene_instance_.GetComponentManager().RunComponents(new RendererComponent.NullOutputContext());
}
break;
}
}