From 15d7d45b8b5112ff7adf1fc1369bf336626d4702 Mon Sep 17 00:00:00 2001 From: David Rose Date: Thu, 12 Feb 2004 16:20:05 +0000 Subject: [PATCH] remove chancfg --- panda/metalibs/panda/Sources.pp | 2 +- panda/src/chancfg/Sources.pp | 42 -- panda/src/chancfg/chancfg.I | 37 -- panda/src/chancfg/chancfg.N | 2 - panda/src/chancfg/chancfg.cxx | 625 ----------------------- panda/src/chancfg/chancfg.h | 132 ----- panda/src/chancfg/chancfg_composite1.cxx | 4 - panda/src/chancfg/chancfg_composite2.cxx | 6 - panda/src/chancfg/chancfg_headers.h | 29 -- panda/src/chancfg/chanlayout.I | 45 -- panda/src/chancfg/chanlayout.cxx | 125 ----- panda/src/chancfg/chanlayout.h | 58 --- panda/src/chancfg/chanparse.I | 111 ---- panda/src/chancfg/chanparse.cxx | 155 ------ panda/src/chancfg/chanparse.h | 48 -- panda/src/chancfg/chansetup.I | 130 ----- panda/src/chancfg/chansetup.cxx | 179 ------- panda/src/chancfg/chansetup.h | 94 ---- panda/src/chancfg/chanshare.h | 26 - panda/src/chancfg/chanviewport.I | 52 -- panda/src/chancfg/chanviewport.h | 44 -- panda/src/chancfg/chanwindow.I | 104 ---- panda/src/chancfg/chanwindow.cxx | 161 ------ panda/src/chancfg/chanwindow.h | 69 --- panda/src/chancfg/layout_db | 260 ---------- panda/src/chancfg/setup_db | 73 --- panda/src/chancfg/test_chancfg.cxx | 23 - panda/src/chancfg/window_db | 74 --- panda/src/framework/Sources.pp | 2 +- panda/src/testbed/Sources.pp | 2 +- 30 files changed, 3 insertions(+), 2711 deletions(-) delete mode 100644 panda/src/chancfg/Sources.pp delete mode 100644 panda/src/chancfg/chancfg.I delete mode 100644 panda/src/chancfg/chancfg.N delete mode 100644 panda/src/chancfg/chancfg.cxx delete mode 100644 panda/src/chancfg/chancfg.h delete mode 100644 panda/src/chancfg/chancfg_composite1.cxx delete mode 100644 panda/src/chancfg/chancfg_composite2.cxx delete mode 100644 panda/src/chancfg/chancfg_headers.h delete mode 100644 panda/src/chancfg/chanlayout.I delete mode 100644 panda/src/chancfg/chanlayout.cxx delete mode 100644 panda/src/chancfg/chanlayout.h delete mode 100644 panda/src/chancfg/chanparse.I delete mode 100644 panda/src/chancfg/chanparse.cxx delete mode 100644 panda/src/chancfg/chanparse.h delete mode 100644 panda/src/chancfg/chansetup.I delete mode 100644 panda/src/chancfg/chansetup.cxx delete mode 100644 panda/src/chancfg/chansetup.h delete mode 100644 panda/src/chancfg/chanshare.h delete mode 100644 panda/src/chancfg/chanviewport.I delete mode 100644 panda/src/chancfg/chanviewport.h delete mode 100644 panda/src/chancfg/chanwindow.I delete mode 100644 panda/src/chancfg/chanwindow.cxx delete mode 100644 panda/src/chancfg/chanwindow.h delete mode 100644 panda/src/chancfg/layout_db delete mode 100644 panda/src/chancfg/setup_db delete mode 100644 panda/src/chancfg/test_chancfg.cxx delete mode 100644 panda/src/chancfg/window_db diff --git a/panda/metalibs/panda/Sources.pp b/panda/metalibs/panda/Sources.pp index ff06704671..724d8ef504 100644 --- a/panda/metalibs/panda/Sources.pp +++ b/panda/metalibs/panda/Sources.pp @@ -11,7 +11,7 @@ #define COMPONENT_LIBS \ recorder pgraph \ - pvrpn grutil chan chancfg pstatclient \ + pvrpn grutil chan pstatclient \ char chat collide cull device \ dgraph display event gobj graph gsgbase \ gsgmisc light linmath mathutil net \ diff --git a/panda/src/chancfg/Sources.pp b/panda/src/chancfg/Sources.pp deleted file mode 100644 index ce5a38eb8b..0000000000 --- a/panda/src/chancfg/Sources.pp +++ /dev/null @@ -1,42 +0,0 @@ -#define OTHER_LIBS interrogatedb:c dconfig:c dtoolconfig:m \ - dtoolutil:c dtoolbase:c dtool:m - -#begin lib_target - #define TARGET chancfg - #define LOCAL_LIBS \ - putil display linmath gobj display gsgbase \ - mathutil - - #define COMBINED_SOURCES $[TARGET]_composite1.cxx $[TARGET]_composite2.cxx - - #define SOURCES \ - chancfg.I chancfg.N chancfg.h chanlayout.I \ - chanlayout.h chanparse.I chanparse.h \ - chansetup.I chansetup.h chanwindow.I chanwindow.h - - #define INCLUDED_SOURCES \ - chancfg.cxx chanlayout.cxx chanparse.cxx \ - chansetup.cxx chanwindow.cxx - - #define INSTALL_HEADERS \ - chancfg.I chancfg.h chanlayout.I chanlayout.h chansetup.I \ - chansetup.h chanshare.h chanviewport.I chanviewport.h chanwindow.I \ - chanwindow.h - - #define INSTALL_CONFIG \ - layout_db setup_db window_db - - #define IGATESCAN chancfg.h - -#end lib_target - -#begin test_bin_target - #define TARGET test_chancfg - #define LOCAL_LIBS \ - chancfg putil - - #define SOURCES \ - test_chancfg.cxx - -#end test_bin_target - diff --git a/panda/src/chancfg/chancfg.I b/panda/src/chancfg/chancfg.I deleted file mode 100644 index cb698c288a..0000000000 --- a/panda/src/chancfg/chancfg.I +++ /dev/null @@ -1,37 +0,0 @@ -// Filename: chancfg.I -// Created by: cary (07Feb99) -// -//////////////////////////////////////////////////////////////////// -// -// PANDA 3D SOFTWARE -// Copyright (c) 2001, Disney Enterprises, Inc. All rights reserved -// -// All use of this software is subject to the terms of the Panda 3d -// Software license. You should have received a copy of this license -// along with this source code; you will also find a current copy of -// the license at http://www.panda3d.org/license.txt . -// -// To contact the maintainers of this program write to -// panda3d@yahoogroups.com . -// -//////////////////////////////////////////////////////////////////// - - INLINE PandaNode *ChanConfig::get_group_node(const int node_index) const { - return _group_node[node_index]; - } - INLINE int ChanConfig::get_group_membership(const int dr_index) const { - return _group_membership[dr_index]; - } - INLINE int ChanConfig::get_num_groups(void) const { - return _group_node.size(); - } - INLINE int ChanConfig::get_num_drs(void) const { - return _display_region.size(); - } - INLINE PT(DisplayRegion) ChanConfig::get_dr(const int dr_index) const { - return _display_region[dr_index]; - } - INLINE PT(GraphicsWindow) ChanConfig::get_win(void) const { - return _graphics_window; - } - diff --git a/panda/src/chancfg/chancfg.N b/panda/src/chancfg/chancfg.N deleted file mode 100644 index 45e7d927aa..0000000000 --- a/panda/src/chancfg/chancfg.N +++ /dev/null @@ -1,2 +0,0 @@ -ignorefile chanlayout.h chanlayout.I chansetup.h chansetup.I -ignorefile chanwindow.h chanwindow.I diff --git a/panda/src/chancfg/chancfg.cxx b/panda/src/chancfg/chancfg.cxx deleted file mode 100644 index dc3b2c505b..0000000000 --- a/panda/src/chancfg/chancfg.cxx +++ /dev/null @@ -1,625 +0,0 @@ -// Filename: chancfg.cxx -// Created by: cary (02Feb99) -// -//////////////////////////////////////////////////////////////////// -// -// PANDA 3D SOFTWARE -// Copyright (c) 2001, Disney Enterprises, Inc. All rights reserved -// -// All use of this software is subject to the terms of the Panda 3d -// Software license. You should have received a copy of this license -// along with this source code; you will also find a current copy of -// the license at http://www.panda3d.org/license.txt . -// -// To contact the maintainers of this program write to -// panda3d@yahoogroups.com . -// -//////////////////////////////////////////////////////////////////// - -#include "chancfg.h" -#include "notify.h" -#include "displayRegion.h" -#include "graphicsPipe.h" -#include "graphicsEngine.h" -#include "graphicsChannel.h" -#include "hardwareChannel.h" -#include "camera.h" -#include "frustum.h" -#include "perspectiveLens.h" -#include "dSearchPath.h" -#include "dconfig.h" -#include "filename.h" -#include "transformState.h" -#include "dcast.h" -#include "config_express.h" -#include "virtualFileSystem.h" - -#include -#include // for sprintf - - -Configure(chanconfig); - -ConfigureFn(chanconfig) { -} - -static bool have_read = false; -NotifyCategoryDef(chancfg, ""); - -static bool -load_chancfg_database(const string &filename, const DSearchPath &path, - const string &type_desc, void (*parser_func)(istream &)) { - Filename fname = Filename::text_filename(filename); - - if (use_vfs) { - VirtualFileSystem *vfs = VirtualFileSystem::get_global_ptr(); - - if (!vfs->resolve_filename(fname, path)) { - chancfg_cat.error() - << "Could not find " << type_desc << " database " << filename - << " in path " << path << "\n"; - return false; - - } else { - istream *ifs; - ifs = vfs->open_read_file(fname); - if (ifs == (istream *)NULL) { - chancfg_cat.error() - << "Unable to read " << type_desc << " database " - << filename << "\n"; - return false; - } - if (chancfg_cat.is_debug()) { - chancfg_cat.debug() - << "Reading " << type_desc << " database " << filename - << "\n"; - } - parser_func(*ifs); - delete ifs; - } - - } else { - - if (!fname.resolve_filename(path)) { - chancfg_cat.error() - << "Could not find " << type_desc << " database " << filename - << " in path " << path << "\n"; - return false; - - } else { - ifstream ifs; - if (!fname.open_read(ifs)) { - chancfg_cat.error() - << "Unable to read " << type_desc << " database " - << filename << "\n"; - return false; - } - if (chancfg_cat.is_debug()) { - chancfg_cat.debug() - << "Reading " << type_desc << " database " << filename - << "\n"; - } - parser_func(ifs); - } - } - - return true; -} - -static void ReadChanConfigData(void) { - if (have_read) - return; - - ResetLayout(); - ResetSetup(); - ResetWindow(); - - // We have to convert from a space-separated list of paths, which - // might be in os-specific form, to a DSearchPath of Panda-form - // directories. We can't just use Filename::from_os_specific() on - // the whole string, since that would only work if there were just - // one directory on the path; instead, we have to convert the - // directories of the path one at a time. - DSearchPath orig_path(chanconfig.GetString("ETC_PATH", "."), " \n\t"); - DSearchPath path; - for (int i = 0; i < orig_path.get_num_directories(); i++) { - path.append_directory(Filename::from_os_specific(orig_path.get_directory(i))); - } - - string layoutdbfilename = chanconfig.GetString("layout-db-file","layout_db"); - string windowdbfilename = chanconfig.GetString("window-db-file","window_db"); - string setupdbfilename = chanconfig.GetString("setup-db-file","setup_db"); - - load_chancfg_database(layoutdbfilename, path, "layout", ParseLayout); - load_chancfg_database(setupdbfilename, path, "setup", ParseSetup); - load_chancfg_database(windowdbfilename, path, "window", ParseWindow); -} - -static const bool config_sanity_check = - chanconfig.GetBool("chan-config-sanity-check", false); - -ChanCfgOverrides ChanOverrideNone; - -INLINE bool LayoutDefined(std::string sym) { - return (LayoutDB != (LayoutType *)NULL) && - (LayoutDB->find(sym) != LayoutDB->end()); -} - -INLINE bool SetupDefined(std::string sym) { - return (SetupDB != (SetupType *)NULL) && - (SetupDB->find(sym) != SetupDB->end()); -} - -INLINE bool ConfigDefined(std::string sym) { - return (WindowDB != (WindowType *)NULL) && - (WindowDB->find(sym) != WindowDB->end()); -} - -bool ChanCheckLayouts(SetupSyms& S) { - if (S.empty()) - return false; - for (SetupSyms::iterator i=S.begin(); i!=S.end(); ++i) - if (!LayoutDefined(*i)) { - chancfg_cat.error() << "no layout called '" << *i << "'" << endl; - return false; - } - return true; -} - -bool ChanCheckSetups(SetupSyms& S) { - if (S.empty()) - return false; - for (SetupSyms::iterator i=S.begin(); i!=S.end(); ++i) { - if (!SetupDefined(*i)) { - chancfg_cat.error() << "no setup called '" << *i << "'" << endl; - return false; - } - } - return true; -} - -INLINE ChanViewport ChanScaleViewport(const ChanViewport& parent, - const ChanViewport& child) { - float dx = (parent.right() - parent.left()); - float dy = (parent.top() - parent.bottom()); - ChanViewport v(parent.left() + (dx * child.left()), - parent.left() + (dx * child.right()), - parent.bottom() + (dy * child.bottom()), - parent.bottom() + (dy * child.top())); - return v; -} - -/* -int ChanFindNextHWChan(int offset, const HardwareChannel::HWChanMap& hw_chans) { - int i = offset; - while (hw_chans.find(i) != hw_chans.end()) - ++i; - return i; -} -*/ - -SetupFOV ChanResolveFOV(SetupFOV& fov, float sizeX, float sizeY) { - float horiz = 45.0f; - float vert; - SetupFOV ret; - switch (fov.getType()) { - case SetupFOV::Horizontal: - horiz = fov.getHoriz(); - if (chancfg_cat.is_debug()) - chancfg_cat->debug() << "ChanResolveFOV:: setting default horiz = " - << horiz << endl; - case SetupFOV::Default: - horiz = chanconfig.GetFloat("fov", horiz); - vert = 2.0f*rad_2_deg(atan((sizeY/sizeX)*tan(0.5f*deg_2_rad(horiz)))); - if (chancfg_cat.is_debug()) - chancfg_cat->debug() << "ChanResolveFOV:: setting horiz = " << horiz - << " and vert = " << vert << endl; - break; - case SetupFOV::Both: - horiz = fov.getHoriz(); - vert = fov.getVert(); - if (chancfg_cat.is_debug()) - chancfg_cat->debug() << "ChanResolveFOV:: setting horiz = " << horiz - << " and vert = " << vert << endl; - break; - - default: - break; - } - - ret.setFOV(horiz, vert); - return ret; -} - -void ChanConfig::chan_eval(GraphicsWindow* win, WindowItem& W, LayoutItem& L, - SVec& S, - ChanViewport& V, int hw_offset, int xsize, int ysize, - const NodePath &render, bool want_cameras) { - int i = min(L.GetNumRegions(), int(S.size())); - int j; - SVec::iterator k; - std::vector< PT(PandaNode) >camera(W.getNumCameraGroups()); - //first camera is special cased to name "camera" for older code - camera[0] = new PandaNode("camera"); - for(int icam=1;icamget_channel(hw_offset); - } else - chan = win->get_channel((*k).getChan()); - // HW channels always start with the full area of the channel - v = ChanViewport(0.0f, 1.0f, 0.0f, 1.0f); - } else { - chan = win->get_channel(0); - } - ChanViewport v2(ChanScaleViewport(v, (*k).getViewport())); - PT(GraphicsLayer) layer = chan->make_layer(); - PT(DisplayRegion) dr = - layer->make_display_region(v2.left(), v2.right(), - v2.bottom(), v2.top()); - if (want_cameras && camera[0] != (PandaNode *)NULL) { - // now make a camera for it - PT(Camera) cam = new Camera(""); - dr->set_camera(NodePath(cam)); - _display_region.push_back(dr); - SetupFOV fov = (*k).getFOV(); - // The distinction between ConsoleSize and DisplaySize - // is to handle display regions with orientations that - // are rotated 90 degrees left or right. For example, - // the model shop cave (LAIR) uses projectors on their - // sides, so that what's horizontal on the console is - // vertical in the cave (Display). - float xConsoleSize = xsize*(v2.right()-v2.left()); - float yConsoleSize = ysize*(v2.top()-v2.bottom()); - float xDisplaySize, yDisplaySize; - if ( (*k).getOrientation() == SetupItem::Left || - (*k).getOrientation() == SetupItem::Right ) { - xDisplaySize = yConsoleSize; - yDisplaySize = xConsoleSize; - } else { - xDisplaySize = xConsoleSize; - yDisplaySize = yConsoleSize; - } - fov = ChanResolveFOV(fov, xDisplaySize, yDisplaySize); - if (chancfg_cat->is_debug()) { - chancfg_cat->debug() << "ChanEval:: FOVhoriz = " << fov.getHoriz() - << " FOVvert = " << fov.getVert() << endl; - chancfg_cat->debug() << "ChanEval:: xsize = " << xsize - << " ysize = " << ysize << endl; - } - - // take care of the orientation - CPT(TransformState) orient; - float hFov, vFov; - - switch ((*k).getOrientation()) { - case SetupItem::Up: - hFov = fov.getHoriz(); vFov = fov.getVert(); - break; - case SetupItem::Down: - hFov = fov.getHoriz(); vFov = fov.getVert(); - orient = TransformState::make_mat - (LMatrix4f::rotate_mat_normaxis(180.0f, LVector3f::forward())); - break; - case SetupItem::Left: - // vertical and horizontal FOV are being switched - hFov = fov.getVert(); vFov = fov.getHoriz(); - orient = TransformState::make_mat - (LMatrix4f::rotate_mat_normaxis(90.0f, LVector3f::forward())); - break; - case SetupItem::Right: - // vertical and horizontal FOV are being switched - hFov = fov.getVert(); vFov = fov.getHoriz(); - orient = TransformState::make_mat - (LMatrix4f::rotate_mat_normaxis(-90.0f, LVector3f::forward())); - break; - } - - PT(Lens) lens = new PerspectiveLens; - lens->set_fov(hFov, vFov); - lens->set_near_far(1.0f, 10000.0f); - cam->set_lens(lens); - - // hfov and vfov for camera are switched from what was specified - // if the orientation is sideways. - if (chancfg_cat->is_debug()) - chancfg_cat->debug() << "ChanEval:: camera hfov = " - << lens->get_hfov() << " vfov = " - << lens->get_vfov() << endl; - cam->set_scene(render); - - camera[W.getCameraGroup(j)]->add_child(cam); - if (orient != (TransformState *)NULL) { - cam->set_transform(orient); - } - } - } - _group_node = camera; - return; -} - -ChanConfig::ChanConfig(GraphicsEngine *engine, GraphicsPipe* pipe, - std::string cfg, const NodePath &render, - ChanCfgOverrides& overrides) { - ReadChanConfigData(); - // check to make sure we know everything we need to - if (!ConfigDefined(cfg)) { - chancfg_cat.error() - << "no window configuration called '" << cfg << "'" << endl; - _graphics_window = (GraphicsWindow*)0; - return; - } - WindowItem W = (*WindowDB)[cfg]; - - std::string l = W.getLayout(); - if (!LayoutDefined(l)) { - chancfg_cat.error() - << "No layout called '" << l << "'" << endl; - _graphics_window = (GraphicsWindow*)0; - return; - } - LayoutItem L = (*LayoutDB)[l]; - - SetupSyms s = W.getSetups(); - if (!ChanCheckSetups(s)) { - chancfg_cat.error() << "Setup failure" << endl; - _graphics_window = (GraphicsWindow*)0; - return; - } - - SVec S; - S.reserve(s.size()); - for (SetupSyms::iterator i=s.begin(); i!=s.end(); ++i) - S.push_back((*SetupDB)[(*i)]); - - // get the window data - int sizeX = chanconfig.GetInt("win-width", -1); - int sizeY = chanconfig.GetInt("win-height", -1); - if (overrides.defined(ChanCfgOverrides::SizeX)) - sizeX = overrides.getInt(ChanCfgOverrides::SizeX); - if (overrides.defined(ChanCfgOverrides::SizeY)) - sizeY = overrides.getInt(ChanCfgOverrides::SizeY); - if (sizeX < 0) { - if (sizeY < 0) { - if(chancfg_cat.is_debug()) - chancfg_cat.debug() << "Using default chan-window size\n"; - // take the default size - sizeX = W.getSizeX(); - sizeY = W.getSizeY(); - } else { - // vertical size is defined, compute horizontal keeping the aspect from - // the default - sizeX = (W.getSizeX() * sizeY) / W.getSizeY(); - } - } else if (sizeY < 0) { - // horizontal size is defined, compute vertical keeping the aspect from the - // default - sizeY = (W.getSizeY() * sizeX) / W.getSizeX(); - } - - int origX = chanconfig.GetInt("win-origin-x"); - int origY = chanconfig.GetInt("win-origin-y"); - origX = overrides.defined(ChanCfgOverrides::OrigX) ? - overrides.getInt(ChanCfgOverrides::OrigX) : origX; - origY = overrides.defined(ChanCfgOverrides::OrigY) ? - overrides.getInt(ChanCfgOverrides::OrigY) : origY; - - bool undecorated = chanconfig.GetBool("undecorated", !W.getBorder()); - bool fullscreen = chanconfig.GetBool("fullscreen", false); - bool use_cursor = !chanconfig.GetBool("cursor-hidden", !W.getCursor()); - int want_depth_bits = chanconfig.GetInt("want-depth-bits", 1); - int want_color_bits = chanconfig.GetInt("want-color-bits", 1); - - float win_background_r = chanconfig.GetFloat("win-background-r", 0.41); - float win_background_g = chanconfig.GetFloat("win-background-g", 0.41); - float win_background_b = chanconfig.GetFloat("win-background-b", 0.41); - - // visual? nope, that's handled with the mode. - int frame_buffer_mode = - FrameBufferProperties::FM_rgba | - FrameBufferProperties::FM_double_buffer | - FrameBufferProperties::FM_depth; - frame_buffer_mode = overrides.defined(ChanCfgOverrides::Mask) ? - overrides.getUInt(ChanCfgOverrides::Mask) : frame_buffer_mode; - - std::string title = cfg; - title = overrides.defined(ChanCfgOverrides::Title) ? - overrides.getString(ChanCfgOverrides::Title) : title; - - FrameBufferProperties fbprops; - fbprops.set_frame_buffer_mode(frame_buffer_mode); - fbprops.set_depth_bits(want_depth_bits); - fbprops.set_color_bits(want_color_bits); - - WindowProperties props; - props.set_open(true); - props.set_origin(origX, origY); - props.set_size(sizeX, sizeY); - props.set_title(title); - props.set_undecorated(undecorated); - props.set_fullscreen(fullscreen); - props.set_cursor_hidden(!use_cursor); - - - // stereo prep? - // DVR prep? - - bool want_cameras = overrides.defined(ChanCfgOverrides::Cameras) ? - overrides.getBool(ChanCfgOverrides::Cameras) : true; - - // open that sucker - PT(GraphicsStateGuardian) gsg = - engine->make_gsg(pipe, fbprops, engine->get_threading_model()); - PT(GraphicsWindow) win = engine->make_window(pipe, gsg); - if(win == (GraphicsWindow *)NULL) { - chancfg_cat.error() << "Could not create window" << endl; - _graphics_window = (GraphicsWindow *)NULL; - return; - } - - win->request_properties(props); - win->set_clear_color(Colorf(win_background_r, win_background_g, - win_background_b, 1.0f)); - - // make channels and display regions - ChanViewport V(0.0f, 1.0f, 0.0f, 1.0f); - chan_eval(win, W, L, S, V, W.getChanOffset()+1, sizeX, sizeY, - render, want_cameras); - for(size_t dr_index=0; dr_index<_display_region.size(); dr_index++) - _group_membership.push_back(W.getCameraGroup(dr_index)); - - // sanity check - if (config_sanity_check) { - nout << "ChanConfig Sanity check:" << endl - << "window - " << (void*)win << endl; - - int max_channel_index = win->get_max_channel_index(); - for (int c = 0; c < max_channel_index; c++) { - if (win->is_channel_defined(c)) { - GraphicsChannel *chan = win->get_channel(c); - nout << " Chan - " << (void*)chan << endl - << " window = " << (void*)(chan->get_window()) << endl - << " active = " << chan->is_active() << endl; - - int num_layers = chan->get_num_layers(); - for (int l = 0; l < num_layers; l++) { - GraphicsLayer *layer = chan->get_layer(l); - nout << " Layer - " << (void*)layer << endl - << " channel = " << (void*)(layer->get_channel()) << endl - << " active = " << layer->is_active() << endl; - - int num_drs = layer->get_num_drs(); - for (int d = 0; d < num_drs; d++) { - DisplayRegion *dr = layer->get_dr(d); - nout << " DR - " << (void*)dr << endl - << " layer = " << (void*)(dr->get_layer()) << endl; - float ll, rr, bb, tt; - dr->get_dimensions(ll, rr, bb, tt); - nout << " (" << ll << " " << rr << " " << bb << " " << tt << ")" << endl - << " camera = " << dr->get_camera() << endl; - NodePath cmm = dr->get_camera(); - if (!cmm.is_empty()) { - Camera *cmm_node = DCAST(Camera, cmm.node()); - nout << " active = " << cmm_node->is_active() << endl; - int num_cam_drs = cmm_node->get_num_display_regions(); - for (int cd = 0; cd < num_cam_drs; cd++) - nout << " dr = " << (void*)cmm_node->get_display_region(cd) << endl; - } - nout << " active = " << dr->is_active() << endl; - } - } - } - } - } - _graphics_window = win; - - return; -} - - - - - -ChanCfgOverrides::ChanCfgOverrides(void) {} - -ChanCfgOverrides::ChanCfgOverrides(const ChanCfgOverrides& c) : - _fields(c._fields) {} - -ChanCfgOverrides::~ChanCfgOverrides(void) {} - -ChanCfgOverrides& ChanCfgOverrides::operator=(const ChanCfgOverrides& c) -{ - _fields = c._fields; - return *this; -} - -void ChanCfgOverrides::setField(const Field f, const bool v) { - Types t; - t.setBool(v); - _fields[f] = t; -} - -void ChanCfgOverrides::setField(const Field f, const int v) { - Types t; - t.setInt(v); - _fields[f] = t; -} - -void ChanCfgOverrides::setField(const Field f, const unsigned int v) { - Types t; - t.setUInt(v); - _fields[f] = t; -} - -void ChanCfgOverrides::setField(const Field f, const float v) { - Types t; - t.setFloat(v); - _fields[f] = t; -} - -void ChanCfgOverrides::setField(const Field f, const double v) { - Types t; - t.setDouble(v); - _fields[f] = t; -} - -void ChanCfgOverrides::setField(const Field f, const std::string& v) { - Types t; - t.setString(v); - _fields[f] = t; -} - -void ChanCfgOverrides::setField(const Field f, const char* v) { - Types t; - t.setString(v); - _fields[f] = t; -} - -bool ChanCfgOverrides::defined(const Field f) const { - return (_fields.find(f) != _fields.end()); -} - -bool ChanCfgOverrides::getBool(const Field f) const { - Fields::const_iterator i = _fields.find(f); - const Types t((*i).second); - return t.getBool(); -} - -int ChanCfgOverrides::getInt(const Field f) const { - Fields::const_iterator i = _fields.find(f); - const Types t((*i).second); - return t.getInt(); -} - -unsigned int ChanCfgOverrides::getUInt(const Field f) const { - Fields::const_iterator i = _fields.find(f); - const Types t((*i).second); - return t.getUInt(); -} - -float ChanCfgOverrides::getFloat(const Field f) const { - Fields::const_iterator i = _fields.find(f); - const Types t((*i).second); - return t.getFloat(); -} - -double ChanCfgOverrides::getDouble(const Field f) const { - Fields::const_iterator i = _fields.find(f); - const Types t((*i).second); - return t.getDouble(); -} - -std::string ChanCfgOverrides::getString(const Field f) const { - Fields::const_iterator i = _fields.find(f); - const Types t((*i).second); - return t.getString(); -} diff --git a/panda/src/chancfg/chancfg.h b/panda/src/chancfg/chancfg.h deleted file mode 100644 index f9e9a7054f..0000000000 --- a/panda/src/chancfg/chancfg.h +++ /dev/null @@ -1,132 +0,0 @@ -// Filename: chancfg.h -// Created by: cary (04Feb99) -// -//////////////////////////////////////////////////////////////////// -// -// PANDA 3D SOFTWARE -// Copyright (c) 2001, Disney Enterprises, Inc. All rights reserved -// -// All use of this software is subject to the terms of the Panda 3d -// Software license. You should have received a copy of this license -// along with this source code; you will also find a current copy of -// the license at http://www.panda3d.org/license.txt . -// -// To contact the maintainers of this program write to -// panda3d@yahoogroups.com . -// -//////////////////////////////////////////////////////////////////// - -#ifndef __CHANCFG_H__ -#define __CHANCFG_H__ - -#include "pandabase.h" - -#include "chanlayout.h" -#include "chansetup.h" -#include "chanwindow.h" -#include "chanshare.h" - -#include "graphicsWindow.h" -#include "pandaNode.h" -#include "nodePath.h" - -#include "pmap.h" - -class GraphicsEngine; -class GraphicsPipe; - -class EXPCL_PANDA ChanCfgOverrides { -public: - enum Field { OrigX, OrigY, SizeX, SizeY, Title, Mask, Cameras }; -private: - class EXPCL_PANDA Types { - private: - bool _b; - int _i; - unsigned int _ui; - float _f; - double _d; - std::string _str; - public: - INLINE Types(void) {} - INLINE Types(const Types& c) : _b(c._b), _i(c._i), _ui(c._ui), _f(c._f), - _d(c._d), _str(c._str) {} - INLINE ~Types(void) {} - INLINE Types& operator=(const Types& c) { - _b = c._b; - _i = c._i; - _ui = c._ui; - _f = c._f; - _d = c._d; - _str = c._str; - return *this; - } - INLINE void setBool(const bool v) { _b = v; } - INLINE bool getBool(void) const { return _b; } - INLINE void setInt(const int v) { _i = v; } - INLINE int getInt(void) const { return _i; } - INLINE void setUInt(const unsigned int v) { _ui = v; } - INLINE unsigned int getUInt(void) const { return _ui; } - INLINE void setFloat(const float v) { _f = v; } - INLINE float getFloat(void) const { return _f; } - INLINE void setDouble(const double v) { _d = v; } - INLINE double getDouble(void) const { return _d; } - INLINE void setString(const std::string& v) { _str = v; } - INLINE std::string getString(void) const { return _str; } - }; - typedef pmap Fields; - Fields _fields; -public: - ChanCfgOverrides(void); - ChanCfgOverrides(const ChanCfgOverrides&); - ~ChanCfgOverrides(void); - - ChanCfgOverrides& operator=(const ChanCfgOverrides&); - - void setField(const Field, const bool); - void setField(const Field, const int); - void setField(const Field, const unsigned int); - void setField(const Field, const float); - void setField(const Field, const double); - void setField(const Field, const std::string&); - void setField(const Field, const char*); - - bool defined(const Field) const; - - bool getBool(const Field) const; - int getInt(const Field) const; - unsigned int getUInt(const Field) const; - float getFloat(const Field) const; - double getDouble(const Field) const; - std::string getString(const Field) const; -}; - -extern ChanCfgOverrides ChanOverrideNone; - -typedef pvector SVec; - -class EXPCL_PANDA ChanConfig -{ -private: - std::vector< PT(PandaNode) > _group_node; - std::vector< PT(DisplayRegion) > _display_region; - std::vector _group_membership; - PT(GraphicsWindow) _graphics_window; - void chan_eval(GraphicsWindow* win, WindowItem& W, LayoutItem& L, - SVec& S, ChanViewport& V, int hw_offset, - int xsize, int ysize, const NodePath &render, bool want_cameras); -PUBLISHED: - ChanConfig(GraphicsEngine *engine, GraphicsPipe *pipe, - std::string cfg, const NodePath &render, - ChanCfgOverrides& = ChanOverrideNone); - INLINE PandaNode *get_group_node(const int node_index) const; - INLINE int get_group_membership(const int dr_index) const; - INLINE int get_num_groups(void) const; - INLINE int get_num_drs(void) const; - INLINE PT(DisplayRegion) get_dr(const int dr_index) const; - INLINE PT(GraphicsWindow) get_win(void) const; -}; - -#include "chancfg.I" - -#endif /* __CHANCFG_H__ */ diff --git a/panda/src/chancfg/chancfg_composite1.cxx b/panda/src/chancfg/chancfg_composite1.cxx deleted file mode 100644 index 70214f4cb5..0000000000 --- a/panda/src/chancfg/chancfg_composite1.cxx +++ /dev/null @@ -1,4 +0,0 @@ - -#include "chancfg.cxx" - - diff --git a/panda/src/chancfg/chancfg_composite2.cxx b/panda/src/chancfg/chancfg_composite2.cxx deleted file mode 100644 index abc1461cfd..0000000000 --- a/panda/src/chancfg/chancfg_composite2.cxx +++ /dev/null @@ -1,6 +0,0 @@ -#include "chanlayout.cxx" -#include "chanparse.cxx" -#include "chansetup.cxx" -#include "chanwindow.cxx" - - diff --git a/panda/src/chancfg/chancfg_headers.h b/panda/src/chancfg/chancfg_headers.h deleted file mode 100644 index 91a80b7dc4..0000000000 --- a/panda/src/chancfg/chancfg_headers.h +++ /dev/null @@ -1,29 +0,0 @@ -// Filename: xxx_headers.h -// Created by: georges (30May01) -// -//////////////////////////////////////////////////////////////////// -// -// PANDA 3D SOFTWARE -// Copyright (c) 2001, Disney Enterprises, Inc. All rights reserved -// -// All use of this software is subject to the terms of the Panda 3d -// Software license. You should have received a copy of this license -// along with this source code; you will also find a current copy of -// the license at http://www.panda3d.org/license.txt . -// -// To contact the maintainers of this program write to -// panda3d@yahoogroups.com . -// -//////////////////////////////////////////////////////////////////// - -#include "notify.h" - -#include "chancfg.h" -#include "chanlayout.h" -#include "chanparse.h" -#include "chansetup.h" -#include "chanshare.h" -#include "chanwindow.h" - -#pragma hdrstop - diff --git a/panda/src/chancfg/chanlayout.I b/panda/src/chancfg/chanlayout.I deleted file mode 100644 index 3ac9fcb8ec..0000000000 --- a/panda/src/chancfg/chanlayout.I +++ /dev/null @@ -1,45 +0,0 @@ -// Filename: chanlayout.I -// Created by: cary (04Feb99) -// -//////////////////////////////////////////////////////////////////// -// -// PANDA 3D SOFTWARE -// Copyright (c) 2001, Disney Enterprises, Inc. All rights reserved -// -// All use of this software is subject to the terms of the Panda 3d -// Software license. You should have received a copy of this license -// along with this source code; you will also find a current copy of -// the license at http://www.panda3d.org/license.txt . -// -// To contact the maintainers of this program write to -// panda3d@yahoogroups.com . -// -//////////////////////////////////////////////////////////////////// - -INLINE LayoutItem::LayoutItem(void) {} - -INLINE LayoutItem::LayoutItem(int x, int y) : _x(x), _y(y) {} - -INLINE LayoutItem::LayoutItem(const LayoutItem& c) : _x(c._x), _y(c._y), - _regions(c._regions) {} - -INLINE LayoutItem::~LayoutItem(void) {} - -INLINE LayoutItem& LayoutItem::operator=(const LayoutItem& c) { - _x = c._x; - _y = c._y; - _regions = c._regions; - return *this; -} - -INLINE void LayoutItem::AddRegion(const ChanViewport& r) { - _regions.push_back(r); -} - -INLINE int LayoutItem::GetNumRegions(void) { - return _regions.size(); -} - -INLINE const ChanViewport& LayoutItem::operator[](int i) { - return _regions[i]; -} diff --git a/panda/src/chancfg/chanlayout.cxx b/panda/src/chancfg/chanlayout.cxx deleted file mode 100644 index 33e22fc19b..0000000000 --- a/panda/src/chancfg/chanlayout.cxx +++ /dev/null @@ -1,125 +0,0 @@ -// Filename: chanlayout.cxx -// Created by: cary (02Feb99) -// -//////////////////////////////////////////////////////////////////// -// -// PANDA 3D SOFTWARE -// Copyright (c) 2001, Disney Enterprises, Inc. All rights reserved -// -// All use of this software is subject to the terms of the Panda 3d -// Software license. You should have received a copy of this license -// along with this source code; you will also find a current copy of -// the license at http://www.panda3d.org/license.txt . -// -// To contact the maintainers of this program write to -// panda3d@yahoogroups.com . -// -//////////////////////////////////////////////////////////////////// - -#include "chanlayout.h" -#include "chanparse.h" -#include "chanshare.h" -#include "notify.h" - -LayoutType* LayoutDB = (LayoutType*)0; - -class LayoutParseFunctor : public ChanParseFunctor { -public: - INLINE LayoutParseFunctor(void) : ChanParseFunctor() {} - virtual ~LayoutParseFunctor(void); - - virtual void operator()(std::string); -}; - -LayoutParseFunctor::~LayoutParseFunctor(void) { - return; -} - -typedef pvector LayoutBoolVec; - -void LayoutParseFunctor::operator()(std::string S) { - std::string sym; - - ChanEatFrontWhite(S); - sym = ChanReadNextWord(S); - ChanCheckScoping(S); - ChanDescope(S); - - int X, Y; - - X = ChanReadNextInt(S); - Y = ChanReadNextInt(S); - - LayoutItem L(X, Y); - LayoutBoolVec mask; - int i=0; - for (; i<(X*Y); ++i) - mask.push_back(false); - - float xfrac = 1. / float(X); - float yfrac = 1. / float(Y); - - while (!S.empty()) { - ChanCheckScoping(S); - i = S.find_first_of(")"); - std::string stmp = S.substr(1, i-1); - S.erase(0, i+1); - ChanEatFrontWhite(S); - - int m, n, start; - - m = ChanReadNextInt(stmp); - n = ChanReadNextInt(stmp); - start = ChanReadNextInt(stmp); - - int x = start % X; - int y = (start - x) / X; - bool ok = true; - - for (int j=y; jdebug() << "parsed a layout called '" << sym << "':" << endl; - chancfg_cat->debug() << " " << L.GetNumRegions() << " regions" << endl; - for (int q=0; qdebug() << " region #" << q << ": (" << v.left() << ", " - << v.right() << ", " << v.bottom() << ", " - << v.top() << ")" << endl; - } - } - (*LayoutDB)[sym] = L; -} - -void ResetLayout() { - if (LayoutDB != (LayoutType *)NULL) { - delete LayoutDB; - } - LayoutDB = new LayoutType; -} - -void ParseLayout(istream& is) { - LayoutParseFunctor l; - ChanParse(is, &l); -} diff --git a/panda/src/chancfg/chanlayout.h b/panda/src/chancfg/chanlayout.h deleted file mode 100644 index bac830ec38..0000000000 --- a/panda/src/chancfg/chanlayout.h +++ /dev/null @@ -1,58 +0,0 @@ -// Filename: chanlayout.h -// Created by: cary (04Feb99) -// -//////////////////////////////////////////////////////////////////// -// -// PANDA 3D SOFTWARE -// Copyright (c) 2001, Disney Enterprises, Inc. All rights reserved -// -// All use of this software is subject to the terms of the Panda 3d -// Software license. You should have received a copy of this license -// along with this source code; you will also find a current copy of -// the license at http://www.panda3d.org/license.txt . -// -// To contact the maintainers of this program write to -// panda3d@yahoogroups.com . -// -//////////////////////////////////////////////////////////////////// - -#ifndef __CHANLAYOUT_H__ -#define __CHANLAYOUT_H__ - -#include "pandabase.h" - -#include "pmap.h" -#include "pvector.h" -#include -#include -#include "chanviewport.h" - - -typedef pvector LayoutRegionVec; - -class LayoutItem { -private: - int _x, _y; - LayoutRegionVec _regions; -public: - INLINE LayoutItem(void); - INLINE LayoutItem(int, int); - INLINE LayoutItem(const LayoutItem&); - INLINE ~LayoutItem(void); - - INLINE LayoutItem& operator=(const LayoutItem&); - INLINE void AddRegion(const ChanViewport&); - INLINE int GetNumRegions(void); - INLINE const ChanViewport& operator[](int); -}; - -typedef pmap LayoutType; - -extern LayoutType* LayoutDB; - -void ResetLayout(); -void ParseLayout(istream&); - -#include "chanlayout.I" - -#endif /* __CHANLAYOUT_H__ */ diff --git a/panda/src/chancfg/chanparse.I b/panda/src/chancfg/chanparse.I deleted file mode 100644 index b6f8ba9a28..0000000000 --- a/panda/src/chancfg/chanparse.I +++ /dev/null @@ -1,111 +0,0 @@ -// Filename: chanparse.I -// Created by: cary (06Feb99) -// -//////////////////////////////////////////////////////////////////// -// -// PANDA 3D SOFTWARE -// Copyright (c) 2001, Disney Enterprises, Inc. All rights reserved -// -// All use of this software is subject to the terms of the Panda 3d -// Software license. You should have received a copy of this license -// along with this source code; you will also find a current copy of -// the license at http://www.panda3d.org/license.txt . -// -// To contact the maintainers of this program write to -// panda3d@yahoogroups.com . -// -//////////////////////////////////////////////////////////////////// - -#include "notify.h" - -INLINE void ChanEatFrontWhite(std::string& S) { - size_t i = S.find_first_not_of(" \t\r\f\n"); - if ((i != std::string::npos) && (i != 0)) - S.erase(0, i); -} - -INLINE void ChanCheckScoping(std::string& S) { - if (S[0] != '(') { - // error, unscoped text usually indicates a problem - nout << "error, '" << S << "' does not start with a (" << endl; - S.erase(0, S.find_first_of("(")); - } -} - -INLINE void ChanDescope(std::string& S) { - int i = ChanMatchingParen(S); - nassertv(i != -1); - S = S.substr(1, i-2); - ChanEatFrontWhite(S); -} - -INLINE std::string ChanReadNextWord(std::string& S) { - int i = S.find_first_of(" \t\r\f\n"); - std::string stmp = S.substr(0, i); - S.erase(0, i); - ChanEatFrontWhite(S); - return stmp; -} - -INLINE int ChanReadNextInt(std::string& S) { - int i = S.find_first_of(" \t\r\f\n"); - std::string stmp = S.substr(0, i); - S.erase(0, i); - ChanEatFrontWhite(S); - istringstream st(stmp.c_str()); - st >> i; - return i; -} - -INLINE bool ChanReadNextBool(std::string& S) { - int i = S.find_first_of(" \t\r\f\n"); - std::string stmp = S.substr(0, i); - S.erase(0, i); - ChanEatFrontWhite(S); - bool ret = false; - if ((stmp.length() != 2) || (stmp[0] != '#')) { - // error, this isn't gonna be either #t or #f - nout << "error, '" << stmp << "' is not either #t or #f" << endl; - ret = false; - } - if (stmp[1] == 't') - ret = true; - else if (stmp[1] != 'f') { - // error this isn't either #t or #f - nout << "error, '" << stmp << "' is not either #t or #f" << endl; - ret = false; - } - return ret; -} - -// #f or int -INLINE int ChanReadNextIntB(std::string& S) { - int i = S.find_first_of(" \t\r\f\n"); - std::string stmp = S.substr(0, i); - S.erase(0, i); - ChanEatFrontWhite(S); - i = -1; - if (stmp[0] == '#') - if ((stmp.length() != 2)||(stmp[1] != 'f')) { - // error, not #f.. #t is not allowed in this case - nout << "error, '" << stmp << "' is not allowed, only #f or an int" - << endl; - i = -1; - } - else { - istringstream st(stmp.c_str()); - st >> i; - } - return i; -} - -INLINE float ChanReadNextFloat(std::string& S) { - int i = S.find_first_of(" \t\r\f\n"); - std::string stmp = S.substr(0, i); - S.erase(0, i); - ChanEatFrontWhite(S); - istringstream st(stmp.c_str()); - float ret; - st >> ret; - return ret; -} diff --git a/panda/src/chancfg/chanparse.cxx b/panda/src/chancfg/chanparse.cxx deleted file mode 100644 index 5123c98afc..0000000000 --- a/panda/src/chancfg/chanparse.cxx +++ /dev/null @@ -1,155 +0,0 @@ -// Filename: chanparse.cxx -// Created by: cary (02Feb99) -// -//////////////////////////////////////////////////////////////////// -// -// PANDA 3D SOFTWARE -// Copyright (c) 2001, Disney Enterprises, Inc. All rights reserved -// -// All use of this software is subject to the terms of the Panda 3d -// Software license. You should have received a copy of this license -// along with this source code; you will also find a current copy of -// the license at http://www.panda3d.org/license.txt . -// -// To contact the maintainers of this program write to -// panda3d@yahoogroups.com . -// -//////////////////////////////////////////////////////////////////// - -#include "chanparse.h" -#include "notify.h" - -const int ChanFileEOF = -1; - -static bool file_done; - -std::string ChanReadLine(istream& is) { - if (is.eof() || is.fail()) -#ifdef BROKEN_EXCEPTIONS - { - file_done = true; - return ""; - } -#else - throw ChanFileEOF; // all done -#endif /* BROKEN_EXCEPTIONS */ - std::string S; - std::getline(is, S); - size_t i = S.find_first_not_of(" \t\f\r\n"); - if ((i == std::string::npos) || (S[i] == ';')) - return ChanReadLine(is); // all white space or comment - if (i != 0) - S.erase(0, i); // remove leading white space - i = S.find_first_of(";"); - if (i != std::string::npos) - S.erase(i, std::string::npos); // remove trailing comment - i = S.find_last_not_of(" \t\f\r\n"); - if (i != std::string::npos) - S.erase(i + 1, std::string::npos); // remove trailing whitespace - return S; -} - -int ChanMatchingParen(std::string S) { - int i = 1, j = 1; - std::string::iterator k = S.begin(); - - ++k; - while ((k != S.end()) && (i != 0)) { - switch (*k) { - case '(': - ++i; - break; - case ')': - --i; - break; - } - ++j; - ++k; - } - if ((k == S.end()) && (i != 0)) - j = -1; - return j; -} - -void ChanParse(istream& is, ChanParseFunctor* p) { - file_done = false; - - std::string S; -#ifdef BROKEN_EXCEPTIONS - S = ChanReadLine(is); - if (file_done) { - nout << "No data in file to parse" << endl; - return; - } -#else - try { - S = ChanReadLine(is); - } - catch (...) { - nout << "No data in file to parse" << endl; - return; // comment that there was no data in file to parse - } -#endif /* BROKEN_EXCEPTIONS */ - - // now the main loop -#ifdef BROKEN_EXCEPTIONS - { - int i; - while (true) { - if ((!S.empty()) && (S[0] != '(')) { - // error, should have leading paren - nout << "error, no leading paren in '" << S << "'" << endl; - S.erase(0, S.find_first_of("(")); - } - while ((S.empty())||(i = ChanMatchingParen(S)) == -1) { - S += " "; - S += ChanReadLine(is); - if (file_done) { - if (!S.empty() && (!(S == " "))) - // error, trailing text usually indicates an error in the file - nout << "error, trailing text in file S = '" << S << "'" << endl; - return; - } - ChanEatFrontWhite(S); - } - (*p)(S.substr(1, i-2)); - S.erase(0, i); - ChanEatFrontWhite(S); - } - } -#else - try { - int i; - while (true) { - if ((!S.empty()) && (S[0] != '(')) { - // error, should have leading paren - nout << "error, no leading paren in '" << S << "'" << endl; - S.erase(0, S.find_first_of("(")); - } - while ((S.empty())||(i = ChanMatchingParen(S)) == -1) { - S += " "; - S += ChanReadLine(is); - ChanEatFrontWhite(S); - } - (*p)(S.substr(1, i-2)); - S.erase(0, i); - ChanEatFrontWhite(S); - } - } - catch (...) { - if (!S.empty() && (!(S == " "))) - // error, trailing text usually indicates an error in the file - nout << "error, trailing text in file S = '" << S << "'" << endl; - return; - } -#endif /* BROKEN_EXCEPTIONS */ -} - -ChanParseFunctor::~ChanParseFunctor() { - return; -} - -void ChanParseFunctor::operator()(std::string) { - // error, should never be in here - return; -} diff --git a/panda/src/chancfg/chanparse.h b/panda/src/chancfg/chanparse.h deleted file mode 100644 index b93545f841..0000000000 --- a/panda/src/chancfg/chanparse.h +++ /dev/null @@ -1,48 +0,0 @@ -// Filename: chanparse.h -// Created by: cary (02Feb99) -// -//////////////////////////////////////////////////////////////////// -// -// PANDA 3D SOFTWARE -// Copyright (c) 2001, Disney Enterprises, Inc. All rights reserved -// -// All use of this software is subject to the terms of the Panda 3d -// Software license. You should have received a copy of this license -// along with this source code; you will also find a current copy of -// the license at http://www.panda3d.org/license.txt . -// -// To contact the maintainers of this program write to -// panda3d@yahoogroups.com . -// -//////////////////////////////////////////////////////////////////// - -#ifndef __CHANPARSE_H__ -#define __CHANPARSE_H__ - -#include "pandabase.h" - -#include - -class EXPCL_PANDA ChanParseFunctor { -public: - INLINE ChanParseFunctor() {}; - virtual ~ChanParseFunctor(); - - virtual void operator()(std::string) = 0; -}; - -int ChanMatchingParen(std::string); -void ChanParse(istream&, ChanParseFunctor*); - -INLINE void ChanEatFrontWhite(std::string&); -INLINE void ChanCheckScoping(std::string&); -INLINE void ChanDescope(std::string&); -INLINE std::string ChanReadNextWord(std::string&); -INLINE int ChanReadNextInt(std::string&); -INLINE bool ChanReadNextBool(std::string&); -INLINE int ChanReadNextIntB(std::string&); -INLINE float ChanReadNextFloat(std::string&); - -#include "chanparse.I" - -#endif /* __CHANPARSE_H__ */ diff --git a/panda/src/chancfg/chansetup.I b/panda/src/chancfg/chansetup.I deleted file mode 100644 index 81820485cb..0000000000 --- a/panda/src/chancfg/chansetup.I +++ /dev/null @@ -1,130 +0,0 @@ -// Filename: chansetup.I -// Created by: cary (05Feb99) -// -//////////////////////////////////////////////////////////////////// -// -// PANDA 3D SOFTWARE -// Copyright (c) 2001, Disney Enterprises, Inc. All rights reserved -// -// All use of this software is subject to the terms of the Panda 3d -// Software license. You should have received a copy of this license -// along with this source code; you will also find a current copy of -// the license at http://www.panda3d.org/license.txt . -// -// To contact the maintainers of this program write to -// panda3d@yahoogroups.com . -// -//////////////////////////////////////////////////////////////////// - -INLINE SetupFOV::SetupFOV(void) : _type(Invalid), - _horiz(0.0f), - _vert(0.0f) {} - -INLINE SetupFOV::SetupFOV(const SetupFOV& c) : _type(c._type), - _horiz(c._horiz), - _vert(c._vert) {} - -INLINE SetupFOV::~SetupFOV(void) {} - -INLINE SetupFOV& SetupFOV::operator=(const SetupFOV& c) { - _type = c._type; - _horiz = c._horiz; - _vert = c._vert; - return *this; -} - -INLINE void SetupFOV::setFOV(void) { - _type = Default; -} - -INLINE void SetupFOV::setFOV(const float h) { - _type = Horizontal; - _horiz = h; -} - -INLINE void SetupFOV::setFOV(const float h, const float v) { - _type = Both; - _horiz = h; - _vert = v; -} - -INLINE SetupFOV::FOVType SetupFOV::getType(void) const { - return _type; -} - -INLINE float SetupFOV::getHoriz(void) const { - return _horiz; -} - -INLINE float SetupFOV::getVert(void) const { - return _vert; -} - -INLINE SetupItem::SetupItem(void) : _viewport(0., 1., 0., 1.) {} - -INLINE SetupItem::SetupItem(const SetupItem& c) : _layouts(c._layouts), - _setups(c._setups), - _stereo(c._stereo), - _hw_chan(c._hw_chan), - _chan(c._chan), - _viewport(c._viewport), - _fov(c._fov), - _orientation(c._orientation) - {} - -INLINE SetupItem::~SetupItem(void) {} - -INLINE SetupItem& SetupItem::operator=(const SetupItem& c) { - _layouts = c._layouts; - _setups = c._setups; - _stereo = c._stereo; - _hw_chan = c._hw_chan; - _chan = c._chan; - _viewport = c._viewport; - _fov = c._fov; - _orientation = c._orientation; - return *this; -} - -INLINE void SetupItem::setState(const bool st, const bool hw, const int pvc, - const ChanViewport& v, const SetupFOV& f, - const Orientation& o) { - _stereo = st; - _hw_chan = hw; - _chan = pvc; - _viewport = v; - _fov = f; - _orientation = o; -} - -INLINE SetupSyms SetupItem::getLayouts(void) const { - return _layouts; -} - -INLINE SetupSyms SetupItem::getSetups(void) const { - return _setups; -} - -INLINE bool SetupItem::getStereo(void) const { - return _stereo; -} - -INLINE bool SetupItem::getHWChan(void) const { - return _hw_chan; -} - -INLINE int SetupItem::getChan(void) const { - return _chan; -} - -INLINE ChanViewport SetupItem::getViewport(void) const { - return _viewport; -} - -INLINE SetupFOV SetupItem::getFOV(void) const { - return _fov; -} - -INLINE SetupItem::Orientation SetupItem::getOrientation(void) const { - return _orientation; -} diff --git a/panda/src/chancfg/chansetup.cxx b/panda/src/chancfg/chansetup.cxx deleted file mode 100644 index 7f7a3d814f..0000000000 --- a/panda/src/chancfg/chansetup.cxx +++ /dev/null @@ -1,179 +0,0 @@ -// Filename: chansetup.cxx -// Created by: cary (05Feb99) -// -//////////////////////////////////////////////////////////////////// -// -// PANDA 3D SOFTWARE -// Copyright (c) 2001, Disney Enterprises, Inc. All rights reserved -// -// All use of this software is subject to the terms of the Panda 3d -// Software license. You should have received a copy of this license -// along with this source code; you will also find a current copy of -// the license at http://www.panda3d.org/license.txt . -// -// To contact the maintainers of this program write to -// panda3d@yahoogroups.com . -// -//////////////////////////////////////////////////////////////////// - -#include "chansetup.h" -#include "chanparse.h" -#include "chanshare.h" -#include "notify.h" - -SetupType* SetupDB = (SetupType*)0; - -class SetupParseFunctor : public ChanParseFunctor { -public: - INLINE SetupParseFunctor(void) : ChanParseFunctor() {} - virtual ~SetupParseFunctor(void); - - virtual void operator()(std::string); -}; - -SetupParseFunctor::~SetupParseFunctor(void) { - return; -} - -void SetupParseFunctor::operator()(std::string S) { - std::string sym; - - ChanEatFrontWhite(S); - sym = ChanReadNextWord(S); - ChanCheckScoping(S); - ChanDescope(S); - - SetupItem s; - - bool stereo = ChanReadNextBool(S); - //KEH - //bool hw_chan = ChanReadNextBool(S); - //int chan_num = ChanReadNextIntB(S); - - ChanCheckScoping(S); - int i = S.find_first_of(")"); - std::string stmp = S.substr(1, i-2); - S.erase(0, i+1); - ChanEatFrontWhite(S); - ChanViewport v(ChanReadNextFloat(stmp), ChanReadNextFloat(stmp), - ChanReadNextFloat(stmp), ChanReadNextFloat(stmp)); - if (!stmp.empty()) { - // error, there shouldn't be anything left after eating the viewport - nout << "error, tailing text in viewport spec '" << stmp << "'" << endl; - stmp.erase(0, std::string::npos); - } - SetupFOV fov; - if (S[0] == '#') { - bool b = ChanReadNextBool(S); - if (b) { - // error, #t is not allowed here - nout << "error, cannot have #t for FOV spec" << endl; - b = false; - } - fov.setFOV(); - } else if (S[0] == '(') { - i = S.find_first_of(")"); - stmp = S.substr(1, i-2); - S.erase(0, i+1); - ChanEatFrontWhite(S); - fov.setFOV(ChanReadNextFloat(stmp), ChanReadNextFloat(stmp)); - if (!stmp.empty()) { - // error, there shouldn't be anything left after eating the fov - nout << "error, trailing text after fov spec '" << stmp << "'" << endl; - stmp.erase(0, std::string::npos); - } - } else { - fov.setFOV(ChanReadNextFloat(S)); - } - SetupItem::Orientation orie = SetupItem::Up; - if (!S.empty()) { - stmp = ChanReadNextWord(S); - if (stmp == "up") { - // nothing really to do - orie = SetupItem::Up; - } else if (stmp == "down") { - orie = SetupItem::Down; - } else if (stmp == "left") { - orie = SetupItem::Left; - } else if (stmp == "right") { - orie = SetupItem::Right; - } else { - // error, not a recognized orientation - nout << "error, invalid orientation '" << stmp << "'" << endl; - stmp.erase(0, std::string::npos); - } - } - if (!S.empty()) { - // error, we should have consumed all the data by now - nout << "error, trailing text on setup spec '" << S << "'" << endl; - S.erase(0, std::string::npos); - } - //KEH - //s.setState(stereo, hw_chan, chan_num, v, fov, orie); - s.setState(stereo, false, -1, v, fov, orie); - - if (chancfg_cat.is_debug()) { - chancfg_cat->debug() << "parsed a setup called '" << sym << "':" << endl; - chancfg_cat->debug() << " is" << (s.getStereo()?" ":" not ") - << "a stereo setup" << endl; - chancfg_cat->debug() <<" is" << (s.getHWChan()?" ":" not ") - << "a HW channel setup" << endl; - chancfg_cat->debug() << " prefered HW channel number: " << s.getChan() - << endl; - ChanViewport qv(s.getViewport()); - chancfg_cat->debug() << " sub viewport: (" << qv.left() << ", " - << qv.right() << ", " << qv.bottom() << ", " - << qv.top() << ")" << endl; - SetupFOV qf(s.getFOV()); - switch (qf.getType()) { - case SetupFOV::Invalid: - chancfg_cat->debug() << " FOV is invalid" << endl; - break; - case SetupFOV::Default: - chancfg_cat->debug() << " FOV takes defaults" << endl; - break; - case SetupFOV::Horizontal: - chancfg_cat->debug() << " FOV specifies only horizontal: " - << qf.getHoriz() << endl; - break; - case SetupFOV::Both: - chancfg_cat->debug() << " FOV: " << qf.getHoriz() << " x " - << qf.getVert() << endl; - break; - default: - chancfg_cat->debug() << " FOV is of an unknown type (" << (int)qf.getType() - << ")" << endl; - } - switch (s.getOrientation()) { - case SetupItem::Up: - chancfg_cat->debug() << " setup is oriented Up" << endl; - break; - case SetupItem::Down: - chancfg_cat->debug() << " setup is oriented Down" << endl; - break; - case SetupItem::Left: - chancfg_cat->debug() << " setup is oriented Left" << endl; - break; - case SetupItem::Right: - chancfg_cat->debug() << " setup is oriented Right" << endl; - break; - default: - chancfg_cat->debug() << " setup has an unknown orientation (" - << (int)s.getOrientation() << ")" << endl; - } - } - (*SetupDB)[sym] = s; -} - - -void ResetSetup() { - if (SetupDB != (SetupType *)NULL) { - delete SetupDB; - } - SetupDB = new SetupType; -} - -void ParseSetup(istream& is) { - SetupParseFunctor s; - ChanParse(is, &s); -} diff --git a/panda/src/chancfg/chansetup.h b/panda/src/chancfg/chansetup.h deleted file mode 100644 index a9cbd929f4..0000000000 --- a/panda/src/chancfg/chansetup.h +++ /dev/null @@ -1,94 +0,0 @@ -// Filename: chansetup.h -// Created by: cary (05Feb99) -// -//////////////////////////////////////////////////////////////////// -// -// PANDA 3D SOFTWARE -// Copyright (c) 2001, Disney Enterprises, Inc. All rights reserved -// -// All use of this software is subject to the terms of the Panda 3d -// Software license. You should have received a copy of this license -// along with this source code; you will also find a current copy of -// the license at http://www.panda3d.org/license.txt . -// -// To contact the maintainers of this program write to -// panda3d@yahoogroups.com . -// -//////////////////////////////////////////////////////////////////// - -#ifndef __CHANSETUP_H__ -#define __CHANSETUP_H__ - -#include "pandabase.h" - -#include - -#include "pmap.h" -#include "chanviewport.h" - -typedef vector_string SetupSyms; - -class SetupFOV { -public: - enum FOVType { Invalid, Default, Horizontal, Both }; -private: - FOVType _type; - float _horiz, _vert; -public: - INLINE SetupFOV(void); - INLINE SetupFOV(const SetupFOV&); - INLINE ~SetupFOV(void); - - INLINE SetupFOV& operator=(const SetupFOV&); - - INLINE void setFOV(void); - INLINE void setFOV(const float); - INLINE void setFOV(const float, const float); - INLINE FOVType getType(void) const; - INLINE float getHoriz(void) const; - INLINE float getVert(void) const; -}; - -class SetupItem { -public: - enum Orientation { Up, Down, Left, Right }; -private: - SetupSyms _layouts; - SetupSyms _setups; - - bool _stereo; - bool _hw_chan; - int _chan; - ChanViewport _viewport; - SetupFOV _fov; - Orientation _orientation; -public: - INLINE SetupItem(void); - INLINE SetupItem(const SetupItem&); - INLINE ~SetupItem(void); - - INLINE SetupItem& operator=(const SetupItem&); - - INLINE void setState(const bool, const bool, const int, const ChanViewport&, - const SetupFOV&, const Orientation&); - - INLINE SetupSyms getLayouts(void) const; - INLINE SetupSyms getSetups(void) const; - INLINE bool getStereo(void) const; - INLINE bool getHWChan(void) const; - INLINE int getChan(void) const; - INLINE ChanViewport getViewport(void) const; - INLINE SetupFOV getFOV(void) const; - INLINE Orientation getOrientation(void) const; -}; - -typedef pmap SetupType; - -extern SetupType* SetupDB; - -void ResetSetup(); -void ParseSetup(istream&); - -#include "chansetup.I" - -#endif /* __CHANSETUP_H__ */ diff --git a/panda/src/chancfg/chanshare.h b/panda/src/chancfg/chanshare.h deleted file mode 100644 index 004c37809f..0000000000 --- a/panda/src/chancfg/chanshare.h +++ /dev/null @@ -1,26 +0,0 @@ -// Filename: chanshare.h -// Created by: frang (24Mar00) -// -//////////////////////////////////////////////////////////////////// -// -// PANDA 3D SOFTWARE -// Copyright (c) 2001, Disney Enterprises, Inc. All rights reserved -// -// All use of this software is subject to the terms of the Panda 3d -// Software license. You should have received a copy of this license -// along with this source code; you will also find a current copy of -// the license at http://www.panda3d.org/license.txt . -// -// To contact the maintainers of this program write to -// panda3d@yahoogroups.com . -// -//////////////////////////////////////////////////////////////////// - -#ifndef __CHANSHARE_H__ -#define __CHANSHARE_H__ - -#include "notifyCategoryProxy.h" - -NotifyCategoryDecl(chancfg, EXPCL_PANDA, EXPTP_PANDA); - -#endif /* __CHANSHARE_H__ */ diff --git a/panda/src/chancfg/chanviewport.I b/panda/src/chancfg/chanviewport.I deleted file mode 100644 index ce549c3aeb..0000000000 --- a/panda/src/chancfg/chanviewport.I +++ /dev/null @@ -1,52 +0,0 @@ -// Filename: chanviewport.I -// Created by: cary (06Feb99) -// -//////////////////////////////////////////////////////////////////// -// -// PANDA 3D SOFTWARE -// Copyright (c) 2001, Disney Enterprises, Inc. All rights reserved -// -// All use of this software is subject to the terms of the Panda 3d -// Software license. You should have received a copy of this license -// along with this source code; you will also find a current copy of -// the license at http://www.panda3d.org/license.txt . -// -// To contact the maintainers of this program write to -// panda3d@yahoogroups.com . -// -//////////////////////////////////////////////////////////////////// - -#include - -INLINE ChanViewport::ChanViewport(void) {} - -INLINE ChanViewport::ChanViewport(float l, float r, float b, float t) : - _left(l), _right(r), _bottom(b), _top(t) { - if (_left > _right) - swap(_left, _right); - if (_bottom > _top) - swap(_bottom, _top); -} - -INLINE ChanViewport::ChanViewport(const ChanViewport& c) : _left(c._left), - _right(c._right), - _bottom(c._bottom), - _top(c._top) {} - -INLINE ChanViewport::~ChanViewport(void) {} - -INLINE ChanViewport& ChanViewport::operator=(const ChanViewport& c) { - _left = c._left; - _right = c._right; - _bottom = c._bottom; - _top = c._top; - return *this; -} - -INLINE float ChanViewport::left(void) const { return _left; } - -INLINE float ChanViewport::right(void) const { return _right; } - -INLINE float ChanViewport::bottom(void) const { return _bottom; } - -INLINE float ChanViewport::top(void) const { return _top; } diff --git a/panda/src/chancfg/chanviewport.h b/panda/src/chancfg/chanviewport.h deleted file mode 100644 index 4c5bc1acae..0000000000 --- a/panda/src/chancfg/chanviewport.h +++ /dev/null @@ -1,44 +0,0 @@ -// Filename: chanviewport.h -// Created by: cary (06Feb99) -// -//////////////////////////////////////////////////////////////////// -// -// PANDA 3D SOFTWARE -// Copyright (c) 2001, Disney Enterprises, Inc. All rights reserved -// -// All use of this software is subject to the terms of the Panda 3d -// Software license. You should have received a copy of this license -// along with this source code; you will also find a current copy of -// the license at http://www.panda3d.org/license.txt . -// -// To contact the maintainers of this program write to -// panda3d@yahoogroups.com . -// -//////////////////////////////////////////////////////////////////// - -#ifndef __CHANVIEWPORT_H__ -#define __CHANVIEWPORT_H__ - - -class EXPCL_PANDA ChanViewport { -private: - float _left, _right, _bottom, _top; - - INLINE ChanViewport(); -public: - INLINE ChanViewport(float, float, float, float); - INLINE ChanViewport(const ChanViewport&); - INLINE ~ChanViewport(); - INLINE ChanViewport& operator=(const ChanViewport&); - - INLINE float left() const; - INLINE float right() const; - INLINE float bottom() const; - INLINE float top() const; -}; - -#include "pandabase.h" - -#include "chanviewport.I" - -#endif /* __CHANVIEWPORT_H__ */ diff --git a/panda/src/chancfg/chanwindow.I b/panda/src/chancfg/chanwindow.I deleted file mode 100644 index 3735ce7e58..0000000000 --- a/panda/src/chancfg/chanwindow.I +++ /dev/null @@ -1,104 +0,0 @@ -// Filename: chanwindow.I -// Created by: cary (06Feb99) -// -//////////////////////////////////////////////////////////////////// -// -// PANDA 3D SOFTWARE -// Copyright (c) 2001, Disney Enterprises, Inc. All rights reserved -// -// All use of this software is subject to the terms of the Panda 3d -// Software license. You should have received a copy of this license -// along with this source code; you will also find a current copy of -// the license at http://www.panda3d.org/license.txt . -// -// To contact the maintainers of this program write to -// panda3d@yahoogroups.com . -// -//////////////////////////////////////////////////////////////////// - -INLINE WindowItem::WindowItem(void) {} - -INLINE WindowItem::WindowItem(const bool h, const bool d, const int o, - const std::string& l, const SetupSyms& s, - const int x, const int y, const bool b, - const bool c, PTA(int) n) : - _hw_chans(h), _dvr(d), - _border(b), _cursor(c), - _chan_offset(o), _sizeX(x), - _sizeY(y), _layout(l), - _setups(s), - _camera_group(n) {} - -INLINE WindowItem::WindowItem(const WindowItem& c) : - _hw_chans(c._hw_chans), - _dvr(c._dvr), - _border(c._border), - _cursor(c._cursor), - _chan_offset(c._chan_offset), - _sizeX(c._sizeX), - _sizeY(c._sizeY), - _layout(c._layout), - _setups(c._setups), - _camera_group(c._camera_group) {} - -INLINE WindowItem::~WindowItem(void) {} - -INLINE WindowItem& WindowItem::operator=(const WindowItem& c) { - _hw_chans = c._hw_chans; - _dvr = c._dvr; - _border = c._border; - _cursor = c._cursor; - _chan_offset = c._chan_offset; - _sizeX = c._sizeX; - _sizeY = c._sizeY; - _layout = c._layout; - _setups = c._setups; - _camera_group = c._camera_group; - return *this; -} - -INLINE bool WindowItem::getHWChans(void) const { - return _hw_chans; -} - -INLINE bool WindowItem::getDVR(void) const { - return _dvr; -} - -INLINE bool WindowItem::getBorder(void) const { - return _border; -} - -INLINE bool WindowItem::getCursor(void) const { - return _cursor; -} - -INLINE int WindowItem::getChanOffset(void) const { - return _chan_offset; -} - -INLINE int WindowItem::getSizeX(void) const { - return _sizeX; -} - -INLINE int WindowItem::getSizeY(void) const { - return _sizeY; -} - -INLINE std::string WindowItem::getLayout(void) const { - return _layout; -} - -INLINE SetupSyms WindowItem::getSetups(void) const { - return _setups; -} - -INLINE int WindowItem::getCameraGroup(int display_region) const { - return _camera_group[display_region]; -} -INLINE int WindowItem::getNumCameraGroups(void) const { - int largestIndex=0; - for(size_t j=0;j<_camera_group.size();j++) - if(_camera_group[j]>largestIndex)largestIndex=_camera_group[j]; - return largestIndex+1; -} diff --git a/panda/src/chancfg/chanwindow.cxx b/panda/src/chancfg/chanwindow.cxx deleted file mode 100644 index 4826036d4f..0000000000 --- a/panda/src/chancfg/chanwindow.cxx +++ /dev/null @@ -1,161 +0,0 @@ -// Filename: chanwindow.cxx -// Created by: cary (06Feb99) -// -//////////////////////////////////////////////////////////////////// -// -// PANDA 3D SOFTWARE -// Copyright (c) 2001, Disney Enterprises, Inc. All rights reserved -// -// All use of this software is subject to the terms of the Panda 3d -// Software license. You should have received a copy of this license -// along with this source code; you will also find a current copy of -// the license at http://www.panda3d.org/license.txt . -// -// To contact the maintainers of this program write to -// panda3d@yahoogroups.com . -// -//////////////////////////////////////////////////////////////////// - -#include "chanwindow.h" -#include "chanparse.h" -#include "chanshare.h" - -#include "notify.h" - -WindowType* WindowDB = (WindowType*)0; - -class WindowParseFunctor : public ChanParseFunctor { -public: - INLINE WindowParseFunctor(void) : ChanParseFunctor() {} - virtual ~WindowParseFunctor(void); - - virtual void operator()(std::string); -}; - -WindowParseFunctor::~WindowParseFunctor(void) { - return; -} - -void WindowParseFunctor::operator()(std::string S) { - std::string sym; - - ChanEatFrontWhite(S); - sym = ChanReadNextWord(S); - ChanCheckScoping(S); - ChanDescope(S); - - //KEH temp - //bool hw_chans = ChanReadNextBool(S); - //bool dvr = ChanReadNextBool(S); - //int hw_chan_offset = ChanReadNextInt(S); - std::string layout = ChanReadNextWord(S); - SetupSyms sv; - PTA(int) cameraGroup; - int group_index=0; - { - ChanCheckScoping(S); - int i=ChanMatchingParen(S); - std::string setupSubstring = S.substr(1,i-2); - S.erase(0,i); - ChanEatFrontWhite(setupSubstring); - - while (!setupSubstring.empty()) { - - ChanCheckScoping(setupSubstring); - std::string groupSubstring = setupSubstring; - //get the group substring - int iend = setupSubstring.find_first_of(")"); - groupSubstring = setupSubstring.substr(1,iend-1); - //then erase that portion from the setup string - setupSubstring.erase(0,iend+1); - ChanEatFrontWhite(setupSubstring); - - while (!groupSubstring.empty()) { - - int region_number = ChanReadNextInt(groupSubstring); - if(region_number<0) { - nout <<"Trying to read region index, which should be >= 0, "; - nout << "but got "<debug() << "parsed a window called '" << sym << "':" << endl; - chancfg_cat->debug() << " do" << (W.getHWChans()?" ":" not ") - << "use HW channels" << endl; - chancfg_cat->debug() << " do" << (W.getDVR()?" ":" not ") << "use DVR" - << endl; - chancfg_cat->debug() << " do" << (W.getBorder()?" ":" not ") - << "have a border" << endl; - chancfg_cat->debug() << " do" << (W.getCursor()?" ":" not ") - << "have a cursor" << endl; - chancfg_cat->debug() << " HW channel offset: " << W.getChanOffset() - << endl; - chancfg_cat->debug() << " prefered window size: (" << W.getSizeX() - << ", " << W.getSizeY() << ")" << endl; - chancfg_cat->debug() << " layout: '" << W.getLayout() << "'" << endl; - chancfg_cat->debug() << " setups:" << endl; - SetupSyms q(W.getSetups()); - for (SetupSyms::iterator r=q.begin(); r!=q.end(); ++r) - chancfg_cat->debug() << " '" << *r << "'" << endl; - } - (*WindowDB)[sym] = W; -} - -void ResetWindow() { - if (WindowDB != (WindowType *)NULL) { - delete WindowDB; - } - WindowDB = new WindowType; -} - -void ParseWindow(istream& is) { - WindowParseFunctor w; - ChanParse(is, &w); -} diff --git a/panda/src/chancfg/chanwindow.h b/panda/src/chancfg/chanwindow.h deleted file mode 100644 index 440f23061a..0000000000 --- a/panda/src/chancfg/chanwindow.h +++ /dev/null @@ -1,69 +0,0 @@ -// Filename: chanwindow.h -// Created by: cary (06Feb99) -// -//////////////////////////////////////////////////////////////////// -// -// PANDA 3D SOFTWARE -// Copyright (c) 2001, Disney Enterprises, Inc. All rights reserved -// -// All use of this software is subject to the terms of the Panda 3d -// Software license. You should have received a copy of this license -// along with this source code; you will also find a current copy of -// the license at http://www.panda3d.org/license.txt . -// -// To contact the maintainers of this program write to -// panda3d@yahoogroups.com . -// -//////////////////////////////////////////////////////////////////// - -#ifndef __CHANWINDOW_H__ -#define __CHANWINDOW_H__ - -#include "pandabase.h" - -#include "pmap.h" -#include "pvector.h" -#include -#include "chansetup.h" -#include - -class WindowItem { -private: - bool _hw_chans, _dvr, _border, _cursor; - int _chan_offset, _sizeX, _sizeY; - std::string _layout; - SetupSyms _setups; - PTA(int) _camera_group; -public: - INLINE WindowItem(); - INLINE WindowItem(const bool, const bool, const int, const std::string&, - const SetupSyms&, const int, const int, const bool, - const bool, PTA(int) ); - INLINE WindowItem(const WindowItem&); - INLINE ~WindowItem(); - - INLINE WindowItem& operator=(const WindowItem&); - - INLINE bool getHWChans() const; - INLINE bool getDVR() const; - INLINE bool getBorder() const; - INLINE bool getCursor() const; - INLINE int getChanOffset() const; - INLINE int getSizeX() const; - INLINE int getSizeY() const; - INLINE std::string getLayout() const; - INLINE SetupSyms getSetups() const; - INLINE int getCameraGroup(int display_region) const; - INLINE int getNumCameraGroups() const; -}; - -typedef pmap WindowType; - -extern WindowType* WindowDB; - -void ResetWindow(); -void ParseWindow(istream&); - -#include "chanwindow.I" - -#endif /* __CHANWINDOW_H__ */ diff --git a/panda/src/chancfg/layout_db b/panda/src/chancfg/layout_db deleted file mode 100644 index adececeec1..0000000000 --- a/panda/src/chancfg/layout_db +++ /dev/null @@ -1,260 +0,0 @@ -;; Filename: layout_db -;; Created by: cary (07Feb99) -;; -;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -;; Copyright (C) 1992,93,94,95,96,97 Walt Disney Imagineering, Inc. -;; -;; These coded instructions, statements, data structures and -;; computer programs contain unpublished proprietary information of -;; Walt Disney Imagineering and are protected by Federal copyright -;; law. They may not be disclosed to third parties or copied or -;; duplicated in any form, in whole or in part, without the prior -;; written consent of Walt Disney Imagineering Inc. -;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -;; - -;;;*Description -;;; The channel layout database. -;;; -;;; The layout specifies how a region is divided up into sup-regions, and -;;; what order we want to talk about them. -;;; -;;; The format for a layout is: -;;; layout m x n rgn rgn rgn -;;; name dicing spec spec spec -;;; (string (int int (---) (---) (---) ...)) -;;; -;;; * There may be an arbitrary number of region specs, though regions are -;;; not allowed to overlap. If they do, this will be detected and an -;;; error will be thrown. -;;; * 'm' is horizontal, 'n' is vertical -;;; -;;; The format for a region spec is: -;;; m x n lower -;;; size left -;;; (int int int) -;;; -;;; * 'Lower left' is the cell index of the lower left corner of the region. -;;; * Cell indexes are 0-based, and start in the lower left corner of the -;;; parent region/window. -;;; * 'm' is horizontal, 'n' is vertical -;;;. - -;;;*Public - -;; -------- -;; | | -;; | 1 | -;; | | -;; -------- -;; -;; 1x1 -(layout1x1 (1 1)) - -;; -------- -;; | | -;; | 2 | -;; | | -;; |------| -;; | | -;; | 1 | -;; | | -;; -------- -;; -;; 1x2 -(layout1x2 (1 2)) - -;; --------------- -;; | | | -;; | 1 | 2 | -;; | | | -;; --------------- -;; -;; 2x1 -(layout2x1 (2 1)) - -;; --------------- -;; | | | -;; | 3 | 4 | -;; | | | -;; |-------------| -;; | | | -;; | 1 | 2 | -;; | | | -;; --------------- -;; -;; 2x2 -(layout2x2 (2 2)) - -;; --------------- -;; | | | -;; | X | 1 | -;; | | | -;; |-------------| -;; | | | -;; | 2 | 3 | -;; | | | -;; --------------- -;; -;; 2x2 -(layout2x2-vflip-2last (2 2 (1 1 3) (1 1 0) (1 1 1))) - -;; --------------- -;; | | -;; | 5 | -;; | | -;; |-------------| -;; | | | -;; | 3 | 4 | -;; | | | -;; |-------------| -;; | | | -;; | 1 | 2 | -;; | | | -;; --------------- -;; -;; 2x3-1+2x2 -(layout2x3-1+2x2 (2 3 (1 1 0) (1 1 1) (1 1 2) (1 1 3) (2 1 4))) - -;; --------------- -;; | | -;; | | -;; | | -;; | 5 | -;; | | -;; | | -;; | | -;; |-------------| -;; | | | -;; | 3 | 4 | -;; | | | -;; |-------------| -;; | | | -;; | 1 | 2 | -;; | | | -;; --------------- -;; -;; 2x4-1+2x2 -(layout2x4-1+2x2 (2 4 (1 1 0) (1 1 1) (1 1 2) (1 1 3) (2 2 4))) - -;; ---------------------- -;; | | | | -;; | 1 | 2 | 3 | -;; | | | | -;; ---------------------- -;; -;; 3x1 -(layout3x1 (3 1)) - -;; -------- -;; | | -;; | 1 | -;; | | -;; -------- -;; | | -;; | 2 | -;; | | -;; -------- -;; | | -;; | 3 | -;; | | -;; -------- -;; -;; 1x3 -(layout1x3 (1 3)) - -;; ---------------------- -;; | | | | -;; | 4 | 5 | 6 | -;; | | | | -;; |--------------------| -;; | | | | -;; | 1 | 2 | 3 | -;; | | | | -;; ---------------------- -;; -;; 3x2 -(layout3x2 (3 2)) - -;; ----------------------------- -;; | | | | | -;; | 1 | 2 | 3 | 4 | -;; | | | | | -;; ----------------------------- -;; -;; 4x1 -(layout4x1 (4 1)) - -;; ------------------------------------ -;; | | | | | | -;; | 1 | 2 | 3 | 4 | 5 | -;; | | | | | | -;; ------------------------------------ -;; -;; 5x1 -(layout5x1 (5 1)) - -;; ------------------------------------ -;; | | | | | | -;; | 1 | 2 | 3 | 4 | 5 | -;; | | | | | | -;; ------------------------------------ -;; | | | | | | -;; | 6 | 7 | 8 | 9 | 10 | -;; | | | | | | -;; ------------------------------------ -;; -;; 5x2 -(layout5x2 (5 2)) - -;; ---------------------- -;; | | -;; | 4 | -;; | | -;; |--------------------| -;; | | | | -;; | 1 | 2 | 3 | -;; | | | | -;; ---------------------- -;; -;; 3x2-1+3x1 -(layout3x2-1+3x1 (3 2 (1 1 0) (1 1 1) (1 1 2) (3 1 3))) - -;; ---------------------- -;; | | | | -;; | 3 | 4 | 5 | -;; | | | | -;; |--------------------| -;; | | | | -;; | 6 | 1 | 2 | -;; | | | | -;; ---------------------- -;; -;; 3x2 -(layout3x2-0last (3 2 (1 1 1) (1 1 2) (1 1 3) (1 1 4) (1 1 5))) - -;; ----------------------------- -;; | | | | | -;; | 13 | 14 | 15 | 16 | -;; | | | | | -;; ----------------------------- -;; | | | | | -;; | 9 | 10 | 11 | 12 | -;; | | | | | -;; ----------------------------- -;; | | | | | -;; | 5 | 6 | 7 | 8 | -;; | | | | | -;; ----------------------------- -;; | | | | | -;; | 1 | 2 | 3 | 4 | -;; | | | | | -;; ----------------------------- -;; -;; 4x4 -(layout4x4 (4 4)) - -;; misc - -;;;*Private - diff --git a/panda/src/chancfg/setup_db b/panda/src/chancfg/setup_db deleted file mode 100644 index 31fd50facb..0000000000 --- a/panda/src/chancfg/setup_db +++ /dev/null @@ -1,73 +0,0 @@ -;; Filename: setup_db -;; Created by: cary (07Feb99) -;; -;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -;; Copyright (C) 1992,93,94,95,96,97 Walt Disney Imagineering, Inc. -;; -;; These coded instructions, statements, data structures and -;; computer programs contain unpublished proprietary information of -;; Walt Disney Imagineering and are protected by Federal copyright -;; law. They may not be disclosed to third parties or copied or -;; duplicated in any form, in whole or in part, without the prior -;; written consent of Walt Disney Imagineering Inc. -;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -;; - -;;;*Description -;;; setup database -;;; -;;; The Setup specifies how a given region is to be configured, or further -;;; divided. -;;; -;;; Abbreviations used below are: -;;; ofs - offset -;;; rgn - region -;;; -;;; The format for a setup is: -;;; setup mono view- FOV orientation -;;; name ster port -;;; (string (bool (---) bool/float/list [direction])) -;;; * The viewport specification allows you to render to less than the -;;; full display region. -;;; -;;; The format for a viewport is: -;;; left right bottom top -;;; (float float float float) -;;; -;;; * these are fractions in the range 0. - 1. and are relative to -;;; the local region. -;;; * a full region would be (0. 1. 0. 1.) -;;; -;;; * If a single value is given for the FOV, it is the horizontal field -;;; of view. The vertical field of view is calculated from that if not -;;; given. The field of view is for the specified viewport. -;;; * Orientation specifies which edge will actually end up on the top -;;; of the display. The horizontal FOV will be the horizontal FOV -;;; AFTER rotation, i.e. as you see it on the actual display device. -;;; For example: In the modelling cave, which uses a "left" orientation, -;;; the image shows up sideways on the console so that is shows up -;;; correctly in the actual cave. The horizontal FOV is horizontal -;;; in the cave, vertical on the console. -;;; * The orientation can have the valid values of: up, down, left, right. -;;; -;;; - -;;;. - -;;;*Public - -(setup-mono-plain (#f (0. 1. 0. 1.) #f)) -(setup-mono-right (#f (0. 1. 0. 1.) #f right)) -(setup-mono-left (#f (0. 1. 0. 1.) #f left)) -(setup-mono-down (#f (0. 1. 0. 1.) #f down)) -(setup-stereo-plain (#t (0. 1. 0. 1.) #f)) -(setup-stereo-right (#t (0. 1. 0. 1.) #f right)) -(setup-stereo-left (#t (0. 1. 0. 1.) #f left)) -(setup-pronto-plain (#f (0. 1. 0.1 0.9) 114.)) -(setup-mono-hmd (#f (0. 1. 0. 1.) (90. 73.74))) -(setup-mono-wide (#f (0. 1. 0. 1.) 180.)) -(setup-mono-wide-vptrim (#f (0. 1. 0.667 1.) 180.)) -(setup-mono-wide-vptrim2 (#f (0. 1. 0.5 1.) 180.)) - -;;;*Private - diff --git a/panda/src/chancfg/test_chancfg.cxx b/panda/src/chancfg/test_chancfg.cxx deleted file mode 100644 index ca85eb221b..0000000000 --- a/panda/src/chancfg/test_chancfg.cxx +++ /dev/null @@ -1,23 +0,0 @@ -// Filename: test_chancfg.cxx -// Created by: shochet (02Feb00) -// -//////////////////////////////////////////////////////////////////// -// -// PANDA 3D SOFTWARE -// Copyright (c) 2001, Disney Enterprises, Inc. All rights reserved -// -// All use of this software is subject to the terms of the Panda 3d -// Software license. You should have received a copy of this license -// along with this source code; you will also find a current copy of -// the license at http://www.panda3d.org/license.txt . -// -// To contact the maintainers of this program write to -// panda3d@yahoogroups.com . -// -//////////////////////////////////////////////////////////////////// - -#include "chancfg.h" - -int main() { - return 0; -} diff --git a/panda/src/chancfg/window_db b/panda/src/chancfg/window_db deleted file mode 100644 index b35993e148..0000000000 --- a/panda/src/chancfg/window_db +++ /dev/null @@ -1,74 +0,0 @@ -;; Filename: chan_db -;; Created by: cary (07Feb99) -;; -;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -;; Copyright (C) 1992,93,94,95,96,97 Walt Disney Imagineering, Inc. -;; -;; These coded instructions, statements, data structures and -;; computer programs contain unpublished proprietary information of -;; Walt Disney Imagineering and are protected by Federal copyright -;; law. They may not be disclosed to third parties or copied or -;; duplicated in any form, in whole or in part, without the prior -;; written consent of Walt Disney Imagineering Inc. -;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -;; - -;;;*Description -;;; The window config database. -;;; -;;; The window config specifies globally how the window is to be configured, -;;; it's default size, which layouts and setups to use, etc. -;;; -;;; Abbreviations used below are: -;;; PVC - Pipe Video Chanel -;;; ofs - offset -;;; rgn - region -;;; -;;; The format for a config is: -;;; window lay- set- default bor- cur- PVC -;;; name out ups size der sor offset -;;; (string ((---) (({int setup}+)+) (int int) bool bool [int] )) -;;; -;;; * The use of Pipe Video Channels is indicated by specifying a PVC offset.;;; The PVC offset will give the first chanel number to be used for -;;; channels that allow default assignment (see setup below). -;;; * Setups is an arbitrarilly long list of setup specs. Any region that -;;; does not have a coresponding setup, does not get configured. There is -;;; an index associated with each setup from the range of 0 to the number -;;; of display regions minus one. The display regions are divided into -;;; groups by the use of the parenthesis. Note that he '{' and '}' above -;;; are for showing that the int and setup values come in pairs, and are -;;; not literally part of the format. -;;;. - -;;;*Public - -(single (layout1x1 ((0 setup-mono-plain)) (640 480) #t #t)) -(single+god (layout2x1 ((0 setup-mono-plain)(1 setup-mono-plain)) - (640 480) #t #t)) -(cave2 (layout2x1 ((0 setup-mono-plain 1 setup-mono-plain)) - (1280 512) #t #t)) -(cave3 (layout3x1 ((0 setup-mono-plain 1 setup-mono-plain - 2 setup-mono-plain)) (720 320) #t #t)) -(cave3+god (layout3x2-1+3x1 ((0 setup-mono-plain 1 setup-mono-plain - 2 setup-mono-plain) (3 setup-mono-plain)) - (720 640) #t #t)) -(cave3passive (layout3x2 ((0 setup-mono-plain 1 setup-mono-plain - 2 setup-mono-plain 3 setup-mono-plain - 4 setup-mono-plain 5 setup-mono-plain)) - (720 640) #t #t)) -(cave5passive (layout5x2 ((0 setup-mono-plain 1 setup-mono-plain - 2 setup-mono-plain 3 setup-mono-plain - 4 setup-mono-plain 5 setup-mono-plain - 6 setup-mono-plain 7 setup-mono-plain - 8 setup-mono-plain 9 setup-mono-plain)) - (720 640) #t #t)) -(mono-modelcave-pipe0 (layout2x2-vflip-2last ((0 setup-mono-cave 1 setup-mono-cave - 2 setup-mono-cave)) (1280 1440) #f #t)) -(mono-modelcave-pipe1 (layout1x2 ((0 setup-mono-cave 1 setup-mono-cave)) - (640 960) #f #f)) -(mono-cave (layout3x2 ((0 setup-mono-cave 1 setup-mono-cave - 2 setup-mono-cave 3 setup-mono-cave - 4 setup-mono-cave 5 setup-mono-cave)) - (1920 960) #f #t)) - - diff --git a/panda/src/framework/Sources.pp b/panda/src/framework/Sources.pp index 30942f3bf7..90d9d18fca 100644 --- a/panda/src/framework/Sources.pp +++ b/panda/src/framework/Sources.pp @@ -5,7 +5,7 @@ #define TARGET framework #define BUILDING_DLL BUILDING_FRAMEWORK #define LOCAL_LIBS \ - recorder pgui pgraph putil collide chan text chancfg \ + recorder pgui pgraph putil collide chan text \ pnmimage pnmimagetypes event #define SOURCES \ diff --git a/panda/src/testbed/Sources.pp b/panda/src/testbed/Sources.pp index 95d39e642c..997c259763 100644 --- a/panda/src/testbed/Sources.pp +++ b/panda/src/testbed/Sources.pp @@ -2,7 +2,7 @@ dtoolutil:c dtoolbase:c dtool:m pystub #define LOCAL_LIBS \ - framework putil collide pgraph chan text chancfg \ + framework putil collide pgraph chan text \ pnmimage pnmimagetypes event effects gobj display \ mathutil putil express dgraph device tform \ linmath pstatclient panda