mirror of
https://github.com/panda3d/panda3d.git
synced 2025-10-03 10:22:45 -04:00
build correctly with drose's new window code
This commit is contained in:
parent
48eef75e74
commit
875e6a4f76
@ -178,8 +178,12 @@ class ShowBase:
|
|||||||
is closed cleanly, so that we free system resources, restore
|
is closed cleanly, so that we free system resources, restore
|
||||||
the desktop and keyboard functionality, etc.
|
the desktop and keyboard functionality, etc.
|
||||||
"""
|
"""
|
||||||
|
try:
|
||||||
|
# Temporary try .. except for new window code
|
||||||
for win in self.winList:
|
for win in self.winList:
|
||||||
win.closeWindow()
|
win.closeWindow()
|
||||||
|
except:
|
||||||
|
pass
|
||||||
del self.win
|
del self.win
|
||||||
del self.winList
|
del self.winList
|
||||||
del self.pipe
|
del self.pipe
|
||||||
@ -204,14 +208,18 @@ class ShowBase:
|
|||||||
self.pipe = makeGraphicsPipe()
|
self.pipe = makeGraphicsPipe()
|
||||||
self.pipeList.append(self.pipe)
|
self.pipeList.append(self.pipe)
|
||||||
|
|
||||||
chanConfig = makeGraphicsWindow(self.pipe, self.render)
|
chanConfig = makeGraphicsWindow(self.graphicsEngine, self.pipe, self.render)
|
||||||
win = chanConfig.getWin()
|
win = chanConfig.getWin()
|
||||||
|
|
||||||
if self.win == None:
|
if self.win == None:
|
||||||
self.win = win
|
self.win = win
|
||||||
|
|
||||||
self.winList.append(win)
|
self.winList.append(win)
|
||||||
|
try:
|
||||||
|
# temporary try..except to support new window code
|
||||||
self.graphicsEngine.addWindow(win)
|
self.graphicsEngine.addWindow(win)
|
||||||
|
except:
|
||||||
|
pass
|
||||||
|
|
||||||
self.getCameras(chanConfig)
|
self.getCameras(chanConfig)
|
||||||
|
|
||||||
|
@ -19,13 +19,24 @@
|
|||||||
#include "showBase.h"
|
#include "showBase.h"
|
||||||
|
|
||||||
#include "throw_event.h"
|
#include "throw_event.h"
|
||||||
#include "interactiveGraphicsPipe.h"
|
|
||||||
#include "graphicsWindow.h"
|
#include "graphicsWindow.h"
|
||||||
#include "chancfg.h"
|
#include "chancfg.h"
|
||||||
#include "renderBuffer.h"
|
#include "renderBuffer.h"
|
||||||
#include "get_config_path.h"
|
#include "get_config_path.h"
|
||||||
#include "camera.h"
|
#include "camera.h"
|
||||||
|
|
||||||
|
// Don't define this unless you have drose's new GraphicsWindow code,
|
||||||
|
// which is currently a work in progress. You probably won't have it
|
||||||
|
// unless you are drose.
|
||||||
|
//#define NEW_WINDOW_CODE
|
||||||
|
|
||||||
|
#ifdef NEW_WINDOW_CODE
|
||||||
|
#include "graphicsPipeSelection.h"
|
||||||
|
#else
|
||||||
|
#include "interactiveGraphicsPipe.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
ConfigureDef(config_showbase);
|
ConfigureDef(config_showbase);
|
||||||
ConfigureFn(config_showbase) {
|
ConfigureFn(config_showbase) {
|
||||||
}
|
}
|
||||||
@ -45,6 +56,20 @@ PT(GraphicsPipe)
|
|||||||
make_graphics_pipe() {
|
make_graphics_pipe() {
|
||||||
PT(GraphicsPipe) main_pipe;
|
PT(GraphicsPipe) main_pipe;
|
||||||
|
|
||||||
|
#ifdef NEW_WINDOW_CODE
|
||||||
|
GraphicsPipeSelection *selection = GraphicsPipeSelection::get_global_ptr();
|
||||||
|
selection->resolve_modules();
|
||||||
|
|
||||||
|
nout << "Known pipe types:" << endl;
|
||||||
|
int num_pipe_types = selection->get_num_pipe_types();
|
||||||
|
for (int i = 0; i < num_pipe_types; i++) {
|
||||||
|
nout << " " << selection->get_pipe_type(i) << "\n";
|
||||||
|
}
|
||||||
|
|
||||||
|
main_pipe = selection->make_default_pipe();
|
||||||
|
|
||||||
|
#else // NEW_WINDOW_CODE
|
||||||
|
|
||||||
// load display modules
|
// load display modules
|
||||||
GraphicsPipe::resolve_modules();
|
GraphicsPipe::resolve_modules();
|
||||||
|
|
||||||
@ -55,6 +80,8 @@ make_graphics_pipe() {
|
|||||||
main_pipe = GraphicsPipe::get_factory().
|
main_pipe = GraphicsPipe::get_factory().
|
||||||
make_instance(InteractiveGraphicsPipe::get_class_type());
|
make_instance(InteractiveGraphicsPipe::get_class_type());
|
||||||
|
|
||||||
|
#endif // NEW_WINDOW_CODE
|
||||||
|
|
||||||
if (main_pipe == (GraphicsPipe*)0L) {
|
if (main_pipe == (GraphicsPipe*)0L) {
|
||||||
nout << "No interactive pipe is available! Check your Configrc!\n";
|
nout << "No interactive pipe is available! Check your Configrc!\n";
|
||||||
return NULL;
|
return NULL;
|
||||||
@ -62,23 +89,34 @@ make_graphics_pipe() {
|
|||||||
|
|
||||||
nout << "Opened a '" << main_pipe->get_type().get_name()
|
nout << "Opened a '" << main_pipe->get_type().get_name()
|
||||||
<< "' interactive graphics pipe." << endl;
|
<< "' interactive graphics pipe." << endl;
|
||||||
|
|
||||||
return main_pipe;
|
return main_pipe;
|
||||||
}
|
}
|
||||||
|
|
||||||
ChanConfig
|
ChanConfig
|
||||||
make_graphics_window(GraphicsPipe *pipe, const NodePath &render) {
|
make_graphics_window(GraphicsEngine *engine, GraphicsPipe *pipe,
|
||||||
|
const NodePath &render) {
|
||||||
PT(GraphicsWindow) main_win;
|
PT(GraphicsWindow) main_win;
|
||||||
ChanCfgOverrides override;
|
ChanCfgOverrides override;
|
||||||
|
|
||||||
|
std::string conf = config_showbase.GetString("chan-config", chan_config);
|
||||||
|
|
||||||
// Now use ChanConfig to create the window.
|
// Now use ChanConfig to create the window.
|
||||||
|
#ifdef NEW_WINDOW_CODE
|
||||||
|
ChanConfig chan_config(engine, pipe, conf, render, override);
|
||||||
|
|
||||||
|
#else // NEW_WINDOW_CODE
|
||||||
|
|
||||||
override.setField(ChanCfgOverrides::Mask,
|
override.setField(ChanCfgOverrides::Mask,
|
||||||
((unsigned int)(W_DOUBLE|W_DEPTH)));
|
((unsigned int)(W_DOUBLE|W_DEPTH)));
|
||||||
|
|
||||||
std::string title = config_showbase.GetString("window-title", window_title);
|
std::string title = config_showbase.GetString("window-title", window_title);
|
||||||
override.setField(ChanCfgOverrides::Title, title);
|
override.setField(ChanCfgOverrides::Title, title);
|
||||||
|
|
||||||
std::string conf = config_showbase.GetString("chan-config", chan_config);
|
|
||||||
ChanConfig chan_config(pipe, conf, render, override);
|
ChanConfig chan_config(pipe, conf, render, override);
|
||||||
|
#endif // NEW_WINDOW_CODE
|
||||||
|
|
||||||
|
|
||||||
main_win = chan_config.get_win();
|
main_win = chan_config.get_win();
|
||||||
assert(main_win != (GraphicsWindow*)0L);
|
assert(main_win != (GraphicsWindow*)0L);
|
||||||
|
|
||||||
@ -138,7 +176,9 @@ void add_fullscreen_testsize(unsigned int xsize,unsigned int ysize) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void runtest_fullscreen_sizes(GraphicsWindow *win) {
|
void runtest_fullscreen_sizes(GraphicsWindow *win) {
|
||||||
|
#ifndef NEW_WINDOW_CODE
|
||||||
(void) win->verify_window_sizes(num_fullscreen_testsizes,fullscreen_testsizes);
|
(void) win->verify_window_sizes(num_fullscreen_testsizes,fullscreen_testsizes);
|
||||||
|
#endif // NEW_WINDOW_CODE
|
||||||
}
|
}
|
||||||
|
|
||||||
bool query_fullscreen_testresult(unsigned int xsize,unsigned int ysize) {
|
bool query_fullscreen_testresult(unsigned int xsize,unsigned int ysize) {
|
||||||
|
@ -36,6 +36,7 @@ typedef Config::Config<ConfigureGetConfig_config_showbase> ConfigShowbase;
|
|||||||
|
|
||||||
class CollisionTraverser;
|
class CollisionTraverser;
|
||||||
class Camera;
|
class Camera;
|
||||||
|
class GraphicsEngine;
|
||||||
|
|
||||||
BEGIN_PUBLISH
|
BEGIN_PUBLISH
|
||||||
|
|
||||||
@ -43,7 +44,8 @@ EXPCL_DIRECT DSearchPath &get_particle_path();
|
|||||||
|
|
||||||
EXPCL_DIRECT PT(GraphicsPipe) make_graphics_pipe();
|
EXPCL_DIRECT PT(GraphicsPipe) make_graphics_pipe();
|
||||||
EXPCL_DIRECT ChanConfig
|
EXPCL_DIRECT ChanConfig
|
||||||
make_graphics_window(GraphicsPipe *pipe, const NodePath &render);
|
make_graphics_window(GraphicsEngine *engine, GraphicsPipe *pipe,
|
||||||
|
const NodePath &render);
|
||||||
|
|
||||||
EXPCL_DIRECT void throw_new_frame();
|
EXPCL_DIRECT void throw_new_frame();
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user