This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
RhodoniteTS is a comprehensive Web3D graphics library written in TypeScript that supports both WebGL2 and WebGPU rendering APIs. It features a "Blittable Memory Architecture" for efficient GPU data transfer and supports advanced rendering techniques including PBR, IBL, WebXR, and various 3D model formats.
pnpm build # Build all targets (ESM + IIFE, dev + prod)
pnpm build-esm-dev # Development ESM build with source maps
pnpm build-esm-prod # Production ESM build (optimized)
pnpm build-samples # Compile TypeScript samplespnpm watch-esm-dev # Watch mode for library development
pnpm watch-samples # Watch samples with auto-reload and dev server
pnpm start # Start development server on port 8082pnpm test # Run all tests (unit + E2E visual regression)
pnpm test-unit # Unit tests only (Vitest)
pnpm test-e2e # E2E visual tests only (Puppeteer)
pnpm test-coverage # Test with coverage report
pnpm test-e2e-update # Update E2E test snapshotspnpm lint # Lint code using Biome
pnpm lint:fix # Auto-fix linting issues
pnpm format # Format code using Biome
pnpm format:fix # Auto-format code
pnpm check # Run both linting and formatting checks
pnpm check:fix # Auto-fix both linting and formatting issues
pnpm doc # Generate TypeDoc API documentation- Node.js 22+ is strictly required
- E2E tests are environment-sensitive and may fail in different environments
- Always run
pnpm build && pnpm build-samples && pnpm testbefore submitting PRs - Main development branch is
develop, notmain
- Entity-Component-System (ECS): Scene graph management through entities with attachable components
- Component Types: Transform, Mesh, Camera, Light, Animation, Physics, Skeletal, BlendShape, VRM, Effekseer
- Component Repository: Centralized component management and lifecycle
- Blittable Memory Architecture: Data stored in pre-allocated ArrayBuffers for efficient GPU transfer
- Memory Pools: Components use typed array views into shared memory pools
- GPU Optimization: Data layout optimized for transfer as floating-point textures
- Strategy Pattern: Abstract rendering interfaces supporting both WebGL2 and WebGPU
- Resource Repositories: Separate management for WebGL and WebGPU resources
- Unified Shader System: Cross-platform shader compilation and management
- Node-Based Composition: Shader nodes for flexible material creation
- Material Contents: Abstraction layer for different material types (PBR, MToon, MatCap, etc.)
- Shader Graph Resolver: Automatic dependency resolution for shader node graphs
src/foundation/
├── components/ # ECS components (Transform, Mesh, Camera, Light, etc.)
├── core/ # Core systems (Entity, Component, Repository, Memory)
├── system/ # System-level management (System, ModuleManager, Time)
├── renderer/ # Rendering pipeline (RenderPass, RenderPipeline, FrameBuffer)
├── materials/ # Material system (Material, MaterialContent, shader nodes)
├── math/ # Mathematical primitives (Vector, Matrix, Quaternion, Color)
├── geometry/ # Mesh and primitive geometry (Primitive, Buffer, Accessor)
├── physics/ # Physics integration (PhysicsComponent, collision detection)
├── helpers/ # Utility helpers (data conversion, validation, etc.)
└── importer/ # Asset importers (glTF, VRM, DRC, KTX2, etc.)
src/webgl/ # WebGL-specific implementation
src/webgpu/ # WebGPU-specific implementation
src/types/ # TypeScript type definitions
src/effekseer/ # Effekseer particle system integration
src/xr/ # WebXR support
- ESM Dev (
dist/esmdev/): Development build with source maps and debugging - ESM Prod (
dist/esm/): Production build with tree-shaking and optimization - IIFE Dev (
dist/iifedev/rhodonite.js): Browser-ready development bundle - IIFE Prod (
dist/iife/rhodonite.min.js): Minified production bundle
- tsup: Primary build tool using esbuild for fast compilation
- esbuild-plugin-shaderity: Processes shader files during build
- esbuild-plugin-version: Handles version file generation
- TypeScript: Type checking and .d.ts generation
- Environment: Happy DOM for lightweight browser simulation
- Coverage: Available via V8 coverage provider
- Location: Test files alongside source code (
*.test.ts)
- Purpose: Visual regression testing for rendering accuracy
- Location:
samples/test_e2e/ - Environment Sensitive: Tests are calibrated for specific development environment
- Snapshots: Image comparison with automatic snapshot updating
- Components extend base
Componentclass and implement required interfaces - Use
ComponentRepositoryfor registration and lifecycle management - Follow established patterns in existing components for consistency
- Use
MemoryManagerfor efficient memory pool allocation - Components should use typed array views rather than creating new arrays
- Consider GPU data layout when designing data structures
- Extend
AbstractMaterialContentfor new material types - Use shader nodes for composable material features
- Register materials with
MaterialRepository
- Use
AssetLoaderwith appropriate extension loaders - Support format detection via file extension and magic numbers
- Handle async loading patterns consistently
- Use
RenderPasssystem for organizing rendering operations - Support both WebGL and WebGPU rendering strategies
- Follow established patterns for resource management
- ktx-parse: KTX2 texture format parsing
- shaderity: Shader compilation and cross-platform support
- zstddec: ZSTD decompression for compressed assets
- @biomejs/biome: Fast linter and formatter for consistent code quality
- typedoc: API documentation generation
- vitest: Fast unit testing framework
- puppeteer: Automated browser testing for E2E
- Think in English deeply, and respond to user in Japanese.