983 Commits
Author SHA1 Message Date
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
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 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 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 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
alteredq 1de8e6fd2a Disabled point light, now that it works also in WebGL, not to have red people :). 2010-10-24 19:34:03 +02:00
alteredq ca261ddca5 Added point light / fixed directional light in WebGLRenderer / added light test example.
Changed WebGLRenderer to use 3x3 normal matrix.

Limitations of WebGL lights:

- currently handles only single one of each ambient/directional/point light
- light intensity modifier not yet taken into account
- only diffuse term (this applies also in CanvasRenderer)
2010-10-24 18:52:42 +02:00
alteredq ecae266e8a Added mesh stroke materials (wireframe) to WebGLRenderer.
Added multipass multimaterials to WebGLRenderer.

Refactored WebGLRenderer shader to become proto-mini-ubershader (untershader :).

Line width is currently not set properly on Chrome in Windows:

http://code.google.com/p/chromium/issues/detail?id=60124
2010-10-22 02:46:56 +02:00
alteredq ce000d482f Merged remote branch 'upstream/master' (original mrdoob's version) 2010-10-21 02:00:52 +02:00
alteredq dde831bf6f Extended CanvasRenderer to be able to handle decals (MeshBitmapUVMappingMaterials as secondary materials).
For decals you need to set "decalIndex" property of the material (corresponding to materials index of the original mesh UV material).

Added multimaterials example.

Fixed forgotten sphere smoothing in OBJ converter example.
2010-10-21 01:38:29 +02:00
alteredq 36dc7212f8 Made Sphere mesh smoothing optional. 2010-10-21 01:17:58 +02:00
Mr.doob db7003e88a * CanvasRenderer and SVGRenderer calculating light only when needed. 2010-10-20 05:14:45 +01:00
alteredq 396d8d1cec Added male model to OBJ converter example. 2010-10-18 14:19:39 +02:00
unknown 60c2354424 Added OBJ -> Three.js converter.
Added OBJ converter test example.

Modified Three.js to handle converted models:

 - extended WebGL renderer to use texturing
   - broke down model into multiple VBOs according to materials
   - textures are lazy created when images get loaded
     (converter takes care of resizing images to nearest power of 2
      dimensions using 2d canvas)

 - changed material array semantics in Mesh object
    - before: multiple materials were applied to all faces (broken in WebGL, needs multitexturing shader)
    - now: there is only single material per face, but one mesh can have faces with different materials

 - added per vertex normals (to get smooth shading in WebGL)
2010-10-18 11:33:32 +02:00
Mr.doob 647b4a57b8 * Added PointLight
* `CanvasRenderer` and `SVGRenderer` basic lighting support (`*ColorStroke`/`*ColorFill` only)
* `Renderer` > `Projector`. `CanvasRenderer`, `SVGRenderer` and `DOMRenderer` do not extend anymore
* Interactivity base code (hdi folder). To be refactored... ([mindlapse](http://github.com/mindlapse))
* Added `computeCentroids` method to `Geometry`
* Included `Stats.js` directly in the `/examples` folder to avoid the need of internet for playing around
2010-10-06 03:36:21 +01:00
mindlapseandMr.doob a89865bda8 3d onclick, see examples/hci_clickcube.html 2010-09-30 23:11:29 +08:00
Mr.doob e68109fdb2 - Clean up 2010-09-17 02:52:29 +01:00
Nicolas Garcia BelmonteandMr.doob 10681d6684 * Bug Fix: Matrix4.makeInvert was calling a non existent scale method. Replaced with multiplyScalar.
* Bug Fix: DirectionalLight wasn't normalizing the direction vector.
 * Added lights to the scene for test.html
2010-09-09 18:47:39 +08:00
Nicolas Garcia BelmonteandMr.doob a319fe3c7b Added a clone of the geometry_cube example working with the WebGL renderer. 2010-09-03 20:54:55 +08:00
Mr.doob 216b4eeee2 * Workaround for Opera bug (clearRect not working with context with negative scale)
* Additional `Matrix4` and `Vector3` methods
2010-08-21 02:58:07 +01:00
Mr.doob 680000c289 - Forgot the stats.js > Stats.js change in some examples... 2010-07-25 18:44:47 +01:00
Mr.doob 9c796ce6ae - Of course, all examples had to point to the renamed file... 2010-07-25 03:51:23 +01:00
Mr.doob 5fe1f2a6d1 - ParticleBitmapMaterial.offset clearRect fixed
- Face4 with MeshBitmapMaterial gap fixed
2010-07-23 20:19:16 +01:00
Mr.doob 217b1505a3 - Added ParticleBitmapMaterial.offset (Vector2) 2010-07-22 08:10:04 +01:00
Mr.doob fbbb78446d - Shadow texture for Earth demo 2010-07-19 13:34:49 +01:00
Mr.doob 2dfcf24e02 - Improved earth demo 2010-07-19 13:34:19 +01:00
Mr.doob a7bed157a3 - Added Sphere primitive
- `three_debug.js` checks for broken UVs and display these faces with pink color instead
2010-07-19 13:23:06 +01:00
Mr.doob b381202910 * Using new object UV instead of Vector2 where it should be used 2010-07-17 14:52:39 +01:00
Mr.doob 8f543db16d * Refactored CanvasRenderer (more duplicated code, but easier to handle)
* `Face4` now supports `MeshBitmapUVMappingMaterial`
* Changed order of `*StrokeMaterial` parameters. Now it's `color`, `opacity`, `lineWidth`.
* `BitmapUVMappingMaterial` > `MeshBitmapUVMappingMaterial`
* `ColorFillMaterial` > `MeshColorFillMaterial`
* `ColorStrokeMaterial` > `MeshColorStrokeMaterial`
* `FaceColorFillMaterial` > `MeshFaceColorFillMaterial`
* `FaceColorStrokeMaterial` > `MeshFaceColorStrokeMaterial`
* `ColorStrokeMaterial` > `LineColorMaterial`
* `Rectangle.instersects` returned false with rectangles with 0px witdh or height
2010-07-17 00:25:50 +01:00
Mr.doob 8e5c8debf9 - Clean up 2010-07-14 14:10:47 +01:00
philogbandMr.doob f0f3483f91 Remove useless alert. 2010-07-14 20:58:35 +08:00
philogbandMr.doob 2b0ea54a4c Core performance improvements through shared props
Old Vector and Matrix constructor functions would create all methods and
make assignments with each call. A lot of speed-ups can be made by using
shared properties through the prototype chain. Since methods and
initialized properties are shared among all instances they're only
created once.

Some tests can be seen at examples/performance-test.html

Some results:

    Chrome

    //6.4 times faster
    performance-test.html:25 Vector2 x 5000000: 213ms
    performance-test.html:30 Vector2Orig x 5000000: 1366ms

    //8.3 times faster
    performance-test.html:37 Vector3 x 5000000: 241ms
    performance-test.html:42 Vector3Orig x 5000000: 2015ms

    //3.8 times faster
    performance-test.html:49 Vector4 x 5000000: 278ms
    performance-test.html:54 Vector4Orig x 5000000: 1059ms

    //7.5 times faster
    performance-test.html:61 Matrix4 x 5000000: 937ms
    performance-test.html:66 Matrix4Orig x 5000000: 7004ms

    Firefox

    //6.8 times faster
    Vector2 x 50000: 45ms
    Vector2Orig x 50000: 307ms

    //11.5 times faster
    Vector3 x 50000: 48ms
    Vector3Orig x 50000: 550ms

    //3.8 times faster
    Vector4 x 50000: 61ms
    Vector4Orig x 50000: 234ms

    //9.4 times faster
    Matrix4 x 50000: 199ms
    Matrix4Orig x 50000: 1878ms

where "Orig" are old versions of the objects.

Running these tests multiple times can yeild different results due to
browser cache. However the results are always kind of similar in terms
of speedup.
2010-07-14 20:58:22 +08:00
Mr.doob 5268aeb0c9 - Blender Exporter: Using filename instead of object name for classname (easier to use that way) 2010-07-13 19:57:44 +01:00
Mr.doob 418a1bc287 * Added ParticleCircleMaterial and ParticleBitmapMaterial
* `Particle` now use `ParticleCircleMaterial` instead of `ColorFillMaterial`
* `Particle.size` > `Particle.scale.x` and `Particle.scale.y`
* `SVGRenderer` currently out of sync
2010-07-12 14:40:54 +01:00
Mr.doob 7b385cf7a8 - First version of the WebGLRenderer (ColorFillMaterial and FaceColorFillMaterial by now)
- Matrix4.lookAt fix (CanvasRenderer and SVGRenderer now handle the -Y)
- Color class now using 0-1 floats instead of 0-255 integers
2010-07-07 02:35:27 +01:00
Mr.doob b0b3d9644a - Small camera tweaks 2010-06-22 23:20:48 +01:00
Mr.doob 7935bc8ab9 - Changed Camera system. (Thx [Paul Brunt](http://github.com/supereggbert))
- Object3D.overdraw = true to enable CanvasRenderer screen space point expansion hack.
2010-06-22 22:31:48 +01:00
Mr.doob 2a3d1e35cb * autoClear property for renderers.
* Removed SVG rgba() workaround for WebKit. (WebKit now supports it);
2010-06-20 19:59:36 +01:00
Mr.doob 0aac038d58 - JSLinted 2010-06-19 18:13:00 +01:00
Mr.doob bdd2d95269 - Tweaks on Terrain demo 2010-06-14 01:58:39 +01:00
Mr.doob 26412389ae - Improved Terrain Generator demo. 2010-06-13 21:30:20 +01:00
Mr.doob 2cd123401a - Added codecs metadata on video demo.
- Added terrain demo.
2010-06-13 07:29:51 +01:00
Mr.doob 3755d003f0 - Using .ogv instead of .ogg for clarity. Although it gives mime-type issues... 2010-06-12 00:32:12 +01:00
Mr.doob ecdf342361 - Added support to Theora only browsers on the materials_video example. 2010-06-11 18:57:10 +01:00