2431 Commits
Author SHA1 Message Date
Mr.doob 251a7d53b8 Figured out why Canvas/SVG wasn't rendering... someone changed camera.near/far to camera.zNear/zFar :P 2011-02-20 03:09:23 +00:00
alteredq 3ecde220d4 Simplified requestAnimationFrame handling (thanks to greggman).
Still with weird error reports in Firefox (though it work despites them).
2011-02-20 01:05:25 +01:00
alteredq 9c2b5c257c Added MiscUtils with THREE.requestAnimationFrame.
This is lifted from greggman's ThreeD http://code.google.com/p/threedlibrary/

Also modified ribbons example to show how to use this.
2011-02-19 18:21:03 +01:00
alteredq e151ff394b Added Ribbon object.
It provides a lean way how to render TRIANGLE_STRIP primitives: needs just n+2 vertices for n triangles (one Ribbon = one strip). There are no faces, no indices, everything is rendered in one simple drawArray call.

Vertex colors are supported, normals not yet.
2011-02-19 16:21:23 +01:00
alteredq 313ce3ed94 More refactoring and optimizations.
- removed unnecessary normal matrix computation in hierarchies (this is already done in renderer)
- removed unnecessary enabling of attribute arrays in every frame (it's enough to do it when shader program is created)
- depth test is now only set if it changed
2011-02-18 17:03:41 +01:00
alteredq 2ecbe2dec2 A lot of bugfixing and refactoring.
- getters/setters are no more in Vector3
  - object hierarchies thus don't use "isDirty"
  - this was completely killing performance for anything that was touching a lot of Vector3 like creation of meshes and dynamic buffers
  - even without this, performance of hierarchies went up (a lot)

- objects do not get passed renderer anymore
  - camera was almost also removed, but this is useful for LOD (though there may be some cleaner way to do this?)

- material ids are now unified, this makes "geometry.sortFacesByMaterial" faster (thus scene init / GUI blocking is shorter)

- all WebGL examples should work now (render-to-texture has weird lights and in some camera control feels different)

- CanvasRender still broken, despite many efforts :(
   - currently only points and lines work, faces don't show up. I think this may need assistance from mrdoob.
2011-02-18 00:31:08 +01:00
Antonin Hildebrand d65ef66aa7 add THREE.ReverseSubtractiveBlending 2011-02-17 22:24:10 +01:00
alteredq afbace2801 Cleaning up to make it pass through Closure compiler.
We have been very lucky - setters / getters were not supported till just 2 hours ago (so fresh, I had to build Closure myself from their repo ;).

http://code.google.com/p/closure-compiler/issues/detail?id=249

Also some refactoring plus added hackish animation offset feature.
2011-02-17 05:10:30 +01:00
alteredq a3cdbf661e Extended basic / lambert / phong materials to handle skinning. 2011-02-17 02:01:31 +01:00
alteredq f4fe695d9a First somehow working version ;).
Just one hardcoded shader for the moment. Everything needs to get cleaned / bugfixed / optimized.
2011-02-17 00:27:42 +01:00
alteredq cf37a8cc43 First integration step: something appeared on the screen ;)
Otherwise things are very much work in progress, expect everything to be broken.
2011-02-16 17:58:19 +01:00
alteredq bc79c2393d Synced with mrdoob's branch. 2011-02-16 12:34:38 +01:00
Mr.doob 5ad6b0b59a I think these are the proper ways to detect <canvas> and WebGL. 2011-02-15 19:24:50 -08:00
alteredq df513e044c Transplanted simple hierarchy system from WebGLRenderer2 into WebGLRenderer.
Work in progress.

