Commit Graph

156 Commits

Author SHA1 Message Date
rdb 8b6f82256e char: allow creating CharacterSlider with default value 2020-01-20 00:43:50 +01:00
rdb 05ed918d63 general: mark deprecated methods with the @deprecated tag
This makes them easier to find and, if necessary, automatically generate deprecation warnings for.
2019-09-08 09:50:28 +02:00
Sam Edwards 4695557a5d general: Don't require BUILDING_* for static builds 2018-08-31 23:54:32 -06:00
rdb ad3ab3ad21 Define stable ordering for WeakPointerTo for use as map/set key
Currently, the WeakPointerTo comparison operators compare the raw pointers, but this is not useful as it may cause a false equality if one weak pointer in the comparison is expired and points to memory that has since been reused.

Instead, we can define a comparison based on the control block pointer, which exists since the new weak pointer implementation in 0bb81a43c9.  This is implemented in the owner_before method, matching C++11 std::weak_ptr semantics.

I would now recommend deprecating most comparison operators of WeakPointerTo or redefining them to make more sense, ie. comparing equal if they (once) referred to the same object and not if they simply point to the same memory address.  This has not yet been done, though code that uses the comparison operators has been fixed in this commit.

Overloads of std::owner_less have been provided for creating a map or set with Weak(Const)PointerTo keys.
2018-07-30 17:27:09 +02:00
Sam Edwards b2bfb31114 general: Remove `using std::*` from headers
Also remove most `using namespace std;` statements. The only one that remains is in py_panda.h.

Closes #350
Closes #335
2018-06-14 16:04:49 +02:00
rdb b88bd99704 Various compiler warning fixes 2018-06-12 12:38:07 +02:00
Sam Edwards 7790f8429d general: Fully qualify header references into the std namespace
Closes #341
2018-06-07 10:35:12 +02:00
Sam Edwards e2b4353800 general: Replace NULL (and 0 as pointer) with C++11 nullptr
Exceptions to this replacement are:
- .c files
- Headers included by a .c file
- stb_image.h
- dr_flac.h
- Strings
- Comments
2018-06-03 16:35:13 -06:00
rdb 3d49986ce2 char: fix crash during Character destructor (regression)
This was a regression in 0bb81a43c9 which was not keeping an edge case in mind if a weak pointer is locked during object destruction.  This issue was fixed by 525a05ea2b1d00a1db901f883f1755943aeff33c, but that is not enough since it causes CharacterJointEffect::get_character() to return null now, so we need a separate method to check if a CharacterJointEffect belongs to a given character.  This is more efficient, too.

