*** empty log message ***

This commit is contained in:
David Rose
2001-02-01 19:37:34 +00:00
parent 6dba71307a
commit 27d8bd1711
18 changed files with 277 additions and 64 deletions

View File

@@ -292,6 +292,44 @@
#defer HAVE_MAYA $[isdir $[MAYA_LOCATION]]
// Define this to generate static libraries and executables, rather than
// dynamic libraries.
//#define LINK_ALL_STATIC yes
// Define this to export the templates from the DLL. This is only
// meaningful if LINK_ALL_STATIC is not defined, and we are building
// on Windows. This can only be used if VC++ is the compiler in
// use, since other compilers don't support the syntax.
#defer EXPORT_TEMPLATES $[eq $[USE_COMPILER],MSVC]
// Define this to explicitly link in the various external drivers, which
// are normally separate, as part of the Panda library.
//#define LINK_IN_GL yes
//#define LINK_IN_DX yes
//#define LINK_IN_EGG yes
//#define LINK_IN_PHYSICS yes
// Define USE_COMPILER to switch the particular compiler that should
// be used. A handful of tokens are recognized, depending on BUILD_TYPE.
// This may also be further customized within Global.$[BUILD_TYPE].pp.
// If BUILD_TYPE is "unix", this may be one of:
// GCC (gcc/g++)
// MIPS (Irix MIPSPro compiler)
//
// If BUILD_TYPE is "msvc" or "gmsvc", this may be one of:
// MSVC (Microsoft Visual C++)
// BOUNDS (BoundsChecker)
// INTEL (Intel C/C++ compiler)e
#if $[eq $[PLATFORM], Irix]
#define USE_COMPILER MIPS
#elif $[eq $[PLATFORM], Linux]
#define USE_COMPILER GCC
#elif $[eq $[PLATFORM], Windows]
#define USE_COMPILER MSVC
#endif
///////////////////////////////////////////////////////////////////////
// The following variables are meaningful when BUILD_TYPE is "unix" or
// "msvc". They define a few environmental things.

View File

@@ -85,6 +85,16 @@ $[cdefine HAVE_NET]
/* Define if we want to compile the audio code. */
$[cdefine HAVE_AUDIO]
/* Define if we want to export template classes from the DLL. Only
makes sense to MSVC++. */
$[cdefine EXPORT_TEMPLATES]
/* Define if we are linking PANDAGL in with PANDA. */
$[cdefine LINK_IN_GL]
/* Define if we are linking PANDAPHYSICS in with PANDA. */
$[cdefine LINK_IN_PHYSICS]
/* Define if we have a gettimeofday() function. */
$[cdefine HAVE_GETTIMEOFDAY]

View File

