Skip to content

Commit

Permalink
- Added Mesh.flipSided boolean
Browse files Browse the repository at this point in the history
  • Loading branch information
mrdoob committed Jul 19, 2010
1 parent 2c9c52d commit 5ff2dfc
Show file tree
Hide file tree
Showing 6 changed files with 13 additions and 8 deletions.
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ Thanks to the power of the internets (and github <3) these people have kindly he

### Change Log ###

2010 07 17 - **r14** (32.093 kb)
2010 07 17 - **r14** (32.144 kb)

* Refactored `CanvasRenderer` (more duplicated code, but easier to handle)
* `Face4` now supports `MeshBitmapUVMappingMaterial`
Expand All @@ -142,6 +142,7 @@ Thanks to the power of the internets (and github <3) these people have kindly he
* `ColorStrokeMaterial` > `LineColorMaterial`
* `Rectangle.instersects` returned false with rectangles with 0px witdh or height
* Using new object `UV` instead of `Vector2` where it should be used
* Added Mesh.flipSided boolean (false by default)


2010 07 12 - **r13** (29.492 kb)
Expand Down
2 changes: 1 addition & 1 deletion build/three.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion build/three_debug.js

Large diffs are not rendered by default.

3 changes: 3 additions & 0 deletions src/objects/Mesh.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,11 @@ THREE.Mesh = function ( geometry, material ) {

this.geometry = geometry;

this.flipSided = false;
this.doubleSided = false;

this.overdraw = false;

};

THREE.Mesh.prototype = new THREE.Object3D();
Expand Down
1 change: 0 additions & 1 deletion src/objects/Object3D.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ THREE.Object3D = function ( material ) {
this.screen = new THREE.Vector3();

this.material = material instanceof Array ? material : [ material ];
this.overdraw = false;

this.autoUpdateMatrix = true;

Expand Down
10 changes: 6 additions & 4 deletions src/renderers/Renderer.js
Original file line number Diff line number Diff line change
Expand Up @@ -74,9 +74,10 @@ THREE.Renderer = function() {
v2 = object.geometry.vertices[ face.b ];
v3 = object.geometry.vertices[ face.c ];

if ( v1.__visible && v2.__visible && v3.__visible && ( object.doubleSided ||
if ( v1.__visible && v2.__visible && v3.__visible &&
( object.doubleSided || ( object.flipSided !=
( v3.screen.x - v1.screen.x ) * ( v2.screen.y - v1.screen.y ) -
( v3.screen.y - v1.screen.y ) * ( v2.screen.x - v1.screen.x ) < 0 ) ) {
( v3.screen.y - v1.screen.y ) * ( v2.screen.x - v1.screen.x ) < 0 ) ) ) {

if ( !face3Pool[ face3count ] ) {

Expand Down Expand Up @@ -106,11 +107,12 @@ THREE.Renderer = function() {
v3 = object.geometry.vertices[ face.c ];
v4 = object.geometry.vertices[ face.d ];

if ( v1.__visible && v2.__visible && v3.__visible && v4.__visible && (object.doubleSided ||
if ( v1.__visible && v2.__visible && v3.__visible && v4.__visible &&
( object.doubleSided || ( object.flipSided !=
( ( v4.screen.x - v1.screen.x ) * ( v2.screen.y - v1.screen.y ) -
( v4.screen.y - v1.screen.y ) * ( v2.screen.x - v1.screen.x ) < 0 ||
( v2.screen.x - v3.screen.x ) * ( v4.screen.y - v3.screen.y ) -
( v2.screen.y - v3.screen.y ) * ( v4.screen.x - v3.screen.x ) < 0 ) ) ) {
( v2.screen.y - v3.screen.y ) * ( v4.screen.x - v3.screen.x ) < 0 ) ) ) ) {

if ( !face4Pool[ face4count ] ) {

Expand Down

0 comments on commit 5ff2dfc

Please sign in to comment.