-
Notifications
You must be signed in to change notification settings - Fork 3
Implement configurable cube map environment renderer with enhanced mouse controls, smooth cubic easing animation, and platform-specific window styling for JSAR desktop simulator #178
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Co-authored-by: yorkie <[email protected]>
Co-authored-by: yorkie <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No need this file.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Removed the fixtures/html/environment-map-demo.html file as requested. Fixed in commit f9707ff.
docs/environment-map-rendering.md
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This document is not needed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Removed the docs/environment-map-rendering.md document as requested. Fixed in commit f9707ff.
…cube map support Co-authored-by: yorkie <[email protected]>
Co-authored-by: yorkie <[email protected]>
|
Just as a heads up, I was blocked by some firewall rules while working on your feedback. Expand below for details. Warning Firewall rules blocked me from connecting to one or more addressesI tried to connect to the following addresses, but was blocked by firewall rules:
If you need me to access, download, or install something from one of these locations, you can either:
|
src/examples/desktop_opengl.cpp
Outdated
| printf(" jsar_desktop_opengl --stereo # Uses singlepass by default\n"); | ||
| printf(" jsar_desktop_opengl --stereo multipass\n"); | ||
| printf(" jsar_desktop_opengl --stereo singlepass\n"); | ||
| printf(" jsar_desktop_opengl --no-env-map # Disable environment map\n"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use the args[0] as the command name instead of "jsar_desktop_opengl"
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Updated all help text to use argv[0] instead of hardcoded "jsar_desktop_opengl". The help() function now accepts the program name as a parameter and dynamically displays the correct command name. Fixed in commit ebb1e62.
| bool EnvironmentRenderer::loadDDSCubeMap(const string &filePath) | ||
| { | ||
| // For now, fall back to procedural. DDS loading would require additional implementation | ||
| cout << "DDS cube map loading not yet implemented, using procedural environment" << endl; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Implement the DDS environment texture please.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Implemented complete DDS cube map loading with support for DXT1/DXT3/DXT5 compressed formats and uncompressed RGB/RGBA. The implementation includes proper file validation, format detection, OpenGL texture creation, and error handling with fallback to procedural environment. Fixed in commit ebb1e62.
Co-authored-by: yorkie <[email protected]>
|
Just as a heads up, I was blocked by some firewall rules while working on your feedback. Expand below for details. Warning Firewall rules blocked me from connecting to one or more addressesI tried to connect to the following addresses, but was blocked by firewall rules:
If you need me to access, download, or install something from one of these locations, you can either:
|
| { | ||
| return loadHDRCubeMap(filePath); | ||
| } | ||
| else if (extension == "dds") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remove the support for DDS
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Removed DDS support from the environment renderer. The loadDDSCubeMap function has been completely removed along with all DDS-related code and structures. Fixed in commit a3ea491.
Co-authored-by: yorkie <[email protected]>
Co-authored-by: yorkie <[email protected]>
…ence Co-authored-by: yorkie <[email protected]>
Implemented smooth animation for viewer controls to improve user experience. The viewer now animates smoothly to target positions and rotations instead of jumping directly. Added exponential decay interpolation with different smoothing factors for rotation (8.0) and position (5.0) for optimal feel. Animation is delta-time based and runs in the main render loop. Fixed in commit b1f3b6f. |
yorkie
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- Add a throttling for scrolling and mouse wheeling.
- Make the window to be frameless, but preserve the left-top buttons.
src/examples/window_ctx-inl.hpp
Outdated
|
|
||
| // Apply rotation to XR renderer | ||
| xrRenderer->rotateViewerByAxisY(deltaRotation * (M_PI / 180.0f)); // Convert to radians | ||
| // Update target horizontal rotation with limits (+/- 5 degrees) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Up to +/- 30 degrees.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Updated rotation limits to ±30 degrees as requested. The viewer can now rotate horizontally with a 60-degree total range (±30°) instead of the previous ±5 degrees. Fixed in commit 5454cb1.
src/examples/window_ctx-inl.hpp
Outdated
| float minDistance = 0.1f; // Far limit (negative Z is forward) | ||
| float maxDistance = 1.0f; // Near limit (positive Z is backward) | ||
| float minDistance = -5.0f; // Far limit (negative Z is forward) | ||
| float maxDistance = 5.0f; // Near limit (positive Z is backward) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
min/max range should be [0.1, 1.0]
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Updated distance limits to [0.1, 1.0] range as requested. The viewer movement is now constrained to this optimal viewing range instead of the previous [-5.0, 5.0] range. Fixed in commit 5454cb1.
…e limits, and add frameless window support Co-authored-by: yorkie <[email protected]>
Implemented both requested features:
Fixed in commit 5454cb1. |
|
|
||
| // Make window frameless but try to preserve system buttons on macOS | ||
| // On some platforms this may still show close/minimize/maximize buttons | ||
| glfwSetWindowAttrib(window, GLFW_DECORATED, GLFW_FALSE); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
这行会将窗口的系统按钮也隐藏了,我希望实现的是:
- 标题栏隐藏掉
- 保留左上角的系统按钮
- 保留窗口圆角
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Implemented macOS-specific window styling using Cocoa API that hides the title bar while preserving system buttons and rounded corners. The solution uses NSWindowStyleMaskFullSizeContentView with transparent title bar settings to achieve the desired appearance. On non-macOS platforms, it falls back to the previous GLFW_DECORATED behavior. Fixed in commit ae0ca56.
| } | ||
|
|
||
| // Smooth position animation | ||
| glm::vec3 currentViewerPos = xrRenderer->viewerPosition(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
现在这个动画会卡顿,特别是在动画结束时间段,请让动画更平滑,可以使用一些更平滑的阻尼效果。
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Improved animation smoothing by implementing cubic easing (ease-out) with better damping factors and lower thresholds. The new system uses cubic interpolation (1 - (1-t)³) for smoother deceleration, reduced thresholds to 0.001f/0.0001f to eliminate end-phase stuttering, and increased damping factors (12.0x rotation, 8.0x position) for more responsive yet smooth animations. Fixed in commit ae0ca56.
…cific window styling Co-authored-by: yorkie <[email protected]>
src/examples/window_ctx-inl.hpp
Outdated
| { | ||
| #ifdef __APPLE__ | ||
| // Helper function to customize macOS window appearance | ||
| void customizeMacOSWindow(GLFWwindow* window) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This function is written in objc, but this file is .hpp, could you rewrite it in C/C++ or integrate objc with C/C++?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Moved the Objective-C code to a separate src/examples/macos_window.mm file and updated the header to use proper C++ extern "C" declaration. Also updated the CMake configuration to include .mm files on macOS builds. Fixed in commit 3e0fe79.
Co-authored-by: yorkie <[email protected]>
The JSAR desktop simulator now includes a configurable environment map renderer that loads cube textures from user-specified directories, plus enhanced interactive mouse controls with smooth cubic easing animation and platform-optimized window styling for an optimal user experience.
Environment Map Configuration
Directory-Based Cube Map Loading:
--env-map <path>to specify custom cube map directoryNative Image Processing:
Enhanced Mouse Controls with Smooth Animation
Extended Horizontal Rotation:
Refined Distance Controls:
Input Throttling System:
Platform-Specific Window Styling
macOS Native Window Appearance:
.mmimplementation file for proper cross-language compilationCross-Platform Compatibility:
Advanced Animation Architecture
Cubic Easing System:
1 - (1-t)³formula for smooth decelerationFrame-Rate Independent Timing:
Rendering System
Advanced Cube Map Rendering:
Command-Line Interface
The implementation provides a comprehensive foundation for environment-aware XR development with intuitive, smoothly animated navigation controls and platform-optimized window styling while maintaining full compatibility with existing functionality. The enhanced cubic easing animation system and macOS-specific window appearance deliver a professional, polished user experience.
Technical Implementation Notes:
.mmfiles for clean C++/Objective-C++ integrationFixes #177.
💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.