creator.ext.d.ts 2.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  1. declare namespace cc {
  2. declare let gfx: any;
  3. export class RenderData {
  4. vDatas: Float32Array[]
  5. uintVDatas: Uint32Array[]
  6. iDatas: Uint16Array[]
  7. init(assembler: Assembler)
  8. createQuadData(index: number, verticesFloats: number, indicesCount: number)
  9. }
  10. export class Assembler {
  11. init(comp: RenderComponent): void;
  12. updateRenderData(comp: RenderComponent): void;
  13. }
  14. export class Assembler2D extends Assembler {
  15. _local: Array;
  16. _renderData: RenderData;
  17. uvOffset: number;
  18. floatsPerVert: number;
  19. updateWorldVerts(comp: RenderComponent): void
  20. }
  21. export class Effect {
  22. getProperty(name: string): any
  23. _properties: any
  24. }
  25. export class BufferAsset extends Asset {
  26. _buffer: ArrayBuffer
  27. }
  28. /////////////////////////////////////////////////////////////////////////////////////////////////////////////
  29. // 材质资源类
  30. export class Material extends Asset {
  31. static getInstantiatedMaterial(mat: Material, renderComponent: RenderComponent): Material;
  32. setProperty(name: string, property: any, force: boolean);
  33. getProperty(name: string): any
  34. get effect(): Effect
  35. }
  36. // 所有支持渲染的组件的基类
  37. export class RenderComponent extends Component {
  38. /** !#en The materials used by this render component.
  39. !#zh 渲染组件使用的材质。 */
  40. sharedMaterials: Material[];
  41. /**
  42. !#en Get the material by index.
  43. !#zh 根据指定索引获取材质
  44. @param index index
  45. */
  46. getMaterial(index: number): Material;
  47. /**
  48. !#en Set the material by index.
  49. !#zh 根据指定索引设置材质
  50. @param index index
  51. @param material material
  52. */
  53. setMaterial(index: number, material: Material): void;
  54. _assembler: Assembler;
  55. setVertsDirty();
  56. disableRender();
  57. markForRender(enable: boolean);
  58. }
  59. // 提供基础渲染接口的渲染器对象,渲染层的基础接口将逐步开放给用户
  60. export class renderer {
  61. /** !#en The render engine is available only after cc.game.EVENT_ENGINE_INITED event.<br/>
  62. Normally it will be inited as the webgl render engine, but in wechat open context domain,
  63. it will be inited as the canvas render engine. Canvas render engine is no longer available for other use case since v2.0.
  64. !#zh 基础渲染引擎对象只在 cc.game.EVENT_ENGINE_INITED 事件触发后才可获取。<br/>
  65. 大多数情况下,它都会是 WebGL 渲染引擎实例,但是在微信开放数据域当中,它会是 Canvas 渲染引擎实例。请注意,从 2.0 开始,我们在其他平台和环境下都废弃了 Canvas 渲染器。 */
  66. static renderEngine: any;
  67. /** !#en The total draw call count in last rendered frame.
  68. !#zh 上一次渲染帧所提交的渲染批次总数。 */
  69. static drawCalls: number;
  70. static _handle: any;
  71. }
  72. }