mirror of
https://github.com/panda3d/panda3d.git
synced 2025-10-04 02:42:49 -04:00
remove pipe from GraphicsEngine::make_window()
This commit is contained in:
parent
5ede98f8d4
commit
9a2e560d20
@ -380,10 +380,10 @@ class ShowBase(DirectObject.DirectObject):
|
|||||||
# Temporary try .. except for old Pandas.
|
# Temporary try .. except for old Pandas.
|
||||||
try:
|
try:
|
||||||
if type == 'onscreen':
|
if type == 'onscreen':
|
||||||
win = self.graphicsEngine.makeWindow(pipe, gsg, name)
|
win = self.graphicsEngine.makeWindow(gsg, name)
|
||||||
elif type == 'offscreen':
|
elif type == 'offscreen':
|
||||||
win = self.graphicsEngine.makeBuffer(
|
win = self.graphicsEngine.makeBuffer(
|
||||||
pipe, gsg, name, props.getXSize(), props.getYSize(), 0)
|
gsg, name, props.getXSize(), props.getYSize(), 0)
|
||||||
except:
|
except:
|
||||||
if type == 'onscreen':
|
if type == 'onscreen':
|
||||||
win = self.graphicsEngine.makeWindow(pipe, gsg)
|
win = self.graphicsEngine.makeWindow(pipe, gsg)
|
||||||
|
@ -72,11 +72,12 @@ get_auto_flip() const {
|
|||||||
// runs one more time.
|
// runs one more time.
|
||||||
//
|
//
|
||||||
// This flavor of make_gsg() uses the default
|
// This flavor of make_gsg() uses the default
|
||||||
// threading model, specified via set_threading_model().
|
// frame buffer properties, specified via
|
||||||
|
// set_frame_buffer_properties().
|
||||||
////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////
|
||||||
INLINE PT(GraphicsStateGuardian) GraphicsEngine::
|
INLINE PT(GraphicsStateGuardian) GraphicsEngine::
|
||||||
make_gsg(GraphicsPipe *pipe) {
|
make_gsg(GraphicsPipe *pipe) {
|
||||||
return make_gsg(pipe, get_frame_buffer_properties(), get_threading_model());
|
return make_gsg(pipe, get_frame_buffer_properties());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -115,8 +115,8 @@ set_frame_buffer_properties(const FrameBufferProperties &properties) {
|
|||||||
////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////
|
||||||
// Function: GraphicsEngine::get_frame_buffer_properties
|
// Function: GraphicsEngine::get_frame_buffer_properties
|
||||||
// Access: Published
|
// Access: Published
|
||||||
// Description: Returns the current default threading model. See
|
// Description: Returns the frame buffer properties for future gsg's.
|
||||||
// set_frame_buffer_properties().
|
// See set_frame_buffer_properties().
|
||||||
////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////
|
||||||
FrameBufferProperties GraphicsEngine::
|
FrameBufferProperties GraphicsEngine::
|
||||||
get_frame_buffer_properties() const {
|
get_frame_buffer_properties() const {
|
||||||
@ -131,9 +131,9 @@ get_frame_buffer_properties() const {
|
|||||||
////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////
|
||||||
// Function: GraphicsEngine::set_threading_model
|
// Function: GraphicsEngine::set_threading_model
|
||||||
// Access: Published
|
// Access: Published
|
||||||
// Description: Specifies how windows created using future calls to
|
// Description: Specifies how future objects created via make_gsg(),
|
||||||
// the one-parameter version of make_gsg() will be
|
// make_buffer(), and make_window() will be threaded.
|
||||||
// threaded.
|
// This does not affect any already-created objects.
|
||||||
////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////
|
||||||
void GraphicsEngine::
|
void GraphicsEngine::
|
||||||
set_threading_model(const GraphicsThreadingModel &threading_model) {
|
set_threading_model(const GraphicsThreadingModel &threading_model) {
|
||||||
@ -151,8 +151,8 @@ set_threading_model(const GraphicsThreadingModel &threading_model) {
|
|||||||
////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////
|
||||||
// Function: GraphicsEngine::get_threading_model
|
// Function: GraphicsEngine::get_threading_model
|
||||||
// Access: Published
|
// Access: Published
|
||||||
// Description: Returns the current default threading model. See
|
// Description: Returns the threading model that will be applied to
|
||||||
// set_threading_model().
|
// future objects. See set_threading_model().
|
||||||
////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////
|
||||||
GraphicsThreadingModel GraphicsEngine::
|
GraphicsThreadingModel GraphicsEngine::
|
||||||
get_threading_model() const {
|
get_threading_model() const {
|
||||||
@ -181,12 +181,11 @@ get_threading_model() const {
|
|||||||
// runs one more time.
|
// runs one more time.
|
||||||
////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////
|
||||||
PT(GraphicsStateGuardian) GraphicsEngine::
|
PT(GraphicsStateGuardian) GraphicsEngine::
|
||||||
make_gsg(GraphicsPipe *pipe, const FrameBufferProperties &properties,
|
make_gsg(GraphicsPipe *pipe, const FrameBufferProperties &properties) {
|
||||||
const GraphicsThreadingModel &threading_model) {
|
|
||||||
// TODO: ask the draw thread to make the GSG.
|
// TODO: ask the draw thread to make the GSG.
|
||||||
PT(GraphicsStateGuardian) gsg = pipe->make_gsg(properties);
|
PT(GraphicsStateGuardian) gsg = pipe->make_gsg(properties);
|
||||||
if (gsg != (GraphicsStateGuardian *)NULL) {
|
if (gsg != (GraphicsStateGuardian *)NULL) {
|
||||||
gsg->_threading_model = threading_model;
|
gsg->_threading_model = get_threading_model();
|
||||||
gsg->_pipe = pipe;
|
gsg->_pipe = pipe;
|
||||||
gsg->_engine = this;
|
gsg->_engine = this;
|
||||||
}
|
}
|
||||||
@ -204,18 +203,16 @@ make_gsg(GraphicsPipe *pipe, const FrameBufferProperties &properties,
|
|||||||
// later.
|
// later.
|
||||||
////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////
|
||||||
GraphicsWindow *GraphicsEngine::
|
GraphicsWindow *GraphicsEngine::
|
||||||
make_window(GraphicsPipe *pipe, GraphicsStateGuardian *gsg,
|
make_window(GraphicsStateGuardian *gsg, const string &name) {
|
||||||
const string &name) {
|
|
||||||
GraphicsThreadingModel threading_model = get_threading_model();
|
GraphicsThreadingModel threading_model = get_threading_model();
|
||||||
|
|
||||||
nassertr(gsg != (GraphicsStateGuardian *)NULL, NULL);
|
nassertr(gsg != (GraphicsStateGuardian *)NULL, NULL);
|
||||||
nassertr(pipe == gsg->get_pipe(), NULL);
|
|
||||||
nassertr(this == gsg->get_engine(), NULL);
|
nassertr(this == gsg->get_engine(), NULL);
|
||||||
nassertr(threading_model.get_draw_name() ==
|
nassertr(threading_model.get_draw_name() ==
|
||||||
gsg->get_threading_model().get_draw_name(), NULL);
|
gsg->get_threading_model().get_draw_name(), NULL);
|
||||||
|
|
||||||
// TODO: ask the window thread to make the window.
|
// TODO: ask the window thread to make the window.
|
||||||
PT(GraphicsWindow) window = pipe->make_window(gsg, name);
|
PT(GraphicsWindow) window = gsg->get_pipe()->make_window(gsg, name);
|
||||||
do_add_window(window, gsg, threading_model);
|
do_add_window(window, gsg, threading_model);
|
||||||
return window;
|
return window;
|
||||||
}
|
}
|
||||||
@ -228,16 +225,16 @@ make_window(GraphicsPipe *pipe, GraphicsStateGuardian *gsg,
|
|||||||
// GraphicsEngine becomes the owner of the buffer; it
|
// GraphicsEngine becomes the owner of the buffer; it
|
||||||
// will persist at least until remove_window() is called
|
// will persist at least until remove_window() is called
|
||||||
// later.
|
// later.
|
||||||
|
//
|
||||||
// This usually returns a GraphicsBuffer object, but it
|
// This usually returns a GraphicsBuffer object, but it
|
||||||
// may actually return a GraphicsWindow if show-buffers
|
// may actually return a GraphicsWindow if show-buffers
|
||||||
// is configured true.
|
// is configured true.
|
||||||
////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////
|
||||||
GraphicsOutput *GraphicsEngine::
|
GraphicsOutput *GraphicsEngine::
|
||||||
make_buffer(GraphicsPipe *pipe, GraphicsStateGuardian *gsg,
|
make_buffer(GraphicsStateGuardian *gsg, const string &name,
|
||||||
const string &name, int x_size, int y_size, bool want_texture) {
|
int x_size, int y_size, bool want_texture) {
|
||||||
if (show_buffers) {
|
if (show_buffers) {
|
||||||
GraphicsWindow *window = make_window(pipe, gsg, name);
|
GraphicsWindow *window = make_window(gsg, name);
|
||||||
if (window != (GraphicsWindow *)NULL) {
|
if (window != (GraphicsWindow *)NULL) {
|
||||||
WindowProperties props;
|
WindowProperties props;
|
||||||
props.set_size(x_size, y_size);
|
props.set_size(x_size, y_size);
|
||||||
@ -257,14 +254,13 @@ make_buffer(GraphicsPipe *pipe, GraphicsStateGuardian *gsg,
|
|||||||
|
|
||||||
GraphicsThreadingModel threading_model = get_threading_model();
|
GraphicsThreadingModel threading_model = get_threading_model();
|
||||||
nassertr(gsg != (GraphicsStateGuardian *)NULL, NULL);
|
nassertr(gsg != (GraphicsStateGuardian *)NULL, NULL);
|
||||||
nassertr(pipe == gsg->get_pipe(), NULL);
|
|
||||||
nassertr(this == gsg->get_engine(), NULL);
|
nassertr(this == gsg->get_engine(), NULL);
|
||||||
nassertr(threading_model.get_draw_name() ==
|
nassertr(threading_model.get_draw_name() ==
|
||||||
gsg->get_threading_model().get_draw_name(), NULL);
|
gsg->get_threading_model().get_draw_name(), NULL);
|
||||||
|
|
||||||
// TODO: ask the window thread to make the buffer.
|
// TODO: ask the window thread to make the buffer.
|
||||||
PT(GraphicsBuffer) buffer =
|
PT(GraphicsBuffer) buffer =
|
||||||
pipe->make_buffer(gsg, name, x_size, y_size, want_texture);
|
gsg->get_pipe()->make_buffer(gsg, name, x_size, y_size, want_texture);
|
||||||
do_add_window(buffer, gsg, threading_model);
|
do_add_window(buffer, gsg, threading_model);
|
||||||
return buffer;
|
return buffer;
|
||||||
}
|
}
|
||||||
|
@ -69,13 +69,10 @@ PUBLISHED:
|
|||||||
|
|
||||||
INLINE PT(GraphicsStateGuardian) make_gsg(GraphicsPipe *pipe);
|
INLINE PT(GraphicsStateGuardian) make_gsg(GraphicsPipe *pipe);
|
||||||
PT(GraphicsStateGuardian) make_gsg(GraphicsPipe *pipe,
|
PT(GraphicsStateGuardian) make_gsg(GraphicsPipe *pipe,
|
||||||
const FrameBufferProperties &properties,
|
const FrameBufferProperties &properties);
|
||||||
const GraphicsThreadingModel &threading_model);
|
|
||||||
|
|
||||||
GraphicsWindow *make_window(GraphicsPipe *pipe, GraphicsStateGuardian *gsg,
|
GraphicsWindow *make_window(GraphicsStateGuardian *gsg, const string &name);
|
||||||
const string &name);
|
GraphicsOutput *make_buffer(GraphicsStateGuardian *gsg, const string &name,
|
||||||
GraphicsOutput *make_buffer(GraphicsPipe *pipe, GraphicsStateGuardian *gsg,
|
|
||||||
const string &name,
|
|
||||||
int x_size, int y_size, bool want_texture);
|
int x_size, int y_size, bool want_texture);
|
||||||
|
|
||||||
bool remove_window(GraphicsOutput *window);
|
bool remove_window(GraphicsOutput *window);
|
||||||
|
@ -117,7 +117,7 @@ open_window(const WindowProperties &props, GraphicsEngine *engine,
|
|||||||
next_window_index++;
|
next_window_index++;
|
||||||
string name = stream.str();
|
string name = stream.str();
|
||||||
|
|
||||||
_window = engine->make_window(pipe, ptgsg, name);
|
_window = engine->make_window(ptgsg, name);
|
||||||
if (_window != (GraphicsWindow *)NULL) {
|
if (_window != (GraphicsWindow *)NULL) {
|
||||||
_window->request_properties(props);
|
_window->request_properties(props);
|
||||||
set_background_type(_background_type);
|
set_background_type(_background_type);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user