Skip to content

Commit

Permalink
Merge pull request #5 from muonlineph/dev
Browse files Browse the repository at this point in the history
v3.0.0 merge from dev to master
  • Loading branch information
weaponsforge authored Mar 22, 2020
2 parents 85b9b77 + 7f6f7df commit 1ed6205
Show file tree
Hide file tree
Showing 47 changed files with 2,977 additions and 1,316 deletions.
39 changes: 36 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,12 +35,45 @@
4. Load the webgl json loader from
`http://localhost:3000`

5. Load the basic-usage object loader demo from
`http://localhost:3000/simple.html`



## Usage

1. Initialize a ThreeJS scene, camera and renderer. See `public/main.js` **init()** for more information.
2. Load ojbect model file(s) (.obj) and add to the ThreeJS scene.

### Model Viewer and Object Loader Usage

> This is the recommended usage for rendering object models as all Three.js scenes are already set-up in the **Viewer** object.
1. Include the required Three.js files in your website (from the **/public/js** directory):
`three.min.js`, `DDSLoader.js`, `MTLLoader.js`, `OBJLoader.js`.

2. Include the custom loader and model viewer (from the **/public** directory):
`loader.js`, `viewer.js`

3. Load your object model(s) using **async-await**, but do not add them to the scene. See [**Object Loader (Basic Usage)**, #2]() for more information.

let a = await loadModel(...)
let b = await loadModel(...)
let c = await loadModel(...)

4. Initialize a new **Viewer** object with the loaded models from #1 as parameters.
`const viewer = new Viewer([a, b, c])`


### Object Loader (Basic Usage)

1. Include the required Three.js files in your website (from the **/public/js** directory):
`three.min.js`, `DDSLoader.js`, `MTLLoader.js`, `OBJLoader.js`.

2. Include the custom loader and model viewer (from the **/public** directory):
`loader.js`, `simple.js`

3. Initialize a ThreeJS scene, camera and renderer. See `public/simple.js` **init()** for more information.

4. Load ojbect model file(s) (.obj) and add to the ThreeJS scene.

let staff = await loadModel('objects/staffofkundun/', 'kundun-OBJ.mtl', 'kundun-OBJ.obj', {
position: { y:10 },
Expand All @@ -49,7 +82,7 @@

scene.add(staff)

- see `public/loader.js` for more loading options
- see `public/loader.js` for more object loading options
- any number of object files can be loaded and added to the `scene`.


Expand Down
File renamed without changes.
File renamed without changes
File renamed without changes.
File renamed without changes.
Loading

0 comments on commit 1ed6205

Please sign in to comment.