Files
cocos4/cocos/core/assets/morph.ts
T
minggo f44822c960 Create PSO in render stage (#6732)
* record PSO in sub model

* import Pass

* create PSO dynamically in render stage

* remove debug codes

* rmeove PSO in more components

* remove unneeded codes

* add comments

* subModel.psoCreateInfos -> subModel.psoInfos

* remove unneeded \!

* remove spaces

* remove unneeded codes

* IPSOCreationInfo -> IPSOCreateInfo

* add name into hash computing

* add GFXInputState back

* concat super's macro patches
2020-06-02 17:11:22 +08:00

84 lines
1.9 KiB
TypeScript

/**
* @hidden
*/
import { GFXAttributeName, GFXDevice, GFXPipelineState } from '../gfx';
import { Mesh } from './mesh';
import { StdMorphRendering } from './morph-rendering';
import { MaterialInstance } from '../renderer/core/material-instance';
import { Material } from './material';
import { IMacroPatch, IPSOCreateInfo } from '../renderer';
export interface Morph {
/**
* Morph data of each sub-mesh.
*/
subMeshMorphs: Array<SubMeshMorph | null>;
/**
* Common initial weights of each sub-mesh.
*/
weights?: number[];
}
export interface MorphTarget {
/**
* Displacement of each target attribute.
*/
displacements: Mesh.IBufferView[];
}
export interface SubMeshMorph {
/**
* Attributes to morph.
*/
attributes: GFXAttributeName[];
/**
* Targets.
*/
targets: MorphTarget[];
/**
* Initial weights of each target.
*/
weights?: number[];
}
export function createMorphRendering (mesh: Mesh, gfxDevice: GFXDevice): MorphRendering | null {
return new StdMorphRendering(mesh, gfxDevice);
}
/**
* Class which control rendering of a morph resource.
*/
export interface MorphRendering {
createInstance (): MorphRenderingInstance;
}
/**
* This rendering instance of a morph resource.
*/
export interface MorphRenderingInstance {
/**
* Sets weights of targets of specified sub mesh.
* @param subMeshIndex
* @param weights
*/
setWeights (subMeshIndex: number, weights: number[]): void;
/**
* Adapts pipeline state to do the rendering.
* @param subMeshIndex
* @param pipelineState
*/
adaptPipelineState(subMeshIndex: number, pipelineCreateInfo: IPSOCreateInfo): void;
requiredPatches(subMeshIndex: number): IMacroPatch[] | undefined;
/**
* Destroy the rendering instance.
*/
destroy(): void;
}