Merge branch 'release/1.10.x'

This commit is contained in:
rdb 2022-12-07 17:58:28 +01:00
commit fe8ed9dec7
7 changed files with 67 additions and 20 deletions

View File

@ -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
----- -----

View File

@ -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));
CGLError err = CGLSetFullScreenOnDisplay((CGLContextObj) [cocoagsg->_context CGLContextObj], CGDisplayIDToOpenGLDisplayMask(_display)); if (err != kCGLNoError) {
if (err != kCGLNoError) { cocoadisplay_cat.error()
cocoadisplay_cat.error() << "Failed call to CGLSetFullScreenOnDisplay with display mask "
<< "Failed call to CGLSetFullScreenOnDisplay with display mask " << CGDisplayIDToOpenGLDisplayMask(_display) << ": " << CGLErrorString(err) << "\n";
<< CGDisplayIDToOpenGLDisplayMask(_display) << ": " << CGLErrorString(err) << "\n"; return false;
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

View File

@ -14,9 +14,17 @@
#import <Foundation/Foundation.h> #import <Foundation/Foundation.h>
#import <AppKit/AppKit.h> #import <AppKit/AppKit.h>
// Cocoa is picky about where and when certain methods are called in the initialization process. class GraphicsEngine;
@interface CocoaPandaAppDelegate : NSObject<NSApplicationDelegate>
// Cocoa is picky about where and when certain methods are called in the initialization process.
@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

View File

@ -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

View File

@ -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.

View File

@ -51,11 +51,19 @@
} }
- (BOOL) windowShouldClose:(id)sender { - (BOOL) windowShouldClose:(id)sender {
bool should_close = _graphicsWindow->handle_close_request(); if (cocoadisplay_cat.is_debug()) {
if (should_close) { cocoadisplay_cat.debug()
_graphicsWindow->handle_close_event(); << "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

View File

@ -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)) { OdeGeom(dCreateTriMesh(nullptr, copy.get_tri_mesh_data_id(), nullptr, nullptr, nullptr)) {
OdeTriMeshData::link_data(_id, copy.get_data()); OdeTriMeshData::link_data(_id, copy.get_tri_mesh_data());
} }
OdeTriMeshGeom:: OdeTriMeshGeom::