Add option to hide the fixed-Patch balls.

This commit is contained in:
Marco Cawthorne 2021-10-13 23:45:43 +02:00
parent 83051af63b
commit 991633dfce
Signed by: eukara
GPG Key ID: C196CD8BA993248A
3 changed files with 30 additions and 0 deletions

View File

@ -86,6 +86,7 @@ struct camwindow_globals_private_t {
bool m_showStats;
bool m_showLighting;
bool m_showAlpha;
bool m_showPatchBalls;
int m_nStrafeMode;
camwindow_globals_private_t() :
@ -98,6 +99,7 @@ struct camwindow_globals_private_t {
m_showStats(false),
m_showLighting(false),
m_showAlpha(true),
m_showPatchBalls(true),
m_nStrafeMode(0)
{
}
@ -1639,9 +1641,30 @@ FreeCaller<void(const Callback<void(bool)> &), ShowAlphaExport> g_show_alpha_cal
Callback<void(const Callback<void(bool)> &)> g_show_alpha_callback(g_show_alpha_caller);
ToggleItem g_show_alpha(g_show_alpha_callback);
/* Show Patch Balls */
void ShowPatchBallsToggle()
{
g_camwindow_globals_private.m_showPatchBalls ^= 1;
}
void ShowPatchBallsExport(const Callback<void(bool)> &importer)
{
importer(g_camwindow_globals_private.m_showPatchBalls);
}
FreeCaller<void(const Callback<void(bool)> &), ShowPatchBallsExport> g_show_patchballs_caller;
Callback<void(const Callback<void(bool)> &)> g_show_patchballs_callback(g_show_patchballs_caller);
ToggleItem g_show_patchballs(g_show_patchballs_callback);
bool
PatchBalls_Visible(void)
{
return g_camwindow_globals_private.m_showPatchBalls;
}
void CamWnd::Cam_Draw()
{
glViewport(0, 0, m_Camera.width, m_Camera.height);
glScissor(0, 0, m_Camera.width, m_Camera.height);
glEnable(GL_SCISSOR_TEST);
#if 0
GLint viewprt[4];
glGetIntegerv( GL_VIEWPORT, viewprt );
@ -2188,6 +2211,7 @@ void CamWnd_Construct()
GlobalToggles_insert("ShowStats", makeCallbackF(ShowStatsToggle), ToggleItem::AddCallbackCaller(g_show_stats));
GlobalToggles_insert("ShowLighting", makeCallbackF(ShowLightToggle), ToggleItem::AddCallbackCaller(g_show_light));
GlobalToggles_insert("ShowAlpha", makeCallbackF(ShowAlphaToggle), ToggleItem::AddCallbackCaller(g_show_alpha));
GlobalToggles_insert("ShowPatchBalls", makeCallbackF(ShowPatchBallsToggle), ToggleItem::AddCallbackCaller(g_show_patchballs));
GlobalPreferenceSystem().registerPreference("ShowStats",
make_property_string(g_camwindow_globals_private.m_showStats));
@ -2195,6 +2219,8 @@ void CamWnd_Construct()
make_property_string(g_camwindow_globals_private.m_showLighting));
GlobalPreferenceSystem().registerPreference("ShowAlpha",
make_property_string(g_camwindow_globals_private.m_showAlpha));
GlobalPreferenceSystem().registerPreference("ShowPatchBalls",
make_property_string(g_camwindow_globals_private.m_showPatchBalls));
GlobalPreferenceSystem().registerPreference("MoveSpeed",
make_property_string(g_camwindow_globals_private.m_nMoveSpeed));
GlobalPreferenceSystem().registerPreference("CamLinkSpeed",

View File

@ -1976,6 +1976,7 @@ ui::MenuItem create_view_menu()
create_check_menu_item_with_mnemonic(menu_in_menu, "Show Lighting", "ShowLighting");
create_check_menu_item_with_mnemonic(menu_in_menu, "Show Alpha", "ShowAlpha");
create_check_menu_item_with_mnemonic(menu_in_menu, "Show Stats", "ShowStats");
create_check_menu_item_with_mnemonic(menu_in_menu, "Show Patch Balls", "ShowPatchBalls");
}
{

View File

@ -1540,6 +1540,7 @@ void patch_draw_sphere(const Vector3 origin, float radius, int sides)
}
}
bool PatchBalls_Visible(void);
void RenderablePatchFixedSolid::RenderNormals() const
{
const std::size_t width = m_tess.m_numStrips + 1;
@ -1552,6 +1553,7 @@ void RenderablePatchFixedSolid::RenderNormals() const
Vector4 colour = (m_tess.m_vertices.data() + (j * width + i))->colour;
/* color the currently selected bit */
if (PatchBalls_Visible()) {
if (PatchInspector_IsSelected((int)i, (int)j)) {
glColor3f(1,0,0);
patch_draw_sphere(pos, 8, 4);
@ -1559,6 +1561,7 @@ void RenderablePatchFixedSolid::RenderNormals() const
glColor3f(1,1,1);
patch_draw_sphere(pos, 2, 4);
}
}
/*{
Vector3 vNormal(