未验证 提交 97daea3b 编写于 作者: M Mr.doob 提交者: GitHub

Merge pull request #20840 from linbingquan/dev-es6-defaultvalue

src: ES6 default value.
...@@ -9,12 +9,12 @@ import { VectorKeyframeTrack } from './tracks/VectorKeyframeTrack.js'; ...@@ -9,12 +9,12 @@ import { VectorKeyframeTrack } from './tracks/VectorKeyframeTrack.js';
import { MathUtils } from '../math/MathUtils.js'; import { MathUtils } from '../math/MathUtils.js';
import { NormalAnimationBlendMode } from '../constants.js'; import { NormalAnimationBlendMode } from '../constants.js';
function AnimationClip( name, duration, tracks, blendMode ) { function AnimationClip( name, duration = - 1, tracks, blendMode = NormalAnimationBlendMode ) {
this.name = name; this.name = name;
this.tracks = tracks; this.tracks = tracks;
this.duration = ( duration !== undefined ) ? duration : - 1; this.duration = duration;
this.blendMode = ( blendMode !== undefined ) ? blendMode : NormalAnimationBlendMode; this.blendMode = blendMode;
this.uuid = MathUtils.generateUUID(); this.uuid = MathUtils.generateUUID();
......
import { Camera } from './Camera.js'; import { Camera } from './Camera.js';
import { Object3D } from '../core/Object3D.js'; import { Object3D } from '../core/Object3D.js';
function OrthographicCamera( left, right, top, bottom, near, far ) { function OrthographicCamera( left = - 1, right = 1, top = 1, bottom = - 1, near = 0.1, far = 2000 ) {
Camera.call( this ); Camera.call( this );
...@@ -10,13 +10,13 @@ function OrthographicCamera( left, right, top, bottom, near, far ) { ...@@ -10,13 +10,13 @@ function OrthographicCamera( left, right, top, bottom, near, far ) {
this.zoom = 1; this.zoom = 1;
this.view = null; this.view = null;
this.left = ( left !== undefined ) ? left : - 1; this.left = left;
this.right = ( right !== undefined ) ? right : 1; this.right = right;
this.top = ( top !== undefined ) ? top : 1; this.top = top;
this.bottom = ( bottom !== undefined ) ? bottom : - 1; this.bottom = bottom;
this.near = ( near !== undefined ) ? near : 0.1; this.near = near;
this.far = ( far !== undefined ) ? far : 2000; this.far = far;
this.updateProjectionMatrix(); this.updateProjectionMatrix();
......
...@@ -13,7 +13,7 @@ const _inverseMatrix = new Matrix4(); ...@@ -13,7 +13,7 @@ const _inverseMatrix = new Matrix4();
const _ray = new Ray(); const _ray = new Ray();
const _sphere = new Sphere(); const _sphere = new Sphere();
function Line( geometry, material, mode ) { function Line( geometry = new BufferGeometry(), material = new LineBasicMaterial(), mode ) {
if ( mode === 1 ) { if ( mode === 1 ) {
...@@ -25,8 +25,8 @@ function Line( geometry, material, mode ) { ...@@ -25,8 +25,8 @@ function Line( geometry, material, mode ) {
this.type = 'Line'; this.type = 'Line';
this.geometry = geometry !== undefined ? geometry : new BufferGeometry(); this.geometry = geometry;
this.material = material !== undefined ? material : new LineBasicMaterial(); this.material = material;
this.updateMorphTargets(); this.updateMorphTargets();
......
...@@ -33,14 +33,14 @@ const _uvC = new Vector2(); ...@@ -33,14 +33,14 @@ const _uvC = new Vector2();
const _intersectionPoint = new Vector3(); const _intersectionPoint = new Vector3();
const _intersectionPointWorld = new Vector3(); const _intersectionPointWorld = new Vector3();
function Mesh( geometry, material ) { function Mesh( geometry = new BufferGeometry(), material = new MeshBasicMaterial() ) {
Object3D.call( this ); Object3D.call( this );
this.type = 'Mesh'; this.type = 'Mesh';
this.geometry = geometry !== undefined ? geometry : new BufferGeometry(); this.geometry = geometry;
this.material = material !== undefined ? material : new MeshBasicMaterial(); this.material = material;
this.updateMorphTargets(); this.updateMorphTargets();
......
...@@ -11,14 +11,14 @@ const _ray = new Ray(); ...@@ -11,14 +11,14 @@ const _ray = new Ray();
const _sphere = new Sphere(); const _sphere = new Sphere();
const _position = new Vector3(); const _position = new Vector3();
function Points( geometry, material ) { function Points( geometry = new BufferGeometry(), material = new PointsMaterial() ) {
Object3D.call( this ); Object3D.call( this );
this.type = 'Points'; this.type = 'Points';
this.geometry = geometry !== undefined ? geometry : new BufferGeometry(); this.geometry = geometry;
this.material = material !== undefined ? material : new PointsMaterial(); this.material = material;
this.updateMorphTargets(); this.updateMorphTargets();
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册