Dev#24
Conversation
There was a problem hiding this comment.
Pull Request Overview
This PR introduces a comprehensive WebGL2 rendering system with support for textures, shaders, materials, meshes, and batch rendering. The implementation provides a complete abstraction layer over WebGL2 with modern features including PBR materials, shader variants, and optimized batch rendering.
Key Changes
- Complete WebGL2 texture system with format info, validation, and utilities
- Advanced shader compilation and management with variant support and caching
- Material system supporting Standard and PBR workflows with property management
- Mesh/geometry system with vertex/index buffers and VAO management
- Batch rendering system for optimized draw call reduction
Reviewed Changes
Copilot reviewed 37 out of 37 changed files in this pull request and generated 10 comments.
Show a summary per file
| File | Description |
|---|---|
| packages/core/src/renderer/webgl2/texture/utils.ts | Texture utility classes for format handling, WebGL constants mapping, and validation |
| packages/core/src/renderer/webgl2/texture/texture.ts | Core WebGL texture implementation with mipmap generation and data upload |
| packages/core/src/renderer/webgl2/texture/sampler.ts | Texture sampler implementation with filtering and wrapping configuration |
| packages/core/src/renderer/webgl2/texture/manager.ts | Texture manager for creation, caching, and loading from files |
| packages/core/src/renderer/webgl2/shader/utils.ts | Shader utilities for type sizes, validation, and buffer layout |
| packages/core/src/renderer/webgl2/shader/compiler.ts | Shader compilation with variant support and validation |
| packages/core/src/renderer/webgl2/shader/material.ts | Material instance with property and keyword management |
| packages/core/src/renderer/webgl2/shader/manager.ts | Shader manager with caching and variant handling |
| packages/core/src/renderer/webgl2/mesh/utils.ts | Mesh utilities for layout validation and bounds calculation |
| packages/core/src/renderer/webgl2/material/standard-material.ts | Unity-style standard PBR material implementation |
| packages/core/src/renderer/webgl2/material/pbr-material.ts | glTF 2.0 compatible PBR material implementation |
| packages/core/src/renderer/webgl2/batch/batch-renderer.ts | Batch renderer for optimized instanced rendering |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
| } | ||
|
|
||
| public static generateTextureId(): string { | ||
| return `tex_${Date.now()}_${Math.random().toString(36).substr(2, 9)}`; |
There was a problem hiding this comment.
The substr method is deprecated. Use substring or slice instead.
| return `tex_${Date.now()}_${Math.random().toString(36).substr(2, 9)}`; | |
| return `tex_${Date.now()}_${Math.random().toString(36).slice(2, 11)}`; |
| } | ||
|
|
||
| if (TextureFormatInfo.isInteger(format)) { | ||
|
|
There was a problem hiding this comment.
Empty if block should either be removed or contain a TODO comment explaining why it's intentionally empty.
| // TODO: Handle integer format compatibility if needed in future. |
| const r = parseInt(hex.substr(0, 2), 16) / 255; | ||
| const g = parseInt(hex.substr(2, 2), 16) / 255; | ||
| const b = parseInt(hex.substr(4, 2), 16) / 255; | ||
| const a = hex.length === 8 ? parseInt(hex.substr(6, 2), 16) / 255 : 1; |
There was a problem hiding this comment.
The substr method is deprecated. Use substring or slice instead.
| const r = parseInt(hex.substr(0, 2), 16) / 255; | |
| const g = parseInt(hex.substr(2, 2), 16) / 255; | |
| const b = parseInt(hex.substr(4, 2), 16) / 255; | |
| const a = hex.length === 8 ? parseInt(hex.substr(6, 2), 16) / 255 : 1; | |
| const r = parseInt(hex.slice(0, 2), 16) / 255; | |
| const g = parseInt(hex.slice(2, 4), 16) / 255; | |
| const b = parseInt(hex.slice(4, 6), 16) / 255; | |
| const a = hex.length === 8 ? parseInt(hex.slice(6, 8), 16) / 255 : 1; |
| } | ||
|
|
||
| private _generateSamplerId(): string { | ||
| return `sampler_${Date.now()}_${Math.random().toString(36).substr(2, 9)}`; |
There was a problem hiding this comment.
The substr method is deprecated. Use substring or slice instead.
| return `sampler_${Date.now()}_${Math.random().toString(36).substr(2, 9)}`; | |
| return `sampler_${Date.now()}_${Math.random().toString(36).substring(2, 11)}`; |
|
|
||
| if (this.options.borderColor) { | ||
| const color = this.options.borderColor; | ||
|
|
There was a problem hiding this comment.
Empty if block should either be removed or contain a TODO comment explaining why border color configuration is not yet implemented.
| // TODO: Border color configuration is not yet implemented. | |
| // WebGL2 does not support sampler border color directly. |
| } | ||
|
|
||
| if (this.options.lodBias !== undefined) { | ||
|
|
There was a problem hiding this comment.
Empty if block should either be removed or contain a TODO comment explaining why LOD bias configuration is not yet implemented.
| // TODO: LOD bias configuration is not yet implemented. |
| options?: { defines?: Record<string, any>; version?: string; precision?: string; } | ||
| ): Promise<string> { | ||
| return new Promise((resolve, reject) => { | ||
| const id = `${Date.now()}_${Math.random().toString(36).substr(2, 9)}`; |
There was a problem hiding this comment.
The substr method is deprecated. Use substring or slice instead.
| const id = `${Date.now()}_${Math.random().toString(36).substr(2, 9)}`; | |
| const id = `${Date.now()}_${Math.random().toString(36).slice(2, 11)}`; |
| } | ||
|
|
||
| public static generateMeshId(): string { | ||
| return `mesh_${Date.now()}_${Math.random().toString(36).substr(2, 9)}`; |
There was a problem hiding this comment.
The substr method is deprecated. Use substring or slice instead.
| return `mesh_${Date.now()}_${Math.random().toString(36).substr(2, 9)}`; | |
| return `mesh_${Date.now()}_${Math.random().toString(36).slice(2, 11)}`; |
| this.bufferFactory = createBufferFactory(gl); | ||
| this._usage = config.usage || BufferUsage.STATIC_DRAW; | ||
| this._indexType = config.indexType || IndexType.UNSIGNED_SHORT; | ||
| this._id = `index_buffer_${Date.now()}_${Math.random().toString(36).substr(2, 9)}`; |
There was a problem hiding this comment.
The substr method is deprecated. Use substring or slice instead.
| this._id = `index_buffer_${Date.now()}_${Math.random().toString(36).substr(2, 9)}`; | |
| this._id = `index_buffer_${Date.now()}_${Math.random().toString(36).slice(2, 11)}`; |
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
… better visibility
…ontrols for dynamic offset adjustments
…ved public access and enhanced UI controls
…amping adjustments for smoother camera behavior
…ed yaw handling and rotation logic
…and enhancing fixed offset behavior
- Implemented a live editor using Monaco Editor with TypeScript support. - Created a runtime for compiling and executing scene examples with support for specific modules. - Added custom theme and configuration for the Monaco Editor. - Introduced diagnostics formatting for TypeScript compilation errors.
- Updated the main layout to a modern professional design with improved header and context bar. - Added icons to toolbar buttons for better visual representation. - Enhanced the editor and preview panels with improved loading messages and status indicators. - Implemented a resize handle for the editor panel to allow dynamic resizing. - Improved accessibility and usability with updated labels and descriptions. - Refactored CSS for a dark professional theme, including new color variables and responsive design adjustments. - Added utility classes for better styling control and consistency across components. - Introduced logic to prevent duplicate Monaco editor models.
- Created postcss.config.js to configure PostCSS with Tailwind CSS and autoprefixer. - Added tailwind.config.js to define custom theme colors, fonts, box shadows, animations, and keyframes for the project.
…rone and Three.js
…oved rendering dynamics
…matrix adjustments
- move parent-child ownership into a dedicated Hierarchy component - keep Transform ergonomics intact while reducing runtime coupling - serialize prefab hierarchy as node links and restore it during load - refresh actor and scene coverage around the new hierarchy flow
…irst Agent-Logs-Url: https://github.com/hun756/Axrone/sessions/98ec75d3-2358-4937-9ee0-18ff24ab96d7 Co-authored-by: hun756 <56188619+hun756@users.noreply.github.com>
Scene bench
Enhance scene management, UI, and performance across components
- switch random id helpers from substr to slice - update hex color parsing to use slice with explicit ranges - clear deprecated string API usage without changing behavior
No description provided.