mirror of
https://github.com/cocos/cocos4.git
synced 2026-12-03 09:23:00 +08:00
84 lines
1.8 KiB
TypeScript
84 lines
1.8 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 } 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, pipelineState: GFXPipelineState): void;
|
|
|
|
requiredPatches(subMeshIndex: number): IMacroPatch[] | undefined;
|
|
|
|
/**
|
|
* Destroy the rendering instance.
|
|
*/
|
|
destroy(): void;
|
|
}
|