aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/linden/indra/newview/llviewerdisplay.cpp
diff options
context:
space:
mode:
authorJacek Antonelli2008-08-15 23:45:19 -0500
committerJacek Antonelli2008-08-15 23:45:19 -0500
commitb235c59d60472f818a9142c0886b95a0ff4191d7 (patch)
treed323c55587584b19cc43a03f58a178823f12d3cd /linden/indra/newview/llviewerdisplay.cpp
parentSecond Life viewer sources 1.18.5.3 (diff)
downloadmeta-impy-b235c59d60472f818a9142c0886b95a0ff4191d7.zip
meta-impy-b235c59d60472f818a9142c0886b95a0ff4191d7.tar.gz
meta-impy-b235c59d60472f818a9142c0886b95a0ff4191d7.tar.bz2
meta-impy-b235c59d60472f818a9142c0886b95a0ff4191d7.tar.xz
Second Life viewer sources 1.18.6.0-RC
Diffstat (limited to 'linden/indra/newview/llviewerdisplay.cpp')
-rw-r--r--linden/indra/newview/llviewerdisplay.cpp199
1 files changed, 121 insertions, 78 deletions
diff --git a/linden/indra/newview/llviewerdisplay.cpp b/linden/indra/newview/llviewerdisplay.cpp
index 24b8105..6018431 100644
--- a/linden/indra/newview/llviewerdisplay.cpp
+++ b/linden/indra/newview/llviewerdisplay.cpp
@@ -62,7 +62,7 @@
62#include "llvograss.h" 62#include "llvograss.h"
63#include "llworld.h" 63#include "llworld.h"
64#include "pipeline.h" 64#include "pipeline.h"
65#include "viewer.h" 65#include "llappviewer.h"
66#include "llstartup.h" 66#include "llstartup.h"
67#include "llfasttimer.h" 67#include "llfasttimer.h"
68#include "llfloatertools.h" 68#include "llfloatertools.h"
@@ -72,14 +72,11 @@
72#include "llviewerregion.h" 72#include "llviewerregion.h"
73#include "lldrawpoolwater.h" 73#include "lldrawpoolwater.h"
74 74
75extern U32 gFrameCount;
76extern LLPointer<LLImageGL> gStartImageGL; 75extern LLPointer<LLImageGL> gStartImageGL;
77extern LLPointer<LLImageGL> gDisconnectedImagep;
78extern BOOL gLogoutRequestSent;
79extern LLTimer gLogoutTimer;
80extern BOOL gHaveSavedSnapshot;
81extern BOOL gDisplaySwapBuffers; 76extern BOOL gDisplaySwapBuffers;
82 77
78LLPointer<LLImageGL> gDisconnectedImagep = NULL;
79
83// used to toggle renderer back on after teleport 80// used to toggle renderer back on after teleport
84const F32 TELEPORT_RENDER_DELAY = 20.f; // Max time a teleport is allowed to take before we raise the curtain 81const F32 TELEPORT_RENDER_DELAY = 20.f; // Max time a teleport is allowed to take before we raise the curtain
85const F32 TELEPORT_ARRIVAL_DELAY = 2.f; // Time to preload the world before raising the curtain after we've actually already arrived. 82const F32 TELEPORT_ARRIVAL_DELAY = 2.f; // Time to preload the world before raising the curtain after we've actually already arrived.
@@ -99,7 +96,7 @@ void render_ui_3d();
99void render_ui_2d(); 96void render_ui_2d();
100void render_disconnected_background(); 97void render_disconnected_background();
101 98
102void process_keystrokes_async(); // in viewer.cpp 99void process_keystrokes_async();
103 100
104void display_startup() 101void display_startup()
105{ 102{
@@ -331,7 +328,7 @@ void display(BOOL rebuild, F32 zoom_factor, int subfield)
331 break; 328 break;
332 } 329 }
333 } 330 }
334 else if(gLogoutRequestSent) 331 else if(LLAppViewer::instance()->logoutRequestSent())
335 { 332 {
336 F32 percent_done = gLogoutTimer.getElapsedTimeF32() * 100.f / gLogoutMaxTime; 333 F32 percent_done = gLogoutTimer.getElapsedTimeF32() * 100.f / gLogoutMaxTime;
337 if (percent_done > 100.f) 334 if (percent_done > 100.f)
@@ -339,7 +336,7 @@ void display(BOOL rebuild, F32 zoom_factor, int subfield)
339 percent_done = 100.f; 336 percent_done = 100.f;
340 } 337 }
341 338
342 if( gQuit ) 339 if( LLApp::isExiting() )
343 { 340 {
344 percent_done = 100.f; 341 percent_done = 100.f;
345 } 342 }
@@ -358,7 +355,7 @@ void display(BOOL rebuild, F32 zoom_factor, int subfield)
358 else 355 else
359 { 356 {
360 357
361 if( gQuit ) 358 if( LLApp::isExiting() )
362 { 359 {
363 percent_done = 100.f; 360 percent_done = 100.f;
364 } 361 }
@@ -554,7 +551,7 @@ void display(BOOL rebuild, F32 zoom_factor, int subfield)
554 // glPopMatrix(); 551 // glPopMatrix();
555 //} 552 //}
556 553
557 if (!(gLogoutRequestSent && gHaveSavedSnapshot) 554 if (!(LLAppViewer::instance()->logoutRequestSent() && LLAppViewer::instance()->hasSavedFinalSnapshot())
558 && !gRestoreGL 555 && !gRestoreGL
559 && !gDisconnected) 556 && !gDisconnected)
560 { 557 {
@@ -745,6 +742,74 @@ void render_ui_and_swap()
745 } 742 }
746} 743}
747 744
745void renderCoordinateAxes()
746{
747 LLGLSNoTexture gls_no_texture;
748 glBegin(GL_LINES);
749 glColor3f(1.0f, 0.0f, 0.0f); // i direction = X-Axis = red
750 glVertex3f(0.0f, 0.0f, 0.0f);
751 glVertex3f(2.0f, 0.0f, 0.0f);
752 glVertex3f(3.0f, 0.0f, 0.0f);
753 glVertex3f(5.0f, 0.0f, 0.0f);
754 glVertex3f(6.0f, 0.0f, 0.0f);
755 glVertex3f(8.0f, 0.0f, 0.0f);
756 // Make an X
757 glVertex3f(11.0f, 1.0f, 1.0f);
758 glVertex3f(11.0f, -1.0f, -1.0f);
759 glVertex3f(11.0f, 1.0f, -1.0f);
760 glVertex3f(11.0f, -1.0f, 1.0f);
761
762 glColor3f(0.0f, 1.0f, 0.0f); // j direction = Y-Axis = green
763 glVertex3f(0.0f, 0.0f, 0.0f);
764 glVertex3f(0.0f, 2.0f, 0.0f);
765 glVertex3f(0.0f, 3.0f, 0.0f);
766 glVertex3f(0.0f, 5.0f, 0.0f);
767 glVertex3f(0.0f, 6.0f, 0.0f);
768 glVertex3f(0.0f, 8.0f, 0.0f);
769 // Make a Y
770 glVertex3f(1.0f, 11.0f, 1.0f);
771 glVertex3f(0.0f, 11.0f, 0.0f);
772 glVertex3f(-1.0f, 11.0f, 1.0f);
773 glVertex3f(0.0f, 11.0f, 0.0f);
774 glVertex3f(0.0f, 11.0f, 0.0f);
775 glVertex3f(0.0f, 11.0f, -1.0f);
776
777 glColor3f(0.0f, 0.0f, 1.0f); // Z-Axis = blue
778 glVertex3f(0.0f, 0.0f, 0.0f);
779 glVertex3f(0.0f, 0.0f, 2.0f);
780 glVertex3f(0.0f, 0.0f, 3.0f);
781 glVertex3f(0.0f, 0.0f, 5.0f);
782 glVertex3f(0.0f, 0.0f, 6.0f);
783 glVertex3f(0.0f, 0.0f, 8.0f);
784 // Make a Z
785 glVertex3f(-1.0f, 1.0f, 11.0f);
786 glVertex3f(1.0f, 1.0f, 11.0f);
787 glVertex3f(1.0f, 1.0f, 11.0f);
788 glVertex3f(-1.0f, -1.0f, 11.0f);
789 glVertex3f(-1.0f, -1.0f, 11.0f);
790 glVertex3f(1.0f, -1.0f, 11.0f);
791 glEnd();
792}
793
794
795void draw_axes()
796{
797 LLGLSUIDefault gls_ui;
798 LLGLSNoTexture gls_no_texture;
799 // A vertical white line at origin
800 LLVector3 v = gAgent.getPositionAgent();
801 glBegin(GL_LINES);
802 glColor3f(1.0f, 1.0f, 1.0f);
803 glVertex3f(0.0f, 0.0f, 0.0f);
804 glVertex3f(0.0f, 0.0f, 40.0f);
805 glEnd();
806 // Some coordinate axes
807 glPushMatrix();
808 glTranslatef( v.mV[VX], v.mV[VY], v.mV[VZ] );
809 renderCoordinateAxes();
810 glPopMatrix();
811}
812
748void render_ui_3d() 813void render_ui_3d()
749{ 814{
750 LLGLSPipeline gls_pipeline; 815 LLGLSPipeline gls_pipeline;
@@ -841,73 +906,6 @@ void render_ui_2d()
841 LLFontGL::sCurOrigin.set(0, 0); 906 LLFontGL::sCurOrigin.set(0, 0);
842} 907}
843 908
844void renderCoordinateAxes()
845{
846 LLGLSNoTexture gls_no_texture;
847 glBegin(GL_LINES);
848 glColor3f(1.0f, 0.0f, 0.0f); // i direction = X-Axis = red
849 glVertex3f(0.0f, 0.0f, 0.0f);
850 glVertex3f(2.0f, 0.0f, 0.0f);
851 glVertex3f(3.0f, 0.0f, 0.0f);
852 glVertex3f(5.0f, 0.0f, 0.0f);
853 glVertex3f(6.0f, 0.0f, 0.0f);
854 glVertex3f(8.0f, 0.0f, 0.0f);
855 // Make an X
856 glVertex3f(11.0f, 1.0f, 1.0f);
857 glVertex3f(11.0f, -1.0f, -1.0f);
858 glVertex3f(11.0f, 1.0f, -1.0f);
859 glVertex3f(11.0f, -1.0f, 1.0f);
860
861 glColor3f(0.0f, 1.0f, 0.0f); // j direction = Y-Axis = green
862 glVertex3f(0.0f, 0.0f, 0.0f);
863 glVertex3f(0.0f, 2.0f, 0.0f);
864 glVertex3f(0.0f, 3.0f, 0.0f);
865 glVertex3f(0.0f, 5.0f, 0.0f);
866 glVertex3f(0.0f, 6.0f, 0.0f);
867 glVertex3f(0.0f, 8.0f, 0.0f);
868 // Make a Y
869 glVertex3f(1.0f, 11.0f, 1.0f);
870 glVertex3f(0.0f, 11.0f, 0.0f);
871 glVertex3f(-1.0f, 11.0f, 1.0f);
872 glVertex3f(0.0f, 11.0f, 0.0f);
873 glVertex3f(0.0f, 11.0f, 0.0f);
874 glVertex3f(0.0f, 11.0f, -1.0f);
875
876 glColor3f(0.0f, 0.0f, 1.0f); // Z-Axis = blue
877 glVertex3f(0.0f, 0.0f, 0.0f);
878 glVertex3f(0.0f, 0.0f, 2.0f);
879 glVertex3f(0.0f, 0.0f, 3.0f);
880 glVertex3f(0.0f, 0.0f, 5.0f);
881 glVertex3f(0.0f, 0.0f, 6.0f);
882 glVertex3f(0.0f, 0.0f, 8.0f);
883 // Make a Z
884 glVertex3f(-1.0f, 1.0f, 11.0f);
885 glVertex3f(1.0f, 1.0f, 11.0f);
886 glVertex3f(1.0f, 1.0f, 11.0f);
887 glVertex3f(-1.0f, -1.0f, 11.0f);
888 glVertex3f(-1.0f, -1.0f, 11.0f);
889 glVertex3f(1.0f, -1.0f, 11.0f);
890 glEnd();
891}
892
893void draw_axes()
894{
895 LLGLSUIDefault gls_ui;
896 LLGLSNoTexture gls_no_texture;
897 // A vertical white line at origin
898 LLVector3 v = gAgent.getPositionAgent();
899 glBegin(GL_LINES);
900 glColor3f(1.0f, 1.0f, 1.0f);
901 glVertex3f(0.0f, 0.0f, 0.0f);
902 glVertex3f(0.0f, 0.0f, 40.0f);
903 glEnd();
904 // Some coordinate axes
905 glPushMatrix();
906 glTranslatef( v.mV[VX], v.mV[VY], v.mV[VZ] );
907 renderCoordinateAxes();
908 glPopMatrix();
909}
910
911 909
912void render_disconnected_background() 910void render_disconnected_background()
913{ 911{
@@ -984,3 +982,48 @@ void render_disconnected_background()
984 glPopMatrix(); 982 glPopMatrix();
985 } 983 }
986} 984}
985
986void display_cleanup()
987{
988 gDisconnectedImagep = NULL;
989}
990
991void process_keystrokes_async()
992{
993#if LL_WINDOWS
994 MSG msg;
995 // look through all input messages, leaving them in the event queue
996 while( PeekMessage(&msg, NULL, 0, 0, PM_NOREMOVE | PM_NOYIELD))
997 {
998 // on first mouse message, break out
999 if (msg.message >= WM_MOUSEFIRST &&
1000 msg.message <= WM_MOUSELAST ||
1001 msg.message == WM_QUIT)
1002 {
1003 break;
1004 }
1005
1006 // this is a message we want to handle now, so remove it from the event queue
1007 PeekMessage(&msg, NULL, msg.message, msg.message, PM_REMOVE | PM_NOYIELD);
1008 // if (msg.message == WM_KEYDOWN)
1009 // {
1010 // llinfos << "Process async key down " << (U32)msg.wParam << llendl;
1011 // }
1012 TranslateMessage(&msg);
1013 DispatchMessage(&msg);
1014 }
1015
1016 // Scan keyboard for movement keys. Command keys and typing
1017 // are handled by windows callbacks. Don't do this until we're
1018 // done initializing. JC
1019 if (gViewerWindow->mWindow->getVisible()
1020 && gViewerWindow->getActive()
1021 && !gViewerWindow->mWindow->getMinimized()
1022 && LLStartUp::getStartupState() == STATE_STARTED
1023 && !gViewerWindow->getShowProgress()
1024 && !gFocusMgr.focusLocked())
1025 {
1026 gKeyboard->scanKeyboard();
1027 }
1028#endif
1029}