Browse Source

Merge branch 'release/1.10.x'

rdb 3 years ago
parent
commit
fe8ed9dec7

+ 2 - 2
README.md

@@ -80,10 +80,10 @@ makepanda\makepanda.bat --everything --installer --msvc-version=14.3 --windows-s
 When the build succeeds, it will produce an .exe file that you can use to
 When the build succeeds, it will produce an .exe file that you can use to
 install Panda3D on your system.
 install Panda3D on your system.
 
 
-Note: you may choose to remove --no-eigen and build with Eigen support in
+**Note:** you may choose to remove `--no-eigen` and build with Eigen support in
 order to improve runtime performance.  However, this will cause the build to
 order to improve runtime performance.  However, this will cause the build to
 take hours to complete, as Eigen is a heavily template-based library, and the
 take hours to complete, as Eigen is a heavily template-based library, and the
-the MSVC compiler does not perform well under these circumstances.
+MSVC compiler does not perform well under those circumstances.
 
 
 Linux
 Linux
 -----
 -----

+ 8 - 10
panda/src/cocoadisplay/cocoaGraphicsWindow.mm

@@ -99,7 +99,7 @@ CocoaGraphicsWindow(GraphicsEngine *engine, GraphicsPipe *pipe,
   if (NSApp == nil) {
   if (NSApp == nil) {
     [CocoaPandaApp sharedApplication];
     [CocoaPandaApp sharedApplication];
 
 
-    CocoaPandaAppDelegate *delegate = [[CocoaPandaAppDelegate alloc] init];
+    CocoaPandaAppDelegate *delegate = [[CocoaPandaAppDelegate alloc] initWithEngine:engine];
     [NSApp setDelegate:delegate];
     [NSApp setDelegate:delegate];
 
 
     [NSApp setActivationPolicy:NSApplicationActivationPolicyRegular];
     [NSApp setActivationPolicy:NSApplicationActivationPolicyRegular];
@@ -209,17 +209,15 @@ begin_frame(FrameMode mode, Thread *current_thread) {
   cocoagsg->lock_context();
   cocoagsg->lock_context();
 
 
   // Set the drawable.
   // Set the drawable.
-  if (_properties.get_fullscreen()) {
+  if (_properties.get_fullscreen() && !is_arm64_mac()) {
     // Fullscreen.  Note that this call doesn't work with the newer
     // Fullscreen.  Note that this call doesn't work with the newer
     // Metal-based OpenGL drivers.
     // Metal-based OpenGL drivers.
-    if (!is_arm64_mac()) {
-      CGLError err = CGLSetFullScreenOnDisplay((CGLContextObj) [cocoagsg->_context CGLContextObj], CGDisplayIDToOpenGLDisplayMask(_display));
-      if (err != kCGLNoError) {
-        cocoadisplay_cat.error()
-          << "Failed call to CGLSetFullScreenOnDisplay with display mask "
-          << CGDisplayIDToOpenGLDisplayMask(_display) << ": " << CGLErrorString(err) << "\n";
-        return false;
-      }
+    CGLError err = CGLSetFullScreenOnDisplay((CGLContextObj) [cocoagsg->_context CGLContextObj], CGDisplayIDToOpenGLDisplayMask(_display));
+    if (err != kCGLNoError) {
+      cocoadisplay_cat.error()
+        << "Failed call to CGLSetFullScreenOnDisplay with display mask "
+        << CGDisplayIDToOpenGLDisplayMask(_display) << ": " << CGLErrorString(err) << "\n";
+      return false;
     }
     }
   } else {
   } else {
     // Although not recommended, it is technically possible to use the same
     // Although not recommended, it is technically possible to use the same

+ 9 - 1
panda/src/cocoadisplay/cocoaPandaAppDelegate.h

@@ -14,9 +14,17 @@
 #import <Foundation/Foundation.h>
 #import <Foundation/Foundation.h>
 #import <AppKit/AppKit.h>
 #import <AppKit/AppKit.h>
 
 
+class GraphicsEngine;
+
 // Cocoa is picky about where and when certain methods are called in the initialization process.
 // Cocoa is picky about where and when certain methods are called in the initialization process.
-@interface CocoaPandaAppDelegate : NSObject<NSApplicationDelegate>
+@interface CocoaPandaAppDelegate : NSObject<NSApplicationDelegate> {
+  @private
+    GraphicsEngine *_engine;
+}
 
 
+- (id) initWithEngine:(GraphicsEngine *)engine;
 - (void)applicationDidFinishLaunching:(NSNotification *)notification;
 - (void)applicationDidFinishLaunching:(NSNotification *)notification;
+- (BOOL)applicationShouldTerminate:(NSApplication *)app;
+- (void)applicationWillTerminate:(NSNotification *)notification;
 
 
 @end
 @end

+ 32 - 0
panda/src/cocoadisplay/cocoaPandaAppDelegate.mm

@@ -12,12 +12,44 @@
 */
 */
 
 
 #import "cocoaPandaAppDelegate.h"
 #import "cocoaPandaAppDelegate.h"
+#include "graphicsEngine.h"
 
 
 @implementation CocoaPandaAppDelegate
 @implementation CocoaPandaAppDelegate
 
 
+- (id) initWithEngine:(GraphicsEngine *)engine {
+
+  if (self = [super init]) {
+    _engine = engine;
+  }
+
+  return self;
+}
+
 - (void)applicationDidFinishLaunching:(NSNotification *)notification {
 - (void)applicationDidFinishLaunching:(NSNotification *)notification {
   // This only seems to work when called here.
   // This only seems to work when called here.
   [NSApp activateIgnoringOtherApps:YES];
   [NSApp activateIgnoringOtherApps:YES];
 }
 }
 
 
+- (BOOL)applicationShouldTerminate:(NSApplication *)app {
+  if (cocoadisplay_cat.is_debug()) {
+    cocoadisplay_cat.debug()
+      << "Received applicationShouldTerminate, closing all Cocoa windows\n";
+  }
+  // Call performClose on all the windows.  This should make ShowBase shut down.
+  for (NSWindow *window in [app windows]) {
+    [window performClose:nil];
+  }
+  return FALSE;
+}
+
+- (void)applicationWillTerminate:(NSNotification *)notification {
+  // The application is about to be closed, tell the graphics engine to close
+  // all the windows.
+  if (cocoadisplay_cat.is_debug()) {
+    cocoadisplay_cat.debug()
+      << "Received applicationWillTerminate, removing all windows\n";
+  }
+  _engine->remove_all_windows();
+}
+
 @end
 @end

+ 1 - 0
panda/src/cocoadisplay/cocoaPandaWindowDelegate.h

@@ -30,6 +30,7 @@ class CocoaGraphicsWindow;
 - (void)windowDidBecomeKey:(NSNotification *)notification;
 - (void)windowDidBecomeKey:(NSNotification *)notification;
 - (void)windowDidResignKey:(NSNotification *)notification;
 - (void)windowDidResignKey:(NSNotification *)notification;
 - (BOOL)windowShouldClose:(id)sender;
 - (BOOL)windowShouldClose:(id)sender;
+- (void)windowWillClose:(id)sender;
 
 
 // TODO: handle fullscreen on Lion.
 // TODO: handle fullscreen on Lion.
 
 

+ 12 - 4
panda/src/cocoadisplay/cocoaPandaWindowDelegate.mm

@@ -51,11 +51,19 @@
 }
 }
 
 
 - (BOOL) windowShouldClose:(id)sender {
 - (BOOL) windowShouldClose:(id)sender {
-  bool should_close = _graphicsWindow->handle_close_request();
-  if (should_close) {
-    _graphicsWindow->handle_close_event();
+  if (cocoadisplay_cat.is_debug()) {
+    cocoadisplay_cat.debug()
+      << "Received windowShouldClose for window " << _graphicsWindow << "\n";
   }
   }
-  return should_close;
+  return _graphicsWindow->handle_close_request();
+}
+
+- (void) windowWillClose:(id)sender {
+  if (cocoadisplay_cat.is_debug()) {
+    cocoadisplay_cat.debug()
+      << "Received windowWillClose for window " << _graphicsWindow << "\n";
+  }
+  _graphicsWindow->handle_close_event();
 }
 }
 
 
 @end
 @end

+ 2 - 2
panda/src/ode/odeTriMeshGeom.cxx

@@ -35,8 +35,8 @@ OdeTriMeshGeom(OdeSpace &space, OdeTriMeshData &data) :
 
 
 OdeTriMeshGeom::
 OdeTriMeshGeom::
 OdeTriMeshGeom(const OdeTriMeshGeom &copy) :
 OdeTriMeshGeom(const OdeTriMeshGeom &copy) :
-  OdeGeom(dCreateTriMesh(nullptr, copy.get_data_id(), nullptr, nullptr, nullptr)) {
-  OdeTriMeshData::link_data(_id, copy.get_data());
+  OdeGeom(dCreateTriMesh(nullptr, copy.get_tri_mesh_data_id(), nullptr, nullptr, nullptr)) {
+  OdeTriMeshData::link_data(_id, copy.get_tri_mesh_data());
 }
 }
 
 
 OdeTriMeshGeom::
 OdeTriMeshGeom::