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