Skip to content

Client 3D application powered by Three.js and Vue 3

Notifications You must be signed in to change notification settings

ebbesand123/vue-d

Repository files navigation

vue-d

vue-d

Beta build showcase: ebbesand123.github.io

vue-d is a client application which shows a controllable 3D scene. It is heavily inspired by 'Discover Three.js'.

The project consists of 3 main parts:

  • src/client: Vue 3 application
    • Single file component format. (SFC)
    • Script setup with TypeScript <script setup lang="ts">
    • State management with Pinia
    • Naive UI for UI components
  • src/world: World class which implements Three.js functionality
  • src/server: Simple server

Commands

> npm run build          # build client
> npm run serve          # serve local build
> npm run dev            # run client dev server
> npm run test:unit      # run unit tests
> npm run test:coverage  # show test coverage
> npm run lint run       # linter with auto fix
> npm run format         # prettier code
> npm run typecheck      # check typing

Local development

VSCode + Volar (and disable Vetur) + TypeScript Vue Plugin (Volar).

Type Support for .vue Imports in TS

TypeScript cannot handle type information for .vue imports by default, so we replace the tsc CLI with vue-tsc for type checking. In editors, we need TypeScript Vue Plugin (Volar) to make the TypeScript language service aware of .vue types.

If the standalone TypeScript plugin doesn't feel fast enough to you, Volar has also implemented a Take Over Mode that is more performant. You can enable it by the following steps:

  1. Disable the built-in TypeScript Extension
    1. Run Extensions: Show Built-in Extensions from VSCode's command palette
    2. Find TypeScript and JavaScript Language Features, right click and select Disable (Workspace)
  2. Reload the VSCode window by running Developer: Reload Window from the command palette.

Extend VSCode with ESLint and Prettier

Plugins: ESLint + Prettier

Add following options to your VSCode settings.json to enable on save formatting.

{
  "editor.formatOnSave": true,
  "editor.codeActionsOnSave": {
    "source.fixAll.eslint": true
  },
  "[vue]": {
    "editor.defaultFormatter": "esbenp.prettier-vscode"
  },
  "[javascript]": {
    "editor.defaultFormatter": "esbenp.prettier-vscode"
  }
}

Backlog

  • Render scene with platonic shapes
  • Basic scene, camera and shape controls
  • optimize mobile UX
  • Save and import scene
  • Light controls
  • Add shapes UI
  • Add missing tests
  • Internationalization