Example #1
0
void VHelp::Init()
{
  Vision::Callbacks.OnUpdateSceneFinished += this;

  VAppMenu* pMainMenu = GetParent()->GetAppModule<VAppMenu>();
  if (pMainMenu == NULL)
  {
    SetEnabled(false);
    m_bToggleEnabled = true;
    return;
  }

  m_callbacks.Append(pMainMenu->RegisterItem(VAppMenuItem("Help", 0, VAPP_DEFAULT_SORTING_3, true)));
  RegisterCallbacks();

  SetEnabled(false);
}
void VDebugOptions::Init()
{
  Vision::Callbacks.OnUpdateSceneBegin += this;
  Vision::Callbacks.OnBeforeSwapBuffers += this;
  Vision::Callbacks.OnRenderHook += this;

  // Setup graph for displaying un-/filtered time steps
  VGraphProps timeStepGraphProps;
  timeStepGraphProps.vPosition.set(-0.85f, -0.3f);  
  timeStepGraphProps.fWidth = 0.25f;
  timeStepGraphProps.fHeight = 0.25f;  
  timeStepGraphProps.iResolution = 64; 
  timeStepGraphProps.bRangeAdaptation = true;
  m_pTimeStepGraph = new VGraphObject(timeStepGraphProps);
  m_pTimeStepGraph->AddCurve("Unfiltered Time Step", VColorRef(0, 255, 0), new VUnfilteredTimeDiffUpdater);
  m_pTimeStepGraph->AddCurve("Filtered Time Step", VColorRef(255, 0, 0), new VFilteredTimeDiffUpdater);
  m_pTimeStepGraph->Init();
  m_pTimeStepGraph->SetVisible(false);

#if defined(WIN32)
  GetParent()->GetInputMap()->MapTrigger(TOGGLE_FPS, VInputManager::GetKeyboard(), CT_KB_F2, VInputOptions::Once(ONCE_ON_RELEASE));
  GetParent()->GetInputMap()->MapTrigger(TOGGLE_WIREFRAME, VInputManager::GetKeyboard(), CT_KB_F3, VInputOptions::Once(ONCE_ON_RELEASE));
#endif

  VAppMenu* pMainMenu = GetParent()->GetAppModule<VAppMenu>();
  if (pMainMenu == NULL)
    return;

  // General Debug Options
  //  Note: OPTION_FPS, OPTION_WIREFRAME, and OPTION_RELOAD_RESOURCES are added directly to the menu's root, the other options
  //        are added to the menu's root as a group called 'Debug Options'
  m_callbacks.Append(pMainMenu->RegisterItem(VAppMenuItem("Toggle FPS Display", OPTION_FPS, VAPP_DEFAULT_SORTING_0, true)));

  // wireframe rendering is not supported on GLES2
#if !defined(_VR_GLES2)
  m_callbacks.Append(pMainMenu->RegisterItem(VAppMenuItem("Wireframe", OPTION_WIREFRAME, VAPP_DEFAULT_SORTING_0 + 1, true)));
#endif

  m_callbacks.Append(pMainMenu->RegisterItem(VAppMenuItem("Reload Modified Resources", OPTION_RELOAD_RESOURCES, VAPP_DEFAULT_SORTING_0 + 2, false)));

  VAppMenuItems items;
  items.Add(VAppMenuItem("Show Time Step Graph", OPTION_TIME_STEP_GRAPH, 0, true));
  items.Add(VAppMenuItem("Save Screenshot", OPTION_SAVE_SCREENSHOT, 0, false));
#if defined(SUPPORTS_MULTITOUCH)
  items.Add(VAppMenuItem("Touch Area Debug Rendering", OPTION_MULTITOUCH, 0, true));
#endif
  m_callbacks.Append(pMainMenu->RegisterGroup("Debug Options", items, NULL, VAPP_DEFAULT_SORTING_0 + 3, true));
  RegisterCallbacks();

  // Debug Render Flags
  items.RemoveAll();
  items.Add(VAppMenuItem("Display Object Triangle Count", DEBUGRENDERFLAG_OBJECT_TRIANGLECOUNT, 0, true));
  items.Add(VAppMenuItem("Display Object Visibility BoundingBox", DEBUGRENDERFLAG_OBJECT_VISBBOX, 0, true));
  items.Add(VAppMenuItem("Display Object vis. Area Assignment", DEBUGRENDERFLAG_OBJECT_VISIBILITYZONES, 0, true));
  items.Add(VAppMenuItem("Display Light Influence BoundingBox", DEBUGRENDERFLAG_LIGHT_INFLUENCEBOX, 0, true));
  items.Add(VAppMenuItem("Display Trace Lines", DEBUGRENDERFLAG_TRACELINES, 0, true));
  items.Add(VAppMenuItem("Display Visibility Objects", DEBUGRENDERFLAG_VISIBILITYOBJECTS, 0, true));
  items.Add(VAppMenuItem("Display Portals", DEBUGRENDERFLAG_PORTALS, 0, true));
  items.Add(VAppMenuItem("Display Visibility Zones", DEBUGRENDERFLAG_VISIBILITYZONES, 0, true));
  items.Add(VAppMenuItem((Vision::GetScriptManager() != NULL) ? "Scripting Statistics" : "Scripting Statistics (no script man.)", DEBUGRENDERFLAG_SCRIPTSTATISTICS, 0, true));
  items.Add(VAppMenuItem("Display Object Render Order", DEBUGRENDERFLAG_OBJECTRENDERORDER, 0, true));
  items.Add(VAppMenuItem("Display Thread Workload", DEBUGRENDERFLAG_THREADWORKLOAD, 0, true));
  items.Add(VAppMenuItem("Display Streaming Zones", DEBUGRENDERFLAG_ZONES, 0, true));
  items.Add(VAppMenuItem("Display Resource Stats", DEBUGRENDERFLAG_RESOURCE_STATISTICS, 0, true));
  items.Add(VAppMenuItem("Display Memory Stats", DEBUGRENDERFLAG_MEMORY_STATISTICS, 0, true));

  m_debugInfos = pMainMenu->RegisterGroup("Debug Infos", items, "Debug Options");
  RegisterCallbacks(m_debugInfos);
}