Babylonjs笔记——相机和粒子系统源码部分

babylonjs中arcrotateCamera和粒子系统的部分源码注释,感觉babylonjs有个不好的就是源码没有什么注释,有些变量根本就不知道是什么意思,要自己一个个试。

一。ArcRotateCamera相机构造函数中成员变量注释,没用专业名词, 全是自己的话

            this.alpha = alpha;//相机绕y轴旋转的角度
            this.beta = beta;//相机绕x轴旋转的角度
            this.radius = radius;//视野半径
            this.target = target;//目标
            this.inertialAlphaOffset = 0;//绕y轴旋转偏移量
            this.inertialBetaOffset = 0;//绕x轴旋转偏移量,用于限制旋转角度
            this.inertialRadiusOffset = 0;//视野范围偏移量
            this.lowerAlphaLimit = null;//
            this.upperAlphaLimit = null;
            this.lowerBetaLimit = 0.01;//
            this.upperBetaLimit = Math.PI;//从y的正半轴可绕x轴旋转最大角度
            this.lowerRadiusLimit = null;//视点拉近的最大距离,用于限制视野范围
            this.upperRadiusLimit = null;//视点拉远的最大距离
            this.angularSensibilityX = 1000.0;
            this.angularSensibilityY = 1000.0;
            this.wheelPrecision = 3.0;
            this.pinchPrecision = 2.0;
            this.panningSensibility = 50.0;//平移系数
            this.inertialPanningX = 0;
            this.inertialPanningY = 0;
            this.keysUp = [38];
            this.keysDown = [40];
            this.keysLeft = [37];
            this.keysRight = [39];
            this.zoomOnFactor = 1;
            this.targetScreenOffset = BABYLON.Vector2.Zero();
            this.pinchInwards = true;
            this.allowUpsideDown = true;
            this._keys = [];
            this._viewMatrix = new BABYLON.Matrix();
            // Panning
            this.panningAxis = new BABYLON.Vector3(1, 1, 0);
            this._isRightClick = false;
            this._isCtrlPushed = false;//ctrl键盘:ctrl+鼠标任意键为拖拽
            this.checkCollisions = false;//碰撞检测
            this.collisionRadius = new BABYLON.Vector3(0.5, 0.5, 0.5);//碰撞检测的半径
            this._collider = new BABYLON.Collider();
            this._previousPosition = BABYLON.Vector3.Zero();
            this._collisionVelocity = BABYLON.Vector3.Zero();
            this._newPosition = BABYLON.Vector3.Zero();

二粒子系统ParticleSystem,构造函数中的成员变量注释

            this.animations = [];//动画
            this.renderingGroupId = 0;
            this.emitter = null;//发射器
            this.emitRate = 10;//发射速率,不是粒子的速度,是粒子系统单位时间内发射多少粒子
            this.manualEmitCount = -1;
            this.updateSpeed = 0.01;更新速率
            this.targetStopDuration = 0;
            this.disposeOnStop = false;
            this.minEmitPower = 1;最小发射力量
            this.maxEmitPower = 1;最大发射力量
            this.minLifeTime = 1;粒子的最小生命周期
            this.maxLifeTime = 1;粒子的最大生命周期
            this.minSize = 1;粒子的最小尺寸
            this.maxSize = 1;粒子的最大尺寸
            this.minAngularSpeed = 0;
            this.maxAngularSpeed = 0;
            this.layerMask = 0x0FFFFFFF;
            this.blendMode = ParticleSystem.BLENDMODE_ONEONE;
            this.forceDepthWrite = false;
            this.gravity = BABYLON.Vector3.Zero();重力
            this.direction1 = new BABYLON.Vector3(0, 1.0, 0);粒子的发射方向,是相对于发射器的方向!!!不是相对于场景中的方向
            this.direction2 = new BABYLON.Vector3(0, 1.0, 0);粒子的发射方向2,同上
            this.minEmitBox = new BABYLON.Vector3(-0.5, -0.5, -0.5);发射器中最小的发射部位;比如一个长方体的左下前角
            this.maxEmitBox = new BABYLON.Vector3(0.5, 0.5, 0.5);发射器中最大的发射部分:比如长方体发射器的右(x)上(y)后(z)角
            this.color1 = new BABYLON.Color4(1.0, 1.0, 1.0, 1.0);粒子的颜色
            this.color2 = new BABYLON.Color4(1.0, 1.0, 1.0, 1.0);
            this.colorDead = new BABYLON.Color4(0, 0, 0, 1.0);
            this.textureMask = new BABYLON.Color4(1.0, 1.0, 1.0, 1.0);
            this.particles = new Array();
            this._vertexDeclaration = [3, 4, 4];
            this._vertexStrideSize = 11 * 4; // 11 floats per particle (x, y, z, r, g, b, a, angle, size, offsetX, offsetY)
            this._stockParticles = new Array();
            this._newPartsExcess = 0;
            this._scaledColorStep = new BABYLON.Color4(0, 0, 0, 0);
            this._colorDiff = new BABYLON.Color4(0, 0, 0, 0);
            this._scaledDirection = BABYLON.Vector3.Zero();
            this._scaledGravity = BABYLON.Vector3.Zero();
            this._currentRenderId = -1;
            this._started = false;
            this._stopped = false;
            this._actualFrame = 0;
            this.id = name;
            this._capacity = capacity;粒子的数量
            this._scene = scene;
            this._customEffect = customEffect;

你可能感兴趣的:(WebGL,ParticleSystem,BabylonJS,ArcRotateCamera,相机粒子系统)