983 Commits
Author SHA1 Message Date
alteredq b09308c238 Synced with mrdoob's materials branch.
Have to commit broken build (missing MeshDepthMaterial.js) as git doesn't want to proceed with new merge till the old one is not committed :(
2010-11-15 02:54:42 +01:00
alteredq bfb8242928 WebGLRenderer also working.
Not all features from the new material format are implemented yet, though already now it's more powerful than the old format (you can now use  texture also in Basic and Phong materials).

Also started to retire old model format: removed old OBJ converter and meshes that it generated.

TODO:
 - take into account shading and blending parameters
 - transplant cube map support from experimental material
2010-11-15 02:29:03 +01:00
Mr.doob 98dc841aab Added MeshDepthMaterial.
Optimised Particles projection in CanvasRenderer.
2010-11-15 01:17:41 +00:00
Mr.doob 64df690cc0 SVGRenderer also working. 2010-11-13 08:20:35 +00:00
Mr.doob 22f48a731b CanvasRenderer handles textures again.
Most of the examples working.
2010-11-13 07:11:57 +00:00
Mr.doob 237f165555 ParticleCircleMaterial working again with CanvasRenderer 2010-11-13 03:42:13 +00:00
Mr.doob ce3d641ff2 Changed materials format a bit.
Almost done porting CanvasRenderer to the new material system (plus some performance gains on the way :D)
`Color` now handles hex with no alpha byte (probably there is a nicer way of doing it...)
2010-11-13 02:39:27 +00:00
alteredq 7ce3b0f7d2 Experimenting with different syntax for materials (just hex instead of THREE.Color in API), checking how it feels with shaders example. 2010-11-12 18:10:28 +01:00
alteredq c31cb220e3 Renamed examples: shader_test -> materials_shaders, materials_test -> materials_multimaterials 2010-11-12 15:57:07 +01:00
Mr.doob a35b35fde9 * examples/geometry/primitivessrc/extras/primitives
* THREE.Rectangle: `_x1`, ` _x2`, `_y1`, `_y2` ⟶ `_left`, `_right`, `_top`, `_bottom`
2010-11-12 04:02:30 +00:00
alteredq 7c26e04c7a Refactored common functionality out of ascii and binary loaders. 2010-11-09 02:19:34 +01:00
alteredq a0fa2ae3dd Optimized binary model format to use indexed UVs. Updated OBJ slim converter and Loader accordingly.
This saves about 10% from size of textured binary models.
2010-11-08 23:20:25 +01:00
alteredq 188f36be5d Optimized ASCII model format to use indexed UVs. Updated OBJ slim converter and Loader accordingly.
This saves ~22% from size of textured ASCII models.

TODO: make the same for binary model format.
2010-11-08 18:10:43 +01:00
alteredq 7abad40d83 Merge remote branch 'remotes/sole/master' 2010-11-06 19:23:28 +01:00
alteredq 514a2e6135 Merged with latest changes in mrdoob's branch. All hex colors should be now without baked opacity. 2010-11-06 18:59:03 +01:00
alteredq 0cb79310e5 Added experimental binary mesh loader. Updated OBJ converter and examples accordingly.
If you want to use binary format, convert OBJ models using "convert_obj_threejs_slim.py" with "-t binary" option.

This will now create two files:
    JS part with materials
    BIN part with binary buffers

Binary models are loaded like this:

loader.loadBinary( 'obj/lucy/Lucy250k_bin.js', function( geometry ) { createScene( geometry, s ) }, "obj/lucy" );

(difference to ascii format is that url root must be always specified so loader can find binary buffers file, like it already was for textures)

Good news:

- raw binary files are quite smaller than raw ascii files (about half size)
- loading times went down about 20-25%
- now also Firefox can handle 250k triangle mesh (it just bugs about long running script), with ascii format it threw "array initialiser too large" exception

Mixed news:

- gzipped binary files are only about 25% smaller than gzipped ascii files so actual benefits are smaller,
  also it's more likely server will have JS gzipping on by default, while you need to set it up for
  other formats (could be hacked around by naming binary files with JS extension instead of BIN?)

Bad news:

