*** empty log message ***

This commit is contained in:
David Rose 2000-11-17 04:49:21 +00:00
parent 2433fd2a1a
commit 7d38626876
218 changed files with 772 additions and 318 deletions

View File

@ -146,7 +146,7 @@ class DirectManipulationControl(PandaObject):
pos = VBase3(0)
hpr = VBase3(0)
decomposeMatrix(self.direct.selected.last.mCoa2Dnp,
VBase3(0), hpr, pos, getDefaultCoordinateSystem())
VBase3(0), hpr, pos, CSDefault)
# Create the task
t = Task.Task(self.followSelectedNodePathTask)
# Update state variables
@ -363,7 +363,7 @@ class DirectManipulationControl(PandaObject):
# And determine where the viewpoint is relative to widget
pos = VBase3(0)
decomposeMatrix(mWidget2Cam, VBase3(0), VBase3(0), pos,
getDefaultCoordinateSystem())
CSDefault)
widgetDir = Vec3(pos)
widgetDir.normalize()
# Convert specified widget axis to view space
@ -438,7 +438,7 @@ class DirectManipulationControl(PandaObject):
mBase2NewBase = Mat4()
mBase2NewBase.composeMatrix(
UNIT_VEC, VBase3(h,p,r), ZERO_VEC,
getDefaultCoordinateSystem())
CSDefault)
mBase2Widget = base.getMat(self.direct.widget)
mWidget2Parent = self.direct.widget.getMat()
# Compose the result
@ -448,7 +448,7 @@ class DirectManipulationControl(PandaObject):
# Extract and apply the hpr
hpr = Vec3(0)
decomposeMatrix(resultMat, VBase3(), hpr, VBase3(),
getDefaultCoordinateSystem())
CSDefault)
self.direct.widget.setHpr(hpr)
def rotate2D(self):
@ -845,7 +845,7 @@ class ObjectHandles(NodePath,PandaObject):
# And determine where the viewpoint is relative to widget
lineOrigin = VBase3(0)
decomposeMatrix(mCam2Widget, VBase3(0), VBase3(0), lineOrigin,
getDefaultCoordinateSystem())
CSDefault)
# Now see where this hits the plane containing the 1D motion axis.
# Pick the intersection plane most normal to the intersection ray
# by comparing lineDir with plane normals. The plane with the
@ -892,7 +892,7 @@ class ObjectHandles(NodePath,PandaObject):
# And determine where the viewpoint is relative to widget
lineOrigin = VBase3(0)
decomposeMatrix(mCam2NodePath, VBase3(0), VBase3(0), lineOrigin,
getDefaultCoordinateSystem())
CSDefault)
# Next we find the vector from viewpoint to the widget through
# the mouse's position on near plane.

View File

@ -36,6 +36,9 @@ class DirectSession(PandaObject):
self.fShift = 0
self.in2DWidget = 0
self.mouseX = 0
self.mouseY = 0
self.pos = VBase3()
self.hpr = VBase3()
self.scale = VBase3()
@ -93,7 +96,7 @@ class DirectSession(PandaObject):
mCoa2Render = state.dnp.mCoa2Dnp * state.dnp.getMat(render)
decomposeMatrix(mCoa2Render,
self.scale,self.hpr,self.pos,
getDefaultCoordinateSystem())
CSDefault)
self.widget.setPosHpr(self.pos,self.hpr)
return Task.cont
@ -253,7 +256,6 @@ class DisplayRegionContext(PandaObject):
self.camera = camera
self.cam = camera.getChild(0)
self.camNode = self.cam.getNode(0)
self.mouseData = win.getMouseData(0)
self.nearVec = Vec3(0)
self.mouseX = 0.0
self.mouseY = 0.0
@ -297,12 +299,10 @@ class DisplayRegionContext(PandaObject):
self.mouseLastX = self.mouseX
self.mouseLastY = self.mouseY
# Values for this frame
# Pixel coordinates of the mouse
self.mousePixelX = self.mouseData.getX()
self.mousePixelY = self.mouseData.getY()
# This ranges from -1 to 1
self.mouseX = ((self.mousePixelX / float(self.width)) * 2.0) - 1.0
self.mouseY = ((self.mousePixelY / float(self.height)) * -2.0) + 1.0
if (base.mouseWatcher.node().hasMouse()):
self.mouseX = base.mouseWatcher.node().getMouseX()
self.mouseY = base.mouseWatcher.node().getMouseY()
# Delta percent of window the mouse moved
self.mouseDeltaX = self.mouseX - self.mouseLastX
self.mouseDeltaY = self.mouseY - self.mouseLastY

View File

@ -52,7 +52,7 @@ class LevelEditor(NodePath, PandaObject):
# DNAStorage instance for storing level DNA info
self.dnaStore = DNAStorage()
loadDNAFile(self.dnaStore, 'dna/storage.dna',
getDefaultCoordinateSystem())
CSDefault)
self.dnaOutputDir = 'ToontownCentral'
self.dnaOutputFile = 'toontown_working.dna'
@ -2239,7 +2239,7 @@ class LevelEditor(NodePath, PandaObject):
self.dnaStore.resetDNAVisGroups()
# Now load in new file
self.groupParent = loadDNAFile(self.dnaStore, filename,
getDefaultCoordinateSystem())
CSDefault)
# Make sure the topmost level object gets put under level objects dna
self.groupParentDNA = self.dnaStore.findDNAGroup(
self.groupParent.getBottomArc())

View File

@ -55,15 +55,25 @@ class ShowBase:
self.camList.append( camera.find('**/+Camera') )
# Set the default camera
self.cam = self.camera.find('**/+Camera')
# Just one per window
# We create both a MouseAndKeyboard object and a MouseWatcher object
# for the window. The MouseAndKeyboard generates mouse events and
# mouse button/keyboard events; the MouseWatcher passes them through
# unchanged when the mouse is not over a 2-d button, and passes
# nothing through when the mouse *is* over a 2-d button. Therefore,
# objects that don't want to get events when the mouse is over a
# button, like the driveInterface, should be parented to
# mouseWatcher, while objects that want events in all cases, like the
# chat interface, should be parented to mak.
self.mak = self.dataRoot.attachNewNode(MouseAndKeyboard(self.win, 0, 'mak'))
self.mouseWatcher = self.mak.attachNewNode(MouseWatcher('mouseWatcher'))
self.trackball = self.dataUnused.attachNewNode(Trackball('trackball'))
self.drive = self.dataUnused.attachNewNode(DriveInterface('drive'))
self.mouse2cam = self.dataUnused.attachNewNode(Transform2SG('mouse2cam'))
self.mouse2cam.node().setArc(self.camera.getBottomArc())
self.useDrive()
self.buttonThrower = self.mak.attachNewNode(ButtonThrower())
self.buttonThrower = self.mouseWatcher.attachNewNode(ButtonThrower())
if (ShowBase.notify == None):
ShowBase.notify = directNotify.newCategory("ShowBase")
@ -132,7 +142,7 @@ class ShowBase:
# Update the mouseInterface to point to the drive
self.mouseInterface = self.drive
self.drive.node().reset()
self.drive.reparentTo(self.mak)
self.drive.reparentTo(self.mouseWatcher)
# Hookup the drive to the camera
self.mouse2cam.reparentTo(self.drive)
# Set the height to a good eyeheight
@ -147,7 +157,7 @@ class ShowBase:
# Update the mouseInterface to point to the trackball
self.mouseInterface = self.trackball
# Hookup the trackball to the camera
self.trackball.reparentTo(self.mak)
self.trackball.reparentTo(self.mouseWatcher)
self.mouse2cam.reparentTo(self.trackball)
def run(self):

View File

