2021SC@SDUSC
目录
(接上篇)
ParticleRenderable.js
3.函数
function(){
this.geometry = new Geometry({
dynamic: true
});
if (!this.material) {
this.material = new Material({
shader: particleShader,
transparent: true,
depthMask: false
});
this.material.enableTexture('sprite');
}
this._particles = [];
this._fields = [];
this._emitters = [];
},
this.geometry = new Geometry({
dynamic: true
});
可以看见,该部分首先将其几何动态属性设为true;
if (!this.material) {
this.material = new Material({
shader: particleShader,
transparent: true,
depthMask: false
});
this.material.enableTexture('sprite');
}
然后,判断目前材质是否存在,若是不存在,则新建材质,
其中渲染器模式为粒子渲染器(particleShader);
透明属性为true,此处应该是因为粒子是利用纹理贴图,故物体本身可设置透明;
最后设置不启用深度遮罩。接着设置材料的enableTexture的标签为sprite;
this._particles = [];
this._fields = [];
this._emitters = [];
最后将粒子、力场和发射器组初始为空。
4、另一对象
接着上述函数后其内部的又一对象。
4.1 属性
culling: false,
frustumCulling: false,
castShadow: false,
receiveShadow: false,
依次为剔除、视锥体剔除、投射阴影、接收阴影,全设置为不启用。
(待续)