Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Migrate to es module / es6 import #39

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
node_modules
*.vscode
.DS_Store
.idea
48 changes: 36 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,38 @@ The plugin was developed for [Tzina: A Symphony of Longing](https://tzina.space)

![DepthKit.js screencapture](https://raw.githubusercontent.com/juniorxsound/DepthKit.js/master/assets/gh/wire.gif)

Include ```depthkit.js``` or ```depthkit.min.js``` after loading ```three.js``` in your project.

Alternatively, if you use Node.js you can install the package with npm using ```npm install depthkit``` [npm package](https://www.npmjs.com/package/depthkit)
# Install

## Install via NPM

`npm i dephtkit` and then `import { DepthKit } from 'depthkit'`
See [npm package](https://www.npmjs.com/package/depthkit).

## Install from CDN - es module (es6)

```html
<!-- Import maps polyfill -->
<!-- Remove this when import maps will be widely supported -->
<script async src="https://unpkg.com/es-module-shims@1.3.6/dist/es-module-shims.js"></script>
<script type="importmap">
{
"imports": {
"three": "https://unpkg.com/three@0.147.0/build/three.module.js",
"three/": "https://unpkg.com/three@0.147.0/"
}
}
</script>
<script type="module">
import * as THREE from 'three'

//TODO be checked once published on npm
import { DepthKit } from 'https://cdn.jsdelivr.net/npm/depthkit@latest/src/depthkit.js'
// or
// TODO replace remmel by juniorxsound in PR - not recommended when published on npm
import { DepthKit } from 'https://cdn.jsdelivr.net/gh/remmel/Depthkit.js/src/depthkit.js'
//...
</script>
```

### Creating a character
```JavaScript
Expand Down Expand Up @@ -45,18 +74,13 @@ Calling ```new DepthKit()``` returns a three.js Object3D which has all the regul

[Mouse hover example](https://juniorxsound.github.io/Depthkit.js/examples/raycast.html)

[Simple webVR example](https://juniorxsound.github.io/Depthkit.js/examples/webvr_simple.html)

[Raycasting webVR example](https://juniorxsound.github.io/Depthkit.js/examples/webvr_raycast.html)
[Raycasting webVR example](https://juniorxsound.github.io/Depthkit.js/examples/webxr_raycast.html)

## How to contribute:
1. Fork/Clone/Download
1. Install all dependcies using ```npm install```
1. Use the following node commands:

```npm run start``` uses ```concurrently``` to start an ```http-server``` and to run ```watchify``` and bundle on every change to ```build/depthkit.js```

```npm run build``` to bundle and minify to ```build/depthkit.min.js```
1. Install all dependencies using `npm install`
1. Start http server : `npm run start`
1. Open http://localhost:8080/examples/simple.html

## Thanks
Originally written by [@mrdoob](https://github.com/mrdoob) and [@obviousjim](https://github.com/obviousjim) ported and modified by [@juniorxsound](https://github.com/juniorxsound) and [@avnerus](https://github.com/Avnerus). Special thank you to [Shirin Anlen](https://github.com/ShirinStar) and all the Tzina crew, [@ZEEEVE](https://github.com/zivschneider), [@jhclaura](https://github.com/jhclaura)
379 changes: 0 additions & 379 deletions build/depthkit.js

This file was deleted.

1 change: 0 additions & 1 deletion build/depthkit.min.js

This file was deleted.

3 changes: 1 addition & 2 deletions examples/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,7 @@

- [**Simple**](https://github.com/juniorxsound/DepthKit.js/blob/master/examples/simple.html) - a simple Three.js scene with one DepthKit character in it
- [**Raycast**](https://github.com/juniorxsound/DepthKit.js/blob/master/examples/raycast.html) - a Three.js scene using a ```THREE.Raycaster``` attached to the mouse position to start and pause the character
- [**WebVR Simple**](https://github.com/juniorxsound/DepthKit.js/blob/master/examples/webvr_simple.html) - a simple Three.js scene using the WebVR API to enable rendering on VR headsets.
- [**WebVR Raycast**](https://github.com/juniorxsound/DepthKit.js/blob/master/examples/webvr_raycast.html) - a Three.js scene using the WebVR API to enable rendering on VR headsets. ```THREE.Raycaster``` attached to the direction the user is looking at for enabling "gaze-to-play"
- [**WebVR Raycast**](https://github.com/juniorxsound/DepthKit.js/blob/master/examples/webxr_raycast.html) - a Three.js scene using the WebVR API to enable rendering on VR headsets. ```THREE.Raycaster``` attached to the direction the user is looking at for enabling "gaze-to-play"

**Notes:**
- Please note that since Chromium for WebVR doesn't support ```.mp4``` playback the video needs to be converted into ```.webm```
Expand Down
Loading