Skip to content

Commit 6355466

Browse files
authored
Merge pull request #113 from vidartf/buffer_geom
Buffer attributes/geometry
2 parents 21a8e47 + 4922270 commit 6355466

35 files changed

+1487
-830
lines changed

README.md

Lines changed: 38 additions & 54 deletions
Original file line numberDiff line numberDiff line change
@@ -1,44 +1,68 @@
1-
pythreejs
2-
=========
1+
# pythreejs
32

4-
This is a _significant_ re-work of the pythreejs extension that introduces an "autogen" script that generates the majority of the ipython-widget code to wrap each of three.js's types. It also takes a different view towards the pythreejs API. Whereas pythreejs adds custom functionality to the classes, sometimes renaming, etc., this approach attempts to mimic the low-level three.js API as closely as possible, opening up the possibility for others to build utility libraries on top of this.
53

6-
This branch does not support all the functionality of the current pythreejs, but it is a significant step forward in terms of the potential to support the majority of three.js's features. Currently supported features:
7-
- Basic building blocks of a scene:
8-
- Textures (both Image-based and Data-based)
9-
- Materials
10-
- Geometries
11-
- Meshs
12-
- Scene, Lights, Cameras, WebGLRenderer
4+
## Getting Started
5+
6+
### Try it online with [Binder](http://mybinder.org/)
7+
8+
[![Binder](http://mybinder.org/badge.svg)](http://mybinder.org:/repo/jovyan/pythreejs/notebooks/examples)
9+
10+
### Installation
11+
12+
Using pip:
13+
14+
```bash
15+
pip install pythreejs
16+
jupyter nbextension install --py --symlink --sys-prefix pythreejs
17+
jupyter nbextension enable --py --sys-prefix pythreejs
18+
```
19+
20+
Note for developers: the `--symlink` argument on Linux or OS X allows one to
21+
modify the JavaScript code in-place. This feature is not available
22+
with Windows.
23+
24+
Using conda
25+
26+
```bash
27+
conda install -c conda-forge pythreejs
28+
```
29+
1330

14-
---
31+
## Developers
32+
33+
### Autogen
34+
35+
This is a _significant_ re-work of the pythreejs extension that introduces an "autogen" script that generates the majority of the ipython-widget code to wrap each of three.js's types. It also takes a different view towards the pythreejs API. Whereas pythreejs adds custom functionality to the classes, sometimes renaming, etc., this approach attempts to mimic the low-level three.js API as closely as possible, opening up the possibility for others to build utility libraries on top of this.
1536

1637
The autogen script, `generate-wrappers.js`, takes advantage of a config file `three-class-config.js` to auto-generate both javascript and python files to define the ipywidget wrappers for each three.js class. The generated javascript files will have `.autogen.js` as the extension. The generated python files have `_autogen.py` as their extension. The script uses the handlebars template system to generate the various code files.
1738

1839
The autogen solution allows for overriding the default behavior of the generated classes. E.g., if `Object3D.js` is present, then it will be loaded into the namespace as opposed to loading `Object3D.autogen.js`. It is up to the author of the override classe to decide whether to inherit behavior from the autogen class or not. Same goes for the python modules. This allows for writing custom methods on both the python and javascript side when needed.
1940

2041
The autogen script relies on a json-like config file (`three-class-config.js`) to describe the classes. Reasonable defaults should take care of most, but it allows specifying the base class, constructor args, etc. for each of the wrappers. A base version of this file can be generated by `generate-class-config.js`, but beware, it overwrites any customization to the config file that has already been done.
2142

22-
## Setup
43+
#### Setup
2344

24-
```
45+
```bash
2546
# Initial setup
2647
cd js
2748
npm install
2849

2950
# Generate files
3051
npm run autogen
52+
pip install -e .
3153

3254
# Build distribution files
3355
npm run build
56+
jupyter nbextension install --py --symlink --sys-prefix pythreejs
3457

3558
# Clean out generated files
3659
npm run clean
60+
3761
```
3862

3963
List of relevant files:
4064

41-
```
65+
```bash
4266
js/package.json
4367
js/webpack.config.js
4468

@@ -92,43 +116,3 @@ js/src/examples/controls/TrackballControls.js
92116
js/src/examples/renderers/CanvasRenderer.js
93117
js/src/examples/renderers/Projector.js
94118
```
95-
96-
97-
TODO: Everything below here is probably outdated.
98-
99-
Getting Started
100-
---------------
101-
102-
### Try it online with [Binder](http://mybinder.org/)
103-
104-
[![Binder](http://mybinder.org/badge.svg)](http://mybinder.org:/repo/jovyan/pythreejs/notebooks/examples)
105-
106-
Installation
107-
------------
108-
109-
Using pip:
110-
111-
```
112-
pip install pythreejs
113-
jupyter nbextension enable --py --sys-prefix pythreejs
114-
```
115-
116-
Using conda
117-
118-
```
119-
$ conda install -c conda-forge pythreejs
120-
```
121-
122-
For a development installation (requires npm):
123-
124-
```
125-
$ git clone https://github.com/jovyan/pythreejs.git
126-
$ cd pythreejs
127-
$ pip install -e .
128-
$ jupyter nbextension install --py --symlink --sys-prefix pythreejs
129-
$ jupyter nbextension enable --py --sys-prefix pythreejs
130-
```
131-
132-
Note for developers: the `--symlink` argument on Linux or OS X allows one to
133-
modify the JavaScript code in-place. This feature is not available
134-
with Windows.

0 commit comments

Comments
 (0)