@@ -62,7 +62,6 @@
#else
#define BROWSEINFO_FLAG
#endif
#defer CFLAGS_SHARED
// Define LINK_ALL_STATIC to generate static libs instead of DLL's.
#if $[LINK_ALL_STATIC]
@@ -75,32 +74,52 @@
#define dlllib dll
#endif
#defer OPTFLAGS /O2 /Ob1 /Ogity /G6
#define CFLAGS_SHARED
#if $[eq $[USE_COMPILER], MSVC]
#define COMPILER cl
#define LINKER link
#define LIBBER lib
#define COMMONFLAGS /Gi-
#define OPTFLAGS /O2 /Ob1 /Ogity /G6
#define DEBUGFLAGS /MDd /Zi $[BROWSEINFO_FLAG] /Fd"$[osfilename $[target:%.obj=%.pdb]]"
#define RELEASEFLAGS /MD
#define EXTRA_LIBPATH
#elif $[eq $[USE_COMPILER], BOUNDS]
#define COMPILER nmcl
#define LINKER nmlink
#define LIBBER lib
#define COMMONFLAGS
#define OPTFLAGS /O2 /Ogity /G6
#define DEBUGFLAGS /MDd /Zi $[BROWSEINFO_FLAG] /Fd"$[osfilename $[target:%.obj=%.pdb]]"
#define RELEASEFLAGS /MD
#define EXTRA_LIBPATH
#elif $[eq $[USE_COMPILER], INTEL]
#define COMPILER icl
#define LINKER xilink
#define LIBBER xilib
#define COMMONFLAGS /Gi-
#define OPTFLAGS /O3 /Ob1 /Ogity /G6 /Qip
#define DEBUGFLAGS /MDd /Zi $[BROWSEINFO_FLAG]
#define RELEASEFLAGS /MD
// We assume the Intel compiler installation dir is mounted as /ia32.
#define EXTRA_LIBPATH /ia32/lib
#else
#error Invalid value specified for USE_COMPILER.
#endif
#defer CDEFINES_OPT1 _DEBUG $[dlink_all_static]
#defer CDEFINES_OPT2 _DEBUG $[dlink_all_static]
#defer CDEFINES_OPT3 $[dlink_all_static]
#defer CDEFINES_OPT4 NDEBUG $[dlink_all_static]
#defer CFLAGS_OPT1 $[CDEFINES_OPT1:%=/D%] /MDd /Gi- /Zi $[BROWSEINFO_FLAG] /Fd"$[osfilename $[target:%.obj=%.pdb]]"
#defer CFLAGS_OPT2 $[CDEFINES_OPT2:%=/D%] /MDd /Gi- /Zi $[BROWSEINFO_FLAG] /Fd"$[osfilename $[target:%.obj=%.pdb]]"
#defer CFLAGS_OPT3 $[CDEFINES_OPT3:%=/D%] /MD /Gi-
#defer CFLAGS_OPT4 $[CDEFINES_OPT4:%=/D%] /MD /Gi-
#defer COMPILER cl
#defer LINKER link
// Define USE_BOUNDSCHECKER for BoundsChecker instrumentaion:
#if $[USE_BOUNDSCHECKER]
#defer CFLAGS_OPT1 $[CDEFINES_OPT1:%=/D%] /MDd /GZ /Zi $[BROWSEINFO_FLAG] /Fd"$[osfilename $[target:%.obj=%.pdb]]"
#defer CFLAGS_OPT2 $[CDEFINES_OPT2:%=/D%] /MDd /Zi $[BROWSEINFO_FLAG] /Fd"$[osfilename $[target:%.obj=%.pdb]]"
#defer CFLAGS_OPT3 $[CDEFINES_OPT3:%=/D%] /MD
#defer CFLAGS_OPT4 $[CDEFINES_OPT4:%=/D%] /MD
#defer OPTFLAGS /O2 /Ogity /G6
#defer COMPILER nmcl
#defer LINKER nmlink
#endif
#defer CFLAGS_OPT1 $[CDEFINES_OPT1:%=/D%] $[COMMONFLAGS] $[DEBUGFLAGS]
#defer CFLAGS_OPT2 $[CDEFINES_OPT2:%=/D%] $[COMMONFLAGS] $[DEBUGFLAGS] $[OPTFLAGS]
#defer CFLAGS_OPT3 $[CDEFINES_OPT3:%=/D%] $[COMMONFLAGS] $[RELEASEFLAGS] $[OPTFLAGS]
#defer CFLAGS_OPT4 $[CDEFINES_OPT4:%=/D%] $[COMMONFLAGS] $[RELEASEFLAGS] $[OPTFLAGS]
// NODEFAULTLIB ensures static libs linked in will connect to the correct msvcrt, so no debug/release mixing occurs
#defer LDFLAGS_OPT1 /debug /incremental:no /NODEFAULTLIB:MSVCRT.LIB /WARN:3
@@ -130,15 +149,15 @@
#defer COMPILE_C $[COMPILER] /nologo /c /Fo"$[osfilename $[target]]" $[decygwin %,/I"%",$[ipath]] $[flags] $[extra_cflags] $[source]
#defer COMPILE_C++ $[COMPILE_C]
#defer STATIC_LIB_C lib /nologo $[sources] /OUT:"$[osfilename $[target]]"
#defer STATIC_LIB_C $[LIBBER] /nologo $[sources] /OUT:"$[osfilename $[target]]"
#defer STATIC_LIB_C++ $[STATIC_LIB_C]
#defer ver_resource $[directory]\ver.res
#defer SHARED_LIB_C $[LINKER] /nologo /dll $[LDFLAGS_OPT$[OPTIMIZE]] $[sources] "$[ver_resource]" $[decygwin %,/LIBPATH:"%",$[lpath]] $[patsubst %.lib,%.lib,%,lib%.lib,$[libs]] /OUT:"$[osfilename $[target]]"
#defer SHARED_LIB_C $[LINKER] /nologo /dll $[LDFLAGS_OPT$[OPTIMIZE]] $[sources] "$[ver_resource]" $[decygwin %,/LIBPATH:"%",$[lpath] $[EXTRA_LIBPATH]] $[patsubst %.lib,%.lib,%,lib%.lib,$[libs]] /OUT:"$[osfilename $[target]]"
#defer SHARED_LIB_C++ $[SHARED_LIB_C]
#defer LINK_BIN_C $[LINKER] /nologo $[LDFLAGS_OPT$[OPTIMIZE]] $[sources] $[decygwin %,/LIBPATH:"%",$[lpath]] $[patsubst %.lib,%.lib,%,lib%.lib,$[libs]] /OUT:"$[osfilename $[target]]"
#defer LINK_BIN_C $[LINKER] /nologo $[LDFLAGS_OPT$[OPTIMIZE]] $[sources] $[decygwin %,/LIBPATH:"%",$[lpath] $[EXTRA_LIBPATH]] $[patsubst %.lib,%.lib,%,lib%.lib,$[libs]] /OUT:"$[osfilename $[target]]"
#defer LINK_BIN_C++ $[LINK_BIN_C]
#if $[LINK_ALL_STATIC]

