mirror of
https://github.com/cocos/cocos4.git
synced 2026-11-21 08:02:39 +08:00
change particle inspector layout (#4384)
This commit is contained in:
@@ -1,8 +1,8 @@
|
||||
import { color4, pseudoRandom } from '../../../../core/vmath';
|
||||
import { CCClass } from '../../../../core/data';
|
||||
import GradientRange from './gradient-range';
|
||||
import { property, ccclass } from '../../../../core/data/class-decorator';
|
||||
import { ccclass, property } from '../../../../core/data/class-decorator';
|
||||
import { color4, pseudoRandom } from '../../../../core/vmath';
|
||||
import Particle from '../particle';
|
||||
import GradientRange from './gradient-range';
|
||||
|
||||
// tslint:disable: max-line-length
|
||||
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
import { lerp } from '../../../../core/vmath';
|
||||
import { Enum } from '../../../../core/value-types';
|
||||
import { AnimationCurve } from '../../../geom-utils';
|
||||
import { CCClass } from '../../../../core/data';
|
||||
import { property, ccclass } from '../../../../core/data/class-decorator';
|
||||
import { ccclass, property } from '../../../../core/data/class-decorator';
|
||||
import { Enum } from '../../../../core/value-types';
|
||||
import { lerp } from '../../../../core/vmath';
|
||||
import { AnimationCurve } from '../../../geom-utils';
|
||||
|
||||
export const Mode = Enum({
|
||||
Constant: 0,
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
import { vec3, quat, pseudoRandom } from '../../../../core/vmath';
|
||||
import { CCClass } from '../../../../core/data';
|
||||
import { ccclass, property } from '../../../../core/data/class-decorator';
|
||||
import { pseudoRandom, quat, vec3 } from '../../../../core/vmath';
|
||||
import { calculateTransform, Space } from '../particle-general-function';
|
||||
import CurveRange from './curve-range';
|
||||
import { CCClass } from '../../../../core/data';
|
||||
import { property, ccclass } from '../../../../core/data/class-decorator';
|
||||
|
||||
// tslint:disable: max-line-length
|
||||
const FORCE_OVERTIME_RAND_OFFSET = 212165;
|
||||
@@ -23,6 +23,7 @@ export default class ForceOvertimeModule {
|
||||
*/
|
||||
@property({
|
||||
type: CurveRange,
|
||||
range: [-1, 1],
|
||||
displayOrder: 2,
|
||||
})
|
||||
public x = new CurveRange();
|
||||
@@ -32,6 +33,7 @@ export default class ForceOvertimeModule {
|
||||
*/
|
||||
@property({
|
||||
type: CurveRange,
|
||||
range: [-1, 1],
|
||||
displayOrder: 3,
|
||||
})
|
||||
public y = new CurveRange();
|
||||
@@ -41,6 +43,7 @@ export default class ForceOvertimeModule {
|
||||
*/
|
||||
@property({
|
||||
type: CurveRange,
|
||||
range: [-1, 1],
|
||||
displayOrder: 4,
|
||||
})
|
||||
public z = new CurveRange();
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
import { color4 } from '../../../../core/vmath';
|
||||
import { Enum } from '../../../../core/value-types';
|
||||
import Gradient, { ColorKey, AlphaKey } from './gradient';
|
||||
import { CCClass } from '../../../../core/data';
|
||||
import { property, ccclass } from '../../../../core/data/class-decorator';
|
||||
import { ccclass, property } from '../../../../core/data/class-decorator';
|
||||
import { Enum } from '../../../../core/value-types';
|
||||
import { color4 } from '../../../../core/vmath';
|
||||
import Gradient, { AlphaKey, ColorKey } from './gradient';
|
||||
|
||||
// tslint:disable: max-line-length
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { repeat, lerp } from '../../../../core/vmath';
|
||||
import { Enum, ValueType, Color } from '../../../../core/value-types';
|
||||
import { CCClass } from '../../../../core/data';
|
||||
import { property, ccclass } from '../../../../core/data/class-decorator';
|
||||
import { ccclass, property } from '../../../../core/data/class-decorator';
|
||||
import { Color, Enum, ValueType } from '../../../../core/value-types';
|
||||
import { lerp, repeat } from '../../../../core/vmath';
|
||||
|
||||
// tslint:disable: max-line-length
|
||||
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
import { vec3, lerp, pseudoRandom } from '../../../../core/vmath';
|
||||
import { CCClass } from '../../../../core/data';
|
||||
import { Space } from '../particle-general-function';
|
||||
import { property, ccclass } from '../../../../core/data/class-decorator';
|
||||
import CurveRange from './curve-range';
|
||||
import { ccclass, property } from '../../../../core/data/class-decorator';
|
||||
import { lerp, pseudoRandom, vec3 } from '../../../../core/vmath';
|
||||
import Particle from '../particle';
|
||||
import { Space } from '../particle-general-function';
|
||||
import CurveRange from './curve-range';
|
||||
|
||||
// tslint:disable: max-line-length
|
||||
const LIMIT_VELOCITY_RAND_OFFSET = 23541;
|
||||
@@ -24,6 +24,7 @@ export default class LimitVelocityOvertimeModule {
|
||||
*/
|
||||
@property({
|
||||
type: CurveRange,
|
||||
range: [-1, 1],
|
||||
displayOrder: 4,
|
||||
})
|
||||
public limitX = new CurveRange();
|
||||
@@ -33,6 +34,7 @@ export default class LimitVelocityOvertimeModule {
|
||||
*/
|
||||
@property({
|
||||
type: CurveRange,
|
||||
range: [-1, 1],
|
||||
displayOrder: 5,
|
||||
})
|
||||
public limitY = new CurveRange();
|
||||
@@ -42,6 +44,7 @@ export default class LimitVelocityOvertimeModule {
|
||||
*/
|
||||
@property({
|
||||
type: CurveRange,
|
||||
range: [-1, 1],
|
||||
displayOrder: 6,
|
||||
})
|
||||
public limitZ = new CurveRange();
|
||||
@@ -51,6 +54,7 @@ export default class LimitVelocityOvertimeModule {
|
||||
*/
|
||||
@property({
|
||||
type: CurveRange,
|
||||
range: [-1, 1],
|
||||
displayOrder: 3,
|
||||
})
|
||||
public limit = new CurveRange();
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { OptimizedKey, evalOptCurve, AnimationCurve } from "../../../geom-utils/curve";
|
||||
import { repeat } from "../../../../core/vmath";
|
||||
import CurveRange, { Mode } from "./curve-range";
|
||||
import { repeat } from '../../../../core/vmath';
|
||||
import { AnimationCurve, evalOptCurve, OptimizedKey } from '../../../geom-utils/curve';
|
||||
import CurveRange, { Mode } from './curve-range';
|
||||
|
||||
// tslint:disable: max-line-length
|
||||
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
import { pseudoRandom } from "../../../../core/vmath";
|
||||
import { CCClass } from "../../../../core/data";
|
||||
import CurveRange from "./curve-range";
|
||||
import { property, ccclass } from "../../../../core/data/class-decorator";
|
||||
import Particle from "../particle";
|
||||
import { CCClass } from '../../../../core/data';
|
||||
import { ccclass, property } from '../../../../core/data/class-decorator';
|
||||
import { pseudoRandom } from '../../../../core/vmath';
|
||||
import Particle from '../particle';
|
||||
import CurveRange from './curve-range';
|
||||
|
||||
// tslint:disable: max-line-length
|
||||
const ROTATION_OVERTIME_RAND_OFFSET = 125292;
|
||||
@@ -45,6 +45,8 @@ export default class RotationOvertimeModule {
|
||||
*/
|
||||
@property({
|
||||
type: CurveRange,
|
||||
range: [-1, 1],
|
||||
radian: true,
|
||||
displayOrder: 2,
|
||||
})
|
||||
public x = new CurveRange();
|
||||
@@ -54,6 +56,8 @@ export default class RotationOvertimeModule {
|
||||
*/
|
||||
@property({
|
||||
type: CurveRange,
|
||||
range: [-1, 1],
|
||||
radian: true,
|
||||
displayOrder: 3,
|
||||
})
|
||||
public y = new CurveRange();
|
||||
@@ -63,6 +67,8 @@ export default class RotationOvertimeModule {
|
||||
*/
|
||||
@property({
|
||||
type: CurveRange,
|
||||
range: [-1, 1],
|
||||
radian: true,
|
||||
displayOrder: 4,
|
||||
})
|
||||
public z = new CurveRange();
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
import { vec3, pseudoRandom } from '../../../../core/vmath';
|
||||
import CurveRange from './curve-range';
|
||||
import { CCClass } from '../../../../core/data';
|
||||
import { property, ccclass } from '../../../../core/data/class-decorator';
|
||||
import { ccclass, property } from '../../../../core/data/class-decorator';
|
||||
import { pseudoRandom, vec3 } from '../../../../core/vmath';
|
||||
import Particle from '../particle';
|
||||
import CurveRange from './curve-range';
|
||||
|
||||
// tslint:disable: max-line-length
|
||||
const SIZE_OVERTIME_RAND_OFFSET = 39825;
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
import { repeat, lerp, pseudoRandom } from "../../../../core/vmath";
|
||||
import { Enum } from "../../../../core/value-types";
|
||||
import CurveRange from "./curve-range";
|
||||
import { CCClass } from "../../../../core/data";
|
||||
import { property, ccclass } from "../../../../core/data/class-decorator";
|
||||
import { ParticleSystemComponent } from "../particle-system-component";
|
||||
import Particle from "../particle";
|
||||
import { CCClass } from '../../../../core/data';
|
||||
import { ccclass, property } from '../../../../core/data/class-decorator';
|
||||
import { Enum } from '../../../../core/value-types';
|
||||
import { lerp, pseudoRandom, repeat } from '../../../../core/vmath';
|
||||
import Particle from '../particle';
|
||||
import { ParticleSystemComponent } from '../particle-system-component';
|
||||
import CurveRange from './curve-range';
|
||||
|
||||
// tslint:disable: max-line-length
|
||||
const TEXTURE_ANIMATION_RAND_OFFSET = 90794;
|
||||
@@ -80,7 +80,7 @@ export default class TextureAnimationModule {
|
||||
|
||||
set mode (val) {
|
||||
if (val === Mode.Sprites) {
|
||||
console.error("particle texture animation's sprites is not supported!");
|
||||
console.error('particle texture animation\'s sprites is not supported!');
|
||||
return;
|
||||
}
|
||||
}
|
||||
@@ -101,7 +101,6 @@ export default class TextureAnimationModule {
|
||||
})
|
||||
public numTilesY = 0;
|
||||
|
||||
|
||||
/**
|
||||
* 动画播放方式
|
||||
*/
|
||||
@@ -145,7 +144,7 @@ export default class TextureAnimationModule {
|
||||
}
|
||||
|
||||
set flipU (val) {
|
||||
console.error("particle texture animation's flipU is not supported!");
|
||||
console.error('particle texture animation\'s flipU is not supported!');
|
||||
}
|
||||
|
||||
@property
|
||||
@@ -156,7 +155,7 @@ export default class TextureAnimationModule {
|
||||
}
|
||||
|
||||
set flipV (val) {
|
||||
console.error("particle texture animation's flipV is not supported!");
|
||||
console.error('particle texture animation\'s flipV is not supported!');
|
||||
}
|
||||
|
||||
@property
|
||||
@@ -167,7 +166,7 @@ export default class TextureAnimationModule {
|
||||
}
|
||||
|
||||
set uvChannelMask (val) {
|
||||
console.error("particle texture animation's uvChannelMask is not supported!");
|
||||
console.error('particle texture animation\'s uvChannelMask is not supported!');
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
import { vec3, quat, pseudoRandom, mat4 } from '../../../../core/vmath';
|
||||
import { CCClass } from '../../../../core/data';
|
||||
import { ccclass, property } from '../../../../core/data/class-decorator';
|
||||
import { mat4, pseudoRandom, quat, vec3 } from '../../../../core/vmath';
|
||||
import Particle from '../particle';
|
||||
import { calculateTransform, Space } from '../particle-general-function';
|
||||
import CurveRange from './curve-range';
|
||||
import { CCClass } from '../../../../core/data';
|
||||
import { property, ccclass } from '../../../../core/data/class-decorator';
|
||||
import Particle from '../particle';
|
||||
|
||||
// tslint:disable: max-line-length
|
||||
const VELOCITY_OVERTIME_RAND_OFFSET = 197866;
|
||||
@@ -24,6 +24,7 @@ export default class VelocityOvertimeModule {
|
||||
*/
|
||||
@property({
|
||||
type: CurveRange,
|
||||
range: [-1, 1],
|
||||
displayOrder: 2,
|
||||
})
|
||||
public x = new CurveRange();
|
||||
@@ -33,6 +34,7 @@ export default class VelocityOvertimeModule {
|
||||
*/
|
||||
@property({
|
||||
type: CurveRange,
|
||||
range: [-1, 1],
|
||||
displayOrder: 3,
|
||||
})
|
||||
public y = new CurveRange();
|
||||
@@ -42,6 +44,7 @@ export default class VelocityOvertimeModule {
|
||||
*/
|
||||
@property({
|
||||
type: CurveRange,
|
||||
range: [-1, 1],
|
||||
displayOrder: 4,
|
||||
})
|
||||
public z = new CurveRange();
|
||||
@@ -51,6 +54,7 @@ export default class VelocityOvertimeModule {
|
||||
*/
|
||||
@property({
|
||||
type: CurveRange,
|
||||
range: [-1, 1],
|
||||
displayOrder: 5,
|
||||
})
|
||||
public speedModifier = new CurveRange();
|
||||
|
||||
@@ -286,7 +286,7 @@ export default class ShapeModule {
|
||||
displayOrder: 5,
|
||||
})
|
||||
get angle () {
|
||||
return toDegree(this._angle);
|
||||
return Math.round(toDegree(this._angle) * 100) / 100;
|
||||
}
|
||||
|
||||
set angle (val) {
|
||||
|
||||
@@ -20,15 +20,16 @@ import { particleEmitZAxis, Space } from './particle-general-function';
|
||||
import { INT_MAX } from '../../../core/vmath/bits';
|
||||
import { ccclass, executionOrder, executeInEditMode, property, requireComponent, menu } from '../../../core/data/class-decorator';
|
||||
import TrailModule from './renderer/trail';
|
||||
import { RenderableComponent } from '../renderable-component';
|
||||
import { Material } from '../../assets';
|
||||
|
||||
const _world_mat = mat4.create();
|
||||
|
||||
@ccclass('cc.ParticleSystemComponent')
|
||||
@menu('Components/ParticleSystemComponent')
|
||||
@requireComponent(ParticleSystemRenderer)
|
||||
@executionOrder(99)
|
||||
@executeInEditMode
|
||||
export class ParticleSystemComponent extends Component {
|
||||
export class ParticleSystemComponent extends RenderableComponent {
|
||||
|
||||
@property
|
||||
private _capacity = 100;
|
||||
@@ -73,6 +74,7 @@ export class ParticleSystemComponent extends Component {
|
||||
*/
|
||||
@property({
|
||||
type: CurveRange,
|
||||
range: [-1, 1],
|
||||
displayOrder: 10,
|
||||
})
|
||||
public startSpeed = new CurveRange();
|
||||
@@ -82,6 +84,8 @@ export class ParticleSystemComponent extends Component {
|
||||
*/
|
||||
@property({
|
||||
type: CurveRange,
|
||||
range: [-1, 1],
|
||||
radian: true,
|
||||
displayOrder: 11,
|
||||
})
|
||||
public startRotation = new CurveRange();
|
||||
@@ -186,6 +190,7 @@ export class ParticleSystemComponent extends Component {
|
||||
*/
|
||||
@property({
|
||||
type: CurveRange,
|
||||
range: [-1, 1],
|
||||
displayOrder: 12,
|
||||
})
|
||||
public gravityModifier = new CurveRange();
|
||||
@@ -218,6 +223,20 @@ export class ParticleSystemComponent extends Component {
|
||||
})
|
||||
public bursts = new Array();
|
||||
|
||||
@property({
|
||||
type: Material,
|
||||
displayName: 'Materials',
|
||||
visible: false,
|
||||
})
|
||||
get sharedMaterials () {
|
||||
// if we don't create an array copy, the editor will modify the original array directly.
|
||||
return super.sharedMaterials;
|
||||
}
|
||||
|
||||
set sharedMaterials (val) {
|
||||
super.sharedMaterials = val;
|
||||
}
|
||||
|
||||
// color over lifetime module
|
||||
/**
|
||||
* 颜色控制模块
|
||||
@@ -294,7 +313,11 @@ export class ParticleSystemComponent extends Component {
|
||||
public trailModule = new TrailModule();
|
||||
|
||||
// particle system renderer
|
||||
private renderer: ParticleSystemRenderer | null;
|
||||
@property({
|
||||
type: ParticleSystemRenderer,
|
||||
})
|
||||
private renderer: ParticleSystemRenderer = new ParticleSystemRenderer();
|
||||
|
||||
private _isPlaying: boolean;
|
||||
private _isPaused: boolean;
|
||||
private _isStopped: boolean;
|
||||
@@ -335,13 +358,11 @@ export class ParticleSystemComponent extends Component {
|
||||
this._customData2 = vec2.create(0, 0);
|
||||
|
||||
this._subEmitters = []; // array of { emitter: ParticleSystemComponent, type: 'birth', 'collision' or 'death'}
|
||||
this.renderer = null;
|
||||
}
|
||||
|
||||
protected onLoad () {
|
||||
public onLoad () {
|
||||
// HACK, TODO
|
||||
this.renderer = this.getComponent(ParticleSystemRenderer);
|
||||
this.renderer!.onInit();
|
||||
this.renderer!.onInit(this);
|
||||
this.shapeModule.onInit(this);
|
||||
this.trailModule.init(this);
|
||||
this.textureAnimationModule.onInit(this);
|
||||
@@ -354,6 +375,7 @@ export class ParticleSystemComponent extends Component {
|
||||
|
||||
protected onDestroy () {
|
||||
// this._system.remove(this);
|
||||
this.renderer.onDestroy();
|
||||
this.trailModule.destroy();
|
||||
}
|
||||
|
||||
@@ -361,15 +383,23 @@ export class ParticleSystemComponent extends Component {
|
||||
if (this.playOnAwake) {
|
||||
this.play();
|
||||
}
|
||||
this.renderer!.enabled = this.enabledInHierarchy;
|
||||
this.renderer.onEnable();
|
||||
this.trailModule.onEnable();
|
||||
}
|
||||
|
||||
protected onDisable () {
|
||||
this.renderer!.enabled = this.enabledInHierarchy;
|
||||
this.renderer!.onDisable();
|
||||
this.trailModule.onDisable();
|
||||
}
|
||||
|
||||
public _onMaterialModified (index: number, material: Material) {
|
||||
this.renderer._onMaterialModified(index, material);
|
||||
}
|
||||
|
||||
public _onRebuildPSO (index: number, material: Material) {
|
||||
this.renderer._onRebuildPSO(index, material);
|
||||
}
|
||||
|
||||
// TODO: fastforward current particle system by simulating particles over given period of time, then pause it.
|
||||
// simulate(time, withChildren, restart, fixedTimeStep) {
|
||||
|
||||
|
||||
@@ -93,7 +93,7 @@ const _vertex_attrs_mesh = [
|
||||
|
||||
@ccclass('cc.ParticleSystemRenderer')
|
||||
@executeInEditMode
|
||||
export default class ParticleSystemRenderer extends RenderableComponent {
|
||||
export default class ParticleSystemRenderer {
|
||||
|
||||
/**
|
||||
* 设定粒子生成模式
|
||||
@@ -112,8 +112,8 @@ export default class ParticleSystemRenderer extends RenderableComponent {
|
||||
}
|
||||
this._renderMode = val;
|
||||
this._setVertexAttrib();
|
||||
this._updateMaterialParams();
|
||||
this._updateModel();
|
||||
this._updateMaterialParams();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -150,16 +150,23 @@ export default class ParticleSystemRenderer extends RenderableComponent {
|
||||
|
||||
@property({
|
||||
type: RenderMode,
|
||||
displayOrder: 3,
|
||||
})
|
||||
private _renderMode = RenderMode.Billboard;
|
||||
|
||||
@property
|
||||
@property({
|
||||
displayOrder: 4,
|
||||
})
|
||||
private _velocityScale = 1;
|
||||
|
||||
@property
|
||||
@property({
|
||||
displayOrder: 5,
|
||||
})
|
||||
private _lengthScale = 1;
|
||||
|
||||
@property
|
||||
@property({
|
||||
displayOrder: 6,
|
||||
})
|
||||
private _mesh: Mesh | null = null;
|
||||
|
||||
/**
|
||||
@@ -167,6 +174,7 @@ export default class ParticleSystemRenderer extends RenderableComponent {
|
||||
*/
|
||||
@property({
|
||||
type: Mesh,
|
||||
displayOrder: 7,
|
||||
})
|
||||
public get mesh () {
|
||||
return this._mesh;
|
||||
@@ -179,6 +187,30 @@ export default class ParticleSystemRenderer extends RenderableComponent {
|
||||
}
|
||||
}
|
||||
|
||||
@property({
|
||||
type: Material,
|
||||
displayOrder: 8,
|
||||
})
|
||||
public get particleMaterial () {
|
||||
return this.particleSystem.getMaterial(0, CC_EDITOR)!;
|
||||
}
|
||||
|
||||
public set particleMaterial (val) {
|
||||
this.particleSystem.setMaterial(val, 0);
|
||||
}
|
||||
|
||||
@property({
|
||||
type: Material,
|
||||
displayOrder: 9,
|
||||
})
|
||||
public get trailMaterial () {
|
||||
return this.particleSystem.getMaterial(1, CC_EDITOR)!;
|
||||
}
|
||||
|
||||
public set trailMaterial (val) {
|
||||
this.particleSystem.setMaterial(val, 1);
|
||||
}
|
||||
|
||||
private _defines: { [index: string]: boolean };
|
||||
private _trailDefines: { [index: string]: boolean };
|
||||
private _model: ParticleBatchModel | null;
|
||||
@@ -190,7 +222,6 @@ export default class ParticleSystemRenderer extends RenderableComponent {
|
||||
private _defaultMat: Material | null = null;
|
||||
|
||||
constructor () {
|
||||
super();
|
||||
this._model = null;
|
||||
|
||||
this.frameTile_velLenScale = cc.v4(1, 1, 0, 0);
|
||||
@@ -207,8 +238,8 @@ export default class ParticleSystemRenderer extends RenderableComponent {
|
||||
};
|
||||
}
|
||||
|
||||
public onInit () {
|
||||
this.particleSystem = this.node.getComponent('cc.ParticleSystemComponent');
|
||||
public onInit (ps) {
|
||||
this.particleSystem = ps.node.getComponent('cc.ParticleSystemComponent');
|
||||
this._particles = new RecyclePool(() => {
|
||||
return new Particle(this);
|
||||
}, 16);
|
||||
@@ -221,26 +252,26 @@ export default class ParticleSystemRenderer extends RenderableComponent {
|
||||
return;
|
||||
}
|
||||
if (this._model == null) {
|
||||
this._model = this._getRenderScene().createModel(ParticleBatchModel, this.node) as ParticleBatchModel;
|
||||
this._model = this.particleSystem._getRenderScene().createModel(ParticleBatchModel, this.node) as ParticleBatchModel;
|
||||
}
|
||||
if (!this._model.inited) {
|
||||
this._model.setCapacity(this.particleSystem.capacity);
|
||||
this._model.node = this.node;
|
||||
this._model.node = this.particleSystem.node;
|
||||
}
|
||||
this._model.enabled = this.enabledInHierarchy;
|
||||
this._updateMaterialParams();
|
||||
this._model.enabled = this.particleSystem.enabledInHierarchy;
|
||||
this._updateModel();
|
||||
this._updateMaterialParams();
|
||||
this._updateTrailMaterial();
|
||||
}
|
||||
|
||||
public onDisable () {
|
||||
if (this._model) {
|
||||
this._model.enabled = this.enabledInHierarchy;
|
||||
this._model.enabled = this.particleSystem.enabledInHierarchy;
|
||||
}
|
||||
}
|
||||
|
||||
public onDestroy () {
|
||||
this._getRenderScene().destroyModel(this._model!);
|
||||
this.particleSystem._getRenderScene().destroyModel(this._model!);
|
||||
this._model = null;
|
||||
}
|
||||
|
||||
@@ -273,7 +304,7 @@ export default class ParticleSystemRenderer extends RenderableComponent {
|
||||
}
|
||||
|
||||
public _updateParticles (dt: number) {
|
||||
this.node.getWorldMatrix(_tempWorldTrans);
|
||||
this.particleSystem.node.getWorldMatrix(_tempWorldTrans);
|
||||
if (this.particleSystem.velocityOvertimeModule.enable) {
|
||||
this.particleSystem.velocityOvertimeModule.update(this.particleSystem._simulationSpace, _tempWorldTrans);
|
||||
}
|
||||
@@ -409,10 +440,10 @@ export default class ParticleSystemRenderer extends RenderableComponent {
|
||||
if (!this.particleSystem) {
|
||||
return;
|
||||
}
|
||||
if (this.sharedMaterial == null && this._defaultMat == null) {
|
||||
this._defaultMat = Material.getInstantiatedMaterial(builtinResMgr.get<Material>('default-particle-material'), this, true);
|
||||
if (this.particleSystem.sharedMaterial == null && this._defaultMat == null) {
|
||||
this._defaultMat = Material.getInstantiatedMaterial(builtinResMgr.get<Material>('default-particle-material'), this.particleSystem, true);
|
||||
}
|
||||
const mat: Material | null = this.sharedMaterial ? this.getMaterial(0, CC_EDITOR)! : this._defaultMat;
|
||||
const mat: Material | null = this.particleSystem.sharedMaterial ? this.particleMaterial : this._defaultMat;
|
||||
if (this.particleSystem._simulationSpace === Space.World) {
|
||||
this._defines[CC_USE_WORLD_SPACE] = true;
|
||||
this._trailDefines[CC_USE_WORLD_SPACE] = true;
|
||||
@@ -464,7 +495,7 @@ export default class ParticleSystemRenderer extends RenderableComponent {
|
||||
mat!.setProperty('frameTile_velLenScale', this.frameTile_velLenScale);
|
||||
}
|
||||
if (this._model) {
|
||||
this._model.setSubModelMaterial(0, this.sharedMaterial || this._defaultMat);
|
||||
this._model.setSubModelMaterial(0, this.particleSystem.sharedMaterial || this._defaultMat);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -475,7 +506,7 @@ export default class ParticleSystemRenderer extends RenderableComponent {
|
||||
} else {
|
||||
this._trailDefines[CC_USE_WORLD_SPACE] = false;
|
||||
}
|
||||
const mat = this.getMaterial(1, CC_EDITOR)!;
|
||||
const mat = this.trailMaterial;
|
||||
mat!.recompileShaders(this._trailDefines);
|
||||
this.particleSystem.trailModule._updateMaterial();
|
||||
}
|
||||
|
||||
@@ -356,7 +356,7 @@ export default class TrailModule {
|
||||
|
||||
public _updateMaterial () {
|
||||
if (this._particleSystem) {
|
||||
const mat = this._particleSystem.renderer.getMaterial(1, CC_EDITOR)!;
|
||||
const mat = this._particleSystem.renderer.trailMaterial;
|
||||
if (mat) {
|
||||
this._trailModel!.setSubModelMaterial(0, mat);
|
||||
}
|
||||
|
||||
@@ -1176,6 +1176,7 @@ function parseAttributes (constructor: Function, attributes: IAcceptableAttribut
|
||||
parseSimpleAttribute('displayName', 'string');
|
||||
parseSimpleAttribute('displayOrder', 'number');
|
||||
parseSimpleAttribute('multiline', 'boolean');
|
||||
parseSimpleAttribute('radian', 'boolean');
|
||||
if (attributes.readonly) {
|
||||
(attrsProto || getAttrsProto())[attrsProtoKey + 'readonly'] = true;
|
||||
}
|
||||
|
||||
@@ -94,6 +94,11 @@ export interface IExposedAttributes {
|
||||
* ???
|
||||
*/
|
||||
unit?: string;
|
||||
|
||||
/**
|
||||
* 转换为弧度
|
||||
*/
|
||||
radian?: boolean;
|
||||
}
|
||||
|
||||
export interface IAcceptableAttributes extends IExposedAttributes {
|
||||
|
||||
Reference in New Issue
Block a user