mirror of
https://github.com/panda3d/panda3d.git
synced 2025-10-03 02:15:43 -04:00
Changes to support a custom GraphicsWindow derivation
This commit is contained in:
parent
9b747b525e
commit
94e5bbf579
@ -476,6 +476,42 @@ make_output(GraphicsPipe *pipe,
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////////////
|
||||||
|
// Function: GraphicsEngine::add_window
|
||||||
|
// Access: Published
|
||||||
|
// Description: This can be used to add a newly-created
|
||||||
|
// GraphicsOutput object (and its GSG) to the engine's
|
||||||
|
// list of windows, and requests that it be opened.
|
||||||
|
// This shouldn't be called by user code as
|
||||||
|
// make_output normally does this under the hood; it
|
||||||
|
// may be useful in esoteric cases in which a custom
|
||||||
|
// window object is used.
|
||||||
|
////////////////////////////////////////////////////////////////////
|
||||||
|
bool GraphicsEngine::
|
||||||
|
add_window(GraphicsOutput *window, int sort) {
|
||||||
|
nassertr(window != NULL, false);
|
||||||
|
|
||||||
|
GraphicsThreadingModel threading_model = get_threading_model();
|
||||||
|
nassertr(this == window->get_engine(), false);
|
||||||
|
|
||||||
|
window->_sort = sort;
|
||||||
|
do_add_window(window, threading_model);
|
||||||
|
|
||||||
|
open_windows();
|
||||||
|
if (window->is_valid()) {
|
||||||
|
do_add_gsg(window->get_gsg(), window->get_pipe(), threading_model);
|
||||||
|
|
||||||
|
display_cat.info()
|
||||||
|
<< "Added output of type " << window->get_type() << "\n";
|
||||||
|
|
||||||
|
return true;
|
||||||
|
|
||||||
|
} else {
|
||||||
|
remove_window(window);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////
|
||||||
// Function: GraphicsEngine::remove_window
|
// Function: GraphicsEngine::remove_window
|
||||||
// Access: Published
|
// Access: Published
|
||||||
@ -2107,6 +2143,8 @@ do_add_window(GraphicsOutput *window,
|
|||||||
void GraphicsEngine::
|
void GraphicsEngine::
|
||||||
do_add_gsg(GraphicsStateGuardian *gsg, GraphicsPipe *pipe,
|
do_add_gsg(GraphicsStateGuardian *gsg, GraphicsPipe *pipe,
|
||||||
const GraphicsThreadingModel &threading_model) {
|
const GraphicsThreadingModel &threading_model) {
|
||||||
|
nassertv(gsg != NULL);
|
||||||
|
|
||||||
ReMutexHolder holder(_lock);
|
ReMutexHolder holder(_lock);
|
||||||
nassertv(gsg->get_pipe() == pipe && gsg->get_engine() == this);
|
nassertv(gsg->get_pipe() == pipe && gsg->get_engine() == this);
|
||||||
gsg->_threading_model = threading_model;
|
gsg->_threading_model = threading_model;
|
||||||
|
@ -92,6 +92,7 @@ PUBLISHED:
|
|||||||
const string &name, int sort,
|
const string &name, int sort,
|
||||||
int x_size, int y_size);
|
int x_size, int y_size);
|
||||||
|
|
||||||
|
bool add_window(GraphicsOutput *window, int sort);
|
||||||
bool remove_window(GraphicsOutput *window);
|
bool remove_window(GraphicsOutput *window);
|
||||||
void remove_all_windows();
|
void remove_all_windows();
|
||||||
void reset_all_windows(bool swapchain);
|
void reset_all_windows(bool swapchain);
|
||||||
|
@ -87,6 +87,20 @@ GraphicsPipe::get_preferred_window_thread() const {
|
|||||||
return PWT_draw;
|
return PWT_draw;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////////////
|
||||||
|
// Function: GraphicsPipe::make_callback_gsg
|
||||||
|
// Access: Public, Virtual
|
||||||
|
// Description: This is called when make_output() is used to create a
|
||||||
|
// CallbackGraphicsWindow. If the GraphicsPipe can
|
||||||
|
// construct a GSG that's not associated with any
|
||||||
|
// particular window object, do so now, assuming the
|
||||||
|
// correct graphics context has been set up externally.
|
||||||
|
////////////////////////////////////////////////////////////////////
|
||||||
|
PT(GraphicsStateGuardian) GraphicsPipe::
|
||||||
|
make_callback_gsg(GraphicsEngine *engine) {
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////
|
||||||
// Function: GraphicsPipe::make_device
|
// Function: GraphicsPipe::make_device
|
||||||
// Access: Public, Virtual
|
// Access: Public, Virtual
|
||||||
@ -138,20 +152,6 @@ make_output(const string &name,
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////
|
|
||||||
// Function: GraphicsPipe::make_callback_gsg
|
|
||||||
// Access: Protected, Virtual
|
|
||||||
// Description: This is called when make_output() is used to create a
|
|
||||||
// CallbackGraphicsWindow. If the GraphicsPipe can
|
|
||||||
// construct a GSG that's not associated with any
|
|
||||||
// particular window object, do so now, assuming the
|
|
||||||
// correct graphics context has been set up externally.
|
|
||||||
////////////////////////////////////////////////////////////////////
|
|
||||||
PT(GraphicsStateGuardian) GraphicsPipe::
|
|
||||||
make_callback_gsg(GraphicsEngine *engine) {
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////
|
||||||
// Function: GraphicsPipe::get_display_information
|
// Function: GraphicsPipe::get_display_information
|
||||||
// Access: Published
|
// Access: Published
|
||||||
|
@ -114,6 +114,8 @@ public:
|
|||||||
INLINE GraphicsDevice *get_device() const;
|
INLINE GraphicsDevice *get_device() const;
|
||||||
virtual PT(GraphicsDevice) make_device(void *scrn = NULL);
|
virtual PT(GraphicsDevice) make_device(void *scrn = NULL);
|
||||||
|
|
||||||
|
virtual PT(GraphicsStateGuardian) make_callback_gsg(GraphicsEngine *engine);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual void close_gsg(GraphicsStateGuardian *gsg);
|
virtual void close_gsg(GraphicsStateGuardian *gsg);
|
||||||
|
|
||||||
@ -126,7 +128,6 @@ protected:
|
|||||||
GraphicsOutput *host,
|
GraphicsOutput *host,
|
||||||
int retry,
|
int retry,
|
||||||
bool &precertify);
|
bool &precertify);
|
||||||
virtual PT(GraphicsStateGuardian) make_callback_gsg(GraphicsEngine *engine);
|
|
||||||
|
|
||||||
LightMutex _lock;
|
LightMutex _lock;
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user