Skip to content

Commit 8af53a6

Browse files
authored
Update README.md
Added example usage and further information.
1 parent a7cafb4 commit 8af53a6

File tree

1 file changed

+27
-2
lines changed

1 file changed

+27
-2
lines changed

README.md

Lines changed: 27 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,27 @@
1-
# bom-three.js
2-
BOMLoader for three.js
1+
# bom-three.js (THREE.BOMLoader)
2+
A javascript library to import BOM (Binary Object/Material) files into three.js. Loaded assets will be output as a THREE.Mesh
3+
consisting of THREE.BufferGeometry and an associated THREE.Material. Multi-material assets may be split into multiple THREE.Mesh objects, per material.
4+
5+
## Usage
6+
Include the loader library in your project:
7+
```html
8+
<script src="https://cdn.rawgit.com/NGenesis/bom-three.js/v0.3/examples/js/loaders/BOMLoader.min.js"></script>
9+
```
10+
11+
Then create an instance of BOMLoader and specify the file path to load:
12+
### Javascript
13+
```javascript
14+
var filePath = 'https://example.com/path/to/file.bom';
15+
16+
var loader = new THREE.BOMLoader();
17+
//loader.setDebug(true); // Output verbose debugging information (Disabled/false by default)
18+
//loader.setPerfTimer(true); // Output loader performance timer information (Disabled/false by default)
19+
loader.setTexturePath(filePath.split('/').slice(0, -1).join('/') + '/'); // Specify base texture path
20+
21+
loader.load(filePath, function(obj) {
22+
scene.add(obj); // Add object to scene once loaded.
23+
});
24+
```
25+
26+
## See also
27+
[obj2bom](https://github.com/NGenesis/bom-obj2bom) - A command line tool to convert OBJ and associated MTL files to BOM (Binary Object/Material) file format.

0 commit comments

Comments
 (0)