View File

@@ -63,7 +63,7 @@ using namespace std;
#define INLINE inline
#endif
#if defined(WIN32_VC) && !defined(LINK_ALL_STATIC)
#if defined(WIN32_VC) && !defined(LINK_ALL_STATIC) && defined(EXPORT_TEMPLATES)
// This macro must be used to export an instantiated template class
// from a DLL. If the template class name itself contains commas, it
// may be necessary to first define a macro for the class name, to

View File

@@ -21,6 +21,19 @@
#define LOCAL_LIBS downloader event ipc express pandabase
#define OTHER_LIBS dtoolconfig dtool
#if $[LINK_IN_GL]
#define BUILDING_DLL $[BUILDING_DLL] BUILDING_PANDAGL
#define COMPONENT_LIBS $[COMPONENT_LIBS] \
glgsg glxdisplay wgldisplay glutdisplay \
sgidisplay sgiglxdisplay sgiglutdisplay
#endif
#if $[LINK_IN_PHYSICS]
#define BUILDING_DLL $[BUILDING_DLL] BUILDING_PANDAPHYSICS
#define COMPONENT_LIBS $[COMPONENT_LIBS] \
physics particlesystem
#endif
#begin metalib_target
#define TARGET panda

View File

@@ -12,6 +12,18 @@
#include <config_pstats.h>
#include <config_sgraph.h>
#ifdef LINK_IN_GL
#include <config_glgsg.h>
#ifdef HAVE_WGL
#include <config_wgldisplay.h>
#endif
#endif
#ifdef LINK_IN_PHYSICS
#include <config_physics.h>
#include <config_particlesystem.h>
#endif
////////////////////////////////////////////////////////////////////
// Function: init_libpanda
// Description: Initializes the library. This must be called at
@@ -28,4 +40,16 @@ init_libpanda() {
init_libpnmimagetypes();
init_libpstatclient();
init_libsgraph();
#ifdef LINK_IN_GL
init_libglgsg();
#ifdef HAVE_WGL
init_libwgldisplay();
#endif
#endif
#ifdef LINK_IN_PHYSICS
init_libphysics();
init_libparticlesystem();
#endif
}

View File

@@ -1,5 +1,3 @@
#define DIRECTORY_IF_GL yes
// DIR_TYPE "metalib" indicates we are building a shared library that
// consists mostly of references to other shared libraries. Under
// Windows, this directly produces a DLL (as opposed to the regular
@@ -8,10 +6,15 @@
#define DIR_TYPE metalib
#define BUILDING_DLL BUILDING_PANDAGL
#define DIRECTORY_IF_GL yes
#define COMPONENT_LIBS \
glgsg glxdisplay wgldisplay glutdisplay \
sgidisplay sgiglxdisplay sgiglutdisplay
#if $[eq $[LINK_IN_GL],]
// We don't have any components if we're linking the GL library
// directly into Panda.
#define COMPONENT_LIBS \
glgsg glxdisplay wgldisplay glutdisplay \
sgidisplay sgiglxdisplay sgiglutdisplay
#endif
#define LOCAL_LIBS gsgbase display express
#define OTHER_LIBS dtoolconfig dtool
@@ -20,7 +23,6 @@
#define TARGET pandagl
#define SOURCES pandagl.cxx pandagl.h
#define INSTALL_HEADERS pandagl.h
#end metalib_target

View File

