Commit Graph
921 Commits
Author SHA1 Message Date
alteredq 8a26198b41 Updated also WebGLRenderer2 to show quads in wireframe. 2011-01-18 20:39:10 +01:00
alteredq 969490ddba Merged astrodud's pull request. 2011-01-18 16:56:56 +01:00
alteredq 5665864605 Merge remote branch 'remotes/astrodud/master' 2011-01-18 16:53:25 +01:00
astrodud 6c071233d6 This is the Object3D.js code as it *should* have been committed 2011-01-18 05:35:32 -08: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 41c692828f Trailing spaces clean up. 2011-01-18 08:18:11 +00: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
astrodud 2a7262ccd9 Merge https://github.com/mrdoob/three.js 2011-01-17 22:57:03 -08:00
astrodud c9706f85bf Optimized Object3D.updateMatrix to (1) cut down where possible on new Matrix4 allocation, (2) only compute
rotation/scale matrices if needed (if no rotation, no need t compute); and (3) no longer require
storage of translationMatrix or scaleMatrix (1 per object). Uses a single tmpMatrix instead.
2011-01-17 22:27:32 -08:00
astrodud d8f6d06edf oops - fixed but in setRotX 2011-01-17 22:09:03 -08:00
Mr.doob 89ecf225d0 Merge remote branch 'alteredq/master' 2011-01-18 05:48:57 +00:00
Mr.doob 0b8323f426 Removed hatching commented code from ShaderUtils. 2011-01-18 05:48:50 +00:00
astrodud 17ab97545e added Matrix4 "setter" functions: setTranslation, setScale, setRotX, setRotY, setRotZ, setRotAxis; to be used in optimizing Object3D.updateMatrix. 2011-01-17 21:45:05 -08:00
astrodud 22a1502174 slight speedup in Matrix4.makeInvert by cutting down object lookups 2011-01-17 21:42:05 -08:00
astrodud 151ff4394e slight speedup in Matrix4.rotationAngleAxisMatrix by cutting down object lookups and redundant multiplications 2011-01-17 21:41:13 -08:00
astrodud f3fd1bcfe6 slight speedup in Matrix4.determinant by cutting down object lookups 2011-01-17 21:38:56 -08: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 e37223a849 Synced with mrdoob's branch. 2011-01-17 08:25:42 +01:00
Mr.doob 28e18bcf2c Added texture/disturb.jpg 2011-01-17 00:00:38 +00:00
astrodud a62dc97e60 added LathedObject to build script for extras options 2011-01-16 15:27:19 -08:00
astrodud ebd21f962b GeometryUtils.merge should obey object2.autoUpdateMatrix 2011-01-16 15:26:00 -08: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 6668440006 Cleaned bit postprocessing example code. 2011-01-16 14:35:17 +01:00
alteredq d50863908c Small improvements in postprocessing example.
Alternating convolution pass textures aspect ratio and using linear magnification filtering leads to less artefacts.
2011-01-16 11:51:56 +01:00
alteredq 61e0bf0289 Synced with mrdoob's branch. 2011-01-16 03:07:56 +01:00
timk 1fbe2bfdbf CanvasRenderer::setSize didn't clear _contextGlobalAlpha et al 2011-01-16 00:43:51 +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 6cc1016477 Testing rendering to full-screen texture.
Requires to turn off mipmapping to be able to use non-power of two texture.

Effect of texture size on performance is noticeable, also there is no antialiasing (default in Chrome is I think 4x multisampling).

So I guess full-screen postprocessing will be quite costly :(. That's the price of WebGL always running at full-blown high resolution.

This could be somehow mitigated by faking lower resolutions via smaller texture, though I guess it still wouldn't be the same as having lower resolution set by GPU driver (this is a major help with performance in games - I never run full 1680 x 1050).
2011-01-14 15:16:14 +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 707dc9d0a0 Refactored render-to-texture example.
Still flipped, though at least now it's consistent.
2011-01-14 02:05:16 +01:00
alteredq 916401fd96 Updated render-to-texture example so that it's easier to check texture orientation. 2011-01-14 00:51:26 +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
alteredq 0f5652390f Added dynamic geometry support also for WebGL lines. Changed line strip example to use Hilbert curves.
Also fixed tons of bugs in lines handling.

TODO: make some example for dynamic lines.
2011-01-13 14:12:18 +01:00
alteredq 15407b01e7 Merge remote branch 'remotes/upstream/master' 2011-01-12 01:00:26 +01:00
alteredq fe6008b616 Added basic support for dynamic geometry in WebGLRenderer (with silly ocean example).
If you want to refresh VBOs (and thus have geometry changes reflected in renderer), you need to set dirty flags on geometry object.

There are separate flags for different buffers (as not always all buffers need to be updated and oh my is updating costly):

    mesh.geometry.__dirtyVertices = true;
    mesh.geometry.__dirtyNormals = true;
    mesh.geometry.__dirtyUvs = true;
    mesh.geometry.__dirtyTangents = true;

    mesh.geometry.__dirtyElements = true;

That was quite tough feature, a lot of refactoring, yet performance is still quite bad :(

The biggest remaining bottleneck seems to be translation between Three.js internal data formats and buffers. I removed as much per-frame arrays creation as I could, but even just iterating through existing data and setting of values is still very costly. Also per-frame normals computation is expensive.
2011-01-12 00:57:04 +01:00
Szymon Nowak 6294caed07 Added render-to-texture feature to WebGL renderer. 2011-01-11 10:10:05 +01:00
oosmoxiecode 6963a57963 Merge branch 'master' of https://github.com/mrdoob/three.js 2011-01-09 21:50:52 +01:00
oosmoxiecode bf0c1a7a55 Uvs are messed up in this one, so it´s probably a good idea to fix that first ;) 2011-01-09 21:43:52 +01:00
oosmoxiecode 6759a5da11 /src/extras/primitives -> Torus.js + Torusknot.js 2011-01-09 21:32:31 +01:00
oosmoxiecode 3f05143a2a test 2011-01-09 21:25:13 +01:00
Szymon Nowak 868cab1e98 Very basic example for RTT feature. 2011-01-09 20:53:56 +01:00
Szymon Nowak 1d706dd789 Basic support for RTT. 2011-01-09 20:50:35 +01:00