mirror of
https://github.com/wahyd4/three.js.git
synced 2026-08-27 22:05:58 +10:00
Merged with latest changes in mrdoob's branch. All hex colors should be now without baked opacity.
This commit is contained in:
+1
-7
@@ -4,12 +4,6 @@
|
||||
|
||||
THREE.Color = function ( hex ) {
|
||||
|
||||
/*
|
||||
this.r; this.g; this.b; this.a;
|
||||
this.hex;
|
||||
this.__styleString;
|
||||
*/
|
||||
|
||||
this.autoUpdate = true;
|
||||
this.setHex( hex );
|
||||
|
||||
@@ -73,7 +67,7 @@ THREE.Color.prototype = {
|
||||
|
||||
updateHex: function () {
|
||||
|
||||
this.hex = Math.floor( this.a * 255 ) << 24 | Math.floor( this.r * 255 ) << 16 | Math.floor( this.g * 255 ) << 8 | Math.floor( this.b * 255 );
|
||||
this.hex = Math.floor( this.a * 255 ) << 24 ^ Math.floor( this.r * 255 ) << 16 ^ Math.floor( this.g * 255 ) << 8 ^ Math.floor( this.b * 255 );
|
||||
|
||||
},
|
||||
|
||||
|
||||
+2
-2
@@ -552,7 +552,7 @@ THREE.Loader.prototype = {
|
||||
|
||||
} else {
|
||||
|
||||
material = new THREE.MeshColorFillMaterial( 0xffeeeeee );
|
||||
material = new THREE.MeshColorFillMaterial( 0xeeeeee );
|
||||
|
||||
}
|
||||
|
||||
@@ -848,7 +848,7 @@ THREE.Loader.prototype = {
|
||||
|
||||
} else {
|
||||
|
||||
material = new THREE.MeshColorFillMaterial( 0xffeeeeee );
|
||||
material = new THREE.MeshColorFillMaterial( 0xeeeeee );
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -5,8 +5,7 @@
|
||||
THREE.LineColorMaterial = function ( hex, opacity, lineWidth ) {
|
||||
|
||||
this.lineWidth = lineWidth || 1;
|
||||
|
||||
this.color = new THREE.Color( ( opacity >= 0 ? ( opacity * 0xff ) << 24 : 0xff000000 ) | hex );
|
||||
this.color = new THREE.Color( ( opacity !== undefined ? opacity : 1 ) * 0xff << 24 ^ hex );
|
||||
|
||||
};
|
||||
|
||||
|
||||
@@ -4,11 +4,11 @@
|
||||
|
||||
THREE.MeshBitmapMaterial = function ( bitmap, mode ) {
|
||||
|
||||
this.id = THREE.MeshBitmapMaterialCounter.value ++;
|
||||
|
||||
this.bitmap = bitmap;
|
||||
this.mode = mode || THREE.MeshBitmapMaterialMode.UVMAPPING;
|
||||
|
||||
this.id = THREE.MeshBitmapMaterialCounter.value++;
|
||||
|
||||
|
||||
this.toString = function () {
|
||||
|
||||
return 'THREE.MeshBitmapMaterial ( bitmap: ' + this.bitmap + ', mode: ' + this.mode + ', id: ' + this.id + ' )';
|
||||
@@ -17,6 +17,5 @@ THREE.MeshBitmapMaterial = function ( bitmap, mode ) {
|
||||
|
||||
};
|
||||
|
||||
THREE.MeshBitmapMaterialCounter = { value:0 };
|
||||
|
||||
THREE.MeshBitmapMaterialCounter = { value: 0 };
|
||||
THREE.MeshBitmapMaterialMode = { UVMAPPING: 0 };
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
|
||||
THREE.MeshColorFillMaterial = function ( hex, opacity ) {
|
||||
|
||||
this.color = new THREE.Color( ( opacity >= 0 ? ( opacity * 0xff ) << 24 : 0xff000000 ) | hex );
|
||||
this.color = new THREE.Color( ( opacity !== undefined ? opacity : 1 ) * 0xff << 24 ^ hex );
|
||||
|
||||
this.toString = function () {
|
||||
|
||||
|
||||
@@ -6,7 +6,7 @@ THREE.MeshColorStrokeMaterial = function ( hex, opacity, lineWidth ) {
|
||||
|
||||
this.lineWidth = lineWidth || 1;
|
||||
|
||||
this.color = new THREE.Color( ( opacity >= 0 ? ( opacity * 0xff ) << 24 : 0xff000000 ) | hex );
|
||||
this.color = new THREE.Color( ( opacity !== undefined ? opacity : 1 ) * 0xff << 24 ^ hex );
|
||||
|
||||
this.toString = function () {
|
||||
|
||||
|
||||
@@ -4,11 +4,12 @@
|
||||
|
||||
THREE.MeshPhongMaterial = function ( ambient, diffuse, specular, shininess, opacity ) {
|
||||
|
||||
this.ambient = new THREE.Color( ( opacity >= 0 ? ( opacity * 0xff ) << 24 : 0xff000000 ) | ambient );
|
||||
this.diffuse = new THREE.Color( ( opacity >= 0 ? ( opacity * 0xff ) << 24 : 0xff000000 ) | diffuse );
|
||||
this.specular = new THREE.Color( ( opacity >= 0 ? ( opacity * 0xff ) << 24 : 0xff000000 ) | specular );
|
||||
this.shininess = shininess;
|
||||
this.opacity = opacity;
|
||||
this.ambient = new THREE.Color( ( opacity !== undefined ? opacity : 1 ) * 0xff << 24 ^ ambient );
|
||||
this.diffuse = new THREE.Color( ( opacity !== undefined ? opacity : 1 ) * 0xff << 24 ^ diffuse );
|
||||
this.specular = new THREE.Color( ( opacity !== undefined ? opacity : 1 ) * 0xff << 24 ^ specular );
|
||||
|
||||
this.shininess = shininess;
|
||||
this.opacity = opacity;
|
||||
|
||||
this.toString = function () {
|
||||
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
|
||||
THREE.ParticleCircleMaterial = function ( hex, opacity ) {
|
||||
|
||||
this.color = new THREE.Color( ( opacity >= 0 ? ( opacity * 0xff ) << 24 : 0xff000000 ) | hex );
|
||||
this.color = new THREE.Color( ( opacity !== undefined ? opacity : 1 ) * 0xff << 24 ^ hex );
|
||||
|
||||
this.toString = function () {
|
||||
|
||||
|
||||
+12
-11
@@ -52,7 +52,7 @@ THREE.Mesh.prototype.sortFacesByMaterial = function () {
|
||||
|
||||
}
|
||||
|
||||
return hash_array.join("_");
|
||||
return hash_array.join( '_' );
|
||||
|
||||
}
|
||||
|
||||
@@ -60,40 +60,41 @@ THREE.Mesh.prototype.sortFacesByMaterial = function () {
|
||||
|
||||
face = this.geometry.faces[ f ];
|
||||
material = face.material;
|
||||
|
||||
|
||||
mhash = materialHash( material );
|
||||
|
||||
if ( hash_map[ mhash ] == undefined ) {
|
||||
|
||||
|
||||
hash_map[ mhash ] = { 'hash': mhash, 'counter': 0 };
|
||||
|
||||
}
|
||||
|
||||
ghash = hash_map[ mhash ].hash + "_" + hash_map[ mhash ].counter;
|
||||
ghash = hash_map[ mhash ].hash + '_' + hash_map[ mhash ].counter;
|
||||
|
||||
if ( this.materialFaceGroup[ ghash ] == undefined ) {
|
||||
|
||||
this.materialFaceGroup[ ghash ] = { 'faces': [], 'material': material, 'vertices': 0 };
|
||||
|
||||
}
|
||||
|
||||
|
||||
vertices = face instanceof THREE.Face3 ? 3 : 4;
|
||||
|
||||
if ( this.materialFaceGroup[ ghash ].vertices + vertices > 65535 ) {
|
||||
|
||||
|
||||
hash_map[ mhash ].counter += 1;
|
||||
ghash = hash_map[ mhash ].hash + "_" + hash_map[ mhash ].counter;
|
||||
|
||||
ghash = hash_map[ mhash ].hash + '_' + hash_map[ mhash ].counter;
|
||||
|
||||
if ( this.materialFaceGroup[ ghash ] == undefined ) {
|
||||
|
||||
this.materialFaceGroup[ ghash ] = { 'faces': [], 'material': material, 'vertices': 0 };
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
this.materialFaceGroup[ ghash ].faces.push( f );
|
||||
this.materialFaceGroup[ ghash ].vertices += vertices;
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
+6
-12
@@ -15,14 +15,11 @@ THREE.Scene = function () {
|
||||
|
||||
this.removeObject = function ( object ) {
|
||||
|
||||
for ( var i = 0, l = this.objects.length; i < l; i++ ) {
|
||||
var i = this.objects.indexOf( object );
|
||||
|
||||
if ( object == this.objects[ i ] ) {
|
||||
if ( i !== -1 ) {
|
||||
|
||||
this.objects.splice( i, 1 );
|
||||
return;
|
||||
|
||||
}
|
||||
this.objects.splice( i, 1 );
|
||||
|
||||
}
|
||||
|
||||
@@ -36,14 +33,11 @@ THREE.Scene = function () {
|
||||
|
||||
this.removeLight = function ( light ) {
|
||||
|
||||
for ( var i = 0, l = this.lights.length; i < l; i++ ) {
|
||||
var i = this.lights.indexOf( light );
|
||||
|
||||
if ( light == this.lights[ i ] ) {
|
||||
if ( i !== -1 ) {
|
||||
|
||||
this.lights.splice( i, 1 );
|
||||
return;
|
||||
|
||||
}
|
||||
this.lights.splice( i, 1 );
|
||||
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user