Commit Graph
252 Commits
Author SHA1 Message Date
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 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 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 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 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 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
alteredq 1d9c3405a3 Changed ParticleSystem to autoupdate transform by default (as do Mesh and Line objects). 2011-02-02 12:41:42 +01:00
alteredq 46146858a9 Fixed flipSided / doubleSided bug in WebGLRenderer.
I have no idea why I stuck it in transparent pass.
2011-02-01 23:53:25 +01:00
alteredq 54e3bc61bd Added elementary support for particles to WebGLRenderer.
It works more or less the same as lines:

  - particles are passed to ParticleSystem object as geometry
  - material is ParticleBasicMaterial (textures should be supported, not tested yet)
  - geometry can be updated by setting "__dirtyVertices" property of the geometry
2011-02-01 14:26:33 +01:00
alteredq 1921192be9 Added basic support for second set of UVs for lightmaps.
Work in progress ...
2011-01-28 22:38:14 +01:00
alteredq 177b2572ef Synced with mrdoob's branch. 2011-01-28 10:32:02 +01:00
Mr.doob c6cec3ca6b Yet some more tweaks to CanvasRenderer::clear() 2011-01-27 21:29:13 +00:00
Mr.doob a7ac6fa598 Made CanvasRenderer ParticleBasicMaterial handling consistent with the rest — material.map needs to be a Texture. 2011-01-27 21:23:33 +00:00
Mr.doob 6d565bfb87 New builds. 2011-01-26 18:37:48 +00:00
Mr.doob 52c0de2b09 Merging with alteredq's branch. 2011-01-26 18:36:49 +00:00
Mr.doob a7b55e9e00 Tweaked clearColor handling in CanvasRenderer and WebGLRenderer2. 2011-01-26 18:33:22 +00:00
Mr.doob b4b2843cae Updated builds. 2011-01-25 20:08:53 +00:00
alteredq 09571ee3d0 Partially merged szimek's pull request
https://github.com/mrdoob/three.js/pull/97
2011-01-23 19:22:49 +01:00
alteredq 3e36fed048 Merged astrodud's pull request. 2011-01-19 09:06:50 +01:00
alteredq 969490ddba Merged astrodud's pull request. 2011-01-18 16:56:56 +01:00
alteredq 5e99c7b8f7 Simplified Matrix4: reused code from setters in creators. 2011-01-18 10:26:11 +01:00
alteredq 8f29cf0324 Prettified formatting of new Matrix4 set methods and also fixed implied globals in setRotAxis. 2011-01-18 10:03:11 +01:00
Mr.doob 5accd0cfd7 Brought back Object3D.rotationMatrix (Projector still uses it). 2011-01-18 07:29:39 +00:00
Mr.doob ecedea4be1 Updated builds. 2011-01-18 07:06:07 +00:00
alteredq fde0754383 Refactored camera translation so that it doesn't create new vectors. 2011-01-17 21:35:43 +01:00
alteredq d1514ca6a7 Refactored lights handling in WebGLRenderer.
This should be the last place where new arrays were created in "render".

Chrome memory now seems stable.

Firefox still grows like mad, though this used to be like this also with other demos (simply setting random values to existing arrays does this).

Seems like Mozilla folks themselves struggle with this:

http://www.flickr.com/photos/11280278@N04/5363335103/in/photostream/
2011-01-17 20:22:46 +01:00
alteredq e54d9519d0 Changed wireframe rendering in WebGLRenderer to show quads.
See discussion here:

https://github.com/mrdoob/three.js/issues#issue/92
2011-01-17 18:44:09 +01:00
alteredq 08f6ceef15 Small optimizations to matrix math.
For the moment just things that are executed every frame in WebGLRenderer.render.

Continuing with quest to minimize creation of new data structures. Should instead create per class/object structures and just reuse them (as gman does in ThreeD). Main goal is to avoid annoying garbage collection pauses.

Let's hope it didn't break something (could be if some code was dependent on cloning of return values of "flatten" or "makeInvert3x3", though from what I checked these are just used to set typed arrays uniforms).
2011-01-17 16:09:26 +01:00
alteredq d110c49c2f Added support for flipSided mesh property to WebGLRenderer.
Also doesn't seem to decrease performance so far (though most of demos have small number of objects).
2011-01-16 21:46:23 +01:00
alteredq 271ba6c524 Added support for "doubleSided" mesh property to WebGLRenderer.
Testing on current examples didn't show any noticeable performance degradation when enabling / disabling culling for every object in every frame.

"FlipSided" property could be probably done in very similar way, just setting "gl.frontFace( gl.CCW )" or "gl.frontFace( gl.CW )"
2011-01-16 15:10:58 +01:00
alteredq 61e0bf0289 Synced with mrdoob's branch. 2011-01-16 03:07:56 +01:00
alteredq a03f714244 Added postprocessing example.
For this had to extend WebGLRenderer a bit:

- MeshShaderMaterial now can take non-specific float array uniforms as "fv1"
  (there is already "fv" type for array of 3-item-vectors, which probably should be renamed to "fv3" to be consistent)

- render method has yet another parameter "clear" for clearing newly set framebuffer (defaults to true).
  This is a bit hackish but it seems necessary to control this somehow. I didn't manage to replicate
  desired behavior just with autoClear.

- another dirty thing is accessing GL context from the application side:
    renderer.context.disable( renderer.context.DEPTH_TEST );

    This should be refactored somehow, wrapped in some API call.
2011-01-15 02:20:47 +01:00
alteredq 7c9fe8ff82 Another update of render-to-texture example and related bugfix.
Rendering proper 3d object into the texture uncovered another issue - framebuffer had to be cleared after switching.

Texture is still flipped :( (original scene has small red torus on the top)

This is proving to be rather tricky. Yet again I tried to handle image coordinate mess in a proper way (UNPACK_FLIP_Y_WEBGL as texture parameter and non-inverted UVs), fixing hacks across the codebase.

This did indeed help with render-to-texture flipping, but instead it created really ugly problems with both normal map and minecraft AO demos. So back to square one :(
2011-01-14 12:39:57 +01:00
alteredq 9bc383e1ed Fixed discrepancy between ANGLE and OpenGL when rendering to texture.
Had to set viewport to make it work in OpenGL.

Also made it easier to see texture orientation in the example.

Now it's visible that there is indeed flipping. At least now it's consistent ;).
2011-01-13 22:10:38 +01:00
alteredq cee7205670 Added simple render-to-texture example.
Something is broken as OpenGL shows different result than ANGLE :(

Though this time it's ANGLE which seems correct.
2011-01-13 17:04:36 +01:00
alteredq b511fdc38b Merged szimek's render-to-texture branch.
This is untested, as example is in different branch, have to commit this merge first.

At least this didn't seem to break existing things.
2011-01-13 15:27:08 +01:00