|
41806 | 41806 | "}", |
41807 | 41807 | "", |
41808 | 41808 | "/**", |
41809 | | - " * @typedef {gdjs.RuntimeObject & {__cameraDistance: number, __spotLight: THREE.SpotLight, _getIsCastingShadow: () => boolean}} SpotLightRuntimeObject", |
| 41809 | + " * @typedef {gdjs.CustomRuntimeObject3D & {__cameraDistance: number, __spotLight: THREE.SpotLight, _getIsCastingShadow: () => boolean, _getConeAngle: () => number, _getColor: () => string}} SpotLightRuntimeObject", |
41810 | 41810 | " */", |
41811 | 41811 | "", |
41812 | 41812 | "const game = runtimeScene.getGame();", |
|
41824 | 41824 | " }", |
41825 | 41825 | "", |
41826 | 41826 | " _updateThreeGroup() {", |
41827 | | - " const object = this._object;", |
41828 | | - " /** @type {THREE.SpotLight} */", |
| 41827 | + " /** @type {SpotLightRuntimeObject} */", |
41829 | 41828 | " //@ts-ignore", |
| 41829 | + " const object = this._object;", |
41830 | 41830 | " const threeObject3D = this.get3DRendererObject();", |
41831 | 41831 | "", |
41832 | 41832 | " threeObject3D.rotation.set(", |
|
41850 | 41850 | "", |
41851 | 41851 | " threeObject3D.visible = !this._object.hidden;", |
41852 | 41852 | "", |
41853 | | - " /** @type {THREE.SpotLight} */", |
41854 | | - " //@ts-ignore", |
41855 | 41853 | " const spotLight = object.__spotLight;", |
41856 | 41854 | "", |
41857 | 41855 | " const editor = game.getInGameEditor ? game.getInGameEditor() : null;", |
@@ -41894,16 +41892,10 @@ |
41894 | 41892 | " const deltaZ = rootObject.getZ() - cameraZ;", |
41895 | 41893 | " distanceSq = deltaX * deltaX + deltaY * deltaY + deltaZ * deltaZ;", |
41896 | 41894 | " }", |
41897 | | - " //@ts-ignore", |
41898 | | - " const distanceMax = object._getVisibilityDistanceMax();", |
41899 | | - " const isWithInRange = distanceSq <= distanceMax * distanceMax;", |
41900 | | - " if (isWithInRange) {", |
41901 | | - " getSpotLightManager(", |
41902 | | - " //@ts-ignore", |
41903 | | - " runtimeScene", |
41904 | | - " ).applyVisibilityAndShadow(object, distanceSq);", |
41905 | | - " }", |
41906 | | - "", |
| 41895 | + " getSpotLightManager(", |
| 41896 | + " //@ts-ignore", |
| 41897 | + " runtimeScene", |
| 41898 | + " ).applyVisibilityAndShadow(object, distanceSq);", |
41907 | 41899 | " }", |
41908 | 41900 | "", |
41909 | 41901 | " // Force the visibility to be checked every frame", |
@@ -42028,17 +42020,17 @@ |
42028 | 42020 | "const coneLength = 64;", |
42029 | 42021 | "", |
42030 | 42022 | "class SpotLightHelper extends THREE.Object3D {", |
42031 | | - " /** @type {gdjs.CustomRuntimeObject3D} */", |
| 42023 | + " /** @type {SpotLightRuntimeObject} */", |
42032 | 42024 | " object;", |
42033 | | - " /** @type {THREE.LineSegments} */", |
| 42025 | + " /** @type {THREE.LineSegments<THREE.BufferGeometry, THREE.LineBasicMaterial>} */", |
42034 | 42026 | " cone;", |
42035 | | - " /** @type {THREE.LineSegments} */", |
| 42027 | + " /** @type {THREE.LineSegments<THREE.BufferGeometry, THREE.LineBasicMaterial>} */", |
42036 | 42028 | " centerLine;", |
42037 | | - " /** @type {THREE.Mesh} */", |
| 42029 | + " /** @type {THREE.Mesh<THREE.BoxGeometry, THREE.MeshBasicMaterial>} */", |
42038 | 42030 | " originBox;", |
42039 | 42031 | "", |
42040 | 42032 | "\t/**", |
42041 | | - " * @param {gdjs.CustomRuntimeObject3D} object", |
| 42033 | + " * @param {SpotLightRuntimeObject} object", |
42042 | 42034 | "\t */", |
42043 | 42035 | " constructor(object) {", |
42044 | 42036 | " super();", |
@@ -42090,38 +42082,23 @@ |
42090 | 42082 | "", |
42091 | 42083 | " dispose() {", |
42092 | 42084 | " this.cone.geometry.dispose();", |
42093 | | - " //@ts-ignore", |
42094 | 42085 | " this.cone.material.dispose();", |
42095 | 42086 | " this.centerLine.geometry.dispose();", |
42096 | | - " //@ts-ignore", |
42097 | 42087 | " this.centerLine.material.dispose();", |
42098 | 42088 | " this.originBox.geometry.dispose();", |
42099 | | - " //@ts-ignore", |
42100 | 42089 | " this.originBox.material.dispose();", |
42101 | 42090 | " }", |
42102 | 42091 | "", |
42103 | 42092 | " update() {", |
42104 | 42093 | " /** @type {number} */", |
42105 | | - " //@ts-ignore", |
42106 | 42094 | " const coneAngle = gdjs.toRad(this.object._getConeAngle());", |
42107 | 42095 | " const coneWidth = coneLength * Math.sin(coneAngle);", |
42108 | 42096 | " const coneHeight = coneLength * Math.cos(coneAngle);", |
42109 | 42097 | " this.cone.scale.set(coneHeight, coneWidth, coneWidth);", |
42110 | | - " /** @type {number} */", |
42111 | | - " //@ts-ignore", |
42112 | | - " const color = gdjs.rgbOrHexStringToNumber(this.object._getColor())", |
42113 | | - " /** @type {THREE.LineBasicMaterial} */", |
42114 | | - " //@ts-ignore", |
42115 | | - " const coneMaterial = this.cone.material;", |
42116 | | - " coneMaterial.color.set(color);", |
42117 | | - " /** @type {THREE.LineBasicMaterial} */", |
42118 | | - " //@ts-ignore", |
42119 | | - " const centerLineMaterial = this.centerLine.material;", |
42120 | | - " centerLineMaterial.color.set(color);", |
42121 | | - " /** @type {THREE.MeshBasicMaterial} */", |
42122 | | - " //@ts-ignore", |
42123 | | - " const originBoxMaterial = this.originBox.material;", |
42124 | | - " originBoxMaterial.color.set(color);", |
| 42098 | + " const color = gdjs.rgbOrHexStringToNumber(this.object._getColor());", |
| 42099 | + " this.cone.material.color.set(color);", |
| 42100 | + " this.centerLine.material.color.set(color);", |
| 42101 | + " this.originBox.material.color.set(color);", |
42125 | 42102 | " }", |
42126 | 42103 | "}", |
42127 | 42104 | "", |
|
43884 | 43861 | "group": "Shadow", |
43885 | 43862 | "name": "IsCastingShadow" |
43886 | 43863 | }, |
43887 | | - { |
43888 | | - "value": "2000", |
43889 | | - "type": "Number", |
43890 | | - "label": "Visibility distance", |
43891 | | - "name": "VisibilityDistanceMax" |
43892 | | - }, |
43893 | 43864 | { |
43894 | 43865 | "value": "Medium", |
43895 | 43866 | "type": "Choice", |
|
43942 | 43913 | { |
43943 | 43914 | "propertyName": "Decay" |
43944 | 43915 | }, |
43945 | | - { |
43946 | | - "propertyName": "VisibilityDistanceMax" |
43947 | | - }, |
43948 | 43916 | { |
43949 | 43917 | "folderName": "Cone", |
43950 | 43918 | "children": [ |
|
0 commit comments