mirror of
https://github.com/wahyd4/three.js.git
synced 2026-08-26 05:15:58 +10:00
Previous commit: Matrix4.transform ⟶ Matrix4.transformVector3 and Matrix4.tranformVector4
This commit fixes what that change broke. Removed chromatic distortion from WebGL reflection/refraction.
This commit is contained in:
@@ -145,7 +145,7 @@
|
||||
|
||||
} else {
|
||||
|
||||
var position = new THREE.Vector3().add( intersects[ 0 ].point, intersects[ 0 ].object.rotationMatrix.transform( intersects[ 0 ].face.normal.clone() ) );
|
||||
var position = new THREE.Vector3().add( intersects[ 0 ].point, intersects[ 0 ].object.rotationMatrix.transformVector3( intersects[ 0 ].face.normal.clone() ) );
|
||||
|
||||
var voxel = new THREE.Mesh( new Cube( 50, 50, 50 ), [ new THREE.MeshLambertMaterial( { color: 0x00ff80, opacity: 1, shading: THREE.FlatShading } ), new THREE.MeshFaceMaterial() ] );
|
||||
voxel.position.x = Math.floor( position.x / 50 ) * 50 + 25;
|
||||
|
||||
@@ -60,6 +60,8 @@ THREE.Matrix4.prototype = {
|
||||
|
||||
v.multiplyScalar( 1 / ( this.n41 * vx + this.n42 * vy + this.n43 * vz + this.n44 ) );
|
||||
|
||||
return v;
|
||||
|
||||
},
|
||||
|
||||
transformVector4: function ( v ) {
|
||||
@@ -71,6 +73,8 @@ THREE.Matrix4.prototype = {
|
||||
v.z = this.n31 * vx + this.n32 * vy + this.n33 * vz + this.n34 * vw;
|
||||
v.w = this.n41 * vx + this.n42 * vy + this.n43 * vz + this.n44 * vw;
|
||||
|
||||
return v;
|
||||
|
||||
},
|
||||
|
||||
crossVector: function ( a ) {
|
||||
|
||||
+5
-5
@@ -52,12 +52,12 @@ THREE.Ray.prototype = {
|
||||
origin = this.origin.clone();
|
||||
direction = this.direction.clone();
|
||||
|
||||
a = object.matrix.transform( vertices[ face.a ].position.clone() );
|
||||
b = object.matrix.transform( vertices[ face.b ].position.clone() );
|
||||
c = object.matrix.transform( vertices[ face.c ].position.clone() );
|
||||
d = face instanceof THREE.Face4 ? object.matrix.transform( vertices[ face.d ].position.clone() ) : null;
|
||||
a = object.matrix.transformVector3( vertices[ face.a ].position.clone() );
|
||||
b = object.matrix.transformVector3( vertices[ face.b ].position.clone() );
|
||||
c = object.matrix.transformVector3( vertices[ face.c ].position.clone() );
|
||||
d = face instanceof THREE.Face4 ? object.matrix.transformVector3( vertices[ face.d ].position.clone() ) : null;
|
||||
|
||||
normal = object.rotationMatrix.transform( face.normal.clone() );
|
||||
normal = object.rotationMatrix.transformVector3( face.normal.clone() );
|
||||
dot = direction.dot( normal );
|
||||
|
||||
if ( dot < 0 ) { // Math.abs( dot ) > 0.0001
|
||||
|
||||
@@ -22,7 +22,7 @@ var GeometryUtils = {
|
||||
|
||||
var vertexCopy = new THREE.Vertex( vertex.position.clone() );
|
||||
|
||||
isMesh && object2.matrix.transform( vertexCopy.position );
|
||||
isMesh && object2.matrix.transformVector3( vertexCopy.position );
|
||||
|
||||
vertices1.push( vertexCopy );
|
||||
|
||||
|
||||
@@ -285,13 +285,13 @@ THREE.Projector = function() {
|
||||
|
||||
_projScreenMatrix.transformVector4( _vector4 );
|
||||
|
||||
_vector4.multiplyScalar( 1 / _vector4.w );
|
||||
_vector4.z /= _vector4.w;
|
||||
|
||||
if ( _vector4.z > 0 && _vector4.z < 1 ) {
|
||||
|
||||
_particle = _particlePool[ _particleCount ] = _particlePool[ _particleCount ] || new THREE.RenderableParticle();
|
||||
_particle.x = _vector4.x;
|
||||
_particle.y = _vector4.y;
|
||||
_particle.x = _vector4.x / _vector4.w;
|
||||
_particle.y = _vector4.y / _vector4.w;
|
||||
_particle.z = _vector4.z;
|
||||
|
||||
_particle.rotation = object.rotation.z;
|
||||
|
||||
@@ -923,10 +923,10 @@ THREE.WebGLRenderer = function ( scene ) {
|
||||
|
||||
"if ( enableCubeMap ) {",
|
||||
|
||||
// "cubeColor = textureCube( tCube, vec3( -vReflect.x, vReflect.yz ) );",
|
||||
"cubeColor.r = textureCube( tCube, vec3( -vReflect.x, vReflect.yz ) ).r;",
|
||||
"cubeColor.g = textureCube( tCube, vec3( -vReflect.x + 0.005, vReflect.yz ) ).g;",
|
||||
"cubeColor.b = textureCube( tCube, vec3( -vReflect.x + 0.01, vReflect.yz ) ).b;",
|
||||
"cubeColor = textureCube( tCube, vec3( -vReflect.x, vReflect.yz ) );",
|
||||
// "cubeColor.r = textureCube( tCube, vec3( -vReflect.x, vReflect.yz ) ).r;",
|
||||
// "cubeColor.g = textureCube( tCube, vec3( -vReflect.x + 0.005, vReflect.yz ) ).g;",
|
||||
// "cubeColor.b = textureCube( tCube, vec3( -vReflect.x + 0.01, vReflect.yz ) ).b;",
|
||||
|
||||
"}",
|
||||
|
||||
|
||||
+1
-1
@@ -144,7 +144,7 @@ def buildExtras(debug):
|
||||
]
|
||||
|
||||
build(files, debug, 'ThreeExtras')
|
||||
|
||||
|
||||
def buildFull(debug):
|
||||
files = [
|
||||
'Three.js',
|
||||
|
||||
+1
-1
@@ -1,7 +1,7 @@
|
||||
#!/bin/sh
|
||||
|
||||
python build.py
|
||||
python build.py --debug
|
||||
python build.py --extras
|
||||
python build.py --debug
|
||||
|
||||
# python build.py --help
|
||||
|
||||
Reference in New Issue
Block a user