Skip to content

Commit f58758c

Browse files
committed
Add an action to choose the max number of lights with shadow
1 parent ee949b5 commit f58758c

1 file changed

Lines changed: 96 additions & 4 deletions

File tree

extensions/reviewed/Light3D.json

Lines changed: 96 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -628,6 +628,14 @@
628628
" value: 20",
629629
"};",
630630
"",
631+
"const editorLightShadowCountMax = {",
632+
" value: 1",
633+
"};",
634+
"",
635+
"const lightShadowCountMax = {",
636+
" value: 4",
637+
"};",
638+
"",
631639
"/**",
632640
" * Get the platforms manager of an instance container.",
633641
" * @param {gdjs.RuntimeScene & {__lightManager: LightManager}} runtimeScene",
@@ -636,8 +644,8 @@
636644
" if (!runtimeScene.__lightManager) {",
637645
" // Create the shared manager if necessary.",
638646
" runtimeScene.__lightManager = isInGameEdition ?",
639-
" new LightManager(editorLightCountMax, 1) :",
640-
" new LightManager(lightCountMax, 4);",
647+
" new LightManager(editorLightCountMax, editorLightShadowCountMax) :",
648+
" new LightManager(lightCountMax, lightShadowCountMax);",
641649
" }",
642650
" return runtimeScene.__lightManager;",
643651
"}",
@@ -724,7 +732,7 @@
724732
"",
725733
" /**",
726734
" * @param maxCount {{value: number}}",
727-
" * @param shadowCount {number}",
735+
" * @param shadowCount {{value: number}}",
728736
" */",
729737
" constructor(maxCount, shadowCount) {",
730738
" this.visibleObjects = new CappedLightList(",
@@ -733,7 +741,7 @@
733741
" (object) => { object.__light3D.visible = false; }",
734742
" );",
735743
" this.shadowObjects = new CappedLightList(",
736-
" { value: shadowCount },",
744+
" shadowCount,",
737745
" (object) => { object.__light3D.castShadow = true; },",
738746
" (object) => { object.__light3D.castShadow = false; }",
739747
" );",
@@ -762,6 +770,7 @@
762770
"gdjs.__light3DExtension = {",
763771
" Light3DRenderer,",
764772
" lightCountMax,",
773+
" lightShadowCountMax,",
765774
"}"
766775
],
767776
"parameterObjects": "",
@@ -848,6 +857,83 @@
848857
],
849858
"parameters": [],
850859
"objectGroups": []
860+
},
861+
{
862+
"description": "the maximum number of nearest lights displayed with shadow simultaneously.",
863+
"fullName": "Max lights with shadow count",
864+
"functionType": "ExpressionAndCondition",
865+
"name": "LightShadowCountMax",
866+
"sentence": "max lights with shadow count",
867+
"events": [
868+
{
869+
"type": "BuiltinCommonInstructions::Standard",
870+
"conditions": [],
871+
"actions": [
872+
{
873+
"type": {
874+
"value": "Light3D::DefineHelperClasses"
875+
},
876+
"parameters": [
877+
"",
878+
""
879+
]
880+
}
881+
]
882+
},
883+
{
884+
"type": "BuiltinCommonInstructions::JsCode",
885+
"inlineCode": [
886+
"",
887+
"eventsFunctionContext.returnValue = gdjs.__light3DExtension.lightShadowCountMax.value;"
888+
],
889+
"parameterObjects": "",
890+
"useStrict": true,
891+
"eventsSheetExpanded": false
892+
}
893+
],
894+
"expressionType": {
895+
"type": "expression"
896+
},
897+
"parameters": [],
898+
"objectGroups": []
899+
},
900+
{
901+
"fullName": "",
902+
"functionType": "ActionWithOperator",
903+
"getterName": "LightShadowCountMax",
904+
"name": "SetLightShadowCountMax",
905+
"sentence": "",
906+
"events": [
907+
{
908+
"type": "BuiltinCommonInstructions::Standard",
909+
"conditions": [],
910+
"actions": [
911+
{
912+
"type": {
913+
"value": "Light3D::DefineHelperClasses"
914+
},
915+
"parameters": [
916+
"",
917+
""
918+
]
919+
}
920+
]
921+
},
922+
{
923+
"type": "BuiltinCommonInstructions::JsCode",
924+
"inlineCode": [
925+
"",
926+
"const value = eventsFunctionContext.getArgument(\"Value\");",
927+
"",
928+
"gdjs.__light3DExtension.lightShadowCountMax.value = value;"
929+
],
930+
"parameterObjects": "",
931+
"useStrict": true,
932+
"eventsSheetExpanded": false
933+
}
934+
],
935+
"parameters": [],
936+
"objectGroups": []
851937
}
852938
],
853939
"eventsFunctionsFolderStructure": {
@@ -867,6 +953,12 @@
867953
},
868954
{
869955
"functionName": "SetLightCountMax"
956+
},
957+
{
958+
"functionName": "LightShadowCountMax"
959+
},
960+
{
961+
"functionName": "SetLightShadowCountMax"
870962
}
871963
]
872964
},

0 commit comments

Comments
 (0)