remove chancfg

This commit is contained in:
David Rose 2004-02-12 16:20:05 +00:00
parent 284fe2d2f6
commit 15d7d45b8b
30 changed files with 3 additions and 2711 deletions

View File

@ -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 \

View File

@ -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

View File

@ -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;
}

View File

@ -1,2 +0,0 @@
ignorefile chanlayout.h chanlayout.I chansetup.h chansetup.I
ignorefile chanwindow.h chanwindow.I

View File

@ -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 <algorithm>
#include <stdio.h> // 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;icam<W.getNumCameraGroups();icam++) {
char dummy[10];//if more than 10^11 groups, you've got bigger problems
sprintf(dummy,"%d",icam);
std::string nodeName = "camera";
nodeName.append(dummy);
camera[icam] = new PandaNode(nodeName);
}
for (j=0, k=S.begin(); j<i; ++j, ++k) {
ChanViewport v(ChanScaleViewport(V, L[j]));
PT(GraphicsChannel) chan;
if ((*k).getHWChan() && W.getHWChans()) {
if ((*k).getChan() == -1) {
chan = win->get_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();
}

View File

@ -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<Field, Types> 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<SetupItem> SVec;
class EXPCL_PANDA ChanConfig
{
private:
std::vector< PT(PandaNode) > _group_node;
std::vector< PT(DisplayRegion) > _display_region;
std::vector<int> _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__ */

View File

@ -1,4 +0,0 @@
#include "chancfg.cxx"

View File

@ -1,6 +0,0 @@
#include "chanlayout.cxx"
#include "chanparse.cxx"
#include "chansetup.cxx"
#include "chanwindow.cxx"

View File

@ -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

View File

@ -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];
}

View File

@ -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<bool> 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; j<y+n; ++j)
for (int k=x; k<x+m; ++k)
if (mask[(j*X)+k])
ok = false;
else
mask[(j*X)+k] = true;
if (ok) {
ChanViewport l((x*xfrac), ((x+m)*xfrac), (y*yfrac), ((y+n)*yfrac));
L.AddRegion(l);
} else {
nout << "error, region (" << m << " " << n << " " << start
<< ") overlaps another. It is being skipped." << endl;
}
}
for (i=0; i<(X*Y); ++i)
if (!mask[i]) {
// an otherwise unaccounted for sub-region
int x = i % X;
int y = (i - x) / X;
ChanViewport l((x*xfrac), ((x+1)*xfrac), (y*yfrac), ((y+1)*yfrac));
L.AddRegion(l);
}
if (chancfg_cat.is_debug()) {
chancfg_cat->debug() << "parsed a layout called '" << sym << "':" << endl;
chancfg_cat->debug() << " " << L.GetNumRegions() << " regions" << endl;
for (int q=0; q<L.GetNumRegions(); ++q) {
const ChanViewport& v = L[q];
chancfg_cat->debug() << " 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);
}

View File

@ -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 <algorithm>
#include <string>
#include "chanviewport.h"
typedef pvector<ChanViewport> 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<std::string, LayoutItem> LayoutType;
extern LayoutType* LayoutDB;
void ResetLayout();
void ParseLayout(istream&);
#include "chanlayout.I"
#endif /* __CHANLAYOUT_H__ */

View File

@ -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;
}

View File

@ -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;
}

View File

@ -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 <string>
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__ */

View File

@ -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;
}

View File

@ -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);
}

View File

@ -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 <vector_string.h>
#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<std::string, SetupItem> SetupType;
extern SetupType* SetupDB;
void ResetSetup();
void ParseSetup(istream&);
#include "chansetup.I"
#endif /* __CHANSETUP_H__ */

View File

@ -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__ */

View File

@ -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 <algorithm>
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; }

View File

@ -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__ */

View File

@ -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;
}

View File

@ -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 "<<region_number<<"."<<endl;
nout << "Ignoring this entry."<<endl;
ChanReadNextWord(groupSubstring); //slurp it up, but ignore it.
} else {
//0 based. We don't know yet how much room we actually need
//as the information is in the un-analyzed layout. cameraGroup
//and sv are handled the same in this manner.
while((int)sv.size() < region_number+1) {
sv.push_back("");
cameraGroup.push_back(0);
}
std::string stmp2 = ChanReadNextWord(groupSubstring);
sv[region_number]=stmp2;
cameraGroup[region_number]=group_index;
}
}
group_index++;
}
}
int X, Y;
{
ChanEatFrontWhite(S);
ChanCheckScoping(S);
int i = S.find_first_of(")");
std::string screenSubstring = S.substr(1, i-1);
S.erase(0, i+1);
ChanEatFrontWhite(S);
X = ChanReadNextInt(screenSubstring);
Y = ChanReadNextInt(screenSubstring);
}
bool border = ChanReadNextBool(S);
bool cursor = ChanReadNextBool(S);
//KEH
bool hw_chans = false;
int hw_chan_offset = 0;
bool dvr = false;
if (!S.empty()) {
hw_chan_offset = ChanReadNextInt(S);
hw_chans = true;
}
if (!S.empty()) {
// error, should have consumed all of the data by now
nout << "error, trailing text in window spec '" << S << "'" << endl;
S.erase(0, std::string::npos);
}
WindowItem W(hw_chans, dvr, hw_chan_offset, layout, sv, X, Y, border,
cursor, cameraGroup);
if (chancfg_cat.is_debug()) {
chancfg_cat->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);
}

View File

@ -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 <string>
#include "chansetup.h"
#include <pta_int.h>
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<std::string, WindowItem> WindowType;
extern WindowType* WindowDB;
void ResetWindow();
void ParseWindow(istream&);
#include "chanwindow.I"
#endif /* __CHANWINDOW_H__ */

View File

@ -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

View File

@ -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

View File

@ -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;
}

View File

@ -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))

View File

@ -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 \

View File

@ -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