mirror of
https://github.com/cocos/cocos4.git
synced 2026-12-05 11:02:40 +08:00
39a7fbdd89
* refactor material instance * revert setMaterial signature * fix some defects * material instance using inheritance (#5) * material instance using inheritance * renderable component * more fixes (#6) * more fixes * minor * fix some defects * fix batching (#7) * better format (#8) * fix * fix batching & skybox (#9) * fix skinning (#10) * change sharedMaterial decorator * add modelcomponent property deprecated Co-authored-by: Yun Hsiao Wu <inheritorofgalaxy@gmail.com>
53 lines
1.6 KiB
TypeScript
53 lines
1.6 KiB
TypeScript
/**
|
|
* @hidden
|
|
*/
|
|
|
|
import { MeshBuffer } from '../../../ui';
|
|
import { Material } from '../../assets/material';
|
|
import { GFXPipelineState, GFXTextureView } from '../../gfx';
|
|
import { GFXBindingLayout } from '../../gfx/binding-layout';
|
|
import { Node } from '../../scene-graph';
|
|
import { Camera } from '../scene/camera';
|
|
import { Model } from '../scene/model';
|
|
import { UI } from './ui';
|
|
|
|
export class UIDrawBatch {
|
|
public camera: Camera | null = null;
|
|
public bufferBatch: MeshBuffer | null = null;
|
|
public model: Model | null = null;
|
|
public material: Material | null = null;
|
|
public texView: GFXTextureView | null = null;
|
|
public firstIdx: number = 0;
|
|
public idxCount: number = 0;
|
|
public pipelineState: GFXPipelineState | null = null;
|
|
public bindingLayout: GFXBindingLayout | null = null;
|
|
public useLocalData: Node | null = null;
|
|
public isStatic = false;
|
|
|
|
public destroy (ui: UI) {
|
|
if (this.pipelineState) {
|
|
ui._getUIMaterial(this.material!).revertPipelineState(this.pipelineState);
|
|
this.pipelineState = null;
|
|
}
|
|
|
|
if (this.bindingLayout) {
|
|
this.bindingLayout = null;
|
|
}
|
|
}
|
|
|
|
public clear (ui: UI) {
|
|
if (this.pipelineState) {
|
|
ui._getUIMaterial(this.material!).revertPipelineState(this.pipelineState);
|
|
this.pipelineState = null;
|
|
}
|
|
this.camera = null;
|
|
this.bufferBatch = null;
|
|
this.material = null;
|
|
this.texView = null;
|
|
this.firstIdx = 0;
|
|
this.idxCount = 0;
|
|
this.model = null;
|
|
this.isStatic = false;
|
|
}
|
|
}
|