Panda3D
|
00001 // Filename: graphicsPipe.cxx 00002 // Created by: mike (09Jan97) 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 "graphicsPipe.h" 00016 #include "graphicsWindow.h" 00017 #include "graphicsBuffer.h" 00018 #include "config_display.h" 00019 #include "mutexHolder.h" 00020 00021 TypeHandle GraphicsPipe::_type_handle; 00022 00023 //////////////////////////////////////////////////////////////////// 00024 // Function: GraphicsPipe::Constructor 00025 // Access: Protected 00026 // Description: 00027 //////////////////////////////////////////////////////////////////// 00028 GraphicsPipe:: 00029 GraphicsPipe() : 00030 _lock("GraphicsPipe") 00031 { 00032 // Initially, we assume the GraphicsPipe is valid. A derived class 00033 // should set this to false if it determines otherwise. 00034 _is_valid = true; 00035 00036 // A derived class must indicate the kinds of GraphicsOutput objects 00037 // it can create. 00038 _supported_types = 0; 00039 00040 _display_width = 0; 00041 _display_height = 0; 00042 00043 _display_information = new DisplayInformation ( ); 00044 } 00045 00046 //////////////////////////////////////////////////////////////////// 00047 // Function: GraphicsPipe::Copy Constructor 00048 // Access: Private 00049 // Description: Don't try to copy GraphicsPipes. 00050 //////////////////////////////////////////////////////////////////// 00051 GraphicsPipe:: 00052 GraphicsPipe(const GraphicsPipe &) { 00053 _is_valid = false; 00054 nassertv(false); 00055 } 00056 00057 //////////////////////////////////////////////////////////////////// 00058 // Function: GraphicsPipe::Copy Assignment Operator 00059 // Access: Private 00060 // Description: Don't try to copy GraphicsPipes. 00061 //////////////////////////////////////////////////////////////////// 00062 void GraphicsPipe:: 00063 operator = (const GraphicsPipe &) { 00064 nassertv(false); 00065 } 00066 00067 //////////////////////////////////////////////////////////////////// 00068 // Function: GraphicsPipe::Destructor 00069 // Access: Published 00070 // Description: 00071 //////////////////////////////////////////////////////////////////// 00072 GraphicsPipe:: 00073 ~GraphicsPipe() { 00074 delete _display_information; 00075 } 00076 00077 //////////////////////////////////////////////////////////////////// 00078 // Function: GraphicsPipe::get_preferred_window_thread 00079 // Access: Public, Virtual 00080 // Description: Returns an indication of the thread in which this 00081 // GraphicsPipe requires its window processing to be 00082 // performed: typically either the app thread (e.g. X) 00083 // or the draw thread (Windows). 00084 //////////////////////////////////////////////////////////////////// 00085 GraphicsPipe::PreferredWindowThread 00086 GraphicsPipe::get_preferred_window_thread() const { 00087 return PWT_draw; 00088 } 00089 00090 //////////////////////////////////////////////////////////////////// 00091 // Function: GraphicsPipe::make_device 00092 // Access: Public, Virtual 00093 // Description: Creates a new device for the pipe. Only DirectX uses 00094 // this device, for other api's it is NULL. 00095 //////////////////////////////////////////////////////////////////// 00096 PT(GraphicsDevice) GraphicsPipe:: 00097 make_device(void *scrn) { 00098 display_cat.error() 00099 << "make_device() unimplemented by " << get_type() << "\n"; 00100 return NULL; 00101 } 00102 00103 //////////////////////////////////////////////////////////////////// 00104 // Function: GraphicsPipe::close_gsg 00105 // Access: Protected, Virtual 00106 // Description: This will be called in the draw thread (the same 00107 // thread in which the GSG was created via make_gsg, 00108 // above) to close the indicated GSG and free its 00109 // associated graphics objects just before it is 00110 // destructed. This method exists to provide a hook for 00111 // the graphics pipe to do any necessary cleanup, if 00112 // any. 00113 //////////////////////////////////////////////////////////////////// 00114 void GraphicsPipe:: 00115 close_gsg(GraphicsStateGuardian *gsg) { 00116 if (gsg != (GraphicsStateGuardian *)NULL) { 00117 gsg->close_gsg(); 00118 } 00119 } 00120 00121 //////////////////////////////////////////////////////////////////// 00122 // Function: GraphicsPipe::make_output 00123 // Access: Protected, Virtual 00124 // Description: Creates a new window on the pipe, if possible. 00125 //////////////////////////////////////////////////////////////////// 00126 PT(GraphicsOutput) GraphicsPipe:: 00127 make_output(const string &name, 00128 const FrameBufferProperties &fb_prop, 00129 const WindowProperties &win_prop, 00130 int flags, 00131 GraphicsEngine *engine, 00132 GraphicsStateGuardian *gsg, 00133 GraphicsOutput *host, 00134 int retry, 00135 bool &precertify) { 00136 display_cat.error() 00137 << get_type() << " cannot create buffers or windows.\n"; 00138 return NULL; 00139 } 00140 00141 //////////////////////////////////////////////////////////////////// 00142 // Function: GraphicsPipe::make_callback_gsg 00143 // Access: Protected, Virtual 00144 // Description: This is called when make_output() is used to create a 00145 // CallbackGraphicsWindow. If the GraphicsPipe can 00146 // construct a GSG that's not associated with any 00147 // particular window object, do so now, assuming the 00148 // correct graphics context has been set up externally. 00149 //////////////////////////////////////////////////////////////////// 00150 PT(GraphicsStateGuardian) GraphicsPipe:: 00151 make_callback_gsg(GraphicsEngine *engine) { 00152 return NULL; 00153 } 00154 00155 //////////////////////////////////////////////////////////////////// 00156 // Function: GraphicsPipe::get_display_information 00157 // Access: Published 00158 // Description: Gets the pipe's DisplayInformation. 00159 //////////////////////////////////////////////////////////////////// 00160 DisplayInformation *GraphicsPipe:: 00161 get_display_information() { 00162 return _display_information; 00163 } 00164 00165 //////////////////////////////////////////////////////////////////// 00166 // Function: GraphicsPipe::lookup_cpu_data 00167 // Access: Public, Virtual 00168 // Description: Looks up the detailed CPU information and stores it 00169 // in _display_information, if supported by the OS. 00170 // This may take a second or two. 00171 //////////////////////////////////////////////////////////////////// 00172 void GraphicsPipe:: 00173 lookup_cpu_data() { 00174 }