babylon.sandbox.module.d.ts 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347
  1. /// <reference types="react" />
  2. declare module "babylonjs-sandbox/globalState" {
  3. import { Observable } from 'babylonjs/Misc/observable';
  4. import { Scene } from 'babylonjs/scene';
  5. import { FilesInput } from 'babylonjs/Misc/filesInput';
  6. export class GlobalState {
  7. currentScene: Scene;
  8. onSceneLoaded: Observable<{
  9. scene: Scene;
  10. filename: string;
  11. }>;
  12. onError: Observable<{
  13. scene?: Scene | undefined;
  14. message?: string | undefined;
  15. }>;
  16. onEnvironmentChanged: Observable<string>;
  17. onRequestClickInterceptor: Observable<void>;
  18. onClickInterceptorClicked: Observable<void>;
  19. filesInput: FilesInput;
  20. isDebugLayerEnabled: boolean;
  21. showDebugLayer(): void;
  22. hideDebugLayer(): void;
  23. }
  24. }
  25. declare module "babylonjs-sandbox/tools/localStorageHelper" {
  26. export class LocalStorageHelper {
  27. static ReadLocalStorageValue(key: string, defaultValue: number): number;
  28. }
  29. }
  30. declare module "babylonjs-sandbox/tools/environmentTools" {
  31. import { HDRCubeTexture } from 'babylonjs/Materials/Textures/hdrCubeTexture';
  32. import { CubeTexture } from 'babylonjs/Materials/Textures/cubeTexture';
  33. import { Scene } from 'babylonjs/scene';
  34. import { GlobalState } from "babylonjs-sandbox/globalState";
  35. export class EnvironmentTools {
  36. static SkyboxPath: string;
  37. static Skyboxes: string[];
  38. static SkyboxesNames: string[];
  39. static LoadSkyboxPathTexture(scene: Scene): HDRCubeTexture | CubeTexture;
  40. static HookWithEnvironmentChange(globalState: GlobalState): void;
  41. }
  42. }
  43. declare module "babylonjs-sandbox/components/renderingZone" {
  44. import * as React from "react";
  45. import { GlobalState } from "babylonjs-sandbox/globalState";
  46. import { Vector3 } from 'babylonjs/Maths/math.vector';
  47. interface IRenderingZoneProps {
  48. globalState: GlobalState;
  49. assetUrl?: string;
  50. cameraPosition?: Vector3;
  51. expanded: boolean;
  52. }
  53. export class RenderingZone extends React.Component<IRenderingZoneProps> {
  54. private _currentPluginName;
  55. private _engine;
  56. private _scene;
  57. private _canvas;
  58. constructor(props: IRenderingZoneProps);
  59. initEngine(): void;
  60. prepareCamera(): void;
  61. handleErrors(): void;
  62. prepareLighting(): void;
  63. onSceneLoaded(filename: string): void;
  64. loadAssetFromUrl(): void;
  65. loadAsset(): void;
  66. componentDidMount(): void;
  67. shouldComponentUpdate(nextProps: IRenderingZoneProps): boolean;
  68. render(): JSX.Element;
  69. }
  70. }
  71. declare module "babylonjs-sandbox/components/footerButton" {
  72. import * as React from "react";
  73. import { GlobalState } from "babylonjs-sandbox/globalState";
  74. interface IFooterButtonProps {
  75. globalState: GlobalState;
  76. enabled: boolean;
  77. onClick: () => void;
  78. icon: any;
  79. label: string;
  80. }
  81. export class FooterButton extends React.Component<IFooterButtonProps> {
  82. render(): JSX.Element | null;
  83. }
  84. }
  85. declare module "babylonjs-sandbox/components/dropUpButton" {
  86. import * as React from "react";
  87. import { GlobalState } from "babylonjs-sandbox/globalState";
  88. interface IDropUpButtonProps {
  89. globalState: GlobalState;
  90. enabled: boolean;
  91. icon?: any;
  92. label: string;
  93. options: string[];
  94. selectedOption?: string;
  95. onOptionPicked: (option: string) => void;
  96. }
  97. export class DropUpButton extends React.Component<IDropUpButtonProps, {
  98. isOpen: boolean;
  99. }> {
  100. private _onClickInterceptorClickedObserver;
  101. constructor(props: IDropUpButtonProps);
  102. componentWillUnmount(): void;
  103. switchDropUp(): void;
  104. clickOption(option: string): void;
  105. render(): JSX.Element | null;
  106. }
  107. }
  108. declare module "babylonjs-sandbox/components/footerFileButton" {
  109. import * as React from "react";
  110. import { GlobalState } from "babylonjs-sandbox/globalState";
  111. interface IFooterFileButtonProps {
  112. globalState: GlobalState;
  113. enabled: boolean;
  114. icon: any;
  115. label: string;
  116. onFilesPicked: (evt: Event, files: FileList | null) => void;
  117. }
  118. export class FooterFileButton extends React.Component<IFooterFileButtonProps> {
  119. onFilePicked(evt: React.ChangeEvent<HTMLInputElement>): void;
  120. render(): JSX.Element | null;
  121. }
  122. }
  123. declare module "babylonjs-sandbox/components/animationBar" {
  124. import * as React from "react";
  125. import { GlobalState } from "babylonjs-sandbox/globalState";
  126. import { Scene } from 'babylonjs/scene';
  127. interface IAnimationBarProps {
  128. globalState: GlobalState;
  129. enabled: boolean;
  130. }
  131. export class AnimationBar extends React.Component<IAnimationBarProps, {
  132. groupIndex: number;
  133. }> {
  134. private _currentScene;
  135. private _sliderSyncObserver;
  136. private _currentGroup;
  137. private _sliderRef;
  138. private _currentPlayingState;
  139. constructor(props: IAnimationBarProps);
  140. getCurrentPosition(): string;
  141. registerBeforeRender(newScene: Scene): void;
  142. pause(): void;
  143. play(): void;
  144. sliderInput(evt: React.FormEvent<HTMLInputElement>): void;
  145. render(): JSX.Element | null;
  146. }
  147. }
  148. declare module "babylonjs-sandbox/components/footer" {
  149. import * as React from "react";
  150. import { GlobalState } from "babylonjs-sandbox/globalState";
  151. interface IFooterProps {
  152. globalState: GlobalState;
  153. }
  154. export class Footer extends React.Component<IFooterProps> {
  155. constructor(props: IFooterProps);
  156. showInspector(): void;
  157. render(): JSX.Element;
  158. }
  159. }
  160. declare module "babylonjs-sandbox/sandbox" {
  161. import * as React from "react";
  162. interface ISandboxProps {
  163. }
  164. export class Sandbox extends React.Component<ISandboxProps, {
  165. isFooterVisible: boolean;
  166. errorMessage: string;
  167. }> {
  168. private _globalState;
  169. private _assetUrl?;
  170. private _cameraPosition?;
  171. private _logoRef;
  172. private _dropTextRef;
  173. private _clickInterceptorRef;
  174. constructor(props: ISandboxProps);
  175. checkUrl(): void;
  176. componentDidUpdate(): void;
  177. render(): JSX.Element;
  178. static Show(hostElement: HTMLElement): void;
  179. }
  180. }
  181. declare module "babylonjs-sandbox/index" {
  182. export * from "babylonjs-sandbox/sandbox";
  183. }
  184. declare module "babylonjs-sandbox/legacy/legacy" {
  185. export * from "babylonjs-sandbox/index";
  186. }
  187. declare module "babylonjs-sandbox" {
  188. export * from "babylonjs-sandbox/legacy/legacy";
  189. }
  190. /// <reference types="react" />
  191. declare module SANDBOX {
  192. export class GlobalState {
  193. currentScene: BABYLON.Scene;
  194. onSceneLoaded: BABYLON.Observable<{
  195. scene: BABYLON.Scene;
  196. filename: string;
  197. }>;
  198. onError: BABYLON.Observable<{
  199. scene?: BABYLON.Scene | undefined;
  200. message?: string | undefined;
  201. }>;
  202. onEnvironmentChanged: BABYLON.Observable<string>;
  203. onRequestClickInterceptor: BABYLON.Observable<void>;
  204. onClickInterceptorClicked: BABYLON.Observable<void>;
  205. filesInput: BABYLON.FilesInput;
  206. isDebugLayerEnabled: boolean;
  207. showDebugLayer(): void;
  208. hideDebugLayer(): void;
  209. }
  210. }
  211. declare module SANDBOX {
  212. export class LocalStorageHelper {
  213. static ReadLocalStorageValue(key: string, defaultValue: number): number;
  214. }
  215. }
  216. declare module SANDBOX {
  217. export class EnvironmentTools {
  218. static SkyboxPath: string;
  219. static Skyboxes: string[];
  220. static SkyboxesNames: string[];
  221. static LoadSkyboxPathTexture(scene: BABYLON.Scene): BABYLON.HDRCubeTexture | BABYLON.CubeTexture;
  222. static HookWithEnvironmentChange(globalState: GlobalState): void;
  223. }
  224. }
  225. declare module SANDBOX {
  226. interface IRenderingZoneProps {
  227. globalState: GlobalState;
  228. assetUrl?: string;
  229. cameraPosition?: BABYLON.Vector3;
  230. expanded: boolean;
  231. }
  232. export class RenderingZone extends React.Component<IRenderingZoneProps> {
  233. private _currentPluginName;
  234. private _engine;
  235. private _scene;
  236. private _canvas;
  237. constructor(props: IRenderingZoneProps);
  238. initEngine(): void;
  239. prepareCamera(): void;
  240. handleErrors(): void;
  241. prepareLighting(): void;
  242. onSceneLoaded(filename: string): void;
  243. loadAssetFromUrl(): void;
  244. loadAsset(): void;
  245. componentDidMount(): void;
  246. shouldComponentUpdate(nextProps: IRenderingZoneProps): boolean;
  247. render(): JSX.Element;
  248. }
  249. }
  250. declare module SANDBOX {
  251. interface IFooterButtonProps {
  252. globalState: GlobalState;
  253. enabled: boolean;
  254. onClick: () => void;
  255. icon: any;
  256. label: string;
  257. }
  258. export class FooterButton extends React.Component<IFooterButtonProps> {
  259. render(): JSX.Element | null;
  260. }
  261. }
  262. declare module SANDBOX {
  263. interface IDropUpButtonProps {
  264. globalState: GlobalState;
  265. enabled: boolean;
  266. icon?: any;
  267. label: string;
  268. options: string[];
  269. selectedOption?: string;
  270. onOptionPicked: (option: string) => void;
  271. }
  272. export class DropUpButton extends React.Component<IDropUpButtonProps, {
  273. isOpen: boolean;
  274. }> {
  275. private _onClickInterceptorClickedObserver;
  276. constructor(props: IDropUpButtonProps);
  277. componentWillUnmount(): void;
  278. switchDropUp(): void;
  279. clickOption(option: string): void;
  280. render(): JSX.Element | null;
  281. }
  282. }
  283. declare module SANDBOX {
  284. interface IFooterFileButtonProps {
  285. globalState: GlobalState;
  286. enabled: boolean;
  287. icon: any;
  288. label: string;
  289. onFilesPicked: (evt: Event, files: FileList | null) => void;
  290. }
  291. export class FooterFileButton extends React.Component<IFooterFileButtonProps> {
  292. onFilePicked(evt: React.ChangeEvent<HTMLInputElement>): void;
  293. render(): JSX.Element | null;
  294. }
  295. }
  296. declare module SANDBOX {
  297. interface IAnimationBarProps {
  298. globalState: GlobalState;
  299. enabled: boolean;
  300. }
  301. export class AnimationBar extends React.Component<IAnimationBarProps, {
  302. groupIndex: number;
  303. }> {
  304. private _currentScene;
  305. private _sliderSyncObserver;
  306. private _currentGroup;
  307. private _sliderRef;
  308. private _currentPlayingState;
  309. constructor(props: IAnimationBarProps);
  310. getCurrentPosition(): string;
  311. registerBeforeRender(newScene: BABYLON.Scene): void;
  312. pause(): void;
  313. play(): void;
  314. sliderInput(evt: React.FormEvent<HTMLInputElement>): void;
  315. render(): JSX.Element | null;
  316. }
  317. }
  318. declare module SANDBOX {
  319. interface IFooterProps {
  320. globalState: GlobalState;
  321. }
  322. export class Footer extends React.Component<IFooterProps> {
  323. constructor(props: IFooterProps);
  324. showInspector(): void;
  325. render(): JSX.Element;
  326. }
  327. }
  328. declare module SANDBOX {
  329. interface ISandboxProps {
  330. }
  331. export class Sandbox extends React.Component<ISandboxProps, {
  332. isFooterVisible: boolean;
  333. errorMessage: string;
  334. }> {
  335. private _globalState;
  336. private _assetUrl?;
  337. private _cameraPosition?;
  338. private _logoRef;
  339. private _dropTextRef;
  340. private _clickInterceptorRef;
  341. constructor(props: ISandboxProps);
  342. checkUrl(): void;
  343. componentDidUpdate(): void;
  344. render(): JSX.Element;
  345. static Show(hostElement: HTMLElement): void;
  346. }
  347. }