@@ -5,11 +5,12 @@
#include "pandagl.h"
#ifndef LINK_IN_GL
#include <config_glgsg.h>
#ifdef HAVE_WGL
#include <config_wgldisplay.h>
#endif
#endif
////////////////////////////////////////////////////////////////////
// Function: init_libpandagl
@@ -21,9 +22,10 @@
////////////////////////////////////////////////////////////////////
void
init_libpandagl() {
#ifndef LINK_IN_GL
init_libglgsg();
#ifdef HAVE_WGL
init_libwgldisplay();
#endif
#endif
}

View File

@@ -7,13 +7,20 @@
#define DIR_TYPE metalib
#define BUILDING_DLL BUILDING_PANDAPHYSICS
#define COMPONENT_LIBS \
physics particlesystem
#if $[eq $[LINK_IN_PHYSICS],]
// We don't have any components if we're linking the Physics library
// directly into Panda.
#define COMPONENT_LIBS \
physics particlesystem
#endif
#define LOCAL_LIBS linmath putil express
#define OTHER_LIBS dtoolconfig dtool
#begin metalib_target
#define TARGET pandaphysics
#define SOURCES pandaphysics.cxx
#define SOURCES pandaphysics.cxx pandaphysics.h
#define INSTALL_HEADERS pandaphysics.h
#end metalib_target

View File

@@ -3,7 +3,25 @@
//
////////////////////////////////////////////////////////////////////
// This is a dummy file whose sole purpose is to give the compiler
// something to compile when making libpandaphysics.so in NO_DEFER mode,
// which generates an empty library that itself links with all the
// other shared libraries that make up libpandaphysics.
#include "pandaphysics.h"
#ifndef LINK_IN_PHYSICS
#include <config_physics.h>
#include <config_particlesystem.h>
#endif
////////////////////////////////////////////////////////////////////
// Function: init_libpandaphysics
// Description: Initializes the library. This must be called at
// least once before any of the functions or classes in
// this library can be used. Normally it will be
// called by the static initializers and need not be
// called explicitly, but special cases exist.
////////////////////////////////////////////////////////////////////
void
init_libpandaphysics() {
#ifndef LINK_IN_PHYSICS
init_libphysics();
init_libparticlesystem();
#endif
}

View File

@@ -0,0 +1,13 @@
// Filename: pandaphysics.h
// Created by: drose (2Jan01)
//
////////////////////////////////////////////////////////////////////
#ifndef PANDAPHYSICS_H
#define PANDAPHYSICS_H
#include <pandabase.h>
EXPCL_PANDAPHYSICS void init_libpandaphysics();
#endif

View File

@@ -35,6 +35,7 @@ static IDirectSound* musicDirectSound = NULL;
// #define MULTI_TO_WIDE(_in, _out) MultiByteToWideChar(CP_ACP, MB_PRECOMPOSED, _in, -1, _out, DMUS_MAX_FILENAME)
#define MULTI_TO_WIDE(x,y) MultiByteToWideChar(CP_ACP, MB_PRECOMPOSED, y, -1, x, _MAX_PATH);
static void update_win(void) {
}
@@ -693,17 +694,22 @@ WinSamplePlaying::WinSamplePlaying(AudioTraits::SoundClass* s)
audio_cat->debug() << "WinSamplePlaying::WinSamplePlaying _data = 0x"
<< (void*)(ws->_data) << " dst = 0x"
<< (void*)dst << endl;
try {
memcpy(dst, ws->_data, ws->_len);
}
catch (...) {
_channel = NULL;
if (audio_cat->is_debug())
audio_cat->debug() << "memcpy failed. dst = 0x" << (void*)dst
<< " data = 0x" << (void*)(ws->_data)
<< " len = " << ws->_len << endl;
return;
}
// The Intel compiler dumps core if we attempt to protect this in a
// try .. catch block. We probably shouldn't be using exception
// handling anyway.
// try {
memcpy(dst, ws->_data, ws->_len);
// }
// catch (...) {
// _channel = NULL;
// if (audio_cat->is_debug())
// audio_cat->debug() << "memcpy failed. dst = 0x" << (void*)dst
// << " data = 0x" << (void*)(ws->_data)
// << " len = " << ws->_len << endl;
// return;
// }
this->unlock();
}

View File

