Skip to content

Conversation

@EndlessJour9527
Copy link
Collaborator

@EndlessJour9527 EndlessJour9527 commented Oct 24, 2025

This pull request adds interactive close button functionality to the BarComponent, improves input handling, and updates the content dragging logic to use accurate world-space calculations. The most significant changes include the addition of instanced rendering for close buttons, new input processing for button interactions, and improved drag behavior that takes camera perspective into account.

BarComponent: Close Button Rendering and Interaction

  • Added instanced rendering for close buttons, including geometry creation, buffer management, and per-instance state (hover, press) in bar_component.cpp and bar_component.hpp. This includes the new createButtonGeometry, updateButtonInstanceBuffer, and related OpenGL resource management. [1] [2] [3] [4]
  • Implemented per-frame input processing for close button interactions, including ray intersection detection, hover state, and click-to-close logic, with a callback mechanism for content removal. [1] [2]

Shader and Resource Management

  • Refactored shader usage to use the new Shader class instead of raw OpenGL program management, simplifying uniform setting and program lifecycle. [1] [2] [3]

Content Dragging Improvements

  • Improved drag calculations to use world-space movement based on camera position, field of view, and viewport size, resulting in more natural and accurate drag behavior for content.

Input Handling Integration

  • Added processInput methods to both Content and BarComponent, connecting content-level input processing to bar interactions and enabling close button functionality. [1] [2]

General Codebase Updates

  • Added references to xr_renderer.hpp and ensured WindowContext is stored in Content for improved access to rendering and input context. [1] [2] [3]

Copilot AI review requested due to automatic review settings October 24, 2025 07:03
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR adds close button functionality to the content bar, enabling users to remove content through visual button interactions. The implementation uses instanced rendering for multiple close buttons, integrates ray-based input processing, and refactors shader management.

Key Changes

  • Added interactive close button with hover states and click detection using ray-distance calculations
  • Integrated callback mechanism for content removal through setOnCloseCallback
  • Refactored shader compilation to use a reusable Shader class

Reviewed Changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated 8 comments.

Show a summary per file
File Description
src/examples/transmute_browser.cpp Registers close callbacks and adds input processing loop for content interactions
src/examples/shader.hpp New reusable Shader class replacing inline shader compilation code
src/examples/content.hpp Added WindowContext reference and processInput method for input handling
src/examples/content.cpp Stores window context and delegates input processing to bar component
src/examples/bar_component.hpp Added button rendering infrastructure, close callback, and Shader integration
src/examples/bar_component.cpp Implements button geometry, instanced rendering, ray-based input detection, and shader refactoring

@EndlessJour9527 EndlessJour9527 self-assigned this Oct 27, 2025
@yorkie yorkie merged commit bc3450b into main Nov 3, 2025
2 checks passed
@yorkie yorkie deleted the feat/add-bar-close-button branch November 3, 2025 10:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants