Commit Graph
363 Commits
Author SHA1 Message Date
Mr.doob 7480fb69cd Updated README examples.
Sound3D ⟶ Sound
2011-02-26 14:21:15 +00:00
Mr.doob 446834ba35 Minor fixes and improvements. 2011-02-26 12:10:35 +00:00
Mr.doob d1aff49533 Fixed Quaternion::slerp. 2011-02-26 11:11:49 +00:00
Mr.doob d1e3a9d872 Object3D::screenPosition ⟶ Object3D::positionScreen
Yet more reformating.
2011-02-26 10:52:35 +00:00
Mr.doob c7aa2ab3d1 Object3D::localMatrix ⟶ Object3D::matrix
Object3D::globalMatrix ⟶ Object3D::matrixWorld

Added hierarchy examples.
2011-02-26 10:31:18 +00:00
Mr.doob e7e47b1f88 More reformating and clean up. 2011-02-26 09:18:10 +00:00
Mr.doob 27dc056af4 Minor refactoring and clean up. 2011-02-26 06:51:23 +00:00
alteredq 49c7eeaf7d Fixed scene loader example.
I forgot to update scene loader to reflect new way of handling textures :S
2011-02-26 05:30:56 +01:00
Mr.doob 45ec0f329b Reverted Camera::FOV,zNear,zFar to Camera::fov,near,far.
Most of the examples or working again as usual. Only `webgl_scene_test.html` and `webgl_ribbons.html` left.
2011-02-26 03:45:16 +00:00
alteredq da8afc4e6d Refactored CameraControl into THREE.QuakeCamera.
Now you can add keyboard + mouse camera control with a single line, just change camera type and add parameters:

 camera = new THREE.QuakeCamera( { fov: 50, aspect: window.innerWidth / window.innerHeight, near: 1, far: 10000,
	                           movement_speed: 1, look_speed: 0.002, nofly: true, look_vertical: false } );

Thanks to mrdoob for suggestions ;)
2011-02-26 00:24:14 +01:00
Mr.doob 033a372c70 Fixed Matrix4::scale
Fixed matrix rotation in Projector (not fully done yet, need to implement herarchies still)
2011-02-25 16:33:04 +00:00
Mr.doob 059d0d7df2 Fixed Matrix4::setRotationFromEuler (using x,y,z order). 2011-02-25 15:37:10 +00:00
alteredq 7415759392 Added 3d sound support plus example.
Thanks to @mikaelemtinger ;)
2011-02-25 09:08:15 +01:00
alteredq 3e2f4f7cc5 Merged with mrdoob's branch.
Also got uqbiquity working and fixed ugly globals bug in WebGLRenderer. Again we missed it because of consistent naming ;)
2011-02-24 01:31:33 +01:00
alteredq cff95a119c Textures are now updateable.
That was much tougher than expected. No wonder other WebGL video demos around the web are broken.

Firefox OpenGL / ANGLE and Chrome OpenGL were ok, getting it to work in Chrome ANGLE was rather tricky.

Please report if something got broken. I tried to go through all textured examples but I may have missed something.

If you want to refresh texture on WebGL side, you just set "texture.needsUpdate" flag (if you use Loader or ImageUtils.loadTexture / loadTextureCube everything is taken care of).

Flag has to be set also for canvas-based textures, sorry no escaping this :(. I tried and it lead to ugly problems (e.g. AO minecraft demo mixes several asynchronously loaded and generated images into one texture, with autodetect always something was broken).

"needsUpdate" should work also on cube textures, though it's not tested yet (also there I didn't put hack for Chrome ANGLE).
2011-02-23 23:43:32 +01:00
Mr.doob fef3c084b1 Changed build setup:
build/Three.js - Includes all renderers + extras
	build/custom/ThreeCanvas.js - Canvas renderer only
	build/custom/ThreeDOM.js - DOM renderer only
	build/custom/ThreeSVG.js - SVG renderer only
	build/custom/ThreeWebGL.js - WebGL renderer only
	build/custom/ThreeExtras.js - Extras only

Moved `THREE.Detector.js` to `examples/js/Detector.js`.

Updated examples to reflect these changes.
2011-02-23 12:35:31 +00:00
Mr.doob a4a8f184c6 src/objects/Object3D.jssrc/core/Objects3D.js 2011-02-22 23:26:19 +00:00
alteredq aba1930fa2 Fixed DOF example layout in Firefox. 2011-02-22 15:41:18 +01:00
Mr.doob a4ee822b10 Easier to understand RequestAnimationFrame setup. 2011-02-21 20:39:11 +00:00
alteredq e3b68c4d90 Fixed bug in frustum culling.
Thanks to oosmoxiecode for reporting ;)
2011-02-21 17:02:11 +01:00
alteredq b36cf734bd Removed dirty flag from Quaternion.
There don't seem to be any effects on performance (though I'm not sure this was actually used in any example/test code path - so far quaternions are used just for animation interpolation and even there they were always dirty, and also just updated during JIT baking).

Also some more code cleanup - no need for Mesh to have own "update" as now it was exactly the same as its parent Object3D.
2011-02-21 03:06:17 +01:00
alteredq d05053c493 Merged with mrdoob's skinning branch.
Not fully tested (need to update bookmarks yet again), but random sample of examples seem to work ;).
2011-02-20 19:17:06 +01:00
alteredq 0111f5ddbb Accidentally merged skinning branch with mrdoob's main branch.
No harm seems to be done, just gained ReverseSubtractiveBlending and fixed Detector ;).
2011-02-20 18:50:26 +01:00
Mr.doob 30a3d14c2d Object3D::rotationMatrix ⟶ Object3D::matrixRotation
I need to look at this objectMatrix::extractRotationMatrix() thing. I don't think this works like that... isn't the scale applied to the rotation in the matrix?
2011-02-20 06:09:14 +00:00
Mr.doob 106db4c3f8 Object3D::autoUpdateMatrix ⟶ Object3D::matrixAutoUpdate
Object3D::matrixNeedsToUpdate ⟶ Object3D::matrixNeedsUpdate
2011-02-20 05:35:13 +00:00
Mr.doob 848d1a338c Removed debug version from compile script. 2011-02-20 04:38:34 +00:00
Mr.doob 4912f59cc6 Compiled new build.
Renamed examples.
2011-02-20 04:11:47 +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
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 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 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 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 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