@ -28,6 +28,8 @@ typedef Config::Config<ConfigureGetConfig_config_showbase> ConfigShowbase;
class CollisionTraverser;
BEGIN_PUBLISH
EXPCL_DIRECT PT(GraphicsPipe) make_graphics_pipe();
EXPCL_DIRECT PT(GraphicsWindow)
make_graphics_window(GraphicsPipe *pipe,
@ -48,5 +50,6 @@ EXPCL_DIRECT void toggle_backface(NodeAttributes &initial_state);
EXPCL_DIRECT ConfigShowbase &get_config_showbase();
END_PUBLISH
#endif

View File

@ -676,6 +676,7 @@ Warning: Variable $[upcase $[tree]]_INSTALL is not set!
$[filter -D%,$[C++FLAGS]] \
$[INTERROGATE_OPTIONS] \
$[if $[INTERROGATE_PYTHON_INTERFACE],-python] \
$[if $[<= $[OPTIMIZE], 1],-spam] \
$[if $[INTERROGATE_C_INTERFACE],-c]

View File

@ -384,7 +384,7 @@ $[install_igatedb_dir]/$[igatedb] : $[so_dir]/$[igatedb] $[so_dir]/stamp
$[so_dir]/$[igatedb] : $[so_dir]/$[igateoutput]
lib$[TARGET]_igatescan = $[igatescan]
$[so_dir]/$[igateoutput] : $[filter-out %.c %.cxx,$[igatescan]] $[so_dir]/stamp
$[so_dir]/$[igateoutput] : $[sort $[patsubst ./%.h,%.h,./%.I,%.I,%,,$[dependencies $[igatescan]] $[igatescan:%=./%]]] $[so_dir]/stamp
interrogate -od $[so_dir]/$[igatedb] -oc $[so_dir]/$[igateoutput] $[interrogate_options] -module "$[igatemod]" -library "$[igatelib]" $(lib$[TARGET]_igatescan)
#define target $[igateoutput:%.cxx=$[so_dir]/%.obj]

View File

@ -361,7 +361,7 @@ $[install_igatedb_dir]\$[igatedb] : $[so_dir]\$[igatedb]
copy $[so_dir]\$[local] $[dest]
lib$[TARGET]_igatescan = $[osfilename $[igatescan]]
$[so_dir]\$[igatedb] $[so_dir]\$[igateoutput] : $[filter-out %.c %.cxx,$[igatescan]]
$[so_dir]\$[igatedb] $[so_dir]\$[igateoutput] : $[sort $[patsubst ./%.h,%.h,./%.I,%.I,%,,$[dependencies $[igatescan]] $[igatescan:%=./%]]]
// We use forward slash for interrogate because it prefers those.
interrogate -od $[so_dir]/$[igatedb] -oc $[so_dir]/$[igateoutput] $[interrogate_options] -module "$[igatemod]" -library "$[igatelib]" $(lib$[TARGET]_igatescan)

View File

@ -316,8 +316,12 @@ $[install_igatedb_dir]/$[igatedb] : $[so_dir]/$[igatedb]
#define dest $[install_igatedb_dir]
cd ./$[so_dir]; $[INSTALL]
// We have to split this out as a separate rule to properly support
// parallel make.
$[so_dir]/$[igatedb] : $[so_dir]/$[igateoutput]
lib$[TARGET]_igatescan = $[igatescan]
$[so_dir]/$[igatedb] $[so_dir]/$[igateoutput] : $[filter-out %.c %.cxx,$[igatescan]]
$[so_dir]/$[igateoutput] : $[sort $[patsubst ./%.h,%.h,./%.I,%.I,%,,$[dependencies $[igatescan]] $[igatescan:%=./%]]]
interrogate -od $[so_dir]/$[igatedb] -oc $[so_dir]/$[igateoutput] $[interrogate_options] -module "$[igatemod]" -library "$[igatelib]" $(lib$[TARGET]_igatescan)
#define target $[igateoutput:%.cxx=$[so_dir]/%.o]

View File

@ -64,6 +64,7 @@ class Config {
static ConfigString Get(const ConfigString sym);
static ConfigTable::Symbol& GetAll(const ConfigString,
ConfigTable::Symbol&);
PUBLISHED:
static bool GetBool(const ConfigString sym, bool def = false);
static int GetInt(const ConfigString sym, int def = 0);
static float GetFloat(const ConfigString sym, float def = 0.);

View File

@ -30,7 +30,7 @@
// respected according to the wishes of the user.
////////////////////////////////////////////////////////////////////
class EXPCL_DTOOL Notify {
public:
PUBLISHED:
Notify();
~Notify();

View File

@ -27,7 +27,7 @@ private:
NotifyCategory(const string &fullname, const string &basename,
NotifyCategory *parent);
public:
PUBLISHED:
INLINE string get_fullname() const;
INLINE string get_basename() const;
INLINE NotifySeverity get_severity() const;

View File

@ -8,6 +8,7 @@
#include <dtoolbase.h>
BEGIN_PUBLISH
enum NotifySeverity {
NS_unspecified, // Never used, a special case internally.
NS_spam,
@ -17,6 +18,7 @@ enum NotifySeverity {
NS_error, // Specifically, a recoverable error.
NS_fatal // A nonrecoverable error--expect abort() or core dump.
};
END_PUBLISH
EXPCL_DTOOL ostream &operator << (ostream &out, NotifySeverity severity);

View File

@ -24,7 +24,7 @@
class EXPCL_DTOOL DSearchPath {
public:
class Results {
public:
PUBLISHED:
Results();
Results(const Results &copy);
void operator = (const Results &copy);
@ -40,7 +40,7 @@ public:
friend class DSearchPath;
};
public:
PUBLISHED:
DSearchPath();
DSearchPath(const string &path, const string &delimiters = ": \t\n");
DSearchPath(const DSearchPath &copy);

View File

@ -37,7 +37,7 @@ class DSearchPath;
// fstream for reading or writing.
////////////////////////////////////////////////////////////////////
class EXPCL_DTOOL Filename {
public:
PUBLISHED:
enum Type {
// These type values must fit within the bits allocated for
// F_type, below.
@ -46,14 +46,15 @@ public:
T_executable = 0x02,
// Perhaps other types will be added later.
};
public:
enum Flags {
F_type = 0x0f,
F_binary = 0x10,
F_text = 0x20,
};
public:
PUBLISHED:
INLINE Filename(const string &filename = "");
INLINE Filename(const char *filename);
INLINE Filename(const Filename &copy);

View File

@ -35,6 +35,7 @@ bool build_c_wrappers = false;
bool build_python_wrappers = false;
bool save_unique_names = false;
bool no_database = false;
bool generate_spam = false;
CPPVisibility min_vis = V_published;
string library_name;
string module_name;
@ -61,6 +62,7 @@ enum CommandOptions {
CO_nodb,
CO_longlong,
CO_promiscuous,
CO_spam,
CO_help,
};
@ -82,6 +84,7 @@ static struct option long_options[] = {
{ "nodb", no_argument, NULL, CO_nodb },
{ "longlong", required_argument, NULL, CO_longlong },
{ "promiscuous", no_argument, NULL, CO_promiscuous },
{ "spam", no_argument, NULL, CO_spam },
{ "help", no_argument, NULL, CO_help },
{ NULL }
};
@ -233,7 +236,11 @@ void show_help() {
<< " -promiscuous\n"
<< " Export *all* public symbols, functions, and classes seen, even those\n"
<< " not explicitly marked to be published.\n\n";
<< " not explicitly marked to be published.\n\n"
<< " -spam\n"
<< " Generate wrapper functions that report each invocation to Notify.\n"
<< " This can sometimes be useful for tracking down bugs.\n\n";
}
// handle commandline -D options
@ -356,6 +363,10 @@ main(int argc, char *argv[]) {
min_vis = V_public;
break;
case CO_spam:
generate_spam = true;
break;
case 'h':
case CO_help:
show_help();

View File

@ -29,6 +29,7 @@ extern bool build_c_wrappers;
extern bool build_python_wrappers;
extern bool save_unique_names;
extern bool no_database;
extern bool generate_spam;
extern CPPVisibility min_vis;
extern string library_name;
extern string module_name;

View File

@ -317,6 +317,13 @@ write_code(ostream &out, InterrogateModuleDef *def) {
out << "#include <Python.h>\n\n";
}
if (generate_spam) {
out << "#include <config_interrogatedb.h>\n"
<< "#include <notifyCategoryProxy.h>\n\n"
<< "NotifyCategoryDecl(in_" << library_name << ", EXPCL_MISC, EXPTP_MISC);\n"
<< "NotifyCategoryDef(in_" << library_name << ", interrogatedb_cat);\n\n";
}
// Now, define all of our wrappers.
out << "extern \"C\" {\n\n";
@ -2109,8 +2116,20 @@ define_method(CPPInstance *function, InterrogateType &itype,
// The function is a template function, not a true function.
return;
}
// As a special kludgey extension, we consider a public static
// method called "get_class_type()" to be marked published, even if
// it is not. This allows us to export all of the TypeHandle system
// stuff without having to specifically flag get_class_type() as
// published.
bool force_publish = false;
if (function->get_simple_name() == "get_class_type" &&
(function->_storage_class && CPPInstance::SC_static) != 0 &&
function->_vis <= V_public) {
force_publish = true;
}
if (function->_vis > min_vis) {
if (!force_publish && function->_vis > min_vis) {
// The function is not marked to be exported.
if ((ftype->_flags & CPPFunctionType::F_destructor) != 0) {
itype._flags |= InterrogateType::F_private_destructor;

View File

@ -723,7 +723,38 @@ involves_unpublished(CPPType *type) {
case CPPDeclaration::ST_pointer:
return involves_unpublished(type->as_pointer_type()->_pointing_at);
case CPPDeclaration::ST_struct:
// A struct type is unpublished only if all of its members are
// unpublished.
if (type->_declaration != (CPPTypeDeclaration *)NULL) {
if (type->_declaration->_vis <= min_vis) {
return false;
}
}
{
CPPScope *scope = type->as_struct_type()->_scope;
bool any_exported = false;
CPPScope::Declarations::const_iterator di;
for (di = scope->_declarations.begin();
di != scope->_declarations.end() && !any_exported;
++di) {
if ((*di)->_vis <= min_vis) {
any_exported = true;
}
}
return !any_exported;
}
case CPPDeclaration::ST_function:
if (type->_declaration != (CPPTypeDeclaration *)NULL) {
if (type->_declaration->_vis <= min_vis) {
return false;
}
}
return true;
/*
{
CPPFunctionType *ftype = type->as_function_type();
if (involves_unpublished(ftype->_return_type)) {
@ -739,6 +770,7 @@ involves_unpublished(CPPType *type) {
}
return false;
}
*/
default:
if (type->_declaration != (CPPTypeDeclaration *)NULL) {

View File

@ -615,9 +615,63 @@ call_function(ostream &out, int indent_level, bool convert_result,
return return_expr;
}
////////////////////////////////////////////////////////////////////
// Function: WrapperBuilder::write_spam_message
// Access: Protected
// Description: Generates the lines of code at the beginning of the
// wrapper function that output a message when the
// wrapper is called. This is output only if -spam is
// specified on the command line.
////////////////////////////////////////////////////////////////////
void WrapperBuilder::
write_spam_message(ostream &out) const {
if (generate_spam) {
out << "#ifndef NDEBUG\n"
<< " if (in_" << library_name << "_cat.is_spam()) {\n"
<< " in_" << library_name << "_cat.spam()\n"
<< " << \"";
write_quoted_string(out, _description);
out << "\\n\";\n"
<< " }\n"
<< "#endif\n";
}
}
////////////////////////////////////////////////////////////////////
// Function: WrapperBuilder::write_quoted_string
// Access: Protected
// Description: Writes the string to the given output stream, as if
// it were quoted within double quotes in a C program.
// Specifically, this escapes characters that need to be
// escaped, and otherwise leaves the string unchanged.
////////////////////////////////////////////////////////////////////
void WrapperBuilder::
write_quoted_string(ostream &out, const string &str) const {
string::const_iterator si;
for (si = str.begin(); si != str.end(); ++si) {
switch (*si) {
case '\n':
out << "\\n";
break;
case '\t':
out << "\\t";
break;
case '\\':
case '"':
out << '\\';
// fall through
default:
out << *si;
}
}
}
////////////////////////////////////////////////////////////////////
// Function: WrapperBuilder::indent
// Access: Protected, Static
// Access: Public, Static
// Description:
////////////////////////////////////////////////////////////////////
ostream &WrapperBuilder::

View File

@ -112,6 +112,8 @@ protected:
bool convert_result = true,
const vector<string> &pexprs = vector<string>()) const;
void write_quoted_string(ostream &out, const string &str) const;
bool _is_valid;
bool _return_value_needs_management;
FunctionIndex _return_value_destructor;

View File

@ -67,6 +67,8 @@ write_wrapper(ostream &out, const string &wrapper_name) const {
}
out << ") {\n";
write_spam_message(out);
string return_expr = call_function(out, 2);
return_expr = manage_return_value(out, 2, return_expr);
if (!return_expr.empty()) {

View File

@ -51,6 +51,8 @@ write_wrapper(ostream &out, const string &wrapper_name) const {
out << "PyObject *\n"
<< wrapper_name << "(PyObject *, PyObject *args) {\n";
write_spam_message(out);
int pn;
string format_specifiers;

View File

@ -21,12 +21,12 @@
#define INSTALL_HEADERS \
interrogate_interface.h interrogate_request.h \
vector_int.h
vector_int.h config_interrogatedb.h
// These are temporary; they need not be installed in the future. These are
// necessary only when using template stopgap.
#define INSTALL_HEADERS \
interrogate_interface.h interrogate_request.h \
$[INSTALL_HEADERS] \
interrogateComponent.h interrogateComponent.I \
interrogateType.h interrogateType.I \
interrogateFunction.h interrogateFunction.I \
@ -34,6 +34,6 @@
interrogateManifest.h interrogateManifest.I \
interrogateElement.h interrogateElement.I \
interrogateDatabase.h interrogateDatabase.I \
indexRemapper.h vector_int.h
indexRemapper.h
#end lib_target

View File

@ -45,6 +45,7 @@ public:
static void set_update_func(UpdateFunc*);
static void set_shutdown_func(ShutdownFunc*);
PUBLISHED:
INLINE static void play(AudioSound*);
INLINE static void stop(AudioSound*);
INLINE static void set_loop(AudioSound*, bool);

View File

@ -30,6 +30,7 @@ private:
public:
typedef AudioTraits::SoundClass* SoundLoadFunc(Filename);
PUBLISHED:
INLINE static bool has_sound(const string& filename);
INLINE static bool verify_sound(const string& filename);
INLINE static AudioSound* load_sound(const string& filename);

View File

@ -19,7 +19,7 @@
// channels in the hierarchy (which must all match).
////////////////////////////////////////////////////////////////////
class EXPCL_PANDA AnimBundle : public AnimGroup {
public:
PUBLISHED:
INLINE AnimBundle(const string &name, float fps, int num_frames);
INLINE double get_base_frame_rate() const;

View File

@ -21,7 +21,7 @@
// instance.
////////////////////////////////////////////////////////////////////
class EXPCL_PANDA AnimBundleNode : public NamedNode {
public:
PUBLISHED:
INLINE AnimBundleNode(AnimBundle *bundle);
INLINE AnimBundleNode(const AnimBundleNode &copy);
INLINE void operator = (const AnimBundleNode &copy);

View File

@ -35,6 +35,7 @@ class EXPCL_PANDA AnimControl : public ReferenceCount {
public:
AnimControl(PartBundle *part, AnimBundle *anim, int channel_index);
PUBLISHED:
void play(const CPT_Event &stop_event = NULL);
void play(int from, int to, const CPT_Event &stop_event = NULL);
void loop(bool restart);

View File

@ -27,7 +27,7 @@
// delete it, unbinding its animation).
////////////////////////////////////////////////////////////////////
class EXPCL_PANDA AnimControlCollection {
public:
PUBLISHED:
AnimControlCollection();
~AnimControlCollection();

View File

@ -13,6 +13,7 @@
class Node;
BEGIN_PUBLISH
////////////////////////////////////////////////////////////////////
// Function: auto_bind
// Description: Walks the scene graph or subgraph beginning at the
@ -25,6 +26,7 @@ class Node;
EXPCL_PANDA void
auto_bind(Node *root_node, AnimControlCollection &controls,
int hierarchy_match_flags = 0);
END_PUBLISH
#endif

View File

@ -67,7 +67,7 @@ do_update(PartBundle *root, PartGroup *parent,
++bci) {
AnimControl *control = (*bci);
int channel_index = control->get_channel_index();
nassertv(channel_index >= 0 && channel_index < _channels.size());
nassertv(channel_index >= 0 && channel_index < (int)_channels.size());
AnimChannelBase *channel = _channels[channel_index];
nassertv(channel != (AnimChannelBase*)0L);
@ -124,7 +124,7 @@ pick_channel_index(list<int> &holes, int &next) const {
int hole = (*ii);
nassertv(hole >= 0 && hole < next);
if (hole < _channels.size() ||
if (hole < (int)_channels.size() ||
_channels[hole] != (AnimChannelBase *)NULL) {
// We can't accept this hole; we're using it!
holes.erase(ii);
@ -133,9 +133,9 @@ pick_channel_index(list<int> &holes, int &next) const {
}
// Now do we have any more to restrict?
if (next < _channels.size()) {
if (next < (int)_channels.size()) {
int i;
for (i = next; i < _channels.size(); i++) {
for (i = next; i < (int)_channels.size(); i++) {
if (_channels[i] == (AnimChannelBase*)0L) {
// Here's a hole we do have.
holes.push_back(i);
@ -157,7 +157,7 @@ pick_channel_index(list<int> &holes, int &next) const {
////////////////////////////////////////////////////////////////////
void MovingPartBase::
bind_hierarchy(AnimGroup *anim, int channel_index) {
while (_channels.size() <= channel_index) {
while ((int)_channels.size() <= channel_index) {
_channels.push_back((AnimChannelBase*)0L);
}

View File

@ -75,6 +75,7 @@ public:
PartBundle(const string &name = "");
virtual PartGroup *make_copy() const;
PUBLISHED:
void set_blend_type(BlendType bt);
INLINE BlendType get_blend_type() const;
@ -94,7 +95,7 @@ public:
INLINE const ChannelBlend &get_blend_map() const;
public:
PUBLISHED:
virtual void output(ostream &out) const;
virtual void write(ostream &out, int indent_level) const;

View File

@ -29,6 +29,7 @@ protected:
public:
virtual bool safe_to_flatten() const;
PUBLISHED:
INLINE PartBundle *get_bundle() const;
private:

View File

@ -97,9 +97,13 @@ public:
return get_class_type();
}
virtual TypeHandle force_init_type() {init_type(); return get_class_type();}
PUBLISHED:
static TypeHandle get_class_type() {
return _type_handle;
}
public:
static void init_type() {
TypedWriteableReferenceCount::init_type();
register_type(_type_handle, "PartGroup",

View File

@ -115,7 +115,10 @@ app_traverse() {
////////////////////////////////////////////////////////////////////
// Function: Character::update
// Access: Public
// Description:
// Description: Recalculates the character's joints and vertices for
// the current frame. Normally this is performed
// automatically during the render and need not be
// called explicitly.
////////////////////////////////////////////////////////////////////
void Character::
update() {

View File

@ -36,13 +36,17 @@ public:
virtual bool safe_to_transform() const;
PUBLISHED:
INLINE CharacterJointBundle *get_bundle() const;
INLINE ComputedVertices *get_computed_vertices() const;
INLINE int get_num_parts() const;
INLINE PartGroup *get_part(int n) const;
public:
virtual void app_traverse();
PUBLISHED:
void update();
private:

View File

@ -32,6 +32,7 @@ public:
virtual void update_internals(PartGroup *parent, bool self_changed,
bool parent_changed);
PUBLISHED:
bool add_net_transform(NodeRelation *arc);
bool remove_net_transform(NodeRelation *arc);
bool has_net_transform(NodeRelation *arc) const;

View File

@ -26,8 +26,10 @@ protected:
public:
CharacterJointBundle(const string &name = "");
PUBLISHED:
INLINE Character *get_node() const;
public:
virtual PartGroup *make_copy() const;
static void register_with_read_factory(void);

View File

@ -25,8 +25,7 @@
// Description : Reads keyboard input in as that of a chat.
////////////////////////////////////////////////////////////////////
class EXPCL_PANDA ChatInput : public DataNode {
public:
PUBLISHED:
ChatInput(TextNode* text_node, const string& name = "");
void reset(void);

View File

@ -35,6 +35,7 @@ public:
CollisionEntry(const CollisionEntry &copy);
void operator = (const CollisionEntry &copy);
PUBLISHED:
INLINE const CollisionSolid *get_from() const;
INLINE bool has_into() const;
INLINE const CollisionSolid *get_into() const;

View File

@ -24,13 +24,15 @@
// triggered it.
////////////////////////////////////////////////////////////////////
class EXPCL_PANDA CollisionHandlerEvent : public CollisionHandler {
public:
PUBLISHED:
CollisionHandlerEvent();
public:
virtual void begin_group();
virtual void add_entry(CollisionEntry *entry);
virtual void end_group();
PUBLISHED:
INLINE void set_in_pattern(const string &pattern);
INLINE string get_in_pattern() const;
INLINE void set_out_pattern(const string &pattern);

View File

@ -21,7 +21,7 @@
// avatar's head.
////////////////////////////////////////////////////////////////////
class EXPCL_PANDA CollisionHandlerFloor : public CollisionHandlerPhysical {
public:
PUBLISHED:
CollisionHandlerFloor();
virtual ~CollisionHandlerFloor();

View File

@ -30,6 +30,7 @@ public:
virtual void add_entry(CollisionEntry *entry);
virtual void end_group();
PUBLISHED:
void add_collider(CollisionNode *node, DriveInterface *drive_interface);
void add_collider(CollisionNode *node, NodeRelation *arc);
bool remove_collider(CollisionNode *node);

View File

@ -19,7 +19,7 @@
// collisions you can have.
////////////////////////////////////////////////////////////////////
class EXPCL_PANDA CollisionHandlerPusher : public CollisionHandlerPhysical {
public:
PUBLISHED:
CollisionHandlerPusher();
virtual ~CollisionHandlerPusher();

View File

@ -21,12 +21,14 @@
// e.g. for picking from the window.
////////////////////////////////////////////////////////////////////
class EXPCL_PANDA CollisionHandlerQueue : public CollisionHandler {
public:
PUBLISHED:
CollisionHandlerQueue();
public:
virtual void begin_group();
virtual void add_entry(CollisionEntry *entry);
PUBLISHED:
void sort_entries();
int get_num_entries() const;

View File

@ -100,7 +100,7 @@ xform(const LMatrix4f &mat) {
// We may have to copy each of our solids as we transform them if
// someone else is sharing their pointers.
if (solid->get_count() > 1) {
if (solid->get_ref_count() > 1) {
solid = solid->make_copy();
(*si) = solid;
}

View File

@ -22,15 +22,17 @@
// world and running into things.
////////////////////////////////////////////////////////////////////
class EXPCL_PANDA CollisionNode : public NamedNode {
public:
PUBLISHED:
CollisionNode(const string &name = "");
public:
CollisionNode(const CollisionNode &copy);
void operator = (const CollisionNode &copy);
virtual ~CollisionNode();
virtual Node *make_copy() const;
virtual void xform(const LMatrix4f &mat);
PUBLISHED:
INLINE void set_collide_mask(CollideMask mask);
INLINE void set_from_collide_mask(CollideMask mask);
INLINE void set_into_collide_mask(CollideMask mask);
@ -45,6 +47,7 @@ public:
INLINE void remove_solid(int n);
INLINE int add_solid(CollisionSolid *solid);
public:
virtual void draw_traverse();
virtual void output(ostream &out) const;

View File

@ -21,10 +21,11 @@ class EXPCL_PANDA CollisionPlane : public CollisionSolid {
protected:
INLINE CollisionPlane();
public:
PUBLISHED:
INLINE CollisionPlane(const Planef &plane);
INLINE CollisionPlane(const CollisionPlane &copy);
public:
virtual CollisionSolid *make_copy();
virtual int
@ -33,9 +34,9 @@ public:
const CollisionSolid *into) const;
virtual void xform(const LMatrix4f &mat);
virtual void output(ostream &out) const;
PUBLISHED:
INLINE LVector3f get_normal() const;
INLINE float dist_to_plane(const LPoint3f &point) const;

View File

@ -17,12 +17,14 @@
// Description :
////////////////////////////////////////////////////////////////////
class EXPCL_PANDA CollisionPolygon : public CollisionPlane {
public:
PUBLISHED:
INLINE CollisionPolygon(const LPoint3f &a, const LPoint3f &b,
const LPoint3f &c);
INLINE CollisionPolygon(const LPoint3f &a, const LPoint3f &b,
const LPoint3f &c, const LPoint3f &d);
INLINE CollisionPolygon(const LPoint3f *begin, const LPoint3f *end);
public:
CollisionPolygon(const CollisionPolygon &copy);
virtual CollisionSolid *make_copy();

View File

@ -21,13 +21,14 @@ class ProjectionNode;
// effects.
////////////////////////////////////////////////////////////////////
class EXPCL_PANDA CollisionRay : public CollisionSolid {
public:
PUBLISHED:
INLINE CollisionRay();
INLINE CollisionRay(const LPoint3f &origin, const LVector3f &direction);
INLINE CollisionRay(float ox, float oy, float oz,
float dx, float dy, float dz);
INLINE CollisionRay(const CollisionRay &copy);
public:
INLINE CollisionRay(const CollisionRay &copy);
virtual CollisionSolid *make_copy();
virtual int
@ -39,6 +40,7 @@ public:
virtual void output(ostream &out) const;
PUBLISHED:
INLINE void set_origin(const LPoint3f &origin);
INLINE void set_origin(float x, float y, float z);
INLINE const LPoint3f &get_origin() const;

View File

@ -43,9 +43,11 @@ public:
virtual CollisionSolid *make_copy()=0;
PUBLISHED:
INLINE void set_tangible(bool tangible);
INLINE bool is_tangible() const;
public:
virtual int
test_intersection(CollisionHandler *record,
const CollisionEntry &entry,
@ -55,6 +57,7 @@ public:
void update_viz(Node *parent);
PUBLISHED:
virtual void output(ostream &out) const;
virtual void write(ostream &out, int indent_level = 0) const;

View File

@ -15,11 +15,12 @@
// Description : A spherical collision volume or object.
////////////////////////////////////////////////////////////////////
class EXPCL_PANDA CollisionSphere : public CollisionSolid {
public:
PUBLISHED:
INLINE CollisionSphere(const LPoint3f &center, float radius);
INLINE CollisionSphere(float cx, float cy, float cz, float radius);
INLINE CollisionSphere(const CollisionSphere &copy);
public:
INLINE CollisionSphere(const CollisionSphere &copy);
virtual CollisionSolid *make_copy();
virtual int
@ -31,6 +32,7 @@ public:
virtual void output(ostream &out) const;
PUBLISHED:
INLINE void set_center(const LPoint3f &center);
INLINE void set_center(float x, float y, float z);
INLINE const LPoint3f &get_center() const;

View File

@ -30,7 +30,7 @@ class Geom;
////////////////////////////////////////////////////////////////////
class EXPCL_PANDA CollisionTraverser :
public TraverserVisitor<NullTransitionWrapper, CollisionLevelState> {
public:
PUBLISHED:
CollisionTraverser(TypeHandle graph_type = RenderRelation::get_class_type());
~CollisionTraverser();

View File

@ -245,7 +245,7 @@ clean_out_old_states() {
++snext;
CullState *cs = (*si);
if (cs->get_count() == 1 && cs->is_empty() && !cs->has_bin()) {
if (cs->get_ref_count() == 1 && cs->is_empty() && !cs->has_bin()) {
// This CullState doesn't seem to be used anywhere else.
_states.erase(si);
}

View File

@ -30,9 +30,10 @@
// instance decalling, while using the CullTraverser.
////////////////////////////////////////////////////////////////////
class EXPCL_PANDA DirectRenderTransition : public ImmediateTransition {
public:
PUBLISHED:
INLINE DirectRenderTransition();
public:
virtual NodeTransition *make_copy() const;
virtual bool has_sub_render() const;

View File

@ -47,11 +47,11 @@ const int MIN_MOVE = 2;
// otherwise, the events will be discarded.
////////////////////////////////////////////////////////////////////
class EXPCL_PANDA MouseAndKeyboard : public DataNode {
public:
PUBLISHED:
MouseAndKeyboard(GraphicsWindow *window, int device,
const string& name = "");
public:
virtual void transmit_data(NodeAttributes &data);
public:

View File

@ -54,8 +54,8 @@
vectorDataTransition.I vectorDataTransition.h
#define IGATESCAN \
dataNode.cxx dataRelation.cxx \
dataGraphTraversal.cxx
dataNode.cxx dataNode.h dataRelation.cxx dataRelation.h \
dataGraphTraversal.cxx dataGraphTraversal.h
#end lib_target

View File

@ -70,6 +70,7 @@ public:
virtual void
transmit_data(NodeAttributes &data)=0;
PUBLISHED:
void set_spam_mode(bool flag);
bool get_spam_mode() const;

View File

@ -31,10 +31,12 @@ public:
private:
static NodeRelation *make_arc(const FactoryParams &params);
public:
PUBLISHED:
static TypeHandle get_class_type() {
return _type_handle;
}
public:
static void init_type() {
NodeRelation::init_type();
register_type(_type_handle, "DataRelation",

View File

@ -30,7 +30,6 @@ class GraphicsPipe;
////////////////////////////////////////////////////////////////////
class EXPCL_PANDA DisplayRegion : public ReferenceCount {
public:
DisplayRegion(GraphicsLayer *);
DisplayRegion(GraphicsLayer *,
const float l, const float r,
@ -38,6 +37,7 @@ public:
DisplayRegion(int xsize, int ysize);
virtual ~DisplayRegion();
PUBLISHED:
INLINE void get_dimensions(float &l, float &r, float &b, float &t) const;
void set_dimensions(float l, float r, float b, float t);

View File

@ -42,6 +42,7 @@ public:
GraphicsChannel(GraphicsWindow *);
virtual ~GraphicsChannel();
PUBLISHED:
GraphicsLayer *make_layer(int index = -1);
int get_num_layers() const;
GraphicsLayer *get_layer(int index) const;
@ -51,8 +52,10 @@ public:
GraphicsWindow *get_window() const;
GraphicsPipe *get_pipe() const;
public:
virtual void window_resized(int x, int y);
PUBLISHED:
INLINE void set_active(bool active);
INLINE bool is_active() const;

View File

@ -44,6 +44,7 @@ protected:
public:
virtual ~GraphicsLayer();
PUBLISHED:
DisplayRegion *make_display_region();
DisplayRegion *make_display_region(float l, float r,
float b, float t);
@ -57,8 +58,10 @@ public:
GraphicsWindow *get_window() const;
GraphicsPipe *get_pipe() const;
public:
void channel_resized(int x, int y);
PUBLISHED:
INLINE void set_active(bool active);
INLINE bool is_active() const;

View File

@ -34,7 +34,7 @@ class glxDisplay;
// Description :
////////////////////////////////////////////////////////////////////
class EXPCL_PANDA GraphicsPipe : public TypedReferenceCount, public Namable {
public:
PUBLISHED:
GraphicsPipe(const PipeSpecifier &spec);
virtual ~GraphicsPipe();
@ -54,6 +54,7 @@ public:
static int get_num_pipes();
static GraphicsPipe *get_pipe(int n);
public:
// This function's interface must be defined here even though we
// know nothing about glx displays at this point.
virtual glxDisplay *get_glx_display();

View File

@ -134,19 +134,6 @@ has_keyboard(int device) const {
return _input_devices[device].has_keyboard();
}
////////////////////////////////////////////////////////////////////
// Function: GraphicsWindow::get_mouse_data
// Access: Public
// Description: Returns the MouseData associated with the nth input
// device.
////////////////////////////////////////////////////////////////////
INLINE const MouseData &GraphicsWindow::
get_mouse_data(int device) const {
nassertr(device >= 0 && device < (int)_input_devices.size(),
*(new MouseData));
return _input_devices[device].get_mouse_data();
}
////////////////////////////////////////////////////////////////////
// Function: GraphicsWindow::get_modifier_buttons
// Access: Public
@ -175,6 +162,19 @@ set_modifier_buttons(int device, const ModifierButtons &mods) {
_input_devices[device].set_modifier_buttons(mods);
}
////////////////////////////////////////////////////////////////////
// Function: GraphicsWindow::get_mouse_data
// Access: Public
// Description: Returns the MouseData associated with the nth input
// device.
////////////////////////////////////////////////////////////////////
INLINE const MouseData &GraphicsWindow::
get_mouse_data(int device) const {
nassertr(device >= 0 && device < (int)_input_devices.size(),
*(new MouseData));
return _input_devices[device].get_mouse_data();
}
////////////////////////////////////////////////////////////////////
// Function: GraphicsWindow::has_button_event
// Access: Public

View File

@ -93,6 +93,8 @@ public:
virtual ~GraphicsWindow();
INLINE const GraphicsWindow::Properties& get_properties() const;
PUBLISHED:
INLINE int get_width() const;
INLINE int get_height() const;
INLINE int get_xorg() const;
@ -104,7 +106,8 @@ public:
INLINE void set_frame_number(const int);
INLINE int get_frame_number() const;
public:
virtual void resized(const int, const int);
INLINE virtual void set_draw_callback(Callback *c);
@ -123,21 +126,22 @@ public:
virtual void make_current();
virtual void unmake_current();
public:
PUBLISHED:
// Mouse and keyboard routines
INLINE int get_num_input_devices() const;
INLINE string get_input_device_name(int device) const;
INLINE bool has_pointer(int device) const;
INLINE bool has_keyboard(int device) const;
INLINE const MouseData &get_mouse_data(int device) const;
INLINE const ModifierButtons &get_modifier_buttons(int device) const;
INLINE void set_modifier_buttons(int device, const ModifierButtons &mods);
public:
INLINE const MouseData &get_mouse_data(int device) const;
INLINE bool has_button_event(int device) const;
INLINE ButtonEvent get_button_event(int device);
public:
PUBLISHED:
// GUI glue methods
virtual void flag_redisplay();
virtual void register_draw_function(GraphicsWindow::vfn);
@ -148,6 +152,7 @@ public:
virtual bool supports_update() const;
virtual void update();
public:
virtual void begin_frame();
virtual void end_frame();

View File

@ -13,6 +13,7 @@
config_downloader.h downloadDb.I \
downloadDb.cxx downloadDb.h \
downloader.I downloader.cxx downloader.h extractor.cxx extractor.h \
hashVal.cxx hashVal.I hashVal.h \
patcher.cxx \
patcher.h
@ -21,7 +22,7 @@
zcompressor.h download_utils.cxx download_utils.h
#define IF_CRYPTO_SOURCES \
crypto_utils.cxx crypto_utils.h hashVal.cxx hashVal.I hashVal.h
crypto_utils.cxx crypto_utils.h
#define INSTALL_HEADERS \
downloader.h downloader.I \

View File

@ -12,8 +12,12 @@
class HashVal;
BEGIN_PUBLISH
EXPCL_PANDAEXPRESS void md5_a_file(const Filename &fname, HashVal &ret);
EXPCL_PANDAEXPRESS void md5_a_buffer(uchar *buf, ulong len, HashVal &ret);
END_PUBLISH
#endif

View File

@ -20,7 +20,6 @@
#include <map>
#include "hashVal.h"
#include "crypto_utils.h"
/*
//////////////////////////////////////////////////

View File

@ -10,8 +10,12 @@
#include <filename.h>
#include <typedef.h>
BEGIN_PUBLISH
EXPCL_PANDAEXPRESS ulong check_crc(Filename name);
EXPCL_PANDAEXPRESS ulong check_adler(Filename name);
END_PUBLISH
#endif

View File

@ -31,7 +31,7 @@ class DownloaderToken;
// Description :
////////////////////////////////////////////////////////////////////
class EXPCL_PANDAEXPRESS Downloader : public AsyncUtility {
public:
PUBLISHED:
Downloader(void);
Downloader(PT(Buffer) buffer);
virtual ~Downloader(void);

View File

@ -23,13 +23,13 @@ class ExtractorToken;
// Description :
////////////////////////////////////////////////////////////////////
class EXPCL_PANDAEXPRESS Extractor : public AsyncUtility {
public:
PUBLISHED:
Extractor(void);
Extractor(PT(Buffer) buffer);
virtual ~Extractor(void);
int request_extract(const Filename &source_file,
const string &event_name, const Filename &rel_path = "");
const string &event_name, const Filename &rel_path = "");
bool extract(Filename &source_file, const Filename &rel_path);

View File

@ -23,7 +23,7 @@ class PatcherToken;
// Description : Applys a patch asynchronously
////////////////////////////////////////////////////////////////////
class EXPCL_PANDAEXPRESS Patcher : public AsyncUtility {
public:
PUBLISHED:
Patcher(void);
Patcher(PT(Buffer) buffer);
virtual ~Patcher(void);

View File

@ -21,7 +21,7 @@ class ClockObject;
class EXPCL_PANDA LensFlareNode : public Node
{
public:
PUBLISHED:
INLINE LensFlareNode(void);
void add_flare(PT(Texture) flare, PTA_float scales, PTA_float offsets,
@ -37,6 +37,7 @@ public:
INLINE void set_light_source(PT_Node source);
public:
virtual bool sub_render(const AllAttributesWrapper &attrib, AllTransitionsWrapper &trans,
GraphicsStateGuardianBase *gsgbase);
virtual bool has_sub_render() const;

View File

@ -24,7 +24,7 @@ class EventReceiver;
// on the events (but not necessarily immediately).
////////////////////////////////////////////////////////////////////
class EXPCL_PANDAEXPRESS Event : public TypedReferenceCount, public Namable {
public:
PUBLISHED:
Event(const string &event_name, EventReceiver *receiver = NULL);
Event(const Event &copy);
void operator = (const Event &copy);

View File

@ -34,11 +34,14 @@ public:
typedef void EventFunction(CPT_Event);
typedef void EventCallbackFunction(CPT(Event), void*);
PUBLISHED:
EventHandler(EventQueue *queue);
void process_events();
virtual void dispatch_event(const CPT_Event &event);
public:
bool add_hook(const string &event_name, EventFunction *function);
bool add_hook(const string &event_name, EventCallbackFunction *function,
void*);

View File

@ -26,7 +26,7 @@
// EventStoreValue template class, defined below.
////////////////////////////////////////////////////////////////////
class EXPCL_PANDAEXPRESS EventParameter {
public:
PUBLISHED:
INLINE EventParameter(const TypedReferenceCount *ptr);
INLINE EventParameter(int value);
INLINE EventParameter(double value);

View File

@ -31,6 +31,7 @@ public:
EventQueue();
~EventQueue();
PUBLISHED:
void queue_event(CPT_Event event);
bool is_queue_empty() const;

View File

@ -36,7 +36,7 @@
// return the time for the current frame.
////////////////////////////////////////////////////////////////////
class EXPCL_PANDAEXPRESS ClockObject {
public:
PUBLISHED:
enum Mode {
M_normal,
M_non_real_time,

View File

@ -27,13 +27,25 @@ ConfigureFn(config_express) {
}
// Set this true to enable tracking of ReferenceCount pointer
// allocation/deallcation via the MemoryUsage object. This is
// primarily useful for detecting memory leaks. It has no effect when
// compiling in NDEBUG mode.
// Set leak-memory true to disable the actual deletion of
// ReferenceCount-derived objects. This is sometimes useful to track
// a reference counting bug, since the formerly deleted objects will
// still remain (with a reference count of -100) without being
// overwritten with a newly-allocated object, and the assertion tests
// in ReferenceCount may more accurately detect the first instance of
// an error.
bool
get_leak_memory() {
static bool got_leak_memory = false;
static bool leak_memory;
// This variable is no longer defined here; instead, it's a member of
// MemoryUsage.
if (!got_leak_memory) {
leak_memory = config_express.GetBool("leak-memory", false);
got_leak_memory = true;
}
return leak_memory;
}
//const bool track_memory_usage = config_express.GetBool("track-memory-usage", false);

View File

@ -20,6 +20,8 @@ NotifyCategoryDecl(express, EXPCL_PANDAEXPRESS, EXPTP_PANDAEXPRESS);
//extern EXPCL_PANDAEXPRESS const bool track_memory_usage;
bool get_leak_memory();
extern const int patchfile_window_size;
extern const int patchfile_increment_size;
extern const int patchfile_buffer_size;

View File

@ -33,7 +33,7 @@
// collection of data elements.
////////////////////////////////////////////////////////////////////
class EXPCL_PANDAEXPRESS Datagram : public TypedObject {
public:
PUBLISHED:
INLINE Datagram();
INLINE Datagram(const void *data, size_t size);
INLINE Datagram(const string &data);

View File

@ -18,7 +18,7 @@
// know the correct type and order of each element.
////////////////////////////////////////////////////////////////////
class EXPCL_PANDAEXPRESS DatagramIterator {
public:
PUBLISHED:
DatagramIterator(const Datagram &datagram, size_t offset = 0);
bool get_bool();

View File

@ -5,7 +5,7 @@
#include "memoryUsage.h"
#include "memoryUsagePointers.h"
#include "clockObject.h"
#include "trueClock.h"
#include "typedReferenceCount.h"
#ifndef NDEBUG
@ -334,7 +334,7 @@ ns_record_pointer(ReferenceCount *ptr) {
info._ptr = ptr;
info._static_type = ReferenceCount::get_class_type();
info._dynamic_type = ReferenceCount::get_class_type();
info._time = ClockObject::get_global_clock()->get_real_time();
info._time = TrueClock::get_ptr()->get_real_time();
info._freeze_index = _freeze_index;
info._reconsider_dynamic_type = true;
@ -395,7 +395,7 @@ ns_remove_pointer(ReferenceCount *ptr) {
MemoryInfo &info = (*ti).second;
if (info._freeze_index == _freeze_index) {
double now = ClockObject::get_global_clock()->get_real_time();
double now = TrueClock::get_ptr()->get_real_time();
_count--;
_trend_types.add_info(info.get_type());
_trend_ages.add_info(now - info._time);
@ -427,7 +427,7 @@ ns_get_pointers(MemoryUsagePointers &result) {
nassertv(_track_memory_usage);
result.clear();
double now = ClockObject::get_global_clock()->get_real_time();
double now = TrueClock::get_ptr()->get_real_time();
Table::iterator ti;
for (ti = _table.begin(); ti != _table.end(); ++ti) {
MemoryInfo &info = (*ti).second;
@ -449,7 +449,7 @@ ns_get_pointers_of_type(MemoryUsagePointers &result, TypeHandle type) {
nassertv(_track_memory_usage);
result.clear();
double now = ClockObject::get_global_clock()->get_real_time();
double now = TrueClock::get_ptr()->get_real_time();
Table::iterator ti;
for (ti = _table.begin(); ti != _table.end(); ++ti) {
MemoryInfo &info = (*ti).second;
@ -476,7 +476,7 @@ ns_get_pointers_of_age(MemoryUsagePointers &result,
nassertv(_track_memory_usage);
result.clear();
double now = ClockObject::get_global_clock()->get_real_time();
double now = TrueClock::get_ptr()->get_real_time();
Table::iterator ti;
for (ti = _table.begin(); ti != _table.end(); ++ti) {
MemoryInfo &info = (*ti).second;
@ -518,12 +518,12 @@ ns_get_pointers_with_zero_count(MemoryUsagePointers &result) {
nassertv(_track_memory_usage);
result.clear();
double now = ClockObject::get_global_clock()->get_real_time();
double now = TrueClock::get_ptr()->get_real_time();
Table::iterator ti;
for (ti = _table.begin(); ti != _table.end(); ++ti) {
MemoryInfo &info = (*ti).second;
if (info._freeze_index == _freeze_index) {
if ((*ti).first->get_count() == 0) {
if ((*ti).first->get_ref_count() == 0) {
(*ti).first->ref();
result.add_entry((*ti).first, info.get_type(), now - info._time);
}
@ -591,7 +591,7 @@ ns_show_trend_types() {
void MemoryUsage::
ns_show_current_ages() {
AgeHistogram hist;
double now = ClockObject::get_global_clock()->get_real_time();
double now = TrueClock::get_ptr()->get_real_time();
Table::iterator ti;
for (ti = _table.begin(); ti != _table.end(); ++ti) {

View File

@ -29,6 +29,7 @@ class EXPCL_PANDAEXPRESS MemoryUsage {
public:
INLINE static bool get_track_memory_usage();
PUBLISHED:
#if defined(__GNUC__) && !defined(NDEBUG)
// There seems to be a problem with egcs-2.91.66: it gets confused
// with too many nested inline functions, and sets the wrong pointer

View File

@ -145,7 +145,7 @@ add_entry(ReferenceCount *ptr, TypeHandle type, double age) {
// We can't safly add pointers with a zero reference count. They
// might be statically-allocated or something, and if we try to add
// them they'll try to destruct when the PointerTo later goes away.
if (ptr->get_count() != 0) {
if (ptr->get_ref_count() != 0) {
_entries.push_back(Entry(ptr, type, age));
}
}

View File

@ -37,7 +37,7 @@
// even exist when compiled with NDEBUG.
////////////////////////////////////////////////////////////////////
class EXPCL_PANDAEXPRESS MemoryUsagePointers {
public:
PUBLISHED:
MemoryUsagePointers();
~MemoryUsagePointers();

View File

@ -24,7 +24,7 @@
// Description : A file that contains a set of files.
////////////////////////////////////////////////////////////////////
class EXPCL_PANDAEXPRESS Multifile {
public:
PUBLISHED:
enum Type {
T_unknown,
T_valid,

View File

@ -17,7 +17,7 @@
// NULL.
////////////////////////////////////////////////////////////////////
class EXPCL_PANDAEXPRESS Namable {
public:
PUBLISHED:
INLINE Namable(const string &initial_name = "");
INLINE Namable(const Namable &copy);
INLINE Namable &operator = (const Namable &other);

View File

@ -99,7 +99,7 @@ PN_uint16 Patchfile::
calc_hash(const char *buffer) {
PN_uint16 hash_value = 0;
for(int i = 0; i < _footprint_length; i++) {
for(int i = 0; i < (int)_footprint_length; i++) {
// this is probably not such a good hash. to be replaced
hash_value ^= (*buffer) << (i % 8);
buffer++;
@ -368,7 +368,7 @@ build(Filename &file_orig, Filename &file_new) {
}
// are there still more bytes left in the new file?
if (ADD_offset != length_new) {
if ((int)ADD_offset != length_new) {
// emit ADD for all remaining bytes
emit_ADD(write_stream, length_new - ADD_offset, &buffer_new[ADD_offset]);
@ -466,7 +466,7 @@ apply(Filename &patch, Filename &file) {
{
///////////
// read # of ADD bytes
nassertr(_buffer->get_length() >= sizeof(ADD_length), false);
nassertr(_buffer->get_length() >= (int)sizeof(ADD_length), false);
patch_stream.read(_buffer->_buffer, sizeof(ADD_length));
_datagram.clear();
_datagram.append_data(_buffer->_buffer, sizeof(ADD_length));
@ -478,7 +478,7 @@ apply(Filename &patch, Filename &file) {
PN_uint32 bytes_left = ADD_length;
while (bytes_left > 0) {
PN_uint32 bytes_this_time = (bytes_left < buflen) ? bytes_left : buflen;
PN_uint32 bytes_this_time = ((int)bytes_left < buflen) ? bytes_left : buflen;
patch_stream.read(_buffer->_buffer, bytes_this_time);
write_stream.write(_buffer->_buffer, bytes_this_time);
bytes_left -= bytes_this_time;
@ -487,7 +487,7 @@ apply(Filename &patch, Filename &file) {
///////////
// read # of COPY bytes
nassertr(_buffer->get_length() >= sizeof(COPY_length), false);
nassertr(_buffer->get_length() >= (int)sizeof(COPY_length), false);
patch_stream.read(_buffer->_buffer, sizeof(COPY_length));
_datagram.clear();
_datagram.append_data(_buffer->_buffer, sizeof(COPY_length));
@ -497,7 +497,7 @@ apply(Filename &patch, Filename &file) {
// if there are bytes to copy, read them from original file and write them to output
if (0 != COPY_length) {
// read copy offset
nassertr(_buffer->get_length() >= sizeof(COPY_offset), false);
nassertr(_buffer->get_length() >= (int)sizeof(COPY_offset), false);
patch_stream.read(_buffer->_buffer, sizeof(COPY_offset));
_datagram.clear();
_datagram.append_data(_buffer->_buffer, sizeof(COPY_offset));
@ -511,7 +511,7 @@ apply(Filename &patch, Filename &file) {
PN_uint32 bytes_left = COPY_length;
while (bytes_left > 0) {
PN_uint32 bytes_this_time = (bytes_left < buflen) ? bytes_left : buflen;
PN_uint32 bytes_this_time = ((int)bytes_left < buflen) ? bytes_left : buflen;
origfile_stream.read(_buffer->_buffer, bytes_this_time);
write_stream.write(_buffer->_buffer, bytes_this_time);
bytes_left -= bytes_this_time;

View File

@ -27,7 +27,7 @@
// Description :
////////////////////////////////////////////////////////////////////
class EXPCL_PANDAEXPRESS Patchfile {
public:
PUBLISHED:
Patchfile(void);
Patchfile(PT(Buffer) buffer);
~Patchfile(void);

View File

@ -261,7 +261,7 @@ INLINE void PointerToBase<T>::
output(ostream &out) const {
out << (void *)_ptr;
if (_ptr != (To *)NULL) {
out << ":" << _ptr->get_count();
out << ":" << _ptr->get_ref_count();
}
}

View File

@ -111,6 +111,7 @@ public:
INLINE bool operator < (const PointerToBase<To> &other) const;
#endif // CPPPARSER
PUBLISHED:
INLINE bool is_null() const;
INLINE void clear();
@ -131,14 +132,16 @@ INLINE ostream &operator <<(ostream &out, const PointerToBase<T> &pointer) {
////////////////////////////////////////////////////////////////////
template <class T>
class PointerTo : public PointerToBase<T> {
public:
PUBLISHED:
INLINE PointerTo(To *ptr = (To *)NULL);
INLINE PointerTo(const PointerTo<T> &copy);
public:
INLINE To &operator *() const;
INLINE To *operator -> () const;
INLINE operator PointerToBase<T>::To *() const;
PUBLISHED:
// When downcasting to a derived class from a PointerTo<BaseClass>,
// C++ would normally require you to cast twice: once to an actual
// BaseClass pointer, and then again to your desired pointer. You
@ -183,15 +186,17 @@ public:
////////////////////////////////////////////////////////////////////
template <class T>
class ConstPointerTo : public PointerToBase<T> {
public:
PUBLISHED:
INLINE ConstPointerTo(const To *ptr = (const To *)NULL);
INLINE ConstPointerTo(const PointerTo<T> &copy);
INLINE ConstPointerTo(const ConstPointerTo<T> &copy);
public:
INLINE const To &operator *() const;
INLINE const To *operator -> () const;
INLINE operator const PointerToBase<T>::To *() const;
PUBLISHED:
INLINE const To *p() const;
INLINE ConstPointerTo<T> &operator = (const To *ptr);

View File

@ -125,13 +125,33 @@ prepare_delete() {
_ref_count = -100;
}
#ifdef NDEBUG
////////////////////////////////////////////////////////////////////
// Function: ReferenceCount::get_count
// Function: ReferenceCount::unref_consider_delete
// Access: Public
// Description: This function is called by the global unref_delete()
// function. This function unrefs the pointer and
// returns true if it should be deleted (i.e. the count
// has gone to zero), or false otherwise. It doesn't
// delete itself because (a) a method cannot safely
// delete this, and (b) we don't have a virtual
// destructor anyway. The decision of whether to delete
// is left up to unref_delete().
////////////////////////////////////////////////////////////////////
INLINE bool ReferenceCount::
unref_consider_delete() {
unref();
return (get_ref_count() == 0);
}
#endif
////////////////////////////////////////////////////////////////////
// Function: ReferenceCount::get_ref_count
// Access: Public
// Description: Returns the current reference count.
////////////////////////////////////////////////////////////////////
INLINE int ReferenceCount::
get_count() const {
get_ref_count() const {
test_ref_count_integrity();
return _ref_count;
}
@ -270,14 +290,8 @@ test_ref_count_integrity() const {
template<class RefCountType>
INLINE void
unref_delete(RefCountType *ptr) {
ptr->unref();
if (ptr->get_count() == 0) {
if (((ReferenceCount *)ptr)->unref_consider_delete()) {
delete ptr;
// If we're testing reference counts, it's sometimes useful to do
// the following instead of actually deleting the pointer:
// ptr->prepare_delete();
}
}

View File

@ -6,3 +6,35 @@
#include "referenceCount.h"
TypeHandle ReferenceCount::_type_handle;
#ifndef NDEBUG
////////////////////////////////////////////////////////////////////
// Function: ReferenceCount::unref_consider_delete
// Access: Public
// Description: This function is called by the global unref_delete()
// function. This function unrefs the pointer and
// returns true if it should be deleted (i.e. the count
// has gone to zero), or false otherwise. It doesn't
// delete itself because (a) a method cannot safely
// delete this, and (b) we don't have a virtual
// destructor anyway. The decision of whether to delete
// is left up to unref_delete().
////////////////////////////////////////////////////////////////////
bool ReferenceCount::
unref_consider_delete() {
unref();
if (get_leak_memory()) {
// In leak-memory mode, we don't actually delete anything.
// However, we do want to call prepare_delete() when the count
// reaches zero, to reset the refcount to -100 as a deleted flag.
if (get_ref_count() == 0) {
prepare_delete();
MemoryUsage::remove_pointer(this);
}
return false;
}
return (get_ref_count() == 0);
}
#endif

View File

@ -41,14 +41,25 @@ protected:
INLINE ~ReferenceCount();
public:
// These functions are not part of the normal API, but they have to
// be public. You shouldn't generally call these directly.
INLINE void prepare_delete();
#ifdef NDEBUG
// unref_consider_delete() is inline only if we are compiling
// NDEBUG.
INLINE bool unref_consider_delete();
#else
bool unref_consider_delete();
#endif
INLINE int get_count() const;
PUBLISHED:
INLINE int get_ref_count() const;
INLINE void ref() const;
INLINE void unref() const;
INLINE void test_ref_count_integrity() const;
public:
static TypeHandle get_class_type() {
return _type_handle;
}

View File

@ -80,7 +80,7 @@ class TypedObject;
// type name may be retrieved for run-time display.
////////////////////////////////////////////////////////////////////
class EXPCL_PANDAEXPRESS TypeHandle {
public:
PUBLISHED:
INLINE TypeHandle();
INLINE TypeHandle(const TypeHandle &copy);
@ -154,6 +154,7 @@ public:
void record_derivation(TypeHandle child, TypeHandle parent);
PUBLISHED:
TypeHandle find_type(const string &name) const;
string get_name(TypeHandle type, TypedObject *object) const;
@ -284,7 +285,8 @@ public:
INLINE TypedObject();
INLINE TypedObject(const TypedObject &copy);
INLINE void operator = (const TypedObject &copy);
PUBLISHED:
// A virtual destructor is just a good idea.
virtual ~TypedObject();

View File

@ -31,9 +31,13 @@ public:
return get_class_type();
}
virtual TypeHandle force_init_type() {init_type(); return get_class_type();}
PUBLISHED:
static TypeHandle get_class_type() {
return _type_handle;
}
public:
static void init_type() {
TypedObject::init_type();
ReferenceCount::init_type();

View File

@ -50,10 +50,12 @@ public:
protected:
void fillin(DatagramIterator& scan, BamReader* manager);
public:
PUBLISHED:
static TypeHandle get_class_type() {
return _type_handle;
}
public:
static void init_type() {
ReferenceCount::init_type();
WriteableConfigurable::init_type();
@ -63,9 +65,13 @@ public:
WriteableConfigurable::get_class_type(),
BoundedObject::get_class_type());
}
PUBLISHED: // Temporary kludge around ffi bug
virtual TypeHandle get_type() const {
return get_class_type();
}
public:
virtual TypeHandle force_init_type() {init_type(); return get_class_type();}

View File

@ -25,7 +25,7 @@
// Description : Specifies atmospheric fog parameters
////////////////////////////////////////////////////////////////////
class EXPCL_PANDA Fog : public TypedReferenceCount {
public:
PUBLISHED:
enum Mode {
M_linear, // f = (end - z) / (end - start)
M_exponential, // f = e^(-density * z)

Some files were not shown because too many files have changed in this diff Show More