mirror of
https://github.com/wahyd4/three.js.git
synced 2026-08-09 13:06:01 +10:00
- Fixed matrix bug (transformed objects outside the x axis would get infinitely tall :S)
- Fixed overdraw when using stroke materials
This commit is contained in:
@@ -115,11 +115,13 @@ If you are interested on messing with the actual library, instead of importing t
|
||||
|
||||
### Change Log ###
|
||||
|
||||
2010 06 20 - **r9** (23.641 kb)
|
||||
2010 06 20 - **r9** (23.753 kb)
|
||||
|
||||
* JSLinted
|
||||
* autoClear property for renderers.
|
||||
* Removed SVG rgba() workaround for WebKit. (WebKit now supports it)
|
||||
* Fixed matrix bug (transformed objects outside the x axis would get infinitely tall :S)
|
||||
* Fixed overdraw when using stroke materials
|
||||
|
||||
|
||||
2010 06 06 - **r8** (23.496 kb)
|
||||
|
||||
+1
-1
File diff suppressed because one or more lines are too long
@@ -11,7 +11,6 @@ THREE.Camera = function ( x, y, z ) {
|
||||
this.projectionMatrix = THREE.Matrix4.makePerspective( 45, 1 /*SCREEN_WIDTH/SCREEN_HEIGHT*/, 0.001, 1000 );
|
||||
|
||||
this.up = new THREE.Vector3( 0, 1, 0 );
|
||||
this.roll = 0;
|
||||
|
||||
// TODO: Need to remove this
|
||||
this.zoom = 3;
|
||||
|
||||
+1
-1
@@ -89,7 +89,7 @@ THREE.Matrix4 = function () {
|
||||
|
||||
this.n21 = a.n21 * b.n11 + a.n22 * b.n21 + a.n23 * b.n31 + a.n24 * b.n41;
|
||||
this.n22 = a.n21 * b.n12 + a.n22 * b.n22 + a.n23 * b.n32 + a.n24 * b.n42;
|
||||
this.n23 = a.n21 * b.n13 + a.n22 * b.n23 + a.n23 * b.n33 + a.n24 * b.n34;
|
||||
this.n23 = a.n21 * b.n13 + a.n22 * b.n23 + a.n23 * b.n33 + a.n24 * b.n43;
|
||||
this.n24 = a.n21 * b.n14 + a.n22 * b.n24 + a.n23 * b.n34 + a.n24 * b.n44;
|
||||
|
||||
this.n31 = a.n31 * b.n11 + a.n32 * b.n21 + a.n33 * b.n31 + a.n34 * b.n41;
|
||||
|
||||
+111
-99
@@ -46,9 +46,13 @@ THREE.CanvasRenderer = function () {
|
||||
suv1 = new THREE.Vector2(), suv2 = new THREE.Vector2(), suv3 = new THREE.Vector2(),
|
||||
suv1x, suv1y, suv2x, suv2y, suv3x, suv3y, denom, m11, m12, m21, m22, dx, dy,
|
||||
bitmap, bitmap_width, bitmap_height,
|
||||
size;
|
||||
size, overdraw;
|
||||
|
||||
this.autoClear && this.clear();
|
||||
if ( this.autoClear ) {
|
||||
|
||||
this.clear();
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
_context.fillStyle = 'rgba(255, 255, 0, 0.5)';
|
||||
@@ -63,107 +67,115 @@ THREE.CanvasRenderer = function () {
|
||||
|
||||
element = this.renderList[ i ];
|
||||
|
||||
_bboxRect.empty();
|
||||
|
||||
_context.beginPath();
|
||||
|
||||
if ( element instanceof THREE.RenderableParticle ) {
|
||||
|
||||
size = element.size * element.screenZ;
|
||||
|
||||
_bboxRect.set( element.x - size, element.y - size, element.x + size, element.y + size );
|
||||
|
||||
if ( !_clipRect.instersects( _bboxRect ) ) {
|
||||
|
||||
continue;
|
||||
|
||||
}
|
||||
|
||||
_context.arc( element.x, element.y, size, 0, pi2, true );
|
||||
|
||||
} else if ( element instanceof THREE.RenderableLine ) {
|
||||
|
||||
v1x = element.v1.x; v1y = element.v1.y;
|
||||
v2x = element.v2.x; v2y = element.v2.y;
|
||||
|
||||
_bboxRect.addPoint( v1x, v1y );
|
||||
_bboxRect.addPoint( v2x, v2y );
|
||||
|
||||
if ( !_clipRect.instersects( _bboxRect ) ) {
|
||||
|
||||
continue;
|
||||
|
||||
}
|
||||
|
||||
_context.moveTo( v1x, v1y );
|
||||
_context.lineTo( v2x, v2y );
|
||||
|
||||
} else if ( element instanceof THREE.RenderableFace3 ) {
|
||||
|
||||
expand( element.v1, element.v2 );
|
||||
expand( element.v2, element.v3 );
|
||||
expand( element.v3, element.v1 );
|
||||
|
||||
v1x = element.v1.x; v1y = element.v1.y;
|
||||
v2x = element.v2.x; v2y = element.v2.y;
|
||||
v3x = element.v3.x; v3y = element.v3.y;
|
||||
|
||||
_bboxRect.addPoint( v1x, v1y );
|
||||
_bboxRect.addPoint( v2x, v2y );
|
||||
_bboxRect.addPoint( v3x, v3y );
|
||||
|
||||
if ( !_clipRect.instersects( _bboxRect ) ) {
|
||||
|
||||
continue;
|
||||
|
||||
}
|
||||
|
||||
_clearRect.addRectangle( _bboxRect );
|
||||
|
||||
_context.moveTo( v1x, v1y );
|
||||
_context.lineTo( v2x, v2y );
|
||||
_context.lineTo( v3x, v3y );
|
||||
_context.lineTo( v1x, v1y );
|
||||
|
||||
} else if ( element instanceof THREE.RenderableFace4 ) {
|
||||
|
||||
expand( element.v1, element.v2 );
|
||||
expand( element.v2, element.v3 );
|
||||
expand( element.v3, element.v4 );
|
||||
expand( element.v4, element.v1 );
|
||||
|
||||
v1x = element.v1.x; v1y = element.v1.y;
|
||||
v2x = element.v2.x; v2y = element.v2.y;
|
||||
v3x = element.v3.x; v3y = element.v3.y;
|
||||
v4x = element.v4.x; v4y = element.v4.y;
|
||||
|
||||
_bboxRect.addPoint( v1x, v1y );
|
||||
_bboxRect.addPoint( v2x, v2y );
|
||||
_bboxRect.addPoint( v3x, v3y );
|
||||
_bboxRect.addPoint( v4x, v4y );
|
||||
|
||||
if ( !_clipRect.instersects( _bboxRect ) ) {
|
||||
|
||||
continue;
|
||||
|
||||
}
|
||||
|
||||
_context.moveTo( v1x, v1y );
|
||||
_context.lineTo( v2x, v2y );
|
||||
_context.lineTo( v3x, v3y );
|
||||
_context.lineTo( v4x, v4y );
|
||||
_context.lineTo( v1x, v1y );
|
||||
|
||||
}
|
||||
|
||||
_context.closePath();
|
||||
|
||||
materialLength = element.material.length;
|
||||
|
||||
for ( j = 0; j < materialLength; j++ ) {
|
||||
|
||||
material = element.material[ j ];
|
||||
|
||||
overdraw = material instanceof THREE.ColorFillMaterial || material instanceof THREE.FaceColorFillMaterial || material instanceof THREE.BitmapUVMappingMaterial;
|
||||
|
||||
_bboxRect.empty();
|
||||
|
||||
_context.beginPath();
|
||||
|
||||
if ( element instanceof THREE.RenderableParticle ) {
|
||||
|
||||
size = element.size * element.screenZ;
|
||||
|
||||
_bboxRect.set( element.x - size, element.y - size, element.x + size, element.y + size );
|
||||
|
||||
if ( !_clipRect.instersects( _bboxRect ) ) {
|
||||
|
||||
continue;
|
||||
|
||||
}
|
||||
|
||||
_context.arc( element.x, element.y, size, 0, pi2, true );
|
||||
|
||||
} else if ( element instanceof THREE.RenderableLine ) {
|
||||
|
||||
v1x = element.v1.x; v1y = element.v1.y;
|
||||
v2x = element.v2.x; v2y = element.v2.y;
|
||||
|
||||
_bboxRect.addPoint( v1x, v1y );
|
||||
_bboxRect.addPoint( v2x, v2y );
|
||||
|
||||
if ( !_clipRect.instersects( _bboxRect ) ) {
|
||||
|
||||
continue;
|
||||
|
||||
}
|
||||
|
||||
_context.moveTo( v1x, v1y );
|
||||
_context.lineTo( v2x, v2y );
|
||||
|
||||
} else if ( element instanceof THREE.RenderableFace3 ) {
|
||||
|
||||
if ( overdraw ) {
|
||||
|
||||
expand( element.v1, element.v2 );
|
||||
expand( element.v2, element.v3 );
|
||||
expand( element.v3, element.v1 );
|
||||
|
||||
}
|
||||
|
||||
v1x = element.v1.x; v1y = element.v1.y;
|
||||
v2x = element.v2.x; v2y = element.v2.y;
|
||||
v3x = element.v3.x; v3y = element.v3.y;
|
||||
|
||||
_bboxRect.addPoint( v1x, v1y );
|
||||
_bboxRect.addPoint( v2x, v2y );
|
||||
_bboxRect.addPoint( v3x, v3y );
|
||||
|
||||
if ( !_clipRect.instersects( _bboxRect ) ) {
|
||||
|
||||
continue;
|
||||
|
||||
}
|
||||
|
||||
_context.moveTo( v1x, v1y );
|
||||
_context.lineTo( v2x, v2y );
|
||||
_context.lineTo( v3x, v3y );
|
||||
_context.lineTo( v1x, v1y );
|
||||
|
||||
} else if ( element instanceof THREE.RenderableFace4 ) {
|
||||
|
||||
if ( overdraw ) {
|
||||
|
||||
expand( element.v1, element.v2 );
|
||||
expand( element.v2, element.v3 );
|
||||
expand( element.v3, element.v4 );
|
||||
expand( element.v4, element.v1 );
|
||||
|
||||
}
|
||||
|
||||
v1x = element.v1.x; v1y = element.v1.y;
|
||||
v2x = element.v2.x; v2y = element.v2.y;
|
||||
v3x = element.v3.x; v3y = element.v3.y;
|
||||
v4x = element.v4.x; v4y = element.v4.y;
|
||||
|
||||
_bboxRect.addPoint( v1x, v1y );
|
||||
_bboxRect.addPoint( v2x, v2y );
|
||||
_bboxRect.addPoint( v3x, v3y );
|
||||
_bboxRect.addPoint( v4x, v4y );
|
||||
|
||||
if ( !_clipRect.instersects( _bboxRect ) ) {
|
||||
|
||||
continue;
|
||||
|
||||
}
|
||||
|
||||
_context.moveTo( v1x, v1y );
|
||||
_context.lineTo( v2x, v2y );
|
||||
_context.lineTo( v3x, v3y );
|
||||
_context.lineTo( v4x, v4y );
|
||||
_context.lineTo( v1x, v1y );
|
||||
|
||||
}
|
||||
|
||||
_context.closePath();
|
||||
|
||||
if ( material instanceof THREE.ColorFillMaterial ) {
|
||||
|
||||
_context.fillStyle = material.color.__styleString;
|
||||
@@ -244,9 +256,9 @@ THREE.CanvasRenderer = function () {
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
_clearRect.addRectangle( _bboxRect );
|
||||
|
||||
_clearRect.addRectangle( _bboxRect );
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user