Merge branch 'master' into deploy-ng

This commit is contained in:
Mitchell Stokes 2017-04-04 21:27:09 -07:00
commit 2302f251b1
213 changed files with 2663 additions and 1475 deletions

View File

@ -31,8 +31,8 @@ are included as part of the Windows 7.1 SDK.
You will also need to have the third-party dependency libraries available for
the build scripts to use. These are available from one of these two URLs,
depending on whether you are on a 32-bit or 64-bit system:
https://www.panda3d.org/download/panda3d-1.9.3/panda3d-1.9.3-tools-win32.zip
https://www.panda3d.org/download/panda3d-1.9.3/panda3d-1.9.3-tools-win64.zip
https://www.panda3d.org/download/panda3d-1.9.4/panda3d-1.9.4-tools-win32.zip
https://www.panda3d.org/download/panda3d-1.9.4/panda3d-1.9.4-tools-win64.zip
After acquiring these dependencies, you may simply build Panda3D from the
command prompt using the following command:
@ -97,7 +97,7 @@ macOS
-----
On macOS, you will need to download a set of precompiled thirdparty packages in order to
compile Panda3D, which can be acquired from [here](https://www.panda3d.org/download/panda3d-1.9.3/panda3d-1.9.3-tools-mac.tar.gz).
compile Panda3D, which can be acquired from [here](https://www.panda3d.org/download/panda3d-1.9.4/panda3d-1.9.4-tools-mac.tar.gz).
After placing the thirdparty directory inside the panda3d source directory,
you may build Panda3D using a command like the following:

View File

@ -4,7 +4,6 @@ from panda3d.core import *
from panda3d.direct import *
from direct.directnotify.DirectNotifyGlobal import directNotify
from direct.distributed.DistributedObjectBase import DistributedObjectBase
from direct.showbase.PythonUtil import StackTrace
#from PyDatagram import PyDatagram
#from PyDatagramIterator import PyDatagramIterator
@ -259,7 +258,10 @@ class DistributedObject(DistributedObjectBase):
def _destroyDO(self):
# after this is called, the object is no longer a DistributedObject
# but may still be used as a DelayDeleted object
self.destroyDoStackTrace = StackTrace()
if __debug__:
# StackTrace is omitted in packed versions
from direct.showbase.PythonUtil import StackTrace
self.destroyDoStackTrace = StackTrace()
# check for leftover cached data that was not retrieved or flushed by this object
# this will catch typos in the data name in calls to get/setCachedData
if hasattr(self, '_cachedData'):

View File

@ -312,7 +312,6 @@ class DoCollectionManager:
else:
self.notify.warning('handleSetLocation: object %s not present' % self.getMsgChannel())
@exceptionLogged()
def storeObjectLocation(self, object, parentId, zoneId):
oldParentId = object.parentId
oldZoneId = object.zoneId

View File

@ -17,7 +17,6 @@ class StagedObject:
call any "handle" functions.
"""
self.__state = initState
pass
def goOnStage(self, *args, **kw):
"""
@ -29,8 +28,6 @@ class StagedObject:
if not self.isOnStage():
self.handleOnStage(*args, **kw)
pass
pass
def handleOnStage(self):
"""
@ -39,7 +36,6 @@ class StagedObject:
Don't forget to call down to this one, though.
"""
self.__state = StagedObject.ON
pass
def goOffStage(self, *args, **kw):
"""
@ -51,8 +47,6 @@ class StagedObject:
if not self.isOffStage():
self.handleOffStage(*args, **kw)
pass
pass
def handleOffStage(self):
"""
@ -61,7 +55,6 @@ class StagedObject:
Don't forget to call down to this one, though.
"""
self.__state = StagedObject.OFF
pass
def isOnStage(self):
return self.__state == StagedObject.ON

View File

@ -90,7 +90,8 @@ class FourState:
off (and so is state 2 which is oposite of 4 and therefore
oposite of 'on').
"""
assert self.debugPrint("FourState(names=%s)"%(names))
self.stateIndex = 0
assert self.__debugPrint("FourState(names=%s)"%(names))
self.track = None
self.stateTime = 0.0
self.names = names
@ -120,7 +121,6 @@ class FourState:
self.exitState4,
[names[1]]),
}
self.stateIndex = 0
self.fsm = ClassicFSM.ClassicFSM('FourState',
list(self.states.values()),
# Initial State
@ -131,7 +131,7 @@ class FourState:
self.fsm.enterInitialState()
def setTrack(self, track):
assert self.debugPrint("setTrack(track=%s)"%(track,))
assert self.__debugPrint("setTrack(track=%s)"%(track,))
if self.track is not None:
self.track.pause()
self.track = None
@ -147,27 +147,27 @@ class FourState:
# If the client wants the state changed it needs to
# send a request to the AI.
#def setIsOn(self, isOn):
# assert self.debugPrint("setIsOn(isOn=%s)"%(isOn,))
# assert self.__debugPrint("setIsOn(isOn=%s)"%(isOn,))
# pass
def isOn(self):
assert self.debugPrint("isOn() returning %s (stateIndex=%s)"%(self.stateIndex==4, self.stateIndex))
assert self.__debugPrint("isOn() returning %s (stateIndex=%s)"%(self.stateIndex==4, self.stateIndex))
return self.stateIndex==4
def changedOnState(self, isOn):
"""
Allow derived classes to overide this.
"""
assert self.debugPrint("changedOnState(isOn=%s)"%(isOn,))
assert self.__debugPrint("changedOnState(isOn=%s)"%(isOn,))
##### state 0 #####
def enterState0(self):
assert self.debugPrint("enter0()")
assert self.__debugPrint("enter0()")
self.enterStateN(0)
def exitState0(self):
assert self.debugPrint("exit0()")
assert self.__debugPrint("exit0()")
# It's important for FourStates to broadcast their state
# when they are generated on the client. Before I put this in,
# if a door was generated and went directly to an 'open' state,
@ -177,43 +177,43 @@ class FourState:
##### state 1 #####
def enterState1(self):
assert self.debugPrint("enterState1()")
assert self.__debugPrint("enterState1()")
self.enterStateN(1)
def exitState1(self):
assert self.debugPrint("exitState1()")
assert self.__debugPrint("exitState1()")
##### state 2 #####
def enterState2(self):
assert self.debugPrint("enterState2()")
assert self.__debugPrint("enterState2()")
self.enterStateN(2)
def exitState2(self):
assert self.debugPrint("exitState2()")
assert self.__debugPrint("exitState2()")
##### state 3 #####
def enterState3(self):
assert self.debugPrint("enterState3()")
assert self.__debugPrint("enterState3()")
self.enterStateN(3)
def exitState3(self):
assert self.debugPrint("exitState3()")
assert self.__debugPrint("exitState3()")
##### state 4 #####
def enterState4(self):
assert self.debugPrint("enterState4()")
assert self.__debugPrint("enterState4()")
self.enterStateN(4)
self.changedOnState(1)
def exitState4(self):
assert self.debugPrint("exitState4()")
assert self.__debugPrint("exitState4()")
self.changedOnState(0)
if __debug__:
def debugPrint(self, message):
def __debugPrint(self, message):
"""for debugging"""
return self.notify.debug("%d (%d) %s"%(
id(self), self.stateIndex==4, message))

View File

@ -93,11 +93,11 @@ class FourStateAI:
off (and so is state 2 which is oposite of state 4 and therefore
oposite of 'on').
"""
assert self.debugPrint(
self.stateIndex = 0
assert self.__debugPrint(
"FourStateAI(names=%s, durations=%s)"
%(names, durations))
self.doLaterTask = None
self.stateIndex = 0
assert len(names) == 5
assert len(names) == len(durations)
self.names = names
@ -137,7 +137,7 @@ class FourStateAI:
self.fsm.enterInitialState()
def delete(self):
assert self.debugPrint("delete()")
assert self.__debugPrint("delete()")
if self.doLaterTask is not None:
self.doLaterTask.remove()
del self.doLaterTask
@ -145,15 +145,15 @@ class FourStateAI:
del self.fsm
def getState(self):
assert self.debugPrint("getState() returning %s"%(self.stateIndex,))
assert self.__debugPrint("getState() returning %s"%(self.stateIndex,))
return [self.stateIndex]
def sendState(self):
assert self.debugPrint("sendState()")
assert self.__debugPrint("sendState()")
self.sendUpdate('setState', self.getState())
def setIsOn(self, isOn):
assert self.debugPrint("setIsOn(isOn=%s)"%(isOn,))
assert self.__debugPrint("setIsOn(isOn=%s)"%(isOn,))
if isOn:
if self.stateIndex != 4:
# ...if it's not On; request turning on:
@ -170,7 +170,7 @@ class FourStateAI:
# self.fsm.request(self.states[nextState])
def isOn(self):
assert self.debugPrint("isOn() returning %s (stateIndex=%s)"%(self.stateIndex==4, self.stateIndex))
assert self.__debugPrint("isOn() returning %s (stateIndex=%s)"%(self.stateIndex==4, self.stateIndex))
return self.stateIndex==4
def changedOnState(self, isOn):
@ -179,12 +179,12 @@ class FourStateAI:
The self.isOn value has toggled. Call getIsOn() to
get the current state.
"""
assert self.debugPrint("changedOnState(isOn=%s)"%(isOn,))
assert self.__debugPrint("changedOnState(isOn=%s)"%(isOn,))
##### states #####
def switchToNextStateTask(self, task):
assert self.debugPrint("switchToNextStateTask()")
assert self.__debugPrint("switchToNextStateTask()")
self.fsm.request(self.states[self.nextStateIndex])
return Task.done
@ -193,11 +193,11 @@ class FourStateAI:
This function is intentionaly simple so that derived classes
may easily alter the network message.
"""
assert self.debugPrint("distributeStateChange()")
assert self.__debugPrint("distributeStateChange()")
self.sendState()
def enterStateN(self, stateIndex, nextStateIndex):
assert self.debugPrint(
assert self.__debugPrint(
"enterStateN(stateIndex=%s, nextStateIndex=%s)"%
(stateIndex, nextStateIndex))
self.stateIndex = stateIndex
@ -211,7 +211,7 @@ class FourStateAI:
"enterStateN-timer-%s"%id(self))
def exitStateN(self):
assert self.debugPrint("exitStateN()")
assert self.__debugPrint("exitStateN()")
if self.doLaterTask:
taskMgr.remove(self.doLaterTask)
self.doLaterTask=None
@ -219,56 +219,56 @@ class FourStateAI:
##### state 0 #####
def enterState0(self):
assert self.debugPrint("enter0()")
assert self.__debugPrint("enter0()")
self.enterStateN(0, 0)
def exitState0(self):
assert self.debugPrint("exit0()")
assert self.__debugPrint("exit0()")
##### state 1 #####
def enterState1(self):
#assert self.debugPrint("enterState1()")
#assert self.__debugPrint("enterState1()")
self.enterStateN(1, 2)
def exitState1(self):
assert self.debugPrint("exitState1()")
assert self.__debugPrint("exitState1()")
self.exitStateN()
##### state 2 #####
def enterState2(self):
#assert self.debugPrint("enterState2()")
#assert self.__debugPrint("enterState2()")
self.enterStateN(2, 3)
def exitState2(self):
assert self.debugPrint("exitState2()")
assert self.__debugPrint("exitState2()")
self.exitStateN()
##### state 3 #####
def enterState3(self):
#assert self.debugPrint("enterState3()")
#assert self.__debugPrint("enterState3()")
self.enterStateN(3, 4)
def exitState3(self):
assert self.debugPrint("exitState3()")
assert self.__debugPrint("exitState3()")
self.exitStateN()
##### state 4 #####
def enterState4(self):
assert self.debugPrint("enterState4()")
assert self.__debugPrint("enterState4()")
self.enterStateN(4, 1)
self.changedOnState(1)
def exitState4(self):
assert self.debugPrint("exitState4()")
assert self.__debugPrint("exitState4()")
self.exitStateN()
self.changedOnState(0)
if __debug__:
def debugPrint(self, message):
def __debugPrint(self, message):
"""for debugging"""
return self.notify.debug("%d (%d) %s"%(
id(self), self.stateIndex==4, message))

View File

@ -1,3 +1,18 @@
------------------------ RELEASE 1.9.4 ------------------------
One of the bugfixes in the last 1.9.3 release introduced a regression,
therefore it was decided to make another 1.9.x release.
* Fix 1.9.3 regression with generating geometry in threaded pipeline
* Various compile warning fixes
* Fix occasional crash in PNMImage::quick_filter_from()
* Fix issue taking screenshots from an OpenGL FBO buffer
* Fix various issues with MeshDrawer
* Fix issue with collision sphere generation in bam2egg
* Fix compile errors with more obscure Python configurations
* Fix assert when using Texture.load_sub_image to load whole image
* Fix fsm FourState
------------------------ RELEASE 1.9.3 ------------------------
This issue fixes several bugs that were still found in 1.9.2.

View File

@ -45,7 +45,9 @@ get_memory_usage(MemoryClass memory_class) const {
void TypeHandle::
inc_memory_usage(MemoryClass memory_class, size_t size) {
#ifdef DO_MEMORY_USAGE
#ifdef _DEBUG
assert((int)memory_class >= 0 && (int)memory_class < (int)MC_limit);
#endif
if ((*this) != TypeHandle::none()) {
TypeRegistryNode *rnode = TypeRegistry::ptr()->look_up(*this, NULL);
assert(rnode != (TypeRegistryNode *)NULL);
@ -53,7 +55,7 @@ inc_memory_usage(MemoryClass memory_class, size_t size) {
// cerr << *this << ".inc(" << memory_class << ", " << size << ") -> " <<
// rnode->_memory_usage[memory_class] << "\n";
if (rnode->_memory_usage[memory_class] < 0) {
cerr << "Memory usage overflow for type " << *this << ".\n";
cerr << "Memory usage overflow for type " << rnode->_name << ".\n";
abort();
}
}
@ -67,7 +69,9 @@ inc_memory_usage(MemoryClass memory_class, size_t size) {
void TypeHandle::
dec_memory_usage(MemoryClass memory_class, size_t size) {
#ifdef DO_MEMORY_USAGE
#ifdef _DEBUG
assert((int)memory_class >= 0 && (int)memory_class < (int)MC_limit);
#endif
if ((*this) != TypeHandle::none()) {
TypeRegistryNode *rnode = TypeRegistry::ptr()->look_up(*this, NULL);
assert(rnode != (TypeRegistryNode *)NULL);
@ -98,7 +102,7 @@ allocate_array(size_t size) {
assert(rnode != (TypeRegistryNode *)NULL);
AtomicAdjust::add(rnode->_memory_usage[MC_array], (AtomicAdjust::Integer)alloc_size);
if (rnode->_memory_usage[MC_array] < 0) {
cerr << "Memory usage overflow for type " << *this << ".\n";
cerr << "Memory usage overflow for type " << rnode->_name << ".\n";
abort();
}
}

View File

@ -23,6 +23,19 @@ freshen_derivations() {
}
}
/**
* Returns the pointer to the global TypeRegistry object.
*/
INLINE TypeRegistry *TypeRegistry::
ptr() {
// It's OK that we don't acquire the lock, because we guarantee that this is
// called at static init time.
if (_global_pointer == NULL) {
init_global_pointer();
}
return _global_pointer;
}
/**
* Ensures the lock pointer has been allocated.
*/

View File

@ -488,20 +488,6 @@ write(ostream &out) const {
_lock->release();
}
/**
* Returns the pointer to the global TypeRegistry object.
*/
TypeRegistry *TypeRegistry::
ptr() {
init_lock();
_lock->acquire();
if (_global_pointer == NULL) {
init_global_pointer();
}
_lock->release();
return _global_pointer;
}
/**
*
*/
@ -531,6 +517,7 @@ TypeRegistry() {
*/
void TypeRegistry::
init_global_pointer() {
init_lock();
init_memory_hook();
_global_pointer = new TypeRegistry;
}

View File

@ -77,7 +77,7 @@ PUBLISHED:
void write(ostream &out) const;
// ptr() returns the pointer to the global TypeRegistry object.
static TypeRegistry *ptr();
static INLINE TypeRegistry *ptr();
MAKE_SEQ_PROPERTY(typehandles, get_num_typehandles, get_typehandle);
MAKE_SEQ_PROPERTY(root_classes, get_num_root_classes, get_root_class);

View File

@ -1133,7 +1133,8 @@ write_class_declarations(ostream &out, ostream *out_h, Object *obj) {
// to a macro function.
out << "typedef " << c_class_name << " " << class_name << "_localtype;\n";
if (obj->_itype.has_destructor() ||
obj->_itype.destructor_is_inherited()) {
obj->_itype.destructor_is_inherited() ||
obj->_itype.destructor_is_implicit()) {
if (TypeManager::is_reference_count(type)) {
out << "Define_Module_ClassRef";
@ -6219,7 +6220,7 @@ write_make_seq(ostream &out, Object *obj, const std::string &ClassName,
// the assumption that the called method doesn't do anything with this
// tuple other than unpack it (which is a fairly safe assumption to make).
out << " PyTupleObject args;\n";
out << " (void)PyObject_INIT_VAR(&args, &PyTuple_Type, 1);\n";
out << " (void)PyObject_INIT_VAR((PyVarObject *)&args, &PyTuple_Type, 1);\n";
}
out <<

View File

@ -343,6 +343,14 @@ destructor_is_inherited() const {
return (_flags & F_inherited_destructor) != 0;
}
/**
*
*/
INLINE bool InterrogateType::
destructor_is_implicit() const {
return (_flags & F_implicit_destructor) != 0;
}
/**
*
*/

View File

@ -82,6 +82,7 @@ public:
INLINE FunctionIndex get_constructor(int n) const;
INLINE bool has_destructor() const;
INLINE bool destructor_is_inherited() const;
INLINE bool destructor_is_implicit() const;
INLINE FunctionIndex get_destructor() const;
INLINE int number_of_elements() const;
INLINE ElementIndex get_element(int n) const;

View File

@ -303,8 +303,14 @@ template<class T> INLINE bool DTOOL_Call_ExtractThisPointer(PyObject *self, T *&
// Functions related to error reporting.
EXPCL_INTERROGATEDB bool _Dtool_CheckErrorOccurred();
// _PyErr_OCCURRED is an undocumented macro version of PyErr_Occurred.
// Some implementations of the CPython API (e.g. PyPy's cpyext) do not define
// it, so in these cases we just silently fall back to PyErr_Occurred.
#ifndef _PyErr_OCCURRED
#define _PyErr_OCCURRED() PyErr_Occurred()
#endif
#ifdef NDEBUG
// _PyErr_OCCURRED is an undocumented inline version of PyErr_Occurred.
#define Dtool_CheckErrorOccurred() (_PyErr_OCCURRED() != NULL)
#else
#define Dtool_CheckErrorOccurred() _Dtool_CheckErrorOccurred()

View File

@ -65,7 +65,6 @@ class btPoint2PointConstraint;
class btPolyhedralConvexShape;
class btQuaternion;
class btSequentialImpulseConstraintSolver;
class btScalar;
class btSliderConstraint;
class btSoftBodyHelpers;
class btSoftBodyRigidBodyCollisionConfiguration;
@ -80,11 +79,13 @@ class btTranslationalLimitMotor;
class btTriangleMesh;
class btTypedConstraint;
class btTypedObject;
class btVector3;
class btVehicleRaycaster;
template <typename T> class btAlignedObjectArray;
struct btVector3 {};
typedef double btScalar;
class btWheelInfo {
public:
class RaycastInfo;

View File

@ -67,7 +67,7 @@ operator = (bool value) {
/**
* Returns the variable's value.
*/
INLINE ConfigVariableBool::
ALWAYS_INLINE ConfigVariableBool::
operator bool () const {
return get_value();
}
@ -100,12 +100,11 @@ set_value(bool value) {
/**
* Returns the variable's value.
*/
INLINE bool ConfigVariableBool::
ALWAYS_INLINE bool ConfigVariableBool::
get_value() const {
TAU_PROFILE("bool ConfigVariableBool::get_value() const", " ", TAU_USER);
if (!is_cache_valid(_local_modified)) {
mark_cache_valid(((ConfigVariableBool *)this)->_local_modified);
((ConfigVariableBool *)this)->_cache = get_bool_word(0);
reload_value();
}
return _cache;
}

View File

@ -12,3 +12,12 @@
*/
#include "configVariableBool.h"
/**
* Refreshes the cached value.
*/
void ConfigVariableBool::
reload_value() const {
mark_cache_valid(_local_modified);
_cache = get_bool_word(0);
}

View File

@ -29,13 +29,13 @@ PUBLISHED:
const string &description = string(), int flags = 0);
INLINE void operator = (bool value);
INLINE operator bool () const;
ALWAYS_INLINE operator bool () const;
INLINE size_t size() const;
INLINE bool operator [] (size_t n) const;
INLINE void set_value(bool value);
INLINE bool get_value() const;
ALWAYS_INLINE bool get_value() const;
INLINE bool get_default_value() const;
MAKE_PROPERTY(value, get_value, set_value);
MAKE_PROPERTY(default_value, get_default_value);
@ -44,8 +44,10 @@ PUBLISHED:
INLINE void set_word(size_t n, bool value);
private:
AtomicAdjust::Integer _local_modified;
bool _cache;
void reload_value() const;
mutable AtomicAdjust::Integer _local_modified;
mutable bool _cache;
};
#include "configVariableBool.I"

View File

@ -70,7 +70,12 @@ is_on(NotifySeverity severity) const {
*/
INLINE bool NotifyCategory::
is_spam() const {
// Instruct the compiler to optimize for the usual case.
#ifdef __GNUC__
return __builtin_expect(is_on(NS_spam), 0);
#else
return is_on(NS_spam);
#endif
}
/**
@ -78,7 +83,12 @@ is_spam() const {
*/
INLINE bool NotifyCategory::
is_debug() const {
// Instruct the compiler to optimize for the usual case.
#ifdef __GNUC__
return __builtin_expect(is_on(NS_debug), 0);
#else
return is_on(NS_debug);
#endif
}
#else
/**

View File

@ -69,7 +69,12 @@ is_on(NotifySeverity severity) {
template<class GetCategory>
INLINE bool NotifyCategoryProxy<GetCategory>::
is_spam() {
// Instruct the compiler to optimize for the usual case.
#ifdef __GNUC__
return __builtin_expect(get_unsafe_ptr()->is_spam(), 0);
#else
return get_unsafe_ptr()->is_spam();
#endif
}
#else
template<class GetCategory>
@ -86,7 +91,12 @@ is_spam() {
template<class GetCategory>
INLINE bool NotifyCategoryProxy<GetCategory>::
is_debug() {
// Instruct the compiler to optimize for the usual case.
#ifdef __GNUC__
return __builtin_expect(get_unsafe_ptr()->is_debug(), 0);
#else
return get_unsafe_ptr()->is_debug();
#endif
}
#else
template<class GetCategory>

View File

@ -122,6 +122,13 @@ private:
// constant expressions and compilation will fail if the assertion is not
// true.
#ifdef __GNUC__
// Tell the optimizer to optimize for the case where the condition is true.
#define _nassert_check(condition) (__builtin_expect(!(condition), 0))
#else
#define _nassert_check(condition) (!(condition))
#endif
#ifdef NDEBUG
#define nassertr(condition, return_value)
@ -131,14 +138,14 @@ private:
#define nassertr_always(condition, return_value) \
{ \
if (!(condition)) { \
if (_nassert_check(condition)) { \
return return_value; \
} \
}
#define nassertv_always(condition) \
{ \
if (!(condition)) { \
if (_nassert_check(condition)) { \
return; \
} \
}
@ -151,7 +158,7 @@ private:
#define nassertr(condition, return_value) \
{ \
if (!(condition)) { \
if (_nassert_check(condition)) { \
if (Notify::ptr()->assert_failure(#condition, __LINE__, __FILE__)) { \
return return_value; \
} \
@ -160,7 +167,7 @@ private:
#define nassertv(condition) \
{ \
if (!(condition)) { \
if (_nassert_check(condition)) { \
if (Notify::ptr()->assert_failure(#condition, __LINE__, __FILE__)) { \
return; \
} \
@ -168,7 +175,7 @@ private:
}
#define nassertd(condition) \
if (!(condition) && \
if (_nassert_check(condition) && \
Notify::ptr()->assert_failure(#condition, __LINE__, __FILE__))
#define nassertr_always(condition, return_value) nassertr(condition, return_value)
@ -177,7 +184,7 @@ private:
#define nassert_raise(message) Notify::ptr()->assert_failure(message, __LINE__, __FILE__)
#define enter_debugger_if(condition) \
if (condition) { \
if (_nassert_check(condition)) { \
Notify::ptr()->assert_failure(#condition, __LINE__, __FILE__); \
__asm { int 3 } \
}

View File

@ -571,6 +571,10 @@ if (COMPILER == "MSVC"):
#LibName(pkg, 'ddraw.lib')
LibName(pkg, 'dxguid.lib')
if SDK.get("VISUALSTUDIO_VERSION") == '14.0':
# dxerr needs this for __vsnwprintf definition.
LibName(pkg, 'legacy_stdio_definitions.lib')
if not PkgSkip("FREETYPE") and os.path.isdir(GetThirdpartyDir() + "freetype/include/freetype2"):
IncDirectory("FREETYPE", GetThirdpartyDir() + "freetype/include/freetype2")
@ -637,7 +641,6 @@ if (COMPILER == "MSVC"):
if (PkgSkip("FFTW")==0): LibName("FFTW", GetThirdpartyDir() + "fftw/lib/rfftw.lib")
if (PkgSkip("FFTW")==0): LibName("FFTW", GetThirdpartyDir() + "fftw/lib/fftw.lib")
if (PkgSkip("ARTOOLKIT")==0):LibName("ARTOOLKIT",GetThirdpartyDir() + "artoolkit/lib/libAR.lib")
if (PkgSkip("ASSIMP")==0): PkgDisable("ASSIMP") # Not yet supported
if (PkgSkip("OPENCV")==0): LibName("OPENCV", GetThirdpartyDir() + "opencv/lib/cv.lib")
if (PkgSkip("OPENCV")==0): LibName("OPENCV", GetThirdpartyDir() + "opencv/lib/highgui.lib")
if (PkgSkip("OPENCV")==0): LibName("OPENCV", GetThirdpartyDir() + "opencv/lib/cvaux.lib")
@ -652,6 +655,9 @@ if (COMPILER == "MSVC"):
if (PkgSkip("FCOLLADA")==0):
LibName("FCOLLADA", GetThirdpartyDir() + "fcollada/lib/FCollada.lib")
IncDirectory("FCOLLADA", GetThirdpartyDir() + "fcollada/include/FCollada")
if (PkgSkip("ASSIMP")==0):
LibName("ASSIMP", GetThirdpartyDir() + "assimp/lib/assimp.lib")
IncDirectory("ASSIMP", GetThirdpartyDir() + "assimp/include/assimp")
if (PkgSkip("SQUISH")==0):
if GetOptimize() <= 2:
LibName("SQUISH", GetThirdpartyDir() + "squish/lib/squishd.lib")
@ -1291,7 +1297,7 @@ def CompileCxx(obj,src,opts):
cmd += " -fno-strict-aliasing"
if optlevel >= 3:
cmd += " -ffast-math"
cmd += " -ffast-math -fno-stack-protector"
if optlevel == 3:
# Fast math is nice, but we'd like to see NaN in dev builds.
cmd += " -fno-finite-math-only"
@ -2789,17 +2795,17 @@ else:
tp_dir = GetThirdpartyDir()
if tp_dir is not None:
dylibs = set()
dylibs = {}
if GetTarget() == 'darwin':
# Make a list of all the dylibs we ship, to figure out whether we should use
# install_name_tool to correct the library reference to point to our copy.
for lib in glob.glob(tp_dir + "/*/lib/*.dylib"):
dylibs.add(os.path.basename(lib))
dylibs[os.path.basename(lib)] = os.path.basename(os.path.realpath(lib))
if not PkgSkip("PYTHON"):
for lib in glob.glob(tp_dir + "/*/lib/" + SDK["PYTHONVERSION"] + "/*.dylib"):
dylibs.add(os.path.basename(lib))
dylibs[os.path.basename(lib)] = os.path.basename(os.path.realpath(lib))
for pkg in PkgListGet():
if PkgSkip(pkg):
@ -2854,7 +2860,8 @@ if tp_dir is not None:
libdep = line.split(" ", 1)[0]
dep_basename = os.path.basename(libdep)
if dep_basename in dylibs:
oscmd("install_name_tool -change %s %s%s %s" % (libdep, dep_prefix, dep_basename, target), True)
dep_target = dylibs[dep_basename]
oscmd("install_name_tool -change %s %s%s %s" % (libdep, dep_prefix, dep_target, target), True)
JustBuilt([target], [tp_lib])
@ -2875,7 +2882,8 @@ if tp_dir is not None:
CopyFile(GetOutputDir() + "/" + base, tp_lib)
if GetTarget() == 'windows':
CopyAllFiles(GetOutputDir() + "/bin/", tp_dir + "extras/bin/")
if os.path.isdir(os.path.join(tp_dir, "extras", "bin")):
CopyAllFiles(GetOutputDir() + "/bin/", tp_dir + "extras/bin/")
if not PkgSkip("PYTHON") and not RTDIST:
# We need to copy the Python DLL to the bin directory for now.
@ -5575,7 +5583,7 @@ if not PkgSkip("PANDATOOL") and not PkgSkip("ASSIMP"):
TargetAdd('p3assimp_composite1.obj', opts=OPTS, input='p3assimp_composite1.cxx')
TargetAdd('libp3assimp.dll', input='p3assimp_composite1.obj')
TargetAdd('libp3assimp.dll', input=COMMON_PANDA_LIBS)
TargetAdd('libp3assimp.dll', opts=OPTS)
TargetAdd('libp3assimp.dll', opts=OPTS+['ZLIB'])
#
# DIRECTORY: pandatool/src/daeprogs/

View File

@ -76,7 +76,8 @@ MAYAVERSIONINFO = [("MAYA6", "6.0"),
("MAYA2014","2014"),
("MAYA2015","2015"),
("MAYA2016","2016"),
("MAYA20165","2016.5")
("MAYA20165","2016.5"),
("MAYA2017","2017")
]
MAXVERSIONINFO = [("MAX6", "SOFTWARE\\Autodesk\\3DSMAX\\6.0", "installdir", "maxsdk\\cssdk\\include"),
@ -2383,6 +2384,8 @@ def SetupVisualStudioEnviron():
os.environ["VCINSTALLDIR"] = SDK["VISUALSTUDIO"] + "VC"
os.environ["WindowsSdkDir"] = SDK["MSPLATFORM"]
winsdk_ver = SDK["MSPLATFORM_VERSION"]
# Determine the directories to look in based on the architecture.
arch = GetTargetArch()
bindir = ""
@ -2398,9 +2401,16 @@ def SetupVisualStudioEnviron():
# Special version of the tools that run on x86.
bindir = 'x86_' + bindir
binpath = SDK["VISUALSTUDIO"] + "VC\\bin\\" + bindir
if not os.path.isdir(binpath):
exit("Couldn't find compilers in %s. You may need to install the Windows SDK 7.1 and the Visual C++ 2010 SP1 Compiler Update for Windows SDK 7.1." % binpath)
vc_binpath = SDK["VISUALSTUDIO"] + "VC\\bin"
binpath = os.path.join(vc_binpath, bindir)
if not os.path.isfile(binpath + "\\cl.exe"):
# Try the x86 tools, those should work just as well.
if arch == 'x64' and os.path.isfile(vc_binpath + "\\x86_amd64\\cl.exe"):
binpath = "{0}\\x86_amd64;{0}".format(vc_binpath)
elif winsdk_ver.startswith('10.'):
exit("Couldn't find compilers in %s. You may need to install the Windows SDK 7.1 and the Visual C++ 2010 SP1 Compiler Update for Windows SDK 7.1." % binpath)
else:
exit("Couldn't find compilers in %s." % binpath)
AddToPathEnv("PATH", binpath)
AddToPathEnv("PATH", SDK["VISUALSTUDIO"] + "Common7\\IDE")

View File

@ -12378,11 +12378,6 @@
<TRef> { Tex1 }
<VertexRef> { 670 158 673 <Ref> { panda_mesh.verts } }
}
<Polygon> {
<RGBA> { 1 1 1 1 }
<TRef> { Tex1 }
<VertexRef> { 602 674 627 <Ref> { panda_mesh.verts } }
}
<Polygon> {
<RGBA> { 1 1 1 1 }
<TRef> { Tex1 }
@ -12398,16 +12393,6 @@
<TRef> { Tex1 }
<VertexRef> { 628 630 676 <Ref> { panda_mesh.verts } }
}
<Polygon> {
<RGBA> { 1 1 1 1 }
<TRef> { Tex1 }
<VertexRef> { 674 676 630 <Ref> { panda_mesh.verts } }
}
<Polygon> {
<RGBA> { 1 1 1 1 }
<TRef> { Tex1 }
<VertexRef> { 630 627 674 <Ref> { panda_mesh.verts } }
}
<Polygon> {
<RGBA> { 1 1 1 1 }
<TRef> { Tex1 }
@ -16888,11 +16873,6 @@
<TRef> { Tex1 }
<VertexRef> { 826 1321 1320 <Ref> { panda_mesh.verts } }
}
<Polygon> {
<RGBA> { 1 1 1 1 }
<TRef> { Tex1 }
<VertexRef> { 674 602 627 <Ref> { panda_mesh.verts } }
}
<Polygon> {
<RGBA> { 1 1 1 1 }
<TRef> { Tex1 }
@ -16908,16 +16888,6 @@
<TRef> { Tex1 }
<VertexRef> { 630 1283 676 <Ref> { panda_mesh.verts } }
}
<Polygon> {
<RGBA> { 1 1 1 1 }
<TRef> { Tex1 }
<VertexRef> { 676 674 630 <Ref> { panda_mesh.verts } }
}
<Polygon> {
<RGBA> { 1 1 1 1 }
<TRef> { Tex1 }
<VertexRef> { 627 630 674 <Ref> { panda_mesh.verts } }
}
<Polygon> {
<RGBA> { 1 1 1 1 }
<TRef> { Tex1 }
@ -24400,7 +24370,7 @@
}
<VertexRef> {
294 295 593 595 597 600 602 624 625 626 627 628 629 630 631 632
633 634 635 636 637 638 649 650 651 653 656 657 658 659 674 675
633 634 635 636 637 638 649 650 651 653 656 657 658 659 675
676 956 957 1251 1254 1256 1258 1279 1280 1281 1282 1283 1284 1285
1286 1287 1288 1289 1290 1301 1302 1303 1305 1308 1309 1310 1311
1325

View File

@ -39,6 +39,13 @@ PUBLISHED:
int get_shape_part() const;
int get_triangle_index() const;
MAKE_PROPERTY(node, get_node);
MAKE_PROPERTY(hit_pos, get_hit_pos);
MAKE_PROPERTY(hit_normal, get_hit_normal);
MAKE_PROPERTY(hit_fraction, get_hit_fraction);
MAKE_PROPERTY(shape_part, get_shape_part);
MAKE_PROPERTY(triangle_index, get_triangle_index);
private:
const btCollisionObject *_object;
btVector3 _normal;
@ -69,6 +76,11 @@ PUBLISHED:
const BulletRayHit get_hit(int idx) const;
MAKE_SEQ(get_hits, get_num_hits, get_hit);
MAKE_PROPERTY(from_pos, get_from_pos);
MAKE_PROPERTY(to_pos, get_to_pos);
MAKE_PROPERTY(closest_hit_fraction, get_closest_hit_fraction);
MAKE_SEQ_PROPERTY(hits, get_num_hits, get_hit);
public:
virtual bool needsCollision(btBroadphaseProxy* proxy0) const;
virtual btScalar addSingleResult(btCollisionWorld::LocalRayResult& rayResult, bool normalInWorldSpace);

View File

@ -442,6 +442,15 @@ set_active(bool active, bool force) {
}
}
/**
*
*/
void BulletBodyNode::
force_active(bool active) {
set_active(active, true);
}
/**
* If true, this object will be deactivated after a certain amount of time has
* passed without movement. If false, the object will always remain active.

View File

@ -56,7 +56,7 @@ PUBLISHED:
// Static and kinematic
INLINE bool is_static() const;
INLINE bool is_kinematic() const;
INLINE void set_static(bool value);
INLINE void set_kinematic(bool value);
@ -79,6 +79,7 @@ PUBLISHED:
// Deactivation
bool is_active() const;
void set_active(bool active, bool force=false);
void force_active(bool active);
void set_deactivation_time(PN_stdfloat dt);
PN_stdfloat get_deactivation_time() const;
@ -86,7 +87,7 @@ PUBLISHED:
void set_deactivation_enabled(bool enabled);
bool is_deactivation_enabled() const;
// Debug Visualistion
// Debug Visualisation
INLINE void set_debug_enabled(const bool enabled);
INLINE bool is_debug_enabled() const;
@ -100,6 +101,7 @@ PUBLISHED:
#if BT_BULLET_VERSION >= 281
INLINE PN_stdfloat get_rolling_friction() const;
INLINE void set_rolling_friction(PN_stdfloat friction);
MAKE_PROPERTY(rolling_friction, get_rolling_friction, set_rolling_friction);
#endif
INLINE bool has_anisotropic_friction() const;
@ -115,6 +117,27 @@ PUBLISHED:
// Special
void set_transform_dirty();
MAKE_SEQ_PROPERTY(shapes, get_num_shapes, get_shape);
MAKE_SEQ_PROPERTY(shape_pos, get_num_shapes, get_shape_pos);
MAKE_SEQ_PROPERTY(shape_mat, get_num_shapes, get_shape_mat);
MAKE_SEQ_PROPERTY(shape_transform, get_num_shapes, get_shape_transform);
MAKE_PROPERTY(shape_bounds, get_shape_bounds);
MAKE_PROPERTY(static, is_static, set_static);
MAKE_PROPERTY(kinematic, is_kinematic, set_kinematic);
MAKE_PROPERTY(collision_notification, notifies_collisions, notify_collisions);
MAKE_PROPERTY(collision_response, get_collision_response, set_collision_response);
MAKE_PROPERTY(contact_response, has_contact_response);
MAKE_PROPERTY(contact_processing_threshold, get_contact_processing_threshold, set_contact_processing_threshold);
MAKE_PROPERTY(active, is_active, force_active);
MAKE_PROPERTY(deactivation_time, get_deactivation_time, set_deactivation_time);
MAKE_PROPERTY(deactivation_enabled, is_deactivation_enabled, set_deactivation_enabled);
MAKE_PROPERTY(debug_enabled, is_debug_enabled, set_debug_enabled);
MAKE_PROPERTY(restitution, get_restitution, set_restitution);
MAKE_PROPERTY(friction, get_friction, set_friction);
MAKE_PROPERTY(anisotropic_friction, get_anisotropic_friction, set_anisotropic_friction);
MAKE_PROPERTY(ccd_swept_sphere_radius, get_ccd_swept_sphere_radius, set_ccd_swept_sphere_radius);
MAKE_PROPERTY(ccd_motion_threshold, get_ccd_motion_threshold, set_ccd_motion_threshold);
public:
virtual btCollisionObject *get_object() const = 0;

View File

@ -42,6 +42,9 @@ PUBLISHED:
static BulletBoxShape *make_from_solid(const CollisionBox *solid);
MAKE_PROPERTY(half_extents_with_margin, get_half_extents_with_margin);
MAKE_PROPERTY(half_extents_without_margin, get_half_extents_without_margin);
public:
virtual btCollisionShape *ptr() const;

View File

@ -34,6 +34,9 @@ PUBLISHED:
INLINE PN_stdfloat get_radius() const;
INLINE PN_stdfloat get_half_height() const;
MAKE_PROPERTY(radius, get_radius);
MAKE_PROPERTY(half_height, get_half_height);
public:
virtual btCollisionShape *ptr() const;

View File

@ -296,7 +296,6 @@ set_gravity(PN_stdfloat gravity) {
#endif
}
/**
*
*/
@ -304,4 +303,4 @@ void BulletCharacterControllerNode::
set_use_ghost_sweep_test(bool value) {
return _character->setUseGhostSweepTest(value);
}
}

View File

@ -39,20 +39,27 @@ PUBLISHED:
BulletShape *get_shape() const;
void set_gravity(PN_stdfloat gravity);
PN_stdfloat get_gravity() const;
PN_stdfloat get_max_slope() const;
void set_fall_speed(PN_stdfloat fall_speed);
void set_jump_speed(PN_stdfloat jump_speed);
void set_max_jump_height(PN_stdfloat max_jump_height);
void set_max_slope(PN_stdfloat max_slope);
void set_gravity(PN_stdfloat gravity);
PN_stdfloat get_max_slope() const;
void set_use_ghost_sweep_test(bool value);
bool is_on_ground() const;
bool can_jump() const;
void do_jump();
MAKE_PROPERTY(shape, get_shape);
MAKE_PROPERTY(gravity, get_gravity, set_gravity);
MAKE_PROPERTY(max_slope, get_max_slope, set_max_slope);
MAKE_PROPERTY(on_ground, is_on_ground);
public:
INLINE virtual btPairCachingGhostObject *get_ghost() const;
INLINE virtual btCharacterControllerInterface *get_character() const;

View File

@ -44,6 +44,15 @@ PUBLISHED:
int get_shape_part() const;
int get_triangle_index() const;
MAKE_PROPERTY(from_pos, get_from_pos);
MAKE_PROPERTY(to_pos, get_to_pos);
MAKE_PROPERTY(node, get_node);
MAKE_PROPERTY(hit_pos, get_hit_pos);
MAKE_PROPERTY(hit_normal, get_hit_normal);
MAKE_PROPERTY(hit_fraction, get_hit_fraction);
MAKE_PROPERTY(shape_part, get_shape_part);
MAKE_PROPERTY(triangle_index, get_triangle_index);
public:
virtual bool needsCollision(btBroadphaseProxy* proxy0) const;
virtual btScalar addSingleResult(btCollisionWorld::LocalRayResult& rayResult, bool normalInWorldSpace);

View File

@ -41,6 +41,13 @@ PUBLISHED:
LVector3 get_hit_normal() const;
PN_stdfloat get_hit_fraction() const;
MAKE_PROPERTY(from_pos, get_from_pos);
MAKE_PROPERTY(to_pos, get_to_pos);
MAKE_PROPERTY(node, get_node);
MAKE_PROPERTY(hit_pos, get_hit_pos);
MAKE_PROPERTY(hit_normal, get_hit_normal);
MAKE_PROPERTY(hit_fraction, get_hit_fraction);
public:
virtual bool needsCollision(btBroadphaseProxy* proxy0) const;

View File

@ -34,6 +34,9 @@ PUBLISHED:
INLINE PN_stdfloat get_radius() const;
INLINE PN_stdfloat get_height() const;
MAKE_PROPERTY(radius, get_radius);
MAKE_PROPERTY(height, get_height);
public:
virtual btCollisionShape *ptr() const;

View File

@ -56,6 +56,10 @@ PUBLISHED:
INLINE CPT(TransformState) get_frame_a() const;
INLINE CPT(TransformState) get_frame_b() const;
MAKE_PROPERTY(fix_threshold, get_fix_threshold, set_fix_threshold);
MAKE_PROPERTY(frame_a, get_frame_a);
MAKE_PROPERTY(frame_b, get_frame_b);
public:
virtual btTypedConstraint *ptr() const;

View File

@ -34,7 +34,7 @@ set_breaking_threshold(PN_stdfloat threshold) {
* Returns the applied impluse limit for breaking the constraint.
*/
INLINE PN_stdfloat BulletConstraint::
set_breaking_threshold() const {
get_breaking_threshold() const {
return (PN_stdfloat)ptr()->getBreakingImpulseThreshold();
}

View File

@ -34,13 +34,13 @@ PUBLISHED:
BulletRigidBodyNode *get_rigid_body_b();
void enable_feedback(bool value);
void set_debug_draw_size(PN_stdfloat size);
PN_stdfloat get_applied_impulse() const;
void set_debug_draw_size(PN_stdfloat size);
PN_stdfloat get_debug_draw_size();
PN_stdfloat get_applied_impulse() const;
INLINE void set_breaking_threshold(PN_stdfloat threshold);
INLINE PN_stdfloat set_breaking_threshold() const;
INLINE PN_stdfloat get_breaking_threshold() const;
INLINE void set_enabled(bool enabled);
INLINE bool is_enabled() const;
@ -54,6 +54,13 @@ PUBLISHED:
void set_param(ConstraintParam num, PN_stdfloat value, int axis=-1);
PN_stdfloat get_param(ConstraintParam num, int axis=-1);
MAKE_PROPERTY(rigid_body_a, get_rigid_body_a);
MAKE_PROPERTY(rigid_body_b, get_rigid_body_b);
MAKE_PROPERTY(debug_draw_size, get_debug_draw_size, set_debug_draw_size);
MAKE_PROPERTY(applied_impulse, get_applied_impulse);
MAKE_PROPERTY(breaking_threshold, get_breaking_threshold, set_breaking_threshold);
MAKE_PROPERTY(enabled, is_enabled, set_enabled);
public:
virtual btTypedConstraint *ptr() const = 0;

View File

@ -41,6 +41,14 @@ PUBLISHED:
INLINE int get_index0() const;
INLINE int get_index1() const;
MAKE_PROPERTY(manifold, get_manifold);
MAKE_PROPERTY(node0, get_node0);
MAKE_PROPERTY(node1, get_node1);
MAKE_PROPERTY(part_id0, get_part_id0);
MAKE_PROPERTY(part_id1, get_part_id1);
MAKE_PROPERTY(index0, get_index0);
MAKE_PROPERTY(index1, get_index1);
private:
BulletManifoldPoint &_mp;
PandaNode *_node0;

View File

@ -26,7 +26,7 @@
#include "eventParameter.h"
#include "pandaNode.h"
struct UserPersitentData {
struct UserPersistentData {
PT(PandaNode) node0;
PT(PandaNode) node1;
};
@ -64,7 +64,7 @@ contact_added_callback(btManifoldPoint &cp,
bullet_cat.debug() << "contact added: " << cp.m_userPersistentData << endl;
// Gather persistent data
UserPersitentData *data = new UserPersitentData();
UserPersistentData *data = new UserPersistentData();
data->node0 = node0;
data->node1 = node1;
@ -126,7 +126,7 @@ contact_destroyed_callback(void *userPersistentData) {
bullet_cat.debug() << "contact removed: " << userPersistentData << endl;
UserPersitentData *data = (UserPersitentData *)userPersistentData;
UserPersistentData *data = (UserPersistentData *)userPersistentData;
// Send event
if (bullet_enable_contact_events) {

View File

@ -39,6 +39,14 @@ PUBLISHED:
INLINE int get_part_id0() const;
INLINE int get_part_id1() const;
MAKE_PROPERTY(manifold_point, get_manifold_point);
MAKE_PROPERTY(node0, get_node0);
MAKE_PROPERTY(node1, get_node1);
MAKE_PROPERTY(idx0, get_idx0);
MAKE_PROPERTY(idx1, get_idx1);
MAKE_PROPERTY(part_id0, get_part_id0);
MAKE_PROPERTY(part_id1, get_part_id1);
private:
static btManifoldPoint _empty;
@ -64,6 +72,7 @@ PUBLISHED:
INLINE int get_num_contacts() const;
INLINE BulletContact get_contact(int idx);
MAKE_SEQ(get_contacts, get_num_contacts, get_contact);
MAKE_SEQ_PROPERTY(contacts, get_num_contacts, get_contact);
public:
#if BT_BULLET_VERSION >= 281

View File

@ -36,6 +36,8 @@ PUBLISHED:
INLINE int get_num_points() const;
MAKE_PROPERTY(num_points, get_num_points);
public:
virtual btCollisionShape *ptr() const;

View File

@ -36,6 +36,10 @@ PUBLISHED:
INLINE LVecBase3 get_half_extents_without_margin() const;
INLINE LVecBase3 get_half_extents_with_margin() const;
MAKE_PROPERTY(radius, get_radius);
MAKE_PROPERTY(half_extents_without_margin, get_half_extents_without_margin);
MAKE_PROPERTY(half_extents_with_margin, get_half_extents_with_margin);
public:
virtual btCollisionShape *ptr() const;

View File

@ -29,6 +29,15 @@ show_wireframe(bool show) {
draw_mask_changed();
}
/**
*
*/
INLINE bool BulletDebugNode::
get_show_wireframe() const {
return _wireframe;
}
/**
*
*/
@ -39,6 +48,15 @@ show_constraints(bool show) {
draw_mask_changed();
}
/**
*
*/
INLINE bool BulletDebugNode::
get_show_constraints() const {
return _constraints;
}
/**
*
*/
@ -49,6 +67,15 @@ show_bounding_boxes(bool show) {
draw_mask_changed();
}
/**
*
*/
INLINE bool BulletDebugNode::
get_show_bounding_boxes() const {
return _bounds;
}
/**
*
*/
@ -57,3 +84,12 @@ show_normals(bool show) {
_drawer._normals = show;
}
/**
*
*/
INLINE bool BulletDebugNode::
get_show_normals() const {
return _drawer._normals;
}

View File

@ -35,6 +35,15 @@ PUBLISHED:
INLINE void show_constraints(bool show);
INLINE void show_bounding_boxes(bool show);
INLINE void show_normals(bool show);
INLINE bool get_show_wireframe() const;
INLINE bool get_show_constraints() const;
INLINE bool get_show_bounding_boxes() const;
INLINE bool get_show_normals() const;
MAKE_PROPERTY(wireframe, get_show_wireframe, show_wireframe);
MAKE_PROPERTY(constraints, get_show_constraints, show_constraints);
MAKE_PROPERTY(bounding_boxes, get_show_bounding_boxes, show_bounding_boxes);
MAKE_PROPERTY(normals, get_show_normals, show_normals);
public:
virtual bool safe_to_flatten() const;

View File

@ -36,6 +36,10 @@ PUBLISHED:
INLINE void set_collide(bool collide);
INLINE bool get_collide() const;
MAKE_PROPERTY(node_0, get_node_0);
MAKE_PROPERTY(node_1, get_node_1);
MAKE_PROPERTY(collide, get_collide, set_collide);
private:
PandaNode *_node0;
PandaNode *_node1;

View File

@ -61,6 +61,10 @@ PUBLISHED:
INLINE CPT(TransformState) get_frame_a() const;
INLINE CPT(TransformState) get_frame_b() const;
MAKE_PROPERTY(translational_limit_motor, get_translational_limit_motor);
MAKE_PROPERTY(frame_a, get_frame_a);
MAKE_PROPERTY(frame_b, get_frame_b);
public:
virtual btTypedConstraint *ptr() const;

View File

@ -38,6 +38,8 @@ PUBLISHED:
INLINE int get_num_overlapping_nodes() const;
INLINE PandaNode *get_overlapping_node(int idx) const;
MAKE_SEQ(get_overlapping_nodes, get_num_overlapping_nodes, get_overlapping_node);
MAKE_SEQ_PROPERTY(overlapping_nodes, get_num_overlapping_nodes, get_overlapping_node);
public:
virtual btCollisionObject *get_object() const;

View File

@ -51,6 +51,9 @@ PUBLISHED:
static void make_texcoords_for_patch(Geom *geom, int resx, int resy);
MAKE_PROPERTY(sb_index, get_sb_index);
MAKE_PROPERTY(sb_flip, get_sb_flip);
private:
static PT(InternalName) _sb_index;
static PT(InternalName) _sb_flip;

View File

@ -73,6 +73,13 @@ PUBLISHED:
INLINE CPT(TransformState) get_frame_a() const;
INLINE CPT(TransformState) get_frame_b() const;
MAKE_PROPERTY(hinge_angle, get_hinge_angle);
MAKE_PROPERTY(lower_limit, get_lower_limit);
MAKE_PROPERTY(upper_limit, get_upper_limit);
MAKE_PROPERTY(angular_only, get_angular_only, set_angular_only);
MAKE_PROPERTY(frame_a, get_frame_a);
MAKE_PROPERTY(frame_b, get_frame_b);
public:
virtual btTypedConstraint *ptr() const;

View File

@ -68,6 +68,30 @@ PUBLISHED:
INLINE PN_stdfloat get_contact_cfm1() const;
INLINE PN_stdfloat get_contact_cfm2() const;
MAKE_PROPERTY(life_time, get_life_time);
MAKE_PROPERTY(distance, get_distance);
MAKE_PROPERTY(applied_impulse, get_applied_impulse, set_applied_impulse);
MAKE_PROPERTY(position_world_on_a, get_position_world_on_a);
MAKE_PROPERTY(position_world_on_b, get_position_world_on_b);
MAKE_PROPERTY(normal_world_on_b, get_normal_world_on_b);
MAKE_PROPERTY(local_point_a, get_local_point_a);
MAKE_PROPERTY(local_point_b, get_local_point_b);
MAKE_PROPERTY(part_id0, get_part_id0);
MAKE_PROPERTY(part_id1, get_part_id1);
MAKE_PROPERTY(index0, get_index0);
MAKE_PROPERTY(index1, get_index1);
MAKE_PROPERTY(lateral_friction_initialized, get_lateral_friction_initialized, set_lateral_friction_initialized);
MAKE_PROPERTY(lateral_friction_dir1, get_lateral_friction_dir1, set_lateral_friction_dir1);
MAKE_PROPERTY(lateral_friction_dir2, get_lateral_friction_dir2, set_lateral_friction_dir2);
MAKE_PROPERTY(contact_motion1, get_contact_motion1, set_contact_motion1);
MAKE_PROPERTY(contact_motion2, get_contact_motion2, set_contact_motion2);
MAKE_PROPERTY(combined_friction, get_combined_friction, set_combined_friction);
MAKE_PROPERTY(combined_restitution, get_combined_restitution, set_combined_restitution);
MAKE_PROPERTY(applied_impulse_lateral1, get_applied_impulse_lateral1, set_applied_impulse_lateral1);
MAKE_PROPERTY(applied_impulse_lateral2, get_applied_impulse_lateral2, set_applied_impulse_lateral2);
MAKE_PROPERTY(contact_cfm1, get_contact_cfm1, set_contact_cfm1);
MAKE_PROPERTY(contact_cfm2, get_contact_cfm2, set_contact_cfm2);
public:
BulletManifoldPoint(btManifoldPoint &pt);

View File

@ -43,6 +43,12 @@ PUBLISHED:
INLINE PN_stdfloat get_margin() const;
MAKE_PROPERTY(transform_a, get_transform_a, set_transform_a);
MAKE_PROPERTY(transform_b, get_transform_b, set_transform_b);
MAKE_PROPERTY(shape_a, get_shape_a);
MAKE_PROPERTY(shape_b, get_shape_b);
MAKE_PROPERTY(margin, get_margin);
public:
virtual btCollisionShape *ptr() const;

View File

@ -37,6 +37,10 @@ PUBLISHED:
INLINE LPoint3 get_sphere_pos(int index) const;
INLINE PN_stdfloat get_sphere_radius(int index) const;
MAKE_PROPERTY(sphere_count, get_sphere_count);
MAKE_SEQ_PROPERTY(sphere_pos, get_sphere_count, get_sphere_pos);
MAKE_SEQ_PROPERTY(sphere_radius, get_sphere_count, get_sphere_radius);
public:
virtual btCollisionShape *ptr() const;

View File

@ -42,6 +42,12 @@ PUBLISHED:
void clear_manifold();
MAKE_PROPERTY(node0, get_node0);
MAKE_PROPERTY(node1, get_node1);
MAKE_SEQ_PROPERTY(manifold_points, get_num_manifold_points, get_manifold_point);
MAKE_PROPERTY(contact_breaking_threshold, get_contact_breaking_threshold);
MAKE_PROPERTY(contact_processing_threshold, get_contact_processing_threshold);
public:
BulletPersistentManifold(btPersistentManifold *manifold);

View File

@ -42,6 +42,9 @@ PUBLISHED:
static BulletPlaneShape *make_from_solid(const CollisionPlane *solid);
MAKE_PROPERTY(plane_normal, get_plane_normal);
MAKE_PROPERTY(plane_constant, get_plane_constant);
public:
virtual btCollisionShape *ptr() const;

View File

@ -86,6 +86,23 @@ PUBLISHED:
// Special
bool pick_dirty_flag();
MAKE_PROPERTY(mass, get_mass, set_mass);
MAKE_PROPERTY(inv_mass, get_inv_mass);
MAKE_PROPERTY(inertia, get_inertia, set_inertia);
MAKE_PROPERTY(inv_inertia_diag_local, get_inv_inertia_diag_local);
MAKE_PROPERTY(inv_inertia_tensor_world, get_inv_inertia_tensor_world);
MAKE_PROPERTY(linear_velocity, get_linear_velocity, set_linear_velocity);
MAKE_PROPERTY(angular_velocity, get_angular_velocity, set_angular_velocity);
MAKE_PROPERTY(linear_damping, get_linear_damping, set_linear_damping);
MAKE_PROPERTY(angular_damping, get_angular_damping, set_angular_damping);
MAKE_PROPERTY(total_force, get_total_force);
MAKE_PROPERTY(total_torque, get_total_torque);
MAKE_PROPERTY(linear_sleep_threshold, get_linear_sleep_threshold, set_linear_sleep_threshold);
MAKE_PROPERTY(angular_sleep_threshold, get_angular_sleep_threshold, set_angular_sleep_threshold);
MAKE_PROPERTY(gravity, get_gravity, set_gravity);
MAKE_PROPERTY(linear_factor, get_linear_factor, set_linear_factor);
MAKE_PROPERTY(angular_factor, get_angular_factor, set_angular_factor);
public:
virtual btCollisionObject *get_object() const;

View File

@ -50,6 +50,13 @@ PUBLISHED:
INLINE PN_stdfloat get_current_position() const;
INLINE PN_stdfloat get_accumulated_impulse() const;
MAKE_PROPERTY(limited, is_limited);
MAKE_PROPERTY(motor_enabled, get_motor_enabled, set_motor_enabled);
MAKE_PROPERTY(current_limit, get_current_limit);
MAKE_PROPERTY(current_error, get_current_error);
MAKE_PROPERTY(current_position, get_current_position);
MAKE_PROPERTY(accumulated_impulse, get_accumulated_impulse);
public:
BulletRotationalLimitMotor(btRotationalLimitMotor &motor);

View File

@ -45,10 +45,20 @@ PUBLISHED:
PN_stdfloat get_margin() const;
BoundingSphere get_shape_bounds() const;
MAKE_PROPERTY(polyhedral, is_polyhedral);
MAKE_PROPERTY(convex, is_convex);
MAKE_PROPERTY(convex_2d, is_convex_2d);
MAKE_PROPERTY(concave, is_concave);
MAKE_PROPERTY(infinite, is_infinite);
MAKE_PROPERTY(non_moving, is_non_moving);
MAKE_PROPERTY(soft_body, is_soft_body);
MAKE_PROPERTY(margin, get_margin, set_margin);
MAKE_PROPERTY(name, get_name);
MAKE_PROPERTY(shape_bounds, get_shape_bounds);
public:
virtual btCollisionShape *ptr() const = 0;
LVecBase3 get_local_scale() const;
void set_local_scale(const LVecBase3 &scale);

View File

@ -74,6 +74,21 @@ PUBLISHED:
INLINE CPT(TransformState) get_frame_a() const;
INLINE CPT(TransformState) get_frame_b() const;
MAKE_PROPERTY(linear_pos, get_linear_pos);
MAKE_PROPERTY(angular_pos, get_angular_pos);
MAKE_PROPERTY(lower_linear_limit, get_lower_linear_limit, set_lower_linear_limit);
MAKE_PROPERTY(upper_linear_limit, get_upper_linear_limit, set_upper_linear_limit);
MAKE_PROPERTY(lower_angular_limit, get_lower_angular_limit, set_lower_angular_limit);
MAKE_PROPERTY(upper_angular_limit, get_upper_angular_limit, set_upper_angular_limit);
MAKE_PROPERTY(powered_linear_motor, get_powered_linear_motor, set_powered_linear_motor);
MAKE_PROPERTY(target_linear_motor_velocity, get_target_linear_motor_velocity, set_target_linear_motor_velocity);
MAKE_PROPERTY(max_linear_motor_force, get_max_linear_motor_force, set_max_linear_motor_force);
MAKE_PROPERTY(powered_angular_motor, get_powered_angular_motor, set_powered_angular_motor);
MAKE_PROPERTY(target_angular_motor_velocity, get_target_angular_motor_velocity, set_target_angular_motor_velocity);
MAKE_PROPERTY(max_angular_motor_force, get_max_angular_motor_force, set_max_angular_motor_force);
MAKE_PROPERTY(frame_a, get_frame_a);
MAKE_PROPERTY(frame_b, get_frame_b);
public:
virtual btTypedConstraint *ptr() const;

View File

@ -113,7 +113,7 @@ set_pressure_coefficient(PN_stdfloat value) {
* Getter for property kVC.
*/
INLINE PN_stdfloat BulletSoftBodyConfig::
get_volume_conversation_coefficient() const {
get_volume_conservation_coefficient() const {
return (PN_stdfloat)_cfg.kVC;
}
@ -122,7 +122,7 @@ get_volume_conversation_coefficient() const {
* Setter for property kVC.
*/
INLINE void BulletSoftBodyConfig::
set_volume_conversation_coefficient(PN_stdfloat value) {
set_volume_conservation_coefficient(PN_stdfloat value) {
_cfg.kVC = (btScalar)value;
}

View File

@ -56,7 +56,7 @@ PUBLISHED:
INLINE void set_drag_coefficient(PN_stdfloat value);
INLINE void set_lift_coefficient(PN_stdfloat value);
INLINE void set_pressure_coefficient(PN_stdfloat value);
INLINE void set_volume_conversation_coefficient(PN_stdfloat value);
INLINE void set_volume_conservation_coefficient(PN_stdfloat value);
INLINE void set_dynamic_friction_coefficient(PN_stdfloat value);
INLINE void set_pose_matching_coefficient(PN_stdfloat value);
INLINE void set_rigid_contacts_hardness(PN_stdfloat value);
@ -81,7 +81,7 @@ PUBLISHED:
INLINE PN_stdfloat get_drag_coefficient() const;
INLINE PN_stdfloat get_lift_coefficient() const;
INLINE PN_stdfloat get_pressure_coefficient() const;
INLINE PN_stdfloat get_volume_conversation_coefficient() const;
INLINE PN_stdfloat get_volume_conservation_coefficient() const;
INLINE PN_stdfloat get_dynamic_friction_coefficient() const;
INLINE PN_stdfloat get_pose_matching_coefficient() const;
INLINE PN_stdfloat get_rigid_contacts_hardness() const;
@ -101,6 +101,32 @@ PUBLISHED:
INLINE int get_drift_solver_iterations() const;
INLINE int get_cluster_solver_iterations() const;
MAKE_PROPERTY(aero_model, get_aero_model, set_aero_model);
MAKE_PROPERTY(velocities_correction_factor, get_velocities_correction_factor, set_velocities_correction_factor);
MAKE_PROPERTY(damping_coefficient, get_damping_coefficient, set_damping_coefficient);
MAKE_PROPERTY(drag_coefficient, get_drag_coefficient, set_drag_coefficient);
MAKE_PROPERTY(lift_coefficient, get_lift_coefficient, set_lift_coefficient);
MAKE_PROPERTY(pressure_coefficient, get_pressure_coefficient, set_pressure_coefficient);
MAKE_PROPERTY(volume_conservation_coefficient, get_volume_conservation_coefficient, set_volume_conservation_coefficient);
MAKE_PROPERTY(dynamic_friction_coefficient, get_dynamic_friction_coefficient, set_dynamic_friction_coefficient);
MAKE_PROPERTY(pose_matching_coefficient, get_pose_matching_coefficient, set_pose_matching_coefficient);
MAKE_PROPERTY(rigid_contacts_hardness, get_rigid_contacts_hardness, set_rigid_contacts_hardness);
MAKE_PROPERTY(kinetic_contacts_hardness, get_kinetic_contacts_hardness, set_kinetic_contacts_hardness);
MAKE_PROPERTY(soft_contacts_hardness, get_soft_contacts_hardness, set_soft_contacts_hardness);
MAKE_PROPERTY(anchors_hardness, get_anchors_hardness, set_anchors_hardness);
MAKE_PROPERTY(soft_vs_rigid_hardness, get_soft_vs_rigid_hardness, set_soft_vs_rigid_hardness);
MAKE_PROPERTY(soft_vs_kinetic_hardness, get_soft_vs_kinetic_hardness, set_soft_vs_kinetic_hardness);
MAKE_PROPERTY(soft_vs_soft_hardness, get_soft_vs_soft_hardness, set_soft_vs_soft_hardness);
MAKE_PROPERTY(soft_vs_rigid_impulse_split, get_soft_vs_rigid_impulse_split, set_soft_vs_rigid_impulse_split);
MAKE_PROPERTY(soft_vs_kinetic_impulse_split, get_soft_vs_kinetic_impulse_split, set_soft_vs_kinetic_impulse_split);
MAKE_PROPERTY(soft_vs_soft_impulse_split, get_soft_vs_soft_impulse_split, set_soft_vs_soft_impulse_split);
MAKE_PROPERTY(maxvolume, get_maxvolume, set_maxvolume);
MAKE_PROPERTY(timescale, get_timescale, set_timescale);
MAKE_PROPERTY(positions_solver_iterations, get_positions_solver_iterations, set_positions_solver_iterations);
MAKE_PROPERTY(velocities_solver_iterations, get_velocities_solver_iterations, set_velocities_solver_iterations);
MAKE_PROPERTY(drift_solver_iterations, get_drift_solver_iterations, set_drift_solver_iterations);
MAKE_PROPERTY(cluster_solver_iterations, get_cluster_solver_iterations, set_cluster_solver_iterations);
public:
BulletSoftBodyConfig(btSoftBody::Config &cfg);

View File

@ -27,16 +27,17 @@ PUBLISHED:
INLINE ~BulletSoftBodyMaterial();
INLINE static BulletSoftBodyMaterial empty();
INLINE void set_linear_stiffness(PN_stdfloat value);
INLINE PN_stdfloat get_linear_stiffness() const;
MAKE_PROPERTY(linear_stiffness, get_linear_stiffness, set_linear_stiffness);
INLINE void set_linear_stiffness(PN_stdfloat value);
INLINE void set_angular_stiffness(PN_stdfloat value);
INLINE PN_stdfloat get_angular_stiffness() const;
MAKE_PROPERTY(angular_stiffness, get_angular_stiffness, set_angular_stiffness);
INLINE void set_angular_stiffness(PN_stdfloat value);
INLINE void set_volume_preservation(PN_stdfloat value);
INLINE PN_stdfloat get_volume_preservation() const;
INLINE void set_volume_preservation(PN_stdfloat value);
MAKE_PROPERTY(linear_stiffness, get_linear_stiffness, set_linear_stiffness);
MAKE_PROPERTY(angular_stiffness, get_angular_stiffness, set_angular_stiffness);
MAKE_PROPERTY(volume_preservation, get_volume_preservation, set_volume_preservation);
public:

View File

@ -50,6 +50,13 @@ PUBLISHED:
INLINE PN_stdfloat get_area() const;
INLINE int is_attached() const;
MAKE_PROPERTY(pos, get_pos);
MAKE_PROPERTY(velocity, get_velocity);
MAKE_PROPERTY(normal, get_normal);
MAKE_PROPERTY(inv_mass, get_inv_mass);
MAKE_PROPERTY(area, get_area);
MAKE_PROPERTY(attached, is_attached);
public:
BulletSoftBodyNodeElement(btSoftBody::Node &node);
@ -203,6 +210,14 @@ PUBLISHED:
const char *face,
const char *node);
MAKE_PROPERTY(cfg, get_cfg);
MAKE_PROPERTY(world_info, get_world_info);
MAKE_PROPERTY(wind_velocity, get_wind_velocity, set_wind_velocity);
MAKE_PROPERTY(aabb, get_aabb);
MAKE_PROPERTY(num_clusters, get_num_clusters);
MAKE_SEQ_PROPERTY(materials, get_num_materials, get_material);
MAKE_SEQ_PROPERTY(nodes, get_num_nodes, get_node);
public:
virtual btCollisionObject *get_object() const;

View File

@ -31,6 +31,8 @@ PUBLISHED:
BulletSoftBodyNode *get_body() const;
MAKE_PROPERTY(body, get_body);
public:
BulletSoftBodyShape(btSoftBodyCollisionShape *shapePtr);

View File

@ -43,6 +43,12 @@ PUBLISHED:
void garbage_collect(int lifetime=256);
MAKE_PROPERTY(air_density, get_air_density, set_air_density);
MAKE_PROPERTY(water_density, get_water_density, set_water_density);
MAKE_PROPERTY(water_offset, get_water_offset, set_water_offset);
MAKE_PROPERTY(water_normal, get_water_normal, set_water_normal);
MAKE_PROPERTY(gravity, get_gravity, set_gravity);
public:
BulletSoftBodyWorldInfo(btSoftBodyWorldInfo &_info);

View File

@ -40,6 +40,8 @@ PUBLISHED:
static BulletSphereShape *make_from_solid(const CollisionSphere *solid);
MAKE_PROPERTY(radius, get_radius);
public:
virtual btCollisionShape *ptr() const;

View File

@ -48,6 +48,9 @@ PUBLISHED:
LPoint3 get_pivot_in_a() const;
LPoint3 get_pivot_in_b() const;
MAKE_PROPERTY(pivot_a, get_pivot_in_a, set_pivot_a);
MAKE_PROPERTY(pivot_b, get_pivot_in_b, set_pivot_b);
public:
virtual btTypedConstraint *ptr() const;

View File

@ -30,6 +30,8 @@ PUBLISHED:
INLINE PN_stdfloat get_timestep() const;
MAKE_PROPERTY(timestep, get_timestep);
private:
btScalar _timestep;

View File

@ -32,8 +32,8 @@ PUBLISHED:
INLINE void set_motor_enabled(int axis, bool enable);
INLINE void set_low_limit(const LVecBase3 &limit);
INLINE void set_high_limit(const LVecBase3 & limit);
INLINE void set_target_velocity(const LVecBase3&velocity);
INLINE void set_high_limit(const LVecBase3 &limit);
INLINE void set_target_velocity(const LVecBase3 &velocity);
INLINE void set_max_motor_force(const LVecBase3 &force);
INLINE void set_damping(PN_stdfloat damping);
INLINE void set_softness(PN_stdfloat softness);
@ -49,6 +49,10 @@ PUBLISHED:
INLINE LPoint3 get_current_diff() const;
INLINE LVector3 get_accumulated_impulse() const;
MAKE_PROPERTY(current_error, get_current_error);
MAKE_PROPERTY(current_diff, get_current_diff);
MAKE_PROPERTY(accumulated_impulse, get_accumulated_impulse);
public:
BulletTranslationalLimitMotor(btTranslationalLimitMotor &motor);

View File

@ -55,6 +55,9 @@ PUBLISHED:
virtual void output(ostream &out) const;
virtual void write(ostream &out, int indent_level) const;
MAKE_PROPERTY(num_triangles, get_num_triangles);
MAKE_PROPERTY(welding_distance, get_welding_distance, set_welding_distance);
public:
INLINE btTriangleMesh *ptr() const;

View File

@ -41,6 +41,9 @@ PUBLISHED:
INLINE bool is_static() const;
INLINE bool is_dynamic() const;
MAKE_PROPERTY(static, is_static);
MAKE_PROPERTY(dynamic, is_dynamic);
public:
virtual btCollisionShape *ptr() const;

View File

@ -46,6 +46,13 @@ PUBLISHED:
INLINE PN_stdfloat get_friction_slip() const;
INLINE PN_stdfloat get_max_suspension_force() const;
MAKE_PROPERTY(suspension_stiffness, get_suspension_stiffness, set_suspension_stiffness);
MAKE_PROPERTY(suspension_compression, get_suspension_compression, set_suspension_compression);
MAKE_PROPERTY(suspension_damping, get_suspension_damping, set_suspension_damping);
MAKE_PROPERTY(max_suspension_travel_cm, get_max_suspension_travel_cm, set_max_suspension_travel_cm);
MAKE_PROPERTY(friction_slip, get_friction_slip, set_friction_slip);
MAKE_PROPERTY(max_suspension_force, get_max_suspension_force, set_max_suspension_force);
private:
btRaycastVehicle::btVehicleTuning _;
@ -87,6 +94,12 @@ PUBLISHED:
// Tuning
INLINE BulletVehicleTuning &get_tuning();
MAKE_PROPERTY(chassis, get_chassis);
MAKE_PROPERTY(current_speed_km_hour, get_current_speed_km_hour);
MAKE_PROPERTY(forward_vector, get_forward_vector);
MAKE_SEQ_PROPERTY(wheels, get_num_wheels, get_wheel);
MAKE_PROPERTY(tuning, get_tuning);
public:
INLINE btRaycastVehicle *get_vehicle() const;

View File

@ -39,6 +39,15 @@ PUBLISHED:
INLINE LPoint3 get_hard_point_ws() const;
INLINE PandaNode *get_ground_object() const;
MAKE_PROPERTY(in_contact, is_in_contact);
MAKE_PROPERTY(suspension_length, get_suspension_length);
MAKE_PROPERTY(contact_normal_ws, get_contact_normal_ws);
MAKE_PROPERTY(wheel_direction_ws, get_wheel_direction_ws);
MAKE_PROPERTY(wheel_axle_ws, get_wheel_axle_ws);
MAKE_PROPERTY(contact_point_ws, get_contact_point_ws);
MAKE_PROPERTY(hard_point_ws, get_hard_point_ws);
MAKE_PROPERTY(ground_object, get_ground_object);
public:
BulletWheelRaycastInfo(btWheelInfo::RaycastInfo &info);
@ -105,6 +114,32 @@ PUBLISHED:
PandaNode *get_node() const;
BulletWheelRaycastInfo get_raycast_info() const;
MAKE_PROPERTY(raycast_info, get_raycast_info);
MAKE_PROPERTY(suspension_rest_length, get_suspension_rest_length);
MAKE_PROPERTY(suspension_stiffness, get_suspension_stiffness, set_suspension_stiffness);
MAKE_PROPERTY(max_suspension_travel_cm, get_max_suspension_travel_cm, set_max_suspension_travel_cm);
MAKE_PROPERTY(friction_slip, get_friction_slip, set_friction_slip);
MAKE_PROPERTY(max_suspension_force, get_max_suspension_force, set_max_suspension_force);
MAKE_PROPERTY(wheels_damping_compression, get_wheels_damping_compression, set_wheels_damping_compression);
MAKE_PROPERTY(wheels_damping_relaxation, get_wheels_damping_relaxation, set_wheels_damping_relaxation);
MAKE_PROPERTY(roll_influence, get_roll_influence, set_roll_influence);
MAKE_PROPERTY(wheel_radius, get_wheel_radius, set_wheel_radius);
MAKE_PROPERTY(steering, get_steering, set_steering);
MAKE_PROPERTY(rotation, get_rotation, set_rotation);
MAKE_PROPERTY(delta_rotation, get_delta_rotation, set_delta_rotation);
MAKE_PROPERTY(engine_force, get_engine_force, set_engine_force);
MAKE_PROPERTY(brake, get_brake, set_brake);
MAKE_PROPERTY(skid_info, get_skid_info, set_skid_info);
MAKE_PROPERTY(wheels_suspension_force, get_wheels_suspension_force, set_wheels_suspension_force);
MAKE_PROPERTY(suspension_relative_velocity, get_suspension_relative_velocity, set_suspension_relative_velocity);
MAKE_PROPERTY(clipped_inv_connection_point_cs, get_clipped_inv_connection_point_cs, set_clipped_inv_connection_point_cs);
MAKE_PROPERTY(chassis_connection_point_cs, get_chassis_connection_point_cs, set_chassis_connection_point_cs);
MAKE_PROPERTY(wheel_direction_cs, get_wheel_direction_cs, set_wheel_direction_cs);
MAKE_PROPERTY(wheel_axle_cs, get_wheel_axle_cs, set_wheel_axle_cs);
MAKE_PROPERTY(world_transform, get_world_transform, set_world_transform);
MAKE_PROPERTY(front_wheel, is_front_wheel, set_front_wheel);
MAKE_PROPERTY(node, get_node, set_node);
public:
BulletWheel(btWheelInfo &info);

View File

@ -81,6 +81,15 @@ get_debug_node() const {
return _debug;
}
/**
*
*/
INLINE bool BulletWorld::
has_debug_node() const {
return _debug != NULL;
}
/**
*
*/

View File

@ -65,6 +65,7 @@ PUBLISHED:
INLINE void set_debug_node(BulletDebugNode *node);
INLINE void clear_debug_node();
INLINE BulletDebugNode *get_debug_node() const;
INLINE bool has_debug_node() const;
// AttachRemove
void attach(TypedObject *object);
@ -159,6 +160,17 @@ PUBLISHED:
FA_callback,
};
MAKE_PROPERTY(gravity, get_gravity, set_gravity);
MAKE_PROPERTY(world_info, get_world_info);
MAKE_PROPERTY2(debug_node, has_debug_node, get_debug_node, set_debug_node, clear_debug_node);
MAKE_SEQ_PROPERTY(ghosts, get_num_ghosts, get_ghost);
MAKE_SEQ_PROPERTY(rigid_bodies, get_num_rigid_bodies, get_rigid_body);
MAKE_SEQ_PROPERTY(soft_bodies, get_num_soft_bodies, get_soft_body);
MAKE_SEQ_PROPERTY(characters, get_num_characters, get_character);
MAKE_SEQ_PROPERTY(vehicles, get_num_vehicles, get_vehicle);
MAKE_SEQ_PROPERTY(constraints, get_num_constraints, get_constraint);
MAKE_SEQ_PROPERTY(manifolds, get_num_manifolds, get_manifold);
PUBLISHED: // Deprecated methods, will become private soon
void attach_ghost(BulletGhostNode *node);
void remove_ghost(BulletGhostNode *node);

View File

@ -122,8 +122,10 @@ void CharacterJointEffect::
cull_callback(CullTraverser *trav, CullTraverserData &data,
CPT(TransformState) &node_transform,
CPT(RenderState) &) const {
CPT(TransformState) dummy_transform = TransformState::make_identity();
adjust_transform(dummy_transform, node_transform, data.node());
if (_character.is_valid_pointer()) {
_character->update();
}
node_transform = data.node()->get_transform();
}
/**
@ -147,7 +149,7 @@ has_adjust_transform() const {
void CharacterJointEffect::
adjust_transform(CPT(TransformState) &net_transform,
CPT(TransformState) &node_transform,
PandaNode *node) const {
const PandaNode *node) const {
if (_character.is_valid_pointer()) {
_character->update();
}

View File

@ -53,7 +53,7 @@ public:
virtual bool has_adjust_transform() const;
virtual void adjust_transform(CPT(TransformState) &net_transform,
CPT(TransformState) &node_transform,
PandaNode *node) const;
const PandaNode *node) const;
protected:
virtual int compare_to_impl(const RenderEffect *other) const;

View File

@ -111,10 +111,12 @@ any_in_bounds() {
}
#endif // NDEBUG
CPT(BoundingVolume) node_bv = node()->get_bounds();
PandaNode *pnode = node();
CPT(BoundingVolume) node_bv = pnode->get_bounds();
if (node_bv->is_of_type(GeometricBoundingVolume::get_class_type())) {
const GeometricBoundingVolume *node_gbv;
DCAST_INTO_R(node_gbv, node_bv, false);
const GeometricBoundingVolume *node_gbv = (const GeometricBoundingVolume *)node_bv.p();
CollideMask this_mask = pnode->get_net_collide_mask();
int num_colliders = get_num_colliders();
for (int c = 0; c < num_colliders; c++) {
@ -125,10 +127,10 @@ any_in_bounds() {
// Don't even bother testing the bounding volume if there are no
// collide bits in common between our collider and this node.
CollideMask from_mask = cnode->get_from_collide_mask() & _include_mask;
if (!(from_mask & node()->get_net_collide_mask()).is_zero()) {
if (!(from_mask & this_mask).is_zero()) {
// Also don't test a node with itself, or with any of its
// descendants.
if (node() == cnode) {
if (pnode == cnode) {
#ifndef NDEBUG
if (collide_cat.is_spam()) {
indent(collide_cat.spam(false), indent_level)

View File

@ -51,7 +51,7 @@ public:
INLINE CollisionLevelStateBase(const NodePath &node_path);
INLINE CollisionLevelStateBase(const CollisionLevelStateBase &parent,
PandaNode *child);
PandaNode *child);
INLINE CollisionLevelStateBase(const CollisionLevelStateBase &copy);
INLINE void operator = (const CollisionLevelStateBase &copy);

View File

@ -196,7 +196,7 @@ cull_callback(CullTraverser *trav, CullTraverserData &data) {
if (respect_prev_transform) {
// Determine the previous frame's position, relative to the current
// position.
NodePath node_path = data._node_path.get_node_path();
NodePath node_path = data.get_node_path();
CPT(TransformState) transform = node_path.get_net_transform()->invert_compose(node_path.get_net_prev_transform());
if (!transform->is_identity()) {

View File

@ -93,6 +93,8 @@ private:
typedef pvector< COWPT(CollisionSolid) > Solids;
Solids _solids;
friend class CollisionTraverser;
public:
static void register_with_read_factory();
virtual void write_datagram(BamWriter *manager, Datagram &dg);

View File

@ -57,7 +57,7 @@ public:
inline bool operator () (int a, int b) const {
const CollisionTraverser::OrderedColliderDef &ocd_a = _trav._ordered_colliders[a];
const CollisionTraverser::OrderedColliderDef &ocd_b = _trav._ordered_colliders[b];
return DCAST(CollisionNode, ocd_a._node_path.node())->get_collider_sort() < DCAST(CollisionNode, ocd_b._node_path.node())->get_collider_sort();
return ((const CollisionNode *)ocd_a._node_path.node())->get_collider_sort() < ((const CollisionNode *)ocd_b._node_path.node())->get_collider_sort();
}
const CollisionTraverser &_trav;
@ -1117,31 +1117,45 @@ compare_collider_to_node(CollisionEntry &entry,
}
if (within_node_bounds) {
Thread *current_thread = Thread::get_current_thread();
CollisionNode *cnode;
DCAST_INTO_V(cnode, entry._into_node);
int num_solids = cnode->get_num_solids();
collide_cat.spam()
<< "Colliding against CollisionNode " << entry._into_node
<< " which has " << num_solids << " collision solids.\n";
for (int s = 0; s < num_solids; ++s) {
entry._into = cnode->get_solid(s);
if (collide_cat.is_spam()) {
collide_cat.spam()
<< "Colliding against CollisionNode " << entry._into_node
<< " which has " << num_solids << " collision solids.\n";
}
// We should allow a collision test for solid into itself, because the
// solid might be simply instanced into multiple different
// CollisionNodes. We are already filtering out tests for a
// CollisionNode into itself.
CPT(BoundingVolume) solid_bv = entry._into->get_bounds();
const GeometricBoundingVolume *solid_gbv = NULL;
if (num_solids > 1 &&
solid_bv->is_of_type(GeometricBoundingVolume::get_class_type())) {
// Only bother to test against each solid's bounding volume if we have
// more than one solid in the node, as a slight optimization. (If the
// node contains just one solid, then the node's bounding volume,
// which we just tested, is the same as the solid's bounding volume.)
DCAST_INTO_V(solid_gbv, solid_bv);
// Only bother to test against each solid's bounding volume if we have
// more than one solid in the node, as a slight optimization. (If the
// node contains just one solid, then the node's bounding volume, which
// we just tested, is the same as the solid's bounding volume.)
if (num_solids == 1) {
entry._into = cnode->_solids[0].get_read_pointer(current_thread);
Colliders::const_iterator ci;
ci = _colliders.find(entry.get_from_node_path());
nassertv(ci != _colliders.end());
entry.test_intersection((*ci).second, this);
} else {
CollisionNode::Solids::const_iterator si;
for (si = cnode->_solids.begin(); si != cnode->_solids.end(); ++si) {
entry._into = (*si).get_read_pointer(current_thread);
// We should allow a collision test for solid into itself, because the
// solid might be simply instanced into multiple different
// CollisionNodes. We are already filtering out tests for a
// CollisionNode into itself.
CPT(BoundingVolume) solid_bv = entry._into->get_bounds();
const GeometricBoundingVolume *solid_gbv = nullptr;
if (solid_bv->is_of_type(GeometricBoundingVolume::get_class_type())) {
solid_gbv = (const GeometricBoundingVolume *)solid_bv.p();
}
compare_collider_to_solid(entry, from_node_gbv, solid_gbv);
}
compare_collider_to_solid(entry, from_node_gbv, solid_gbv);
}
}
}

View File

@ -111,10 +111,7 @@ cull_callback(CullTraverser *trav, CullTraverserData &data) {
// its objects according to their appropriate net transform.
xform_data._net_transform = TransformState::make_identity();
xform_data._view_frustum = trav->get_view_frustum();
xform_data.apply_transform_and_state(trav, net_transform,
RenderState::make_empty(),
RenderEffects::make_empty(),
ClipPlaneAttrib::make());
xform_data.apply_transform(net_transform);
// Draw all the collision solids.
Solids::const_iterator si;

View File

@ -84,10 +84,27 @@ finish_cull(SceneSetup *, Thread *current_thread) {
void CullBinBackToFront::
draw(bool force, Thread *current_thread) {
PStatTimer timer(_draw_this_pcollector, current_thread);
GeomPipelineReader geom_reader(current_thread);
GeomVertexDataPipelineReader data_reader(current_thread);
Objects::const_iterator oi;
for (oi = _objects.begin(); oi != _objects.end(); ++oi) {
CullableObject *object = (*oi)._object;
CullHandler::draw(object, _gsg, force, current_thread);
if (object->_draw_callback == nullptr) {
nassertd(object->_geom != nullptr) continue;
_gsg->set_state_and_transform(object->_state, object->_internal_transform);
data_reader.set_object(object->_munged_data);
data_reader.check_array_readers();
geom_reader.set_object(object->_geom);
geom_reader.draw(_gsg, object->_munger, &data_reader, force);
} else {
// It has a callback associated.
object->draw_callback(_gsg, force, current_thread);
// Now the callback has taken care of drawing.
}
}
}

View File

@ -70,10 +70,27 @@ finish_cull(SceneSetup *, Thread *current_thread) {
void CullBinFixed::
draw(bool force, Thread *current_thread) {
PStatTimer timer(_draw_this_pcollector, current_thread);
GeomPipelineReader geom_reader(current_thread);
GeomVertexDataPipelineReader data_reader(current_thread);
Objects::const_iterator oi;
for (oi = _objects.begin(); oi != _objects.end(); ++oi) {
CullableObject *object = (*oi)._object;
CullHandler::draw(object, _gsg, force, current_thread);
if (object->_draw_callback == nullptr) {
nassertd(object->_geom != nullptr) continue;
_gsg->set_state_and_transform(object->_state, object->_internal_transform);
data_reader.set_object(object->_munged_data);
data_reader.check_array_readers();
geom_reader.set_object(object->_geom);
geom_reader.draw(_gsg, object->_munger, &data_reader, force);
} else {
// It has a callback associated.
object->draw_callback(_gsg, force, current_thread);
// Now the callback has taken care of drawing.
}
}
}

View File

@ -84,10 +84,27 @@ finish_cull(SceneSetup *, Thread *current_thread) {
void CullBinFrontToBack::
draw(bool force, Thread *current_thread) {
PStatTimer timer(_draw_this_pcollector, current_thread);
GeomPipelineReader geom_reader(current_thread);
GeomVertexDataPipelineReader data_reader(current_thread);
Objects::const_iterator oi;
for (oi = _objects.begin(); oi != _objects.end(); ++oi) {
CullableObject *object = (*oi)._object;
CullHandler::draw(object, _gsg, force, current_thread);
if (object->_draw_callback == nullptr) {
nassertd(object->_geom != nullptr) continue;
_gsg->set_state_and_transform(object->_state, object->_internal_transform);
data_reader.set_object(object->_munged_data);
data_reader.check_array_readers();
geom_reader.set_object(object->_geom);
geom_reader.draw(_gsg, object->_munger, &data_reader, force);
} else {
// It has a callback associated.
object->draw_callback(_gsg, force, current_thread);
// Now the callback has taken care of drawing.
}
}
}

View File

@ -69,10 +69,27 @@ finish_cull(SceneSetup *, Thread *current_thread) {
void CullBinStateSorted::
draw(bool force, Thread *current_thread) {
PStatTimer timer(_draw_this_pcollector, current_thread);
GeomPipelineReader geom_reader(current_thread);
GeomVertexDataPipelineReader data_reader(current_thread);
Objects::const_iterator oi;
for (oi = _objects.begin(); oi != _objects.end(); ++oi) {
CullableObject *object = (*oi)._object;
CullHandler::draw(object, _gsg, force, current_thread);
if (object->_draw_callback == nullptr) {
nassertd(object->_geom != nullptr) continue;
_gsg->set_state_and_transform(object->_state, object->_internal_transform);
data_reader.set_object(object->_munged_data);
data_reader.check_array_readers();
geom_reader.set_object(object->_geom);
geom_reader.draw(_gsg, object->_munger, &data_reader, force);
} else {
// It has a callback associated.
object->draw_callback(_gsg, force, current_thread);
// Now the callback has taken care of drawing.
}
}
}

View File

@ -54,10 +54,27 @@ add_object(CullableObject *object, Thread *current_thread) {
void CullBinUnsorted::
draw(bool force, Thread *current_thread) {
PStatTimer timer(_draw_this_pcollector, current_thread);
GeomPipelineReader geom_reader(current_thread);
GeomVertexDataPipelineReader data_reader(current_thread);
Objects::iterator oi;
for (oi = _objects.begin(); oi != _objects.end(); ++oi) {
CullableObject *object = (*oi);
CullHandler::draw(object, _gsg, force, current_thread);
if (object->_draw_callback == nullptr) {
nassertd(object->_geom != nullptr) continue;
_gsg->set_state_and_transform(object->_state, object->_internal_transform);
data_reader.set_object(object->_munged_data);
data_reader.check_array_readers();
geom_reader.set_object(object->_geom);
geom_reader.draw(_gsg, object->_munger, &data_reader, force);
} else {
// It has a callback associated.
object->draw_callback(_gsg, force, current_thread);
// Now the callback has taken care of drawing.
}
}
}

View File

@ -15,11 +15,13 @@
#include "displayInformation.h"
// For __rdtsc
#if defined(__i386) || defined(__x86_64__) || defined(_M_IX86) || defined(_M_X64)
#ifdef _MSC_VER
#include <intrin.h>
#elif defined(__GNUC__) && !defined(__clang__)
#include <x86intrin.h>
#endif
#endif
/**
* Returns true if these two DisplayModes are identical.
@ -529,6 +531,7 @@ get_cpu_frequency() {
*/
uint64_t DisplayInformation::
get_cpu_time() {
#if defined(__i386) || defined(__x86_64__) || defined(_M_IX86) || defined(_M_X64)
#if defined(_MSC_VER) || (defined(__GNUC__) && !defined(__clang__))
return __rdtsc();
#else
@ -536,6 +539,9 @@ get_cpu_time() {
__asm__ __volatile__ ("rdtsc" : "=a" (lo), "=d" (hi));
return ((uint64_t)hi << 32) | lo;
#endif
#else
return 0;
#endif
}
/**

View File

@ -28,6 +28,16 @@
#include <unistd.h>
#endif
#ifdef _WIN32
#ifndef WIN32_LEAN_AND_MEAN
#define WIN32_LEAN_AND_MEAN 1
#endif
#include <windows.h>
#endif
// CPUID is only available on i386 and x86-64 architectures.
#if defined(__i386) || defined(__x86_64__) || defined(_M_IX86) || defined(_M_X64)
#if defined(__GNUC__) && !defined(__APPLE__)
// GCC and Clang offer a useful cpuid.h header.
#include <cpuid.h>
@ -38,13 +48,6 @@
#include <intrin.h>
#endif
#ifdef _WIN32
#ifndef WIN32_LEAN_AND_MEAN
#define WIN32_LEAN_AND_MEAN 1
#endif
#include <windows.h>
#endif
union cpuid_info {
char str[16];
struct {
@ -85,6 +88,7 @@ static inline void get_cpuid(uint32_t leaf, cpuid_info &info) {
: "0" (leaf));
#endif
}
#endif
#ifdef IS_LINUX
/**
@ -123,6 +127,7 @@ GraphicsPipe() :
_display_information = new DisplayInformation();
#if defined(__i386) || defined(__x86_64__) || defined(_M_IX86) || defined(_M_X64)
cpuid_info info;
const uint32_t max_cpuid = get_cpuid_max(0);
const uint32_t max_extended = get_cpuid_max(0x80000000);
@ -148,6 +153,7 @@ GraphicsPipe() :
brand[48] = 0;
_display_information->_cpu_brand_string = brand;
}
#endif
#if defined(IS_OSX)
// macOS exposes a lot of useful information through sysctl.

View File

@ -903,16 +903,10 @@ fetch_specified_part(Shader::ShaderMatInput part, InternalName *name,
case Shader::SMO_identity: {
return &LMatrix4::ident_mat();
}
case Shader::SMO_window_size: {
t = LMatrix4::translate_mat(_current_display_region->get_pixel_width(),
_current_display_region->get_pixel_height(),
0.0);
return &t;
}
case Shader::SMO_window_size:
case Shader::SMO_pixel_size: {
t = LMatrix4::translate_mat(_current_display_region->get_pixel_width(),
_current_display_region->get_pixel_height(),
0.0);
LVecBase2i pixel_size = _current_display_region->get_pixel_size();
t = LMatrix4::translate_mat(pixel_size[0], pixel_size[1], 0);
return &t;
}
case Shader::SMO_frame_time: {
@ -1049,7 +1043,7 @@ fetch_specified_part(Shader::ShaderMatInput part, InternalName *name,
LColor const &c = lt->get_color();
LColor const &s = lt->get_specular_color();
t = np.get_net_transform()->get_mat() *
get_scene()->get_world_transform()->get_mat();
_scene_setup->get_world_transform()->get_mat();
LVecBase3 d = -(t.xform_vec(lt->get_direction()));
d.normalize();
LVecBase3 h = d + LVecBase3(0,-1,0);
@ -1066,11 +1060,12 @@ fetch_specified_part(Shader::ShaderMatInput part, InternalName *name,
LColor const &c = lt->get_color();
LColor const &s = lt->get_specular_color();
t = np.get_net_transform()->get_mat() *
get_scene()->get_world_transform()->get_mat();
_scene_setup->get_world_transform()->get_mat();
LVecBase3 p = (t.xform_point(lt->get_point()));
LVecBase3 a = lt->get_attenuation();
PN_stdfloat lnear = lt->get_lens(0)->get_near();
PN_stdfloat lfar = lt->get_lens(0)->get_far();
Lens *lens = lt->get_lens(0);
PN_stdfloat lnear = lens->get_near();
PN_stdfloat lfar = lens->get_far();
t = LMatrix4(c[0],c[1],c[2],c[3],s[0],s[1],s[2],s[3],p[0],p[1],p[2],lnear,a[0],a[1],a[2],lfar);
return &t;
}
@ -1086,7 +1081,7 @@ fetch_specified_part(Shader::ShaderMatInput part, InternalName *name,
LColor const &s = lt->get_specular_color();
PN_stdfloat cutoff = ccos(deg_2_rad(lens->get_hfov() * 0.5f));
t = np.get_net_transform()->get_mat() *
get_scene()->get_world_transform()->get_mat();
_scene_setup->get_world_transform()->get_mat();
LVecBase3 p = t.xform_point(lens->get_nodal_point());
LVecBase3 d = -(t.xform_vec(lens->get_view_vector()));
t = LMatrix4(c[0],c[1],c[2],c[3],s[0],s[1],s[2],s[3],p[0],p[1],p[2],0,d[0],d[1],d[2],cutoff);
@ -1109,7 +1104,7 @@ fetch_specified_part(Shader::ShaderMatInput part, InternalName *name,
Light *light_obj = light.node()->as_light();
nassertr(light_obj != (Light *)NULL, &LMatrix4::zeros_mat());
if (light_obj->get_type() == AmbientLight::get_class_type()) {
if (light_obj->is_ambient_light()) {
cur_ambient_light += light_obj->get_color();
}
}
@ -1155,27 +1150,31 @@ fetch_specified_part(Shader::ShaderMatInput part, InternalName *name,
case Shader::SMO_plane_x: {
const NodePath &np = _target_shader->get_shader_input_nodepath(name);
nassertr(!np.is_empty(), &LMatrix4::zeros_mat());
nassertr(np.node()->is_of_type(PlaneNode::get_class_type()), &LMatrix4::zeros_mat());
LPlane p = DCAST(PlaneNode, np.node())->get_plane();
const PlaneNode *plane_node;
DCAST_INTO_R(plane_node, np.node(), &LMatrix4::zeros_mat());
LPlane p = plane_node->get_plane();
t = LMatrix4(0,0,0,0,0,0,0,0,0,0,0,0,p[0],p[1],p[2],p[3]);
return &t;
}
case Shader::SMO_clipplane_x: {
const ClipPlaneAttrib *cpa = DCAST(ClipPlaneAttrib, _target_rs->get_attrib_def(ClipPlaneAttrib::get_class_slot()));
const ClipPlaneAttrib *cpa;
_target_rs->get_attrib_def(cpa);
int planenr = atoi(name->get_name().c_str());
if (planenr >= cpa->get_num_on_planes()) {
return &LMatrix4::zeros_mat();
}
const NodePath &np = cpa->get_on_plane(planenr);
nassertr(!np.is_empty(), &LMatrix4::zeros_mat());
nassertr(np.node()->is_of_type(PlaneNode::get_class_type()), &LMatrix4::zeros_mat());
LPlane p (DCAST(PlaneNode, np.node())->get_plane());
const PlaneNode *plane_node;
DCAST_INTO_R(plane_node, np.node(), &LMatrix4::zeros_mat());
LPlane p (plane_node->get_plane());
p.xform(np.get_net_transform()->get_mat()); // World-space
t = LMatrix4(0,0,0,0,0,0,0,0,0,0,0,0,p[0],p[1],p[2],p[3]);
return &t;
}
case Shader::SMO_apiview_clipplane_i: {
const ClipPlaneAttrib *cpa = DCAST(ClipPlaneAttrib, _target_rs->get_attrib_def(ClipPlaneAttrib::get_class_slot()));
const ClipPlaneAttrib *cpa;
_target_rs->get_attrib_def(cpa);
if (index >= cpa->get_num_on_planes()) {
return &LMatrix4::zeros_mat();
}
@ -1186,7 +1185,7 @@ fetch_specified_part(Shader::ShaderMatInput part, InternalName *name,
DCAST_INTO_R(plane_node, plane.node(), &LMatrix4::zeros_mat());
CPT(TransformState) transform =
get_scene()->get_cs_world_transform()->compose(
_scene_setup->get_cs_world_transform()->compose(
plane.get_transform(_scene_setup->get_scene_root().get_parent()));
LPlane xformed_plane = plane_node->get_plane() * transform->get_mat();
@ -1206,24 +1205,24 @@ fetch_specified_part(Shader::ShaderMatInput part, InternalName *name,
return &t;
}
case Shader::SMO_world_to_view: {
return &(get_scene()->get_world_transform()->get_mat());
return &(_scene_setup->get_world_transform()->get_mat());
break;
}
case Shader::SMO_view_to_world: {
return &(get_scene()->get_camera_transform()->get_mat());
return &(_scene_setup->get_camera_transform()->get_mat());
}
case Shader::SMO_model_to_view: {
return &(get_external_transform()->get_mat());
return &(_inv_cs_transform->compose(_internal_transform)->get_mat());
}
case Shader::SMO_model_to_apiview: {
return &(get_internal_transform()->get_mat());
return &(_internal_transform->get_mat());
}
case Shader::SMO_view_to_model: {
t = get_external_transform()->get_inverse()->get_mat();
t = _internal_transform->invert_compose(_cs_transform)->get_mat();
return &t;
}
case Shader::SMO_apiview_to_model: {
t = get_internal_transform()->get_inverse()->get_mat();
t = _internal_transform->get_inverse()->get_mat();
return &t;
}
case Shader::SMO_apiview_to_view: {
@ -1268,13 +1267,13 @@ fetch_specified_part(Shader::ShaderMatInput part, InternalName *name,
const NodePath &np = _target_shader->get_shader_input_nodepath(name);
nassertr(!np.is_empty(), &LMatrix4::ident_mat());
t = np.get_net_transform()->get_mat() *
get_scene()->get_world_transform()->get_mat();
_scene_setup->get_world_transform()->get_mat();
return &t;
}
case Shader::SMO_view_to_view_x: {
const NodePath &np = _target_shader->get_shader_input_nodepath(name);
nassertr(!np.is_empty(), &LMatrix4::ident_mat());
t = get_scene()->get_camera_transform()->get_mat() *
t = _scene_setup->get_camera_transform()->get_mat() *
np.get_net_transform()->get_inverse()->get_mat();
return &t;
}
@ -1283,13 +1282,13 @@ fetch_specified_part(Shader::ShaderMatInput part, InternalName *name,
nassertr(!np.is_empty(), &LMatrix4::ident_mat());
t = LMatrix4::convert_mat(_internal_coordinate_system, _coordinate_system) *
np.get_net_transform()->get_mat() *
get_scene()->get_world_transform()->get_mat();
_scene_setup->get_world_transform()->get_mat();
return &t;
}
case Shader::SMO_view_to_apiview_x: {
const NodePath &np = _target_shader->get_shader_input_nodepath(name);
nassertr(!np.is_empty(), &LMatrix4::ident_mat());
t = (get_scene()->get_camera_transform()->get_mat() *
t = (_scene_setup->get_camera_transform()->get_mat() *
np.get_net_transform()->get_inverse()->get_mat() *
LMatrix4::convert_mat(_coordinate_system, _internal_coordinate_system));
return &t;
@ -1297,20 +1296,22 @@ fetch_specified_part(Shader::ShaderMatInput part, InternalName *name,
case Shader::SMO_clip_x_to_view: {
const NodePath &np = _target_shader->get_shader_input_nodepath(name);
nassertr(!np.is_empty(), &LMatrix4::ident_mat());
nassertr(np.node()->is_of_type(LensNode::get_class_type()), &LMatrix4::ident_mat());
Lens *lens = DCAST(LensNode, np.node())->get_lens();
const LensNode *node;
DCAST_INTO_R(node, np.node(), &LMatrix4::ident_mat());
const Lens *lens = node->get_lens();
t = lens->get_projection_mat_inv(_current_stereo_channel) *
LMatrix4::convert_mat(lens->get_coordinate_system(), _coordinate_system) *
np.get_net_transform()->get_mat() *
get_scene()->get_world_transform()->get_mat();
_scene_setup->get_world_transform()->get_mat();
return &t;
}
case Shader::SMO_view_to_clip_x: {
const NodePath &np = _target_shader->get_shader_input_nodepath(name);
nassertr(!np.is_empty(), &LMatrix4::ident_mat());
nassertr(np.node()->is_of_type(LensNode::get_class_type()), &LMatrix4::ident_mat());
Lens *lens = DCAST(LensNode, np.node())->get_lens();
t = get_scene()->get_camera_transform()->get_mat() *
const LensNode *node;
DCAST_INTO_R(node, np.node(), &LMatrix4::ident_mat());
const Lens *lens = node->get_lens();
t = _scene_setup->get_camera_transform()->get_mat() *
np.get_net_transform()->get_inverse()->get_mat() *
LMatrix4::convert_mat(_coordinate_system, lens->get_coordinate_system()) *
lens->get_projection_mat(_current_stereo_channel);
@ -1319,20 +1320,22 @@ fetch_specified_part(Shader::ShaderMatInput part, InternalName *name,
case Shader::SMO_apiclip_x_to_view: {
const NodePath &np = _target_shader->get_shader_input_nodepath(name);
nassertr(!np.is_empty(), &LMatrix4::ident_mat());
nassertr(np.node()->is_of_type(LensNode::get_class_type()), &LMatrix4::ident_mat());
Lens *lens = DCAST(LensNode, np.node())->get_lens();
const LensNode *node;
DCAST_INTO_R(node, np.node(), &LMatrix4::ident_mat());
const Lens *lens = node->get_lens();
t = calc_projection_mat(lens)->get_inverse()->get_mat() *
get_cs_transform_for(lens->get_coordinate_system())->get_inverse()->get_mat() *
np.get_net_transform()->get_mat() *
get_scene()->get_world_transform()->get_mat();
_scene_setup->get_world_transform()->get_mat();
return &t;
}
case Shader::SMO_view_to_apiclip_x: {
const NodePath &np = _target_shader->get_shader_input_nodepath(name);
nassertr(!np.is_empty(), &LMatrix4::ident_mat());
nassertr(np.node()->is_of_type(LensNode::get_class_type()), &LMatrix4::ident_mat());
Lens *lens = DCAST(LensNode, np.node())->get_lens();
t = get_scene()->get_camera_transform()->get_mat() *
const LensNode *node;
DCAST_INTO_R(node, np.node(), &LMatrix4::ident_mat());
const Lens *lens = node->get_lens();
t = _scene_setup->get_camera_transform()->get_mat() *
np.get_net_transform()->get_inverse()->get_mat() *
get_cs_transform_for(lens->get_coordinate_system())->get_mat() *
calc_projection_mat(lens)->get_mat();
@ -1383,7 +1386,7 @@ fetch_specified_part(Shader::ShaderMatInput part, InternalName *name,
Light *light_obj = light.node()->as_light();
nassertr(light_obj != (Light *)NULL, &LMatrix4::ident_mat());
if (light_obj->get_type() != AmbientLight::get_class_type()) {
if (!light_obj->is_ambient_light()) {
if (i++ == index) {
return fetch_specified_member(light, name, t);
}
@ -1430,7 +1433,7 @@ fetch_specified_member(const NodePath &np, CPT_InternalName attrib, LMatrix4 &t)
static const CPT_InternalName IN_constantAttenuation("constantAttenuation");
static const CPT_InternalName IN_linearAttenuation("linearAttenuation");
static const CPT_InternalName IN_quadraticAttenuation("quadraticAttenuation");
static const CPT_InternalName IN_shadowMatrix("shadowMatrix");
static const CPT_InternalName IN_shadowViewMatrix("shadowViewMatrix");
PandaNode *node = NULL;
if (!np.is_empty()) {
@ -1454,7 +1457,7 @@ fetch_specified_member(const NodePath &np, CPT_InternalName attrib, LMatrix4 &t)
}
Light *light = node->as_light();
nassertr(light != (Light *)NULL, &LMatrix4::ident_mat());
if (node->is_of_type(AmbientLight::get_class_type())) {
if (node->is_ambient_light()) {
LColor c = light->get_color();
c.componentwise_mult(_light_color_scale);
t.set_row(3, c);
@ -1470,7 +1473,7 @@ fetch_specified_member(const NodePath &np, CPT_InternalName attrib, LMatrix4 &t)
}
Light *light = node->as_light();
nassertr(light != (Light *)NULL, &LMatrix4::ones_mat());
if (node->is_of_type(AmbientLight::get_class_type())) {
if (node->is_ambient_light()) {
// Ambient light has no diffuse color.
t.set_row(3, LColor(0.0f, 0.0f, 0.0f, 1.0f));
} else {
@ -1493,7 +1496,7 @@ fetch_specified_member(const NodePath &np, CPT_InternalName attrib, LMatrix4 &t)
if (np.is_empty()) {
t = LMatrix4(0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0);
return &t;
} else if (node->is_of_type(AmbientLight::get_class_type())) {
} else if (node->is_ambient_light()) {
// Ambient light has no position.
t = LMatrix4(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);
return &t;
@ -1503,7 +1506,7 @@ fetch_specified_member(const NodePath &np, CPT_InternalName attrib, LMatrix4 &t)
CPT(TransformState) transform = np.get_transform(_scene_setup->get_scene_root().get_parent());
LVector3 dir = -(light->get_direction() * transform->get_mat());
dir *= get_scene()->get_cs_world_transform()->get_mat();
dir *= _scene_setup->get_cs_world_transform()->get_mat();
t = LMatrix4(0,0,0,0,0,0,0,0,0,0,0,0,dir[0],dir[1],dir[2],0);
return &t;
} else {
@ -1513,7 +1516,7 @@ fetch_specified_member(const NodePath &np, CPT_InternalName attrib, LMatrix4 &t)
nassertr(lens != (Lens *)NULL, &LMatrix4::ident_mat());
CPT(TransformState) transform =
get_scene()->get_cs_world_transform()->compose(
_scene_setup->get_cs_world_transform()->compose(
np.get_transform(_scene_setup->get_scene_root().get_parent()));
const LMatrix4 &light_mat = transform->get_mat();
@ -1526,7 +1529,7 @@ fetch_specified_member(const NodePath &np, CPT_InternalName attrib, LMatrix4 &t)
if (np.is_empty()) {
t = LMatrix4(0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0);
return &t;
} else if (node->is_of_type(AmbientLight::get_class_type())) {
} else if (node->is_ambient_light()) {
// Ambient light has no half-vector.
t = LMatrix4(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);
return &t;
@ -1536,7 +1539,7 @@ fetch_specified_member(const NodePath &np, CPT_InternalName attrib, LMatrix4 &t)
CPT(TransformState) transform = np.get_transform(_scene_setup->get_scene_root().get_parent());
LVector3 dir = -(light->get_direction() * transform->get_mat());
dir *= get_scene()->get_cs_world_transform()->get_mat();
dir *= _scene_setup->get_cs_world_transform()->get_mat();
dir.normalize();
dir += LVector3(0, 0, 1);
dir.normalize();
@ -1549,7 +1552,7 @@ fetch_specified_member(const NodePath &np, CPT_InternalName attrib, LMatrix4 &t)
nassertr(lens != (Lens *)NULL, &LMatrix4::ident_mat());
CPT(TransformState) transform =
get_scene()->get_cs_world_transform()->compose(
_scene_setup->get_cs_world_transform()->compose(
np.get_transform(_scene_setup->get_scene_root().get_parent()));
const LMatrix4 &light_mat = transform->get_mat();
@ -1565,7 +1568,7 @@ fetch_specified_member(const NodePath &np, CPT_InternalName attrib, LMatrix4 &t)
if (node == (PandaNode *)NULL) {
t.set_row(3, LVector3(0.0f, 0.0f, -1.0f));
return &t;
} else if (node->is_of_type(AmbientLight::get_class_type())) {
} else if (node->is_ambient_light()) {
// Ambient light has no spot direction.
t.set_row(3, LVector3(0.0f, 0.0f, 0.0f));
return &t;
@ -1576,7 +1579,7 @@ fetch_specified_member(const NodePath &np, CPT_InternalName attrib, LMatrix4 &t)
nassertr(lens != (Lens *)NULL, &LMatrix4::ident_mat());
CPT(TransformState) transform =
get_scene()->get_cs_world_transform()->compose(
_scene_setup->get_cs_world_transform()->compose(
np.get_transform(_scene_setup->get_scene_root().get_parent()));
const LMatrix4 &light_mat = transform->get_mat();
@ -1670,7 +1673,7 @@ fetch_specified_member(const NodePath &np, CPT_InternalName attrib, LMatrix4 &t)
t.set_row(3, LVecBase4(light->get_attenuation()[2]));
return &t;
} else if (attrib == IN_shadowMatrix) {
} else if (attrib == IN_shadowViewMatrix) {
static const LMatrix4 biasmat(0.5f, 0.0f, 0.0f, 0.0f,
0.0f, 0.5f, 0.0f, 0.0f,
0.0f, 0.0f, 0.5f, 0.0f,
@ -1684,8 +1687,8 @@ fetch_specified_member(const NodePath &np, CPT_InternalName attrib, LMatrix4 &t)
DCAST_INTO_R(lnode, node, &LMatrix4::ident_mat());
Lens *lens = lnode->get_lens();
t = get_external_transform()->get_mat() *
get_scene()->get_camera_transform()->get_mat() *
t = _inv_cs_transform->get_mat() *
_scene_setup->get_camera_transform()->get_mat() *
np.get_net_transform()->get_inverse()->get_mat() *
LMatrix4::convert_mat(_coordinate_system, lens->get_coordinate_system());
@ -1785,7 +1788,7 @@ fetch_specified_texture(Shader::ShaderTexSpec &spec, SamplerState &sampler,
Light *light_obj = light.node()->as_light();
nassertr(light_obj != (Light *)NULL, NULL);
if (light_obj->get_type() != AmbientLight::get_class_type()) {
if (!light_obj->is_ambient_light()) {
if (i++ == spec._stage) {
PT(Texture) tex = get_shadow_map(light);
if (tex != (Texture *)NULL) {
@ -2663,7 +2666,7 @@ do_issue_light() {
_lighting_enabled = true;
}
if (light_obj->get_type() == AmbientLight::get_class_type()) {
if (light_obj->is_ambient_light()) {
// Ambient lights don't require specific light ids; simply add in the
// ambient contribution to the current total
cur_ambient_light += light_obj->get_color();
@ -3143,11 +3146,12 @@ async_reload_texture(TextureContext *tc) {
*/
PT(Texture) GraphicsStateGuardian::
get_shadow_map(const NodePath &light_np, GraphicsOutputBase *host) {
nassertr(light_np.node()->is_of_type(DirectionalLight::get_class_type()) ||
light_np.node()->is_of_type(PointLight::get_class_type()) ||
light_np.node()->is_of_type(Spotlight::get_class_type()), NULL);
PandaNode *node = light_np.node();
nassertr(node->is_of_type(DirectionalLight::get_class_type()) ||
node->is_of_type(PointLight::get_class_type()) ||
node->is_of_type(Spotlight::get_class_type()), NULL);
PT(LightLensNode) light = DCAST(LightLensNode, light_np.node());
LightLensNode *light = (LightLensNode *)node;
if (light == NULL || !light->_shadow_caster) {
// TODO: return dummy shadow map (all white).
return NULL;
@ -3177,11 +3181,12 @@ get_shadow_map(const NodePath &light_np, GraphicsOutputBase *host) {
PT(Texture) GraphicsStateGuardian::
make_shadow_buffer(const NodePath &light_np, GraphicsOutputBase *host) {
// Make sure everything is valid.
nassertr(light_np.node()->is_of_type(DirectionalLight::get_class_type()) ||
light_np.node()->is_of_type(PointLight::get_class_type()) ||
light_np.node()->is_of_type(Spotlight::get_class_type()), NULL);
PandaNode *node = light_np.node();
nassertr(node->is_of_type(DirectionalLight::get_class_type()) ||
node->is_of_type(PointLight::get_class_type()) ||
node->is_of_type(Spotlight::get_class_type()), NULL);
PT(LightLensNode) light = DCAST(LightLensNode, light_np.node());
LightLensNode *light = (LightLensNode *)node;
if (light == NULL || !light->_shadow_caster) {
return NULL;
}

View File

@ -286,7 +286,7 @@ PUBLISHED:
MAKE_PROPERTY(driver_shader_version_minor, get_driver_shader_version_minor);
bool set_scene(SceneSetup *scene_setup);
virtual SceneSetup *get_scene() const;
virtual SceneSetup *get_scene() const FINAL;
MAKE_PROPERTY(scene, get_scene, set_scene);
public:

View File

@ -103,7 +103,7 @@ make_copy() const {
bool ProjectionScreen::
cull_callback(CullTraverser *, CullTraverserData &data) {
if (_auto_recompute) {
recompute_if_stale(data._node_path.get_node_path());
recompute_if_stale(data.get_node_path());
}
return true;
}

View File

@ -265,8 +265,3 @@ init_libdxgsg9() {
PandaSystem *ps = PandaSystem::get_global_ptr();
ps->add_system("DirectX9");
}
// Necessary to allow use of dxerr from MSVC 2015
#if _MSC_VER >= 1900
int (WINAPIV * __vsnprintf)(char *, size_t, const char*, va_list) = _vsnprintf;
#endif

View File

@ -164,7 +164,7 @@ munge_format_impl(const GeomVertexFormat *orig,
// Now go through the remaining arrays and make sure they are tightly
// packed. If not, repack them.
for (int i = 0; i < new_format->get_num_arrays(); ++i) {
for (size_t i = 0; i < new_format->get_num_arrays(); ++i) {
CPT(GeomVertexArrayFormat) orig_a = new_format->get_array(i);
if (orig_a->count_unused_space() != 0) {
PT(GeomVertexArrayFormat) new_a = new GeomVertexArrayFormat;
@ -267,7 +267,7 @@ premunge_format_impl(const GeomVertexFormat *orig) {
// Now go through the remaining arrays and make sure they are tightly
// packed. If not, repack them.
for (int i = 0; i < new_format->get_num_arrays(); ++i) {
for (size_t i = 0; i < new_format->get_num_arrays(); ++i) {
CPT(GeomVertexArrayFormat) orig_a = new_format->get_array(i);
if (orig_a->count_unused_space() != 0) {
PT(GeomVertexArrayFormat) new_a = new GeomVertexArrayFormat;

View File

@ -863,7 +863,7 @@ prepare_display_region(DisplayRegionPipelineReader *dr) {
dr->get_region_pixels_i(l, u, w, h);
// Create the viewport
D3DVIEWPORT9 vp = { l, u, w, h, 0.0f, 1.0f };
D3DVIEWPORT9 vp = { (DWORD)l, (DWORD)u, (DWORD)w, (DWORD)h, 0.0f, 1.0f };
_current_viewport = vp;
HRESULT hr = _d3d_device->SetViewport(&_current_viewport);
if (FAILED(hr)) {
@ -1185,7 +1185,7 @@ begin_draw_primitives(const GeomPipelineReader *geom_reader,
const TransformTable *table = data_reader->get_transform_table();
if (table != (TransformTable *)NULL) {
for (int i = 0; i < table->get_num_transforms(); i++) {
for (size_t i = 0; i < table->get_num_transforms(); ++i) {
LMatrix4 mat;
table->get_transform(i)->mult_matrix(mat, _internal_transform->get_mat());
const D3DMATRIX *d3d_mat = (const D3DMATRIX *)mat.get_data();

View File

@ -132,8 +132,7 @@ allocate_ibuffer(DXScreenData &scrn,
dxgsg9_cat.debug()
<< "creating index buffer " << _ibuffer << ": "
<< reader->get_num_vertices() << " indices ("
<< reader->get_vertices_reader()->get_array_format()->get_column(0)->get_numeric_type()
<< ")\n";
<< reader->get_index_type() << ")\n";
}
}
}
@ -169,7 +168,7 @@ upload_data(const GeomPrimitivePipelineReader *reader, bool force) {
if (data_pointer == NULL) {
return false;
}
int data_size = reader->get_data_size_bytes();
size_t data_size = (size_t)reader->get_data_size_bytes();
if (reader->get_index_type() == GeomEnums::NT_uint8) {
// We widen 8-bits indices to 16-bits.

View File

@ -940,6 +940,9 @@ apply_node_properties(EggGroup *egg_group, PandaNode *node, bool allow_backstage
ModelNode *model_node = DCAST(ModelNode, node);
switch (model_node->get_preserve_transform()) {
case ModelNode::PT_none:
egg_group->set_model_flag(true);
break;
case ModelNode::PT_drop_node:
break;

View File

@ -295,10 +295,13 @@ show_trend_ages() {
*/
INLINE MemoryUsage *MemoryUsage::
get_global_ptr() {
if (_global_ptr == (MemoryUsage *)NULL) {
init_memory_hook();
_global_ptr = new MemoryUsage(*memory_hook);
memory_hook = _global_ptr;
#ifdef __GNUC__
// Tell the compiler that this is an unlikely branch.
if (__builtin_expect(_global_ptr == nullptr, 0)) {
#else
if (_global_ptr == nullptr) {
#endif
init_memory_usage();
}
return _global_ptr;

View File

@ -489,6 +489,16 @@ MemoryUsage(const MemoryHook &copy) : MemoryHook(copy) {
_total_size = 0;
}
/**
* Initializes the global MemoryUsage pointer.
*/
void MemoryUsage::
init_memory_usage() {
init_memory_hook();
_global_ptr = new MemoryUsage(*memory_hook);
memory_hook = _global_ptr;
}
/**
* This callback method is called whenever the total allocated heap size
* exceeds _max_heap_size. It's mainly intended for reporting memory leaks,

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