Panda3D
 All Classes Functions Variables Enumerations
config_tinydisplay.cxx
00001 // Filename: config_tinydisplay.cxx
00002 // Created by:  drose (24Apr08)
00003 //
00004 ////////////////////////////////////////////////////////////////////
00005 //
00006 // PANDA 3D SOFTWARE
00007 // Copyright (c) Carnegie Mellon University.  All rights reserved.
00008 //
00009 // All use of this software is subject to the terms of the revised BSD
00010 // license.  You should have received a copy of this license along
00011 // with this source code in a file named "LICENSE."
00012 //
00013 ////////////////////////////////////////////////////////////////////
00014 
00015 #include "config_tinydisplay.h"
00016 #include "tinyXGraphicsPipe.h"
00017 #include "tinyXGraphicsWindow.h"
00018 #include "tinyWinGraphicsPipe.h"
00019 #include "tinyWinGraphicsWindow.h"
00020 #include "tinyOsxGraphicsPipe.h"
00021 #include "tinyOsxGraphicsWindow.h"
00022 #include "tinySDLGraphicsPipe.h"
00023 #include "tinySDLGraphicsWindow.h"
00024 #include "tinyOffscreenGraphicsPipe.h"
00025 #include "tinyGraphicsBuffer.h"
00026 #include "tinyGraphicsStateGuardian.h"
00027 #include "tinyGeomMunger.h"
00028 #include "tinyTextureContext.h"
00029 #include "graphicsPipeSelection.h"
00030 #include "dconfig.h"
00031 #include "pandaSystem.h"
00032 
00033 Configure(config_tinydisplay);
00034 NotifyCategoryDef(tinydisplay, "display");
00035 
00036 ConfigureFn(config_tinydisplay) {
00037   init_libtinydisplay();
00038 }
00039 
00040 ConfigVariableBool show_resize_box
00041 ("show-resize-box", true,
00042  PRC_DESC("When this variable is true, then resizable OSX Panda windows will "
00043           "be rendered with a resize control in the lower-right corner.  "
00044           "This is specially handled by Panda, since otherwise the 3-d "
00045           "window would completely hide any resize control drawn by the "
00046           "OS.  Set this variable false to allow this control to be hidden."));
00047 
00048 ConfigVariableBool osx_disable_event_loop
00049 ("osx-disable-event-loop", false,
00050  PRC_DESC("Set this true to disable the window event loop for the Panda "
00051           "windows.  This makes sense only in a publish environment where "
00052           "the window event loop is already handled by another part of the "
00053           "app."));
00054 
00055 ConfigVariableInt osx_mouse_wheel_scale
00056 ("osx-mouse-wheel-scale", 1,
00057  PRC_DESC("Specify the number of units to spin the Mac mouse wheel to "
00058           "represent a single wheel_up or wheel_down message."));
00059 
00060 ConfigVariableBool td_ignore_mipmaps
00061   ("td-ignore-mipmaps", false,
00062    PRC_DESC("Configure this true to disable use of mipmaps on the "
00063             "tinydisplay software renderer."));
00064 
00065 ConfigVariableBool td_ignore_clamp
00066   ("td-ignore-clamp", false,
00067    PRC_DESC("Configure this true to disable texture clamp mode and other "
00068             "wrap modes other than repeat (all textures will repeat, which "
00069             "is a little cheaper)."));
00070 
00071 ConfigVariableBool td_perspective_textures
00072   ("td-perspective-textures", true,
00073    PRC_DESC("Configure this false to disable use of perspective-correct "
00074             "textures on the tinydisplay software renderer, for a small "
00075             "performance gain."));
00076 
00077 ////////////////////////////////////////////////////////////////////
00078 //     Function: init_libtinydisplay
00079 //  Description: Initializes the library.  This must be called at
00080 //               least once before any of the functions or classes in
00081 //               this library can be used.  Normally it will be
00082 //               called by the static initializers and need not be
00083 //               called explicitly, but special cases exist.
00084 ////////////////////////////////////////////////////////////////////
00085 void
00086 init_libtinydisplay() {
00087   static bool initialized = false;
00088   if (initialized) {
00089     return;
00090   }
00091   initialized = true;
00092 
00093   TinyGraphicsBuffer::init_type();
00094   TinyGraphicsStateGuardian::init_type();
00095   TinyGeomMunger::init_type();
00096   TinyTextureContext::init_type();
00097 
00098   PandaSystem *ps = PandaSystem::get_global_ptr();
00099   ps->add_system("TinyPanda");
00100 
00101   GraphicsPipeSelection *selection = GraphicsPipeSelection::get_global_ptr();
00102 
00103 #ifdef HAVE_X11
00104   TinyXGraphicsPipe::init_type();
00105   TinyXGraphicsWindow::init_type();
00106   selection->add_pipe_type(TinyXGraphicsPipe::get_class_type(),
00107                            TinyXGraphicsPipe::pipe_constructor);
00108   ps->set_system_tag("TinyPanda", "native_window_system", "X11");
00109 #endif
00110 
00111 #ifdef WIN32
00112   TinyWinGraphicsPipe::init_type();
00113   TinyWinGraphicsWindow::init_type();
00114   selection->add_pipe_type(TinyWinGraphicsPipe::get_class_type(),
00115                            TinyWinGraphicsPipe::pipe_constructor);
00116   ps->set_system_tag("TinyPanda", "native_window_system", "Win");
00117 #endif
00118 
00119 #if defined(IS_OSX) && !defined(BUILD_IPHONE)
00120   TinyOsxGraphicsPipe::init_type();
00121   TinyOsxGraphicsWindow::init_type();
00122   selection->add_pipe_type(TinyOsxGraphicsPipe::get_class_type(),
00123                            TinyOsxGraphicsPipe::pipe_constructor);
00124   ps->set_system_tag("TinyPanda", "native_window_system", "OSX");
00125 #endif
00126 
00127 #ifdef HAVE_SDL
00128   TinySDLGraphicsPipe::init_type();
00129   TinySDLGraphicsWindow::init_type();
00130   selection->add_pipe_type(TinySDLGraphicsPipe::get_class_type(),
00131                            TinySDLGraphicsPipe::pipe_constructor);
00132   ps->set_system_tag("TinyPanda", "SDL", "SDL");
00133 #endif
00134 
00135   TinyOffscreenGraphicsPipe::init_type();
00136   selection->add_pipe_type(TinyOffscreenGraphicsPipe::get_class_type(),
00137                            TinyOffscreenGraphicsPipe::pipe_constructor);
00138   ps->set_system_tag("TinyPanda", "", "");
00139 }
00140 
00141 ////////////////////////////////////////////////////////////////////
00142 //     Function: get_pipe_type_p3tinydisplay
00143 //  Description: Returns the TypeHandle index of the recommended
00144 //               graphics pipe type defined by this module.
00145 ////////////////////////////////////////////////////////////////////
00146 int
00147 get_pipe_type_p3tinydisplay() {
00148 
00149 #ifdef WIN32
00150   return TinyWinGraphicsPipe::get_class_type().get_index();
00151 #endif
00152 
00153 #if defined(IS_OSX) && !defined(BUILD_IPHONE)
00154   return TinyOsxGraphicsPipe::get_class_type().get_index();
00155 #endif
00156 
00157 #ifdef HAVE_X11
00158   return TinyXGraphicsPipe::get_class_type().get_index();
00159 #endif
00160 
00161 #ifdef HAVE_SDL
00162   return TinySDLGraphicsPipe::get_class_type().get_index();
00163 #endif
00164 
00165   return TinyOffscreenGraphicsPipe::get_class_type().get_index();
00166 }
 All Classes Functions Variables Enumerations