Skip to content

Commit f563a97

Browse files
committed
Remove the distance property
1 parent d335777 commit f563a97

1 file changed

Lines changed: 16 additions & 48 deletions

File tree

examples/3d-car-coin-hunt/3d-car-coin-hunt.json

Lines changed: 16 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -41806,7 +41806,7 @@
4180641806
"}",
4180741807
"",
4180841808
"/**",
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",
4181041810
" */",
4181141811
"",
4181241812
"const game = runtimeScene.getGame();",
@@ -41824,9 +41824,9 @@
4182441824
" }",
4182541825
"",
4182641826
" _updateThreeGroup() {",
41827-
" const object = this._object;",
41828-
" /** @type {THREE.SpotLight} */",
41827+
" /** @type {SpotLightRuntimeObject} */",
4182941828
" //@ts-ignore",
41829+
" const object = this._object;",
4183041830
" const threeObject3D = this.get3DRendererObject();",
4183141831
"",
4183241832
" threeObject3D.rotation.set(",
@@ -41850,8 +41850,6 @@
4185041850
"",
4185141851
" threeObject3D.visible = !this._object.hidden;",
4185241852
"",
41853-
" /** @type {THREE.SpotLight} */",
41854-
" //@ts-ignore",
4185541853
" const spotLight = object.__spotLight;",
4185641854
"",
4185741855
" const editor = game.getInGameEditor ? game.getInGameEditor() : null;",
@@ -41894,16 +41892,10 @@
4189441892
" const deltaZ = rootObject.getZ() - cameraZ;",
4189541893
" distanceSq = deltaX * deltaX + deltaY * deltaY + deltaZ * deltaZ;",
4189641894
" }",
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);",
4190741899
" }",
4190841900
"",
4190941901
" // Force the visibility to be checked every frame",
@@ -42028,17 +42020,17 @@
4202842020
"const coneLength = 64;",
4202942021
"",
4203042022
"class SpotLightHelper extends THREE.Object3D {",
42031-
" /** @type {gdjs.CustomRuntimeObject3D} */",
42023+
" /** @type {SpotLightRuntimeObject} */",
4203242024
" object;",
42033-
" /** @type {THREE.LineSegments} */",
42025+
" /** @type {THREE.LineSegments<THREE.BufferGeometry, THREE.LineBasicMaterial>} */",
4203442026
" cone;",
42035-
" /** @type {THREE.LineSegments} */",
42027+
" /** @type {THREE.LineSegments<THREE.BufferGeometry, THREE.LineBasicMaterial>} */",
4203642028
" centerLine;",
42037-
" /** @type {THREE.Mesh} */",
42029+
" /** @type {THREE.Mesh<THREE.BoxGeometry, THREE.MeshBasicMaterial>} */",
4203842030
" originBox;",
4203942031
"",
4204042032
"\t/**",
42041-
" * @param {gdjs.CustomRuntimeObject3D} object",
42033+
" * @param {SpotLightRuntimeObject} object",
4204242034
"\t */",
4204342035
" constructor(object) {",
4204442036
" super();",
@@ -42090,38 +42082,23 @@
4209042082
"",
4209142083
" dispose() {",
4209242084
" this.cone.geometry.dispose();",
42093-
" //@ts-ignore",
4209442085
" this.cone.material.dispose();",
4209542086
" this.centerLine.geometry.dispose();",
42096-
" //@ts-ignore",
4209742087
" this.centerLine.material.dispose();",
4209842088
" this.originBox.geometry.dispose();",
42099-
" //@ts-ignore",
4210042089
" this.originBox.material.dispose();",
4210142090
" }",
4210242091
"",
4210342092
" update() {",
4210442093
" /** @type {number} */",
42105-
" //@ts-ignore",
4210642094
" const coneAngle = gdjs.toRad(this.object._getConeAngle());",
4210742095
" const coneWidth = coneLength * Math.sin(coneAngle);",
4210842096
" const coneHeight = coneLength * Math.cos(coneAngle);",
4210942097
" 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);",
4212542102
" }",
4212642103
"}",
4212742104
"",
@@ -43884,12 +43861,6 @@
4388443861
"group": "Shadow",
4388543862
"name": "IsCastingShadow"
4388643863
},
43887-
{
43888-
"value": "2000",
43889-
"type": "Number",
43890-
"label": "Visibility distance",
43891-
"name": "VisibilityDistanceMax"
43892-
},
4389343864
{
4389443865
"value": "Medium",
4389543866
"type": "Choice",
@@ -43942,9 +43913,6 @@
4394243913
{
4394343914
"propertyName": "Decay"
4394443915
},
43945-
{
43946-
"propertyName": "VisibilityDistanceMax"
43947-
},
4394843916
{
4394943917
"folderName": "Cone",
4395043918
"children": [

0 commit comments

Comments
 (0)