#include "renderable.h"
#include "preferencesystem.h"
-#include "generic/callback.h"
+#include "signal/signal.h"
#include "container/array.h"
#include "scenelib.h"
#include "render.h"
#include "timer.h"
-std::vector<Callback> g_cameraMoved_callbacks;
+Signal0 g_cameraMoved_callbacks;
-void AddCameraMovedCallback(const Callback& callback)
+void AddCameraMovedCallback(const SignalHandler& handler)
{
- g_cameraMoved_callbacks.push_back(callback);
+ g_cameraMoved_callbacks.connectLast(handler);
}
void CameraMovedNotify()
{
- std::for_each(g_cameraMoved_callbacks.begin(), g_cameraMoved_callbacks.end(), CallbackInvoke());
+ g_cameraMoved_callbacks();
}
}
+
void CamWnd_Add_Handlers_Move(CamWnd& camwnd)
{
camwnd.m_selection_button_press_handler = g_signal_connect(G_OBJECT(camwnd.m_gl_widget), "button_press_event", G_CALLBACK(selection_button_press), camwnd.m_window_observer);
void CamWnd::EnableFreeMove()
{
-#if 0
- globalOutputStream() << "EnableFreeMove\n";
-#endif
+ //globalOutputStream() << "EnableFreeMove\n";
+
ASSERT_MESSAGE(!m_bFreeMove, "EnableFreeMove: free-move was already enabled");
m_bFreeMove = true;
Camera_clearMovementFlags(getCamera(), MOVE_ALL);
void CamWnd::DisableFreeMove()
{
-#if 0
- globalOutputStream() << "DisableFreeMove\n";
-#endif
+ //globalOutputStream() << "DisableFreeMove\n";
+
ASSERT_MESSAGE(m_bFreeMove, "DisableFreeMove: free-move was not enabled");
m_bFreeMove = false;
Camera_clearMovementFlags(getCamera(), MOVE_ALL);
}
- unsigned int globalstate = RENDER_DEPTHTEST|RENDER_COLOURWRITE|RENDER_DEPTHWRITE|RENDER_ALPHATEST|RENDER_BLEND|RENDER_CULLFACE|RENDER_COLOUR|RENDER_OFFSETLINE;
+ unsigned int globalstate = RENDER_DEPTHTEST|RENDER_COLOURWRITE|RENDER_DEPTHWRITE|RENDER_ALPHATEST|RENDER_BLEND|RENDER_CULLFACE|RENDER_COLOURARRAY|RENDER_OFFSETLINE|RENDER_POLYGONSMOOTH|RENDER_LINESMOOTH|RENDER_FOG|RENDER_COLOURCHANGE;
switch (m_Camera.draw_mode)
{
case cd_wire:
void CamWnd_registerShortcuts()
{
toggle_add_accelerator("ToggleCubicClip");
+
+ if(g_pGameDescription->mGameType == "doom3")
+ {
+ command_connect_accelerator("TogglePreview");
+ }
}
}
}
+void CamWnd_TogglePreview(void)
+{
+ // gametype must be doom3 for this function to work
+ // if the gametype is not doom3 something is wrong with the
+ // global command list or somebody else calls this function.
+ ASSERT_MESSAGE(g_pGameDescription->mGameType == "doom3", "CamWnd_TogglePreview called although mGameType is not doom3 compatible");
+
+ // switch between textured and lighting mode
+ CamWnd_SetMode((CamWnd_GetMode() == cd_lighting) ? cd_texture : cd_lighting);
+}
+
CameraModel* g_camera_model = 0;
typedef FreeCaller1<bool, CamWnd_Move_Discrete_Import> CamWndMoveDiscreteImportCaller;
+/// \brief Initialisation for things that have the same lifespan as this module.
void CamWnd_Construct()
{
GlobalCommands_insert("CenterView", FreeCaller<GlobalCamera_ResetAngles>(), Accelerator(GDK_End));
GlobalCommands_insert("LookThroughSelected", FreeCaller<GlobalCamera_LookThroughSelected>());
GlobalCommands_insert("LookThroughCamera", FreeCaller<GlobalCamera_LookThroughCamera>());
+ if(g_pGameDescription->mGameType == "doom3")
+ {
+ GlobalCommands_insert("TogglePreview", FreeCaller<CamWnd_TogglePreview>(), Accelerator(GDK_F3));
+ }
+
GlobalShortcuts_insert("CameraForward", Accelerator(GDK_Up));
GlobalShortcuts_insert("CameraBack", Accelerator(GDK_Down));
GlobalShortcuts_insert("CameraLeft", Accelerator(GDK_Left));