提交 5e9a9419 编写于 作者: A alteredq

Merge remote-tracking branch 'remotes/WestLangley/dev' into dev

/**
* @author WestLangley / https://github.com/WestLangley
* @author zz85 / https://github.com/zz85
*/
THREE.ArrowHelper = function ( origin, dir, length, hex ) {
THREE.Object3D.call( this );
var lineGeometry = new THREE.Geometry();
lineGeometry.vertices.push( new THREE.Vertex() );
lineGeometry.vertices.push( new THREE.Vertex( new THREE.Vector3( 0, 1, 0 ) ) );
line = new THREE.Line( lineGeometry, new THREE.LineBasicMaterial( { color : hex } ) );
this.add( line );
var coneGeometry = new THREE.CylinderGeometry( 0, 0.05, 0.25, 5, 1 );
cone = new THREE.Mesh( coneGeometry, new THREE.MeshBasicMaterial( { color : hex } ) );
cone.position.set( 0, 1, 0 );
this.add( cone );
this.position = origin;
this.setDirection( dir );
this.setLength( length );
};
THREE.ArrowHelper.prototype = new THREE.Object3D();
THREE.ArrowHelper.prototype.constructor = THREE.ArrowHelper;
THREE.ArrowHelper.prototype.setDirection = function( dir ) {
var axis = new THREE.Vector3( 0, 1, 0 ).crossSelf( dir );
var radians = Math.acos( new THREE.Vector3( 0, 1, 0 ).dot( dir.clone().normalize() ) );
this.matrix = new THREE.Matrix4().setRotationAxis( axis.normalize(), radians );
this.rotation.getRotationFromMatrix( this.matrix, this.scale );
};
THREE.ArrowHelper.prototype.setLength = function( length ) {
this.scale.set( length, length, length );
};
THREE.ArrowHelper.prototype.setColor = function( hex ) {
this.children[0].material.color.setHex( hex );
this.children[1].material.color.setHex( hex );
};
......@@ -558,8 +558,11 @@ THREE.ShaderChunk = {
"#ifdef PHYSICALLY_BASED_SHADING",
"vec3 schlick = specular + vec3( 1.0 - specular ) * pow( dot( lVector, pointHalfVector ), 5.0 );",
"pointSpecular += schlick * pointLightColor[ i ] * pointSpecularWeight * pointDiffuseWeight * lDistance;",
// normalization factor
"float specularNormalization = ( shininess + 2.0 ) / 8.0;",
"vec3 schlick = specular + vec3( 1.0 - specular ) * pow( 1.0 - dot( lVector, pointHalfVector ), 5.0 );",
"pointSpecular += schlick * pointLightColor[ i ] * pointSpecularWeight * pointDiffuseWeight * lDistance * specularNormalization;",
"#else",
......@@ -628,12 +631,12 @@ THREE.ShaderChunk = {
*/
// normalization factor
//float specularNormalization = ( shininess + 2.0 ) / 8.0;
"float specularNormalization = ( shininess + 2.0 ) / 8.0;",
//"dirSpecular += specular * directionalLightColor[ i ] * dirSpecularWeight * dirDiffuseWeight * specularNormalization * fresnel;",
"vec3 schlick = specular + vec3( 1.0 - specular ) * pow( dot( dirVector, dirHalfVector ), 5.0 );",
"dirSpecular += schlick * directionalLightColor[ i ] * dirSpecularWeight * dirDiffuseWeight;",
"vec3 schlick = specular + vec3( 1.0 - specular ) * pow( 1.0 - dot( dirVector, dirHalfVector ), 5.0 );",
"dirSpecular += schlick * directionalLightColor[ i ] * dirSpecularWeight * dirDiffuseWeight * specularNormalization;",
"#else",
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册