As with static objects, faster with OpenGL (34 -> 38 fps) and slower with ANGLE (30 -> 27 fps).
2011-02-15 04:22:37 +01:00
alteredq 04cae71659 Refactored render pass madness in WebGLRenderer to something a bit more sane.
Also fixed subtle bug in `materials_gl` example: face.material => face.materials (since renaming this example was just silently broken)
2011-02-14 23:12:30 +01:00
alteredq 373e6c29c1 Added forgotten Detector.js 2011-02-14 22:26:34 +01:00
alteredq a9af9481e5 Added vertex colors to ASCII model loader and to Blender exporter (plus corresponding example).
Also fixed quads vertex color bug in WebGLRenderer and did small optimization of face state handling.
2011-02-14 20:21:42 +01:00
alteredq be527d9f81 More optimizations of WebGLRenderer.
On my notebook WebGLRenderer now 35% faster than WebGLRenderer2 (in OpenGL, in ANGLE it's still 15% slower, go figure).
2011-02-14 01:57:55 +01:00
alteredq 56fcd26ef3 Small optimizations: skipped flattening in 3x3 matrix inversion and uploading camera position uniform only for materials where it's used. 2011-02-13 23:39:08 +01:00
alteredq eced0ca840 Small performance optimizations in WebGLRenderer: skipping few more typed arrays setters.
This should affect only use cases with lots of animated objects (unlike current performance tests where object matrices are not updated).
2011-02-13 22:51:17 +01:00
alteredq ff0c7f1b84 Changed lines to use drawArrays instead of drawElements.
As for particles, performance should be the same just using less memory.
2011-02-13 22:23:33 +01:00
alteredq fe2e9759b6 Refactored WebGLRenderer to be able to handle MeshShaderMaterial also for Lines and ParticleSystems.
It is now object type that determines which type of primitives is going to be used (triangles / lines / line strips / points).
2011-02-13 22:08:59 +01:00
alteredq 082da28c8e Renamed THREE.Supports to THREE.Detector, moved it to extras. Also cleaned up example title tags. 2011-02-13 19:19:55 +01:00
alteredq 29cf97eee7 Added centralized message for non-WebGL-compatible browser to majority of examples.
That was painful; hopefully since now it should be easier to have it in every WebGL example.

It's enough to add one line (ideally as the first thing that gets executed):

    if ( ! THREE.Supports.webgl ) THREE.Supports.addGetWebGLMessage();

This will add message box with default styling centered near top of the window. Optional parameters "parent" and "id" can be specified for further customization and integration with the document, also message DOM element is returned for easier access.

    var messageElement = THREE.Supports.addGetWebGLMessage( { parent: container, id: "my_message" } );

By default, message is added to document.body and has id "oldie" (can be styled with CSS).
2011-02-13 00:09:09 +01:00
alteredq 8e2f8c8b13 Fixed broken WebGL support detection.
Created "THREE.Supports" object, which should centralize this stuff. So far it detects <canvas>, WebGL and WebWorkers; later it could detect for example GPU capabilities.

Not sure about name or location, but it's pretty tiring go through all examples when something changes, so it should be somewhere in the library.

Code duplication is bad: even html snippets with error message should be centralized somewhere, so that when new browsers arrive we wouldn't have to keep changing them in many places.
2011-02-12 20:02:05 +01:00
alteredq 12fb60f1be Added glow to lines vertex color example. 2011-02-12 18:30:09 +01:00
alteredq 27ee81d4a1 Changed particles to use drawArrays instead of drawElements.
There shouldn't be performance difference, just less memory used (indices were not used anyways).
2011-02-12 15:24:48 +01:00
alteredq 078b0977ae Few dirty performance optimizations.
WebGLRenderer now as fast as WebGLRenderer2.
2011-02-12 05:57:17 +01:00
alteredq fe70e245dd Reused frustum culling from WebGLRenderer2 in WebGLRenderer.
Many balls demos now noticeably faster ;)
2011-02-12 05:12:50 +01:00
alteredq abfa966fb9 Synced with mrdoob's branch. 2011-02-12 04:01:21 +01:00
alteredq 119f363f24 Fixed simple ugly bug causing line buffers to be always updated.
Also doing less matrix multiplications (though this just seems to have shifted bottleneck elsewhere).
2011-02-12 03:53:18 +01:00
Mr.doob aaa0b59660 Fixed CanvasRenderer texturePath method (checking if det == 0). 2011-02-11 18:42:58 -08:00
alteredq d34d8d8e05 Vertex colors examples tweaks. 2011-02-12 02:00:33 +01:00
alteredq f5642a3beb Added mesh vertex color example. 2011-02-12 01:26:41 +01:00
alteredq 9a9ed7cc85 Fixed lights removal not being reflected in WebGLRenderer. 2011-02-11 23:54:08 +01:00
alteredq e8497d205b Simplified shaders building. 2011-02-11 21:37:39 +01:00
alteredq ad51a48fcd Added "depth_test" parameter to materials.
This is to be able to control depth buffer writing / testing on per geometry chunk level (before it was possible just to hack it on per scene level via exposed GL context).

