Files
lucidia-metaverse/node_modules/three/examples/jsm/renderers/common/CubeRenderTarget.js
Alexa Louise 47cf47f624 Initial commit: Lucidia Metaverse
Complete 3D metaverse platform with:
- Three.js 3D rendering
- Cannon.js physics engine
- Pointer lock controls
- Procedural cityscape
- Floating islands
- Portal system
- Particle effects
- WebXR/VR support ready
- Multiplayer ready (Socket.io)

Features:
- First-person controls (WASD + mouse)
- Jump and run mechanics
- Chat system
- Real-time HUD
- Loading screen
- Responsive design

Built with Vite for fast builds and hot reload.

🤖 Generated with Claude Code

Co-Authored-By: Claude <noreply@anthropic.com>
2025-12-22 19:02:56 -06:00

66 lines
1.9 KiB
JavaScript

import { WebGLCubeRenderTarget, Scene, CubeCamera, BoxGeometry, Mesh, BackSide, NoBlending, LinearFilter, LinearMipmapLinearFilter } from 'three';
import { equirectUV } from '../../nodes/utils/EquirectUVNode.js';
import { texture as TSL_Texture } from '../../nodes/accessors/TextureNode.js';
import { positionWorldDirection } from '../../nodes/accessors/PositionNode.js';
import { createNodeMaterialFromType } from '../../nodes/materials/NodeMaterial.js';
// @TODO: Consider rename WebGLCubeRenderTarget to just CubeRenderTarget
class CubeRenderTarget extends WebGLCubeRenderTarget {
constructor( size = 1, options = {} ) {
super( size, options );
this.isCubeRenderTarget = true;
}
fromEquirectangularTexture( renderer, texture ) {
const currentMinFilter = texture.minFilter;
const currentGenerateMipmaps = texture.generateMipmaps;
texture.generateMipmaps = true;
this.texture.type = texture.type;
this.texture.colorSpace = texture.colorSpace;
this.texture.generateMipmaps = texture.generateMipmaps;
this.texture.minFilter = texture.minFilter;
this.texture.magFilter = texture.magFilter;
const geometry = new BoxGeometry( 5, 5, 5 );
const uvNode = equirectUV( positionWorldDirection );
const material = createNodeMaterialFromType( 'MeshBasicNodeMaterial' );
material.colorNode = TSL_Texture( texture, uvNode, 0 );
material.side = BackSide;
material.blending = NoBlending;
const mesh = new Mesh( geometry, material );
const scene = new Scene();
scene.add( mesh );
// Avoid blurred poles
if ( texture.minFilter === LinearMipmapLinearFilter ) texture.minFilter = LinearFilter;
const camera = new CubeCamera( 1, 10, this );
camera.update( renderer, scene );
texture.minFilter = currentMinFilter;
texture.currentGenerateMipmaps = currentGenerateMipmaps;
mesh.geometry.dispose();
mesh.material.dispose();
return this;
}
}
export default CubeRenderTarget;