Fixes #330
2018-05-27 15:37:45 +02:00
rdb 0bb81a43c9 express: make a thread safe weak pointer implementation (#321)
To access a WeakPointerTo in a thread-safe way, use something like this:

    if (auto ptr = weak_ptr.lock()) {
      ..use ptr as regular PointerTo
    }

The new implementation no longer needs a reference to be stored to all weak pointers on the WeakReferenceList; a mere count of weak pointers is sufficient.  Therefore, callbacks theoretically no longer require a WeakPointerTo to be constructed.

The WeakPointerTo class is not actually atomic; it could be made so, but I don't believe it's worth it at this time.
2018-05-15 13:40:21 +02:00
Sam Edwards 9dd37e9dbc general: Add guards to ensure proper BUILDING_ macros defined
This is designed to sanity-check the buildsystem, ensuring that the
expected BUILDING_ macros are defined at the expected time. It
also helps catch cases where the wrong BUILDING_/EXPCL_ macros
are used.
2018-03-25 13:17:52 -06:00
Sam Edwards 5f14d9c48f char: Move JointVertexTransform::_matrix to CharacterJoint
The rationale is that CharacterJoint should contain all of the joint
state information, and JointVertexTransform should be pretty much devoid
of state so that we don't have to worry about synchronizing it.
JointVertexTransform::_matrix was just a cached/precomputed matrix
that transforms from original vertex positions to animated vertex
positions, so moving it to CharacterJoint doesn't change any engine
functionality.

This also removes the useless lock on recomputing that matrix. It was
useless because it was computing from shared state in CharacterJoint
that wasn't properly synchronized, but this would have to be fixed by
making CharacterJoint pipeline-cycled - a lock won't do.
2018-03-10 20:26:02 -07:00
Sam Edwards 280b13a289 char: Remove references to dead "ComputedVertices" class
This hasn't been a thing for nearly 13 years.
2018-03-10 20:15:39 -07:00
rdb dd2806c8bd Mark constructors 'explicit' for which coercion makes no sense 2017-11-06 19:47:38 +01:00
rdb 6f8b379bda Big patch full of performance improvements
This particularly benefits applications with a lot of nodes.
2017-04-03 01:41:23 +02:00
rdb 8381118a97 Assorted tweaks and compile warning fixes 2016-07-14 12:54:39 +02:00
tobspr 0fcfb8e372 New file headers, new comment style 2016-02-17 17:47:48 +01:00
rdb db3ab953e4 Remove ppremake, genPyCode, and all hacks created to support them 2015-11-09 19:06:49 +01:00
rdb f33e450823 A lot of performance changes, particularly wrt dcasts and state management 2015-07-27 16:32:57 +02:00
David Rose 33b9a1e1cf integrate Eigen 2011-12-16 14:17:48 +00:00
Zhao Huang a34cb75f82 Added to characterJoint
INLINE const LMatrix4 &get_transform() const;
  CPT(TransformState) get_transform_state() const;

This is to reduce the code bloat for freezing a joint using actor.
Previously, freezing a joint (using its current transform required two temporary
initailizations, a Mat4() and a TransformState in python.

tmat = tmat4(); joint.getTransform( tmat); tstate = TransformState( tmat);
freeze(..., transform = tstate )

now this can be collapsed down to
freeze( ..., transform = joint.getTransformState() )
2011-12-15 01:51:59 +00:00
David Rose dfe16c64f6 rename all Panda-built libraries to begin with libp3 or libpanda 2011-12-06 02:39:21 +00:00
David Rose 501470169f stdfloat_double 2011-10-10 05:25:10 +00:00
David Rose cfe0796c46 fix assertion error on showTightBounds() 2010-02-23 20:42:25 +00:00
David Rose 31d75582a3 egg-optchar -defpose 2008-12-23 20:41:31 +00:00
David Rose 99b0236c1c fix bam reader 2008-12-19 00:03:46 +00:00
David Rose f3106c89e2 setLODAnimation 2008-12-15 22:44:33 +00:00
David Rose 0a97dadc30 characterJoint.I 2008-11-21 19:22:39 +00:00
David Rose a666ef78fe shave a few more microseconds off animation time 2008-11-20 18:44:30 +00:00
David Rose 440746d3a4 expose interfaces for constructing Characters and associated joint hierarchies via Python 2008-11-05 19:33:04 +00:00
David Rose d4c2c9858d SIMPLE_THREADS_NO_MUTEX -> LightMutex 2008-10-08 23:23:40 +00:00
David Rose 06fc402c55 more useful spammage 2008-09-13 02:03:11 +00:00
David Rose 6d953de53a asynchronous animation binding 2008-08-07 17:26:39 +00:00
David Rose fb9c56432a we are now using the modified BSD license 2008-05-28 18:37:20 +00:00
Zachary Pavlov 894493de24 added this so I can make a root character for ships 2008-04-20 22:12:25 +00:00
David Rose 89f4ff426b make thread-safe 2007-11-27 01:12:50 +00:00
David Rose 7c9997118c support common transforming of shared PartBundles 2007-10-03 21:14:33 +00:00
Josh Yelon 9c63234504 Modified add_local_transform to immediately update node 2007-09-12 19:56:29 +00:00
David Rose fb973c9cfd Add LMatrix*::xform_vec_general(), fix clip plane issues 2007-08-23 16:24:49 +00:00
David Rose a44e8e3b30 fix assertion crash 2007-08-01 22:26:10 +00:00
Zachary Pavlov 220d33e006 okay, this is going to be a big commit. The basic idea here is to add transparent defines to allow for directory based dlls later. This will let us build tau again. ugggg 2007-07-20 23:02:51 +00:00
David Rose a2e7037b16 clarify assertions 2007-07-18 06:47:53 +00:00
David Rose 24d4175ca9 compiler warnings, etc. 2007-07-13 22:31:17 +00:00
David Rose 5b3686b659 prevent bam loading crash 2007-07-12 16:46:27 +00:00
David Rose 2ded3768ac fix assertion failure with merge_bundles 2007-07-05 18:36:57 +00:00
David Rose f7cc947329 change merge_bundles() interface 2007-07-04 15:58:16 +00:00
David Rose 826406eebc merge_bundles 2007-07-03 23:14:48 +00:00
David Rose 81ae62f553 rework controlJoint() and freezeJoint() to reduce memory footprint 2007-07-03 17:24:21 +00:00
David Rose 9b575fbe58 steps toward async flatten 2007-04-03 23:21:49 +00:00
David Rose 5179b6de77 expose CharacterSlider and find_slider() properly 2007-03-21 18:55:39 +00:00