3D engine that AI agents drive
JavaScript 3d3d-engineagentic-aiai-agentsblenderclaude-codegame-enginegaussian-splattinggltfjavascriptmcpmcp-servermodel-context-protocolpath-tracerpath-tracingpbrrenderingthreejs-alternativewebgl2webgpu
Merge remote-tracking branch 'origin/main' into w2185m
Nguyen Xuan Anf996b2b466ad
diff --cc src/renderer.jsindex e71d87bb,f05257d8..fa05cb1c--- a/src/renderer.js+++ b/src/renderer.js@@@ -2133,45 -2116,14 +2118,28 @@@ export class CrucibleRendererthis.renderTargets.record('multisampleColor', { width, height, format: this.hdr ? 'RGBA16F' : 'RGBA8', samples: this.multisampleSamples });this.renderTargets.record('multisampleDepth', { width, height, format: depthFormat, samples: this.multisampleSamples });this.renderTargets.record('frameColor', { width, height, format: this.hdr ? 'RGBA16F' : 'RGBA8' });- this.frameTexture = context.createTexture();- context.bindTexture(context.TEXTURE_2D, this.frameTexture);- context.texImage2D(context.TEXTURE_2D, 0, this.hdr ? context.RGBA16F : context.RGBA8, width, height, 0, context.RGBA, this.hdr ? context.HALF_FLOAT : context.UNSIGNED_BYTE, null);- context.texParameteri(context.TEXTURE_2D, context.TEXTURE_MIN_FILTER, context.LINEAR);- context.texParameteri(context.TEXTURE_2D, context.TEXTURE_MAG_FILTER, context.LINEAR);- context.texParameteri(context.TEXTURE_2D, context.TEXTURE_WRAP_S, context.CLAMP_TO_EDGE);- context.texParameteri(context.TEXTURE_2D, context.TEXTURE_WRAP_T, context.CLAMP_TO_EDGE);- this.resolveFramebuffer = context.createFramebuffer();- context.bindFramebuffer(context.FRAMEBUFFER, this.resolveFramebuffer);- context.framebufferTexture2D(context.FRAMEBUFFER, context.COLOR_ATTACHMENT0, context.TEXTURE_2D, this.frameTexture, 0);- if (this.depth) {- this.depthTexture = context.createTexture();- context.bindTexture(context.TEXTURE_2D, this.depthTexture);- context.texImage2D(context.TEXTURE_2D, 0, context.DEPTH_COMPONENT24, width, height, 0, context.DEPTH_COMPONENT, context.UNSIGNED_INT, null);- context.texParameteri(context.TEXTURE_2D, context.TEXTURE_MIN_FILTER, context.NEAREST);- context.texParameteri(context.TEXTURE_2D, context.TEXTURE_MAG_FILTER, context.NEAREST);- context.texParameteri(context.TEXTURE_2D, context.TEXTURE_WRAP_S, context.CLAMP_TO_EDGE);- context.texParameteri(context.TEXTURE_2D, context.TEXTURE_WRAP_T, context.CLAMP_TO_EDGE);- context.framebufferTexture2D(context.FRAMEBUFFER, context.DEPTH_ATTACHMENT, context.TEXTURE_2D, this.depthTexture, 0);- this.renderTargets.record('sceneDepth', { width, height, format: 'DEPTH_COMPONENT24' });- }- if (context.checkFramebufferStatus(context.FRAMEBUFFER) !== context.FRAMEBUFFER_COMPLETE) throw new Error('Resolve framebuffer allocation failed. Choose a lower quality preset.');+ const resolve = this.backend.createResolveTarget({ width, height, hdr: this.hdr, depth: this.depth });+ this.resolveFramebuffer = resolve.framebuffer;+ this.frameTexture = resolve.colorTexture;+ this.depthTexture = resolve.depthTexture;+ if (this.depth) this.renderTargets.record('sceneDepth', { width, height, format: depthFormat });this.bloomWidth = Math.max(1, Math.ceil(width / 2));this.bloomHeight = Math.max(1, Math.ceil(height / 2));- context.bindFramebuffer(context.FRAMEBUFFER, null);+ this.backend.bindCanvasTarget();+ this.chooseColorFormat(width, height);+ }++ // An opaque canvas never reads the frame's alpha, so the frame and multisample colour take 4 bytes a pixel instead of 8 (#2179).+ // A device that refuses the compact framebuffers gets the RGBA16F targets back.+ chooseColorFormat(width, height) {+ this.colorFormat = this.hdr ? 'RGBA16F' : 'RGBA8';+ if (!canUseCompactColor(this)) return;+ try {+ respecifyColorTargets(this, width, height);+ } catch {+ this.compactColor = false;+ this.allocateFrameTargets(width, height);+ }}// The prefilter and BRDF programs build while the other programs do, instead of after them.