mirror of
https://github.com/cocos/cocos4.git
synced 2026-12-03 01:12:42 +08:00
dfc3d141f2
* gfx: descriptor sets * gfx: descriptor set, singular * better structure * adapt upper layers: first pass finally all compiler errors cleared. OKAY IT'S HAPPENING EVERYBODY STAY THE ****ING CALM * adapt upper layers: second pass THERE AND BACK AGAIN * unified light pass & shadow shader * gfx: descriptor set & pipeline layout * light pass: better structure * light pass: dynamic uniform * even more type checking for memory pools * Fix particleSystem and lineComponent. * delete comment * guard pool init param * Fix trail module error. * delete space * light pass: instancing & batching support * don't polyfill gfx stuff inside EffectAsset * better light pass structure * fix spot light culling Co-authored-by: caryliu <caryliu1999@gmail.com>
82 lines
1.7 KiB
TypeScript
82 lines
1.7 KiB
TypeScript
/**
|
|
* @hidden
|
|
*/
|
|
|
|
import { GFXAttributeName, GFXDevice, GFXDescriptorSet } from '../gfx';
|
|
import { Mesh } from './mesh';
|
|
import { StdMorphRendering } from './morph-rendering';
|
|
import { IMacroPatch } from '../renderer';
|
|
|
|
export interface Morph {
|
|
/**
|
|
* Morph data of each sub-mesh.
|
|
*/
|
|
subMeshMorphs: (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, descriptorSet: GFXDescriptorSet): void;
|
|
|
|
requiredPatches (subMeshIndex: number): IMacroPatch[] | undefined;
|
|
|
|
/**
|
|
* Destroy the rendering instance.
|
|
*/
|
|
destroy (): void;
|
|
}
|