An open API service indexing awesome lists of open source software.

https://github.com/vibe-stack/freed

A web based 3d editor inspired by blender, demo app for the vibe coding book
https://github.com/vibe-stack/freed

3d 3deditor blender editor threejs web3d

Last synced: 10 months ago
JSON representation

A web based 3d editor inspired by blender, demo app for the vibe coding book

Awesome Lists containing this project

README

          

# Gestalt - 3D Web Editor

A React-first 3D editor with reactive geometry system, built with Next.js and modern web technologies.

## ๐Ÿš€ Features

### Core Functionality
- **Reactive Geometry System**: Built on Zustand stores with reactive data structures
- **Dual View Modes**: Object Mode and Edit Mode for different interaction paradigms
- **Component Selection**: Vertex, Edge, and Face selection in Edit Mode
- **Scene Hierarchy**: Nested objects with parent-child relationships
- **Real-time Updates**: All changes are immediately reflected across the UI

### T3D File Format Support
- **Custom Format**: Proprietary `.t3d` format for saving/loading scenes
- **Full Data Preservation**: Complete scene state including meshes, materials, hierarchy, and viewport
- **Browser-based**: Entirely client-side export/import using ZIP compression
- **Version Control**: Built-in version compatibility system
- **ID Stability**: Preserves all object IDs across export/import cycles

### Current Implementation
- Multiple mesh creation and management
- Material system with PBR properties
- Transform operations (position, rotation, scale)
- Selection state management
- Viewport camera controls
- Debug panels and test suites

## ๐Ÿ› ๏ธ Tech Stack

- **Frontend**: Next.js 15, React 19, TypeScript
- **State Management**: Zustand with Immer middleware
- **3D Math**: Custom geometry utilities
- **File Handling**: JSZip for T3D format
- **Styling**: Tailwind CSS
- **Development**: Turbopack for fast builds

## ๐Ÿ“ Project Structure

```
src/
โ”œโ”€โ”€ app/ # Next.js app directory
โ”œโ”€โ”€ components/ # React components
โ”‚ โ”œโ”€โ”€ GeometryDebugPanel.tsx
โ”‚ โ”œโ”€โ”€ T3DToolbar.tsx # Export/Import controls
โ”‚ โ”œโ”€โ”€ T3DTestSuite.tsx # Testing utilities
โ”‚ โ””โ”€โ”€ DemoContentCreator.tsx
โ”œโ”€โ”€ stores/ # Zustand stores
โ”‚ โ”œโ”€โ”€ geometryStore.ts # Meshes and materials
โ”‚ โ”œโ”€โ”€ sceneStore.ts # Scene hierarchy
โ”‚ โ”œโ”€โ”€ selectionStore.ts # Selection state
โ”‚ โ””โ”€โ”€ viewportStore.ts # Camera and viewport
โ”œโ”€โ”€ types/ # TypeScript definitions
โ”‚ โ”œโ”€โ”€ geometry.ts # Core 3D types
โ”‚ โ””โ”€โ”€ t3d.ts # T3D format types
โ””โ”€โ”€ utils/ # Utilities
โ”œโ”€โ”€ geometry.ts # Math and geometry helpers
โ”œโ”€โ”€ t3dExporter.ts # T3D export functionality
โ””โ”€โ”€ t3dImporter.ts # T3D import functionality
```

## ๐ŸŽฎ Usage

### Getting Started

1. **Install dependencies**:
```bash
npm install
```

2. **Run development server**:
```bash
npm run dev
```

3. **Open in browser**: Navigate to `http://localhost:3000`

### Basic Workflow

1. **Create Demo Content**: Click "Create Demo Scene" to populate the scene
2. **Switch Modes**: Use Tab key to toggle between Object and Edit modes
3. **Select Elements**: Click objects/vertices/edges/faces based on current mode
4. **Export Scene**: Click "Export as .t3d" to save your work
5. **Import Scene**: Click "Import .t3d" to load a saved scene

### Keyboard Shortcuts

- **Tab**: Toggle between Object Mode and Edit Mode
- **1**: Switch to Vertex selection (Edit Mode)
- **2**: Switch to Edge selection (Edit Mode)
- **3**: Switch to Face selection (Edit Mode)
- **Alt+A** or **Esc**: Clear all selections

## ๐Ÿ“„ T3D File Format

The T3D format is a ZIP archive containing:

- `scene.json`: Complete scene data in JSON format
- `assets/`: Folder for textures and other assets (future)

### Key Features:
- **Versioned**: Semantic versioning for compatibility
- **Complete**: Preserves all scene data including IDs
- **Compressed**: ZIP compression for smaller files
- **Extensible**: Designed for future enhancements

See [T3D_FORMAT.md](./T3D_FORMAT.md) for detailed specification.

## ๐Ÿงช Testing

The project includes comprehensive testing tools:

- **T3D Test Suite**: Automated round-trip testing for export/import
- **Filter Tests**: Verify selective export functionality
- **Demo Content**: Sample scenes for testing

Run tests through the web interface or use the programmatic test suite.

## ๐Ÿ—๏ธ Development

### Architecture

The application follows a reactive architecture pattern:

1. **Stores**: Centralized state management with Zustand
2. **Components**: React components that subscribe to store changes
3. **Utilities**: Pure functions for calculations and data transformations
4. **Types**: Comprehensive TypeScript definitions

### Adding Features

1. **Define Types**: Add TypeScript definitions in `src/types/`
2. **Update Stores**: Extend Zustand stores with new state and actions
3. **Create Components**: Build React components that consume store data
4. **Add Utilities**: Implement pure functions for complex operations

### Code Style

- **Functional Components**: Use React function components with hooks
- **Immutable Updates**: All state changes use Immer for immutability
- **TypeScript**: Strict typing for all code
- **Modular**: Clear separation of concerns

## ๐Ÿšง Current Status

**Phase 1: Reactive Foundation** โœ…
- Core stores and data structures implemented
- Basic geometry creation and manipulation
- Selection system with dual modes
- Scene hierarchy management

**Phase 2: File System** โœ…
- T3D format design and implementation
- Export/import functionality
- Data integrity testing
- Browser-based file operations

**Phase 3: 3D Rendering** (Coming Soon)
- Three.js integration
- Real-time 3D viewport
- Material rendering
- Interactive 3D manipulators

## ๐Ÿค Contributing

1. Fork the repository
2. Create a feature branch
3. Make your changes
4. Add tests if applicable
5. Submit a pull request

## ๐Ÿ“ License

This project is in active development. License to be determined.

## ๐Ÿ”ฎ Roadmap

- [ ] 3D viewport with Three.js
- [ ] Interactive transformers and gizmos
- [ ] Advanced material system
- [ ] Animation timeline
- [ ] Plugin system
- [ ] Multi-user collaboration
- [ ] Cloud storage integration