greasedLineSimpleMaterial.d.ts 6.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199
  1. import type { Scene } from "../../scene";
  2. import { RawTexture } from "../Textures/rawTexture";
  3. import { ShaderMaterial } from "../shaderMaterial";
  4. import type { Nullable } from "../../types";
  5. import { Color3 } from "../../Maths/math.color";
  6. import { Vector2 } from "../../Maths/math.vector";
  7. import "../../Shaders/greasedLine.fragment";
  8. import "../../Shaders/greasedLine.vertex";
  9. import type { GreasedLineMaterialOptions, IGreasedLineMaterial } from "./greasedLineMaterialInterfaces";
  10. import { GreasedLineMeshColorDistributionType, GreasedLineMeshColorMode } from "./greasedLineMaterialInterfaces";
  11. /**
  12. * GreasedLineSimpleMaterial
  13. */
  14. export declare class GreasedLineSimpleMaterial extends ShaderMaterial implements IGreasedLineMaterial {
  15. private _visibility;
  16. private _width;
  17. private _useDash;
  18. private _dashCount;
  19. private _dashArray;
  20. private _dashRatio;
  21. private _dashOffset;
  22. private _useColors;
  23. private _color;
  24. private _colors;
  25. private _colorsDistributionType;
  26. private _colorMode;
  27. private _colorsSampling;
  28. private _resolution;
  29. private _sizeAttenuation;
  30. private _colorsTexture;
  31. private _cameraFacing;
  32. /**
  33. * GreasedLineSimple material constructor
  34. * @param name material name
  35. * @param scene the scene
  36. * @param options material options
  37. */
  38. constructor(name: string, scene: Scene, options: GreasedLineMaterialOptions);
  39. /**
  40. * Disposes the plugin material.
  41. */
  42. dispose(): void;
  43. private _setColorModeAndColorDistributionType;
  44. /**
  45. * Updates the material. Use when material created in lazy mode.
  46. */
  47. updateLazy(): void;
  48. /**
  49. * Returns the colors used to colorize the line
  50. */
  51. get colors(): Nullable<Color3[]>;
  52. /**
  53. * Sets the colors used to colorize the line
  54. */
  55. set colors(value: Nullable<Color3[]>);
  56. /**
  57. * Creates or updates the colors texture
  58. * @param colors color table RGBA
  59. * @param lazy if lazy, the colors are not updated
  60. * @param forceNewTexture force creation of a new texture
  61. */
  62. setColors(colors: Nullable<Color3[]>, lazy?: boolean, forceNewTexture?: boolean): void;
  63. /**
  64. * Gets the colors texture
  65. */
  66. get colorsTexture(): RawTexture;
  67. /**
  68. * Sets the colorsTexture
  69. */
  70. set colorsTexture(value: RawTexture);
  71. /**
  72. * Line base width. At each point the line width is calculated by widths[pointIndex] * width
  73. */
  74. get width(): number;
  75. /**
  76. * Line base width. At each point the line width is calculated by widths[pointIndex] * width
  77. */
  78. set width(value: number);
  79. /**
  80. * Whether to use the colors option to colorize the line
  81. */
  82. get useColors(): boolean;
  83. set useColors(value: boolean);
  84. /**
  85. * The type of sampling of the colors texture. The values are the same when using with textures.
  86. */
  87. get colorsSampling(): number;
  88. /**
  89. * The type of sampling of the colors texture. The values are the same when using with textures.
  90. */
  91. set colorsSampling(value: number);
  92. /**
  93. * Normalized value of how much of the line will be visible
  94. * 0 - 0% of the line will be visible
  95. * 1 - 100% of the line will be visible
  96. */
  97. get visibility(): number;
  98. set visibility(value: number);
  99. /**
  100. * Turns on/off dash mode
  101. */
  102. get useDash(): boolean;
  103. /**
  104. * Turns on/off dash mode
  105. */
  106. set useDash(value: boolean);
  107. /**
  108. * Gets the dash offset
  109. */
  110. get dashOffset(): number;
  111. /**
  112. * Sets the dash offset
  113. */
  114. set dashOffset(value: number);
  115. /**
  116. * Length of the dash. 0 to 1. 0.5 means half empty, half drawn.
  117. */
  118. get dashRatio(): number;
  119. /**
  120. * Length of the dash. 0 to 1. 0.5 means half empty, half drawn.
  121. */
  122. set dashRatio(value: number);
  123. /**
  124. * Gets the number of dashes in the line
  125. */
  126. get dashCount(): number;
  127. /**
  128. * Sets the number of dashes in the line
  129. * @param value dash
  130. */
  131. set dashCount(value: number);
  132. /**
  133. * False means 1 unit in width = 1 unit on scene, true means 1 unit in width is reduced on the screen to make better looking lines
  134. */
  135. get sizeAttenuation(): boolean;
  136. /**
  137. * Turn on/off attenuation of the width option and widths array.
  138. * @param value false means 1 unit in width = 1 unit on scene, true means 1 unit in width is reduced on the screen to make better looking lines
  139. */
  140. set sizeAttenuation(value: boolean);
  141. /**
  142. * Gets the color of the line
  143. */
  144. get color(): Color3;
  145. /**
  146. * Sets the color of the line
  147. * @param value Color3
  148. */
  149. set color(value: Color3);
  150. /**
  151. * Sets the color of the line. If set the whole line will be mixed with this color according to the colorMode option.
  152. * The simple material always needs a color to be set. If you set it to null it will set the color to the default color (GreasedLineSimpleMaterial.DEFAULT_COLOR).
  153. * @param value color
  154. */
  155. setColor(value: Nullable<Color3>): void;
  156. /**
  157. * Gets the color distributiopn type
  158. */
  159. get colorsDistributionType(): GreasedLineMeshColorDistributionType;
  160. /**
  161. * Sets the color distribution type
  162. * @see GreasedLineMeshColorDistributionType
  163. * @param value color distribution type
  164. */
  165. set colorsDistributionType(value: GreasedLineMeshColorDistributionType);
  166. /**
  167. * Gets the mixing mode of the color and colors paramaters. Default value is GreasedLineMeshColorMode.SET.
  168. * MATERIAL_TYPE_SIMPLE mixes the color and colors of the greased line material.
  169. * @see GreasedLineMeshColorMode
  170. */
  171. get colorMode(): GreasedLineMeshColorMode;
  172. /**
  173. * Sets the mixing mode of the color and colors paramaters. Default value is GreasedLineMeshColorMode.SET.
  174. * MATERIAL_TYPE_SIMPLE mixes the color and colors of the greased line material.
  175. * @see GreasedLineMeshColorMode
  176. */
  177. set colorMode(value: GreasedLineMeshColorMode);
  178. /**
  179. * Gets the resolution
  180. */
  181. get resolution(): Vector2;
  182. /**
  183. * Sets the resolution
  184. * @param value resolution of the screen for GreasedLine
  185. */
  186. set resolution(value: Vector2);
  187. /**
  188. * Serializes this plugin material
  189. * @returns serializationObjec
  190. */
  191. serialize(): any;
  192. /**
  193. * Parses a serialized objects
  194. * @param source serialized object
  195. * @param scene scene
  196. * @param _rootUrl root url for textures
  197. */
  198. parse(source: any, scene: Scene, _rootUrl: string): void;
  199. }