Commit Graph
233 Commits
Author SHA1 Message Date
Mr.doob 047f190d4d Avoiding merge conflicts (I'm sure there is a way to handle these in this client, maybe not yet...) 2010-11-04 20:55:58 +00: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 fb4935d35b Trying to avoid merge conflicts :S 2010-11-02 19:38:04 +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 7c163bb9c1 In OBJ converter made smooth/flat shading configurable via command line parameter (-s smooth|flat). 2010-11-02 18:59:23 +01:00
alteredq 93c2ed9474 In OBJ converter added handling of cases where there are no materials specified in OBJ file (which is different from having null materials or no MTL file). 2010-11-02 12:02:37 +01:00
Mr.doob f30216ff8e Applying alteredq's CanvasRenderer fix re Ambient Light calculation to SVGRenderer. 2010-11-01 18:30:05 +00: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
alteredq 9d2aaf4e4c Synced with mrdoob's branch. 2010-11-01 13:12:18 +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 daf2700ccb * Projector.js: Rather than calculating the screen space centrium of each face per render, seemed smarter to just project the precomputed centrium. Side effect: Polygon shaking is gone \o/ 2010-10-31 02:31:14 +00:00
alteredq 8e31bbb165 Synced with mrdoob's branch. 2010-10-31 03:07:31 +01:00
Mr.doob 7f0a42cce8 Merge remote branch 'alteredq/master' 2010-10-31 02:05:05 +00:00
alteredq 8ea9f2d107 Merge remote branch 'remotes/upstream/master' 2010-10-31 03:04:31 +01:00
alteredq b22bd9da2e Added face culling to WebGLRenderer (default is now backface culling on, front face is counter-clockwise).
Thanks to mrdoob for noticing :)
2010-10-31 02:32:36 +01: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 5b1a64e747 * Matrix4.makeOrtho() fixed 2010-10-30 05:05:02 +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
Mr.doob 6f51ce7e8d * Trying to make the interaction stuff work... 2010-10-30 01:39:08 +01:00
Mr.doob d764c7980e Merge remote branch 'alteredq/master' 2010-10-29 16:40:43 +01:00
alteredq 129a128ec1 Cleaned up WebGLRenderer. Made Blinn-Phong shader work also in Firefox 4. 2010-10-29 13:35:31 +02:00
alteredq 45f7464793 Synced with mrdoob's branch. 2010-10-29 09:43:18 +02:00
Mr.doob 17641fed96 * Typo on point lights example link 2010-10-29 04:20:48 +01:00
Mr.doob 3e5fed7104 * .blend wasn't supposed to get in.... 2010-10-29 04:16:40 +01:00
Mr.doob 98693605e8 * Added point lights example 2010-10-29 04:15:00 +01:00
Mr.doob 4f1cb8f48f * Added point lights example 2010-10-29 04:00:11 +01:00
Mr.doob a0e9935a0f * Minor change to SVGRenderer 2010-10-28 21:48:32 +01:00
Mr.doob 1b1fb7affe * Code clean up (yuicompressor doesn't throw a single warning :D) and some reformating
* Minor fixes (Geometry normal calculation)
* Isolated Matrix3 code into `Matrix3.js`
* README and TODO updated
2010-10-28 21:27:58 +01:00
alteredq 79ab4bf2e6 Merged with mrdoob's branch. Got WebGLRenderer working again :)
Changed OBJ -> Three.js converter to use new materials system (eventual old models need to be reconverted).

Limitations:

  - one use case is now much slower
    - when a mesh has each face with different color (e.g. polyfield in examples/test.html)
    - before this used FaceColorFill material and in WebGLRenderer it was rendered fast with color attribute array
    - now when FaceColorFill material is gone, each face gets own VBO :(

  - material sorting uses Materials "toString" methods for hashing, so it's very important to keep these in a good shape
2010-10-28 19:35:13 +02:00
alteredq b6904f3d72 Added Blinn-Phong material for WebGLRenderer.
In Chrome it looks more or less ok, but it has some problem in Firefox 4 (with some camera angles there are black areas around edges).

Also updated Python builder scripts and examples to include this new material.
2010-10-27 21:16:11 +02:00
Mr.doob 71f96a5f1b Merge remote branch 'alteredq/master' 2010-10-27 17:50:40 +01:00
alteredq 5d7e32a3af Changed camera matrix update in WebGLRenderer to happen just once per frame, no need to do it with every object. 2010-10-27 10:27:59 +02:00
Mr.doob 7464f5ff97 * MeshBitmapUVMappingMaterial -> MeshBitmapMaterial. Second param is mode, which is THREE.MeshBitmapMaterialMode.UVMAPPING by default.
* Removed MeshFaceColorFillMaterial and MeshFaceColorStrokeMaterial
* Added MeshFaceMaterial ( it uses the face.material for that pass )
* CanvasRenderer and SVGRenderer per face material logic changed.
* SVGRenderer supports particles again.
* WebGLRenderer currently broken :/
* Code clean up
2010-10-27 08:49:00 +01:00
alteredq 87e0d754bd Premultiplied alpha in WebGLRenderer for MeshColorFillMaterial and MeshColorStrokeMaterial (to get closer to CanvasRenderer look). 2010-10-26 15:22:31 +02:00
alteredq 277d117b3d Refactored multimaterials to also work with non-textured models composed from multiple material groups.
Old version was doing massive overdraw (whole mesh was drawn for each material).

Even current solution is still quite messy: there is a different behavior for stroke and fill materials (when used as secondary materials).

Stroke materials are applied to the complete mesh (as most common use case seems to be wireframe) while fill materials now apply only to faces within single material group (when "decalIndex" property of secondary fill material is set).
2010-10-26 12:18:30 +02:00