Disabling depth test is useful for example for additively blended particles, handling of transparency or for having background textured quad.

Another option would be to have it on per object level, but then this could prevent different handling of objects with both transparent and opaque parts.

Also in this commit:

- more progress towards mesh vertex colors
- less matrix multiplications in render call
- fixed ugly bug in doubleSided / flipSided handling
- cleanup of materials
    - added a lot of missing stuff in debug strings and parameters handlers
    - normal and depth materials now have opacity parameter
    - wrote comments for non-obvious things
2011-02-11 19:58:58 +01:00
alteredq fe6d492573 Added vertex colors to WebGL lines plus corresponding example.
Vertex colors for meshes in progress ...
2011-02-11 03:25:54 +01:00
alteredq 3e58a51fc9 Changed environment map mixing fragment shader snippet to preserve total material opacity. 2011-02-10 13:20:10 +01:00
alteredq 642939fb79 Added transparent render pass for immediate simulator objects in WebGLRenderer. 2011-02-10 04:00:05 +01:00
alteredq fc9d5bc83e Ported voxel painter demo to work with WebGLRenderer. 2011-02-08 18:23:40 +01:00
alteredq b3ea0d5fcd Changed a bit clear color API.
Renamed: setClearColor( hex, opacity ) => setClearColorHex( hex, opacity )

New: setClearColor( color, opacity )

In this way it's a bit cheaper to animate clear color.

Hope I didn't break examples - I searched for "setClearColor" and changed it in one place where it was used.
2011-02-08 12:49:14 +01:00
alteredq a8ab2336b3 Small marching cube freeze optimization. 2011-02-07 18:26:11 +01:00
alteredq fc0b8cab64 Added method for freezing MarchingCubes buffers into regular Geometry. 2011-02-07 18:19:00 +01:00
alteredq b198531c66 Added MarchingCubes object.
Very much work-in-progress. Expect things to change.

Also changed film shader to have optional grayscale (controlled via uniform).
2011-02-07 14:29:42 +01:00
alteredq feed283804 Added support for material blending parameter to scene loader. 2011-02-04 17:14:23 +01:00
alteredq b4bffd49e3 Added basic sanitization of id->filename mapping in FBX converter. 2011-02-04 11:46:07 +01:00
alteredq 750a242f0c Added vertex colors for particles. 2011-02-03 23:54:30 +01:00
alteredq 5365a11b0e Small refactoring in handling of "dirty" buffers in WebGLRenderer. 2011-02-03 19:00:02 +01:00
alteredq 8227d9f118 Added billboard particles (semi-opaque depth sorted).
Work in progress, caveats:

- sort happens just inside one ParticleSystems, so everything gets messed up when more ParticleSystems are in the same screen space
- not yet solved proper order of operations, if you change object transform, you need to update ParticleSystem object matrix manually before rendering (so that sort works, otherwise it will use transform from previous frame)

Also fixed transparency in fog and did small optimizations in WebGLRenderer.
2011-02-03 02:53:33 +01:00