2014-02-09 22:10:30 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								/**************************************************************************/  
						 
					
						
							
								
									
										
										
										
											2020-03-26 18:49:16 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								/*  light_3d.cpp                                                          */  
						 
					
						
							
								
									
										
										
										
											2014-02-09 22:10:30 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								/**************************************************************************/  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								/*                         This file is part of:                          */  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								/*                             GODOT ENGINE                               */  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								/*                        https://godotengine.org                         */  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								/**************************************************************************/  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								/* Copyright (c) 2014-present Godot Engine contributors (see AUTHORS.md). */  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								/* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur.                  */  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								/*                                                                        */  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								/* Permission is hereby granted, free of charge, to any person obtaining  */  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								/* a copy of this software and associated documentation files (the        */  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								/* "Software"), to deal in the Software without restriction, including    */  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								/* without limitation the rights to use, copy, modify, merge, publish,    */  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								/* distribute, sublicense, and/or sell copies of the Software, and to     */  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								/* permit persons to whom the Software is furnished to do so, subject to  */  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								/* the following conditions:                                              */  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								/*                                                                        */  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								/* The above copyright notice and this permission notice shall be         */  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								/* included in all copies or substantial portions of the Software.        */  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								/*                                                                        */  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,        */  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF     */  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. */  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY   */  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,   */  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE      */  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.                 */  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								/**************************************************************************/  
						 
					
						
							
								
									
										
										
										
											2018-01-05 00:50:27 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-07-31 16:20:24 -07:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								# include  "core/config/project_settings.h" 
  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2020-03-26 18:49:16 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								# include  "light_3d.h" 
  
						 
					
						
							
								
									
										
										
										
											2016-03-09 00:00:52 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2021-01-29 19:55:54 -05:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								void  Light3D : : set_param ( Param  p_param ,  real_t  p_value )  {  
						 
					
						
							
								
									
										
										
										
											2016-10-27 11:50:26 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									ERR_FAIL_INDEX ( p_param ,  PARAM_MAX ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									param [ p_param ]  =  p_value ; 
							 
						 
					
						
							
								
									
										
										
										
											2014-02-09 22:10:30 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2020-03-27 15:21:27 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									RS : : get_singleton ( ) - > light_set_param ( light ,  RS : : LightParam ( p_param ) ,  p_value ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2014-02-09 22:10:30 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2016-10-27 11:50:26 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									if  ( p_param  = =  PARAM_SPOT_ANGLE  | |  p_param  = =  PARAM_RANGE )  { 
							 
						 
					
						
							
								
									
										
										
										
											2021-06-23 16:49:50 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										update_gizmos ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-09-07 22:59:55 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										if  ( p_param  = =  PARAM_SPOT_ANGLE )  { 
							 
						 
					
						
							
								
									
										
										
										
											2020-10-29 05:01:28 -05:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											update_configuration_warnings ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-09-07 22:59:55 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										} 
							 
						 
					
						
							
								
									
										
										
										
											2016-10-27 11:50:26 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
									
										
										
										
											2014-02-09 22:10:30 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2021-01-29 19:55:54 -05:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								real_t  Light3D : : get_param ( Param  p_param )  const  {  
						 
					
						
							
								
									
										
										
										
											2016-10-27 11:50:26 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									ERR_FAIL_INDEX_V ( p_param ,  PARAM_MAX ,  0 ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									return  param [ p_param ] ; 
							 
						 
					
						
							
								
									
										
										
										
											2014-02-09 22:10:30 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
									
										
										
										
											2016-03-09 00:00:52 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2020-03-26 18:49:16 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								void  Light3D : : set_shadow ( bool  p_enable )  {  
						 
					
						
							
								
									
										
										
										
											2016-10-27 11:50:26 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									shadow  =  p_enable ; 
							 
						 
					
						
							
								
									
										
										
										
											2020-03-27 15:21:27 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									RS : : get_singleton ( ) - > light_set_shadow ( light ,  p_enable ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2019-07-07 16:22:09 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2020-02-13 23:34:59 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									notify_property_list_changed ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2023-02-25 16:24:41 -08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									update_configuration_warnings ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2014-02-09 22:10:30 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
									
										
										
										
											2020-05-14 14:29:06 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2020-03-26 18:49:16 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								bool  Light3D : : has_shadow ( )  const  {  
						 
					
						
							
								
									
										
										
										
											2016-10-27 11:50:26 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									return  shadow ; 
							 
						 
					
						
							
								
									
										
										
										
											2014-02-09 22:10:30 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2020-03-26 18:49:16 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								void  Light3D : : set_negative ( bool  p_enable )  {  
						 
					
						
							
								
									
										
										
										
											2016-10-27 11:50:26 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									negative  =  p_enable ; 
							 
						 
					
						
							
								
									
										
										
										
											2020-03-27 15:21:27 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									RS : : get_singleton ( ) - > light_set_negative ( light ,  p_enable ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2014-02-09 22:10:30 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
									
										
										
										
											2020-05-14 14:29:06 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2020-03-26 18:49:16 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								bool  Light3D : : is_negative ( )  const  {  
						 
					
						
							
								
									
										
										
										
											2016-10-27 11:50:26 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									return  negative ; 
							 
						 
					
						
							
								
									
										
										
										
											2014-02-09 22:10:30 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-02-24 22:55:14 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								void  Light3D : : set_enable_distance_fade ( bool  p_enable )  {  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									distance_fade_enabled  =  p_enable ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									RS : : get_singleton ( ) - > light_set_distance_fade ( light ,  distance_fade_enabled ,  distance_fade_begin ,  distance_fade_shadow ,  distance_fade_length ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									notify_property_list_changed ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								bool  Light3D : : is_distance_fade_enabled ( )  const  {  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									return  distance_fade_enabled ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								void  Light3D : : set_distance_fade_begin ( real_t  p_distance )  {  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									distance_fade_begin  =  p_distance ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									RS : : get_singleton ( ) - > light_set_distance_fade ( light ,  distance_fade_enabled ,  distance_fade_begin ,  distance_fade_shadow ,  distance_fade_length ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								real_t  Light3D : : get_distance_fade_begin ( )  const  {  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									return  distance_fade_begin ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								void  Light3D : : set_distance_fade_shadow ( real_t  p_distance )  {  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									distance_fade_shadow  =  p_distance ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									RS : : get_singleton ( ) - > light_set_distance_fade ( light ,  distance_fade_enabled ,  distance_fade_begin ,  distance_fade_shadow ,  distance_fade_length ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								real_t  Light3D : : get_distance_fade_shadow ( )  const  {  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									return  distance_fade_shadow ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								void  Light3D : : set_distance_fade_length ( real_t  p_length )  {  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									distance_fade_length  =  p_length ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									RS : : get_singleton ( ) - > light_set_distance_fade ( light ,  distance_fade_enabled ,  distance_fade_begin ,  distance_fade_shadow ,  distance_fade_length ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								real_t  Light3D : : get_distance_fade_length ( )  const  {  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									return  distance_fade_length ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2020-03-26 18:49:16 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								void  Light3D : : set_cull_mask ( uint32_t  p_cull_mask )  {  
						 
					
						
							
								
									
										
										
										
											2016-10-27 11:50:26 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									cull_mask  =  p_cull_mask ; 
							 
						 
					
						
							
								
									
										
										
										
											2020-03-27 15:21:27 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									RS : : get_singleton ( ) - > light_set_cull_mask ( light ,  p_cull_mask ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2016-10-27 11:50:26 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
									
										
										
										
											2020-05-14 14:29:06 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2020-03-26 18:49:16 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								uint32_t  Light3D : : get_cull_mask ( )  const  {  
						 
					
						
							
								
									
										
										
										
											2016-10-27 11:50:26 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									return  cull_mask ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
									
										
										
										
											2014-02-09 22:10:30 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2020-03-26 18:49:16 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								void  Light3D : : set_color ( const  Color  & p_color )  {  
						 
					
						
							
								
									
										
										
										
											2016-10-27 11:50:26 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									color  =  p_color ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-07-31 16:20:24 -07:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									if  ( GLOBAL_GET ( " rendering/lights_and_shadows/use_physical_light_units " ) )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										Color  combined  =  color . srgb_to_linear ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										combined  * =  correlated_color . srgb_to_linear ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										RS : : get_singleton ( ) - > light_set_color ( light ,  combined . linear_to_srgb ( ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									}  else  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										RS : : get_singleton ( ) - > light_set_color ( light ,  color ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
									
										
										
										
											2020-01-01 00:52:20 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									// The gizmo color depends on the light color, so update it.
 
							 
						 
					
						
							
								
									
										
										
										
											2021-06-23 16:49:50 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									update_gizmos ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2016-10-27 11:50:26 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
									
										
										
										
											2020-05-14 14:29:06 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2020-03-26 18:49:16 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								Color  Light3D : : get_color ( )  const  {  
						 
					
						
							
								
									
										
										
										
											2016-10-27 11:50:26 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									return  color ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
									
										
										
										
											2014-02-09 22:10:30 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2020-03-26 18:49:16 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								void  Light3D : : set_shadow_reverse_cull_face ( bool  p_enable )  {  
						 
					
						
							
								
									
										
										
										
											2017-08-19 20:06:40 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									reverse_cull  =  p_enable ; 
							 
						 
					
						
							
								
									
										
										
										
											2020-03-27 15:21:27 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									RS : : get_singleton ( ) - > light_set_reverse_cull_face_mode ( light ,  reverse_cull ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2017-08-19 20:06:40 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2020-03-26 18:49:16 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								bool  Light3D : : get_shadow_reverse_cull_face ( )  const  {  
						 
					
						
							
								
									
										
										
										
											2017-08-19 20:06:40 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									return  reverse_cull ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2020-03-26 18:49:16 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								AABB  Light3D : : get_aabb ( )  const  {  
						 
					
						
							
								
									
										
										
										
											2020-03-27 15:21:27 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									if  ( type  = =  RenderingServer : : LIGHT_DIRECTIONAL )  { 
							 
						 
					
						
							
								
									
										
										
										
											2017-11-16 21:09:00 -05:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										return  AABB ( Vector3 ( - 1 ,  - 1 ,  - 1 ) ,  Vector3 ( 2 ,  2 ,  2 ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2016-03-09 00:00:52 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2020-03-27 15:21:27 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									}  else  if  ( type  = =  RenderingServer : : LIGHT_OMNI )  { 
							 
						 
					
						
							
								
									
										
										
										
											2017-11-16 21:09:00 -05:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										return  AABB ( Vector3 ( - 1 ,  - 1 ,  - 1 )  *  param [ PARAM_RANGE ] ,  Vector3 ( 2 ,  2 ,  2 )  *  param [ PARAM_RANGE ] ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2016-03-09 00:00:52 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2020-03-27 15:21:27 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									}  else  if  ( type  = =  RenderingServer : : LIGHT_SPOT )  { 
							 
						 
					
						
							
								
									
										
										
										
											2023-01-24 01:08:32 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										real_t  cone_slant_height  =  param [ PARAM_RANGE ] ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										real_t  cone_angle_rad  =  Math : : deg_to_rad ( param [ PARAM_SPOT_ANGLE ] ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										if  ( cone_angle_rad  >  Math_PI  /  2.0 )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											// Just return the AABB of an omni light if the spot angle is above 90 degrees.
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											return  AABB ( Vector3 ( - 1 ,  - 1 ,  - 1 )  *  cone_slant_height ,  Vector3 ( 2 ,  2 ,  2 )  *  cone_slant_height ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										real_t  size  =  Math : : sin ( cone_angle_rad )  *  cone_slant_height ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										return  AABB ( Vector3 ( - size ,  - size ,  - cone_slant_height ) ,  Vector3 ( 2  *  size ,  2  *  size ,  cone_slant_height ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2014-02-09 22:10:30 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2017-11-16 21:09:00 -05:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									return  AABB ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2014-02-09 22:10:30 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-10-10 14:33:51 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								PackedStringArray  Light3D : : get_configuration_warnings ( )  const  {  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									PackedStringArray  warnings  =  VisualInstance3D : : get_configuration_warnings ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									if  ( ! get_scale ( ) . is_equal_approx ( Vector3 ( 1 ,  1 ,  1 ) ) )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										warnings . push_back ( RTR ( " A light's scale does not affect the visual size of the light. " ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									return  warnings ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2020-03-26 18:49:16 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								void  Light3D : : set_bake_mode ( BakeMode  p_mode )  {  
						 
					
						
							
								
									
										
										
										
											2017-12-14 08:59:46 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									bake_mode  =  p_mode ; 
							 
						 
					
						
							
								
									
										
										
										
											2020-06-25 10:33:28 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									RS : : get_singleton ( ) - > light_set_bake_mode ( light ,  RS : : LightBakeMode ( p_mode ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2017-12-14 08:59:46 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2020-03-26 18:49:16 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								Light3D : : BakeMode  Light3D : : get_bake_mode ( )  const  {  
						 
					
						
							
								
									
										
										
										
											2017-12-14 08:59:46 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									return  bake_mode ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2020-04-15 14:09:48 +07:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								void  Light3D : : set_projector ( const  Ref < Texture2D >  & p_texture )  {  
						 
					
						
							
								
									
										
										
										
											2020-04-14 17:05:45 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									projector  =  p_texture ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									RID  tex_id  =  projector . is_valid ( )  ?  projector - > get_rid ( )  :  RID ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									RS : : get_singleton ( ) - > light_set_projector ( light ,  tex_id ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2020-10-29 05:01:28 -05:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									update_configuration_warnings ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2020-04-14 17:05:45 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								Ref < Texture2D >  Light3D : : get_projector ( )  const  {  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									return  projector ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-06-23 08:19:18 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								void  Light3D : : owner_changed_notify ( )  {  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									// For cases where owner changes _after_ entering tree (as example, editor editing).
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									_update_visibility ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-07-31 16:20:24 -07:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								// Temperature expressed in Kelvins. Valid range 1000 - 15000
  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								// First converts to CIE 1960 then to sRGB
  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								// As explained in the Filament documentation: https://google.github.io/filament/Filament.md.html#lighting/directlighting/lightsparameterization
  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								Color  _color_from_temperature ( float  p_temperature )  {  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									float  T2  =  p_temperature  *  p_temperature ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									float  u  =  ( 0.860117757f  +  1.54118254e-4 f  *  p_temperature  +  1.28641212e-7 f  *  T2 )  / 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											( 1.0f  +  8.42420235e-4 f  *  p_temperature  +  7.08145163e-7 f  *  T2 ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									float  v  =  ( 0.317398726f  +  4.22806245e-5 f  *  p_temperature  +  4.20481691e-8 f  *  T2 )  / 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											( 1.0f  -  2.89741816e-5 f  *  p_temperature  +  1.61456053e-7 f  *  T2 ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									// Convert to xyY space.
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									float  d  =  1.0f  /  ( 2.0f  *  u  -  8.0f  *  v  +  4.0f ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									float  x  =  3.0f  *  u  *  d ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									float  y  =  2.0f  *  v  *  d ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									// Convert to XYZ space
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									const  float  a  =  1.0  /  MAX ( y ,  1e-5 f ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									Vector3  xyz  =  Vector3 ( x  *  a ,  1.0 ,  ( 1.0f  -  x  -  y )  *  a ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									// Convert from XYZ to sRGB(linear)
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									Vector3  linear  =  Vector3 ( 3.2404542f  *  xyz . x  -  1.5371385f  *  xyz . y  -  0.4985314f  *  xyz . z , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											- 0.9692660f  *  xyz . x  +  1.8760108f  *  xyz . y  +  0.0415560f  *  xyz . z , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											0.0556434f  *  xyz . x  -  0.2040259f  *  xyz . y  +  1.0572252f  *  xyz . z ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									linear  / =  MAX ( 1e-5 f ,  linear [ linear . max_axis_index ( ) ] ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									// Normalize, clamp, and convert to sRGB.
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									return  Color ( linear . x ,  linear . y ,  linear . z ) . clamp ( ) . linear_to_srgb ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								void  Light3D : : set_temperature ( const  float  p_temperature )  {  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									temperature  =  p_temperature ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									if  ( ! GLOBAL_GET ( " rendering/lights_and_shadows/use_physical_light_units " ) )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										return ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									correlated_color  =  _color_from_temperature ( temperature ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									Color  combined  =  color . srgb_to_linear ( )  *  correlated_color . srgb_to_linear ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									RS : : get_singleton ( ) - > light_set_color ( light ,  combined . linear_to_srgb ( ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									// The gizmo color depends on the light color, so update it.
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									update_gizmos ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								Color  Light3D : : get_correlated_color ( )  const  {  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									return  correlated_color ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								float  Light3D : : get_temperature ( )  const  {  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									return  temperature ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2020-03-26 18:49:16 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								void  Light3D : : _update_visibility ( )  {  
						 
					
						
							
								
									
										
										
										
											2020-05-14 16:41:43 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									if  ( ! is_inside_tree ( ) )  { 
							 
						 
					
						
							
								
									
										
										
										
											2014-10-12 02:13:22 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										return ; 
							 
						 
					
						
							
								
									
										
										
										
											2020-05-14 16:41:43 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
									
										
										
										
											2014-10-12 02:13:22 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2016-10-03 16:33:42 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									bool  editor_ok  =  true ; 
							 
						 
					
						
							
								
									
										
										
										
											2014-10-14 01:01:25 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								# ifdef TOOLS_ENABLED 
  
						 
					
						
							
								
									
										
										
										
											2014-10-12 02:13:22 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									if  ( editor_only )  { 
							 
						 
					
						
							
								
									
										
										
										
											2017-08-19 01:02:56 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										if  ( ! Engine : : get_singleton ( ) - > is_editor_hint ( ) )  { 
							 
						 
					
						
							
								
									
										
										
										
											2014-10-12 02:13:22 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											editor_ok  =  false ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										}  else  { 
							 
						 
					
						
							
								
									
										
										
										
											2014-11-05 21:20:42 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											editor_ok  =  ( get_tree ( ) - > get_edited_scene_root ( )  & &  ( this  = =  get_tree ( ) - > get_edited_scene_root ( )  | |  get_owner ( )  = =  get_tree ( ) - > get_edited_scene_root ( ) ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2014-10-12 02:13:22 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
									
										
										
										
											2016-10-03 16:23:43 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								# else 
  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									if  ( editor_only )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										editor_ok  =  false ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
									
										
										
										
											2014-10-14 01:01:25 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								# endif 
  
						 
					
						
							
								
									
										
										
										
											2014-10-12 02:13:22 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2020-03-27 15:21:27 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									RS : : get_singleton ( ) - > instance_set_visible ( get_instance ( ) ,  is_visible_in_tree ( )  & &  editor_ok ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2014-10-12 02:13:22 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2020-03-26 18:49:16 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								void  Light3D : : _notification ( int  p_what )  {  
						 
					
						
							
								
									
										
										
										
											2022-02-15 18:06:48 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									switch  ( p_what )  { 
							 
						 
					
						
							
								
									
										
										
										
											2022-10-29 22:15:27 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										case  NOTIFICATION_TRANSFORM_CHANGED :  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											update_configuration_warnings ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										}  break ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-02-15 18:06:48 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										case  NOTIFICATION_VISIBILITY_CHANGED : 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										case  NOTIFICATION_ENTER_TREE :  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											_update_visibility ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										}  break ; 
							 
						 
					
						
							
								
									
										
										
										
											2014-10-12 02:13:22 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
									
										
										
										
											2014-06-11 10:41:03 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2020-03-26 18:49:16 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								void  Light3D : : set_editor_only ( bool  p_editor_only )  {  
						 
					
						
							
								
									
										
										
										
											2014-10-12 02:13:22 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									editor_only  =  p_editor_only ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									_update_visibility ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2020-03-26 18:49:16 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								bool  Light3D : : is_editor_only ( )  const  {  
						 
					
						
							
								
									
										
										
										
											2014-10-12 02:13:22 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									return  editor_only ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-08-12 23:57:11 +03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								void  Light3D : : _validate_property ( PropertyInfo  & p_property )  const  {  
						 
					
						
							
								
									
										
										
										
											2021-07-09 10:28:33 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									if  ( ! shadow  & &  ( p_property . name  = =  " shadow_bias "  | |  p_property . name  = =  " shadow_normal_bias "  | |  p_property . name  = =  " shadow_reverse_cull_face "  | |  p_property . name  = =  " shadow_transmittance_bias "  | |  p_property . name  = =  " shadow_opacity "  | |  p_property . name  = =  " shadow_blur "  | |  p_property . name  = =  " distance_fade_shadow " ) )  { 
							 
						 
					
						
							
								
									
										
										
										
											2022-08-12 23:57:11 +03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										p_property . usage  =  PROPERTY_USAGE_NO_EDITOR ; 
							 
						 
					
						
							
								
									
										
										
										
											2020-02-13 23:34:59 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-07-31 16:20:24 -07:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									if  ( get_light_type ( )  ! =  RS : : LIGHT_DIRECTIONAL  & &  ( p_property . name  = =  " light_angular_distance "  | |  p_property . name  = =  " light_intensity_lux " ) )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										// Angular distance and Light Intensity Lux are only used in DirectionalLight3D.
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										p_property . usage  =  PROPERTY_USAGE_NONE ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									}  else  if  ( get_light_type ( )  = =  RS : : LIGHT_DIRECTIONAL  & &  p_property . name  = =  " light_intensity_lumens " )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										p_property . usage  =  PROPERTY_USAGE_NONE ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									if  ( ! GLOBAL_GET ( " rendering/lights_and_shadows/use_physical_light_units " )  & &  ( p_property . name  = =  " light_intensity_lumens "  | |  p_property . name  = =  " light_intensity_lux "  | |  p_property . name  = =  " light_temperature " ) )  { 
							 
						 
					
						
							
								
									
										
										
										
											2022-08-12 23:57:11 +03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										p_property . usage  =  PROPERTY_USAGE_NONE ; 
							 
						 
					
						
							
								
									
										
										
										
											2020-04-09 15:11:15 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
									
										
										
										
											2022-02-24 22:55:14 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-08-12 23:57:11 +03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									if  ( ! distance_fade_enabled  & &  ( p_property . name  = =  " distance_fade_begin "  | |  p_property . name  = =  " distance_fade_shadow "  | |  p_property . name  = =  " distance_fade_length " ) )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										p_property . usage  =  PROPERTY_USAGE_NO_EDITOR ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-02-24 22:55:14 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
									
										
										
										
											2019-03-02 17:12:01 -08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2020-03-26 18:49:16 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								void  Light3D : : _bind_methods ( )  {  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									ClassDB : : bind_method ( D_METHOD ( " set_editor_only " ,  " editor_only " ) ,  & Light3D : : set_editor_only ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									ClassDB : : bind_method ( D_METHOD ( " is_editor_only " ) ,  & Light3D : : is_editor_only ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2017-03-05 16:44:50 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2020-03-26 18:49:16 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									ClassDB : : bind_method ( D_METHOD ( " set_param " ,  " param " ,  " value " ) ,  & Light3D : : set_param ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									ClassDB : : bind_method ( D_METHOD ( " get_param " ,  " param " ) ,  & Light3D : : get_param ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2017-03-05 16:44:50 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2020-03-26 18:49:16 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									ClassDB : : bind_method ( D_METHOD ( " set_shadow " ,  " enabled " ) ,  & Light3D : : set_shadow ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									ClassDB : : bind_method ( D_METHOD ( " has_shadow " ) ,  & Light3D : : has_shadow ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2017-03-05 16:44:50 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2020-03-26 18:49:16 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									ClassDB : : bind_method ( D_METHOD ( " set_negative " ,  " enabled " ) ,  & Light3D : : set_negative ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									ClassDB : : bind_method ( D_METHOD ( " is_negative " ) ,  & Light3D : : is_negative ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2017-03-05 16:44:50 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2020-03-26 18:49:16 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									ClassDB : : bind_method ( D_METHOD ( " set_cull_mask " ,  " cull_mask " ) ,  & Light3D : : set_cull_mask ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									ClassDB : : bind_method ( D_METHOD ( " get_cull_mask " ) ,  & Light3D : : get_cull_mask ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2017-03-05 16:44:50 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-02-24 22:55:14 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									ClassDB : : bind_method ( D_METHOD ( " set_enable_distance_fade " ,  " enable " ) ,  & Light3D : : set_enable_distance_fade ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									ClassDB : : bind_method ( D_METHOD ( " is_distance_fade_enabled " ) ,  & Light3D : : is_distance_fade_enabled ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									ClassDB : : bind_method ( D_METHOD ( " set_distance_fade_begin " ,  " distance " ) ,  & Light3D : : set_distance_fade_begin ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									ClassDB : : bind_method ( D_METHOD ( " get_distance_fade_begin " ) ,  & Light3D : : get_distance_fade_begin ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									ClassDB : : bind_method ( D_METHOD ( " set_distance_fade_shadow " ,  " distance " ) ,  & Light3D : : set_distance_fade_shadow ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									ClassDB : : bind_method ( D_METHOD ( " get_distance_fade_shadow " ) ,  & Light3D : : get_distance_fade_shadow ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									ClassDB : : bind_method ( D_METHOD ( " set_distance_fade_length " ,  " distance " ) ,  & Light3D : : set_distance_fade_length ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									ClassDB : : bind_method ( D_METHOD ( " get_distance_fade_length " ) ,  & Light3D : : get_distance_fade_length ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2020-03-26 18:49:16 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									ClassDB : : bind_method ( D_METHOD ( " set_color " ,  " color " ) ,  & Light3D : : set_color ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									ClassDB : : bind_method ( D_METHOD ( " get_color " ) ,  & Light3D : : get_color ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2017-03-05 16:44:50 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2020-03-26 18:49:16 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									ClassDB : : bind_method ( D_METHOD ( " set_shadow_reverse_cull_face " ,  " enable " ) ,  & Light3D : : set_shadow_reverse_cull_face ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									ClassDB : : bind_method ( D_METHOD ( " get_shadow_reverse_cull_face " ) ,  & Light3D : : get_shadow_reverse_cull_face ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2017-08-19 20:06:40 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2020-03-26 18:49:16 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									ClassDB : : bind_method ( D_METHOD ( " set_bake_mode " ,  " bake_mode " ) ,  & Light3D : : set_bake_mode ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									ClassDB : : bind_method ( D_METHOD ( " get_bake_mode " ) ,  & Light3D : : get_bake_mode ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2017-12-14 08:59:46 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2020-04-14 17:05:45 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									ClassDB : : bind_method ( D_METHOD ( " set_projector " ,  " projector " ) ,  & Light3D : : set_projector ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									ClassDB : : bind_method ( D_METHOD ( " get_projector " ) ,  & Light3D : : get_projector ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-07-31 16:20:24 -07:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									ClassDB : : bind_method ( D_METHOD ( " set_temperature " ,  " temperature " ) ,  & Light3D : : set_temperature ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									ClassDB : : bind_method ( D_METHOD ( " get_temperature " ) ,  & Light3D : : get_temperature ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									ClassDB : : bind_method ( D_METHOD ( " get_correlated_color " ) ,  & Light3D : : get_correlated_color ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2017-01-04 01:16:14 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									ADD_GROUP ( " Light " ,  " light_ " ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-07-31 16:20:24 -07:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									ADD_PROPERTYI ( PropertyInfo ( Variant : : FLOAT ,  " light_intensity_lumens " ,  PROPERTY_HINT_RANGE ,  " 0,100000.0,0.01,or_greater,suffix:lm " ) ,  " set_param " ,  " get_param " ,  PARAM_INTENSITY ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									ADD_PROPERTYI ( PropertyInfo ( Variant : : FLOAT ,  " light_intensity_lux " ,  PROPERTY_HINT_RANGE ,  " 0,150000.0,0.01,or_greater,suffix:lx " ) ,  " set_param " ,  " get_param " ,  PARAM_INTENSITY ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									ADD_PROPERTY ( PropertyInfo ( Variant : : FLOAT ,  " light_temperature " ,  PROPERTY_HINT_RANGE ,  " 1000,15000.0,1.0,suffix:k " ) ,  " set_temperature " ,  " get_temperature " ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2017-02-12 01:11:37 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									ADD_PROPERTY ( PropertyInfo ( Variant : : COLOR ,  " light_color " ,  PROPERTY_HINT_COLOR_NO_ALPHA ) ,  " set_color " ,  " get_color " ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2021-07-16 03:33:10 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									ADD_PROPERTYI ( PropertyInfo ( Variant : : FLOAT ,  " light_energy " ,  PROPERTY_HINT_RANGE ,  " 0,16,0.001,or_greater " ) ,  " set_param " ,  " get_param " ,  PARAM_ENERGY ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									ADD_PROPERTYI ( PropertyInfo ( Variant : : FLOAT ,  " light_indirect_energy " ,  PROPERTY_HINT_RANGE ,  " 0,16,0.001,or_greater " ) ,  " set_param " ,  " get_param " ,  PARAM_INDIRECT_ENERGY ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2021-07-09 10:28:33 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									ADD_PROPERTYI ( PropertyInfo ( Variant : : FLOAT ,  " light_volumetric_fog_energy " ,  PROPERTY_HINT_RANGE ,  " 0,16,0.001,or_greater " ) ,  " set_param " ,  " get_param " ,  PARAM_VOLUMETRIC_FOG_ENERGY ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2020-04-14 17:05:45 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									ADD_PROPERTY ( PropertyInfo ( Variant : : OBJECT ,  " light_projector " ,  PROPERTY_HINT_RESOURCE_TYPE ,  " Texture2D " ) ,  " set_projector " ,  " get_projector " ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2021-07-16 03:33:10 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									ADD_PROPERTYI ( PropertyInfo ( Variant : : FLOAT ,  " light_size " ,  PROPERTY_HINT_RANGE ,  " 0,1,0.001,or_greater,suffix:m " ) ,  " set_param " ,  " get_param " ,  PARAM_SIZE ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-06-17 20:00:54 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									ADD_PROPERTYI ( PropertyInfo ( Variant : : FLOAT ,  " light_angular_distance " ,  PROPERTY_HINT_RANGE ,  " 0,90,0.01,degrees " ) ,  " set_param " ,  " get_param " ,  PARAM_SIZE ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2017-02-12 01:11:37 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									ADD_PROPERTY ( PropertyInfo ( Variant : : BOOL ,  " light_negative " ) ,  " set_negative " ,  " is_negative " ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2021-07-16 03:33:10 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									ADD_PROPERTYI ( PropertyInfo ( Variant : : FLOAT ,  " light_specular " ,  PROPERTY_HINT_RANGE ,  " 0,16,0.001,or_greater " ) ,  " set_param " ,  " get_param " ,  PARAM_SPECULAR ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2021-11-26 17:47:37 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									ADD_PROPERTY ( PropertyInfo ( Variant : : INT ,  " light_bake_mode " ,  PROPERTY_HINT_ENUM ,  " Disabled,Static (VoxelGI/SDFGI/LightmapGI),Dynamic (VoxelGI/SDFGI only) " ) ,  " set_bake_mode " ,  " get_bake_mode " ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2017-02-12 01:11:37 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									ADD_PROPERTY ( PropertyInfo ( Variant : : INT ,  " light_cull_mask " ,  PROPERTY_HINT_LAYERS_3D_RENDER ) ,  " set_cull_mask " ,  " get_cull_mask " ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-07-25 19:11:24 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2017-01-04 01:16:14 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									ADD_GROUP ( " Shadow " ,  " shadow_ " ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2017-02-12 01:11:37 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									ADD_PROPERTY ( PropertyInfo ( Variant : : BOOL ,  " shadow_enabled " ) ,  " set_shadow " ,  " has_shadow " ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2020-04-07 22:51:52 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									ADD_PROPERTYI ( PropertyInfo ( Variant : : FLOAT ,  " shadow_bias " ,  PROPERTY_HINT_RANGE ,  " 0,10,0.001 " ) ,  " set_param " ,  " get_param " ,  PARAM_SHADOW_BIAS ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									ADD_PROPERTYI ( PropertyInfo ( Variant : : FLOAT ,  " shadow_normal_bias " ,  PROPERTY_HINT_RANGE ,  " 0,10,0.001 " ) ,  " set_param " ,  " get_param " ,  PARAM_SHADOW_NORMAL_BIAS ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2017-08-19 20:06:40 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									ADD_PROPERTY ( PropertyInfo ( Variant : : BOOL ,  " shadow_reverse_cull_face " ) ,  " set_shadow_reverse_cull_face " ,  " get_shadow_reverse_cull_face " ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2021-07-16 03:33:10 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									ADD_PROPERTYI ( PropertyInfo ( Variant : : FLOAT ,  " shadow_transmittance_bias " ,  PROPERTY_HINT_RANGE ,  " -16,16,0.001 " ) ,  " set_param " ,  " get_param " ,  PARAM_TRANSMITTANCE_BIAS ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-06-10 12:47:06 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									ADD_PROPERTYI ( PropertyInfo ( Variant : : FLOAT ,  " shadow_opacity " ,  PROPERTY_HINT_RANGE ,  " 0,1,0.01 " ) ,  " set_param " ,  " get_param " ,  PARAM_SHADOW_OPACITY ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2021-07-16 03:33:10 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									ADD_PROPERTYI ( PropertyInfo ( Variant : : FLOAT ,  " shadow_blur " ,  PROPERTY_HINT_RANGE ,  " 0,10,0.001 " ) ,  " set_param " ,  " get_param " ,  PARAM_SHADOW_BLUR ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-07-25 19:11:24 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									ADD_GROUP ( " Distance Fade " ,  " distance_fade_ " ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-02-24 22:55:14 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									ADD_PROPERTY ( PropertyInfo ( Variant : : BOOL ,  " distance_fade_enabled " ) ,  " set_enable_distance_fade " ,  " is_distance_fade_enabled " ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-05-20 00:24:41 -05:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									ADD_PROPERTY ( PropertyInfo ( Variant : : FLOAT ,  " distance_fade_begin " ,  PROPERTY_HINT_RANGE ,  " 0.0,4096.0,0.01,or_greater,suffix:m " ) ,  " set_distance_fade_begin " ,  " get_distance_fade_begin " ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									ADD_PROPERTY ( PropertyInfo ( Variant : : FLOAT ,  " distance_fade_shadow " ,  PROPERTY_HINT_RANGE ,  " 0.0,4096.0,0.01,or_greater,suffix:m " ) ,  " set_distance_fade_shadow " ,  " get_distance_fade_shadow " ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									ADD_PROPERTY ( PropertyInfo ( Variant : : FLOAT ,  " distance_fade_length " ,  PROPERTY_HINT_RANGE ,  " 0.0,4096.0,0.01,or_greater,suffix:m " ) ,  " set_distance_fade_length " ,  " get_distance_fade_length " ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-07-25 19:11:24 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2017-01-04 01:16:14 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									ADD_GROUP ( " Editor " ,  " " ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2017-02-12 01:11:37 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									ADD_PROPERTY ( PropertyInfo ( Variant : : BOOL ,  " editor_only " ) ,  " set_editor_only " ,  " is_editor_only " ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-07-25 19:11:24 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2017-01-04 01:16:14 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									ADD_GROUP ( " " ,  " " ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2017-03-05 16:44:50 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2017-08-20 17:45:01 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									BIND_ENUM_CONSTANT ( PARAM_ENERGY ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2017-11-19 21:45:42 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									BIND_ENUM_CONSTANT ( PARAM_INDIRECT_ENERGY ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2021-07-09 10:28:33 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									BIND_ENUM_CONSTANT ( PARAM_VOLUMETRIC_FOG_ENERGY ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2017-08-20 17:45:01 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									BIND_ENUM_CONSTANT ( PARAM_SPECULAR ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									BIND_ENUM_CONSTANT ( PARAM_RANGE ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2020-04-20 11:48:00 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									BIND_ENUM_CONSTANT ( PARAM_SIZE ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2017-08-20 17:45:01 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									BIND_ENUM_CONSTANT ( PARAM_ATTENUATION ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									BIND_ENUM_CONSTANT ( PARAM_SPOT_ANGLE ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									BIND_ENUM_CONSTANT ( PARAM_SPOT_ATTENUATION ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									BIND_ENUM_CONSTANT ( PARAM_SHADOW_MAX_DISTANCE ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									BIND_ENUM_CONSTANT ( PARAM_SHADOW_SPLIT_1_OFFSET ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									BIND_ENUM_CONSTANT ( PARAM_SHADOW_SPLIT_2_OFFSET ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									BIND_ENUM_CONSTANT ( PARAM_SHADOW_SPLIT_3_OFFSET ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2019-09-07 14:38:17 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									BIND_ENUM_CONSTANT ( PARAM_SHADOW_FADE_START ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2017-08-20 17:45:01 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									BIND_ENUM_CONSTANT ( PARAM_SHADOW_NORMAL_BIAS ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									BIND_ENUM_CONSTANT ( PARAM_SHADOW_BIAS ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2020-04-07 22:51:52 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									BIND_ENUM_CONSTANT ( PARAM_SHADOW_PANCAKE_SIZE ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-06-10 12:47:06 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									BIND_ENUM_CONSTANT ( PARAM_SHADOW_OPACITY ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2020-04-10 02:30:36 -07:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									BIND_ENUM_CONSTANT ( PARAM_SHADOW_BLUR ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2020-04-07 22:51:52 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									BIND_ENUM_CONSTANT ( PARAM_TRANSMITTANCE_BIAS ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-07-31 16:20:24 -07:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									BIND_ENUM_CONSTANT ( PARAM_INTENSITY ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2017-08-20 17:45:01 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									BIND_ENUM_CONSTANT ( PARAM_MAX ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2017-12-14 08:59:46 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									BIND_ENUM_CONSTANT ( BAKE_DISABLED ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2020-06-25 10:33:28 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									BIND_ENUM_CONSTANT ( BAKE_STATIC ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2021-11-26 17:47:37 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									BIND_ENUM_CONSTANT ( BAKE_DYNAMIC ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2014-02-09 22:10:30 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2020-03-27 15:21:27 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								Light3D : : Light3D ( RenderingServer : : LightType  p_type )  {  
						 
					
						
							
								
									
										
										
										
											2014-02-09 22:10:30 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
									type  =  p_type ; 
							 
						 
					
						
							
								
									
										
										
										
											2017-11-09 23:34:01 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									switch  ( p_type )  { 
							 
						 
					
						
							
								
									
										
										
										
											2020-05-10 13:00:47 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										case  RS : : LIGHT_DIRECTIONAL : 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											light  =  RenderingServer : : get_singleton ( ) - > directional_light_create ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											break ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										case  RS : : LIGHT_OMNI : 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											light  =  RenderingServer : : get_singleton ( ) - > omni_light_create ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											break ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										case  RS : : LIGHT_SPOT : 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											light  =  RenderingServer : : get_singleton ( ) - > spot_light_create ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											break ; 
							 
						 
					
						
							
								
									
										
										
										
											2019-04-09 17:08:36 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										default :  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										} ; 
							 
						 
					
						
							
								
									
										
										
										
											2017-11-09 23:34:01 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2020-03-27 15:21:27 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									RS : : get_singleton ( ) - > instance_set_base ( get_instance ( ) ,  light ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2016-10-03 16:33:42 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2016-10-27 11:50:26 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									set_color ( Color ( 1 ,  1 ,  1 ,  1 ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									set_shadow ( false ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									set_negative ( false ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									set_cull_mask ( 0xFFFFFFFF ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									set_param ( PARAM_ENERGY ,  1 ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2017-11-19 21:45:42 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									set_param ( PARAM_INDIRECT_ENERGY ,  1 ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2021-07-09 10:28:33 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									set_param ( PARAM_VOLUMETRIC_FOG_ENERGY ,  1 ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2016-11-20 22:49:53 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									set_param ( PARAM_SPECULAR ,  0.5 ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2016-10-27 11:50:26 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									set_param ( PARAM_RANGE ,  5 ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2020-04-09 15:11:15 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									set_param ( PARAM_SIZE ,  0 ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2016-10-27 11:50:26 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									set_param ( PARAM_ATTENUATION ,  1 ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									set_param ( PARAM_SPOT_ANGLE ,  45 ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									set_param ( PARAM_SPOT_ATTENUATION ,  1 ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									set_param ( PARAM_SHADOW_MAX_DISTANCE ,  0 ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									set_param ( PARAM_SHADOW_SPLIT_1_OFFSET ,  0.1 ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									set_param ( PARAM_SHADOW_SPLIT_2_OFFSET ,  0.2 ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									set_param ( PARAM_SHADOW_SPLIT_3_OFFSET ,  0.5 ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2019-09-07 14:38:17 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									set_param ( PARAM_SHADOW_FADE_START ,  0.8 ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2020-04-07 22:51:52 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									set_param ( PARAM_SHADOW_PANCAKE_SIZE ,  20.0 ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-06-10 12:47:06 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									set_param ( PARAM_SHADOW_OPACITY ,  1.0 ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2020-04-10 02:30:36 -07:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									set_param ( PARAM_SHADOW_BLUR ,  1.0 ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-12-05 21:44:23 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									set_param ( PARAM_SHADOW_BIAS ,  0.1 ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2020-04-07 22:51:52 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									set_param ( PARAM_SHADOW_NORMAL_BIAS ,  1.0 ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									set_param ( PARAM_TRANSMITTANCE_BIAS ,  0.05 ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2019-09-07 14:38:17 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									set_param ( PARAM_SHADOW_FADE_START ,  1 ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-07-31 16:20:24 -07:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									// For OmniLight3D and SpotLight3D, specified in Lumens.
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									set_param ( PARAM_INTENSITY ,  1000.0 ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									set_temperature ( 6500.0 ) ;  // Nearly white.
 
							 
						 
					
						
							
								
									
										
										
										
											2018-07-18 13:47:42 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									set_disable_scale ( true ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2014-02-09 22:10:30 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2020-03-26 18:49:16 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								Light3D : : Light3D ( )  {  
						 
					
						
							
								
									
										
										
										
											2021-06-17 16:03:09 -06:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									ERR_PRINT ( " Light3D should not be instantiated directly; use the DirectionalLight3D, OmniLight3D or SpotLight3D subtypes instead. " ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2014-02-09 22:10:30 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2020-03-26 18:49:16 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								Light3D : : ~ Light3D ( )  {  
						 
					
						
							
								
									
										
										
										
											2022-12-12 12:42:37 -05:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									ERR_FAIL_NULL ( RenderingServer : : get_singleton ( ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2020-03-27 15:21:27 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									RS : : get_singleton ( ) - > instance_set_base ( get_instance ( ) ,  RID ( ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2016-10-27 11:50:26 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2020-05-14 16:41:43 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									if  ( light . is_valid ( ) )  { 
							 
						 
					
						
							
								
									
										
										
										
											2020-03-27 15:21:27 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										RenderingServer : : get_singleton ( ) - > free ( light ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2020-05-14 16:41:43 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
									
										
										
										
											2014-02-09 22:10:30 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
									
										
										
										
											2020-05-14 14:29:06 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2014-02-09 22:10:30 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								/////////////////////////////////////////
  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2020-03-26 18:49:16 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								void  DirectionalLight3D : : set_shadow_mode ( ShadowMode  p_mode )  {  
						 
					
						
							
								
									
										
										
										
											2014-02-09 22:10:30 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
									shadow_mode  =  p_mode ; 
							 
						 
					
						
							
								
									
										
										
										
											2020-03-27 15:21:27 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									RS : : get_singleton ( ) - > light_directional_set_shadow_mode ( light ,  RS : : LightDirectionalShadowMode ( p_mode ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2021-10-23 12:41:10 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									notify_property_list_changed ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2014-02-09 22:10:30 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2020-03-26 18:49:16 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								DirectionalLight3D : : ShadowMode  DirectionalLight3D : : get_shadow_mode ( )  const  {  
						 
					
						
							
								
									
										
										
										
											2014-02-09 22:10:30 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
									return  shadow_mode ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2020-03-26 18:49:16 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								void  DirectionalLight3D : : set_blend_splits ( bool  p_enable )  {  
						 
					
						
							
								
									
										
										
										
											2016-11-09 23:55:06 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									blend_splits  =  p_enable ; 
							 
						 
					
						
							
								
									
										
										
										
											2020-03-27 15:21:27 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									RS : : get_singleton ( ) - > light_directional_set_blend_splits ( light ,  p_enable ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2014-02-09 22:10:30 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2020-03-26 18:49:16 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								bool  DirectionalLight3D : : is_blend_splits_enabled ( )  const  {  
						 
					
						
							
								
									
										
										
										
											2016-11-09 23:55:06 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									return  blend_splits ; 
							 
						 
					
						
							
								
									
										
										
										
											2014-02-09 22:10:30 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2021-10-20 00:40:46 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								void  DirectionalLight3D : : set_sky_mode ( SkyMode  p_mode )  {  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									sky_mode  =  p_mode ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									RS : : get_singleton ( ) - > light_directional_set_sky_mode ( light ,  RS : : LightDirectionalSkyMode ( p_mode ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2020-10-21 23:22:53 -07:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2021-10-20 00:40:46 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								DirectionalLight3D : : SkyMode  DirectionalLight3D : : get_sky_mode ( )  const  {  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									return  sky_mode ; 
							 
						 
					
						
							
								
									
										
										
										
											2020-10-21 23:22:53 -07:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-08-12 23:57:11 +03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								void  DirectionalLight3D : : _validate_property ( PropertyInfo  & p_property )  const  {  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									if  ( shadow_mode  = =  SHADOW_ORTHOGONAL  & &  ( p_property . name  = =  " directional_shadow_split_1 "  | |  p_property . name  = =  " directional_shadow_blend_splits " ) )  { 
							 
						 
					
						
							
								
									
										
										
										
											2021-10-25 22:04:30 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										// Split 2 and split blending are only used with the PSSM 2 Splits and PSSM 4 Splits shadow modes.
 
							 
						 
					
						
							
								
									
										
										
										
											2022-08-12 23:57:11 +03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										p_property . usage  =  PROPERTY_USAGE_NO_EDITOR ; 
							 
						 
					
						
							
								
									
										
										
										
											2021-10-23 12:41:10 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-08-12 23:57:11 +03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									if  ( ( shadow_mode  = =  SHADOW_ORTHOGONAL  | |  shadow_mode  = =  SHADOW_PARALLEL_2_SPLITS )  & &  ( p_property . name  = =  " directional_shadow_split_2 "  | |  p_property . name  = =  " directional_shadow_split_3 " ) )  { 
							 
						 
					
						
							
								
									
										
										
										
											2021-10-25 22:04:30 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										// Splits 3 and 4 are only used with the PSSM 4 Splits shadow mode.
 
							 
						 
					
						
							
								
									
										
										
										
											2022-08-12 23:57:11 +03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										p_property . usage  =  PROPERTY_USAGE_NO_EDITOR ; 
							 
						 
					
						
							
								
									
										
										
										
											2021-10-23 12:41:10 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-08-12 23:57:11 +03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									if  ( p_property . name  = =  " light_size "  | |  p_property . name  = =  " light_projector "  | |  p_property . name  = =  " light_specular " )  { 
							 
						 
					
						
							
								
									
										
										
										
											2021-10-23 12:41:10 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										// Not implemented in DirectionalLight3D (`light_size` is replaced by `light_angular_distance`).
 
							 
						 
					
						
							
								
									
										
										
										
											2022-08-12 23:57:11 +03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										p_property . usage  =  PROPERTY_USAGE_NONE ; 
							 
						 
					
						
							
								
									
										
										
										
											2021-10-23 12:41:10 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
									
										
										
										
											2021-10-25 22:04:30 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-08-12 23:57:11 +03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									if  ( p_property . name  = =  " distance_fade_enabled "  | |  p_property . name  = =  " distance_fade_begin "  | |  p_property . name  = =  " distance_fade_shadow "  | |  p_property . name  = =  " distance_fade_length " )  { 
							 
						 
					
						
							
								
									
										
										
										
											2022-02-24 22:55:14 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										// Not relevant for DirectionalLight3D, as the light LOD system only pertains to point lights.
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										// For DirectionalLight3D, `directional_shadow_max_distance` can be used instead.
 
							 
						 
					
						
							
								
									
										
										
										
											2022-08-12 23:57:11 +03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										p_property . usage  =  PROPERTY_USAGE_NONE ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-02-24 22:55:14 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
									
										
										
										
											2021-10-23 12:41:10 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2020-03-26 18:49:16 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								void  DirectionalLight3D : : _bind_methods ( )  {  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									ClassDB : : bind_method ( D_METHOD ( " set_shadow_mode " ,  " mode " ) ,  & DirectionalLight3D : : set_shadow_mode ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									ClassDB : : bind_method ( D_METHOD ( " get_shadow_mode " ) ,  & DirectionalLight3D : : get_shadow_mode ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2014-02-09 22:10:30 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2020-03-26 18:49:16 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									ClassDB : : bind_method ( D_METHOD ( " set_blend_splits " ,  " enabled " ) ,  & DirectionalLight3D : : set_blend_splits ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									ClassDB : : bind_method ( D_METHOD ( " is_blend_splits_enabled " ) ,  & DirectionalLight3D : : is_blend_splits_enabled ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2016-11-09 23:55:06 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2021-10-20 00:40:46 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									ClassDB : : bind_method ( D_METHOD ( " set_sky_mode " ,  " mode " ) ,  & DirectionalLight3D : : set_sky_mode ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									ClassDB : : bind_method ( D_METHOD ( " get_sky_mode " ) ,  & DirectionalLight3D : : get_sky_mode ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2020-10-21 23:22:53 -07:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2017-01-04 01:16:14 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									ADD_GROUP ( " Directional Shadow " ,  " directional_shadow_ " ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2020-06-01 01:20:35 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									ADD_PROPERTY ( PropertyInfo ( Variant : : INT ,  " directional_shadow_mode " ,  PROPERTY_HINT_ENUM ,  " Orthogonal (Fast),PSSM 2 Splits (Average),PSSM 4 Splits (Slow) " ) ,  " set_shadow_mode " ,  " get_shadow_mode " ) ; 
							 
						 
					
						
							
								
									
										
										
											
												Variant: Added 64-bit packed arrays, renamed Variant::REAL to FLOAT.
- Renames PackedIntArray to PackedInt32Array.
- Renames PackedFloatArray to PackedFloat32Array.
- Adds PackedInt64Array and PackedFloat64Array.
- Renames Variant::REAL to Variant::FLOAT for consistency.
Packed arrays are for storing large amount of data and creating stuff like
meshes, buffers. textures, etc. Forcing them to be 64 is a huge waste of
memory. That said, many users requested the ability to have 64 bits packed
arrays for their games, so this is just an optional added type.
For Variant, the float datatype is always 64 bits, and exposed as `float`.
We still have `real_t` which is the datatype that can change from 32 to 64
bits depending on a compile flag (not entirely working right now, but that's
the idea). It affects math related datatypes and code only.
Neither Variant nor PackedArray make use of real_t, which is only intended
for math precision, so the term is removed from there to keep only float.
											 
										 
										
											2020-02-24 15:20:53 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									ADD_PROPERTYI ( PropertyInfo ( Variant : : FLOAT ,  " directional_shadow_split_1 " ,  PROPERTY_HINT_RANGE ,  " 0,1,0.001 " ) ,  " set_param " ,  " get_param " ,  PARAM_SHADOW_SPLIT_1_OFFSET ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									ADD_PROPERTYI ( PropertyInfo ( Variant : : FLOAT ,  " directional_shadow_split_2 " ,  PROPERTY_HINT_RANGE ,  " 0,1,0.001 " ) ,  " set_param " ,  " get_param " ,  PARAM_SHADOW_SPLIT_2_OFFSET ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									ADD_PROPERTYI ( PropertyInfo ( Variant : : FLOAT ,  " directional_shadow_split_3 " ,  PROPERTY_HINT_RANGE ,  " 0,1,0.001 " ) ,  " set_param " ,  " get_param " ,  PARAM_SHADOW_SPLIT_3_OFFSET ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2017-02-12 01:11:37 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									ADD_PROPERTY ( PropertyInfo ( Variant : : BOOL ,  " directional_shadow_blend_splits " ) ,  " set_blend_splits " ,  " is_blend_splits_enabled " ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2021-07-16 03:33:10 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									ADD_PROPERTYI ( PropertyInfo ( Variant : : FLOAT ,  " directional_shadow_fade_start " ,  PROPERTY_HINT_RANGE ,  " 0,1,0.001 " ) ,  " set_param " ,  " get_param " ,  PARAM_SHADOW_FADE_START ) ; 
							 
						 
					
						
							
								
									
										
										
											
												Fix editor suffixes and degrees conversion
* Functions to convert to/from degrees are all gone. Conversion is done by the editor.
* Use PROPERTY_HINT_ANGLE instead of PROPERTY_HINT_RANGE to edit radian angles in degrees.
* Added possibility to add suffixes to range properties, use "min,max[,step][,suffix:<something>]" example "0,100,1,suffix:m"
* In general, can add suffixes for EditorSpinSlider
Not covered by this PR, will have to be addressed by future ones:
* Ability to switch radians/degrees in the inspector for angle properties (if actually wanted).
* Animations previously made will most likely break, need to add a way to make old ones compatible.
* Only added a "px" suffix to 2D position and a "m" one to 3D position, someone needs to go through the rest of the engine and add all remaining suffixes.
* Likely also need to track down usage of EditorSpinSlider outside properties to add suffixes to it too.
											 
										 
										
											2021-06-29 16:42:12 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									ADD_PROPERTYI ( PropertyInfo ( Variant : : FLOAT ,  " directional_shadow_max_distance " ,  PROPERTY_HINT_RANGE ,  " 0,8192,0.1,or_greater,exp " ) ,  " set_param " ,  " get_param " ,  PARAM_SHADOW_MAX_DISTANCE ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									ADD_PROPERTYI ( PropertyInfo ( Variant : : FLOAT ,  " directional_shadow_pancake_size " ,  PROPERTY_HINT_RANGE ,  " 0,1024,0.1,or_greater,exp " ) ,  " set_param " ,  " get_param " ,  PARAM_SHADOW_PANCAKE_SIZE ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2014-02-09 22:10:30 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2021-10-20 00:40:46 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									ADD_PROPERTY ( PropertyInfo ( Variant : : INT ,  " sky_mode " ,  PROPERTY_HINT_ENUM ,  " Light and Sky,Light Only,Sky Only " ) ,  " set_sky_mode " ,  " get_sky_mode " ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2020-10-21 23:22:53 -07:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2017-08-20 17:45:01 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									BIND_ENUM_CONSTANT ( SHADOW_ORTHOGONAL ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									BIND_ENUM_CONSTANT ( SHADOW_PARALLEL_2_SPLITS ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									BIND_ENUM_CONSTANT ( SHADOW_PARALLEL_4_SPLITS ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2021-10-20 00:40:46 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									BIND_ENUM_CONSTANT ( SKY_MODE_LIGHT_AND_SKY ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									BIND_ENUM_CONSTANT ( SKY_MODE_LIGHT_ONLY ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									BIND_ENUM_CONSTANT ( SKY_MODE_SKY_ONLY ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2014-02-09 22:10:30 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2020-03-26 18:49:16 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								DirectionalLight3D : : DirectionalLight3D ( )  :  
						 
					
						
							
								
									
										
										
										
											2020-03-27 15:21:27 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										Light3D ( RenderingServer : : LIGHT_DIRECTIONAL )  { 
							 
						 
					
						
							
								
									
										
										
										
											2019-07-17 19:44:00 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									set_param ( PARAM_SHADOW_MAX_DISTANCE ,  100 ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2019-09-07 14:38:17 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									set_param ( PARAM_SHADOW_FADE_START ,  0.8 ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-12-05 21:44:23 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									// Increase the default shadow normal bias to better suit most scenes.
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									set_param ( PARAM_SHADOW_NORMAL_BIAS ,  2.0 ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-07-31 16:20:24 -07:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									set_param ( PARAM_INTENSITY ,  100000.0 ) ;  // Specified in Lux, approximate mid-day sun.
 
							 
						 
					
						
							
								
									
										
										
										
											2016-11-09 23:55:06 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									set_shadow_mode ( SHADOW_PARALLEL_4_SPLITS ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									blend_splits  =  false ; 
							 
						 
					
						
							
								
									
										
										
										
											2021-10-20 00:40:46 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									set_sky_mode ( SKY_MODE_LIGHT_AND_SKY ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2016-11-09 23:55:06 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
									
										
										
										
											2014-02-09 22:10:30 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2020-03-26 18:49:16 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								void  OmniLight3D : : set_shadow_mode ( ShadowMode  p_mode )  {  
						 
					
						
							
								
									
										
										
										
											2016-11-09 23:55:06 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									shadow_mode  =  p_mode ; 
							 
						 
					
						
							
								
									
										
										
										
											2020-03-27 15:21:27 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									RS : : get_singleton ( ) - > light_omni_set_shadow_mode ( light ,  RS : : LightOmniShadowMode ( p_mode ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2014-02-09 22:10:30 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2020-03-26 18:49:16 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								OmniLight3D : : ShadowMode  OmniLight3D : : get_shadow_mode ( )  const  {  
						 
					
						
							
								
									
										
										
										
											2016-11-09 23:55:06 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									return  shadow_mode ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-09-19 16:43:15 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								PackedStringArray  OmniLight3D : : get_configuration_warnings ( )  const  {  
						 
					
						
							
								
									
										
										
										
											2022-10-10 14:33:51 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									PackedStringArray  warnings  =  Light3D : : get_configuration_warnings ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2020-04-14 17:05:45 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									if  ( ! has_shadow ( )  & &  get_projector ( ) . is_valid ( ) )  { 
							 
						 
					
						
							
								
									
										
										
										
											2022-03-28 15:24:14 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										warnings . push_back ( RTR ( " Projector texture only works with shadows active. " ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2020-04-14 17:05:45 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2023-02-25 16:24:41 -08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									if  ( get_projector ( ) . is_valid ( )  & &  OS : : get_singleton ( ) - > get_current_rendering_method ( )  = =  " gl_compatibility " )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										warnings . push_back ( RTR ( " Projector textures are not supported when using the GL Compatibility backend yet. Support will be added in a future release. " ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2020-10-29 05:01:28 -05:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									return  warnings ; 
							 
						 
					
						
							
								
									
										
										
										
											2020-04-14 17:05:45 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2020-03-26 18:49:16 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								void  OmniLight3D : : _bind_methods ( )  {  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									ClassDB : : bind_method ( D_METHOD ( " set_shadow_mode " ,  " mode " ) ,  & OmniLight3D : : set_shadow_mode ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									ClassDB : : bind_method ( D_METHOD ( " get_shadow_mode " ) ,  & OmniLight3D : : get_shadow_mode ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2016-11-09 23:55:06 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2017-01-04 01:16:14 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									ADD_GROUP ( " Omni " ,  " omni_ " ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2021-07-16 03:33:10 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									ADD_PROPERTYI ( PropertyInfo ( Variant : : FLOAT ,  " omni_range " ,  PROPERTY_HINT_RANGE ,  " 0,4096,0.001,or_greater,exp " ) ,  " set_param " ,  " get_param " ,  PARAM_RANGE ) ; 
							 
						 
					
						
							
								
									
										
										
											
												Variant: Added 64-bit packed arrays, renamed Variant::REAL to FLOAT.
- Renames PackedIntArray to PackedInt32Array.
- Renames PackedFloatArray to PackedFloat32Array.
- Adds PackedInt64Array and PackedFloat64Array.
- Renames Variant::REAL to Variant::FLOAT for consistency.
Packed arrays are for storing large amount of data and creating stuff like
meshes, buffers. textures, etc. Forcing them to be 64 is a huge waste of
memory. That said, many users requested the ability to have 64 bits packed
arrays for their games, so this is just an optional added type.
For Variant, the float datatype is always 64 bits, and exposed as `float`.
We still have `real_t` which is the datatype that can change from 32 to 64
bits depending on a compile flag (not entirely working right now, but that's
the idea). It affects math related datatypes and code only.
Neither Variant nor PackedArray make use of real_t, which is only intended
for math precision, so the term is removed from there to keep only float.
											 
										 
										
											2020-02-24 15:20:53 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									ADD_PROPERTYI ( PropertyInfo ( Variant : : FLOAT ,  " omni_attenuation " ,  PROPERTY_HINT_EXP_EASING ,  " attenuation " ) ,  " set_param " ,  " get_param " ,  PARAM_ATTENUATION ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2017-02-12 01:11:37 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									ADD_PROPERTY ( PropertyInfo ( Variant : : INT ,  " omni_shadow_mode " ,  PROPERTY_HINT_ENUM ,  " Dual Paraboloid,Cube " ) ,  " set_shadow_mode " ,  " get_shadow_mode " ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2017-09-12 22:09:06 +03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									BIND_ENUM_CONSTANT ( SHADOW_DUAL_PARABOLOID ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									BIND_ENUM_CONSTANT ( SHADOW_CUBE ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2014-02-09 22:10:30 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2020-03-26 18:49:16 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								OmniLight3D : : OmniLight3D ( )  :  
						 
					
						
							
								
									
										
										
										
											2020-03-27 15:21:27 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										Light3D ( RenderingServer : : LIGHT_OMNI )  { 
							 
						 
					
						
							
								
									
										
										
										
											2017-06-12 23:36:33 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									set_shadow_mode ( SHADOW_CUBE ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2014-02-09 22:10:30 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-09-19 16:43:15 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								PackedStringArray  SpotLight3D : : get_configuration_warnings ( )  const  {  
						 
					
						
							
								
									
										
										
										
											2022-10-10 14:33:51 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									PackedStringArray  warnings  =  Light3D : : get_configuration_warnings ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2019-07-07 16:22:09 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									if  ( has_shadow ( )  & &  get_param ( PARAM_SPOT_ANGLE )  > =  90.0 )  { 
							 
						 
					
						
							
								
									
										
										
										
											2022-03-28 15:24:14 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										warnings . push_back ( RTR ( " A SpotLight3D with an angle wider than 90 degrees cannot cast shadows. " ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2019-07-07 16:22:09 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2020-04-14 17:05:45 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									if  ( ! has_shadow ( )  & &  get_projector ( ) . is_valid ( ) )  { 
							 
						 
					
						
							
								
									
										
										
										
											2022-03-28 15:24:14 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										warnings . push_back ( RTR ( " Projector texture only works with shadows active. " ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2020-04-14 17:05:45 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2023-02-25 16:24:41 -08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									if  ( get_projector ( ) . is_valid ( )  & &  OS : : get_singleton ( ) - > get_current_rendering_method ( )  = =  " gl_compatibility " )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										warnings . push_back ( RTR ( " Projector textures are not supported when using the GL Compatibility backend yet. Support will be added in a future release. " ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2020-10-29 05:01:28 -05:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									return  warnings ; 
							 
						 
					
						
							
								
									
										
										
										
											2019-07-07 16:22:09 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2020-03-26 18:49:16 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								void  SpotLight3D : : _bind_methods ( )  {  
						 
					
						
							
								
									
										
										
										
											2017-01-04 01:16:14 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									ADD_GROUP ( " Spot " ,  " spot_ " ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2021-07-16 03:33:10 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									ADD_PROPERTYI ( PropertyInfo ( Variant : : FLOAT ,  " spot_range " ,  PROPERTY_HINT_RANGE ,  " 0,4096,0.001,or_greater,exp,suffix:m " ) ,  " set_param " ,  " get_param " ,  PARAM_RANGE ) ; 
							 
						 
					
						
							
								
									
										
										
											
												Variant: Added 64-bit packed arrays, renamed Variant::REAL to FLOAT.
- Renames PackedIntArray to PackedInt32Array.
- Renames PackedFloatArray to PackedFloat32Array.
- Adds PackedInt64Array and PackedFloat64Array.
- Renames Variant::REAL to Variant::FLOAT for consistency.
Packed arrays are for storing large amount of data and creating stuff like
meshes, buffers. textures, etc. Forcing them to be 64 is a huge waste of
memory. That said, many users requested the ability to have 64 bits packed
arrays for their games, so this is just an optional added type.
For Variant, the float datatype is always 64 bits, and exposed as `float`.
We still have `real_t` which is the datatype that can change from 32 to 64
bits depending on a compile flag (not entirely working right now, but that's
the idea). It affects math related datatypes and code only.
Neither Variant nor PackedArray make use of real_t, which is only intended
for math precision, so the term is removed from there to keep only float.
											 
										 
										
											2020-02-24 15:20:53 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									ADD_PROPERTYI ( PropertyInfo ( Variant : : FLOAT ,  " spot_attenuation " ,  PROPERTY_HINT_EXP_EASING ,  " attenuation " ) ,  " set_param " ,  " get_param " ,  PARAM_ATTENUATION ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2021-07-16 03:33:10 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									ADD_PROPERTYI ( PropertyInfo ( Variant : : FLOAT ,  " spot_angle " ,  PROPERTY_HINT_RANGE ,  " 0,180,0.01,degrees " ) ,  " set_param " ,  " get_param " ,  PARAM_SPOT_ANGLE ) ; 
							 
						 
					
						
							
								
									
										
										
											
												Variant: Added 64-bit packed arrays, renamed Variant::REAL to FLOAT.
- Renames PackedIntArray to PackedInt32Array.
- Renames PackedFloatArray to PackedFloat32Array.
- Adds PackedInt64Array and PackedFloat64Array.
- Renames Variant::REAL to Variant::FLOAT for consistency.
Packed arrays are for storing large amount of data and creating stuff like
meshes, buffers. textures, etc. Forcing them to be 64 is a huge waste of
memory. That said, many users requested the ability to have 64 bits packed
arrays for their games, so this is just an optional added type.
For Variant, the float datatype is always 64 bits, and exposed as `float`.
We still have `real_t` which is the datatype that can change from 32 to 64
bits depending on a compile flag (not entirely working right now, but that's
the idea). It affects math related datatypes and code only.
Neither Variant nor PackedArray make use of real_t, which is only intended
for math precision, so the term is removed from there to keep only float.
											 
										 
										
											2020-02-24 15:20:53 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									ADD_PROPERTYI ( PropertyInfo ( Variant : : FLOAT ,  " spot_angle_attenuation " ,  PROPERTY_HINT_EXP_EASING ,  " attenuation " ) ,  " set_param " ,  " get_param " ,  PARAM_SPOT_ATTENUATION ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2014-02-09 22:10:30 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
									
										
										
										
											2022-12-05 21:44:23 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								SpotLight3D : : SpotLight3D ( )  :  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										Light3D ( RenderingServer : : LIGHT_SPOT )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									// Decrease the default shadow bias to better suit most scenes.
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									set_param ( PARAM_SHADOW_BIAS ,  0.03 ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}