提交 2a3d1e35 编写于 作者: M Mr.doob

* autoClear property for renderers.

* Removed SVG rgba() workaround for WebKit. (WebKit now supports it);
上级 0aac038d
......@@ -55,7 +55,7 @@ This code creates a camera, then creates a scene object, adds a bunch of random
scene = new THREE.Scene();
renderer = new THREE.CanvasRenderer();
renderer.setSize(window.innerWidth, window.innerHeight);
renderer.setSize( window.innerWidth, window.innerHeight );
for (var i = 0; i < 1000; i++) {
......@@ -115,7 +115,14 @@ If you are interested on messing with the actual library, instead of importing t
### Change Log ###
2010 06 06 - **r8** (23.597 kb)
2010 06 20 - **r9** (23.641 kb)
* JSLinted
* autoClear property for renderers.
* Removed SVG rgba() workaround for WebKit. (WebKit now supports it)
2010 06 06 - **r8** (23.496 kb)
* Moved UVs to Geometry.
* CanvasRenderer expands screen space points (workaround for antialias gaps).
......
此差异已折叠。
......@@ -64,7 +64,6 @@
camera = new THREE.Camera(0, 150, 400);
camera.focus = 300;
camera.target.position.y = 150;
camera.updateMatrix();
scene = new THREE.Scene();
......
......@@ -193,8 +193,8 @@
function loop() {
camera.position.x += (mouseX - camera.position.x) * .05;
camera.position.y += (-mouseY - camera.position.y) * .05;
camera.position.x += (mouseX - camera.position.x) * 0.05;
camera.position.y += (-mouseY - camera.position.y) * 0.05;
renderer.render(scene, camera);
stats.update();
......@@ -282,7 +282,7 @@
vector3.x = src_data[ index - 4 ] - src_data[ index + 4 ];
vector3.y = 2;
vector3.z = src_data[ index - ( width * 4 ) ] - src_data[ index + ( width * 4 ) ];;
vector3.z = src_data[ index - ( width * 4 ) ] - src_data[ index + ( width * 4 ) ];
vector3.normalize();
shade = vector3.dot(sun);
......
......@@ -2,15 +2,15 @@
* @author mr.doob / http://mrdoob.com/
*/
THREE.Camera = function (x, y, z) {
THREE.Camera = function ( x, y, z ) {
this.position = new THREE.Vector3(x, y, z);
this.target = { position: new THREE.Vector3(0, 0, 0) };
this.position = new THREE.Vector3( x, y, z );
this.target = { position: new THREE.Vector3( 0, 0, 0 ) };
this.matrix = new THREE.Matrix4();
this.projectionMatrix = THREE.Matrix4.makePerspective(45, 1 /*SCREEN_WIDTH/SCREEN_HEIGHT*/, 0.001, 1000);
this.projectionMatrix = THREE.Matrix4.makePerspective( 45, 1 /*SCREEN_WIDTH/SCREEN_HEIGHT*/, 0.001, 1000 );
this.up = new THREE.Vector3(0, 1, 0);
this.up = new THREE.Vector3( 0, 1, 0 );
this.roll = 0;
// TODO: Need to remove this
......@@ -21,7 +21,7 @@ THREE.Camera = function (x, y, z) {
this.updateMatrix = function () {
this.matrix.lookAt(this.position, this.target.position, this.up);
this.matrix.lookAt( this.position, this.target.position, this.up );
};
......
......@@ -36,20 +36,11 @@ THREE.Matrix4 = function () {
y.copy( x );
y.crossSelf( z );
y.normalize();
y.negate(); //
this.n11 = x.x;
this.n12 = x.y;
this.n13 = x.z;
this.n14 = - x.dot( eye );
this.n21 = y.x;
this.n22 = y.y;
this.n23 = y.z;
this.n24 = - y.dot( eye );
this.n31 = z.x;
this.n32 = z.y;
this.n33 = z.z;
this.n34 = - z.dot( eye );
y.negate();
this.n11 = x.x; this.n12 = x.y; this.n13 = x.z; this.n14 = - x.dot( eye );
this.n21 = y.x; this.n22 = y.y; this.n23 = y.z; this.n24 = - y.dot( eye );
this.n31 = z.x; this.n32 = z.y; this.n33 = z.z; this.n34 = - z.dot( eye );
};
this.transform = function ( v ) {
......
......@@ -14,6 +14,7 @@ THREE.CanvasRenderer = function () {
_vector2 = new THREE.Vector2();
this.domElement = _viewport;
this.autoClear = true;
this.setSize = function ( width, height ) {
......@@ -26,6 +27,15 @@ THREE.CanvasRenderer = function () {
};
this.clear = function () {
_clearRect.inflate( 1 );
_clearRect.minSelf( _clipRect );
_context.clearRect( _clearRect.getX(), _clearRect.getY(), _clearRect.getWidth(), _clearRect.getHeight() );
_clearRect.empty();
};
this.render = function ( scene, camera ) {
var i, j, element, pi2 = Math.PI * 2,
......@@ -38,10 +48,7 @@ THREE.CanvasRenderer = function () {
bitmap, bitmap_width, bitmap_height,
size;
_clearRect.inflate( 1 );
_clearRect.minSelf( _clipRect );
_context.clearRect( _clearRect.getX(), _clearRect.getY(), _clearRect.getWidth(), _clearRect.getHeight() );
_clearRect.empty();
this.autoClear && this.clear();
/*
_context.fillStyle = 'rgba(255, 255, 0, 0.5)';
......
......@@ -13,6 +13,7 @@ THREE.SVGRenderer = function () {
_quality = 1;
this.domElement = _viewport;
this.autoClear = true;
this.setQuality = function( quality ) {
......@@ -35,6 +36,16 @@ THREE.SVGRenderer = function () {
};
this.clear = function () {
while ( _viewport.childNodes.length > 0 ) {
_viewport.removeChild( _viewport.childNodes[ 0 ] );
}
};
this.render = function ( scene, camera ) {
var i, j, element, elementsLength, material, materialLength,
......@@ -42,13 +53,9 @@ THREE.SVGRenderer = function () {
v1x, v1y, v2x, v2y, v3x, v3y, v4x, v4y,
size;
this.project( scene, camera );
while ( _viewport.childNodes.length > 0 ) {
_viewport.removeChild( _viewport.childNodes[ 0 ] );
this.autoClear && this.clear();
}
this.project( scene, camera );
elementsLength = this.renderList.length;
......
......@@ -3,7 +3,7 @@ import os
# MERGER
rev = 8;
rev = 9;
files = [];
files.append('Three.js');
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册