@@ -69,7 +69,11 @@ insert(const NetDatagram &data) {
PR_Lock(_cvlock);
bool enqueue_ok = ((int)_queue.size() < _max_queue_size);
if (enqueue_ok) {
#ifdef __ICL
_queue.push_back(new NetDatagram(data));
#else
_queue.push_back(data);
#endif
}
PR_NotifyCondVar(_cv);
PR_Unlock(_cvlock);
@@ -112,7 +116,13 @@ extract(NetDatagram &result) {
}
nassertr(!_queue.empty(), false);
#ifdef __ICL
NetDatagram *ptr = _queue.front();
result = *ptr;
delete ptr;
#else
result = _queue.front();
#endif
_queue.pop_front();
PR_Unlock(_cvlock);

View File

@@ -36,7 +36,16 @@ public:
private:
PRLock *_cvlock;
PRCondVar *_cv;
deque<NetDatagram> _queue;
#ifdef __ICL
// The Intel compiler for some reason dumps core on a queue of
// NetDatagrams.
typedef deque<NetDatagram *> QueueType;
#else
typedef deque<NetDatagram> QueueType;
#endif
QueueType _queue;
bool _shutdown;
int _max_queue_size;
};

View File

@@ -11,5 +11,24 @@ ConfigureDef(config_particlesystem);
NotifyCategoryDef(particlesystem, "");
ConfigureFn(config_particlesystem) {
init_libparticlesystem();
}
////////////////////////////////////////////////////////////////////
// Function: init_libparticlesystem
// Description: Initializes the library. This must be called at
// least once before any of the functions or classes in
// this library can be used. Normally it will be
// called by the static initializers and need not be
// called explicitly, but special cases exist.
////////////////////////////////////////////////////////////////////
void
init_libparticlesystem() {
static bool initialized = false;
if (initialized) {
return;
}
initialized = true;
}

View File

@@ -13,4 +13,6 @@
ConfigureDecl(config_particlesystem, EXPCL_PANDAPHYSICS, EXPTP_PANDAPHYSICS);
NotifyCategoryDecl(particlesystem, EXPCL_PANDAPHYSICS, EXPTP_PANDAPHYSICS);
extern EXPCL_PANDAPHYSICS void init_libparticlesystem();
#endif // CONFIG_PARTICLESYSTEM_H

View File

@@ -16,6 +16,37 @@ ConfigureDef(config_physics);
NotifyCategoryDef(physics, "");
ConfigureFn(config_physics) {
init_libphysics();
}
const float LinearIntegrator::_max_linear_dt =
config_physics.GetFloat("default_max_linear_dt", 1.0f / 30.0f);
const float AngularIntegrator::_max_angular_dt =
config_physics.GetFloat("default_max_angular_dt", 1.0f / 30.0f);
int LinearNoiseForce::_random_seed =
config_physics.GetInt("default_noise_force_seed", 665);
const float PhysicsObject::_default_terminal_velocity =
config_physics.GetFloat("default_terminal_velocity", 400.0f);
////////////////////////////////////////////////////////////////////
// Function: init_libphysics
// Description: Initializes the library. This must be called at
// least once before any of the functions or classes in
// this library can be used. Normally it will be
// called by the static initializers and need not be
// called explicitly, but special cases exist.
////////////////////////////////////////////////////////////////////
void
init_libphysics() {
static bool initialized = false;
if (initialized) {
return;
}
initialized = true;
PhysicsObject::init_type();
Physical::init_type();
PhysicalNode::init_type();
@@ -33,15 +64,3 @@ ConfigureFn(config_physics) {
LinearUserDefinedForce::init_type();
LinearCylinderVortexForce::init_type();
}
const float LinearIntegrator::_max_linear_dt =
config_physics.GetFloat("default_max_linear_dt", 1.0f / 30.0f);
const float AngularIntegrator::_max_angular_dt =
config_physics.GetFloat("default_max_angular_dt", 1.0f / 30.0f);
int LinearNoiseForce::_random_seed =
config_physics.GetInt("default_noise_force_seed", 665);
const float PhysicsObject::_default_terminal_velocity =
config_physics.GetFloat("default_terminal_velocity", 400.0f);

View File

@@ -13,4 +13,6 @@
ConfigureDecl(config_physics, EXPCL_PANDAPHYSICS, EXPTP_PANDAPHYSICS);
NotifyCategoryDecl(physics, EXPCL_PANDAPHYSICS, EXPTP_PANDAPHYSICS);
extern EXPCL_PANDAPHYSICS void init_libphysics();
#endif // CONFIG_PHYSICS_H