- browser blocking is back :( Not that it ever went completely away (for large models object creation is more costly than loading and it is blocking), but it was slightly better with ascii loader (where data is loaded as worker's JS body).

    - this comes from having to use Ajax to load binary data
    - loading binary data by Ajax from within worker didn't really help, it was in fact slightly slower and browser did freeze :(
    - can't easily embed binary data in JSON (would need to encode it which would make it bigger, defying the purpose)

- Loader got fatter

Also in this commit: renamed Loader.loadAsync() => Loader.loadAsciiOld() and Loader.loadWorker() = Loader.loadAscii() so that names correspond to model formats instead of underlying implementation.

loadAsciiOld - JS exported by Blender and old OBJ converter
loadAscii    - JSON created by slim OBJ converter (-t ascii)
loadBinary   - JSON + BIN created by slim OBJ converter (-t binary)

TODO:

 - look into UV coordinates, should be indexed the same way as vertices, normals and faces are (instead of unrolled per each face)
 - look into HTML5 File API, binary blobs could help
2010-11-06 17:24:58 +01:00
Mr.doob 3cdc007b90 * Fixed some minor issues handling opacity in hex colors 2010-11-06 12:51:09 +00:00
Mr.doob 1849e9050c * Added a nicer interactivity example ⟶ examples/interactive_voxelpainter.html 2010-11-05 06:00:09 +00:00
sole bf6db5a714 merging? 2010-11-05 00:41:20 +00:00
Mr.doob 52045b53cb * examples/geometry_large_mesh.html: credit were credit is due :) 2010-11-05 00:26:33 +00:00
Mr.doobandsole 0ca8efd916 Fixed stats 2010-11-05 08:26:17 +08:00
alteredq c437ce68fe Small clarifications in large mesh example description: model size meanwhile went down to 3.5 MB ;) and file access flag applies to Chrome. 2010-11-05 00:33:24 +01:00
alteredq f6e829ca21 Synced with mrdoob's branch. 2010-11-05 00:25:03 +01:00
Mr.doob 55c40d0fa3 * Renamed examples/large_mesh_test.html to examples/geometry_large_mesh.html
* Added the first WebGL example to README \:D/
2010-11-04 22:29:38 +00:00
Mr.doob 5053cc4e6d * Added 2 more examples to the README.
* Cleaned interactive_cubes example code.
2010-11-04 21:59:42 +00:00
Mr.doob 83690551a3 Added a comment on example/large_mesh_test.html about the --allow-file-access-from-files bit. 2010-11-04 21:08:59 +00:00
Mr.doob 425c01111b Merge remote branch 'alteredq/master' 2010-11-04 20:57:29 +00:00
alteredq 49d1bd170b Made JSON model format slimmer by flattening arrays. Modified Loader and OBJ converter accordingly.
This is a first step towards eventual binary model format.
2010-11-04 21:18:08 +01:00
Mr.doob 8d198002d1 * Fixed a bug in Ray.intersectObject: face.normal needs to be transformed using matrixRotation otherwise rotated objects fail
* A bit nicer example
2010-11-04 20:11:37 +00:00
Mr.doob 9a62d1173a Refactored ClickResolver to Ray and Projector.unprojectVector` working.
Unimpressive example added `interactive_spheres.html`
2010-11-04 03:35:08 +00:00
alteredq 5192428f25 Added Loader class providing both asynchronous JS and web worker based loading of models.
The idea is that later there will be more loaders which would load different formats (like OBJLoader, ColladaLoader).

Usage (async JS):

var loader = new THREE.Loader();
loader.loadAsync( "obj/torus/Torus.js", function() { createScene( new Torus() ) } );

Usage (web worker):

var loader = new THREE.Loader();
loader.loadWorker( "obj/torus/Torus_slim.js", function( geometry ) { createScene( geometry ) } );

Web worker loader is useful for large meshes, where it allows browser to stay responsive for longer time and also it can handle larger meshes than async JS loader.

Web worker loader needs a simpler format of the model. Web workers can communicate with the main application only via message passing, where messages are JSON objects.

There is a new version of OBJ -> Three.js converter (convert_obj_threejs_slim.py) which can produce model in format needed for web workers.

All examples which were using models from OBJ converter were refactored to use Loader.

Except large mesh example, all examples are using just async JS loading. Web worker loading is there, it's just commented out, as it's a bit pain for local development.

Chrome doesn't allow to run web workers from pages accessed via file://, so you need either to run it with "--allow-file-access-from-files" flag, or access examples via local server (http://localhost/example.html).
2010-11-03 18:12:31 +01:00
Mr.doob 8cb2f9e2a1 Merge remote branch 'alteredq/master' 2010-11-02 19:38:30 +00:00
Mr.doob b57169bc84 Projector.unprojectVector() apparently working
Work in progress refactoring ClickResolver.js to Ray.js
2010-11-02 19:27:31 +00:00
alteredq 88c5d3e571 Forgot to build one-file version and to bump up version number. 2010-11-02 19:28:53 +01:00
alteredq 2b1f0a9b97 Added Lucy model (100k triangles version). The example using it already went to previous commit. 2010-11-02 19:15:26 +01:00
alteredq 406063d588 Added breaking of mesh into chunks of max 64K vertices (done in materials sorting step). 2010-11-02 19:12:05 +01:00
alteredq 1fae823482 Quick and dirty fix for OBJ converter demo: don't do backface culling to get back floor mesh that disappeared (turning it upside down gets ugly lighting). 2010-11-02 19:07:37 +01:00
alteredq a8ff77e1d4 Fixed ambient light computation in CanvasRenderer to get correct lighting when there is no ambient light specified in the scene. 2010-11-01 13:47:10 +01:00
Mr.doob a919753328 * Clickresolver.js: Implemented blackpawn's point in triangle algos ( http://www.blackpawn.com/texts/pointinpoly/default.html ). Now works properly with Face3 too. 2010-11-01 11:13:52 +00:00
Mr.doob 8eb356db40 Now we just need to make sure geometry.computeCentroids() is called at the end of creating/modifying the geometry, otherwise things break... 2010-10-31 02:49:14 +00:00
Mr.doob 7f0a42cce8 Merge remote branch 'alteredq/master' 2010-10-31 02:05:05 +00:00
alteredq f32fc45541 Added WebGL version of pointlights example (including Walt's head mesh with vertex normals). 2010-10-31 01:46:20 +02:00
Mr.doob cf58088c23 Merge remote branch 'alteredq/master' 2010-10-31 00:44:47 +01:00
alteredq b150a74755 Synced with mrdoob's branch. 2010-10-31 01:40:25 +02:00
Mark DiMarco 705a0ab687 updated examples to call scene.add instead of scene.addObject 2010-10-30 18:18:37 -05:00
alteredq 1c35d90fd7 Added handling of multiple lights to WebGLRenderer.
Limitations:

 - Chrome can handle up to 5 lights in total (directional + point)
 - Firefox seems to handle up to 29 lights

These number are GPU specific (mine is ATI Mobility Radeon 3650).

This turned out to be quite tricky. The number of varying vectors in shaders is limited. Additionally Chrome and Firefox have different limitations (at least on Windows, probably due to Chrome using ANGLE as rendering backend).

Hence WebGLRenderer has hardcoded limit of maximum 5 lights.

WebGLRenderer constructor now takes (optional) scene argument, so that numbers and types of lights present in the scene can be used to generate minimal possible shader.

If no scene is passed, shader allowing 1 directional + 4 point lights will be generated.
2010-10-31 00:45:04 +02:00
Mr.doob 05ba1a2b1c * Nicer looking orthographic projection example. 2010-10-30 19:18:01 +01:00
Mr.doob 8ee8c9baf9 * three.js: Fixed terrain example (was still using Scene.add()) 2010-10-30 05:19:44 +01:00
Mr.doob 7eacf2ae0e * Fixed Matrix4.makeOrtho(). bottom - top -> top - bottom
* Added `camera_orthographic` example.
2010-10-30 05:00:42 +01:00
Mr.doob c0d14df4a8 * Fixed examples that were still using scene.add() 2010-10-30 04:11:41 +01:00