Three.js 3D rendering library for javascript #gamedev #game-engine #rendering #javascript
|
14 năm trước cách đây | |
---|---|---|
build | 14 năm trước cách đây | |
examples | 14 năm trước cách đây | |
src | 14 năm trước cách đây | |
utils | 14 năm trước cách đây | |
.gitignore | 14 năm trước cách đây | |
LICENSE | 14 năm trước cách đây | |
README.md | 14 năm trước cách đây | |
REVISION | 14 năm trước cách đây | |
TODO | 14 năm trước cách đây |
The aim of the project is to create a lightweight 3D engine with a very low level of complexity — in other words, for dummies. The engine can render using <canvas>, <svg> and WebGL.
Contributors — Getting Started — API Reference
More? #three.js on irc.freenode.net
Download the minified library and include it in your html.
<script src="js/Three.js"></script>
This code creates a camera, then creates a scene, adds a cube on it, creates a <canvas> renderer and adds its viewport in the document.body element.
<script>
var camera, scene, renderer,
geometry, material, mesh;
init();
animate();
function init() {
camera = new THREE.Camera( 75, window.innerWidth / window.innerHeight, 1, 10000 );
camera.position.z = 1000;
scene = new THREE.Scene();
geometry = new THREE.Cube( 200, 200, 200 );
material = new THREE.MeshBasicMaterial( { color: 0xff0000, wireframe: true } );
mesh = new THREE.Mesh( geometry, material );
scene.addObject( mesh );
renderer = new THREE.CanvasRenderer();
renderer.setSize( window.innerWidth, window.innerHeight );
document.body.appendChild( renderer.domElement );
}
function animate() {
// Include examples/js/RequestAnimationFrame.js for cross-browser compatibility.
requestAnimationFrame( animate );
render();
}
function render() {
mesh.rotation.x += 0.01;
mesh.rotation.y += 0.02;
renderer.render( scene, camera );
}
</script>
2011 05 21 - r41/ROME (264.801 KB, gzip: 64.599 KB)
(Up to this point, some rome specific features have managed to get included in the lib. The aim is to clean this up in next revisions.)
2011 04 24 - r40 (263.774 KB, gzip: 64.320 KB)
Object3D.lookAt
. (mrdoob)CollisionSystem
. (drojdjou and alteredq)Trident
object. (sroucheray)data
object to Renderers for getting number of vertices/faces/callDraws from last render. (mrdoob)Projector
handling Particles with hierarchies. (mrdoob)2011 04 09 - r39 (249.048 KB, gzip: 61.020 KB)
Collisions
classes. (drojdjou)Sprite
object. (empaempa)*Loader
issue where Workers were kept alive and next loads were delayed. (alteredq)THREE
namespace to all the classes that missed it. (mrdoob)2011 03 31 - r38 (225.442 KB, gzip: 55.908 KB)
LensFlare
light. (empaempa)ShadowVolume
object (stencil shadows). (empaempa)Loader
(mrdoob)material.transparent
define whether material is transparent or not (before we were guessing). (mrdoob)2011 03 22 - r37 (208.495 KB, gzip: 51.376 KB)
Geometry.uvs
is now a multidimensional array (allowing infinite uv sets) (alteredq)CanvasRenderer
renders Face4
again (without spliting to 2 Face3
) (mrdoob)ParticleCircleMaterial
> ParticleCanvasMaterial
. Allowing injecting any canvas.context
code! (mrdoob)2011 03 14 - r36 (194.547 KB, gzip: 48.608 KB)
WebGLRenderer
aspect ratio bug when scene had only one material. (mrdoob)sizeAttenuation
property to ParticleBasicMaterial
. (mrdoob)PathCamera
. (alteredq)WebGLRenderer
bug when Camera has a parent. CameraCamera.updateMatrix
method. (empaempa)Camera.updateMatrix
method and Object3D.updateMatrix
. (mrdoob)2011 03 06 - r35 (187.875 KB, gzip: 46.433 KB)
translate
, translateX
, translateY
, translateZ
and lookAt
methods to Object3D
. (mrdoob)setViewport
and setScissor
to WebGLRenderer
. (alteredq)2011 03 02 - r34 (186.045 KB, gzip: 45.953 KB)
QuakeCamera
for easy fly-bys (alteredq)LOD
example (alteredq)2011 02 26 - r33 (184.483 KB, gzip: 45.580 KB)
ParticleSystem
object to WebGLRenderer
(alteredq)Line
support to WebGLRenderer
(alteredq)WebGLRenderer
(alteredq)Ribbon
object. (alteredq)WebGLRenderer
(alteredq)Sound
object and SoundRenderer
. (empaempa)LOD
, Bone
, SkinnedMesh
objects and hierarchy being developed. (empaempa)2010 12 31 - r32 (89.301 KB, gzip: 21.351 KB)
Scene
now supports Fog
and FogExp2
. WebGLRenderer
only right now. (alteredq)setClearColor( hex, opacity )
to WebGLRenderer
and CanvasRenderer
(alteredq & mrdoob)WebGLRenderer
shader system refactored improving performance. (alteredq)Projector
now does frustum culling of all the objects using their sphereBoundingBox. (thx errynp)material
property changed to materials
globaly.2010 12 06 - r31 (79.479 KB, gzip: 18.788 KB)
WebGLRenderer
python build.py --includes
generates includes string2010 11 30 - r30 (77.809 KB, gzip: 18.336 KB)
WebGLRenderer
(alteredq)SmoothShading
support on CanvasRenderer
/MeshLambertMaterial
MeshShaderMaterial
for WebGLRenderer
(alteredq)RenderableFace4
from Projector
/CanvasRenderer
(maybe just temporary).GeometryUtils
, ImageUtils
, SceneUtils
and ShaderUtils
(alteredq & mrdoob)2010 11 17 - r29 (69.563 KB)
CanvasRenderer
(julianwa)CanvasRenderer
and SVGRenderer
. (mrdoob)2010 11 04 - r28 (62.802 KB)
Loader
class allows load geometry asynchronously at runtime. (alteredq)MeshPhongMaterial
working with WebGLRenderer
. (alteredq)Projector.unprojectVector
and Ray
class to check intersections with faces (based on mindlapse work)Projector
z-sorting (not as jumpy anymore).2010 10 28 - r25 (54.480 KB)
WebGLRenderer
now up to date with other renderers! (alteredq)MeshFaceMaterial
(multipass per face)CanvasRenderer
and SVGRenderer
material handling2010 10 06 - r18 (44.420 KB)
PointLight
CanvasRenderer
and SVGRenderer
basic lighting support (ColorStroke/ColorFill only)Renderer
> Projector
. CanvasRenderer
, SVGRenderer
and DOMRenderer
do not extend anymorecomputeCentroids
method to Geometry
2010 09 17 - r17 (39.487 KB)
Light
, AmbientLight
and DirectionalLight
(philogb)WebGLRenderer
basic lighting support (philogb)2010 08 21 - r16 (35.592 KB)
Matrix4
and Vector3
methods2010 07 23 - r15 (32.440 KB)
UV
instead of Vector2
where it should be usedMesh.flipSided
boolean (false by default)CanvasRenderer
was handling UVs at 1,1 as bitmapWidth, bitmapHeight (instead of bitmapWidth - 1, bitmapHeight - 1)ParticleBitmapMaterial.offset
addedFace4
with MeshBitmapUVMappingMaterial
2010 07 17 - r14 (32.144 KB)
CanvasRenderer
(more duplicated code, but easier to handle)Face4
now supports MeshBitmapUVMappingMaterial
*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 height2010 07 12 - r13 (29.492 KB)
ParticleCircleMaterial
and ParticleBitmapMaterial
Particle
now use ParticleCircleMaterial
instead of ColorFillMaterial
Particle.size
> Particle.scale.x
and Particle.scale.y
Particle.rotation.z
for rotating the particleSVGRenderer
currently out of sync2010 07 07 - r12 (28.494 KB)
WebGLRenderer
(ColorFillMaterial
and FaceColorFillMaterial
by now)Matrix4.lookAt
fix (CanvasRenderer
and SVGRenderer
now handle the -Y)Color
now using 0-1 floats instead of 0-255 integers2010 07 03 - r11 (23.541 KB)
Scene.add
> Scene.addObject
Scene.removeObject
2010 06 22 - r10 (23.959 KB)
Object3D.overdraw = true
to enable CanvasRenderer screen space point expansion hack.2010 06 20 - r9 (23.753 KB)
autoClear
property for renderers.2010 06 06 - r8 (23.496 KB)
Geometry
.CanvasRenderer
expands screen space points (workaround for antialias gaps).CanvasRenderer
supports BitmapUVMappingMaterial
.2010 06 05 - r7 (22.387 KB)
2010 05 17 - r6 (21.003 KB)
CanvasRenderer
and SVGRenderer
clearRect
optimisations on CanvasRenderer
2010 05 16 - r5 (19.026 KB)
THREE
namespaceCamera.x
-> Camera.position.x
Camera.target.x
> Camera.target.position.x
ColorMaterial
> ColorFillMaterial
FaceColorMaterial
> FaceColorFillMaterial
ColorStrokeMaterial
and FaceColorStrokeMaterial
geometry.faces.a
are now indexes instead of references2010 04 26 - r4 (16.274 KB)
SVGRenderer
Particle renderingCanvasRenderer
uses context.setTransform
to avoid extra calculations2010 04 24 - r3 (16.392 KB)
Plane
and Cube
primitives2010 04 24 - r2 (15.724 KB)
Color
handling2010 04 24 - r1 (15.25 KB)