Backport various fixes for 1.9.4

This commit is contained in:
rdb 2017-03-31 17:45:15 +02:00
parent bf919e4811
commit 163c923c82
35 changed files with 130 additions and 75 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.2/panda3d-1.9.2-tools-win32.zip
https://www.panda3d.org/download/panda3d-1.9.2/panda3d-1.9.2-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:

View File

@ -413,7 +413,7 @@ class DirectCameraControl(DirectObject):
np = NodePath('temp')
np.setPos(base.direct.camera, hitPt)
self.coaMarkerPos = np.getPos()
np.remove()
np.removeNode()
self.coaMarker.setPos(self.coaMarkerPos)
iRay.collisionNodePath.removeNode()

View File

@ -91,6 +91,7 @@ class FourState:
off (and so is state 2 which is oposite of 4 and therefore
oposite of 'on').
"""
self.stateIndex = 0
assert self.debugPrint("FourState(names=%s)"%(names))
self.track = None
self.stateTime = 0.0
@ -121,7 +122,6 @@ class FourState:
self.exitState4,
[names[1]]),
}
self.stateIndex = 0
self.fsm = ClassicFSM.ClassicFSM('FourState',
self.states.values(),
# Initial State

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').
"""
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

View File

@ -3699,8 +3699,8 @@ paint_window_osx_port() {
int y_size = min(_wparams.get_win_height(), _swbuffer->get_y_size());
size_t rowsize = _swbuffer->get_row_size();
Rect src_rect = {0, 0, y_size, x_size};
Rect ddrc_rect = {0, 0, y_size, x_size};
Rect src_rect = {0, 0, (short)y_size, (short)x_size};
Rect ddrc_rect = {0, 0, (short)y_size, (short)x_size};
QDErr err;
@ -3754,7 +3754,7 @@ paint_window_osx_cgcontext(CGContextRef context) {
int y_size = min(_wparams.get_win_height(), _swbuffer->get_y_size());
if (_buffer_image != NULL) {
CGRect region = { { 0, 0 }, { x_size, y_size } };
CGRect region = { { 0, 0 }, { (CGFloat)x_size, (CGFloat)y_size } };
CGContextDrawImage(context, region, _buffer_image);
}
}
@ -3794,7 +3794,7 @@ handle_event_osx_event_record(const P3D_event_data &event) {
// First, convert the coordinates from screen coordinates to
// browser window coordinates.
WindowRef window = handle._handle._osx_cgcontext._window;
CGPoint cgpt = { pt.h, pt.v };
CGPoint cgpt = { (CGFloat)pt.h, (CGFloat)pt.v };
HIPointConvert(&cgpt, kHICoordSpaceScreenPixel, NULL,
kHICoordSpaceWindow, window);

View File

@ -290,7 +290,7 @@ refresh() {
return;
}
if (_toplevel_window != NULL) {
Rect r = { 0, 0, _win_height, _win_width };
Rect r = { 0, 0, (short)_win_height, (short)_win_width };
InvalWindowRect(_toplevel_window, &r);
} else {
@ -374,7 +374,7 @@ paint_window_osx_cgcontext(CGContextRef context) {
CGColorSpaceRef rgb_space = CGColorSpaceCreateDeviceRGB();
CGColorRef bg = CGColorCreate(rgb_space, bg_components);
CGRect region = { { 0, 0 }, { _win_width, _win_height } };
CGRect region = { { 0, 0 }, { (CGFloat)_win_width, (CGFloat)_win_height } };
CGContextSetFillColorWithColor(context, bg);
CGContextFillRect(context, region);
@ -440,7 +440,7 @@ handle_event_osx_event_record(const P3D_event_data &event) {
// First, convert the coordinates from screen coordinates to
// browser window coordinates.
WindowRef window = handle._handle._osx_cgcontext._window;
CGPoint cgpt = { pt.h, pt.v };
CGPoint cgpt = { (CGFloat)pt.h, (CGFloat)pt.v };
HIPointConvert(&cgpt, kHICoordSpaceScreenPixel, NULL,
kHICoordSpaceWindow, window);
@ -662,7 +662,7 @@ paint_progress_bar(CGContextRef context) {
int bar_x, bar_y, bar_width, bar_height;
get_bar_placement(bar_x, bar_y, bar_width, bar_height);
CGRect bar_rect = { { bar_x, bar_y }, { bar_width, bar_height } };
CGRect bar_rect = { { (CGFloat)bar_x, (CGFloat)bar_y }, { (CGFloat)bar_width, (CGFloat)bar_height } };
// Clear the entire progress bar to white (or the background color).
CGContextSetFillColorWithColor(context, bar_bg);
@ -672,7 +672,7 @@ paint_progress_bar(CGContextRef context) {
if (_progress_known) {
int progress_width = (int)(bar_width * _install_progress + 0.5);
if (progress_width != 0) {
CGRect prog = { { bar_x, bar_y }, { progress_width, bar_height } };
CGRect prog = { { (CGFloat)bar_x, (CGFloat)bar_y }, { (CGFloat)progress_width, (CGFloat)bar_height } };
CGContextSetFillColorWithColor(context, bar);
CGContextFillRect(context, prog);
}
@ -687,7 +687,7 @@ paint_progress_bar(CGContextRef context) {
progress = block_travel * 2 - progress;
}
CGRect prog = { { bar_x + progress, bar_y }, { block_width, bar_height } };
CGRect prog = { { (CGFloat)(bar_x + progress), (CGFloat)bar_y }, { (CGFloat)block_width, (CGFloat)bar_height } };
CGContextSetFillColorWithColor(context, bar);
CGContextFillRect(context, prog);
}
@ -697,8 +697,8 @@ paint_progress_bar(CGContextRef context) {
// We offset the border by half a pixel, so we'll be drawing the
// one-pixel line through the middle of a pixel, and it won't try to
// antialias itself into a half-black two-pixel line.
CGRect border_rect = { { bar_x - 0.5, bar_y - 0.5 },
{ bar_width + 1, bar_height + 1 } };
CGRect border_rect = { { (CGFloat)(bar_x - 0.5), (CGFloat)(bar_y - 0.5) },
{ (CGFloat)(bar_width + 1), (CGFloat)(bar_height + 1) } };
CGContextBeginPath(context);
CGContextSetLineWidth(context, 1);

View File

@ -282,6 +282,9 @@ class MemoryExplorerItem:
def getNumChildren(self):
return len(self.children)
def getChildren(self):
return self.children
def getChildrenAsList(self):
return self.children

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

@ -3,7 +3,7 @@
// ppremake scripts for Panda.
// Use spaces to separate the major, minor, and sequence numbers here.
#define PANDA_VERSION 1 9 3
#define PANDA_VERSION 1 9 4
// This variable will be defined to false in the CVS repository, but
// scripts that generate source tarballs and/or binary releases for

View File

@ -1075,6 +1075,7 @@ function_operator:
more_template_declaration:
type_like_declaration
| template_declaration
| friend_declaration
;
template_declaration:

View File

@ -346,8 +346,14 @@ template<class T> INLINE bool DTOOL_Call_ExtractThisPointer(PyObject *self, T *&
// Functions related to error reporting.
// _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
EXPCL_DTOOLCONFIG bool Dtool_CheckErrorOccurred();

View File

@ -91,6 +91,7 @@ extern "C" {
EXPCL_PYSTUB int PyModule_AddObject(...);
EXPCL_PYSTUB int PyModule_AddStringConstant(...);
EXPCL_PYSTUB int PyModule_Create2(...);
EXPCL_PYSTUB int PyModule_Create2TraceRefs(...);
EXPCL_PYSTUB int PyNumber_Check(...);
EXPCL_PYSTUB int PyNumber_Float(...);
EXPCL_PYSTUB int PyNumber_Int(...);
@ -150,12 +151,14 @@ extern "C" {
EXPCL_PYSTUB int PyUnicodeUCS2_FromStringAndSize(...);
EXPCL_PYSTUB int PyUnicodeUCS2_FromWideChar(...);
EXPCL_PYSTUB int PyUnicodeUCS2_AsWideChar(...);
EXPCL_PYSTUB int PyUnicodeUCS2_AsWideCharString(...);
EXPCL_PYSTUB int PyUnicodeUCS2_GetSize(...);
EXPCL_PYSTUB int PyUnicodeUCS4_FromFormat(...);
EXPCL_PYSTUB int PyUnicodeUCS4_FromString(...);
EXPCL_PYSTUB int PyUnicodeUCS4_FromStringAndSize(...);
EXPCL_PYSTUB int PyUnicodeUCS4_FromWideChar(...);
EXPCL_PYSTUB int PyUnicodeUCS4_AsWideChar(...);
EXPCL_PYSTUB int PyUnicodeUCS4_AsWideCharString(...);
EXPCL_PYSTUB int PyUnicodeUCS4_GetSize(...);
EXPCL_PYSTUB int PyUnicode_AsUTF8(...);
EXPCL_PYSTUB int PyUnicode_AsUTF8AndSize(...);
@ -174,6 +177,7 @@ extern "C" {
EXPCL_PYSTUB int Py_InitModule4(...);
EXPCL_PYSTUB int Py_InitModule4_64(...);
EXPCL_PYSTUB int Py_InitModule4TraceRefs(...);
EXPCL_PYSTUB int Py_InitModule4TraceRefs_64(...);
EXPCL_PYSTUB int _PyArg_ParseTuple_SizeT(...);
EXPCL_PYSTUB int _PyArg_ParseTupleAndKeywords_SizeT(...);
EXPCL_PYSTUB int _PyArg_Parse_SizeT(...);
@ -183,9 +187,14 @@ extern "C" {
EXPCL_PYSTUB int _PyObject_Del(...);
EXPCL_PYSTUB int _PyUnicode_AsString(...);
EXPCL_PYSTUB int _PyUnicode_AsStringAndSize(...);
EXPCL_PYSTUB int _Py_AddToAllObjects(...);
EXPCL_PYSTUB int _Py_BuildValue_SizeT(...);
EXPCL_PYSTUB int _Py_Dealloc(...);
EXPCL_PYSTUB int _Py_ForgetReference(...);
EXPCL_PYSTUB int _Py_NegativeRefcount(...);
EXPCL_PYSTUB int _Py_NewReference(...);
EXPCL_PYSTUB int _Py_PrintReferenceAddresses(...);
EXPCL_PYSTUB int _Py_PrintReferences(...);
EXPCL_PYSTUB int _Py_RefTotal(...);
EXPCL_PYSTUB void Py_Initialize();
@ -291,6 +300,7 @@ int PyModule_AddIntConstant(...) { return 0; };
int PyModule_AddObject(...) { return 0; };
int PyModule_AddStringConstant(...) { return 0; };
int PyModule_Create2(...) { return 0; };
int PyModule_Create2TraceRefs(...) { return 0; };
int PyNumber_Check(...) { return 0; }
int PyNumber_Float(...) { return 0; }
int PyNumber_Int(...) { return 0; }
@ -350,12 +360,14 @@ int PyUnicodeUCS2_FromString(...) { return 0; }
int PyUnicodeUCS2_FromStringAndSize(...) { return 0; }
int PyUnicodeUCS2_FromWideChar(...) { return 0; }
int PyUnicodeUCS2_AsWideChar(...) { return 0; }
int PyUnicodeUCS2_AsWideCharString(...) { return 0; }
int PyUnicodeUCS2_GetSize(...) { return 0; }
int PyUnicodeUCS4_FromFormat(...) { return 0; }
int PyUnicodeUCS4_FromString(...) { return 0; }
int PyUnicodeUCS4_FromStringAndSize(...) { return 0; }
int PyUnicodeUCS4_FromWideChar(...) { return 0; }
int PyUnicodeUCS4_AsWideChar(...) { return 0; }
int PyUnicodeUCS4_AsWideCharString(...) { return 0; }
int PyUnicodeUCS4_GetSize(...) { return 0; }
int PyUnicode_AsUTF8(...) { return 0; }
int PyUnicode_AsUTF8AndSize(...) { return 0; }
@ -374,6 +386,7 @@ int Py_BuildValue(...) { return 0; }
int Py_InitModule4(...) { return 0; }
int Py_InitModule4_64(...) { return 0; }
int Py_InitModule4TraceRefs(...) { return 0; };
int Py_InitModule4TraceRefs_64(...) { return 0; };
int _PyArg_ParseTuple_SizeT(...) { return 0; };
int _PyArg_ParseTupleAndKeywords_SizeT(...) { return 0; };
int _PyArg_Parse_SizeT(...) { return 0; };
@ -383,9 +396,14 @@ int _PyObject_DebugFree(...) { return 0; };
int _PyObject_Del(...) { return 0; };
int _PyUnicode_AsString(...) { return 0; };
int _PyUnicode_AsStringAndSize(...) { return 0; };
int _Py_AddToAllObjects(...) { return 0; };
int _Py_BuildValue_SizeT(...) { return 0; };
int _Py_Dealloc(...) { return 0; };
int _Py_ForgetReference(...) { return 0; };
int _Py_NegativeRefcount(...) { return 0; };
int _Py_NewReference(...) { return 0; };
int _Py_PrintReferenceAddresses(...) { return 0; };
int _Py_PrintReferences(...) { return 0; };
int _Py_RefTotal(...) { return 0; };
// We actually might call this one.

View File

@ -450,7 +450,7 @@ get_sound(const string &file_name, bool positional, int) {
vfs->resolve_filename(path, get_model_path());
// Build a new AudioSound from the audio data.
PT(AudioSound) audioSound = 0;
PT(AudioSound) audioSound;
PT(FmodAudioSound) fmodAudioSound = new FmodAudioSound(this, path, positional);
_all_sounds.insert(fmodAudioSound);

View File

@ -1120,7 +1120,6 @@ cleanup() {
OpenALAudioManager::SoundData::
SoundData() :
_manager(0),
_movie(0),
_sample(0),
_stream(NULL),
_length(0.0),

View File

@ -258,7 +258,7 @@ PT(CollisionEntry) CollisionBox::
test_intersection_from_sphere(const CollisionEntry &entry) const {
const CollisionSphere *sphere;
DCAST_INTO_R(sphere, entry.get_from(), 0);
DCAST_INTO_R(sphere, entry.get_from(), NULL);
CPT(TransformState) wrt_space = entry.get_wrt_space();
CPT(TransformState) wrt_prev_space = entry.get_wrt_prev_space();
@ -466,7 +466,7 @@ test_intersection_from_sphere(const CollisionEntry &entry) const {
PT(CollisionEntry) CollisionBox::
test_intersection_from_ray(const CollisionEntry &entry) const {
const CollisionRay *ray;
DCAST_INTO_R(ray, entry.get_from(), 0);
DCAST_INTO_R(ray, entry.get_from(), NULL);
const LMatrix4 &wrt_mat = entry.get_wrt_mat();
LPoint3 from_origin = ray->get_origin() * wrt_mat;
@ -549,7 +549,7 @@ test_intersection_from_ray(const CollisionEntry &entry) const {
PT(CollisionEntry) CollisionBox::
test_intersection_from_segment(const CollisionEntry &entry) const {
const CollisionSegment *seg;
DCAST_INTO_R(seg, entry.get_from(), 0);
DCAST_INTO_R(seg, entry.get_from(), NULL);
const LMatrix4 &wrt_mat = entry.get_wrt_mat();
LPoint3 from_origin = seg->get_point_a() * wrt_mat;

View File

@ -141,7 +141,7 @@ compute_internal_bounds() const {
PT(CollisionEntry) CollisionFloorMesh::
test_intersection_from_ray(const CollisionEntry &entry) const {
const CollisionRay *ray;
DCAST_INTO_R(ray, entry.get_from(), 0);
DCAST_INTO_R(ray, entry.get_from(), NULL);
LPoint3 from_origin = ray->get_origin() * entry.get_wrt_mat();
double fx = from_origin[0];
@ -208,7 +208,7 @@ test_intersection_from_ray(const CollisionEntry &entry) const {
PT(CollisionEntry) CollisionFloorMesh::
test_intersection_from_sphere(const CollisionEntry &entry) const {
const CollisionSphere *sphere;
DCAST_INTO_R(sphere, entry.get_from(), 0);
DCAST_INTO_R(sphere, entry.get_from(), NULL);
LPoint3 from_origin = sphere->get_center() * entry.get_wrt_mat();
double fx = from_origin[0];

View File

@ -143,7 +143,7 @@ handle_entries() {
// currently we only support spheres as the collider
const CollisionSphere *sphere;
DCAST_INTO_R(sphere, entries.front()->get_from(), 0);
DCAST_INTO_R(sphere, entries.front()->get_from(), false);
from_node_path.set_pos(wrt_node, 0,0,0);
LPoint3 sphere_offset = (sphere->get_center() *

View File

@ -109,7 +109,7 @@ compute_internal_bounds() const {
PT(CollisionEntry) CollisionInvSphere::
test_intersection_from_sphere(const CollisionEntry &entry) const {
const CollisionSphere *sphere;
DCAST_INTO_R(sphere, entry.get_from(), 0);
DCAST_INTO_R(sphere, entry.get_from(), NULL);
const LMatrix4 &wrt_mat = entry.get_wrt_mat();
@ -163,7 +163,7 @@ test_intersection_from_sphere(const CollisionEntry &entry) const {
PT(CollisionEntry) CollisionInvSphere::
test_intersection_from_line(const CollisionEntry &entry) const {
const CollisionLine *line;
DCAST_INTO_R(line, entry.get_from(), 0);
DCAST_INTO_R(line, entry.get_from(), NULL);
const LMatrix4 &wrt_mat = entry.get_wrt_mat();
@ -206,7 +206,7 @@ test_intersection_from_line(const CollisionEntry &entry) const {
PT(CollisionEntry) CollisionInvSphere::
test_intersection_from_ray(const CollisionEntry &entry) const {
const CollisionRay *ray;
DCAST_INTO_R(ray, entry.get_from(), 0);
DCAST_INTO_R(ray, entry.get_from(), NULL);
const LMatrix4 &wrt_mat = entry.get_wrt_mat();
@ -252,7 +252,7 @@ test_intersection_from_ray(const CollisionEntry &entry) const {
PT(CollisionEntry) CollisionInvSphere::
test_intersection_from_segment(const CollisionEntry &entry) const {
const CollisionSegment *segment;
DCAST_INTO_R(segment, entry.get_from(), 0);
DCAST_INTO_R(segment, entry.get_from(), NULL);
const LMatrix4 &wrt_mat = entry.get_wrt_mat();

View File

@ -128,7 +128,7 @@ compute_internal_bounds() const {
PT(CollisionEntry) CollisionPlane::
test_intersection_from_sphere(const CollisionEntry &entry) const {
const CollisionSphere *sphere;
DCAST_INTO_R(sphere, entry.get_from(), 0);
DCAST_INTO_R(sphere, entry.get_from(), NULL);
const LMatrix4 &wrt_mat = entry.get_wrt_mat();
@ -169,7 +169,7 @@ test_intersection_from_sphere(const CollisionEntry &entry) const {
PT(CollisionEntry) CollisionPlane::
test_intersection_from_line(const CollisionEntry &entry) const {
const CollisionLine *line;
DCAST_INTO_R(line, entry.get_from(), 0);
DCAST_INTO_R(line, entry.get_from(), NULL);
const LMatrix4 &wrt_mat = entry.get_wrt_mat();
@ -216,7 +216,7 @@ test_intersection_from_line(const CollisionEntry &entry) const {
PT(CollisionEntry) CollisionPlane::
test_intersection_from_ray(const CollisionEntry &entry) const {
const CollisionRay *ray;
DCAST_INTO_R(ray, entry.get_from(), 0);
DCAST_INTO_R(ray, entry.get_from(), NULL);
const LMatrix4 &wrt_mat = entry.get_wrt_mat();
@ -270,7 +270,7 @@ test_intersection_from_ray(const CollisionEntry &entry) const {
PT(CollisionEntry) CollisionPlane::
test_intersection_from_segment(const CollisionEntry &entry) const {
const CollisionSegment *segment;
DCAST_INTO_R(segment, entry.get_from(), 0);
DCAST_INTO_R(segment, entry.get_from(), NULL);
const LMatrix4 &wrt_mat = entry.get_wrt_mat();
@ -331,7 +331,7 @@ test_intersection_from_segment(const CollisionEntry &entry) const {
PT(CollisionEntry) CollisionPlane::
test_intersection_from_parabola(const CollisionEntry &entry) const {
const CollisionParabola *parabola;
DCAST_INTO_R(parabola, entry.get_from(), 0);
DCAST_INTO_R(parabola, entry.get_from(), NULL);
const LMatrix4 &wrt_mat = entry.get_wrt_mat();

View File

@ -402,7 +402,7 @@ test_intersection_from_sphere(const CollisionEntry &entry) const {
}
const CollisionSphere *sphere;
DCAST_INTO_R(sphere, entry.get_from(), 0);
DCAST_INTO_R(sphere, entry.get_from(), NULL);
CPT(TransformState) wrt_space = entry.get_wrt_space();
CPT(TransformState) wrt_prev_space = entry.get_wrt_prev_space();
@ -590,7 +590,7 @@ test_intersection_from_line(const CollisionEntry &entry) const {
}
const CollisionLine *line;
DCAST_INTO_R(line, entry.get_from(), 0);
DCAST_INTO_R(line, entry.get_from(), NULL);
const LMatrix4 &wrt_mat = entry.get_wrt_mat();
@ -661,7 +661,7 @@ test_intersection_from_ray(const CollisionEntry &entry) const {
}
const CollisionRay *ray;
DCAST_INTO_R(ray, entry.get_from(), 0);
DCAST_INTO_R(ray, entry.get_from(), NULL);
const LMatrix4 &wrt_mat = entry.get_wrt_mat();
@ -737,7 +737,7 @@ test_intersection_from_segment(const CollisionEntry &entry) const {
}
const CollisionSegment *segment;
DCAST_INTO_R(segment, entry.get_from(), 0);
DCAST_INTO_R(segment, entry.get_from(), NULL);
const LMatrix4 &wrt_mat = entry.get_wrt_mat();
@ -815,7 +815,7 @@ test_intersection_from_parabola(const CollisionEntry &entry) const {
}
const CollisionParabola *parabola;
DCAST_INTO_R(parabola, entry.get_from(), 0);
DCAST_INTO_R(parabola, entry.get_from(), NULL);
const LMatrix4 &wrt_mat = entry.get_wrt_mat();

View File

@ -141,7 +141,7 @@ compute_internal_bounds() const {
PT(CollisionEntry) CollisionSphere::
test_intersection_from_sphere(const CollisionEntry &entry) const {
const CollisionSphere *sphere;
DCAST_INTO_R(sphere, entry.get_from(), 0);
DCAST_INTO_R(sphere, entry.get_from(), NULL);
CPT(TransformState) wrt_space = entry.get_wrt_space();
@ -254,7 +254,7 @@ test_intersection_from_sphere(const CollisionEntry &entry) const {
PT(CollisionEntry) CollisionSphere::
test_intersection_from_line(const CollisionEntry &entry) const {
const CollisionLine *line;
DCAST_INTO_R(line, entry.get_from(), 0);
DCAST_INTO_R(line, entry.get_from(), NULL);
const LMatrix4 &wrt_mat = entry.get_wrt_mat();
@ -296,7 +296,7 @@ test_intersection_from_line(const CollisionEntry &entry) const {
PT(CollisionEntry) CollisionSphere::
test_intersection_from_box(const CollisionEntry &entry) const {
const CollisionBox *box;
DCAST_INTO_R(box, entry.get_from(), 0);
DCAST_INTO_R(box, entry.get_from(), NULL);
// Instead of transforming the box into the sphere's coordinate space,
// we do it the other way around. It's easier that way.
@ -374,7 +374,7 @@ test_intersection_from_box(const CollisionEntry &entry) const {
PT(CollisionEntry) CollisionSphere::
test_intersection_from_ray(const CollisionEntry &entry) const {
const CollisionRay *ray;
DCAST_INTO_R(ray, entry.get_from(), 0);
DCAST_INTO_R(ray, entry.get_from(), NULL);
const LMatrix4 &wrt_mat = entry.get_wrt_mat();
@ -423,7 +423,7 @@ test_intersection_from_ray(const CollisionEntry &entry) const {
PT(CollisionEntry) CollisionSphere::
test_intersection_from_segment(const CollisionEntry &entry) const {
const CollisionSegment *segment;
DCAST_INTO_R(segment, entry.get_from(), 0);
DCAST_INTO_R(segment, entry.get_from(), NULL);
const LMatrix4 &wrt_mat = entry.get_wrt_mat();
@ -474,7 +474,7 @@ test_intersection_from_segment(const CollisionEntry &entry) const {
PT(CollisionEntry) CollisionSphere::
test_intersection_from_parabola(const CollisionEntry &entry) const {
const CollisionParabola *parabola;
DCAST_INTO_R(parabola, entry.get_from(), 0);
DCAST_INTO_R(parabola, entry.get_from(), NULL);
const LMatrix4 &wrt_mat = entry.get_wrt_mat();

View File

@ -158,7 +158,7 @@ compute_internal_bounds() const {
PT(CollisionEntry) CollisionTube::
test_intersection_from_sphere(const CollisionEntry &entry) const {
const CollisionSphere *sphere;
DCAST_INTO_R(sphere, entry.get_from(), 0);
DCAST_INTO_R(sphere, entry.get_from(), NULL);
CPT(TransformState) wrt_space = entry.get_wrt_space();
CPT(TransformState) wrt_prev_space = entry.get_wrt_prev_space();
@ -239,7 +239,7 @@ test_intersection_from_sphere(const CollisionEntry &entry) const {
PT(CollisionEntry) CollisionTube::
test_intersection_from_line(const CollisionEntry &entry) const {
const CollisionLine *line;
DCAST_INTO_R(line, entry.get_from(), 0);
DCAST_INTO_R(line, entry.get_from(), NULL);
const LMatrix4 &wrt_mat = entry.get_wrt_mat();
@ -289,7 +289,7 @@ test_intersection_from_line(const CollisionEntry &entry) const {
PT(CollisionEntry) CollisionTube::
test_intersection_from_ray(const CollisionEntry &entry) const {
const CollisionRay *ray;
DCAST_INTO_R(ray, entry.get_from(), 0);
DCAST_INTO_R(ray, entry.get_from(), NULL);
const LMatrix4 &wrt_mat = entry.get_wrt_mat();
@ -353,7 +353,7 @@ test_intersection_from_ray(const CollisionEntry &entry) const {
PT(CollisionEntry) CollisionTube::
test_intersection_from_segment(const CollisionEntry &entry) const {
const CollisionSegment *segment;
DCAST_INTO_R(segment, entry.get_from(), 0);
DCAST_INTO_R(segment, entry.get_from(), NULL);
const LMatrix4 &wrt_mat = entry.get_wrt_mat();
@ -419,7 +419,7 @@ test_intersection_from_segment(const CollisionEntry &entry) const {
PT(CollisionEntry) CollisionTube::
test_intersection_from_parabola(const CollisionEntry &entry) const {
const CollisionParabola *parabola;
DCAST_INTO_R(parabola, entry.get_from(), 0);
DCAST_INTO_R(parabola, entry.get_from(), NULL);
const LMatrix4 &wrt_mat = entry.get_wrt_mat();

View File

@ -582,6 +582,12 @@ get_screenshot() {
return NULL;
}
{
// Make sure that the correct viewport is active.
DisplayRegionPipelineReader dr_reader(this, current_thread);
gsg->prepare_display_region(&dr_reader);
}
PT(Texture) tex = new Texture;
RenderBuffer buffer = gsg->get_render_buffer(get_screenshot_buffer_type(),

View File

@ -891,7 +891,7 @@ load_client_certificate() {
// Rewind the "file" to the beginning in order to read the public
// key (which might appear first in the file).
BIO_reset(mbio);
(void)BIO_reset(mbio);
ERR_clear_error();
_client_certificate_pub =

View File

@ -481,7 +481,7 @@ convert_collision_node(CollisionNode *node, const WorkingNodePath &node_path,
} else if (child->is_of_type(CollisionSphere::get_class_type())) {
CPT(CollisionSphere) sphere = DCAST(CollisionSphere, child);
LPoint3 center = sphere->get_center();
LVector3 offset(sphere->get_radius(), 0, 0);
PN_stdfloat radius = sphere->get_radius();
EggGroup *egg_sphere;
if (num_solids == 1) {
@ -498,15 +498,19 @@ convert_collision_node(CollisionNode *node, const WorkingNodePath &node_path,
}
egg_sphere->set_collide_flags(flags);
EggVertex ev1, ev2;
ev1.set_pos(LCAST(double, (center + offset) * net_mat));
ev2.set_pos(LCAST(double, (center - offset) * net_mat));
EggVertex ev1, ev2, ev3, ev4;
ev1.set_pos(LCAST(double, (center + LVector3(radius, 0, 0)) * net_mat));
ev2.set_pos(LCAST(double, (center + LVector3(0, radius, 0)) * net_mat));
ev3.set_pos(LCAST(double, (center + LVector3(-radius, 0, 0)) * net_mat));
ev4.set_pos(LCAST(double, (center + LVector3(0, -radius, 0)) * net_mat));
EggPolygon *egg_poly = new EggPolygon;
egg_sphere->add_child(egg_poly);
egg_poly->add_vertex(cvpool->create_unique_vertex(ev1));
egg_poly->add_vertex(cvpool->create_unique_vertex(ev2));
egg_poly->add_vertex(cvpool->create_unique_vertex(ev3));
egg_poly->add_vertex(cvpool->create_unique_vertex(ev4));
} else if (child->is_of_type(CollisionPlane::get_class_type())) {
LPlane plane = DCAST(CollisionPlane, child)->get_plane();

View File

@ -163,6 +163,9 @@ begin_frame(FrameMode mode, Thread *current_thread) {
}
}
#endif
} else if (mode == FM_refresh) {
// Just bind the FBO.
rebuild_bitplanes();
}
_gsg->set_current_properties(&get_fb_properties());

View File

@ -3320,8 +3320,8 @@ do_load_sub_image(CData *cdata, const PNMImage &image, int x, int y, int z, int
nassertr(y >= 0 && y < tex_y_size, false);
nassertr(z >= 0 && z < tex_z_size, false);
nassertr(image.get_x_size() + x < tex_x_size, false);
nassertr(image.get_y_size() + y < tex_y_size, false);
nassertr(image.get_x_size() + x <= tex_x_size, false);
nassertr(image.get_y_size() + y <= tex_y_size, false);
// Flip y
y = cdata->_y_size - (image.get_y_size() + y);

View File

@ -30,7 +30,7 @@ get_data(dGeomID id) {
if (iter != data_map.end()) {
return iter->second;
}
return 0;
return NULL;
}
void OdeTriMeshData::

View File

@ -35,7 +35,7 @@ set_tri_mesh_data(OdeTriMeshData &data) {
INLINE PT(OdeTriMeshData) OdeTriMeshGeom::
get_tri_mesh_data() const {
nassertr(_id != 0 ,0);
nassertr(_id != 0, NULL);
return OdeTriMeshData::get_data(_id);
}

View File

@ -543,7 +543,7 @@ filter_to_max(int max_clip_planes) const {
CPT(RenderAttrib) ClipPlaneAttrib::
compose_off(const RenderAttrib *other) const {
const ClipPlaneAttrib *ta;
DCAST_INTO_R(ta, other, 0);
DCAST_INTO_R(ta, other, NULL);
if (_off_all_planes || (!ta->_off_all_planes && ta->_off_planes.empty())) {
// If we turn off all planes, or the other turns none off, the
@ -772,7 +772,7 @@ get_hash_impl() const {
CPT(RenderAttrib) ClipPlaneAttrib::
compose_impl(const RenderAttrib *other) const {
const ClipPlaneAttrib *ta;
DCAST_INTO_R(ta, other, 0);
DCAST_INTO_R(ta, other, NULL);
if (ta->_off_all_planes) {
// If the other type turns off all planes, it doesn't matter what

View File

@ -42,7 +42,7 @@ PortalClipper::
PortalClipper(GeometricBoundingVolume *frustum, SceneSetup *scene_setup):
_reduced_viewport_min(-1,-1),
_reduced_viewport_max(1,1),
_clip_state(0)
_clip_state(NULL)
{
_previous = new GeomNode("my_frustum");

View File

@ -713,7 +713,7 @@ box_filter_line(const PNMImage &image,
// Get the final (partial) xel
float x_contrib = x1 - (float)x_last;
if (x_contrib > 0.0001f) {
if (x_contrib > 0.0001f && x < image.get_x_size()) {
box_filter_xel(image, x, y, x_contrib, y_contrib,
color, pixel_count);
}
@ -745,7 +745,7 @@ box_filter_region(const PNMImage &image,
// Get the final (partial) row
float y_contrib = y1 - (float)y_last;
if (y_contrib > 0.0001f) {
if (y_contrib > 0.0001f && y < image.get_y_size()) {
box_filter_line(image, x0, y, x1, y_contrib,
color, pixel_count);
}

View File

@ -98,7 +98,7 @@
static XFile *x_file = (XFile *)NULL;
static XFileNode *current_node = (XFileNode *)NULL;
static PT(XFileDataDef) current_data_def = (XFileDataDef *)NULL;
static PT(XFileDataDef) current_data_def;
////////////////////////////////////////////////////////////////////
// Defining the interface to the parser.

View File

@ -31,7 +31,7 @@
static XFile *x_file = (XFile *)NULL;
static XFileNode *current_node = (XFileNode *)NULL;
static PT(XFileDataDef) current_data_def = (XFileDataDef *)NULL;
static PT(XFileDataDef) current_data_def;
////////////////////////////////////////////////////////////////////
// Defining the interface to the parser.

View File

@ -20,7 +20,7 @@ from direct.showbase.DirectObject import DirectObject
from direct.task.Task import Task
import sys
# First we define some contants for the colors
# First we define some constants for the colors
BLACK = (0, 0, 0, 1)
WHITE = (1, 1, 1, 1)
HIGHLIGHT = (0, 1, 1, 1)
@ -33,7 +33,7 @@ PIECEBLACK = (.15, .15, .15, 1)
# This is how we know where to position an object in 3D space based on a 2D mouse
# position. It also assumes that we are dragging in the XY plane.
#
# This is derived from the mathmatical of a plane, solved for a given point
# This is derived from the mathematical of a plane, solved for a given point
def PointAtZ(z, point, vec):
return point + vec * ((z - point.getZ()) / vec.getZ())
@ -41,7 +41,7 @@ def PointAtZ(z, point, vec):
def SquarePos(i):
return LPoint3((i % 8) - 3.5, int(i // 8) - 3.5, 0)
# Helper function for determining wheter a square should be white or black
# Helper function for determining whether a square should be white or black
# The modulo operations (%) generate the every-other pattern of a chess-board
def SquareColor(i):
if (i + ((i // 8) % 2)) % 2:
@ -84,7 +84,7 @@ class ChessboardDemo(ShowBase):
# relative to it
self.pickerNP = camera.attachNewNode(self.pickerNode)
# Everything to be picked will use bit 1. This way if we were doing other
# collision we could seperate it
# collision we could separate it
self.pickerNode.setFromCollideMask(BitMask32.bit(1))
self.pickerRay = CollisionRay() # Make our ray
# Add it to the collision node
@ -96,7 +96,7 @@ class ChessboardDemo(ShowBase):
# Now we create the chess board and its pieces
# We will attach all of the squares to their own root. This way we can do the
# collision pass just on the sqaures and save the time of checking the rest
# collision pass just on the squares and save the time of checking the rest
# of the scene
self.squareRoot = render.attachNewNode("squareRoot")
@ -240,7 +240,7 @@ class ChessboardDemo(ShowBase):
render.setLight(render.attachNewNode(ambientLight))
# Class for a piece. This just handels loading the model and setting initial
# Class for a piece. This just handles loading the model and setting initial
# position and color
class Piece(object):
def __init__(self, square, color):