Style: clang-format: Disable AllowShortCaseLabelsOnASingleLine

Part of #33027.
This commit is contained in:
Rémi Verschelde 2020-05-10 13:00:47 +02:00
parent e956e80c1f
commit 69de7ce38c
91 changed files with 4146 additions and 1632 deletions

View File

@ -13,7 +13,7 @@ AlignAfterOpenBracket: DontAlign
AlignTrailingComments: false
AllowAllParametersOfDeclarationOnNextLine: false
# AllowShortBlocksOnASingleLine: false
AllowShortCaseLabelsOnASingleLine: true
# AllowShortCaseLabelsOnASingleLine: false
AllowShortFunctionsOnASingleLine: Inline
# AllowShortIfStatementsOnASingleLine: false
# AllowShortLoopsOnASingleLine: false

View File

@ -114,23 +114,36 @@ int Image::get_format_pixel_size(Format p_format) {
return 1; //luminance
case FORMAT_LA8:
return 2; //luminance-alpha
case FORMAT_R8: return 1;
case FORMAT_RG8: return 2;
case FORMAT_RGB8: return 3;
case FORMAT_RGBA8: return 4;
case FORMAT_RGBA4444: return 2;
case FORMAT_RGB565: return 2;
case FORMAT_R8:
return 1;
case FORMAT_RG8:
return 2;
case FORMAT_RGB8:
return 3;
case FORMAT_RGBA8:
return 4;
case FORMAT_RGBA4444:
return 2;
case FORMAT_RGB565:
return 2;
case FORMAT_RF:
return 4; //float
case FORMAT_RGF: return 8;
case FORMAT_RGBF: return 12;
case FORMAT_RGBAF: return 16;
case FORMAT_RGF:
return 8;
case FORMAT_RGBF:
return 12;
case FORMAT_RGBAF:
return 16;
case FORMAT_RH:
return 2; //half float
case FORMAT_RGH: return 4;
case FORMAT_RGBH: return 6;
case FORMAT_RGBAH: return 8;
case FORMAT_RGBE9995: return 4;
case FORMAT_RGH:
return 4;
case FORMAT_RGBH:
return 6;
case FORMAT_RGBAH:
return 8;
case FORMAT_RGBE9995:
return 4;
case FORMAT_DXT1:
return 1; //s3tc bc1
case FORMAT_DXT3:
@ -149,22 +162,32 @@ int Image::get_format_pixel_size(Format p_format) {
return 1; //unsigned float
case FORMAT_PVRTC2:
return 1; //pvrtc
case FORMAT_PVRTC2A: return 1;
case FORMAT_PVRTC4: return 1;
case FORMAT_PVRTC4A: return 1;
case FORMAT_PVRTC2A:
return 1;
case FORMAT_PVRTC4:
return 1;
case FORMAT_PVRTC4A:
return 1;
case FORMAT_ETC:
return 1; //etc1
case FORMAT_ETC2_R11:
return 1; //etc2
case FORMAT_ETC2_R11S:
return 1; //signed: return 1; NOT srgb.
case FORMAT_ETC2_RG11: return 1;
case FORMAT_ETC2_RG11S: return 1;
case FORMAT_ETC2_RGB8: return 1;
case FORMAT_ETC2_RGBA8: return 1;
case FORMAT_ETC2_RGB8A1: return 1;
case FORMAT_ETC2_RA_AS_RG: return 1;
case FORMAT_DXT5_RA_AS_RG: return 1;
case FORMAT_ETC2_RG11:
return 1;
case FORMAT_ETC2_RG11S:
return 1;
case FORMAT_ETC2_RGB8:
return 1;
case FORMAT_ETC2_RGBA8:
return 1;
case FORMAT_ETC2_RGB8A1:
return 1;
case FORMAT_ETC2_RA_AS_RG:
return 1;
case FORMAT_DXT5_RA_AS_RG:
return 1;
case FORMAT_MAX: {
}
}
@ -478,36 +501,96 @@ void Image::convert(Format p_new_format) {
switch (conversion_type) {
case FORMAT_L8 | (FORMAT_LA8 << 8): _convert<1, false, 1, true, true, true>(width, height, rptr, wptr); break;
case FORMAT_L8 | (FORMAT_R8 << 8): _convert<1, false, 1, false, true, false>(width, height, rptr, wptr); break;
case FORMAT_L8 | (FORMAT_RG8 << 8): _convert<1, false, 2, false, true, false>(width, height, rptr, wptr); break;
case FORMAT_L8 | (FORMAT_RGB8 << 8): _convert<1, false, 3, false, true, false>(width, height, rptr, wptr); break;
case FORMAT_L8 | (FORMAT_RGBA8 << 8): _convert<1, false, 3, true, true, false>(width, height, rptr, wptr); break;
case FORMAT_LA8 | (FORMAT_L8 << 8): _convert<1, true, 1, false, true, true>(width, height, rptr, wptr); break;
case FORMAT_LA8 | (FORMAT_R8 << 8): _convert<1, true, 1, false, true, false>(width, height, rptr, wptr); break;
case FORMAT_LA8 | (FORMAT_RG8 << 8): _convert<1, true, 2, false, true, false>(width, height, rptr, wptr); break;
case FORMAT_LA8 | (FORMAT_RGB8 << 8): _convert<1, true, 3, false, true, false>(width, height, rptr, wptr); break;
case FORMAT_LA8 | (FORMAT_RGBA8 << 8): _convert<1, true, 3, true, true, false>(width, height, rptr, wptr); break;
case FORMAT_R8 | (FORMAT_L8 << 8): _convert<1, false, 1, false, false, true>(width, height, rptr, wptr); break;
case FORMAT_R8 | (FORMAT_LA8 << 8): _convert<1, false, 1, true, false, true>(width, height, rptr, wptr); break;
case FORMAT_R8 | (FORMAT_RG8 << 8): _convert<1, false, 2, false, false, false>(width, height, rptr, wptr); break;
case FORMAT_R8 | (FORMAT_RGB8 << 8): _convert<1, false, 3, false, false, false>(width, height, rptr, wptr); break;
case FORMAT_R8 | (FORMAT_RGBA8 << 8): _convert<1, false, 3, true, false, false>(width, height, rptr, wptr); break;
case FORMAT_RG8 | (FORMAT_L8 << 8): _convert<2, false, 1, false, false, true>(width, height, rptr, wptr); break;
case FORMAT_RG8 | (FORMAT_LA8 << 8): _convert<2, false, 1, true, false, true>(width, height, rptr, wptr); break;
case FORMAT_RG8 | (FORMAT_R8 << 8): _convert<2, false, 1, false, false, false>(width, height, rptr, wptr); break;
case FORMAT_RG8 | (FORMAT_RGB8 << 8): _convert<2, false, 3, false, false, false>(width, height, rptr, wptr); break;
case FORMAT_RG8 | (FORMAT_RGBA8 << 8): _convert<2, false, 3, true, false, false>(width, height, rptr, wptr); break;
case FORMAT_RGB8 | (FORMAT_L8 << 8): _convert<3, false, 1, false, false, true>(width, height, rptr, wptr); break;
case FORMAT_RGB8 | (FORMAT_LA8 << 8): _convert<3, false, 1, true, false, true>(width, height, rptr, wptr); break;
case FORMAT_RGB8 | (FORMAT_R8 << 8): _convert<3, false, 1, false, false, false>(width, height, rptr, wptr); break;
case FORMAT_RGB8 | (FORMAT_RG8 << 8): _convert<3, false, 2, false, false, false>(width, height, rptr, wptr); break;
case FORMAT_RGB8 | (FORMAT_RGBA8 << 8): _convert<3, false, 3, true, false, false>(width, height, rptr, wptr); break;
case FORMAT_RGBA8 | (FORMAT_L8 << 8): _convert<3, true, 1, false, false, true>(width, height, rptr, wptr); break;
case FORMAT_RGBA8 | (FORMAT_LA8 << 8): _convert<3, true, 1, true, false, true>(width, height, rptr, wptr); break;
case FORMAT_RGBA8 | (FORMAT_R8 << 8): _convert<3, true, 1, false, false, false>(width, height, rptr, wptr); break;
case FORMAT_RGBA8 | (FORMAT_RG8 << 8): _convert<3, true, 2, false, false, false>(width, height, rptr, wptr); break;
case FORMAT_RGBA8 | (FORMAT_RGB8 << 8): _convert<3, true, 3, false, false, false>(width, height, rptr, wptr); break;
case FORMAT_L8 | (FORMAT_LA8 << 8):
_convert<1, false, 1, true, true, true>(width, height, rptr, wptr);
break;
case FORMAT_L8 | (FORMAT_R8 << 8):
_convert<1, false, 1, false, true, false>(width, height, rptr, wptr);
break;
case FORMAT_L8 | (FORMAT_RG8 << 8):
_convert<1, false, 2, false, true, false>(width, height, rptr, wptr);
break;
case FORMAT_L8 | (FORMAT_RGB8 << 8):
_convert<1, false, 3, false, true, false>(width, height, rptr, wptr);
break;
case FORMAT_L8 | (FORMAT_RGBA8 << 8):
_convert<1, false, 3, true, true, false>(width, height, rptr, wptr);
break;
case FORMAT_LA8 | (FORMAT_L8 << 8):
_convert<1, true, 1, false, true, true>(width, height, rptr, wptr);
break;
case FORMAT_LA8 | (FORMAT_R8 << 8):
_convert<1, true, 1, false, true, false>(width, height, rptr, wptr);
break;
case FORMAT_LA8 | (FORMAT_RG8 << 8):
_convert<1, true, 2, false, true, false>(width, height, rptr, wptr);
break;
case FORMAT_LA8 | (FORMAT_RGB8 << 8):
_convert<1, true, 3, false, true, false>(width, height, rptr, wptr);
break;
case FORMAT_LA8 | (FORMAT_RGBA8 << 8):
_convert<1, true, 3, true, true, false>(width, height, rptr, wptr);
break;
case FORMAT_R8 | (FORMAT_L8 << 8):
_convert<1, false, 1, false, false, true>(width, height, rptr, wptr);
break;
case FORMAT_R8 | (FORMAT_LA8 << 8):
_convert<1, false, 1, true, false, true>(width, height, rptr, wptr);
break;
case FORMAT_R8 | (FORMAT_RG8 << 8):
_convert<1, false, 2, false, false, false>(width, height, rptr, wptr);
break;
case FORMAT_R8 | (FORMAT_RGB8 << 8):
_convert<1, false, 3, false, false, false>(width, height, rptr, wptr);
break;
case FORMAT_R8 | (FORMAT_RGBA8 << 8):
_convert<1, false, 3, true, false, false>(width, height, rptr, wptr);
break;
case FORMAT_RG8 | (FORMAT_L8 << 8):
_convert<2, false, 1, false, false, true>(width, height, rptr, wptr);
break;
case FORMAT_RG8 | (FORMAT_LA8 << 8):
_convert<2, false, 1, true, false, true>(width, height, rptr, wptr);
break;
case FORMAT_RG8 | (FORMAT_R8 << 8):
_convert<2, false, 1, false, false, false>(width, height, rptr, wptr);
break;
case FORMAT_RG8 | (FORMAT_RGB8 << 8):
_convert<2, false, 3, false, false, false>(width, height, rptr, wptr);
break;
case FORMAT_RG8 | (FORMAT_RGBA8 << 8):
_convert<2, false, 3, true, false, false>(width, height, rptr, wptr);
break;
case FORMAT_RGB8 | (FORMAT_L8 << 8):
_convert<3, false, 1, false, false, true>(width, height, rptr, wptr);
break;
case FORMAT_RGB8 | (FORMAT_LA8 << 8):
_convert<3, false, 1, true, false, true>(width, height, rptr, wptr);
break;
case FORMAT_RGB8 | (FORMAT_R8 << 8):
_convert<3, false, 1, false, false, false>(width, height, rptr, wptr);
break;
case FORMAT_RGB8 | (FORMAT_RG8 << 8):
_convert<3, false, 2, false, false, false>(width, height, rptr, wptr);
break;
case FORMAT_RGB8 | (FORMAT_RGBA8 << 8):
_convert<3, false, 3, true, false, false>(width, height, rptr, wptr);
break;
case FORMAT_RGBA8 | (FORMAT_L8 << 8):
_convert<3, true, 1, false, false, true>(width, height, rptr, wptr);
break;
case FORMAT_RGBA8 | (FORMAT_LA8 << 8):
_convert<3, true, 1, true, false, true>(width, height, rptr, wptr);
break;
case FORMAT_RGBA8 | (FORMAT_R8 << 8):
_convert<3, true, 1, false, false, false>(width, height, rptr, wptr);
break;
case FORMAT_RGBA8 | (FORMAT_RG8 << 8):
_convert<3, true, 2, false, false, false>(width, height, rptr, wptr);
break;
case FORMAT_RGBA8 | (FORMAT_RGB8 << 8):
_convert<3, true, 3, false, false, false>(width, height, rptr, wptr);
break;
}
bool gen_mipmaps = mipmaps;
@ -949,25 +1032,49 @@ void Image::resize(int p_width, int p_height, Interpolation p_interpolation) {
if (format >= FORMAT_L8 && format <= FORMAT_RGBA8) {
switch (get_format_pixel_size(format)) {
case 1: _scale_nearest<1, uint8_t>(r_ptr, w_ptr, width, height, p_width, p_height); break;
case 2: _scale_nearest<2, uint8_t>(r_ptr, w_ptr, width, height, p_width, p_height); break;
case 3: _scale_nearest<3, uint8_t>(r_ptr, w_ptr, width, height, p_width, p_height); break;
case 4: _scale_nearest<4, uint8_t>(r_ptr, w_ptr, width, height, p_width, p_height); break;
case 1:
_scale_nearest<1, uint8_t>(r_ptr, w_ptr, width, height, p_width, p_height);
break;
case 2:
_scale_nearest<2, uint8_t>(r_ptr, w_ptr, width, height, p_width, p_height);
break;
case 3:
_scale_nearest<3, uint8_t>(r_ptr, w_ptr, width, height, p_width, p_height);
break;
case 4:
_scale_nearest<4, uint8_t>(r_ptr, w_ptr, width, height, p_width, p_height);
break;
}
} else if (format >= FORMAT_RF && format <= FORMAT_RGBAF) {
switch (get_format_pixel_size(format)) {
case 4: _scale_nearest<1, float>(r_ptr, w_ptr, width, height, p_width, p_height); break;
case 8: _scale_nearest<2, float>(r_ptr, w_ptr, width, height, p_width, p_height); break;
case 12: _scale_nearest<3, float>(r_ptr, w_ptr, width, height, p_width, p_height); break;
case 16: _scale_nearest<4, float>(r_ptr, w_ptr, width, height, p_width, p_height); break;
case 4:
_scale_nearest<1, float>(r_ptr, w_ptr, width, height, p_width, p_height);
break;
case 8:
_scale_nearest<2, float>(r_ptr, w_ptr, width, height, p_width, p_height);
break;
case 12:
_scale_nearest<3, float>(r_ptr, w_ptr, width, height, p_width, p_height);
break;
case 16:
_scale_nearest<4, float>(r_ptr, w_ptr, width, height, p_width, p_height);
break;
}
} else if (format >= FORMAT_RH && format <= FORMAT_RGBAH) {
switch (get_format_pixel_size(format)) {
case 2: _scale_nearest<1, uint16_t>(r_ptr, w_ptr, width, height, p_width, p_height); break;
case 4: _scale_nearest<2, uint16_t>(r_ptr, w_ptr, width, height, p_width, p_height); break;
case 6: _scale_nearest<3, uint16_t>(r_ptr, w_ptr, width, height, p_width, p_height); break;
case 8: _scale_nearest<4, uint16_t>(r_ptr, w_ptr, width, height, p_width, p_height); break;
case 2:
_scale_nearest<1, uint16_t>(r_ptr, w_ptr, width, height, p_width, p_height);
break;
case 4:
_scale_nearest<2, uint16_t>(r_ptr, w_ptr, width, height, p_width, p_height);
break;
case 6:
_scale_nearest<3, uint16_t>(r_ptr, w_ptr, width, height, p_width, p_height);
break;
case 8:
_scale_nearest<4, uint16_t>(r_ptr, w_ptr, width, height, p_width, p_height);
break;
}
}
@ -1013,24 +1120,48 @@ void Image::resize(int p_width, int p_height, Interpolation p_interpolation) {
if (format >= FORMAT_L8 && format <= FORMAT_RGBA8) {
switch (get_format_pixel_size(format)) {
case 1: _scale_bilinear<1, uint8_t>(src_ptr, w_ptr, src_width, src_height, p_width, p_height); break;
case 2: _scale_bilinear<2, uint8_t>(src_ptr, w_ptr, src_width, src_height, p_width, p_height); break;
case 3: _scale_bilinear<3, uint8_t>(src_ptr, w_ptr, src_width, src_height, p_width, p_height); break;
case 4: _scale_bilinear<4, uint8_t>(src_ptr, w_ptr, src_width, src_height, p_width, p_height); break;
case 1:
_scale_bilinear<1, uint8_t>(src_ptr, w_ptr, src_width, src_height, p_width, p_height);
break;
case 2:
_scale_bilinear<2, uint8_t>(src_ptr, w_ptr, src_width, src_height, p_width, p_height);
break;
case 3:
_scale_bilinear<3, uint8_t>(src_ptr, w_ptr, src_width, src_height, p_width, p_height);
break;
case 4:
_scale_bilinear<4, uint8_t>(src_ptr, w_ptr, src_width, src_height, p_width, p_height);
break;
}
} else if (format >= FORMAT_RF && format <= FORMAT_RGBAF) {
switch (get_format_pixel_size(format)) {
case 4: _scale_bilinear<1, float>(src_ptr, w_ptr, src_width, src_height, p_width, p_height); break;
case 8: _scale_bilinear<2, float>(src_ptr, w_ptr, src_width, src_height, p_width, p_height); break;
case 12: _scale_bilinear<3, float>(src_ptr, w_ptr, src_width, src_height, p_width, p_height); break;
case 16: _scale_bilinear<4, float>(src_ptr, w_ptr, src_width, src_height, p_width, p_height); break;
case 4:
_scale_bilinear<1, float>(src_ptr, w_ptr, src_width, src_height, p_width, p_height);
break;
case 8:
_scale_bilinear<2, float>(src_ptr, w_ptr, src_width, src_height, p_width, p_height);
break;
case 12:
_scale_bilinear<3, float>(src_ptr, w_ptr, src_width, src_height, p_width, p_height);
break;
case 16:
_scale_bilinear<4, float>(src_ptr, w_ptr, src_width, src_height, p_width, p_height);
break;
}
} else if (format >= FORMAT_RH && format <= FORMAT_RGBAH) {
switch (get_format_pixel_size(format)) {
case 2: _scale_bilinear<1, uint16_t>(src_ptr, w_ptr, src_width, src_height, p_width, p_height); break;
case 4: _scale_bilinear<2, uint16_t>(src_ptr, w_ptr, src_width, src_height, p_width, p_height); break;
case 6: _scale_bilinear<3, uint16_t>(src_ptr, w_ptr, src_width, src_height, p_width, p_height); break;
case 8: _scale_bilinear<4, uint16_t>(src_ptr, w_ptr, src_width, src_height, p_width, p_height); break;
case 2:
_scale_bilinear<1, uint16_t>(src_ptr, w_ptr, src_width, src_height, p_width, p_height);
break;
case 4:
_scale_bilinear<2, uint16_t>(src_ptr, w_ptr, src_width, src_height, p_width, p_height);
break;
case 6:
_scale_bilinear<3, uint16_t>(src_ptr, w_ptr, src_width, src_height, p_width, p_height);
break;
case 8:
_scale_bilinear<4, uint16_t>(src_ptr, w_ptr, src_width, src_height, p_width, p_height);
break;
}
}
}
@ -1046,24 +1177,48 @@ void Image::resize(int p_width, int p_height, Interpolation p_interpolation) {
if (format >= FORMAT_L8 && format <= FORMAT_RGBA8) {
switch (get_format_pixel_size(format)) {
case 1: _scale_cubic<1, uint8_t>(r_ptr, w_ptr, width, height, p_width, p_height); break;
case 2: _scale_cubic<2, uint8_t>(r_ptr, w_ptr, width, height, p_width, p_height); break;
case 3: _scale_cubic<3, uint8_t>(r_ptr, w_ptr, width, height, p_width, p_height); break;
case 4: _scale_cubic<4, uint8_t>(r_ptr, w_ptr, width, height, p_width, p_height); break;
case 1:
_scale_cubic<1, uint8_t>(r_ptr, w_ptr, width, height, p_width, p_height);
break;
case 2:
_scale_cubic<2, uint8_t>(r_ptr, w_ptr, width, height, p_width, p_height);
break;
case 3:
_scale_cubic<3, uint8_t>(r_ptr, w_ptr, width, height, p_width, p_height);
break;
case 4:
_scale_cubic<4, uint8_t>(r_ptr, w_ptr, width, height, p_width, p_height);
break;
}
} else if (format >= FORMAT_RF && format <= FORMAT_RGBAF) {
switch (get_format_pixel_size(format)) {
case 4: _scale_cubic<1, float>(r_ptr, w_ptr, width, height, p_width, p_height); break;
case 8: _scale_cubic<2, float>(r_ptr, w_ptr, width, height, p_width, p_height); break;
case 12: _scale_cubic<3, float>(r_ptr, w_ptr, width, height, p_width, p_height); break;
case 16: _scale_cubic<4, float>(r_ptr, w_ptr, width, height, p_width, p_height); break;
case 4:
_scale_cubic<1, float>(r_ptr, w_ptr, width, height, p_width, p_height);
break;
case 8:
_scale_cubic<2, float>(r_ptr, w_ptr, width, height, p_width, p_height);
break;
case 12:
_scale_cubic<3, float>(r_ptr, w_ptr, width, height, p_width, p_height);
break;
case 16:
_scale_cubic<4, float>(r_ptr, w_ptr, width, height, p_width, p_height);
break;
}
} else if (format >= FORMAT_RH && format <= FORMAT_RGBAH) {
switch (get_format_pixel_size(format)) {
case 2: _scale_cubic<1, uint16_t>(r_ptr, w_ptr, width, height, p_width, p_height); break;
case 4: _scale_cubic<2, uint16_t>(r_ptr, w_ptr, width, height, p_width, p_height); break;
case 6: _scale_cubic<3, uint16_t>(r_ptr, w_ptr, width, height, p_width, p_height); break;
case 8: _scale_cubic<4, uint16_t>(r_ptr, w_ptr, width, height, p_width, p_height); break;
case 2:
_scale_cubic<1, uint16_t>(r_ptr, w_ptr, width, height, p_width, p_height);
break;
case 4:
_scale_cubic<2, uint16_t>(r_ptr, w_ptr, width, height, p_width, p_height);
break;
case 6:
_scale_cubic<3, uint16_t>(r_ptr, w_ptr, width, height, p_width, p_height);
break;
case 8:
_scale_cubic<4, uint16_t>(r_ptr, w_ptr, width, height, p_width, p_height);
break;
}
}
} break;
@ -1071,24 +1226,48 @@ void Image::resize(int p_width, int p_height, Interpolation p_interpolation) {
if (format >= FORMAT_L8 && format <= FORMAT_RGBA8) {
switch (get_format_pixel_size(format)) {
case 1: _scale_lanczos<1, uint8_t>(r_ptr, w_ptr, width, height, p_width, p_height); break;
case 2: _scale_lanczos<2, uint8_t>(r_ptr, w_ptr, width, height, p_width, p_height); break;
case 3: _scale_lanczos<3, uint8_t>(r_ptr, w_ptr, width, height, p_width, p_height); break;
case 4: _scale_lanczos<4, uint8_t>(r_ptr, w_ptr, width, height, p_width, p_height); break;
case 1:
_scale_lanczos<1, uint8_t>(r_ptr, w_ptr, width, height, p_width, p_height);
break;
case 2:
_scale_lanczos<2, uint8_t>(r_ptr, w_ptr, width, height, p_width, p_height);
break;
case 3:
_scale_lanczos<3, uint8_t>(r_ptr, w_ptr, width, height, p_width, p_height);
break;
case 4:
_scale_lanczos<4, uint8_t>(r_ptr, w_ptr, width, height, p_width, p_height);
break;
}
} else if (format >= FORMAT_RF && format <= FORMAT_RGBAF) {
switch (get_format_pixel_size(format)) {
case 4: _scale_lanczos<1, float>(r_ptr, w_ptr, width, height, p_width, p_height); break;
case 8: _scale_lanczos<2, float>(r_ptr, w_ptr, width, height, p_width, p_height); break;
case 12: _scale_lanczos<3, float>(r_ptr, w_ptr, width, height, p_width, p_height); break;
case 16: _scale_lanczos<4, float>(r_ptr, w_ptr, width, height, p_width, p_height); break;
case 4:
_scale_lanczos<1, float>(r_ptr, w_ptr, width, height, p_width, p_height);
break;
case 8:
_scale_lanczos<2, float>(r_ptr, w_ptr, width, height, p_width, p_height);
break;
case 12:
_scale_lanczos<3, float>(r_ptr, w_ptr, width, height, p_width, p_height);
break;
case 16:
_scale_lanczos<4, float>(r_ptr, w_ptr, width, height, p_width, p_height);
break;
}
} else if (format >= FORMAT_RH && format <= FORMAT_RGBAH) {
switch (get_format_pixel_size(format)) {
case 2: _scale_lanczos<1, uint16_t>(r_ptr, w_ptr, width, height, p_width, p_height); break;
case 4: _scale_lanczos<2, uint16_t>(r_ptr, w_ptr, width, height, p_width, p_height); break;
case 6: _scale_lanczos<3, uint16_t>(r_ptr, w_ptr, width, height, p_width, p_height); break;
case 8: _scale_lanczos<4, uint16_t>(r_ptr, w_ptr, width, height, p_width, p_height); break;
case 2:
_scale_lanczos<1, uint16_t>(r_ptr, w_ptr, width, height, p_width, p_height);
break;
case 4:
_scale_lanczos<2, uint16_t>(r_ptr, w_ptr, width, height, p_width, p_height);
break;
case 6:
_scale_lanczos<3, uint16_t>(r_ptr, w_ptr, width, height, p_width, p_height);
break;
case 8:
_scale_lanczos<4, uint16_t>(r_ptr, w_ptr, width, height, p_width, p_height);
break;
}
}
} break;
@ -1403,23 +1582,51 @@ void Image::shrink_x2() {
switch (format) {
case FORMAT_L8:
case FORMAT_R8: _generate_po2_mipmap<uint8_t, 1, false, Image::average_4_uint8, Image::renormalize_uint8>(r, w, width, height); break;
case FORMAT_LA8: _generate_po2_mipmap<uint8_t, 2, false, Image::average_4_uint8, Image::renormalize_uint8>(r, w, width, height); break;
case FORMAT_RG8: _generate_po2_mipmap<uint8_t, 2, false, Image::average_4_uint8, Image::renormalize_uint8>(r, w, width, height); break;
case FORMAT_RGB8: _generate_po2_mipmap<uint8_t, 3, false, Image::average_4_uint8, Image::renormalize_uint8>(r, w, width, height); break;
case FORMAT_RGBA8: _generate_po2_mipmap<uint8_t, 4, false, Image::average_4_uint8, Image::renormalize_uint8>(r, w, width, height); break;
case FORMAT_R8:
_generate_po2_mipmap<uint8_t, 1, false, Image::average_4_uint8, Image::renormalize_uint8>(r, w, width, height);
break;
case FORMAT_LA8:
_generate_po2_mipmap<uint8_t, 2, false, Image::average_4_uint8, Image::renormalize_uint8>(r, w, width, height);
break;
case FORMAT_RG8:
_generate_po2_mipmap<uint8_t, 2, false, Image::average_4_uint8, Image::renormalize_uint8>(r, w, width, height);
break;
case FORMAT_RGB8:
_generate_po2_mipmap<uint8_t, 3, false, Image::average_4_uint8, Image::renormalize_uint8>(r, w, width, height);
break;
case FORMAT_RGBA8:
_generate_po2_mipmap<uint8_t, 4, false, Image::average_4_uint8, Image::renormalize_uint8>(r, w, width, height);
break;
case FORMAT_RF: _generate_po2_mipmap<float, 1, false, Image::average_4_float, Image::renormalize_float>(reinterpret_cast<const float *>(r), reinterpret_cast<float *>(w), width, height); break;
case FORMAT_RGF: _generate_po2_mipmap<float, 2, false, Image::average_4_float, Image::renormalize_float>(reinterpret_cast<const float *>(r), reinterpret_cast<float *>(w), width, height); break;
case FORMAT_RGBF: _generate_po2_mipmap<float, 3, false, Image::average_4_float, Image::renormalize_float>(reinterpret_cast<const float *>(r), reinterpret_cast<float *>(w), width, height); break;
case FORMAT_RGBAF: _generate_po2_mipmap<float, 4, false, Image::average_4_float, Image::renormalize_float>(reinterpret_cast<const float *>(r), reinterpret_cast<float *>(w), width, height); break;
case FORMAT_RF:
_generate_po2_mipmap<float, 1, false, Image::average_4_float, Image::renormalize_float>(reinterpret_cast<const float *>(r), reinterpret_cast<float *>(w), width, height);
break;
case FORMAT_RGF:
_generate_po2_mipmap<float, 2, false, Image::average_4_float, Image::renormalize_float>(reinterpret_cast<const float *>(r), reinterpret_cast<float *>(w), width, height);
break;
case FORMAT_RGBF:
_generate_po2_mipmap<float, 3, false, Image::average_4_float, Image::renormalize_float>(reinterpret_cast<const float *>(r), reinterpret_cast<float *>(w), width, height);
break;
case FORMAT_RGBAF:
_generate_po2_mipmap<float, 4, false, Image::average_4_float, Image::renormalize_float>(reinterpret_cast<const float *>(r), reinterpret_cast<float *>(w), width, height);
break;
case FORMAT_RH: _generate_po2_mipmap<uint16_t, 1, false, Image::average_4_half, Image::renormalize_half>(reinterpret_cast<const uint16_t *>(r), reinterpret_cast<uint16_t *>(w), width, height); break;
case FORMAT_RGH: _generate_po2_mipmap<uint16_t, 2, false, Image::average_4_half, Image::renormalize_half>(reinterpret_cast<const uint16_t *>(r), reinterpret_cast<uint16_t *>(w), width, height); break;
case FORMAT_RGBH: _generate_po2_mipmap<uint16_t, 3, false, Image::average_4_half, Image::renormalize_half>(reinterpret_cast<const uint16_t *>(r), reinterpret_cast<uint16_t *>(w), width, height); break;
case FORMAT_RGBAH: _generate_po2_mipmap<uint16_t, 4, false, Image::average_4_half, Image::renormalize_half>(reinterpret_cast<const uint16_t *>(r), reinterpret_cast<uint16_t *>(w), width, height); break;
case FORMAT_RH:
_generate_po2_mipmap<uint16_t, 1, false, Image::average_4_half, Image::renormalize_half>(reinterpret_cast<const uint16_t *>(r), reinterpret_cast<uint16_t *>(w), width, height);
break;
case FORMAT_RGH:
_generate_po2_mipmap<uint16_t, 2, false, Image::average_4_half, Image::renormalize_half>(reinterpret_cast<const uint16_t *>(r), reinterpret_cast<uint16_t *>(w), width, height);
break;
case FORMAT_RGBH:
_generate_po2_mipmap<uint16_t, 3, false, Image::average_4_half, Image::renormalize_half>(reinterpret_cast<const uint16_t *>(r), reinterpret_cast<uint16_t *>(w), width, height);
break;
case FORMAT_RGBAH:
_generate_po2_mipmap<uint16_t, 4, false, Image::average_4_half, Image::renormalize_half>(reinterpret_cast<const uint16_t *>(r), reinterpret_cast<uint16_t *>(w), width, height);
break;
case FORMAT_RGBE9995: _generate_po2_mipmap<uint32_t, 1, false, Image::average_4_rgbe9995, Image::renormalize_rgbe9995>(reinterpret_cast<const uint32_t *>(r), reinterpret_cast<uint32_t *>(w), width, height); break;
case FORMAT_RGBE9995:
_generate_po2_mipmap<uint32_t, 1, false, Image::average_4_rgbe9995, Image::renormalize_rgbe9995>(reinterpret_cast<const uint32_t *>(r), reinterpret_cast<uint32_t *>(w), width, height);
break;
default: {
}
}
@ -1485,9 +1692,13 @@ Error Image::generate_mipmaps(bool p_renormalize) {
switch (format) {
case FORMAT_L8:
case FORMAT_R8: _generate_po2_mipmap<uint8_t, 1, false, Image::average_4_uint8, Image::renormalize_uint8>(&wp[prev_ofs], &wp[ofs], prev_w, prev_h); break;
case FORMAT_R8:
_generate_po2_mipmap<uint8_t, 1, false, Image::average_4_uint8, Image::renormalize_uint8>(&wp[prev_ofs], &wp[ofs], prev_w, prev_h);
break;
case FORMAT_LA8:
case FORMAT_RG8: _generate_po2_mipmap<uint8_t, 2, false, Image::average_4_uint8, Image::renormalize_uint8>(&wp[prev_ofs], &wp[ofs], prev_w, prev_h); break;
case FORMAT_RG8:
_generate_po2_mipmap<uint8_t, 2, false, Image::average_4_uint8, Image::renormalize_uint8>(&wp[prev_ofs], &wp[ofs], prev_w, prev_h);
break;
case FORMAT_RGB8:
if (p_renormalize)
_generate_po2_mipmap<uint8_t, 3, true, Image::average_4_uint8, Image::renormalize_uint8>(&wp[prev_ofs], &wp[ofs], prev_w, prev_h);
@ -1911,12 +2122,24 @@ void Image::create(const char **p_xpm) {
break;
switch (i) {
case 0: col_r = v << 4; break;
case 1: col_r |= v; break;
case 2: col_g = v << 4; break;
case 3: col_g |= v; break;
case 4: col_b = v << 4; break;
case 5: col_b |= v; break;
case 0:
col_r = v << 4;
break;
case 1:
col_r |= v;
break;
case 2:
col_g = v << 4;
break;
case 3:
col_g |= v;
break;
case 4:
col_b = v << 4;
break;
case 5:
col_b |= v;
break;
};
}
@ -2901,12 +3124,24 @@ Image::UsedChannels Image::detect_used_channels(CompressSource p_source) {
void Image::optimize_channels() {
switch (detect_used_channels()) {
case USED_CHANNELS_L: convert(FORMAT_L8); break;
case USED_CHANNELS_LA: convert(FORMAT_LA8); break;
case USED_CHANNELS_R: convert(FORMAT_R8); break;
case USED_CHANNELS_RG: convert(FORMAT_RG8); break;
case USED_CHANNELS_RGB: convert(FORMAT_RGB8); break;
case USED_CHANNELS_RGBA: convert(FORMAT_RGBA8); break;
case USED_CHANNELS_L:
convert(FORMAT_L8);
break;
case USED_CHANNELS_LA:
convert(FORMAT_LA8);
break;
case USED_CHANNELS_R:
convert(FORMAT_R8);
break;
case USED_CHANNELS_RG:
convert(FORMAT_RG8);
break;
case USED_CHANNELS_RGB:
convert(FORMAT_RGB8);
break;
case USED_CHANNELS_RGBA:
convert(FORMAT_RGBA8);
break;
}
}

View File

@ -67,10 +67,14 @@ String JSON::_print_var(const Variant &p_var, const String &p_indent, int p_cur_
switch (p_var.get_type()) {
case Variant::NIL: return "null";
case Variant::BOOL: return p_var.operator bool() ? "true" : "false";
case Variant::INT: return itos(p_var);
case Variant::FLOAT: return rtos(p_var);
case Variant::NIL:
return "null";
case Variant::BOOL:
return p_var.operator bool() ? "true" : "false";
case Variant::INT:
return itos(p_var);
case Variant::FLOAT:
return rtos(p_var);
case Variant::PACKED_INT32_ARRAY:
case Variant::PACKED_INT64_ARRAY:
case Variant::PACKED_FLOAT32_ARRAY:
@ -116,7 +120,8 @@ String JSON::_print_var(const Variant &p_var, const String &p_indent, int p_cur_
s += end_statement + _make_indent(p_indent, p_cur_indent) + "}";
return s;
};
default: return "\"" + String(p_var).json_escape() + "\"";
default:
return "\"" + String(p_var).json_escape() + "\"";
}
}
@ -199,11 +204,21 @@ Error JSON::_get_token(const CharType *p_str, int &index, int p_len, Token &r_to
switch (next) {
case 'b': res = 8; break;
case 't': res = 9; break;
case 'n': res = 10; break;
case 'f': res = 12; break;
case 'r': res = 13; break;
case 'b':
res = 8;
break;
case 't':
res = 9;
break;
case 'n':
res = 10;
break;
case 'f':
res = 12;
break;
case 'r':
res = 13;
break;
case 'u': {
// hex number
for (int j = 0; j < 4; j++) {

View File

@ -49,11 +49,21 @@ void Logger::log_error(const char *p_function, const char *p_file, int p_line, c
const char *err_type = "ERROR";
switch (p_type) {
case ERR_ERROR: err_type = "ERROR"; break;
case ERR_WARNING: err_type = "WARNING"; break;
case ERR_SCRIPT: err_type = "SCRIPT ERROR"; break;
case ERR_SHADER: err_type = "SHADER ERROR"; break;
default: ERR_PRINT("Unknown error type"); break;
case ERR_ERROR:
err_type = "ERROR";
break;
case ERR_WARNING:
err_type = "WARNING";
break;
case ERR_SCRIPT:
err_type = "SCRIPT ERROR";
break;
case ERR_SHADER:
err_type = "SHADER ERROR";
break;
default:
ERR_PRINT("Unknown error type");
break;
}
const char *err_details;

View File

@ -177,14 +177,22 @@ Vector3 AABB::get_support(const Vector3 &p_normal) const {
Vector3 AABB::get_endpoint(int p_point) const {
switch (p_point) {
case 0: return Vector3(position.x, position.y, position.z);
case 1: return Vector3(position.x, position.y, position.z + size.z);
case 2: return Vector3(position.x, position.y + size.y, position.z);
case 3: return Vector3(position.x, position.y + size.y, position.z + size.z);
case 4: return Vector3(position.x + size.x, position.y, position.z);
case 5: return Vector3(position.x + size.x, position.y, position.z + size.z);
case 6: return Vector3(position.x + size.x, position.y + size.y, position.z);
case 7: return Vector3(position.x + size.x, position.y + size.y, position.z + size.z);
case 0:
return Vector3(position.x, position.y, position.z);
case 1:
return Vector3(position.x, position.y, position.z + size.z);
case 2:
return Vector3(position.x, position.y + size.y, position.z);
case 3:
return Vector3(position.x, position.y + size.y, position.z + size.z);
case 4:
return Vector3(position.x + size.x, position.y, position.z);
case 5:
return Vector3(position.x + size.x, position.y, position.z + size.z);
case 6:
return Vector3(position.x + size.x, position.y + size.y, position.z);
case 7:
return Vector3(position.x + size.x, position.y + size.y, position.z + size.z);
};
ERR_FAIL_V(Vector3());

View File

@ -1023,11 +1023,21 @@ Error Expression::_get_token(Token &r_token) {
switch (next) {
case 'b': res = 8; break;
case 't': res = 9; break;
case 'n': res = 10; break;
case 'f': res = 12; break;
case 'r': res = 13; break;
case 'b':
res = 8;
break;
case 't':
res = 9;
break;
case 'n':
res = 10;
break;
case 'f':
res = 12;
break;
case 'r':
res = 13;
break;
case 'u': {
// hex number
for (int j = 0; j < 4; j++) {
@ -1703,27 +1713,69 @@ Expression::ENode *Expression::_parse_expression() {
Variant::Operator op = Variant::OP_MAX;
switch (tk.type) {
case TK_OP_IN: op = Variant::OP_IN; break;
case TK_OP_EQUAL: op = Variant::OP_EQUAL; break;
case TK_OP_NOT_EQUAL: op = Variant::OP_NOT_EQUAL; break;
case TK_OP_LESS: op = Variant::OP_LESS; break;
case TK_OP_LESS_EQUAL: op = Variant::OP_LESS_EQUAL; break;
case TK_OP_GREATER: op = Variant::OP_GREATER; break;
case TK_OP_GREATER_EQUAL: op = Variant::OP_GREATER_EQUAL; break;
case TK_OP_AND: op = Variant::OP_AND; break;
case TK_OP_OR: op = Variant::OP_OR; break;
case TK_OP_NOT: op = Variant::OP_NOT; break;
case TK_OP_ADD: op = Variant::OP_ADD; break;
case TK_OP_SUB: op = Variant::OP_SUBTRACT; break;
case TK_OP_MUL: op = Variant::OP_MULTIPLY; break;
case TK_OP_DIV: op = Variant::OP_DIVIDE; break;
case TK_OP_MOD: op = Variant::OP_MODULE; break;
case TK_OP_SHIFT_LEFT: op = Variant::OP_SHIFT_LEFT; break;
case TK_OP_SHIFT_RIGHT: op = Variant::OP_SHIFT_RIGHT; break;
case TK_OP_BIT_AND: op = Variant::OP_BIT_AND; break;
case TK_OP_BIT_OR: op = Variant::OP_BIT_OR; break;
case TK_OP_BIT_XOR: op = Variant::OP_BIT_XOR; break;
case TK_OP_BIT_INVERT: op = Variant::OP_BIT_NEGATE; break;
case TK_OP_IN:
op = Variant::OP_IN;
break;
case TK_OP_EQUAL:
op = Variant::OP_EQUAL;
break;
case TK_OP_NOT_EQUAL:
op = Variant::OP_NOT_EQUAL;
break;
case TK_OP_LESS:
op = Variant::OP_LESS;
break;
case TK_OP_LESS_EQUAL:
op = Variant::OP_LESS_EQUAL;
break;
case TK_OP_GREATER:
op = Variant::OP_GREATER;
break;
case TK_OP_GREATER_EQUAL:
op = Variant::OP_GREATER_EQUAL;
break;
case TK_OP_AND:
op = Variant::OP_AND;
break;
case TK_OP_OR:
op = Variant::OP_OR;
break;
case TK_OP_NOT:
op = Variant::OP_NOT;
break;
case TK_OP_ADD:
op = Variant::OP_ADD;
break;
case TK_OP_SUB:
op = Variant::OP_SUBTRACT;
break;
case TK_OP_MUL:
op = Variant::OP_MULTIPLY;
break;
case TK_OP_DIV:
op = Variant::OP_DIVIDE;
break;
case TK_OP_MOD:
op = Variant::OP_MODULE;
break;
case TK_OP_SHIFT_LEFT:
op = Variant::OP_SHIFT_LEFT;
break;
case TK_OP_SHIFT_RIGHT:
op = Variant::OP_SHIFT_RIGHT;
break;
case TK_OP_BIT_AND:
op = Variant::OP_BIT_AND;
break;
case TK_OP_BIT_OR:
op = Variant::OP_BIT_OR;
break;
case TK_OP_BIT_XOR:
op = Variant::OP_BIT_XOR;
break;
case TK_OP_BIT_INVERT:
op = Variant::OP_BIT_NEGATE;
break;
default: {
};
}
@ -1772,36 +1824,74 @@ Expression::ENode *Expression::_parse_expression() {
unary = true;
break;
case Variant::OP_MULTIPLY: priority = 2; break;
case Variant::OP_DIVIDE: priority = 2; break;
case Variant::OP_MODULE: priority = 2; break;
case Variant::OP_MULTIPLY:
priority = 2;
break;
case Variant::OP_DIVIDE:
priority = 2;
break;
case Variant::OP_MODULE:
priority = 2;
break;
case Variant::OP_ADD: priority = 3; break;
case Variant::OP_SUBTRACT: priority = 3; break;
case Variant::OP_ADD:
priority = 3;
break;
case Variant::OP_SUBTRACT:
priority = 3;
break;
case Variant::OP_SHIFT_LEFT: priority = 4; break;
case Variant::OP_SHIFT_RIGHT: priority = 4; break;
case Variant::OP_SHIFT_LEFT:
priority = 4;
break;
case Variant::OP_SHIFT_RIGHT:
priority = 4;
break;
case Variant::OP_BIT_AND: priority = 5; break;
case Variant::OP_BIT_XOR: priority = 6; break;
case Variant::OP_BIT_OR: priority = 7; break;
case Variant::OP_BIT_AND:
priority = 5;
break;
case Variant::OP_BIT_XOR:
priority = 6;
break;
case Variant::OP_BIT_OR:
priority = 7;
break;
case Variant::OP_LESS: priority = 8; break;
case Variant::OP_LESS_EQUAL: priority = 8; break;
case Variant::OP_GREATER: priority = 8; break;
case Variant::OP_GREATER_EQUAL: priority = 8; break;
case Variant::OP_LESS:
priority = 8;
break;
case Variant::OP_LESS_EQUAL:
priority = 8;
break;
case Variant::OP_GREATER:
priority = 8;
break;
case Variant::OP_GREATER_EQUAL:
priority = 8;
break;
case Variant::OP_EQUAL: priority = 8; break;
case Variant::OP_NOT_EQUAL: priority = 8; break;
case Variant::OP_EQUAL:
priority = 8;
break;
case Variant::OP_NOT_EQUAL:
priority = 8;
break;
case Variant::OP_IN: priority = 10; break;
case Variant::OP_IN:
priority = 10;
break;
case Variant::OP_NOT:
priority = 11;
unary = true;
break;
case Variant::OP_AND: priority = 12; break;
case Variant::OP_OR: priority = 13; break;
case Variant::OP_AND:
priority = 12;
break;
case Variant::OP_OR:
priority = 13;
break;
default: {
_set_error("Parser bug, invalid operator in expression: " + itos(expression[i].op));

View File

@ -445,7 +445,8 @@ static inline void _mark_outside(uint8_t ***p_cell_status, int x, int y, int z,
next_z--;
prev = _CELL_PREV_Z_POS;
} break;
default: ERR_FAIL();
default:
ERR_FAIL();
}
if (next_x < 0 || next_x >= len_x)
@ -1083,10 +1084,18 @@ Vector<Vector<Point2>> Geometry::_polypaths_do_operation(PolyBooleanOperation p_
ClipType op = ctUnion;
switch (p_op) {
case OPERATION_UNION: op = ctUnion; break;
case OPERATION_DIFFERENCE: op = ctDifference; break;
case OPERATION_INTERSECTION: op = ctIntersection; break;
case OPERATION_XOR: op = ctXor; break;
case OPERATION_UNION:
op = ctUnion;
break;
case OPERATION_DIFFERENCE:
op = ctDifference;
break;
case OPERATION_INTERSECTION:
op = ctIntersection;
break;
case OPERATION_XOR:
op = ctXor;
break;
}
Path path_a, path_b;
@ -1135,19 +1144,35 @@ Vector<Vector<Point2>> Geometry::_polypath_offset(const Vector<Point2> &p_polypa
JoinType jt = jtSquare;
switch (p_join_type) {
case JOIN_SQUARE: jt = jtSquare; break;
case JOIN_ROUND: jt = jtRound; break;
case JOIN_MITER: jt = jtMiter; break;
case JOIN_SQUARE:
jt = jtSquare;
break;
case JOIN_ROUND:
jt = jtRound;
break;
case JOIN_MITER:
jt = jtMiter;
break;
}
EndType et = etClosedPolygon;
switch (p_end_type) {
case END_POLYGON: et = etClosedPolygon; break;
case END_JOINED: et = etClosedLine; break;
case END_BUTT: et = etOpenButt; break;
case END_SQUARE: et = etOpenSquare; break;
case END_ROUND: et = etOpenRound; break;
case END_POLYGON:
et = etClosedPolygon;
break;
case END_JOINED:
et = etClosedLine;
break;
case END_BUTT:
et = etOpenButt;
break;
case END_SQUARE:
et = etOpenSquare;
break;
case END_ROUND:
et = etOpenRound;
break;
}
ClipperOffset co(2.0, 0.25 * SCALE_FACTOR); // Defaults from ClipperOffset.
Path path;

View File

@ -39,18 +39,24 @@ String DirAccess::_get_root_path() const {
switch (_access_type) {
case ACCESS_RESOURCES: return ProjectSettings::get_singleton()->get_resource_path();
case ACCESS_USERDATA: return OS::get_singleton()->get_user_data_dir();
default: return "";
case ACCESS_RESOURCES:
return ProjectSettings::get_singleton()->get_resource_path();
case ACCESS_USERDATA:
return OS::get_singleton()->get_user_data_dir();
default:
return "";
}
}
String DirAccess::_get_root_string() const {
switch (_access_type) {
case ACCESS_RESOURCES: return "res://";
case ACCESS_USERDATA: return "user://";
default: return "";
case ACCESS_RESOURCES:
return "res://";
case ACCESS_USERDATA:
return "user://";
default:
return "";
}
}
@ -220,7 +226,8 @@ String DirAccess::fix_path(String p_path) const {
return p_path;
} break;
case ACCESS_MAX: break; // Can't happen, but silences warning
case ACCESS_MAX:
break; // Can't happen, but silences warning
}
return p_path;

View File

@ -163,7 +163,8 @@ String FileAccess::fix_path(const String &p_path) const {
return r_path;
} break;
case ACCESS_MAX: break; // Can't happen, but silences warning
case ACCESS_MAX:
break; // Can't happen, but silences warning
}
return r_path;

View File

@ -4183,9 +4183,14 @@ String String::sprintf(const Array &values, bool *error) const {
int base = 16;
bool capitalize = false;
switch (c) {
case 'd': base = 10; break;
case 'o': base = 8; break;
case 'x': break;
case 'd':
base = 10;
break;
case 'o':
base = 8;
break;
case 'x':
break;
case 'X':
base = 16;
capitalize = true;

View File

@ -1406,20 +1406,47 @@ void Variant::reference(const Variant &p_variant) {
void Variant::zero() {
switch (type) {
case NIL: break;
case BOOL: this->_data._bool = false; break;
case INT: this->_data._int = 0; break;
case FLOAT: this->_data._float = 0; break;
case VECTOR2: *reinterpret_cast<Vector2 *>(this->_data._mem) = Vector2(); break;
case VECTOR2I: *reinterpret_cast<Vector2i *>(this->_data._mem) = Vector2i(); break;
case RECT2: *reinterpret_cast<Rect2 *>(this->_data._mem) = Rect2(); break;
case RECT2I: *reinterpret_cast<Rect2i *>(this->_data._mem) = Rect2i(); break;
case VECTOR3: *reinterpret_cast<Vector3 *>(this->_data._mem) = Vector3(); break;
case VECTOR3I: *reinterpret_cast<Vector3i *>(this->_data._mem) = Vector3i(); break;
case PLANE: *reinterpret_cast<Plane *>(this->_data._mem) = Plane(); break;
case QUAT: *reinterpret_cast<Quat *>(this->_data._mem) = Quat(); break;
case COLOR: *reinterpret_cast<Color *>(this->_data._mem) = Color(); break;
default: this->clear(); break;
case NIL:
break;
case BOOL:
this->_data._bool = false;
break;
case INT:
this->_data._int = 0;
break;
case FLOAT:
this->_data._float = 0;
break;
case VECTOR2:
*reinterpret_cast<Vector2 *>(this->_data._mem) = Vector2();
break;
case VECTOR2I:
*reinterpret_cast<Vector2i *>(this->_data._mem) = Vector2i();
break;
case RECT2:
*reinterpret_cast<Rect2 *>(this->_data._mem) = Rect2();
break;
case RECT2I:
*reinterpret_cast<Rect2i *>(this->_data._mem) = Rect2i();
break;
case VECTOR3:
*reinterpret_cast<Vector3 *>(this->_data._mem) = Vector3();
break;
case VECTOR3I:
*reinterpret_cast<Vector3i *>(this->_data._mem) = Vector3i();
break;
case PLANE:
*reinterpret_cast<Plane *>(this->_data._mem) = Plane();
break;
case QUAT:
*reinterpret_cast<Quat *>(this->_data._mem) = Quat();
break;
case COLOR:
*reinterpret_cast<Color *>(this->_data._mem) = Color();
break;
default:
this->clear();
break;
}
}
@ -1545,11 +1572,16 @@ Variant::operator signed int() const {
switch (type) {
case NIL: return 0;
case BOOL: return _data._bool ? 1 : 0;
case INT: return _data._int;
case FLOAT: return _data._float;
case STRING: return operator String().to_int();
case NIL:
return 0;
case BOOL:
return _data._bool ? 1 : 0;
case INT:
return _data._int;
case FLOAT:
return _data._float;
case STRING:
return operator String().to_int();
default: {
return 0;
@ -1560,11 +1592,16 @@ Variant::operator unsigned int() const {
switch (type) {
case NIL: return 0;
case BOOL: return _data._bool ? 1 : 0;
case INT: return _data._int;
case FLOAT: return _data._float;
case STRING: return operator String().to_int();
case NIL:
return 0;
case BOOL:
return _data._bool ? 1 : 0;
case INT:
return _data._int;
case FLOAT:
return _data._float;
case STRING:
return operator String().to_int();
default: {
return 0;
@ -1576,11 +1613,16 @@ Variant::operator int64_t() const {
switch (type) {
case NIL: return 0;
case BOOL: return _data._bool ? 1 : 0;
case INT: return _data._int;
case FLOAT: return _data._float;
case STRING: return operator String().to_int64();
case NIL:
return 0;
case BOOL:
return _data._bool ? 1 : 0;
case INT:
return _data._int;
case FLOAT:
return _data._float;
case STRING:
return operator String().to_int64();
default: {
return 0;
@ -1612,11 +1654,16 @@ Variant::operator uint64_t() const {
switch (type) {
case NIL: return 0;
case BOOL: return _data._bool ? 1 : 0;
case INT: return _data._int;
case FLOAT: return _data._float;
case STRING: return operator String().to_int();
case NIL:
return 0;
case BOOL:
return _data._bool ? 1 : 0;
case INT:
return _data._int;
case FLOAT:
return _data._float;
case STRING:
return operator String().to_int();
default: {
return 0;
@ -1639,11 +1686,16 @@ Variant::operator signed long() const {
switch (type) {
case NIL: return 0;
case BOOL: return _data._bool ? 1 : 0;
case INT: return _data._int;
case FLOAT: return _data._real;
case STRING: return operator String().to_int();
case NIL:
return 0;
case BOOL:
return _data._bool ? 1 : 0;
case INT:
return _data._int;
case FLOAT:
return _data._real;
case STRING:
return operator String().to_int();
default: {
return 0;
@ -1657,11 +1709,16 @@ Variant::operator unsigned long() const {
switch (type) {
case NIL: return 0;
case BOOL: return _data._bool ? 1 : 0;
case INT: return _data._int;
case FLOAT: return _data._real;
case STRING: return operator String().to_int();
case NIL:
return 0;
case BOOL:
return _data._bool ? 1 : 0;
case INT:
return _data._int;
case FLOAT:
return _data._real;
case STRING:
return operator String().to_int();
default: {
return 0;
@ -1676,11 +1733,16 @@ Variant::operator signed short() const {
switch (type) {
case NIL: return 0;
case BOOL: return _data._bool ? 1 : 0;
case INT: return _data._int;
case FLOAT: return _data._float;
case STRING: return operator String().to_int();
case NIL:
return 0;
case BOOL:
return _data._bool ? 1 : 0;
case INT:
return _data._int;
case FLOAT:
return _data._float;
case STRING:
return operator String().to_int();
default: {
return 0;
@ -1691,11 +1753,16 @@ Variant::operator unsigned short() const {
switch (type) {
case NIL: return 0;
case BOOL: return _data._bool ? 1 : 0;
case INT: return _data._int;
case FLOAT: return _data._float;
case STRING: return operator String().to_int();
case NIL:
return 0;
case BOOL:
return _data._bool ? 1 : 0;
case INT:
return _data._int;
case FLOAT:
return _data._float;
case STRING:
return operator String().to_int();
default: {
return 0;
@ -1706,11 +1773,16 @@ Variant::operator signed char() const {
switch (type) {
case NIL: return 0;
case BOOL: return _data._bool ? 1 : 0;
case INT: return _data._int;
case FLOAT: return _data._float;
case STRING: return operator String().to_int();
case NIL:
return 0;
case BOOL:
return _data._bool ? 1 : 0;
case INT:
return _data._int;
case FLOAT:
return _data._float;
case STRING:
return operator String().to_int();
default: {
return 0;
@ -1721,11 +1793,16 @@ Variant::operator unsigned char() const {
switch (type) {
case NIL: return 0;
case BOOL: return _data._bool ? 1 : 0;
case INT: return _data._int;
case FLOAT: return _data._float;
case STRING: return operator String().to_int();
case NIL:
return 0;
case BOOL:
return _data._bool ? 1 : 0;
case INT:
return _data._int;
case FLOAT:
return _data._float;
case STRING:
return operator String().to_int();
default: {
return 0;
@ -1742,11 +1819,16 @@ Variant::operator float() const {
switch (type) {
case NIL: return 0;
case BOOL: return _data._bool ? 1.0 : 0.0;
case INT: return (float)_data._int;
case FLOAT: return _data._float;
case STRING: return operator String().to_double();
case NIL:
return 0;
case BOOL:
return _data._bool ? 1.0 : 0.0;
case INT:
return (float)_data._int;
case FLOAT:
return _data._float;
case STRING:
return operator String().to_double();
default: {
return 0;
@ -1757,11 +1839,16 @@ Variant::operator double() const {
switch (type) {
case NIL: return 0;
case BOOL: return _data._bool ? 1.0 : 0.0;
case INT: return (double)_data._int;
case FLOAT: return _data._float;
case STRING: return operator String().to_double();
case NIL:
return 0;
case BOOL:
return _data._bool ? 1.0 : 0.0;
case INT:
return (double)_data._int;
case FLOAT:
return _data._float;
case STRING:
return operator String().to_double();
default: {
return 0;
@ -1800,27 +1887,40 @@ Variant::operator String() const {
String Variant::stringify(List<const void *> &stack) const {
switch (type) {
case NIL: return "Null";
case BOOL: return _data._bool ? "True" : "False";
case INT: return itos(_data._int);
case FLOAT: return rtos(_data._float);
case STRING: return *reinterpret_cast<const String *>(_data._mem);
case VECTOR2: return "(" + operator Vector2() + ")";
case VECTOR2I: return "(" + operator Vector2i() + ")";
case RECT2: return "(" + operator Rect2() + ")";
case RECT2I: return "(" + operator Rect2i() + ")";
case NIL:
return "Null";
case BOOL:
return _data._bool ? "True" : "False";
case INT:
return itos(_data._int);
case FLOAT:
return rtos(_data._float);
case STRING:
return *reinterpret_cast<const String *>(_data._mem);
case VECTOR2:
return "(" + operator Vector2() + ")";
case VECTOR2I:
return "(" + operator Vector2i() + ")";
case RECT2:
return "(" + operator Rect2() + ")";
case RECT2I:
return "(" + operator Rect2i() + ")";
case TRANSFORM2D: {
Transform2D mat32 = operator Transform2D();
return "(" + Variant(mat32.elements[0]).operator String() + ", " + Variant(mat32.elements[1]).operator String() + ", " + Variant(mat32.elements[2]).operator String() + ")";
} break;
case VECTOR3: return "(" + operator Vector3() + ")";
case VECTOR3I: return "(" + operator Vector3i() + ")";
case VECTOR3:
return "(" + operator Vector3() + ")";
case VECTOR3I:
return "(" + operator Vector3i() + ")";
case PLANE:
return operator Plane();
//case QUAT:
case AABB: return operator ::AABB();
case QUAT: return "(" + operator Quat() + ")";
case AABB:
return operator ::AABB();
case QUAT:
return "(" + operator Quat() + ")";
case BASIS: {
Basis mat3 = operator Basis();
@ -1846,10 +1946,14 @@ String Variant::stringify(List<const void *> &stack) const {
return mtx + ")";
} break;
case TRANSFORM: return operator Transform();
case STRING_NAME: return operator StringName();
case NODE_PATH: return operator NodePath();
case COLOR: return String::num(operator Color().r) + "," + String::num(operator Color().g) + "," + String::num(operator Color().b) + "," + String::num(operator Color().a);
case TRANSFORM:
return operator Transform();
case STRING_NAME:
return operator StringName();
case NODE_PATH:
return operator NodePath();
case COLOR:
return String::num(operator Color().r) + "," + String::num(operator Color().g) + "," + String::num(operator Color().b) + "," + String::num(operator Color().a);
case DICTIONARY: {
const Dictionary &d = *reinterpret_cast<const Dictionary *>(_data._mem);
@ -3676,9 +3780,12 @@ bool Variant::is_shared() const {
switch (type) {
case OBJECT: return true;
case ARRAY: return true;
case DICTIONARY: return true;
case OBJECT:
return true;
case ARRAY:
return true;
case DICTIONARY:
return true;
default: {
}
}

View File

@ -861,9 +861,15 @@ struct _VariantCall {
static void _call_Transform2D_xform(Variant &r_ret, Variant &p_self, const Variant **p_args) {
switch (p_args[0]->type) {
case Variant::VECTOR2: r_ret = reinterpret_cast<Transform2D *>(p_self._data._ptr)->xform(p_args[0]->operator Vector2()); return;
case Variant::RECT2: r_ret = reinterpret_cast<Transform2D *>(p_self._data._ptr)->xform(p_args[0]->operator Rect2()); return;
case Variant::PACKED_VECTOR2_ARRAY: r_ret = reinterpret_cast<Transform2D *>(p_self._data._ptr)->xform(p_args[0]->operator PackedVector2Array()); return;
case Variant::VECTOR2:
r_ret = reinterpret_cast<Transform2D *>(p_self._data._ptr)->xform(p_args[0]->operator Vector2());
return;
case Variant::RECT2:
r_ret = reinterpret_cast<Transform2D *>(p_self._data._ptr)->xform(p_args[0]->operator Rect2());
return;
case Variant::PACKED_VECTOR2_ARRAY:
r_ret = reinterpret_cast<Transform2D *>(p_self._data._ptr)->xform(p_args[0]->operator PackedVector2Array());
return;
default:
r_ret = Variant();
ERR_PRINT("Invalid type in function 'xform' in base 'Transform2D'. Valid types are Vector2, Rect2, and PackedVector2Array.");
@ -872,9 +878,15 @@ struct _VariantCall {
static void _call_Transform2D_xform_inv(Variant &r_ret, Variant &p_self, const Variant **p_args) {
switch (p_args[0]->type) {
case Variant::VECTOR2: r_ret = reinterpret_cast<Transform2D *>(p_self._data._ptr)->xform_inv(p_args[0]->operator Vector2()); return;
case Variant::RECT2: r_ret = reinterpret_cast<Transform2D *>(p_self._data._ptr)->xform_inv(p_args[0]->operator Rect2()); return;
case Variant::PACKED_VECTOR2_ARRAY: r_ret = reinterpret_cast<Transform2D *>(p_self._data._ptr)->xform_inv(p_args[0]->operator PackedVector2Array()); return;
case Variant::VECTOR2:
r_ret = reinterpret_cast<Transform2D *>(p_self._data._ptr)->xform_inv(p_args[0]->operator Vector2());
return;
case Variant::RECT2:
r_ret = reinterpret_cast<Transform2D *>(p_self._data._ptr)->xform_inv(p_args[0]->operator Rect2());
return;
case Variant::PACKED_VECTOR2_ARRAY:
r_ret = reinterpret_cast<Transform2D *>(p_self._data._ptr)->xform_inv(p_args[0]->operator PackedVector2Array());
return;
default:
r_ret = Variant();
ERR_PRINT("Invalid type in function 'xform_inv' in base 'Transform2D'. Valid types are Vector2, Rect2, and PackedVector2Array.");
@ -883,7 +895,9 @@ struct _VariantCall {
static void _call_Transform2D_basis_xform(Variant &r_ret, Variant &p_self, const Variant **p_args) {
switch (p_args[0]->type) {
case Variant::VECTOR2: r_ret = reinterpret_cast<Transform2D *>(p_self._data._ptr)->basis_xform(p_args[0]->operator Vector2()); return;
case Variant::VECTOR2:
r_ret = reinterpret_cast<Transform2D *>(p_self._data._ptr)->basis_xform(p_args[0]->operator Vector2());
return;
default:
r_ret = Variant();
ERR_PRINT("Invalid type in function 'basis_xform' in base 'Transform2D'. Only Vector2 is valid.");
@ -892,7 +906,9 @@ struct _VariantCall {
static void _call_Transform2D_basis_xform_inv(Variant &r_ret, Variant &p_self, const Variant **p_args) {
switch (p_args[0]->type) {
case Variant::VECTOR2: r_ret = reinterpret_cast<Transform2D *>(p_self._data._ptr)->basis_xform_inv(p_args[0]->operator Vector2()); return;
case Variant::VECTOR2:
r_ret = reinterpret_cast<Transform2D *>(p_self._data._ptr)->basis_xform_inv(p_args[0]->operator Vector2());
return;
default:
r_ret = Variant();
ERR_PRINT("Invalid type in function 'basis_xform_inv' in base 'Transform2D'. Only Vector2 is valid.");
@ -929,10 +945,18 @@ struct _VariantCall {
static void _call_Transform_xform(Variant &r_ret, Variant &p_self, const Variant **p_args) {
switch (p_args[0]->type) {
case Variant::VECTOR3: r_ret = reinterpret_cast<Transform *>(p_self._data._ptr)->xform(p_args[0]->operator Vector3()); return;
case Variant::PLANE: r_ret = reinterpret_cast<Transform *>(p_self._data._ptr)->xform(p_args[0]->operator Plane()); return;
case Variant::AABB: r_ret = reinterpret_cast<Transform *>(p_self._data._ptr)->xform(p_args[0]->operator ::AABB()); return;
case Variant::PACKED_VECTOR3_ARRAY: r_ret = reinterpret_cast<Transform *>(p_self._data._ptr)->xform(p_args[0]->operator ::PackedVector3Array()); return;
case Variant::VECTOR3:
r_ret = reinterpret_cast<Transform *>(p_self._data._ptr)->xform(p_args[0]->operator Vector3());
return;
case Variant::PLANE:
r_ret = reinterpret_cast<Transform *>(p_self._data._ptr)->xform(p_args[0]->operator Plane());
return;
case Variant::AABB:
r_ret = reinterpret_cast<Transform *>(p_self._data._ptr)->xform(p_args[0]->operator ::AABB());
return;
case Variant::PACKED_VECTOR3_ARRAY:
r_ret = reinterpret_cast<Transform *>(p_self._data._ptr)->xform(p_args[0]->operator ::PackedVector3Array());
return;
default:
r_ret = Variant();
ERR_PRINT("Invalid type in function 'xform' in base 'Transform'. Valid types are Vector3, Plane, AABB, and PackedVector3Array.");
@ -941,10 +965,18 @@ struct _VariantCall {
static void _call_Transform_xform_inv(Variant &r_ret, Variant &p_self, const Variant **p_args) {
switch (p_args[0]->type) {
case Variant::VECTOR3: r_ret = reinterpret_cast<Transform *>(p_self._data._ptr)->xform_inv(p_args[0]->operator Vector3()); return;
case Variant::PLANE: r_ret = reinterpret_cast<Transform *>(p_self._data._ptr)->xform_inv(p_args[0]->operator Plane()); return;
case Variant::AABB: r_ret = reinterpret_cast<Transform *>(p_self._data._ptr)->xform_inv(p_args[0]->operator ::AABB()); return;
case Variant::PACKED_VECTOR3_ARRAY: r_ret = reinterpret_cast<Transform *>(p_self._data._ptr)->xform_inv(p_args[0]->operator ::PackedVector3Array()); return;
case Variant::VECTOR3:
r_ret = reinterpret_cast<Transform *>(p_self._data._ptr)->xform_inv(p_args[0]->operator Vector3());
return;
case Variant::PLANE:
r_ret = reinterpret_cast<Transform *>(p_self._data._ptr)->xform_inv(p_args[0]->operator Plane());
return;
case Variant::AABB:
r_ret = reinterpret_cast<Transform *>(p_self._data._ptr)->xform_inv(p_args[0]->operator ::AABB());
return;
case Variant::PACKED_VECTOR3_ARRAY:
r_ret = reinterpret_cast<Transform *>(p_self._data._ptr)->xform_inv(p_args[0]->operator ::PackedVector3Array());
return;
default:
r_ret = Variant();
ERR_PRINT("Invalid type in function 'xform_inv' in base 'Transform'. Valid types are Vector3, Plane, AABB, and PackedVector3Array.");
@ -1280,50 +1312,74 @@ Variant Variant::construct(const Variant::Type p_type, const Variant **p_args, i
return Variant();
// atomic types
case BOOL: return Variant(false);
case INT: return 0;
case FLOAT: return 0.0f;
case BOOL:
return Variant(false);
case INT:
return 0;
case FLOAT:
return 0.0f;
case STRING:
return String();
// math types
case VECTOR2:
return Vector2();
case RECT2: return Rect2();
case VECTOR3: return Vector3();
case TRANSFORM2D: return Transform2D();
case PLANE: return Plane();
case QUAT: return Quat();
case RECT2:
return Rect2();
case VECTOR3:
return Vector3();
case TRANSFORM2D:
return Transform2D();
case PLANE:
return Plane();
case QUAT:
return Quat();
case AABB:
return ::AABB();
case BASIS: return Basis();
case BASIS:
return Basis();
case TRANSFORM:
return Transform();
// misc types
case COLOR: return Color();
case COLOR:
return Color();
case STRING_NAME:
return StringName();
case NODE_PATH:
return NodePath();
case _RID: return RID();
case OBJECT: return (Object *)nullptr;
case CALLABLE: return Callable();
case SIGNAL: return Signal();
case DICTIONARY: return Dictionary();
case _RID:
return RID();
case OBJECT:
return (Object *)nullptr;
case CALLABLE:
return Callable();
case SIGNAL:
return Signal();
case DICTIONARY:
return Dictionary();
case ARRAY:
return Array();
case PACKED_BYTE_ARRAY: return PackedByteArray();
case PACKED_INT32_ARRAY: return PackedInt32Array();
case PACKED_INT64_ARRAY: return PackedInt64Array();
case PACKED_FLOAT32_ARRAY: return PackedFloat32Array();
case PACKED_FLOAT64_ARRAY: return PackedFloat64Array();
case PACKED_STRING_ARRAY: return PackedStringArray();
case PACKED_BYTE_ARRAY:
return PackedByteArray();
case PACKED_INT32_ARRAY:
return PackedInt32Array();
case PACKED_INT64_ARRAY:
return PackedInt64Array();
case PACKED_FLOAT32_ARRAY:
return PackedFloat32Array();
case PACKED_FLOAT64_ARRAY:
return PackedFloat64Array();
case PACKED_STRING_ARRAY:
return PackedStringArray();
case PACKED_VECTOR2_ARRAY:
return PackedVector2Array();
case PACKED_VECTOR3_ARRAY: return PackedVector3Array();
case PACKED_COLOR_ARRAY: return PackedColorArray();
default: return Variant();
case PACKED_VECTOR3_ARRAY:
return PackedVector3Array();
case PACKED_COLOR_ARRAY:
return PackedColorArray();
default:
return Variant();
}
} else if (p_argcount == 1 && p_args[0]->type == p_type) {
@ -1354,46 +1410,68 @@ Variant Variant::construct(const Variant::Type p_type, const Variant **p_args, i
case VECTOR2I: {
return Vector2i(*p_args[0]);
}
case RECT2: return (Rect2(*p_args[0]));
case RECT2I: return (Rect2i(*p_args[0]));
case VECTOR3: return (Vector3(*p_args[0]));
case VECTOR3I: return (Vector3i(*p_args[0]));
case RECT2:
return (Rect2(*p_args[0]));
case RECT2I:
return (Rect2i(*p_args[0]));
case VECTOR3:
return (Vector3(*p_args[0]));
case VECTOR3I:
return (Vector3i(*p_args[0]));
case TRANSFORM2D:
return (Transform2D(p_args[0]->operator Transform2D()));
case PLANE: return (Plane(*p_args[0]));
case QUAT: return (p_args[0]->operator Quat());
case PLANE:
return (Plane(*p_args[0]));
case QUAT:
return (p_args[0]->operator Quat());
case AABB:
return (::AABB(*p_args[0]));
case BASIS: return (Basis(p_args[0]->operator Basis()));
case BASIS:
return (Basis(p_args[0]->operator Basis()));
case TRANSFORM:
return (Transform(p_args[0]->operator Transform()));
// misc types
case COLOR: return p_args[0]->type == Variant::STRING ? Color::html(*p_args[0]) : Color::hex(*p_args[0]);
case COLOR:
return p_args[0]->type == Variant::STRING ? Color::html(*p_args[0]) : Color::hex(*p_args[0]);
case STRING_NAME:
return (StringName(p_args[0]->operator StringName()));
case NODE_PATH:
return (NodePath(p_args[0]->operator NodePath()));
case _RID: return (RID(*p_args[0]));
case OBJECT: return ((Object *)(p_args[0]->operator Object *()));
case CALLABLE: return ((Callable)(p_args[0]->operator Callable()));
case SIGNAL: return ((Signal)(p_args[0]->operator Signal()));
case DICTIONARY: return p_args[0]->operator Dictionary();
case _RID:
return (RID(*p_args[0]));
case OBJECT:
return ((Object *)(p_args[0]->operator Object *()));
case CALLABLE:
return ((Callable)(p_args[0]->operator Callable()));
case SIGNAL:
return ((Signal)(p_args[0]->operator Signal()));
case DICTIONARY:
return p_args[0]->operator Dictionary();
case ARRAY:
return p_args[0]->operator Array();
// arrays
case PACKED_BYTE_ARRAY: return (PackedByteArray(*p_args[0]));
case PACKED_INT32_ARRAY: return (PackedInt32Array(*p_args[0]));
case PACKED_INT64_ARRAY: return (PackedInt64Array(*p_args[0]));
case PACKED_FLOAT32_ARRAY: return (PackedFloat32Array(*p_args[0]));
case PACKED_FLOAT64_ARRAY: return (PackedFloat64Array(*p_args[0]));
case PACKED_STRING_ARRAY: return (PackedStringArray(*p_args[0]));
case PACKED_BYTE_ARRAY:
return (PackedByteArray(*p_args[0]));
case PACKED_INT32_ARRAY:
return (PackedInt32Array(*p_args[0]));
case PACKED_INT64_ARRAY:
return (PackedInt64Array(*p_args[0]));
case PACKED_FLOAT32_ARRAY:
return (PackedFloat32Array(*p_args[0]));
case PACKED_FLOAT64_ARRAY:
return (PackedFloat64Array(*p_args[0]));
case PACKED_STRING_ARRAY:
return (PackedStringArray(*p_args[0]));
case PACKED_VECTOR2_ARRAY:
return (PackedVector2Array(*p_args[0]));
case PACKED_VECTOR3_ARRAY: return (PackedVector3Array(*p_args[0]));
case PACKED_COLOR_ARRAY: return (PackedColorArray(*p_args[0]));
default: return Variant();
case PACKED_VECTOR3_ARRAY:
return (PackedVector3Array(*p_args[0]));
case PACKED_COLOR_ARRAY:
return (PackedColorArray(*p_args[0]));
default:
return Variant();
}
} else if (p_argcount >= 1) {

View File

@ -1015,7 +1015,8 @@ void Variant::evaluate(const Operator &p_op, const Variant &p_a,
case VECTOR2: {
_RETURN(p_a._data._transform2d->xform(*(const Vector2 *)p_b._data._mem));
}
default: _RETURN_FAIL;
default:
_RETURN_FAIL;
}
}
@ -1030,7 +1031,8 @@ void Variant::evaluate(const Operator &p_op, const Variant &p_a,
case FLOAT: {
_RETURN(*reinterpret_cast<const Quat *>(p_a._data._mem) * p_b._data._float);
}
default: _RETURN_FAIL;
default:
_RETURN_FAIL;
}
}
@ -1042,7 +1044,8 @@ void Variant::evaluate(const Operator &p_op, const Variant &p_a,
case BASIS: {
_RETURN(*p_a._data._basis * *p_b._data._basis);
}
default: _RETURN_FAIL;
default:
_RETURN_FAIL;
}
}
@ -1054,7 +1057,8 @@ void Variant::evaluate(const Operator &p_op, const Variant &p_a,
case TRANSFORM: {
_RETURN(*p_a._data._transform * *p_b._data._transform);
}
default: _RETURN_FAIL;
default:
_RETURN_FAIL;
}
}

View File

@ -243,11 +243,21 @@ Error VariantParser::get_token(Stream *p_stream, Token &r_token, int &line, Stri
switch (next) {
case 'b': res = 8; break;
case 't': res = 9; break;
case 'n': res = 10; break;
case 'f': res = 12; break;
case 'r': res = 13; break;
case 'b':
res = 8;
break;
case 't':
res = 9;
break;
case 'n':
res = 10;
break;
case 'f':
res = 12;
break;
case 'r':
res = 13;
break;
case 'u': {
//hex number
for (int j = 0; j < 4; j++) {

View File

@ -55,10 +55,14 @@ static String _typestr(SL::DataType p_type) {
static String _prestr(SL::DataPrecision p_pres) {
switch (p_pres) {
case SL::PRECISION_LOWP: return "lowp ";
case SL::PRECISION_MEDIUMP: return "mediump ";
case SL::PRECISION_HIGHP: return "highp ";
case SL::PRECISION_DEFAULT: return "";
case SL::PRECISION_LOWP:
return "lowp ";
case SL::PRECISION_MEDIUMP:
return "mediump ";
case SL::PRECISION_HIGHP:
return "highp ";
case SL::PRECISION_DEFAULT:
return "";
}
return "";
}
@ -66,9 +70,12 @@ static String _prestr(SL::DataPrecision p_pres) {
static String _qualstr(SL::ArgumentQualifier p_qual) {
switch (p_qual) {
case SL::ARGUMENT_QUALIFIER_IN: return "in ";
case SL::ARGUMENT_QUALIFIER_OUT: return "out ";
case SL::ARGUMENT_QUALIFIER_INOUT: return "inout ";
case SL::ARGUMENT_QUALIFIER_IN:
return "in ";
case SL::ARGUMENT_QUALIFIER_OUT:
return "out ";
case SL::ARGUMENT_QUALIFIER_INOUT:
return "inout ";
}
return "";
}
@ -96,7 +103,8 @@ static String f2sp0(float p_float) {
static String get_constant_text(SL::DataType p_type, const Vector<SL::ConstantNode::Value> &p_values) {
switch (p_type) {
case SL::TYPE_BOOL: return p_values[0].boolean ? "true" : "false";
case SL::TYPE_BOOL:
return p_values[0].boolean ? "true" : "false";
case SL::TYPE_BVEC2:
case SL::TYPE_BVEC3:
case SL::TYPE_BVEC4: {
@ -118,7 +126,8 @@ static String get_constant_text(SL::DataType p_type, const Vector<SL::ConstantNo
}
// GLSL ES 2 doesn't support uints, so we just use signed ints instead...
case SL::TYPE_UINT: return itos(p_values[0].uint);
case SL::TYPE_UINT:
return itos(p_values[0].uint);
case SL::TYPE_UVEC2:
case SL::TYPE_UVEC3:
case SL::TYPE_UVEC4: {
@ -140,7 +149,8 @@ static String get_constant_text(SL::DataType p_type, const Vector<SL::ConstantNo
} break;
case SL::TYPE_INT: return itos(p_values[0].sint);
case SL::TYPE_INT:
return itos(p_values[0].sint);
case SL::TYPE_IVEC2:
case SL::TYPE_IVEC3:
case SL::TYPE_IVEC4: {
@ -161,7 +171,8 @@ static String get_constant_text(SL::DataType p_type, const Vector<SL::ConstantNo
return text.as_string();
} break;
case SL::TYPE_FLOAT: return f2sp0(p_values[0].real);
case SL::TYPE_FLOAT:
return f2sp0(p_values[0].real);
case SL::TYPE_VEC2:
case SL::TYPE_VEC3:
case SL::TYPE_VEC4: {
@ -202,7 +213,8 @@ static String get_constant_text(SL::DataType p_type, const Vector<SL::ConstantNo
return text.as_string();
} break;
default: ERR_FAIL_V(String());
default:
ERR_FAIL_V(String());
}
}

View File

@ -49,11 +49,21 @@ void SyslogLogger::print_error(const char *p_function, const char *p_file, int p
const char *err_type = "**ERROR**";
switch (p_type) {
case ERR_ERROR: err_type = "**ERROR**"; break;
case ERR_WARNING: err_type = "**WARNING**"; break;
case ERR_SCRIPT: err_type = "**SCRIPT ERROR**"; break;
case ERR_SHADER: err_type = "**SHADER ERROR**"; break;
default: ERR_PRINT("Unknown error type"); break;
case ERR_ERROR:
err_type = "**ERROR**";
break;
case ERR_WARNING:
err_type = "**WARNING**";
break;
case ERR_SCRIPT:
err_type = "**SCRIPT ERROR**";
break;
case ERR_SHADER:
err_type = "**SHADER ERROR**";
break;
default:
ERR_PRINT("Unknown error type");
break;
}
const char *err_details;

View File

@ -566,52 +566,66 @@ int RenderingDeviceVulkan::get_format_vertex_size(DataFormat p_format) {
case DATA_FORMAT_B8G8R8A8_UNORM:
case DATA_FORMAT_B8G8R8A8_SNORM:
case DATA_FORMAT_B8G8R8A8_UINT:
case DATA_FORMAT_B8G8R8A8_SINT: return 4;
case DATA_FORMAT_B8G8R8A8_SINT:
return 4;
case DATA_FORMAT_R16_UNORM:
case DATA_FORMAT_R16_SNORM:
case DATA_FORMAT_R16_UINT:
case DATA_FORMAT_R16_SINT:
case DATA_FORMAT_R16_SFLOAT: return 4;
case DATA_FORMAT_R16_SFLOAT:
return 4;
case DATA_FORMAT_R16G16_UNORM:
case DATA_FORMAT_R16G16_SNORM:
case DATA_FORMAT_R16G16_UINT:
case DATA_FORMAT_R16G16_SINT:
case DATA_FORMAT_R16G16_SFLOAT: return 4;
case DATA_FORMAT_R16G16_SFLOAT:
return 4;
case DATA_FORMAT_R16G16B16_UNORM:
case DATA_FORMAT_R16G16B16_SNORM:
case DATA_FORMAT_R16G16B16_UINT:
case DATA_FORMAT_R16G16B16_SINT:
case DATA_FORMAT_R16G16B16_SFLOAT: return 8;
case DATA_FORMAT_R16G16B16_SFLOAT:
return 8;
case DATA_FORMAT_R16G16B16A16_UNORM:
case DATA_FORMAT_R16G16B16A16_SNORM:
case DATA_FORMAT_R16G16B16A16_UINT:
case DATA_FORMAT_R16G16B16A16_SINT:
case DATA_FORMAT_R16G16B16A16_SFLOAT: return 8;
case DATA_FORMAT_R16G16B16A16_SFLOAT:
return 8;
case DATA_FORMAT_R32_UINT:
case DATA_FORMAT_R32_SINT:
case DATA_FORMAT_R32_SFLOAT: return 4;
case DATA_FORMAT_R32_SFLOAT:
return 4;
case DATA_FORMAT_R32G32_UINT:
case DATA_FORMAT_R32G32_SINT:
case DATA_FORMAT_R32G32_SFLOAT: return 8;
case DATA_FORMAT_R32G32_SFLOAT:
return 8;
case DATA_FORMAT_R32G32B32_UINT:
case DATA_FORMAT_R32G32B32_SINT:
case DATA_FORMAT_R32G32B32_SFLOAT: return 12;
case DATA_FORMAT_R32G32B32_SFLOAT:
return 12;
case DATA_FORMAT_R32G32B32A32_UINT:
case DATA_FORMAT_R32G32B32A32_SINT:
case DATA_FORMAT_R32G32B32A32_SFLOAT: return 16;
case DATA_FORMAT_R32G32B32A32_SFLOAT:
return 16;
case DATA_FORMAT_R64_UINT:
case DATA_FORMAT_R64_SINT:
case DATA_FORMAT_R64_SFLOAT: return 8;
case DATA_FORMAT_R64_SFLOAT:
return 8;
case DATA_FORMAT_R64G64_UINT:
case DATA_FORMAT_R64G64_SINT:
case DATA_FORMAT_R64G64_SFLOAT: return 16;
case DATA_FORMAT_R64G64_SFLOAT:
return 16;
case DATA_FORMAT_R64G64B64_UINT:
case DATA_FORMAT_R64G64B64_SINT:
case DATA_FORMAT_R64G64B64_SFLOAT: return 24;
case DATA_FORMAT_R64G64B64_SFLOAT:
return 24;
case DATA_FORMAT_R64G64B64A64_UINT:
case DATA_FORMAT_R64G64B64A64_SINT:
case DATA_FORMAT_R64G64B64A64_SFLOAT: return 32;
default: return 0;
case DATA_FORMAT_R64G64B64A64_SFLOAT:
return 32;
default:
return 0;
}
}
@ -619,28 +633,32 @@ uint32_t RenderingDeviceVulkan::get_image_format_pixel_size(DataFormat p_format)
switch (p_format) {
case DATA_FORMAT_R4G4_UNORM_PACK8: return 1;
case DATA_FORMAT_R4G4_UNORM_PACK8:
return 1;
case DATA_FORMAT_R4G4B4A4_UNORM_PACK16:
case DATA_FORMAT_B4G4R4A4_UNORM_PACK16:
case DATA_FORMAT_R5G6B5_UNORM_PACK16:
case DATA_FORMAT_B5G6R5_UNORM_PACK16:
case DATA_FORMAT_R5G5B5A1_UNORM_PACK16:
case DATA_FORMAT_B5G5R5A1_UNORM_PACK16:
case DATA_FORMAT_A1R5G5B5_UNORM_PACK16: return 2;
case DATA_FORMAT_A1R5G5B5_UNORM_PACK16:
return 2;
case DATA_FORMAT_R8_UNORM:
case DATA_FORMAT_R8_SNORM:
case DATA_FORMAT_R8_USCALED:
case DATA_FORMAT_R8_SSCALED:
case DATA_FORMAT_R8_UINT:
case DATA_FORMAT_R8_SINT:
case DATA_FORMAT_R8_SRGB: return 1;
case DATA_FORMAT_R8_SRGB:
return 1;
case DATA_FORMAT_R8G8_UNORM:
case DATA_FORMAT_R8G8_SNORM:
case DATA_FORMAT_R8G8_USCALED:
case DATA_FORMAT_R8G8_SSCALED:
case DATA_FORMAT_R8G8_UINT:
case DATA_FORMAT_R8G8_SINT:
case DATA_FORMAT_R8G8_SRGB: return 2;
case DATA_FORMAT_R8G8_SRGB:
return 2;
case DATA_FORMAT_R8G8B8_UNORM:
case DATA_FORMAT_R8G8B8_SNORM:
case DATA_FORMAT_R8G8B8_USCALED:
@ -654,7 +672,8 @@ uint32_t RenderingDeviceVulkan::get_image_format_pixel_size(DataFormat p_format)
case DATA_FORMAT_B8G8R8_SSCALED:
case DATA_FORMAT_B8G8R8_UINT:
case DATA_FORMAT_B8G8R8_SINT:
case DATA_FORMAT_B8G8R8_SRGB: return 3;
case DATA_FORMAT_B8G8R8_SRGB:
return 3;
case DATA_FORMAT_R8G8B8A8_UNORM:
case DATA_FORMAT_R8G8B8A8_SNORM:
case DATA_FORMAT_R8G8B8A8_USCALED:
@ -668,7 +687,8 @@ uint32_t RenderingDeviceVulkan::get_image_format_pixel_size(DataFormat p_format)
case DATA_FORMAT_B8G8R8A8_SSCALED:
case DATA_FORMAT_B8G8R8A8_UINT:
case DATA_FORMAT_B8G8R8A8_SINT:
case DATA_FORMAT_B8G8R8A8_SRGB: return 4;
case DATA_FORMAT_B8G8R8A8_SRGB:
return 4;
case DATA_FORMAT_A8B8G8R8_UNORM_PACK32:
case DATA_FORMAT_A8B8G8R8_SNORM_PACK32:
case DATA_FORMAT_A8B8G8R8_USCALED_PACK32:
@ -687,67 +707,87 @@ uint32_t RenderingDeviceVulkan::get_image_format_pixel_size(DataFormat p_format)
case DATA_FORMAT_A2B10G10R10_USCALED_PACK32:
case DATA_FORMAT_A2B10G10R10_SSCALED_PACK32:
case DATA_FORMAT_A2B10G10R10_UINT_PACK32:
case DATA_FORMAT_A2B10G10R10_SINT_PACK32: return 4;
case DATA_FORMAT_A2B10G10R10_SINT_PACK32:
return 4;
case DATA_FORMAT_R16_UNORM:
case DATA_FORMAT_R16_SNORM:
case DATA_FORMAT_R16_USCALED:
case DATA_FORMAT_R16_SSCALED:
case DATA_FORMAT_R16_UINT:
case DATA_FORMAT_R16_SINT:
case DATA_FORMAT_R16_SFLOAT: return 2;
case DATA_FORMAT_R16_SFLOAT:
return 2;
case DATA_FORMAT_R16G16_UNORM:
case DATA_FORMAT_R16G16_SNORM:
case DATA_FORMAT_R16G16_USCALED:
case DATA_FORMAT_R16G16_SSCALED:
case DATA_FORMAT_R16G16_UINT:
case DATA_FORMAT_R16G16_SINT:
case DATA_FORMAT_R16G16_SFLOAT: return 4;
case DATA_FORMAT_R16G16_SFLOAT:
return 4;
case DATA_FORMAT_R16G16B16_UNORM:
case DATA_FORMAT_R16G16B16_SNORM:
case DATA_FORMAT_R16G16B16_USCALED:
case DATA_FORMAT_R16G16B16_SSCALED:
case DATA_FORMAT_R16G16B16_UINT:
case DATA_FORMAT_R16G16B16_SINT:
case DATA_FORMAT_R16G16B16_SFLOAT: return 6;
case DATA_FORMAT_R16G16B16_SFLOAT:
return 6;
case DATA_FORMAT_R16G16B16A16_UNORM:
case DATA_FORMAT_R16G16B16A16_SNORM:
case DATA_FORMAT_R16G16B16A16_USCALED:
case DATA_FORMAT_R16G16B16A16_SSCALED:
case DATA_FORMAT_R16G16B16A16_UINT:
case DATA_FORMAT_R16G16B16A16_SINT:
case DATA_FORMAT_R16G16B16A16_SFLOAT: return 8;
case DATA_FORMAT_R16G16B16A16_SFLOAT:
return 8;
case DATA_FORMAT_R32_UINT:
case DATA_FORMAT_R32_SINT:
case DATA_FORMAT_R32_SFLOAT: return 4;
case DATA_FORMAT_R32_SFLOAT:
return 4;
case DATA_FORMAT_R32G32_UINT:
case DATA_FORMAT_R32G32_SINT:
case DATA_FORMAT_R32G32_SFLOAT: return 8;
case DATA_FORMAT_R32G32_SFLOAT:
return 8;
case DATA_FORMAT_R32G32B32_UINT:
case DATA_FORMAT_R32G32B32_SINT:
case DATA_FORMAT_R32G32B32_SFLOAT: return 12;
case DATA_FORMAT_R32G32B32_SFLOAT:
return 12;
case DATA_FORMAT_R32G32B32A32_UINT:
case DATA_FORMAT_R32G32B32A32_SINT:
case DATA_FORMAT_R32G32B32A32_SFLOAT: return 16;
case DATA_FORMAT_R32G32B32A32_SFLOAT:
return 16;
case DATA_FORMAT_R64_UINT:
case DATA_FORMAT_R64_SINT:
case DATA_FORMAT_R64_SFLOAT: return 8;
case DATA_FORMAT_R64_SFLOAT:
return 8;
case DATA_FORMAT_R64G64_UINT:
case DATA_FORMAT_R64G64_SINT:
case DATA_FORMAT_R64G64_SFLOAT: return 16;
case DATA_FORMAT_R64G64_SFLOAT:
return 16;
case DATA_FORMAT_R64G64B64_UINT:
case DATA_FORMAT_R64G64B64_SINT:
case DATA_FORMAT_R64G64B64_SFLOAT: return 24;
case DATA_FORMAT_R64G64B64_SFLOAT:
return 24;
case DATA_FORMAT_R64G64B64A64_UINT:
case DATA_FORMAT_R64G64B64A64_SINT:
case DATA_FORMAT_R64G64B64A64_SFLOAT: return 32;
case DATA_FORMAT_R64G64B64A64_SFLOAT:
return 32;
case DATA_FORMAT_B10G11R11_UFLOAT_PACK32:
case DATA_FORMAT_E5B9G9R9_UFLOAT_PACK32: return 4;
case DATA_FORMAT_D16_UNORM: return 2;
case DATA_FORMAT_X8_D24_UNORM_PACK32: return 4;
case DATA_FORMAT_D32_SFLOAT: return 4;
case DATA_FORMAT_S8_UINT: return 1;
case DATA_FORMAT_D16_UNORM_S8_UINT: return 4;
case DATA_FORMAT_D24_UNORM_S8_UINT: return 4;
case DATA_FORMAT_E5B9G9R9_UFLOAT_PACK32:
return 4;
case DATA_FORMAT_D16_UNORM:
return 2;
case DATA_FORMAT_X8_D24_UNORM_PACK32:
return 4;
case DATA_FORMAT_D32_SFLOAT:
return 4;
case DATA_FORMAT_S8_UINT:
return 1;
case DATA_FORMAT_D16_UNORM_S8_UINT:
return 4;
case DATA_FORMAT_D24_UNORM_S8_UINT:
return 4;
case DATA_FORMAT_D32_SFLOAT_S8_UINT:
return 5; //?
case DATA_FORMAT_BC1_RGB_UNORM_BLOCK:
@ -765,17 +805,20 @@ uint32_t RenderingDeviceVulkan::get_image_format_pixel_size(DataFormat p_format)
case DATA_FORMAT_BC6H_UFLOAT_BLOCK:
case DATA_FORMAT_BC6H_SFLOAT_BLOCK:
case DATA_FORMAT_BC7_UNORM_BLOCK:
case DATA_FORMAT_BC7_SRGB_BLOCK: return 1;
case DATA_FORMAT_BC7_SRGB_BLOCK:
return 1;
case DATA_FORMAT_ETC2_R8G8B8_UNORM_BLOCK:
case DATA_FORMAT_ETC2_R8G8B8_SRGB_BLOCK:
case DATA_FORMAT_ETC2_R8G8B8A1_UNORM_BLOCK:
case DATA_FORMAT_ETC2_R8G8B8A1_SRGB_BLOCK:
case DATA_FORMAT_ETC2_R8G8B8A8_UNORM_BLOCK:
case DATA_FORMAT_ETC2_R8G8B8A8_SRGB_BLOCK: return 1;
case DATA_FORMAT_ETC2_R8G8B8A8_SRGB_BLOCK:
return 1;
case DATA_FORMAT_EAC_R11_UNORM_BLOCK:
case DATA_FORMAT_EAC_R11_SNORM_BLOCK:
case DATA_FORMAT_EAC_R11G11_UNORM_BLOCK:
case DATA_FORMAT_EAC_R11G11_SNORM_BLOCK: return 1;
case DATA_FORMAT_EAC_R11G11_SNORM_BLOCK:
return 1;
case DATA_FORMAT_ASTC_4x4_UNORM_BLOCK:
case DATA_FORMAT_ASTC_4x4_SRGB_BLOCK:
case DATA_FORMAT_ASTC_5x4_UNORM_BLOCK:
@ -803,14 +846,17 @@ uint32_t RenderingDeviceVulkan::get_image_format_pixel_size(DataFormat p_format)
case DATA_FORMAT_ASTC_12x10_UNORM_BLOCK:
case DATA_FORMAT_ASTC_12x10_SRGB_BLOCK:
case DATA_FORMAT_ASTC_12x12_UNORM_BLOCK:
case DATA_FORMAT_ASTC_12x12_SRGB_BLOCK: return 1;
case DATA_FORMAT_ASTC_12x12_SRGB_BLOCK:
return 1;
case DATA_FORMAT_G8B8G8R8_422_UNORM:
case DATA_FORMAT_B8G8R8G8_422_UNORM: return 4;
case DATA_FORMAT_B8G8R8G8_422_UNORM:
return 4;
case DATA_FORMAT_G8_B8_R8_3PLANE_420_UNORM:
case DATA_FORMAT_G8_B8R8_2PLANE_420_UNORM:
case DATA_FORMAT_G8_B8_R8_3PLANE_422_UNORM:
case DATA_FORMAT_G8_B8R8_2PLANE_422_UNORM:
case DATA_FORMAT_G8_B8_R8_3PLANE_444_UNORM: return 4;
case DATA_FORMAT_G8_B8_R8_3PLANE_444_UNORM:
return 4;
case DATA_FORMAT_R10X6_UNORM_PACK16:
case DATA_FORMAT_R10X6G10X6_UNORM_2PACK16:
case DATA_FORMAT_R10X6G10X6B10X6A10X6_UNORM_4PACK16:
@ -830,14 +876,16 @@ uint32_t RenderingDeviceVulkan::get_image_format_pixel_size(DataFormat p_format)
case DATA_FORMAT_G12X4_B12X4R12X4_2PLANE_420_UNORM_3PACK16:
case DATA_FORMAT_G12X4_B12X4_R12X4_3PLANE_422_UNORM_3PACK16:
case DATA_FORMAT_G12X4_B12X4R12X4_2PLANE_422_UNORM_3PACK16:
case DATA_FORMAT_G12X4_B12X4_R12X4_3PLANE_444_UNORM_3PACK16: return 2;
case DATA_FORMAT_G12X4_B12X4_R12X4_3PLANE_444_UNORM_3PACK16:
return 2;
case DATA_FORMAT_G16B16G16R16_422_UNORM:
case DATA_FORMAT_B16G16R16G16_422_UNORM:
case DATA_FORMAT_G16_B16_R16_3PLANE_420_UNORM:
case DATA_FORMAT_G16_B16R16_2PLANE_420_UNORM:
case DATA_FORMAT_G16_B16_R16_3PLANE_422_UNORM:
case DATA_FORMAT_G16_B16R16_2PLANE_422_UNORM:
case DATA_FORMAT_G16_B16_R16_3PLANE_444_UNORM: return 8;
case DATA_FORMAT_G16_B16_R16_3PLANE_444_UNORM:
return 8;
case DATA_FORMAT_PVRTC1_2BPP_UNORM_BLOCK_IMG:
case DATA_FORMAT_PVRTC1_4BPP_UNORM_BLOCK_IMG:
case DATA_FORMAT_PVRTC2_2BPP_UNORM_BLOCK_IMG:
@ -845,7 +893,8 @@ uint32_t RenderingDeviceVulkan::get_image_format_pixel_size(DataFormat p_format)
case DATA_FORMAT_PVRTC1_2BPP_SRGB_BLOCK_IMG:
case DATA_FORMAT_PVRTC1_4BPP_SRGB_BLOCK_IMG:
case DATA_FORMAT_PVRTC2_2BPP_SRGB_BLOCK_IMG:
case DATA_FORMAT_PVRTC2_4BPP_SRGB_BLOCK_IMG: return 1;
case DATA_FORMAT_PVRTC2_4BPP_SRGB_BLOCK_IMG:
return 1;
default: {
ERR_PRINT("Format not handled, bug");
}
@ -943,29 +992,41 @@ uint32_t RenderingDeviceVulkan::get_compressed_image_format_block_byte_size(Data
case DATA_FORMAT_BC1_RGB_UNORM_BLOCK:
case DATA_FORMAT_BC1_RGB_SRGB_BLOCK:
case DATA_FORMAT_BC1_RGBA_UNORM_BLOCK:
case DATA_FORMAT_BC1_RGBA_SRGB_BLOCK: return 8;
case DATA_FORMAT_BC1_RGBA_SRGB_BLOCK:
return 8;
case DATA_FORMAT_BC2_UNORM_BLOCK:
case DATA_FORMAT_BC2_SRGB_BLOCK: return 16;
case DATA_FORMAT_BC2_SRGB_BLOCK:
return 16;
case DATA_FORMAT_BC3_UNORM_BLOCK:
case DATA_FORMAT_BC3_SRGB_BLOCK: return 16;
case DATA_FORMAT_BC3_SRGB_BLOCK:
return 16;
case DATA_FORMAT_BC4_UNORM_BLOCK:
case DATA_FORMAT_BC4_SNORM_BLOCK: return 8;
case DATA_FORMAT_BC4_SNORM_BLOCK:
return 8;
case DATA_FORMAT_BC5_UNORM_BLOCK:
case DATA_FORMAT_BC5_SNORM_BLOCK: return 16;
case DATA_FORMAT_BC5_SNORM_BLOCK:
return 16;
case DATA_FORMAT_BC6H_UFLOAT_BLOCK:
case DATA_FORMAT_BC6H_SFLOAT_BLOCK: return 16;
case DATA_FORMAT_BC6H_SFLOAT_BLOCK:
return 16;
case DATA_FORMAT_BC7_UNORM_BLOCK:
case DATA_FORMAT_BC7_SRGB_BLOCK: return 16;
case DATA_FORMAT_BC7_SRGB_BLOCK:
return 16;
case DATA_FORMAT_ETC2_R8G8B8_UNORM_BLOCK:
case DATA_FORMAT_ETC2_R8G8B8_SRGB_BLOCK: return 8;
case DATA_FORMAT_ETC2_R8G8B8_SRGB_BLOCK:
return 8;
case DATA_FORMAT_ETC2_R8G8B8A1_UNORM_BLOCK:
case DATA_FORMAT_ETC2_R8G8B8A1_SRGB_BLOCK: return 8;
case DATA_FORMAT_ETC2_R8G8B8A1_SRGB_BLOCK:
return 8;
case DATA_FORMAT_ETC2_R8G8B8A8_UNORM_BLOCK:
case DATA_FORMAT_ETC2_R8G8B8A8_SRGB_BLOCK: return 16;
case DATA_FORMAT_ETC2_R8G8B8A8_SRGB_BLOCK:
return 16;
case DATA_FORMAT_EAC_R11_UNORM_BLOCK:
case DATA_FORMAT_EAC_R11_SNORM_BLOCK: return 8;
case DATA_FORMAT_EAC_R11_SNORM_BLOCK:
return 8;
case DATA_FORMAT_EAC_R11G11_UNORM_BLOCK:
case DATA_FORMAT_EAC_R11G11_SNORM_BLOCK: return 16;
case DATA_FORMAT_EAC_R11G11_SNORM_BLOCK:
return 16;
case DATA_FORMAT_ASTC_4x4_UNORM_BLOCK: //again, not sure about astc
case DATA_FORMAT_ASTC_4x4_SRGB_BLOCK:
case DATA_FORMAT_ASTC_5x4_UNORM_BLOCK:
@ -1028,11 +1089,13 @@ uint32_t RenderingDeviceVulkan::get_compressed_image_format_pixel_rshift(DataFor
case DATA_FORMAT_PVRTC1_4BPP_UNORM_BLOCK_IMG:
case DATA_FORMAT_PVRTC2_4BPP_UNORM_BLOCK_IMG:
case DATA_FORMAT_PVRTC1_4BPP_SRGB_BLOCK_IMG:
case DATA_FORMAT_PVRTC2_4BPP_SRGB_BLOCK_IMG: return 1;
case DATA_FORMAT_PVRTC2_4BPP_SRGB_BLOCK_IMG:
return 1;
case DATA_FORMAT_PVRTC1_2BPP_UNORM_BLOCK_IMG: //these formats are quarter byte size, so rshift is 1
case DATA_FORMAT_PVRTC2_2BPP_UNORM_BLOCK_IMG:
case DATA_FORMAT_PVRTC1_2BPP_SRGB_BLOCK_IMG:
case DATA_FORMAT_PVRTC2_2BPP_SRGB_BLOCK_IMG: return 2;
case DATA_FORMAT_PVRTC2_2BPP_SRGB_BLOCK_IMG:
return 2;
default: {
}
}
@ -7222,42 +7285,77 @@ String RenderingDeviceVulkan::get_captured_timestamp_name(uint32_t p_index) cons
int RenderingDeviceVulkan::limit_get(Limit p_limit) {
switch (p_limit) {
case LIMIT_MAX_BOUND_UNIFORM_SETS: return limits.maxBoundDescriptorSets;
case LIMIT_MAX_FRAMEBUFFER_COLOR_ATTACHMENTS: return limits.maxColorAttachments;
case LIMIT_MAX_TEXTURES_PER_UNIFORM_SET: return limits.maxDescriptorSetSampledImages;
case LIMIT_MAX_SAMPLERS_PER_UNIFORM_SET: return limits.maxDescriptorSetSamplers;
case LIMIT_MAX_STORAGE_BUFFERS_PER_UNIFORM_SET: return limits.maxDescriptorSetStorageBuffers;
case LIMIT_MAX_STORAGE_IMAGES_PER_UNIFORM_SET: return limits.maxDescriptorSetStorageImages;
case LIMIT_MAX_UNIFORM_BUFFERS_PER_UNIFORM_SET: return limits.maxDescriptorSetUniformBuffers;
case LIMIT_MAX_DRAW_INDEXED_INDEX: return limits.maxDrawIndexedIndexValue;
case LIMIT_MAX_FRAMEBUFFER_HEIGHT: return limits.maxFramebufferHeight;
case LIMIT_MAX_FRAMEBUFFER_WIDTH: return limits.maxFramebufferWidth;
case LIMIT_MAX_TEXTURE_ARRAY_LAYERS: return limits.maxImageArrayLayers;
case LIMIT_MAX_TEXTURE_SIZE_1D: return limits.maxImageDimension1D;
case LIMIT_MAX_TEXTURE_SIZE_2D: return limits.maxImageDimension2D;
case LIMIT_MAX_TEXTURE_SIZE_3D: return limits.maxImageDimension3D;
case LIMIT_MAX_TEXTURE_SIZE_CUBE: return limits.maxImageDimensionCube;
case LIMIT_MAX_TEXTURES_PER_SHADER_STAGE: return limits.maxPerStageDescriptorSampledImages;
case LIMIT_MAX_SAMPLERS_PER_SHADER_STAGE: return limits.maxPerStageDescriptorSamplers;
case LIMIT_MAX_STORAGE_BUFFERS_PER_SHADER_STAGE: return limits.maxPerStageDescriptorStorageBuffers;
case LIMIT_MAX_STORAGE_IMAGES_PER_SHADER_STAGE: return limits.maxPerStageDescriptorStorageImages;
case LIMIT_MAX_UNIFORM_BUFFERS_PER_SHADER_STAGE: return limits.maxPerStageDescriptorUniformBuffers;
case LIMIT_MAX_PUSH_CONSTANT_SIZE: return limits.maxPushConstantsSize;
case LIMIT_MAX_UNIFORM_BUFFER_SIZE: return limits.maxUniformBufferRange;
case LIMIT_MAX_VERTEX_INPUT_ATTRIBUTE_OFFSET: return limits.maxVertexInputAttributeOffset;
case LIMIT_MAX_VERTEX_INPUT_ATTRIBUTES: return limits.maxVertexInputAttributes;
case LIMIT_MAX_VERTEX_INPUT_BINDINGS: return limits.maxVertexInputBindings;
case LIMIT_MAX_VERTEX_INPUT_BINDING_STRIDE: return limits.maxVertexInputBindingStride;
case LIMIT_MIN_UNIFORM_BUFFER_OFFSET_ALIGNMENT: return limits.minUniformBufferOffsetAlignment;
case LIMIT_MAX_COMPUTE_WORKGROUP_COUNT_X: return limits.maxComputeWorkGroupCount[0];
case LIMIT_MAX_COMPUTE_WORKGROUP_COUNT_Y: return limits.maxComputeWorkGroupCount[1];
case LIMIT_MAX_COMPUTE_WORKGROUP_COUNT_Z: return limits.maxComputeWorkGroupCount[2];
case LIMIT_MAX_COMPUTE_WORKGROUP_INVOCATIONS: return limits.maxComputeWorkGroupInvocations;
case LIMIT_MAX_COMPUTE_WORKGROUP_SIZE_X: return limits.maxComputeWorkGroupSize[0];
case LIMIT_MAX_COMPUTE_WORKGROUP_SIZE_Y: return limits.maxComputeWorkGroupSize[1];
case LIMIT_MAX_COMPUTE_WORKGROUP_SIZE_Z: return limits.maxComputeWorkGroupSize[2];
case LIMIT_MAX_BOUND_UNIFORM_SETS:
return limits.maxBoundDescriptorSets;
case LIMIT_MAX_FRAMEBUFFER_COLOR_ATTACHMENTS:
return limits.maxColorAttachments;
case LIMIT_MAX_TEXTURES_PER_UNIFORM_SET:
return limits.maxDescriptorSetSampledImages;
case LIMIT_MAX_SAMPLERS_PER_UNIFORM_SET:
return limits.maxDescriptorSetSamplers;
case LIMIT_MAX_STORAGE_BUFFERS_PER_UNIFORM_SET:
return limits.maxDescriptorSetStorageBuffers;
case LIMIT_MAX_STORAGE_IMAGES_PER_UNIFORM_SET:
return limits.maxDescriptorSetStorageImages;
case LIMIT_MAX_UNIFORM_BUFFERS_PER_UNIFORM_SET:
return limits.maxDescriptorSetUniformBuffers;
case LIMIT_MAX_DRAW_INDEXED_INDEX:
return limits.maxDrawIndexedIndexValue;
case LIMIT_MAX_FRAMEBUFFER_HEIGHT:
return limits.maxFramebufferHeight;
case LIMIT_MAX_FRAMEBUFFER_WIDTH:
return limits.maxFramebufferWidth;
case LIMIT_MAX_TEXTURE_ARRAY_LAYERS:
return limits.maxImageArrayLayers;
case LIMIT_MAX_TEXTURE_SIZE_1D:
return limits.maxImageDimension1D;
case LIMIT_MAX_TEXTURE_SIZE_2D:
return limits.maxImageDimension2D;
case LIMIT_MAX_TEXTURE_SIZE_3D:
return limits.maxImageDimension3D;
case LIMIT_MAX_TEXTURE_SIZE_CUBE:
return limits.maxImageDimensionCube;
case LIMIT_MAX_TEXTURES_PER_SHADER_STAGE:
return limits.maxPerStageDescriptorSampledImages;
case LIMIT_MAX_SAMPLERS_PER_SHADER_STAGE:
return limits.maxPerStageDescriptorSamplers;
case LIMIT_MAX_STORAGE_BUFFERS_PER_SHADER_STAGE:
return limits.maxPerStageDescriptorStorageBuffers;
case LIMIT_MAX_STORAGE_IMAGES_PER_SHADER_STAGE:
return limits.maxPerStageDescriptorStorageImages;
case LIMIT_MAX_UNIFORM_BUFFERS_PER_SHADER_STAGE:
return limits.maxPerStageDescriptorUniformBuffers;
case LIMIT_MAX_PUSH_CONSTANT_SIZE:
return limits.maxPushConstantsSize;
case LIMIT_MAX_UNIFORM_BUFFER_SIZE:
return limits.maxUniformBufferRange;
case LIMIT_MAX_VERTEX_INPUT_ATTRIBUTE_OFFSET:
return limits.maxVertexInputAttributeOffset;
case LIMIT_MAX_VERTEX_INPUT_ATTRIBUTES:
return limits.maxVertexInputAttributes;
case LIMIT_MAX_VERTEX_INPUT_BINDINGS:
return limits.maxVertexInputBindings;
case LIMIT_MAX_VERTEX_INPUT_BINDING_STRIDE:
return limits.maxVertexInputBindingStride;
case LIMIT_MIN_UNIFORM_BUFFER_OFFSET_ALIGNMENT:
return limits.minUniformBufferOffsetAlignment;
case LIMIT_MAX_COMPUTE_WORKGROUP_COUNT_X:
return limits.maxComputeWorkGroupCount[0];
case LIMIT_MAX_COMPUTE_WORKGROUP_COUNT_Y:
return limits.maxComputeWorkGroupCount[1];
case LIMIT_MAX_COMPUTE_WORKGROUP_COUNT_Z:
return limits.maxComputeWorkGroupCount[2];
case LIMIT_MAX_COMPUTE_WORKGROUP_INVOCATIONS:
return limits.maxComputeWorkGroupInvocations;
case LIMIT_MAX_COMPUTE_WORKGROUP_SIZE_X:
return limits.maxComputeWorkGroupSize[0];
case LIMIT_MAX_COMPUTE_WORKGROUP_SIZE_Y:
return limits.maxComputeWorkGroupSize[1];
case LIMIT_MAX_COMPUTE_WORKGROUP_SIZE_Z:
return limits.maxComputeWorkGroupSize[2];
default: ERR_FAIL_V(0);
default:
ERR_FAIL_V(0);
}
return 0;

View File

@ -5297,10 +5297,18 @@ void AnimationTrackEditor::_edit_menu_pressed(int p_option) {
}
switch (animation->track_get_type(i)) {
case Animation::TYPE_TRANSFORM: text += " (Transform)"; break;
case Animation::TYPE_METHOD: text += " (Methods)"; break;
case Animation::TYPE_BEZIER: text += " (Bezier)"; break;
case Animation::TYPE_AUDIO: text += " (Audio)"; break;
case Animation::TYPE_TRANSFORM:
text += " (Transform)";
break;
case Animation::TYPE_METHOD:
text += " (Methods)";
break;
case Animation::TYPE_BEZIER:
text += " (Bezier)";
break;
case Animation::TYPE_AUDIO:
text += " (Audio)";
break;
default: {
};
}

View File

@ -171,20 +171,48 @@ void ConnectDialog::_add_bind() {
Variant value;
switch (vt) {
case Variant::BOOL: value = false; break;
case Variant::INT: value = 0; break;
case Variant::FLOAT: value = 0.0; break;
case Variant::STRING: value = ""; break;
case Variant::STRING_NAME: value = ""; break;
case Variant::VECTOR2: value = Vector2(); break;
case Variant::RECT2: value = Rect2(); break;
case Variant::VECTOR3: value = Vector3(); break;
case Variant::PLANE: value = Plane(); break;
case Variant::QUAT: value = Quat(); break;
case Variant::AABB: value = AABB(); break;
case Variant::BASIS: value = Basis(); break;
case Variant::TRANSFORM: value = Transform(); break;
case Variant::COLOR: value = Color(); break;
case Variant::BOOL:
value = false;
break;
case Variant::INT:
value = 0;
break;
case Variant::FLOAT:
value = 0.0;
break;
case Variant::STRING:
value = "";
break;
case Variant::STRING_NAME:
value = "";
break;
case Variant::VECTOR2:
value = Vector2();
break;
case Variant::RECT2:
value = Rect2();
break;
case Variant::VECTOR3:
value = Vector3();
break;
case Variant::PLANE:
value = Plane();
break;
case Variant::QUAT:
value = Quat();
break;
case Variant::AABB:
value = AABB();
break;
case Variant::BASIS:
value = Basis();
break;
case Variant::TRANSFORM:
value = Transform();
break;
case Variant::COLOR:
value = Color();
break;
default: {
ERR_FAIL();
} break;

View File

@ -1497,7 +1497,8 @@ void EditorHelp::_notification(int p_what) {
_class_desc_resized();
}
} break;
default: break;
default:
break;
}
}
@ -1642,7 +1643,8 @@ void EditorHelpBit::_notification(int p_what) {
rich_text->add_theme_color_override("selection_color", get_theme_color("accent_color", "Editor") * Color(1, 1, 1, 0.4));
} break;
default: break;
default:
break;
}
}

View File

@ -3318,13 +3318,27 @@ bool EditorInspectorDefaultPlugin::parse_property(Object *p_object, Variant::Typ
EditorPropertyMember::Type type = EditorPropertyMember::MEMBER_METHOD_OF_BASE_TYPE;
switch (p_hint) {
case PROPERTY_HINT_METHOD_OF_BASE_TYPE: type = EditorPropertyMember::MEMBER_METHOD_OF_BASE_TYPE; break;
case PROPERTY_HINT_METHOD_OF_INSTANCE: type = EditorPropertyMember::MEMBER_METHOD_OF_INSTANCE; break;
case PROPERTY_HINT_METHOD_OF_SCRIPT: type = EditorPropertyMember::MEMBER_METHOD_OF_SCRIPT; break;
case PROPERTY_HINT_PROPERTY_OF_VARIANT_TYPE: type = EditorPropertyMember::MEMBER_PROPERTY_OF_VARIANT_TYPE; break;
case PROPERTY_HINT_PROPERTY_OF_BASE_TYPE: type = EditorPropertyMember::MEMBER_PROPERTY_OF_BASE_TYPE; break;
case PROPERTY_HINT_PROPERTY_OF_INSTANCE: type = EditorPropertyMember::MEMBER_PROPERTY_OF_INSTANCE; break;
case PROPERTY_HINT_PROPERTY_OF_SCRIPT: type = EditorPropertyMember::MEMBER_PROPERTY_OF_SCRIPT; break;
case PROPERTY_HINT_METHOD_OF_BASE_TYPE:
type = EditorPropertyMember::MEMBER_METHOD_OF_BASE_TYPE;
break;
case PROPERTY_HINT_METHOD_OF_INSTANCE:
type = EditorPropertyMember::MEMBER_METHOD_OF_INSTANCE;
break;
case PROPERTY_HINT_METHOD_OF_SCRIPT:
type = EditorPropertyMember::MEMBER_METHOD_OF_SCRIPT;
break;
case PROPERTY_HINT_PROPERTY_OF_VARIANT_TYPE:
type = EditorPropertyMember::MEMBER_PROPERTY_OF_VARIANT_TYPE;
break;
case PROPERTY_HINT_PROPERTY_OF_BASE_TYPE:
type = EditorPropertyMember::MEMBER_PROPERTY_OF_BASE_TYPE;
break;
case PROPERTY_HINT_PROPERTY_OF_INSTANCE:
type = EditorPropertyMember::MEMBER_PROPERTY_OF_INSTANCE;
break;
case PROPERTY_HINT_PROPERTY_OF_SCRIPT:
type = EditorPropertyMember::MEMBER_PROPERTY_OF_SCRIPT;
break;
default: {
}
}

View File

@ -504,18 +504,26 @@ void ExportTemplateManager::_notification(int p_what) {
status = TTR("Disconnected");
errored = true;
break;
case HTTPClient::STATUS_RESOLVING: status = TTR("Resolving"); break;
case HTTPClient::STATUS_RESOLVING:
status = TTR("Resolving");
break;
case HTTPClient::STATUS_CANT_RESOLVE:
status = TTR("Can't Resolve");
errored = true;
break;
case HTTPClient::STATUS_CONNECTING: status = TTR("Connecting..."); break;
case HTTPClient::STATUS_CONNECTING:
status = TTR("Connecting...");
break;
case HTTPClient::STATUS_CANT_CONNECT:
status = TTR("Can't Connect");
errored = true;
break;
case HTTPClient::STATUS_CONNECTED: status = TTR("Connected"); break;
case HTTPClient::STATUS_REQUESTING: status = TTR("Requesting..."); break;
case HTTPClient::STATUS_CONNECTED:
status = TTR("Connected");
break;
case HTTPClient::STATUS_REQUESTING:
status = TTR("Requesting...");
break;
case HTTPClient::STATUS_BODY:
status = TTR("Downloading");
if (download_templates->get_body_size() > 0) {

View File

@ -538,12 +538,18 @@ Error EditorSceneImporterGLTF::_parse_accessors(GLTFState &state) {
String EditorSceneImporterGLTF::_get_component_type_name(const uint32_t p_component) {
switch (p_component) {
case COMPONENT_TYPE_BYTE: return "Byte";
case COMPONENT_TYPE_UNSIGNED_BYTE: return "UByte";
case COMPONENT_TYPE_SHORT: return "Short";
case COMPONENT_TYPE_UNSIGNED_SHORT: return "UShort";
case COMPONENT_TYPE_INT: return "Int";
case COMPONENT_TYPE_FLOAT: return "Float";
case COMPONENT_TYPE_BYTE:
return "Byte";
case COMPONENT_TYPE_UNSIGNED_BYTE:
return "UByte";
case COMPONENT_TYPE_SHORT:
return "Short";
case COMPONENT_TYPE_UNSIGNED_SHORT:
return "UShort";
case COMPONENT_TYPE_INT:
return "Int";
case COMPONENT_TYPE_FLOAT:
return "Float";
}
return "<Error>";
@ -655,12 +661,24 @@ Error EditorSceneImporterGLTF::_decode_buffer_view(GLTFState &state, double *dst
int EditorSceneImporterGLTF::_get_component_type_size(const int component_type) {
switch (component_type) {
case COMPONENT_TYPE_BYTE: return 1; break;
case COMPONENT_TYPE_UNSIGNED_BYTE: return 1; break;
case COMPONENT_TYPE_SHORT: return 2; break;
case COMPONENT_TYPE_UNSIGNED_SHORT: return 2; break;
case COMPONENT_TYPE_INT: return 4; break;
case COMPONENT_TYPE_FLOAT: return 4; break;
case COMPONENT_TYPE_BYTE:
return 1;
break;
case COMPONENT_TYPE_UNSIGNED_BYTE:
return 1;
break;
case COMPONENT_TYPE_SHORT:
return 2;
break;
case COMPONENT_TYPE_UNSIGNED_SHORT:
return 2;
break;
case COMPONENT_TYPE_INT:
return 4;
break;
case COMPONENT_TYPE_FLOAT:
return 4;
break;
default: {
ERR_FAIL_V(0);
}

View File

@ -83,9 +83,15 @@ Error ResourceImporterCSVTranslation::import(const String &p_source_file, const
String delimiter;
switch ((int)p_options["delimiter"]) {
case 0: delimiter = ","; break;
case 1: delimiter = ";"; break;
case 2: delimiter = "\t"; break;
case 0:
delimiter = ",";
break;
case 1:
delimiter = ";";
break;
case 2:
delimiter = "\t";
break;
}
FileAccessRef f = FileAccess::open(p_source_file, FileAccess::READ);

View File

@ -221,16 +221,26 @@ int ResourceImporterScene::get_preset_count() const {
String ResourceImporterScene::get_preset_name(int p_idx) const {
switch (p_idx) {
case PRESET_SINGLE_SCENE: return TTR("Import as Single Scene");
case PRESET_SEPARATE_ANIMATIONS: return TTR("Import with Separate Animations");
case PRESET_SEPARATE_MATERIALS: return TTR("Import with Separate Materials");
case PRESET_SEPARATE_MESHES: return TTR("Import with Separate Objects");
case PRESET_SEPARATE_MESHES_AND_MATERIALS: return TTR("Import with Separate Objects+Materials");
case PRESET_SEPARATE_MESHES_AND_ANIMATIONS: return TTR("Import with Separate Objects+Animations");
case PRESET_SEPARATE_MATERIALS_AND_ANIMATIONS: return TTR("Import with Separate Materials+Animations");
case PRESET_SEPARATE_MESHES_MATERIALS_AND_ANIMATIONS: return TTR("Import with Separate Objects+Materials+Animations");
case PRESET_MULTIPLE_SCENES: return TTR("Import as Multiple Scenes");
case PRESET_MULTIPLE_SCENES_AND_MATERIALS: return TTR("Import as Multiple Scenes+Materials");
case PRESET_SINGLE_SCENE:
return TTR("Import as Single Scene");
case PRESET_SEPARATE_ANIMATIONS:
return TTR("Import with Separate Animations");
case PRESET_SEPARATE_MATERIALS:
return TTR("Import with Separate Materials");
case PRESET_SEPARATE_MESHES:
return TTR("Import with Separate Objects");
case PRESET_SEPARATE_MESHES_AND_MATERIALS:
return TTR("Import with Separate Objects+Materials");
case PRESET_SEPARATE_MESHES_AND_ANIMATIONS:
return TTR("Import with Separate Objects+Animations");
case PRESET_SEPARATE_MATERIALS_AND_ANIMATIONS:
return TTR("Import with Separate Materials+Animations");
case PRESET_SEPARATE_MESHES_MATERIALS_AND_ANIMATIONS:
return TTR("Import with Separate Objects+Materials+Animations");
case PRESET_MULTIPLE_SCENES:
return TTR("Import as Multiple Scenes");
case PRESET_MULTIPLE_SCENES_AND_MATERIALS:
return TTR("Import as Multiple Scenes+Materials");
}
return "";

View File

@ -2212,12 +2212,18 @@ int VisibilityNotifier3DGizmoPlugin::get_priority() const {
String VisibilityNotifier3DGizmoPlugin::get_handle_name(const EditorNode3DGizmo *p_gizmo, int p_idx) const {
switch (p_idx) {
case 0: return "Size X";
case 1: return "Size Y";
case 2: return "Size Z";
case 3: return "Pos X";
case 4: return "Pos Y";
case 5: return "Pos Z";
case 0:
return "Size X";
case 1:
return "Size Y";
case 2:
return "Size Z";
case 3:
return "Pos X";
case 4:
return "Pos Y";
case 5:
return "Pos Z";
}
return "";
@ -2404,12 +2410,18 @@ bool GPUParticles3DGizmoPlugin::is_selectable_when_hidden() const {
String GPUParticles3DGizmoPlugin::get_handle_name(const EditorNode3DGizmo *p_gizmo, int p_idx) const {
switch (p_idx) {
case 0: return "Size X";
case 1: return "Size Y";
case 2: return "Size Z";
case 3: return "Pos X";
case 4: return "Pos Y";
case 5: return "Pos Z";
case 0:
return "Size X";
case 1:
return "Size Y";
case 2:
return "Size Z";
case 3:
return "Pos X";
case 4:
return "Pos Y";
case 5:
return "Pos Z";
}
return "";
@ -2569,12 +2581,18 @@ int ReflectionProbeGizmoPlugin::get_priority() const {
String ReflectionProbeGizmoPlugin::get_handle_name(const EditorNode3DGizmo *p_gizmo, int p_idx) const {
switch (p_idx) {
case 0: return "Extents X";
case 1: return "Extents Y";
case 2: return "Extents Z";
case 3: return "Origin X";
case 4: return "Origin Y";
case 5: return "Origin Z";
case 0:
return "Extents X";
case 1:
return "Extents Y";
case 2:
return "Extents Z";
case 3:
return "Origin X";
case 4:
return "Origin Y";
case 5:
return "Origin Z";
}
return "";
@ -2752,9 +2770,12 @@ int DecalGizmoPlugin::get_priority() const {
String DecalGizmoPlugin::get_handle_name(const EditorNode3DGizmo *p_gizmo, int p_idx) const {
switch (p_idx) {
case 0: return "Extents X";
case 1: return "Extents Y";
case 2: return "Extents Z";
case 0:
return "Extents X";
case 1:
return "Extents Y";
case 2:
return "Extents Z";
}
return "";
@ -2893,9 +2914,12 @@ int GIProbeGizmoPlugin::get_priority() const {
String GIProbeGizmoPlugin::get_handle_name(const EditorNode3DGizmo *p_gizmo, int p_idx) const {
switch (p_idx) {
case 0: return "Extents X";
case 1: return "Extents Y";
case 2: return "Extents Z";
case 0:
return "Extents X";
case 1:
return "Extents Y";
case 2:
return "Extents Z";
}
return "";

View File

@ -1297,7 +1297,8 @@ void EditorAssetLibrary::_http_request_completed(int p_status, int p_code, const
}
}
} break;
default: break;
default:
break;
}
}

View File

@ -6262,7 +6262,8 @@ void CanvasItemEditorViewport::_notification(int p_what) {
disconnect("mouse_exited", callable_mp(this, &CanvasItemEditorViewport::_on_mouse_exit));
} break;
default: break;
default:
break;
}
}

View File

@ -785,11 +785,16 @@ static int _get_key_modifier_setting(const String &p_property) {
switch (EditorSettings::get_singleton()->get(p_property).operator int()) {
case 0: return 0;
case 1: return KEY_SHIFT;
case 2: return KEY_ALT;
case 3: return KEY_META;
case 4: return KEY_CONTROL;
case 0:
return 0;
case 1:
return KEY_SHIFT;
case 2:
return KEY_ALT;
case 3:
return KEY_META;
case 4:
return KEY_CONTROL;
}
return 0;
}

View File

@ -74,11 +74,21 @@ void ThemeEditor::_name_menu_about_to_show() {
switch (type_select->get_selected()) {
case 0: Theme::get_default()->get_icon_list(fromtype, &names); break;
case 1: Theme::get_default()->get_stylebox_list(fromtype, &names); break;
case 2: Theme::get_default()->get_font_list(fromtype, &names); break;
case 3: Theme::get_default()->get_color_list(fromtype, &names); break;
case 4: Theme::get_default()->get_constant_list(fromtype, &names); break;
case 0:
Theme::get_default()->get_icon_list(fromtype, &names);
break;
case 1:
Theme::get_default()->get_stylebox_list(fromtype, &names);
break;
case 2:
Theme::get_default()->get_font_list(fromtype, &names);
break;
case 3:
Theme::get_default()->get_color_list(fromtype, &names);
break;
case 4:
Theme::get_default()->get_constant_list(fromtype, &names);
break;
}
} else if (popup_mode == POPUP_REMOVE) {
@ -324,11 +334,21 @@ void ThemeEditor::_dialog_cbk() {
switch (type_select->get_selected()) {
case 0: theme->set_icon(name_edit->get_text(), type_edit->get_text(), Ref<Texture2D>()); break;
case 1: theme->set_stylebox(name_edit->get_text(), type_edit->get_text(), Ref<StyleBox>()); break;
case 2: theme->set_font(name_edit->get_text(), type_edit->get_text(), Ref<Font>()); break;
case 3: theme->set_color(name_edit->get_text(), type_edit->get_text(), Color()); break;
case 4: theme->set_constant(name_edit->get_text(), type_edit->get_text(), 0); break;
case 0:
theme->set_icon(name_edit->get_text(), type_edit->get_text(), Ref<Texture2D>());
break;
case 1:
theme->set_stylebox(name_edit->get_text(), type_edit->get_text(), Ref<StyleBox>());
break;
case 2:
theme->set_font(name_edit->get_text(), type_edit->get_text(), Ref<Font>());
break;
case 3:
theme->set_color(name_edit->get_text(), type_edit->get_text(), Color());
break;
case 4:
theme->set_constant(name_edit->get_text(), type_edit->get_text(), 0);
break;
}
} break;
@ -376,11 +396,21 @@ void ThemeEditor::_dialog_cbk() {
case POPUP_REMOVE: {
switch (type_select->get_selected()) {
case 0: theme->clear_icon(name_edit->get_text(), type_edit->get_text()); break;
case 1: theme->clear_stylebox(name_edit->get_text(), type_edit->get_text()); break;
case 2: theme->clear_font(name_edit->get_text(), type_edit->get_text()); break;
case 3: theme->clear_color(name_edit->get_text(), type_edit->get_text()); break;
case 4: theme->clear_constant(name_edit->get_text(), type_edit->get_text()); break;
case 0:
theme->clear_icon(name_edit->get_text(), type_edit->get_text());
break;
case 1:
theme->clear_stylebox(name_edit->get_text(), type_edit->get_text());
break;
case 2:
theme->clear_font(name_edit->get_text(), type_edit->get_text());
break;
case 3:
theme->clear_color(name_edit->get_text(), type_edit->get_text());
break;
case 4:
theme->clear_constant(name_edit->get_text(), type_edit->get_text());
break;
}
} break;

View File

@ -2429,12 +2429,24 @@ ProjectManager::ProjectManager() {
#endif
} break;
case 1: editor_set_scale(0.75); break;
case 2: editor_set_scale(1.0); break;
case 3: editor_set_scale(1.25); break;
case 4: editor_set_scale(1.5); break;
case 5: editor_set_scale(1.75); break;
case 6: editor_set_scale(2.0); break;
case 1:
editor_set_scale(0.75);
break;
case 2:
editor_set_scale(1.0);
break;
case 3:
editor_set_scale(1.25);
break;
case 4:
editor_set_scale(1.5);
break;
case 5:
editor_set_scale(1.75);
break;
case 6:
editor_set_scale(2.0);
break;
default: {
editor_set_scale(custom_display_scale);

View File

@ -806,12 +806,23 @@ void ProjectSettingsEditor::_update_actions() {
if (mb.is_valid()) {
String str = _get_device_string(mb->get_device()) + ", ";
switch (mb->get_button_index()) {
case BUTTON_LEFT: str += TTR("Left Button"); break;
case BUTTON_RIGHT: str += TTR("Right Button"); break;
case BUTTON_MIDDLE: str += TTR("Middle Button"); break;
case BUTTON_WHEEL_UP: str += TTR("Wheel Up"); break;
case BUTTON_WHEEL_DOWN: str += TTR("Wheel Down"); break;
default: str += vformat(TTR("%d Button"), mb->get_button_index());
case BUTTON_LEFT:
str += TTR("Left Button");
break;
case BUTTON_RIGHT:
str += TTR("Right Button");
break;
case BUTTON_MIDDLE:
str += TTR("Middle Button");
break;
case BUTTON_WHEEL_UP:
str += TTR("Wheel Up");
break;
case BUTTON_WHEEL_DOWN:
str += TTR("Wheel Down");
break;
default:
str += vformat(TTR("%d Button"), mb->get_button_index());
}
action2->set_text(0, str);

View File

@ -990,8 +990,12 @@ void SceneTreeDock::_tool_selected(int p_tool, bool p_confirm_override) {
}
} else {
switch (p_tool) {
case TOOL_CREATE_2D_SCENE: new_node = memnew(Node2D); break;
case TOOL_CREATE_3D_SCENE: new_node = memnew(Node3D); break;
case TOOL_CREATE_2D_SCENE:
new_node = memnew(Node2D);
break;
case TOOL_CREATE_3D_SCENE:
new_node = memnew(Node3D);
break;
case TOOL_CREATE_USER_INTERFACE: {
Control *node = memnew(Control);
node->set_anchors_and_margins_preset(PRESET_WIDE); //more useful for resizable UIs.

View File

@ -125,33 +125,60 @@ String Performance::get_monitor_name(Monitor p_monitor) const {
float Performance::get_monitor(Monitor p_monitor) const {
switch (p_monitor) {
case TIME_FPS: return Engine::get_singleton()->get_frames_per_second();
case TIME_PROCESS: return _process_time;
case TIME_PHYSICS_PROCESS: return _physics_process_time;
case MEMORY_STATIC: return Memory::get_mem_usage();
case MEMORY_STATIC_MAX: return Memory::get_mem_max_usage();
case MEMORY_MESSAGE_BUFFER_MAX: return MessageQueue::get_singleton()->get_max_buffer_usage();
case OBJECT_COUNT: return ObjectDB::get_object_count();
case OBJECT_RESOURCE_COUNT: return ResourceCache::get_cached_resource_count();
case OBJECT_NODE_COUNT: return _get_node_count();
case OBJECT_ORPHAN_NODE_COUNT: return Node::orphan_node_count;
case RENDER_OBJECTS_IN_FRAME: return RS::get_singleton()->get_render_info(RS::INFO_OBJECTS_IN_FRAME);
case RENDER_VERTICES_IN_FRAME: return RS::get_singleton()->get_render_info(RS::INFO_VERTICES_IN_FRAME);
case RENDER_MATERIAL_CHANGES_IN_FRAME: return RS::get_singleton()->get_render_info(RS::INFO_MATERIAL_CHANGES_IN_FRAME);
case RENDER_SHADER_CHANGES_IN_FRAME: return RS::get_singleton()->get_render_info(RS::INFO_SHADER_CHANGES_IN_FRAME);
case RENDER_SURFACE_CHANGES_IN_FRAME: return RS::get_singleton()->get_render_info(RS::INFO_SURFACE_CHANGES_IN_FRAME);
case RENDER_DRAW_CALLS_IN_FRAME: return RS::get_singleton()->get_render_info(RS::INFO_DRAW_CALLS_IN_FRAME);
case RENDER_VIDEO_MEM_USED: return RS::get_singleton()->get_render_info(RS::INFO_VIDEO_MEM_USED);
case RENDER_TEXTURE_MEM_USED: return RS::get_singleton()->get_render_info(RS::INFO_TEXTURE_MEM_USED);
case RENDER_VERTEX_MEM_USED: return RS::get_singleton()->get_render_info(RS::INFO_VERTEX_MEM_USED);
case RENDER_USAGE_VIDEO_MEM_TOTAL: return RS::get_singleton()->get_render_info(RS::INFO_USAGE_VIDEO_MEM_TOTAL);
case PHYSICS_2D_ACTIVE_OBJECTS: return PhysicsServer2D::get_singleton()->get_process_info(PhysicsServer2D::INFO_ACTIVE_OBJECTS);
case PHYSICS_2D_COLLISION_PAIRS: return PhysicsServer2D::get_singleton()->get_process_info(PhysicsServer2D::INFO_COLLISION_PAIRS);
case PHYSICS_2D_ISLAND_COUNT: return PhysicsServer2D::get_singleton()->get_process_info(PhysicsServer2D::INFO_ISLAND_COUNT);
case PHYSICS_3D_ACTIVE_OBJECTS: return PhysicsServer3D::get_singleton()->get_process_info(PhysicsServer3D::INFO_ACTIVE_OBJECTS);
case PHYSICS_3D_COLLISION_PAIRS: return PhysicsServer3D::get_singleton()->get_process_info(PhysicsServer3D::INFO_COLLISION_PAIRS);
case PHYSICS_3D_ISLAND_COUNT: return PhysicsServer3D::get_singleton()->get_process_info(PhysicsServer3D::INFO_ISLAND_COUNT);
case AUDIO_OUTPUT_LATENCY: return AudioServer::get_singleton()->get_output_latency();
case TIME_FPS:
return Engine::get_singleton()->get_frames_per_second();
case TIME_PROCESS:
return _process_time;
case TIME_PHYSICS_PROCESS:
return _physics_process_time;
case MEMORY_STATIC:
return Memory::get_mem_usage();
case MEMORY_STATIC_MAX:
return Memory::get_mem_max_usage();
case MEMORY_MESSAGE_BUFFER_MAX:
return MessageQueue::get_singleton()->get_max_buffer_usage();
case OBJECT_COUNT:
return ObjectDB::get_object_count();
case OBJECT_RESOURCE_COUNT:
return ResourceCache::get_cached_resource_count();
case OBJECT_NODE_COUNT:
return _get_node_count();
case OBJECT_ORPHAN_NODE_COUNT:
return Node::orphan_node_count;
case RENDER_OBJECTS_IN_FRAME:
return RS::get_singleton()->get_render_info(RS::INFO_OBJECTS_IN_FRAME);
case RENDER_VERTICES_IN_FRAME:
return RS::get_singleton()->get_render_info(RS::INFO_VERTICES_IN_FRAME);
case RENDER_MATERIAL_CHANGES_IN_FRAME:
return RS::get_singleton()->get_render_info(RS::INFO_MATERIAL_CHANGES_IN_FRAME);
case RENDER_SHADER_CHANGES_IN_FRAME:
return RS::get_singleton()->get_render_info(RS::INFO_SHADER_CHANGES_IN_FRAME);
case RENDER_SURFACE_CHANGES_IN_FRAME:
return RS::get_singleton()->get_render_info(RS::INFO_SURFACE_CHANGES_IN_FRAME);
case RENDER_DRAW_CALLS_IN_FRAME:
return RS::get_singleton()->get_render_info(RS::INFO_DRAW_CALLS_IN_FRAME);
case RENDER_VIDEO_MEM_USED:
return RS::get_singleton()->get_render_info(RS::INFO_VIDEO_MEM_USED);
case RENDER_TEXTURE_MEM_USED:
return RS::get_singleton()->get_render_info(RS::INFO_TEXTURE_MEM_USED);
case RENDER_VERTEX_MEM_USED:
return RS::get_singleton()->get_render_info(RS::INFO_VERTEX_MEM_USED);
case RENDER_USAGE_VIDEO_MEM_TOTAL:
return RS::get_singleton()->get_render_info(RS::INFO_USAGE_VIDEO_MEM_TOTAL);
case PHYSICS_2D_ACTIVE_OBJECTS:
return PhysicsServer2D::get_singleton()->get_process_info(PhysicsServer2D::INFO_ACTIVE_OBJECTS);
case PHYSICS_2D_COLLISION_PAIRS:
return PhysicsServer2D::get_singleton()->get_process_info(PhysicsServer2D::INFO_COLLISION_PAIRS);
case PHYSICS_2D_ISLAND_COUNT:
return PhysicsServer2D::get_singleton()->get_process_info(PhysicsServer2D::INFO_ISLAND_COUNT);
case PHYSICS_3D_ACTIVE_OBJECTS:
return PhysicsServer3D::get_singleton()->get_process_info(PhysicsServer3D::INFO_ACTIVE_OBJECTS);
case PHYSICS_3D_COLLISION_PAIRS:
return PhysicsServer3D::get_singleton()->get_process_info(PhysicsServer3D::INFO_COLLISION_PAIRS);
case PHYSICS_3D_ISLAND_COUNT:
return PhysicsServer3D::get_singleton()->get_process_info(PhysicsServer3D::INFO_ISLAND_COUNT);
case AUDIO_OUTPUT_LATENCY:
return AudioServer::get_singleton()->get_output_latency();
default: {
}

View File

@ -199,14 +199,24 @@ class GetClassAndNamespace {
switch (next) {
case 'b': res = 8; break;
case 't': res = 9; break;
case 'n': res = 10; break;
case 'f': res = 12; break;
case 'b':
res = 8;
break;
case 't':
res = 9;
break;
case 'n':
res = 10;
break;
case 'f':
res = 12;
break;
case 'r':
res = 13;
break;
case '\"': res = '\"'; break;
case '\"':
res = '\"';
break;
case '\\':
res = '\\';
break;

View File

@ -61,10 +61,14 @@ static String _typestr(SL::DataType p_type) {
static String _prestr(SL::DataPrecision p_pres) {
switch (p_pres) {
case SL::PRECISION_LOWP: return "lowp ";
case SL::PRECISION_MEDIUMP: return "mediump ";
case SL::PRECISION_HIGHP: return "highp ";
case SL::PRECISION_DEFAULT: return "";
case SL::PRECISION_LOWP:
return "lowp ";
case SL::PRECISION_MEDIUMP:
return "mediump ";
case SL::PRECISION_HIGHP:
return "highp ";
case SL::PRECISION_DEFAULT:
return "";
}
return "";
}
@ -77,23 +81,40 @@ static String _opstr(SL::Operator p_op) {
static String get_constant_text(SL::DataType p_type, const Vector<SL::ConstantNode::Value> &p_values) {
switch (p_type) {
case SL::TYPE_BOOL: return p_values[0].boolean ? "true" : "false";
case SL::TYPE_BVEC2: return String() + "bvec2(" + (p_values[0].boolean ? "true" : "false") + (p_values[1].boolean ? "true" : "false") + ")";
case SL::TYPE_BVEC3: return String() + "bvec3(" + (p_values[0].boolean ? "true" : "false") + "," + (p_values[1].boolean ? "true" : "false") + "," + (p_values[2].boolean ? "true" : "false") + ")";
case SL::TYPE_BVEC4: return String() + "bvec4(" + (p_values[0].boolean ? "true" : "false") + "," + (p_values[1].boolean ? "true" : "false") + "," + (p_values[2].boolean ? "true" : "false") + "," + (p_values[3].boolean ? "true" : "false") + ")";
case SL::TYPE_INT: return rtos(p_values[0].sint);
case SL::TYPE_IVEC2: return String() + "ivec2(" + rtos(p_values[0].sint) + "," + rtos(p_values[1].sint) + ")";
case SL::TYPE_IVEC3: return String() + "ivec3(" + rtos(p_values[0].sint) + "," + rtos(p_values[1].sint) + "," + rtos(p_values[2].sint) + ")";
case SL::TYPE_IVEC4: return String() + "ivec4(" + rtos(p_values[0].sint) + "," + rtos(p_values[1].sint) + "," + rtos(p_values[2].sint) + "," + rtos(p_values[3].sint) + ")";
case SL::TYPE_UINT: return rtos(p_values[0].real);
case SL::TYPE_UVEC2: return String() + "uvec2(" + rtos(p_values[0].real) + "," + rtos(p_values[1].real) + ")";
case SL::TYPE_UVEC3: return String() + "uvec3(" + rtos(p_values[0].real) + "," + rtos(p_values[1].real) + "," + rtos(p_values[2].real) + ")";
case SL::TYPE_UVEC4: return String() + "uvec4(" + rtos(p_values[0].real) + "," + rtos(p_values[1].real) + "," + rtos(p_values[2].real) + "," + rtos(p_values[3].real) + ")";
case SL::TYPE_FLOAT: return rtos(p_values[0].real);
case SL::TYPE_VEC2: return String() + "vec2(" + rtos(p_values[0].real) + "," + rtos(p_values[1].real) + ")";
case SL::TYPE_VEC3: return String() + "vec3(" + rtos(p_values[0].real) + "," + rtos(p_values[1].real) + "," + rtos(p_values[2].real) + ")";
case SL::TYPE_VEC4: return String() + "vec4(" + rtos(p_values[0].real) + "," + rtos(p_values[1].real) + "," + rtos(p_values[2].real) + "," + rtos(p_values[3].real) + ")";
default: ERR_FAIL_V(String());
case SL::TYPE_BOOL:
return p_values[0].boolean ? "true" : "false";
case SL::TYPE_BVEC2:
return String() + "bvec2(" + (p_values[0].boolean ? "true" : "false") + (p_values[1].boolean ? "true" : "false") + ")";
case SL::TYPE_BVEC3:
return String() + "bvec3(" + (p_values[0].boolean ? "true" : "false") + "," + (p_values[1].boolean ? "true" : "false") + "," + (p_values[2].boolean ? "true" : "false") + ")";
case SL::TYPE_BVEC4:
return String() + "bvec4(" + (p_values[0].boolean ? "true" : "false") + "," + (p_values[1].boolean ? "true" : "false") + "," + (p_values[2].boolean ? "true" : "false") + "," + (p_values[3].boolean ? "true" : "false") + ")";
case SL::TYPE_INT:
return rtos(p_values[0].sint);
case SL::TYPE_IVEC2:
return String() + "ivec2(" + rtos(p_values[0].sint) + "," + rtos(p_values[1].sint) + ")";
case SL::TYPE_IVEC3:
return String() + "ivec3(" + rtos(p_values[0].sint) + "," + rtos(p_values[1].sint) + "," + rtos(p_values[2].sint) + ")";
case SL::TYPE_IVEC4:
return String() + "ivec4(" + rtos(p_values[0].sint) + "," + rtos(p_values[1].sint) + "," + rtos(p_values[2].sint) + "," + rtos(p_values[3].sint) + ")";
case SL::TYPE_UINT:
return rtos(p_values[0].real);
case SL::TYPE_UVEC2:
return String() + "uvec2(" + rtos(p_values[0].real) + "," + rtos(p_values[1].real) + ")";
case SL::TYPE_UVEC3:
return String() + "uvec3(" + rtos(p_values[0].real) + "," + rtos(p_values[1].real) + "," + rtos(p_values[2].real) + ")";
case SL::TYPE_UVEC4:
return String() + "uvec4(" + rtos(p_values[0].real) + "," + rtos(p_values[1].real) + "," + rtos(p_values[2].real) + "," + rtos(p_values[3].real) + ")";
case SL::TYPE_FLOAT:
return rtos(p_values[0].real);
case SL::TYPE_VEC2:
return String() + "vec2(" + rtos(p_values[0].real) + "," + rtos(p_values[1].real) + ")";
case SL::TYPE_VEC3:
return String() + "vec3(" + rtos(p_values[0].real) + "," + rtos(p_values[1].real) + "," + rtos(p_values[2].real) + ")";
case SL::TYPE_VEC4:
return String() + "vec4(" + rtos(p_values[0].real) + "," + rtos(p_values[1].real) + "," + rtos(p_values[2].real) + "," + rtos(p_values[3].real) + ")";
default:
ERR_FAIL_V(String());
}
}

View File

@ -202,20 +202,34 @@ public:
*/
static float get_fbx_fps(int32_t time_mode, const aiScene *p_scene) {
switch (time_mode) {
case AssetImportFbx::TIME_MODE_DEFAULT: return 24; //hack
case AssetImportFbx::TIME_MODE_120: return 120;
case AssetImportFbx::TIME_MODE_100: return 100;
case AssetImportFbx::TIME_MODE_60: return 60;
case AssetImportFbx::TIME_MODE_50: return 50;
case AssetImportFbx::TIME_MODE_48: return 48;
case AssetImportFbx::TIME_MODE_30: return 30;
case AssetImportFbx::TIME_MODE_30_DROP: return 30;
case AssetImportFbx::TIME_MODE_NTSC_DROP_FRAME: return 29.9700262f;
case AssetImportFbx::TIME_MODE_NTSC_FULL_FRAME: return 29.9700262f;
case AssetImportFbx::TIME_MODE_PAL: return 25;
case AssetImportFbx::TIME_MODE_CINEMA: return 24;
case AssetImportFbx::TIME_MODE_1000: return 1000;
case AssetImportFbx::TIME_MODE_CINEMA_ND: return 23.976f;
case AssetImportFbx::TIME_MODE_DEFAULT:
return 24; //hack
case AssetImportFbx::TIME_MODE_120:
return 120;
case AssetImportFbx::TIME_MODE_100:
return 100;
case AssetImportFbx::TIME_MODE_60:
return 60;
case AssetImportFbx::TIME_MODE_50:
return 50;
case AssetImportFbx::TIME_MODE_48:
return 48;
case AssetImportFbx::TIME_MODE_30:
return 30;
case AssetImportFbx::TIME_MODE_30_DROP:
return 30;
case AssetImportFbx::TIME_MODE_NTSC_DROP_FRAME:
return 29.9700262f;
case AssetImportFbx::TIME_MODE_NTSC_FULL_FRAME:
return 29.9700262f;
case AssetImportFbx::TIME_MODE_PAL:
return 25;
case AssetImportFbx::TIME_MODE_CINEMA:
return 24;
case AssetImportFbx::TIME_MODE_1000:
return 1000;
case AssetImportFbx::TIME_MODE_CINEMA_ND:
return 23.976f;
case AssetImportFbx::TIME_MODE_CUSTOM:
int32_t frame_rate = -1;
p_scene->mMetaData->Get("FrameRate", frame_rate);

View File

@ -162,7 +162,8 @@ void HingeJointBullet::set_flag(PhysicsServer3D::HingeJointFlag p_flag, bool p_v
case PhysicsServer3D::HINGE_JOINT_FLAG_ENABLE_MOTOR:
hingeConstraint->enableMotor(p_value);
break;
case PhysicsServer3D::HINGE_JOINT_FLAG_MAX: break; // Can't happen, but silences warning
case PhysicsServer3D::HINGE_JOINT_FLAG_MAX:
break; // Can't happen, but silences warning
}
}

View File

@ -344,56 +344,123 @@ real_t SliderJointBullet::getLinearPos() {
void SliderJointBullet::set_param(PhysicsServer3D::SliderJointParam p_param, real_t p_value) {
switch (p_param) {
case PhysicsServer3D::SLIDER_JOINT_LINEAR_LIMIT_UPPER: setUpperLinLimit(p_value); break;
case PhysicsServer3D::SLIDER_JOINT_LINEAR_LIMIT_LOWER: setLowerLinLimit(p_value); break;
case PhysicsServer3D::SLIDER_JOINT_LINEAR_LIMIT_SOFTNESS: setSoftnessLimLin(p_value); break;
case PhysicsServer3D::SLIDER_JOINT_LINEAR_LIMIT_RESTITUTION: setRestitutionLimLin(p_value); break;
case PhysicsServer3D::SLIDER_JOINT_LINEAR_LIMIT_DAMPING: setDampingLimLin(p_value); break;
case PhysicsServer3D::SLIDER_JOINT_LINEAR_MOTION_SOFTNESS: setSoftnessDirLin(p_value); break;
case PhysicsServer3D::SLIDER_JOINT_LINEAR_MOTION_RESTITUTION: setRestitutionDirLin(p_value); break;
case PhysicsServer3D::SLIDER_JOINT_LINEAR_MOTION_DAMPING: setDampingDirLin(p_value); break;
case PhysicsServer3D::SLIDER_JOINT_LINEAR_ORTHOGONAL_SOFTNESS: setSoftnessOrthoLin(p_value); break;
case PhysicsServer3D::SLIDER_JOINT_LINEAR_ORTHOGONAL_RESTITUTION: setRestitutionOrthoLin(p_value); break;
case PhysicsServer3D::SLIDER_JOINT_LINEAR_ORTHOGONAL_DAMPING: setDampingOrthoLin(p_value); break;
case PhysicsServer3D::SLIDER_JOINT_ANGULAR_LIMIT_UPPER: setUpperAngLimit(p_value); break;
case PhysicsServer3D::SLIDER_JOINT_ANGULAR_LIMIT_LOWER: setLowerAngLimit(p_value); break;
case PhysicsServer3D::SLIDER_JOINT_ANGULAR_LIMIT_SOFTNESS: setSoftnessLimAng(p_value); break;
case PhysicsServer3D::SLIDER_JOINT_ANGULAR_LIMIT_RESTITUTION: setRestitutionLimAng(p_value); break;
case PhysicsServer3D::SLIDER_JOINT_ANGULAR_LIMIT_DAMPING: setDampingLimAng(p_value); break;
case PhysicsServer3D::SLIDER_JOINT_ANGULAR_MOTION_SOFTNESS: setSoftnessDirAng(p_value); break;
case PhysicsServer3D::SLIDER_JOINT_ANGULAR_MOTION_RESTITUTION: setRestitutionDirAng(p_value); break;
case PhysicsServer3D::SLIDER_JOINT_ANGULAR_MOTION_DAMPING: setDampingDirAng(p_value); break;
case PhysicsServer3D::SLIDER_JOINT_ANGULAR_ORTHOGONAL_SOFTNESS: setSoftnessOrthoAng(p_value); break;
case PhysicsServer3D::SLIDER_JOINT_ANGULAR_ORTHOGONAL_RESTITUTION: setRestitutionOrthoAng(p_value); break;
case PhysicsServer3D::SLIDER_JOINT_ANGULAR_ORTHOGONAL_DAMPING: setDampingOrthoAng(p_value); break;
case PhysicsServer3D::SLIDER_JOINT_MAX: break; // Can't happen, but silences warning
case PhysicsServer3D::SLIDER_JOINT_LINEAR_LIMIT_UPPER:
setUpperLinLimit(p_value);
break;
case PhysicsServer3D::SLIDER_JOINT_LINEAR_LIMIT_LOWER:
setLowerLinLimit(p_value);
break;
case PhysicsServer3D::SLIDER_JOINT_LINEAR_LIMIT_SOFTNESS:
setSoftnessLimLin(p_value);
break;
case PhysicsServer3D::SLIDER_JOINT_LINEAR_LIMIT_RESTITUTION:
setRestitutionLimLin(p_value);
break;
case PhysicsServer3D::SLIDER_JOINT_LINEAR_LIMIT_DAMPING:
setDampingLimLin(p_value);
break;
case PhysicsServer3D::SLIDER_JOINT_LINEAR_MOTION_SOFTNESS:
setSoftnessDirLin(p_value);
break;
case PhysicsServer3D::SLIDER_JOINT_LINEAR_MOTION_RESTITUTION:
setRestitutionDirLin(p_value);
break;
case PhysicsServer3D::SLIDER_JOINT_LINEAR_MOTION_DAMPING:
setDampingDirLin(p_value);
break;
case PhysicsServer3D::SLIDER_JOINT_LINEAR_ORTHOGONAL_SOFTNESS:
setSoftnessOrthoLin(p_value);
break;
case PhysicsServer3D::SLIDER_JOINT_LINEAR_ORTHOGONAL_RESTITUTION:
setRestitutionOrthoLin(p_value);
break;
case PhysicsServer3D::SLIDER_JOINT_LINEAR_ORTHOGONAL_DAMPING:
setDampingOrthoLin(p_value);
break;
case PhysicsServer3D::SLIDER_JOINT_ANGULAR_LIMIT_UPPER:
setUpperAngLimit(p_value);
break;
case PhysicsServer3D::SLIDER_JOINT_ANGULAR_LIMIT_LOWER:
setLowerAngLimit(p_value);
break;
case PhysicsServer3D::SLIDER_JOINT_ANGULAR_LIMIT_SOFTNESS:
setSoftnessLimAng(p_value);
break;
case PhysicsServer3D::SLIDER_JOINT_ANGULAR_LIMIT_RESTITUTION:
setRestitutionLimAng(p_value);
break;
case PhysicsServer3D::SLIDER_JOINT_ANGULAR_LIMIT_DAMPING:
setDampingLimAng(p_value);
break;
case PhysicsServer3D::SLIDER_JOINT_ANGULAR_MOTION_SOFTNESS:
setSoftnessDirAng(p_value);
break;
case PhysicsServer3D::SLIDER_JOINT_ANGULAR_MOTION_RESTITUTION:
setRestitutionDirAng(p_value);
break;
case PhysicsServer3D::SLIDER_JOINT_ANGULAR_MOTION_DAMPING:
setDampingDirAng(p_value);
break;
case PhysicsServer3D::SLIDER_JOINT_ANGULAR_ORTHOGONAL_SOFTNESS:
setSoftnessOrthoAng(p_value);
break;
case PhysicsServer3D::SLIDER_JOINT_ANGULAR_ORTHOGONAL_RESTITUTION:
setRestitutionOrthoAng(p_value);
break;
case PhysicsServer3D::SLIDER_JOINT_ANGULAR_ORTHOGONAL_DAMPING:
setDampingOrthoAng(p_value);
break;
case PhysicsServer3D::SLIDER_JOINT_MAX:
break; // Can't happen, but silences warning
}
}
real_t SliderJointBullet::get_param(PhysicsServer3D::SliderJointParam p_param) const {
switch (p_param) {
case PhysicsServer3D::SLIDER_JOINT_LINEAR_LIMIT_UPPER: return getUpperLinLimit();
case PhysicsServer3D::SLIDER_JOINT_LINEAR_LIMIT_LOWER: return getLowerLinLimit();
case PhysicsServer3D::SLIDER_JOINT_LINEAR_LIMIT_SOFTNESS: return getSoftnessLimLin();
case PhysicsServer3D::SLIDER_JOINT_LINEAR_LIMIT_RESTITUTION: return getRestitutionLimLin();
case PhysicsServer3D::SLIDER_JOINT_LINEAR_LIMIT_DAMPING: return getDampingLimLin();
case PhysicsServer3D::SLIDER_JOINT_LINEAR_MOTION_SOFTNESS: return getSoftnessDirLin();
case PhysicsServer3D::SLIDER_JOINT_LINEAR_MOTION_RESTITUTION: return getRestitutionDirLin();
case PhysicsServer3D::SLIDER_JOINT_LINEAR_MOTION_DAMPING: return getDampingDirLin();
case PhysicsServer3D::SLIDER_JOINT_LINEAR_ORTHOGONAL_SOFTNESS: return getSoftnessOrthoLin();
case PhysicsServer3D::SLIDER_JOINT_LINEAR_ORTHOGONAL_RESTITUTION: return getRestitutionOrthoLin();
case PhysicsServer3D::SLIDER_JOINT_LINEAR_ORTHOGONAL_DAMPING: return getDampingOrthoLin();
case PhysicsServer3D::SLIDER_JOINT_ANGULAR_LIMIT_UPPER: return getUpperAngLimit();
case PhysicsServer3D::SLIDER_JOINT_ANGULAR_LIMIT_LOWER: return getLowerAngLimit();
case PhysicsServer3D::SLIDER_JOINT_ANGULAR_LIMIT_SOFTNESS: return getSoftnessLimAng();
case PhysicsServer3D::SLIDER_JOINT_ANGULAR_LIMIT_RESTITUTION: return getRestitutionLimAng();
case PhysicsServer3D::SLIDER_JOINT_ANGULAR_LIMIT_DAMPING: return getDampingLimAng();
case PhysicsServer3D::SLIDER_JOINT_ANGULAR_MOTION_SOFTNESS: return getSoftnessDirAng();
case PhysicsServer3D::SLIDER_JOINT_ANGULAR_MOTION_RESTITUTION: return getRestitutionDirAng();
case PhysicsServer3D::SLIDER_JOINT_ANGULAR_MOTION_DAMPING: return getDampingDirAng();
case PhysicsServer3D::SLIDER_JOINT_ANGULAR_ORTHOGONAL_SOFTNESS: return getSoftnessOrthoAng();
case PhysicsServer3D::SLIDER_JOINT_ANGULAR_ORTHOGONAL_RESTITUTION: return getRestitutionOrthoAng();
case PhysicsServer3D::SLIDER_JOINT_ANGULAR_ORTHOGONAL_DAMPING: return getDampingOrthoAng();
case PhysicsServer3D::SLIDER_JOINT_LINEAR_LIMIT_UPPER:
return getUpperLinLimit();
case PhysicsServer3D::SLIDER_JOINT_LINEAR_LIMIT_LOWER:
return getLowerLinLimit();
case PhysicsServer3D::SLIDER_JOINT_LINEAR_LIMIT_SOFTNESS:
return getSoftnessLimLin();
case PhysicsServer3D::SLIDER_JOINT_LINEAR_LIMIT_RESTITUTION:
return getRestitutionLimLin();
case PhysicsServer3D::SLIDER_JOINT_LINEAR_LIMIT_DAMPING:
return getDampingLimLin();
case PhysicsServer3D::SLIDER_JOINT_LINEAR_MOTION_SOFTNESS:
return getSoftnessDirLin();
case PhysicsServer3D::SLIDER_JOINT_LINEAR_MOTION_RESTITUTION:
return getRestitutionDirLin();
case PhysicsServer3D::SLIDER_JOINT_LINEAR_MOTION_DAMPING:
return getDampingDirLin();
case PhysicsServer3D::SLIDER_JOINT_LINEAR_ORTHOGONAL_SOFTNESS:
return getSoftnessOrthoLin();
case PhysicsServer3D::SLIDER_JOINT_LINEAR_ORTHOGONAL_RESTITUTION:
return getRestitutionOrthoLin();
case PhysicsServer3D::SLIDER_JOINT_LINEAR_ORTHOGONAL_DAMPING:
return getDampingOrthoLin();
case PhysicsServer3D::SLIDER_JOINT_ANGULAR_LIMIT_UPPER:
return getUpperAngLimit();
case PhysicsServer3D::SLIDER_JOINT_ANGULAR_LIMIT_LOWER:
return getLowerAngLimit();
case PhysicsServer3D::SLIDER_JOINT_ANGULAR_LIMIT_SOFTNESS:
return getSoftnessLimAng();
case PhysicsServer3D::SLIDER_JOINT_ANGULAR_LIMIT_RESTITUTION:
return getRestitutionLimAng();
case PhysicsServer3D::SLIDER_JOINT_ANGULAR_LIMIT_DAMPING:
return getDampingLimAng();
case PhysicsServer3D::SLIDER_JOINT_ANGULAR_MOTION_SOFTNESS:
return getSoftnessDirAng();
case PhysicsServer3D::SLIDER_JOINT_ANGULAR_MOTION_RESTITUTION:
return getRestitutionDirAng();
case PhysicsServer3D::SLIDER_JOINT_ANGULAR_MOTION_DAMPING:
return getDampingDirAng();
case PhysicsServer3D::SLIDER_JOINT_ANGULAR_ORTHOGONAL_SOFTNESS:
return getSoftnessOrthoAng();
case PhysicsServer3D::SLIDER_JOINT_ANGULAR_ORTHOGONAL_RESTITUTION:
return getRestitutionOrthoAng();
case PhysicsServer3D::SLIDER_JOINT_ANGULAR_ORTHOGONAL_DAMPING:
return getDampingOrthoAng();
default:
return 0;
}

View File

@ -90,9 +90,12 @@ Variant CSGShape3DGizmoPlugin::get_handle_value(EditorNode3DGizmo *p_gizmo, int
CSGBox3D *s = Object::cast_to<CSGBox3D>(cs);
switch (p_idx) {
case 0: return s->get_width();
case 1: return s->get_height();
case 2: return s->get_depth();
case 0:
return s->get_width();
case 1:
return s->get_height();
case 2:
return s->get_depth();
}
}
@ -157,9 +160,15 @@ void CSGShape3DGizmoPlugin::set_handle(EditorNode3DGizmo *p_gizmo, int p_idx, Ca
d = 0.001;
switch (p_idx) {
case 0: s->set_width(d * 2); break;
case 1: s->set_height(d * 2); break;
case 2: s->set_depth(d * 2); break;
case 0:
s->set_width(d * 2);
break;
case 1:
s->set_height(d * 2);
break;
case 2:
s->set_depth(d * 2);
break;
}
}
@ -229,9 +238,15 @@ void CSGShape3DGizmoPlugin::commit_handle(EditorNode3DGizmo *p_gizmo, int p_idx,
CSGBox3D *s = Object::cast_to<CSGBox3D>(cs);
if (p_cancel) {
switch (p_idx) {
case 0: s->set_width(p_restore); break;
case 1: s->set_height(p_restore); break;
case 2: s->set_depth(p_restore); break;
case 0:
s->set_width(p_restore);
break;
case 1:
s->set_height(p_restore);
break;
case 2:
s->set_depth(p_restore);
break;
}
return;
}
@ -241,9 +256,15 @@ void CSGShape3DGizmoPlugin::commit_handle(EditorNode3DGizmo *p_gizmo, int p_idx,
static const char *method[3] = { "set_width", "set_height", "set_depth" };
float current = 0;
switch (p_idx) {
case 0: current = s->get_width(); break;
case 1: current = s->get_height(); break;
case 2: current = s->get_depth(); break;
case 0:
current = s->get_width();
break;
case 1:
current = s->get_height();
break;
case 2:
current = s->get_depth();
break;
}
ur->add_do_method(s, method[p_idx], current);

View File

@ -185,9 +185,15 @@ CSGBrush *CSGShape3D::_get_brush() {
CSGBrushOperation bop;
switch (child->get_operation()) {
case CSGShape3D::OPERATION_UNION: bop.merge_brushes(CSGBrushOperation::OPERATION_UNION, *n, *nn2, *nn, snap); break;
case CSGShape3D::OPERATION_INTERSECTION: bop.merge_brushes(CSGBrushOperation::OPERATION_INTERSECTION, *n, *nn2, *nn, snap); break;
case CSGShape3D::OPERATION_SUBTRACTION: bop.merge_brushes(CSGBrushOperation::OPERATION_SUBSTRACTION, *n, *nn2, *nn, snap); break;
case CSGShape3D::OPERATION_UNION:
bop.merge_brushes(CSGBrushOperation::OPERATION_UNION, *n, *nn2, *nn, snap);
break;
case CSGShape3D::OPERATION_INTERSECTION:
bop.merge_brushes(CSGBrushOperation::OPERATION_INTERSECTION, *n, *nn2, *nn, snap);
break;
case CSGShape3D::OPERATION_SUBTRACTION:
bop.merge_brushes(CSGBrushOperation::OPERATION_SUBSTRACTION, *n, *nn2, *nn, snap);
break;
}
memdelete(n);
memdelete(nn2);
@ -1830,8 +1836,12 @@ CSGBrush *CSGPolygon3D::_build_brush() {
int face_count = 0;
switch (mode) {
case MODE_DEPTH: face_count = triangles.size() * 2 / 3 + (final_polygon.size()) * 2; break;
case MODE_SPIN: face_count = (spin_degrees < 360 ? triangles.size() * 2 / 3 : 0) + (final_polygon.size()) * 2 * spin_sides; break;
case MODE_DEPTH:
face_count = triangles.size() * 2 / 3 + (final_polygon.size()) * 2;
break;
case MODE_SPIN:
face_count = (spin_degrees < 360 ? triangles.size() * 2 / 3 : 0) + (final_polygon.size()) * 2 * spin_sides;
break;
case MODE_PATH: {
float bl = curve->get_baked_length();
int splits = MAX(2, Math::ceil(bl / path_interval));

View File

@ -2184,7 +2184,8 @@ String GDScriptWarning::get_message() const {
case STANDALONE_TERNARY: {
return "Standalone ternary conditional operator: the return value is being discarded.";
}
case WARNING_MAX: break; // Can't happen, but silences warning
case WARNING_MAX:
break; // Can't happen, but silences warning
}
ERR_FAIL_V_MSG(String(), "Invalid GDScript warning code: " + get_name_from_code(code) + ".");

View File

@ -177,16 +177,36 @@ int GDScriptCompiler::_parse_assign_right_expression(CodeGen &codegen, const GDS
switch (p_expression->op) {
case GDScriptParser::OperatorNode::OP_ASSIGN_ADD: var_op = Variant::OP_ADD; break;
case GDScriptParser::OperatorNode::OP_ASSIGN_SUB: var_op = Variant::OP_SUBTRACT; break;
case GDScriptParser::OperatorNode::OP_ASSIGN_MUL: var_op = Variant::OP_MULTIPLY; break;
case GDScriptParser::OperatorNode::OP_ASSIGN_DIV: var_op = Variant::OP_DIVIDE; break;
case GDScriptParser::OperatorNode::OP_ASSIGN_MOD: var_op = Variant::OP_MODULE; break;
case GDScriptParser::OperatorNode::OP_ASSIGN_SHIFT_LEFT: var_op = Variant::OP_SHIFT_LEFT; break;
case GDScriptParser::OperatorNode::OP_ASSIGN_SHIFT_RIGHT: var_op = Variant::OP_SHIFT_RIGHT; break;
case GDScriptParser::OperatorNode::OP_ASSIGN_BIT_AND: var_op = Variant::OP_BIT_AND; break;
case GDScriptParser::OperatorNode::OP_ASSIGN_BIT_OR: var_op = Variant::OP_BIT_OR; break;
case GDScriptParser::OperatorNode::OP_ASSIGN_BIT_XOR: var_op = Variant::OP_BIT_XOR; break;
case GDScriptParser::OperatorNode::OP_ASSIGN_ADD:
var_op = Variant::OP_ADD;
break;
case GDScriptParser::OperatorNode::OP_ASSIGN_SUB:
var_op = Variant::OP_SUBTRACT;
break;
case GDScriptParser::OperatorNode::OP_ASSIGN_MUL:
var_op = Variant::OP_MULTIPLY;
break;
case GDScriptParser::OperatorNode::OP_ASSIGN_DIV:
var_op = Variant::OP_DIVIDE;
break;
case GDScriptParser::OperatorNode::OP_ASSIGN_MOD:
var_op = Variant::OP_MODULE;
break;
case GDScriptParser::OperatorNode::OP_ASSIGN_SHIFT_LEFT:
var_op = Variant::OP_SHIFT_LEFT;
break;
case GDScriptParser::OperatorNode::OP_ASSIGN_SHIFT_RIGHT:
var_op = Variant::OP_SHIFT_RIGHT;
break;
case GDScriptParser::OperatorNode::OP_ASSIGN_BIT_AND:
var_op = Variant::OP_BIT_AND;
break;
case GDScriptParser::OperatorNode::OP_ASSIGN_BIT_OR:
var_op = Variant::OP_BIT_OR;
break;
case GDScriptParser::OperatorNode::OP_ASSIGN_BIT_XOR:
var_op = Variant::OP_BIT_XOR;
break;
case GDScriptParser::OperatorNode::OP_INIT_ASSIGN:
case GDScriptParser::OperatorNode::OP_ASSIGN: {

View File

@ -1082,16 +1082,36 @@ static bool _guess_expression_type(GDScriptCompletionContext &p_context, const G
Variant::Operator vop = Variant::OP_MAX;
switch (op->op) {
case GDScriptParser::OperatorNode::OP_ADD: vop = Variant::OP_ADD; break;
case GDScriptParser::OperatorNode::OP_SUB: vop = Variant::OP_SUBTRACT; break;
case GDScriptParser::OperatorNode::OP_MUL: vop = Variant::OP_MULTIPLY; break;
case GDScriptParser::OperatorNode::OP_DIV: vop = Variant::OP_DIVIDE; break;
case GDScriptParser::OperatorNode::OP_MOD: vop = Variant::OP_MODULE; break;
case GDScriptParser::OperatorNode::OP_SHIFT_LEFT: vop = Variant::OP_SHIFT_LEFT; break;
case GDScriptParser::OperatorNode::OP_SHIFT_RIGHT: vop = Variant::OP_SHIFT_RIGHT; break;
case GDScriptParser::OperatorNode::OP_BIT_AND: vop = Variant::OP_BIT_AND; break;
case GDScriptParser::OperatorNode::OP_BIT_OR: vop = Variant::OP_BIT_OR; break;
case GDScriptParser::OperatorNode::OP_BIT_XOR: vop = Variant::OP_BIT_XOR; break;
case GDScriptParser::OperatorNode::OP_ADD:
vop = Variant::OP_ADD;
break;
case GDScriptParser::OperatorNode::OP_SUB:
vop = Variant::OP_SUBTRACT;
break;
case GDScriptParser::OperatorNode::OP_MUL:
vop = Variant::OP_MULTIPLY;
break;
case GDScriptParser::OperatorNode::OP_DIV:
vop = Variant::OP_DIVIDE;
break;
case GDScriptParser::OperatorNode::OP_MOD:
vop = Variant::OP_MODULE;
break;
case GDScriptParser::OperatorNode::OP_SHIFT_LEFT:
vop = Variant::OP_SHIFT_LEFT;
break;
case GDScriptParser::OperatorNode::OP_SHIFT_RIGHT:
vop = Variant::OP_SHIFT_RIGHT;
break;
case GDScriptParser::OperatorNode::OP_BIT_AND:
vop = Variant::OP_BIT_AND;
break;
case GDScriptParser::OperatorNode::OP_BIT_OR:
vop = Variant::OP_BIT_OR;
break;
case GDScriptParser::OperatorNode::OP_BIT_XOR:
vop = Variant::OP_BIT_XOR;
break;
default: {
}
}

View File

@ -920,10 +920,18 @@ GDScriptParser::Node *GDScriptParser::_parse_expression(Node *p_parent, bool p_s
e.is_op = true;
switch (tokenizer->get_token()) {
case GDScriptTokenizer::TK_OP_ADD: e.op = OperatorNode::OP_POS; break;
case GDScriptTokenizer::TK_OP_SUB: e.op = OperatorNode::OP_NEG; break;
case GDScriptTokenizer::TK_OP_NOT: e.op = OperatorNode::OP_NOT; break;
case GDScriptTokenizer::TK_OP_BIT_INVERT: e.op = OperatorNode::OP_BIT_INVERT; break;
case GDScriptTokenizer::TK_OP_ADD:
e.op = OperatorNode::OP_POS;
break;
case GDScriptTokenizer::TK_OP_SUB:
e.op = OperatorNode::OP_NEG;
break;
case GDScriptTokenizer::TK_OP_NOT:
e.op = OperatorNode::OP_NOT;
break;
case GDScriptTokenizer::TK_OP_BIT_INVERT:
e.op = OperatorNode::OP_BIT_INVERT;
break;
default: {
}
}
@ -1339,25 +1347,55 @@ GDScriptParser::Node *GDScriptParser::_parse_expression(Node *p_parent, bool p_s
switch (tokenizer->get_token()) { //see operator
case GDScriptTokenizer::TK_OP_IN: op = OperatorNode::OP_IN; break;
case GDScriptTokenizer::TK_OP_EQUAL: op = OperatorNode::OP_EQUAL; break;
case GDScriptTokenizer::TK_OP_NOT_EQUAL: op = OperatorNode::OP_NOT_EQUAL; break;
case GDScriptTokenizer::TK_OP_LESS: op = OperatorNode::OP_LESS; break;
case GDScriptTokenizer::TK_OP_LESS_EQUAL: op = OperatorNode::OP_LESS_EQUAL; break;
case GDScriptTokenizer::TK_OP_GREATER: op = OperatorNode::OP_GREATER; break;
case GDScriptTokenizer::TK_OP_GREATER_EQUAL: op = OperatorNode::OP_GREATER_EQUAL; break;
case GDScriptTokenizer::TK_OP_AND: op = OperatorNode::OP_AND; break;
case GDScriptTokenizer::TK_OP_OR: op = OperatorNode::OP_OR; break;
case GDScriptTokenizer::TK_OP_ADD: op = OperatorNode::OP_ADD; break;
case GDScriptTokenizer::TK_OP_SUB: op = OperatorNode::OP_SUB; break;
case GDScriptTokenizer::TK_OP_MUL: op = OperatorNode::OP_MUL; break;
case GDScriptTokenizer::TK_OP_DIV: op = OperatorNode::OP_DIV; break;
case GDScriptTokenizer::TK_OP_IN:
op = OperatorNode::OP_IN;
break;
case GDScriptTokenizer::TK_OP_EQUAL:
op = OperatorNode::OP_EQUAL;
break;
case GDScriptTokenizer::TK_OP_NOT_EQUAL:
op = OperatorNode::OP_NOT_EQUAL;
break;
case GDScriptTokenizer::TK_OP_LESS:
op = OperatorNode::OP_LESS;
break;
case GDScriptTokenizer::TK_OP_LESS_EQUAL:
op = OperatorNode::OP_LESS_EQUAL;
break;
case GDScriptTokenizer::TK_OP_GREATER:
op = OperatorNode::OP_GREATER;
break;
case GDScriptTokenizer::TK_OP_GREATER_EQUAL:
op = OperatorNode::OP_GREATER_EQUAL;
break;
case GDScriptTokenizer::TK_OP_AND:
op = OperatorNode::OP_AND;
break;
case GDScriptTokenizer::TK_OP_OR:
op = OperatorNode::OP_OR;
break;
case GDScriptTokenizer::TK_OP_ADD:
op = OperatorNode::OP_ADD;
break;
case GDScriptTokenizer::TK_OP_SUB:
op = OperatorNode::OP_SUB;
break;
case GDScriptTokenizer::TK_OP_MUL:
op = OperatorNode::OP_MUL;
break;
case GDScriptTokenizer::TK_OP_DIV:
op = OperatorNode::OP_DIV;
break;
case GDScriptTokenizer::TK_OP_MOD:
op = OperatorNode::OP_MOD;
break;
//case GDScriptTokenizer::TK_OP_NEG: op=OperatorNode::OP_NEG ; break;
case GDScriptTokenizer::TK_OP_SHIFT_LEFT: op = OperatorNode::OP_SHIFT_LEFT; break;
case GDScriptTokenizer::TK_OP_SHIFT_RIGHT: op = OperatorNode::OP_SHIFT_RIGHT; break;
case GDScriptTokenizer::TK_OP_SHIFT_LEFT:
op = OperatorNode::OP_SHIFT_LEFT;
break;
case GDScriptTokenizer::TK_OP_SHIFT_RIGHT:
op = OperatorNode::OP_SHIFT_RIGHT;
break;
case GDScriptTokenizer::TK_OP_ASSIGN: {
_VALIDATE_ASSIGN op = OperatorNode::OP_ASSIGN;
@ -1374,23 +1412,57 @@ GDScriptParser::Node *GDScriptParser::_parse_expression(Node *p_parent, bool p_s
}
} break;
case GDScriptTokenizer::TK_OP_ASSIGN_ADD: _VALIDATE_ASSIGN op = OperatorNode::OP_ASSIGN_ADD; break;
case GDScriptTokenizer::TK_OP_ASSIGN_SUB: _VALIDATE_ASSIGN op = OperatorNode::OP_ASSIGN_SUB; break;
case GDScriptTokenizer::TK_OP_ASSIGN_MUL: _VALIDATE_ASSIGN op = OperatorNode::OP_ASSIGN_MUL; break;
case GDScriptTokenizer::TK_OP_ASSIGN_DIV: _VALIDATE_ASSIGN op = OperatorNode::OP_ASSIGN_DIV; break;
case GDScriptTokenizer::TK_OP_ASSIGN_MOD: _VALIDATE_ASSIGN op = OperatorNode::OP_ASSIGN_MOD; break;
case GDScriptTokenizer::TK_OP_ASSIGN_SHIFT_LEFT: _VALIDATE_ASSIGN op = OperatorNode::OP_ASSIGN_SHIFT_LEFT; break;
case GDScriptTokenizer::TK_OP_ASSIGN_SHIFT_RIGHT: _VALIDATE_ASSIGN op = OperatorNode::OP_ASSIGN_SHIFT_RIGHT; break;
case GDScriptTokenizer::TK_OP_ASSIGN_BIT_AND: _VALIDATE_ASSIGN op = OperatorNode::OP_ASSIGN_BIT_AND; break;
case GDScriptTokenizer::TK_OP_ASSIGN_BIT_OR: _VALIDATE_ASSIGN op = OperatorNode::OP_ASSIGN_BIT_OR; break;
case GDScriptTokenizer::TK_OP_ASSIGN_BIT_XOR: _VALIDATE_ASSIGN op = OperatorNode::OP_ASSIGN_BIT_XOR; break;
case GDScriptTokenizer::TK_OP_BIT_AND: op = OperatorNode::OP_BIT_AND; break;
case GDScriptTokenizer::TK_OP_BIT_OR: op = OperatorNode::OP_BIT_OR; break;
case GDScriptTokenizer::TK_OP_BIT_XOR: op = OperatorNode::OP_BIT_XOR; break;
case GDScriptTokenizer::TK_PR_IS: op = OperatorNode::OP_IS; break;
case GDScriptTokenizer::TK_CF_IF: op = OperatorNode::OP_TERNARY_IF; break;
case GDScriptTokenizer::TK_CF_ELSE: op = OperatorNode::OP_TERNARY_ELSE; break;
default: valid = false; break;
case GDScriptTokenizer::TK_OP_ASSIGN_ADD:
_VALIDATE_ASSIGN op = OperatorNode::OP_ASSIGN_ADD;
break;
case GDScriptTokenizer::TK_OP_ASSIGN_SUB:
_VALIDATE_ASSIGN op = OperatorNode::OP_ASSIGN_SUB;
break;
case GDScriptTokenizer::TK_OP_ASSIGN_MUL:
_VALIDATE_ASSIGN op = OperatorNode::OP_ASSIGN_MUL;
break;
case GDScriptTokenizer::TK_OP_ASSIGN_DIV:
_VALIDATE_ASSIGN op = OperatorNode::OP_ASSIGN_DIV;
break;
case GDScriptTokenizer::TK_OP_ASSIGN_MOD:
_VALIDATE_ASSIGN op = OperatorNode::OP_ASSIGN_MOD;
break;
case GDScriptTokenizer::TK_OP_ASSIGN_SHIFT_LEFT:
_VALIDATE_ASSIGN op = OperatorNode::OP_ASSIGN_SHIFT_LEFT;
break;
case GDScriptTokenizer::TK_OP_ASSIGN_SHIFT_RIGHT:
_VALIDATE_ASSIGN op = OperatorNode::OP_ASSIGN_SHIFT_RIGHT;
break;
case GDScriptTokenizer::TK_OP_ASSIGN_BIT_AND:
_VALIDATE_ASSIGN op = OperatorNode::OP_ASSIGN_BIT_AND;
break;
case GDScriptTokenizer::TK_OP_ASSIGN_BIT_OR:
_VALIDATE_ASSIGN op = OperatorNode::OP_ASSIGN_BIT_OR;
break;
case GDScriptTokenizer::TK_OP_ASSIGN_BIT_XOR:
_VALIDATE_ASSIGN op = OperatorNode::OP_ASSIGN_BIT_XOR;
break;
case GDScriptTokenizer::TK_OP_BIT_AND:
op = OperatorNode::OP_BIT_AND;
break;
case GDScriptTokenizer::TK_OP_BIT_OR:
op = OperatorNode::OP_BIT_OR;
break;
case GDScriptTokenizer::TK_OP_BIT_XOR:
op = OperatorNode::OP_BIT_XOR;
break;
case GDScriptTokenizer::TK_PR_IS:
op = OperatorNode::OP_IS;
break;
case GDScriptTokenizer::TK_CF_IF:
op = OperatorNode::OP_TERNARY_IF;
break;
case GDScriptTokenizer::TK_CF_ELSE:
op = OperatorNode::OP_TERNARY_ELSE;
break;
default:
valid = false;
break;
}
if (valid) {
@ -1443,36 +1515,74 @@ GDScriptParser::Node *GDScriptParser::_parse_expression(Node *p_parent, bool p_s
unary = true;
break;
case OperatorNode::OP_MUL: priority = 2; break;
case OperatorNode::OP_DIV: priority = 2; break;
case OperatorNode::OP_MOD: priority = 2; break;
case OperatorNode::OP_MUL:
priority = 2;
break;
case OperatorNode::OP_DIV:
priority = 2;
break;
case OperatorNode::OP_MOD:
priority = 2;
break;
case OperatorNode::OP_ADD: priority = 3; break;
case OperatorNode::OP_SUB: priority = 3; break;
case OperatorNode::OP_ADD:
priority = 3;
break;
case OperatorNode::OP_SUB:
priority = 3;
break;
case OperatorNode::OP_SHIFT_LEFT: priority = 4; break;
case OperatorNode::OP_SHIFT_RIGHT: priority = 4; break;
case OperatorNode::OP_SHIFT_LEFT:
priority = 4;
break;
case OperatorNode::OP_SHIFT_RIGHT:
priority = 4;
break;
case OperatorNode::OP_BIT_AND: priority = 5; break;
case OperatorNode::OP_BIT_XOR: priority = 6; break;
case OperatorNode::OP_BIT_OR: priority = 7; break;
case OperatorNode::OP_BIT_AND:
priority = 5;
break;
case OperatorNode::OP_BIT_XOR:
priority = 6;
break;
case OperatorNode::OP_BIT_OR:
priority = 7;
break;
case OperatorNode::OP_LESS: priority = 8; break;
case OperatorNode::OP_LESS_EQUAL: priority = 8; break;
case OperatorNode::OP_GREATER: priority = 8; break;
case OperatorNode::OP_GREATER_EQUAL: priority = 8; break;
case OperatorNode::OP_LESS:
priority = 8;
break;
case OperatorNode::OP_LESS_EQUAL:
priority = 8;
break;
case OperatorNode::OP_GREATER:
priority = 8;
break;
case OperatorNode::OP_GREATER_EQUAL:
priority = 8;
break;
case OperatorNode::OP_EQUAL: priority = 8; break;
case OperatorNode::OP_NOT_EQUAL: priority = 8; break;
case OperatorNode::OP_EQUAL:
priority = 8;
break;
case OperatorNode::OP_NOT_EQUAL:
priority = 8;
break;
case OperatorNode::OP_IN: priority = 10; break;
case OperatorNode::OP_IN:
priority = 10;
break;
case OperatorNode::OP_NOT:
priority = 11;
unary = true;
break;
case OperatorNode::OP_AND: priority = 12; break;
case OperatorNode::OP_OR: priority = 13; break;
case OperatorNode::OP_AND:
priority = 12;
break;
case OperatorNode::OP_OR:
priority = 13;
break;
case OperatorNode::OP_TERNARY_IF:
priority = 14;
@ -1485,17 +1595,39 @@ GDScriptParser::Node *GDScriptParser::_parse_expression(Node *p_parent, bool p_s
// Rigth-to-left should be false in this case, otherwise it would always error.
break;
case OperatorNode::OP_ASSIGN: priority = 15; break;
case OperatorNode::OP_ASSIGN_ADD: priority = 15; break;
case OperatorNode::OP_ASSIGN_SUB: priority = 15; break;
case OperatorNode::OP_ASSIGN_MUL: priority = 15; break;
case OperatorNode::OP_ASSIGN_DIV: priority = 15; break;
case OperatorNode::OP_ASSIGN_MOD: priority = 15; break;
case OperatorNode::OP_ASSIGN_SHIFT_LEFT: priority = 15; break;
case OperatorNode::OP_ASSIGN_SHIFT_RIGHT: priority = 15; break;
case OperatorNode::OP_ASSIGN_BIT_AND: priority = 15; break;
case OperatorNode::OP_ASSIGN_BIT_OR: priority = 15; break;
case OperatorNode::OP_ASSIGN_BIT_XOR: priority = 15; break;
case OperatorNode::OP_ASSIGN:
priority = 15;
break;
case OperatorNode::OP_ASSIGN_ADD:
priority = 15;
break;
case OperatorNode::OP_ASSIGN_SUB:
priority = 15;
break;
case OperatorNode::OP_ASSIGN_MUL:
priority = 15;
break;
case OperatorNode::OP_ASSIGN_DIV:
priority = 15;
break;
case OperatorNode::OP_ASSIGN_MOD:
priority = 15;
break;
case OperatorNode::OP_ASSIGN_SHIFT_LEFT:
priority = 15;
break;
case OperatorNode::OP_ASSIGN_SHIFT_RIGHT:
priority = 15;
break;
case OperatorNode::OP_ASSIGN_BIT_AND:
priority = 15;
break;
case OperatorNode::OP_ASSIGN_BIT_OR:
priority = 15;
break;
case OperatorNode::OP_ASSIGN_BIT_XOR:
priority = 15;
break;
default: {
_set_error("GDScriptParser bug, invalid operator in expression: " + itos(expression[i].op));
@ -3184,9 +3316,15 @@ void GDScriptParser::_parse_block(BlockNode *p_block, bool p_static) {
ConstantNode *cn = alloc_node<ConstantNode>();
switch (args.size()) {
case 1: cn->value = (int64_t)constants[0]; break;
case 2: cn->value = Vector2i(constants[0], constants[1]); break;
case 3: cn->value = Vector3i(constants[0], constants[1], constants[2]); break;
case 1:
cn->value = (int64_t)constants[0];
break;
case 2:
cn->value = Vector2i(constants[0], constants[1]);
break;
case 3:
cn->value = Vector3i(constants[0], constants[1], constants[2]);
break;
}
cn->datatype = _type_from_variant(cn->value);
container = cn;
@ -3198,9 +3336,15 @@ void GDScriptParser::_parse_block(BlockNode *p_block, bool p_static) {
on->arguments.push_back(tn);
switch (args.size()) {
case 1: tn->vtype = Variant::INT; break;
case 2: tn->vtype = Variant::VECTOR2I; break;
case 3: tn->vtype = Variant::VECTOR3I; break;
case 1:
tn->vtype = Variant::INT;
break;
case 2:
tn->vtype = Variant::VECTOR2I;
break;
case 3:
tn->vtype = Variant::VECTOR3I;
break;
}
for (int i = 0; i < args.size(); i++) {

View File

@ -803,16 +803,36 @@ void GDScriptTokenizerText::_advance() {
switch (next) {
case 'a': res = '\a'; break;
case 'b': res = '\b'; break;
case 't': res = '\t'; break;
case 'n': res = '\n'; break;
case 'v': res = '\v'; break;
case 'f': res = '\f'; break;
case 'r': res = '\r'; break;
case '\'': res = '\''; break;
case '\"': res = '\"'; break;
case '\\': res = '\\'; break;
case 'a':
res = '\a';
break;
case 'b':
res = '\b';
break;
case 't':
res = '\t';
break;
case 'n':
res = '\n';
break;
case 'v':
res = '\v';
break;
case 'f':
res = '\f';
break;
case 'r':
res = '\r';
break;
case '\'':
res = '\'';
break;
case '\"':
res = '\"';
break;
case '\\':
res = '\\';
break;
case 'u': {
// hex number

View File

@ -181,14 +181,24 @@ ScriptClassParser::Token ScriptClassParser::get_token() {
CharType res = 0;
switch (next) {
case 'b': res = 8; break;
case 't': res = 9; break;
case 'n': res = 10; break;
case 'f': res = 12; break;
case 'b':
res = 8;
break;
case 't':
res = 9;
break;
case 'n':
res = 10;
break;
case 'f':
res = 12;
break;
case 'r':
res = 13;
break;
case '\"': res = '\"'; break;
case '\"':
res = '\"';
break;
case '\\':
res = '\\';
break;

View File

@ -501,7 +501,8 @@ void GDMonoField::set_value_from_variant(MonoObject *p_object, const Variant &p_
case Variant::PACKED_COLOR_ARRAY: {
SET_FROM_ARRAY(PackedColorArray);
} break;
default: break;
default:
break;
}
} break;

View File

@ -111,9 +111,13 @@ RES ResourceFormatPVR::load(const String &p_path, const String &p_original_path,
switch (flags & 0xFF) {
case 0x18:
case 0xC: format = (flags & PVR_HAS_ALPHA) ? Image::FORMAT_PVRTC2A : Image::FORMAT_PVRTC2; break;
case 0xC:
format = (flags & PVR_HAS_ALPHA) ? Image::FORMAT_PVRTC2A : Image::FORMAT_PVRTC2;
break;
case 0x19:
case 0xD: format = (flags & PVR_HAS_ALPHA) ? Image::FORMAT_PVRTC4A : Image::FORMAT_PVRTC4; break;
case 0xD:
format = (flags & PVR_HAS_ALPHA) ? Image::FORMAT_PVRTC4A : Image::FORMAT_PVRTC4;
break;
case 0x16:
format = Image::FORMAT_L8;
break;

View File

@ -342,84 +342,212 @@ static Color _color_from_type(Variant::Type p_type, bool dark_theme = true) {
Color color;
if (dark_theme)
switch (p_type) {
case Variant::NIL: color = Color(0.41, 0.93, 0.74); break;
case Variant::NIL:
color = Color(0.41, 0.93, 0.74);
break;
case Variant::BOOL: color = Color(0.55, 0.65, 0.94); break;
case Variant::INT: color = Color(0.49, 0.78, 0.94); break;
case Variant::FLOAT: color = Color(0.38, 0.85, 0.96); break;
case Variant::STRING: color = Color(0.42, 0.65, 0.93); break;
case Variant::BOOL:
color = Color(0.55, 0.65, 0.94);
break;
case Variant::INT:
color = Color(0.49, 0.78, 0.94);
break;
case Variant::FLOAT:
color = Color(0.38, 0.85, 0.96);
break;
case Variant::STRING:
color = Color(0.42, 0.65, 0.93);
break;
case Variant::VECTOR2: color = Color(0.74, 0.57, 0.95); break;
case Variant::VECTOR2I: color = Color(0.74, 0.57, 0.95); break;
case Variant::RECT2: color = Color(0.95, 0.57, 0.65); break;
case Variant::RECT2I: color = Color(0.95, 0.57, 0.65); break;
case Variant::VECTOR3: color = Color(0.84, 0.49, 0.93); break;
case Variant::VECTOR3I: color = Color(0.84, 0.49, 0.93); break;
case Variant::TRANSFORM2D: color = Color(0.77, 0.93, 0.41); break;
case Variant::PLANE: color = Color(0.97, 0.44, 0.44); break;
case Variant::QUAT: color = Color(0.93, 0.41, 0.64); break;
case Variant::AABB: color = Color(0.93, 0.47, 0.57); break;
case Variant::BASIS: color = Color(0.89, 0.93, 0.41); break;
case Variant::TRANSFORM: color = Color(0.96, 0.66, 0.43); break;
case Variant::VECTOR2:
color = Color(0.74, 0.57, 0.95);
break;
case Variant::VECTOR2I:
color = Color(0.74, 0.57, 0.95);
break;
case Variant::RECT2:
color = Color(0.95, 0.57, 0.65);
break;
case Variant::RECT2I:
color = Color(0.95, 0.57, 0.65);
break;
case Variant::VECTOR3:
color = Color(0.84, 0.49, 0.93);
break;
case Variant::VECTOR3I:
color = Color(0.84, 0.49, 0.93);
break;
case Variant::TRANSFORM2D:
color = Color(0.77, 0.93, 0.41);
break;
case Variant::PLANE:
color = Color(0.97, 0.44, 0.44);
break;
case Variant::QUAT:
color = Color(0.93, 0.41, 0.64);
break;
case Variant::AABB:
color = Color(0.93, 0.47, 0.57);
break;
case Variant::BASIS:
color = Color(0.89, 0.93, 0.41);
break;
case Variant::TRANSFORM:
color = Color(0.96, 0.66, 0.43);
break;
case Variant::COLOR: color = Color(0.62, 1.0, 0.44); break;
case Variant::NODE_PATH: color = Color(0.41, 0.58, 0.93); break;
case Variant::_RID: color = Color(0.41, 0.93, 0.6); break;
case Variant::OBJECT: color = Color(0.47, 0.95, 0.91); break;
case Variant::DICTIONARY: color = Color(0.47, 0.93, 0.69); break;
case Variant::COLOR:
color = Color(0.62, 1.0, 0.44);
break;
case Variant::NODE_PATH:
color = Color(0.41, 0.58, 0.93);
break;
case Variant::_RID:
color = Color(0.41, 0.93, 0.6);
break;
case Variant::OBJECT:
color = Color(0.47, 0.95, 0.91);
break;
case Variant::DICTIONARY:
color = Color(0.47, 0.93, 0.69);
break;
case Variant::ARRAY: color = Color(0.88, 0.88, 0.88); break;
case Variant::PACKED_BYTE_ARRAY: color = Color(0.67, 0.96, 0.78); break;
case Variant::PACKED_INT32_ARRAY: color = Color(0.69, 0.86, 0.96); break;
case Variant::PACKED_FLOAT32_ARRAY: color = Color(0.59, 0.91, 0.97); break;
case Variant::PACKED_INT64_ARRAY: color = Color(0.69, 0.86, 0.96); break;
case Variant::PACKED_FLOAT64_ARRAY: color = Color(0.59, 0.91, 0.97); break;
case Variant::PACKED_STRING_ARRAY: color = Color(0.62, 0.77, 0.95); break;
case Variant::PACKED_VECTOR2_ARRAY: color = Color(0.82, 0.7, 0.96); break;
case Variant::PACKED_VECTOR3_ARRAY: color = Color(0.87, 0.61, 0.95); break;
case Variant::PACKED_COLOR_ARRAY: color = Color(0.91, 1.0, 0.59); break;
case Variant::ARRAY:
color = Color(0.88, 0.88, 0.88);
break;
case Variant::PACKED_BYTE_ARRAY:
color = Color(0.67, 0.96, 0.78);
break;
case Variant::PACKED_INT32_ARRAY:
color = Color(0.69, 0.86, 0.96);
break;
case Variant::PACKED_FLOAT32_ARRAY:
color = Color(0.59, 0.91, 0.97);
break;
case Variant::PACKED_INT64_ARRAY:
color = Color(0.69, 0.86, 0.96);
break;
case Variant::PACKED_FLOAT64_ARRAY:
color = Color(0.59, 0.91, 0.97);
break;
case Variant::PACKED_STRING_ARRAY:
color = Color(0.62, 0.77, 0.95);
break;
case Variant::PACKED_VECTOR2_ARRAY:
color = Color(0.82, 0.7, 0.96);
break;
case Variant::PACKED_VECTOR3_ARRAY:
color = Color(0.87, 0.61, 0.95);
break;
case Variant::PACKED_COLOR_ARRAY:
color = Color(0.91, 1.0, 0.59);
break;
default:
color.set_hsv(p_type / float(Variant::VARIANT_MAX), 0.7, 0.7);
}
else
switch (p_type) {
case Variant::NIL: color = Color(0.15, 0.89, 0.63); break;
case Variant::NIL:
color = Color(0.15, 0.89, 0.63);
break;
case Variant::BOOL: color = Color(0.43, 0.56, 0.92); break;
case Variant::INT: color = Color(0.31, 0.7, 0.91); break;
case Variant::FLOAT: color = Color(0.15, 0.8, 0.94); break;
case Variant::STRING: color = Color(0.27, 0.56, 0.91); break;
case Variant::BOOL:
color = Color(0.43, 0.56, 0.92);
break;
case Variant::INT:
color = Color(0.31, 0.7, 0.91);
break;
case Variant::FLOAT:
color = Color(0.15, 0.8, 0.94);
break;
case Variant::STRING:
color = Color(0.27, 0.56, 0.91);
break;
case Variant::VECTOR2: color = Color(0.68, 0.46, 0.93); break;
case Variant::VECTOR2I: color = Color(0.68, 0.46, 0.93); break;
case Variant::RECT2: color = Color(0.93, 0.46, 0.56); break;
case Variant::RECT2I: color = Color(0.93, 0.46, 0.56); break;
case Variant::VECTOR3: color = Color(0.86, 0.42, 0.93); break;
case Variant::VECTOR3I: color = Color(0.86, 0.42, 0.93); break;
case Variant::TRANSFORM2D: color = Color(0.59, 0.81, 0.1); break;
case Variant::PLANE: color = Color(0.97, 0.44, 0.44); break;
case Variant::QUAT: color = Color(0.93, 0.41, 0.64); break;
case Variant::AABB: color = Color(0.93, 0.47, 0.57); break;
case Variant::BASIS: color = Color(0.7, 0.73, 0.1); break;
case Variant::TRANSFORM: color = Color(0.96, 0.56, 0.28); break;
case Variant::VECTOR2:
color = Color(0.68, 0.46, 0.93);
break;
case Variant::VECTOR2I:
color = Color(0.68, 0.46, 0.93);
break;
case Variant::RECT2:
color = Color(0.93, 0.46, 0.56);
break;
case Variant::RECT2I:
color = Color(0.93, 0.46, 0.56);
break;
case Variant::VECTOR3:
color = Color(0.86, 0.42, 0.93);
break;
case Variant::VECTOR3I:
color = Color(0.86, 0.42, 0.93);
break;
case Variant::TRANSFORM2D:
color = Color(0.59, 0.81, 0.1);
break;
case Variant::PLANE:
color = Color(0.97, 0.44, 0.44);
break;
case Variant::QUAT:
color = Color(0.93, 0.41, 0.64);
break;
case Variant::AABB:
color = Color(0.93, 0.47, 0.57);
break;
case Variant::BASIS:
color = Color(0.7, 0.73, 0.1);
break;
case Variant::TRANSFORM:
color = Color(0.96, 0.56, 0.28);
break;
case Variant::COLOR: color = Color(0.24, 0.75, 0.0); break;
case Variant::NODE_PATH: color = Color(0.41, 0.58, 0.93); break;
case Variant::_RID: color = Color(0.17, 0.9, 0.45); break;
case Variant::OBJECT: color = Color(0.07, 0.84, 0.76); break;
case Variant::DICTIONARY: color = Color(0.34, 0.91, 0.62); break;
case Variant::COLOR:
color = Color(0.24, 0.75, 0.0);
break;
case Variant::NODE_PATH:
color = Color(0.41, 0.58, 0.93);
break;
case Variant::_RID:
color = Color(0.17, 0.9, 0.45);
break;
case Variant::OBJECT:
color = Color(0.07, 0.84, 0.76);
break;
case Variant::DICTIONARY:
color = Color(0.34, 0.91, 0.62);
break;
case Variant::ARRAY: color = Color(0.45, 0.45, 0.45); break;
case Variant::PACKED_BYTE_ARRAY: color = Color(0.38, 0.92, 0.6); break;
case Variant::PACKED_INT32_ARRAY: color = Color(0.38, 0.73, 0.92); break;
case Variant::PACKED_FLOAT32_ARRAY: color = Color(0.25, 0.83, 0.95); break;
case Variant::PACKED_INT64_ARRAY: color = Color(0.38, 0.73, 0.92); break;
case Variant::PACKED_FLOAT64_ARRAY: color = Color(0.25, 0.83, 0.95); break;
case Variant::PACKED_STRING_ARRAY: color = Color(0.38, 0.62, 0.92); break;
case Variant::PACKED_VECTOR2_ARRAY: color = Color(0.62, 0.36, 0.92); break;
case Variant::PACKED_VECTOR3_ARRAY: color = Color(0.79, 0.35, 0.92); break;
case Variant::PACKED_COLOR_ARRAY: color = Color(0.57, 0.73, 0.0); break;
case Variant::ARRAY:
color = Color(0.45, 0.45, 0.45);
break;
case Variant::PACKED_BYTE_ARRAY:
color = Color(0.38, 0.92, 0.6);
break;
case Variant::PACKED_INT32_ARRAY:
color = Color(0.38, 0.73, 0.92);
break;
case Variant::PACKED_FLOAT32_ARRAY:
color = Color(0.25, 0.83, 0.95);
break;
case Variant::PACKED_INT64_ARRAY:
color = Color(0.38, 0.73, 0.92);
break;
case Variant::PACKED_FLOAT64_ARRAY:
color = Color(0.25, 0.83, 0.95);
break;
case Variant::PACKED_STRING_ARRAY:
color = Color(0.38, 0.62, 0.92);
break;
case Variant::PACKED_VECTOR2_ARRAY:
color = Color(0.62, 0.36, 0.92);
break;
case Variant::PACKED_VECTOR3_ARRAY:
color = Color(0.79, 0.35, 0.92);
break;
case Variant::PACKED_COLOR_ARRAY:
color = Color(0.57, 0.73, 0.0);
break;
default:
color.set_hsv(p_type / float(Variant::VARIANT_MAX), 0.3, 0.3);

View File

@ -386,11 +386,21 @@ Error VisualScriptExpression::_get_token(Token &r_token) {
switch (next) {
case 'b': res = 8; break;
case 't': res = 9; break;
case 'n': res = 10; break;
case 'f': res = 12; break;
case 'r': res = 13; break;
case 'b':
res = 8;
break;
case 't':
res = 9;
break;
case 'n':
res = 10;
break;
case 'f':
res = 12;
break;
case 'r':
res = 13;
break;
case 'u': {
// hex number
for (int j = 0; j < 4; j++) {
@ -1005,27 +1015,69 @@ VisualScriptExpression::ENode *VisualScriptExpression::_parse_expression() {
Variant::Operator op = Variant::OP_MAX;
switch (tk.type) {
case TK_OP_IN: op = Variant::OP_IN; break;
case TK_OP_EQUAL: op = Variant::OP_EQUAL; break;
case TK_OP_NOT_EQUAL: op = Variant::OP_NOT_EQUAL; break;
case TK_OP_LESS: op = Variant::OP_LESS; break;
case TK_OP_LESS_EQUAL: op = Variant::OP_LESS_EQUAL; break;
case TK_OP_GREATER: op = Variant::OP_GREATER; break;
case TK_OP_GREATER_EQUAL: op = Variant::OP_GREATER_EQUAL; break;
case TK_OP_AND: op = Variant::OP_AND; break;
case TK_OP_OR: op = Variant::OP_OR; break;
case TK_OP_NOT: op = Variant::OP_NOT; break;
case TK_OP_ADD: op = Variant::OP_ADD; break;
case TK_OP_SUB: op = Variant::OP_SUBTRACT; break;
case TK_OP_MUL: op = Variant::OP_MULTIPLY; break;
case TK_OP_DIV: op = Variant::OP_DIVIDE; break;
case TK_OP_MOD: op = Variant::OP_MODULE; break;
case TK_OP_SHIFT_LEFT: op = Variant::OP_SHIFT_LEFT; break;
case TK_OP_SHIFT_RIGHT: op = Variant::OP_SHIFT_RIGHT; break;
case TK_OP_BIT_AND: op = Variant::OP_BIT_AND; break;
case TK_OP_BIT_OR: op = Variant::OP_BIT_OR; break;
case TK_OP_BIT_XOR: op = Variant::OP_BIT_XOR; break;
case TK_OP_BIT_INVERT: op = Variant::OP_BIT_NEGATE; break;
case TK_OP_IN:
op = Variant::OP_IN;
break;
case TK_OP_EQUAL:
op = Variant::OP_EQUAL;
break;
case TK_OP_NOT_EQUAL:
op = Variant::OP_NOT_EQUAL;
break;
case TK_OP_LESS:
op = Variant::OP_LESS;
break;
case TK_OP_LESS_EQUAL:
op = Variant::OP_LESS_EQUAL;
break;
case TK_OP_GREATER:
op = Variant::OP_GREATER;
break;
case TK_OP_GREATER_EQUAL:
op = Variant::OP_GREATER_EQUAL;
break;
case TK_OP_AND:
op = Variant::OP_AND;
break;
case TK_OP_OR:
op = Variant::OP_OR;
break;
case TK_OP_NOT:
op = Variant::OP_NOT;
break;
case TK_OP_ADD:
op = Variant::OP_ADD;
break;
case TK_OP_SUB:
op = Variant::OP_SUBTRACT;
break;
case TK_OP_MUL:
op = Variant::OP_MULTIPLY;
break;
case TK_OP_DIV:
op = Variant::OP_DIVIDE;
break;
case TK_OP_MOD:
op = Variant::OP_MODULE;
break;
case TK_OP_SHIFT_LEFT:
op = Variant::OP_SHIFT_LEFT;
break;
case TK_OP_SHIFT_RIGHT:
op = Variant::OP_SHIFT_RIGHT;
break;
case TK_OP_BIT_AND:
op = Variant::OP_BIT_AND;
break;
case TK_OP_BIT_OR:
op = Variant::OP_BIT_OR;
break;
case TK_OP_BIT_XOR:
op = Variant::OP_BIT_XOR;
break;
case TK_OP_BIT_INVERT:
op = Variant::OP_BIT_NEGATE;
break;
default: {
};
}
@ -1074,36 +1126,74 @@ VisualScriptExpression::ENode *VisualScriptExpression::_parse_expression() {
unary = true;
break;
case Variant::OP_MULTIPLY: priority = 2; break;
case Variant::OP_DIVIDE: priority = 2; break;
case Variant::OP_MODULE: priority = 2; break;
case Variant::OP_MULTIPLY:
priority = 2;
break;
case Variant::OP_DIVIDE:
priority = 2;
break;
case Variant::OP_MODULE:
priority = 2;
break;
case Variant::OP_ADD: priority = 3; break;
case Variant::OP_SUBTRACT: priority = 3; break;
case Variant::OP_ADD:
priority = 3;
break;
case Variant::OP_SUBTRACT:
priority = 3;
break;
case Variant::OP_SHIFT_LEFT: priority = 4; break;
case Variant::OP_SHIFT_RIGHT: priority = 4; break;
case Variant::OP_SHIFT_LEFT:
priority = 4;
break;
case Variant::OP_SHIFT_RIGHT:
priority = 4;
break;
case Variant::OP_BIT_AND: priority = 5; break;
case Variant::OP_BIT_XOR: priority = 6; break;
case Variant::OP_BIT_OR: priority = 7; break;
case Variant::OP_BIT_AND:
priority = 5;
break;
case Variant::OP_BIT_XOR:
priority = 6;
break;
case Variant::OP_BIT_OR:
priority = 7;
break;
case Variant::OP_LESS: priority = 8; break;
case Variant::OP_LESS_EQUAL: priority = 8; break;
case Variant::OP_GREATER: priority = 8; break;
case Variant::OP_GREATER_EQUAL: priority = 8; break;
case Variant::OP_LESS:
priority = 8;
break;
case Variant::OP_LESS_EQUAL:
priority = 8;
break;
case Variant::OP_GREATER:
priority = 8;
break;
case Variant::OP_GREATER_EQUAL:
priority = 8;
break;
case Variant::OP_EQUAL: priority = 8; break;
case Variant::OP_NOT_EQUAL: priority = 8; break;
case Variant::OP_EQUAL:
priority = 8;
break;
case Variant::OP_NOT_EQUAL:
priority = 8;
break;
case Variant::OP_IN: priority = 10; break;
case Variant::OP_IN:
priority = 10;
break;
case Variant::OP_NOT:
priority = 11;
unary = true;
break;
case Variant::OP_AND: priority = 12; break;
case Variant::OP_OR: priority = 13; break;
case Variant::OP_AND:
priority = 12;
break;
case Variant::OP_OR:
priority = 13;
break;
default: {
_set_error("Parser bug, invalid operator in expression: " + itos(expression[i].op));

View File

@ -81,10 +81,18 @@ String VisualScriptYield::get_caption() const {
String VisualScriptYield::get_text() const {
switch (yield_mode) {
case YIELD_RETURN: return ""; break;
case YIELD_FRAME: return "Next Frame"; break;
case YIELD_PHYSICS_FRAME: return "Next Physics Frame"; break;
case YIELD_WAIT: return rtos(wait_time) + " sec(s)"; break;
case YIELD_RETURN:
return "";
break;
case YIELD_FRAME:
return "Next Frame";
break;
case YIELD_PHYSICS_FRAME:
return "Next Physics Frame";
break;
case YIELD_WAIT:
return rtos(wait_time) + " sec(s)";
break;
}
return String();
@ -122,9 +130,15 @@ public:
case VisualScriptYield::YIELD_RETURN:
ret = STEP_EXIT_FUNCTION_BIT;
break; //return the yield
case VisualScriptYield::YIELD_FRAME: state->connect_to_signal(tree, "idle_frame", Array()); break;
case VisualScriptYield::YIELD_PHYSICS_FRAME: state->connect_to_signal(tree, "physics_frame", Array()); break;
case VisualScriptYield::YIELD_WAIT: state->connect_to_signal(tree->create_timer(wait_time).ptr(), "timeout", Array()); break;
case VisualScriptYield::YIELD_FRAME:
state->connect_to_signal(tree, "idle_frame", Array());
break;
case VisualScriptYield::YIELD_PHYSICS_FRAME:
state->connect_to_signal(tree, "physics_frame", Array());
break;
case VisualScriptYield::YIELD_WAIT:
state->connect_to_signal(tree->create_timer(wait_time).ptr(), "timeout", Array());
break;
}
*p_working_mem = state;

View File

@ -83,9 +83,13 @@ class JavaClass : public Reference {
switch (p_sig) {
case ARG_TYPE_VOID: r_type = Variant::NIL; break;
case ARG_TYPE_VOID:
r_type = Variant::NIL;
break;
case ARG_TYPE_BOOLEAN | ARG_NUMBER_CLASS_BIT:
case ARG_TYPE_BOOLEAN: r_type = Variant::BOOL; break;
case ARG_TYPE_BOOLEAN:
r_type = Variant::BOOL;
break;
case ARG_TYPE_BYTE | ARG_NUMBER_CLASS_BIT:
case ARG_TYPE_BYTE:
r_type = Variant::INT;
@ -121,10 +125,18 @@ class JavaClass : public Reference {
r_type = Variant::FLOAT;
likelihood = 0.5;
break;
case ARG_TYPE_STRING: r_type = Variant::STRING; break;
case ARG_TYPE_CLASS: r_type = Variant::OBJECT; break;
case ARG_ARRAY_BIT | ARG_TYPE_VOID: r_type = Variant::NIL; break;
case ARG_ARRAY_BIT | ARG_TYPE_BOOLEAN: r_type = Variant::ARRAY; break;
case ARG_TYPE_STRING:
r_type = Variant::STRING;
break;
case ARG_TYPE_CLASS:
r_type = Variant::OBJECT;
break;
case ARG_ARRAY_BIT | ARG_TYPE_VOID:
r_type = Variant::NIL;
break;
case ARG_ARRAY_BIT | ARG_TYPE_BOOLEAN:
r_type = Variant::ARRAY;
break;
case ARG_ARRAY_BIT | ARG_TYPE_BYTE:
r_type = Variant::PACKED_BYTE_ARRAY;
likelihood = 1.0;
@ -153,8 +165,12 @@ class JavaClass : public Reference {
r_type = Variant::PACKED_FLOAT32_ARRAY;
likelihood = 0.5;
break;
case ARG_ARRAY_BIT | ARG_TYPE_STRING: r_type = Variant::PACKED_STRING_ARRAY; break;
case ARG_ARRAY_BIT | ARG_TYPE_CLASS: r_type = Variant::ARRAY; break;
case ARG_ARRAY_BIT | ARG_TYPE_STRING:
r_type = Variant::PACKED_STRING_ARRAY;
break;
case ARG_ARRAY_BIT | ARG_TYPE_CLASS:
r_type = Variant::ARRAY;
break;
}
}

View File

@ -237,9 +237,12 @@ int dom2godot_keycode(int dom_keycode) {
switch (dom_keycode) {
//case DOM_VK_CANCEL: return KEY_UNKNOWN;
case DOM_VK_HELP: return KEY_HELP;
case DOM_VK_BACK_SPACE: return KEY_BACKSPACE;
case DOM_VK_TAB: return KEY_TAB;
case DOM_VK_HELP:
return KEY_HELP;
case DOM_VK_BACK_SPACE:
return KEY_BACKSPACE;
case DOM_VK_TAB:
return KEY_TAB;
case DOM_VK_CLEAR:
case DOM_VK_WIN_OEM_CLEAR: // OEM duplicate
@ -249,14 +252,17 @@ int dom2godot_keycode(int dom_keycode) {
case DOM_VK_ENTER: // unused according to MDN
return KEY_ENTER;
case DOM_VK_SHIFT: return KEY_SHIFT;
case DOM_VK_CONTROL: return KEY_CONTROL;
case DOM_VK_SHIFT:
return KEY_SHIFT;
case DOM_VK_CONTROL:
return KEY_CONTROL;
case DOM_VK_ALT:
case DOM_VK_ALTGR:
return KEY_ALT;
case DOM_VK_PAUSE: return KEY_PAUSE;
case DOM_VK_PAUSE:
return KEY_PAUSE;
case DOM_VK_CAPS_LOCK:
return KEY_CAPSLOCK;
@ -279,14 +285,22 @@ int dom2godot_keycode(int dom_keycode) {
case DOM_VK_MODECHANGE: return KEY_UNKNOWN;
*/
case DOM_VK_SPACE: return KEY_SPACE;
case DOM_VK_PAGE_UP: return KEY_PAGEUP;
case DOM_VK_PAGE_DOWN: return KEY_PAGEDOWN;
case DOM_VK_END: return KEY_END;
case DOM_VK_HOME: return KEY_HOME;
case DOM_VK_LEFT: return KEY_LEFT;
case DOM_VK_UP: return KEY_UP;
case DOM_VK_RIGHT: return KEY_RIGHT;
case DOM_VK_SPACE:
return KEY_SPACE;
case DOM_VK_PAGE_UP:
return KEY_PAGEUP;
case DOM_VK_PAGE_DOWN:
return KEY_PAGEDOWN;
case DOM_VK_END:
return KEY_END;
case DOM_VK_HOME:
return KEY_HOME;
case DOM_VK_LEFT:
return KEY_LEFT;
case DOM_VK_UP:
return KEY_UP;
case DOM_VK_RIGHT:
return KEY_RIGHT;
case DOM_VK_DOWN:
return KEY_DOWN;
@ -297,24 +311,31 @@ int dom2godot_keycode(int dom_keycode) {
return KEY_PRINT;
//case DOM_VK_EXECUTE: return KEY_UNKNOWN;
case DOM_VK_INSERT: return KEY_INSERT;
case DOM_VK_DELETE: return KEY_DELETE;
case DOM_VK_INSERT:
return KEY_INSERT;
case DOM_VK_DELETE:
return KEY_DELETE;
case DOM_VK_META:
case DOM_VK_WIN:
return KEY_META;
case DOM_VK_CONTEXT_MENU: return KEY_MENU;
case DOM_VK_CONTEXT_MENU:
return KEY_MENU;
case DOM_VK_SLEEP:
return KEY_STANDBY;
// Numpad keys
case DOM_VK_MULTIPLY: return KEY_KP_MULTIPLY;
case DOM_VK_ADD: return KEY_KP_ADD;
case DOM_VK_MULTIPLY:
return KEY_KP_MULTIPLY;
case DOM_VK_ADD:
return KEY_KP_ADD;
case DOM_VK_SEPARATOR:
return KEY_KP_PERIOD; // Good enough?
case DOM_VK_SUBTRACT: return KEY_KP_SUBTRACT;
case DOM_VK_DECIMAL: return KEY_KP_PERIOD;
case DOM_VK_SUBTRACT:
return KEY_KP_SUBTRACT;
case DOM_VK_DECIMAL:
return KEY_KP_PERIOD;
case DOM_VK_DIVIDE:
return KEY_KP_DIVIDE;
@ -329,7 +350,8 @@ int dom2godot_keycode(int dom_keycode) {
case DOM_VK_F24: return KEY_UNKNOWN;
*/
case DOM_VK_NUM_LOCK: return KEY_NUMLOCK;
case DOM_VK_NUM_LOCK:
return KEY_NUMLOCK;
case DOM_VK_SCROLL_LOCK:
return KEY_SCROLLLOCK;
@ -341,40 +363,68 @@ int dom2godot_keycode(int dom_keycode) {
case DOM_VK_WIN_OEM_FJ_ROYA: return KEY_UNKNOWN;
*/
case DOM_VK_CIRCUMFLEX: return KEY_ASCIICIRCUM;
case DOM_VK_EXCLAMATION: return KEY_EXCLAM;
case DOM_VK_DOUBLE_QUOTE: return KEY_QUOTEDBL;
case DOM_VK_HASH: return KEY_NUMBERSIGN;
case DOM_VK_DOLLAR: return KEY_DOLLAR;
case DOM_VK_PERCENT: return KEY_PERCENT;
case DOM_VK_AMPERSAND: return KEY_AMPERSAND;
case DOM_VK_UNDERSCORE: return KEY_UNDERSCORE;
case DOM_VK_OPEN_PAREN: return KEY_PARENLEFT;
case DOM_VK_CLOSE_PAREN: return KEY_PARENRIGHT;
case DOM_VK_ASTERISK: return KEY_ASTERISK;
case DOM_VK_PLUS: return KEY_PLUS;
case DOM_VK_PIPE: return KEY_BAR;
case DOM_VK_HYPHEN_MINUS: return KEY_MINUS;
case DOM_VK_OPEN_CURLY_BRACKET: return KEY_BRACELEFT;
case DOM_VK_CLOSE_CURLY_BRACKET: return KEY_BRACERIGHT;
case DOM_VK_TILDE: return KEY_ASCIITILDE;
case DOM_VK_CIRCUMFLEX:
return KEY_ASCIICIRCUM;
case DOM_VK_EXCLAMATION:
return KEY_EXCLAM;
case DOM_VK_DOUBLE_QUOTE:
return KEY_QUOTEDBL;
case DOM_VK_HASH:
return KEY_NUMBERSIGN;
case DOM_VK_DOLLAR:
return KEY_DOLLAR;
case DOM_VK_PERCENT:
return KEY_PERCENT;
case DOM_VK_AMPERSAND:
return KEY_AMPERSAND;
case DOM_VK_UNDERSCORE:
return KEY_UNDERSCORE;
case DOM_VK_OPEN_PAREN:
return KEY_PARENLEFT;
case DOM_VK_CLOSE_PAREN:
return KEY_PARENRIGHT;
case DOM_VK_ASTERISK:
return KEY_ASTERISK;
case DOM_VK_PLUS:
return KEY_PLUS;
case DOM_VK_PIPE:
return KEY_BAR;
case DOM_VK_HYPHEN_MINUS:
return KEY_MINUS;
case DOM_VK_OPEN_CURLY_BRACKET:
return KEY_BRACELEFT;
case DOM_VK_CLOSE_CURLY_BRACKET:
return KEY_BRACERIGHT;
case DOM_VK_TILDE:
return KEY_ASCIITILDE;
case DOM_VK_VOLUME_MUTE: return KEY_VOLUMEMUTE;
case DOM_VK_VOLUME_DOWN: return KEY_VOLUMEDOWN;
case DOM_VK_VOLUME_UP: return KEY_VOLUMEUP;
case DOM_VK_VOLUME_MUTE:
return KEY_VOLUMEMUTE;
case DOM_VK_VOLUME_DOWN:
return KEY_VOLUMEDOWN;
case DOM_VK_VOLUME_UP:
return KEY_VOLUMEUP;
case DOM_VK_COMMA: return KEY_COMMA;
case DOM_VK_PERIOD: return KEY_PERIOD;
case DOM_VK_SLASH: return KEY_SLASH;
case DOM_VK_BACK_QUOTE: return KEY_QUOTELEFT;
case DOM_VK_OPEN_BRACKET: return KEY_BRACKETLEFT;
case DOM_VK_BACK_SLASH: return KEY_BACKSLASH;
case DOM_VK_CLOSE_BRACKET: return KEY_BRACKETRIGHT;
case DOM_VK_COMMA:
return KEY_COMMA;
case DOM_VK_PERIOD:
return KEY_PERIOD;
case DOM_VK_SLASH:
return KEY_SLASH;
case DOM_VK_BACK_QUOTE:
return KEY_QUOTELEFT;
case DOM_VK_OPEN_BRACKET:
return KEY_BRACKETLEFT;
case DOM_VK_BACK_SLASH:
return KEY_BACKSLASH;
case DOM_VK_CLOSE_BRACKET:
return KEY_BRACKETRIGHT;
case DOM_VK_QUOTE:
return KEY_APOSTROPHE;
// The rest is OEM/unusual.
default: return KEY_UNKNOWN;
default:
return KEY_UNKNOWN;
};
}

View File

@ -324,12 +324,23 @@ EM_BOOL OS_JavaScript::mouse_button_callback(int p_event_type, const EmscriptenM
dom2godot_mod(p_event, ev);
switch (p_event->button) {
case DOM_BUTTON_LEFT: ev->set_button_index(BUTTON_LEFT); break;
case DOM_BUTTON_MIDDLE: ev->set_button_index(BUTTON_MIDDLE); break;
case DOM_BUTTON_RIGHT: ev->set_button_index(BUTTON_RIGHT); break;
case DOM_BUTTON_XBUTTON1: ev->set_button_index(BUTTON_XBUTTON1); break;
case DOM_BUTTON_XBUTTON2: ev->set_button_index(BUTTON_XBUTTON2); break;
default: return false;
case DOM_BUTTON_LEFT:
ev->set_button_index(BUTTON_LEFT);
break;
case DOM_BUTTON_MIDDLE:
ev->set_button_index(BUTTON_MIDDLE);
break;
case DOM_BUTTON_RIGHT:
ev->set_button_index(BUTTON_RIGHT);
break;
case DOM_BUTTON_XBUTTON1:
ev->set_button_index(BUTTON_XBUTTON1);
break;
case DOM_BUTTON_XBUTTON2:
ev->set_button_index(BUTTON_XBUTTON2);
break;
default:
return false;
}
if (ev->is_pressed()) {
@ -413,22 +424,38 @@ static const char *godot2dom_cursor(OS::CursorShape p_shape) {
case OS::CURSOR_ARROW:
default:
return "auto";
case OS::CURSOR_IBEAM: return "text";
case OS::CURSOR_POINTING_HAND: return "pointer";
case OS::CURSOR_CROSS: return "crosshair";
case OS::CURSOR_WAIT: return "progress";
case OS::CURSOR_BUSY: return "wait";
case OS::CURSOR_DRAG: return "grab";
case OS::CURSOR_CAN_DROP: return "grabbing";
case OS::CURSOR_FORBIDDEN: return "no-drop";
case OS::CURSOR_VSIZE: return "ns-resize";
case OS::CURSOR_HSIZE: return "ew-resize";
case OS::CURSOR_BDIAGSIZE: return "nesw-resize";
case OS::CURSOR_FDIAGSIZE: return "nwse-resize";
case OS::CURSOR_MOVE: return "move";
case OS::CURSOR_VSPLIT: return "row-resize";
case OS::CURSOR_HSPLIT: return "col-resize";
case OS::CURSOR_HELP: return "help";
case OS::CURSOR_IBEAM:
return "text";
case OS::CURSOR_POINTING_HAND:
return "pointer";
case OS::CURSOR_CROSS:
return "crosshair";
case OS::CURSOR_WAIT:
return "progress";
case OS::CURSOR_BUSY:
return "wait";
case OS::CURSOR_DRAG:
return "grab";
case OS::CURSOR_CAN_DROP:
return "grabbing";
case OS::CURSOR_FORBIDDEN:
return "no-drop";
case OS::CURSOR_VSIZE:
return "ns-resize";
case OS::CURSOR_HSIZE:
return "ew-resize";
case OS::CURSOR_BDIAGSIZE:
return "nesw-resize";
case OS::CURSOR_FDIAGSIZE:
return "nwse-resize";
case OS::CURSOR_MOVE:
return "move";
case OS::CURSOR_VSPLIT:
return "row-resize";
case OS::CURSOR_HSPLIT:
return "col-resize";
case OS::CURSOR_HELP:
return "help";
}
}

View File

@ -2776,23 +2776,57 @@ void DisplayServerOSX::cursor_set_shape(CursorShape p_shape) {
[cursors[p_shape] set];
} else {
switch (p_shape) {
case CURSOR_ARROW: [[NSCursor arrowCursor] set]; break;
case CURSOR_IBEAM: [[NSCursor IBeamCursor] set]; break;
case CURSOR_POINTING_HAND: [[NSCursor pointingHandCursor] set]; break;
case CURSOR_CROSS: [[NSCursor crosshairCursor] set]; break;
case CURSOR_WAIT: [[NSCursor arrowCursor] set]; break;
case CURSOR_BUSY: [[NSCursor arrowCursor] set]; break;
case CURSOR_DRAG: [[NSCursor closedHandCursor] set]; break;
case CURSOR_CAN_DROP: [[NSCursor openHandCursor] set]; break;
case CURSOR_FORBIDDEN: [[NSCursor operationNotAllowedCursor] set]; break;
case CURSOR_VSIZE: [_cursorFromSelector(@selector(_windowResizeNorthSouthCursor), @selector(resizeUpDownCursor)) set]; break;
case CURSOR_HSIZE: [_cursorFromSelector(@selector(_windowResizeEastWestCursor), @selector(resizeLeftRightCursor)) set]; break;
case CURSOR_BDIAGSIZE: [_cursorFromSelector(@selector(_windowResizeNorthEastSouthWestCursor)) set]; break;
case CURSOR_FDIAGSIZE: [_cursorFromSelector(@selector(_windowResizeNorthWestSouthEastCursor)) set]; break;
case CURSOR_MOVE: [[NSCursor arrowCursor] set]; break;
case CURSOR_VSPLIT: [[NSCursor resizeUpDownCursor] set]; break;
case CURSOR_HSPLIT: [[NSCursor resizeLeftRightCursor] set]; break;
case CURSOR_HELP: [_cursorFromSelector(@selector(_helpCursor)) set]; break;
case CURSOR_ARROW:
[[NSCursor arrowCursor] set];
break;
case CURSOR_IBEAM:
[[NSCursor IBeamCursor] set];
break;
case CURSOR_POINTING_HAND:
[[NSCursor pointingHandCursor] set];
break;
case CURSOR_CROSS:
[[NSCursor crosshairCursor] set];
break;
case CURSOR_WAIT:
[[NSCursor arrowCursor] set];
break;
case CURSOR_BUSY:
[[NSCursor arrowCursor] set];
break;
case CURSOR_DRAG:
[[NSCursor closedHandCursor] set];
break;
case CURSOR_CAN_DROP:
[[NSCursor openHandCursor] set];
break;
case CURSOR_FORBIDDEN:
[[NSCursor operationNotAllowedCursor] set];
break;
case CURSOR_VSIZE:
[_cursorFromSelector(@selector(_windowResizeNorthSouthCursor), @selector(resizeUpDownCursor)) set];
break;
case CURSOR_HSIZE:
[_cursorFromSelector(@selector(_windowResizeEastWestCursor), @selector(resizeLeftRightCursor)) set];
break;
case CURSOR_BDIAGSIZE:
[_cursorFromSelector(@selector(_windowResizeNorthEastSouthWestCursor)) set];
break;
case CURSOR_FDIAGSIZE:
[_cursorFromSelector(@selector(_windowResizeNorthWestSouthEastCursor)) set];
break;
case CURSOR_MOVE:
[[NSCursor arrowCursor] set];
break;
case CURSOR_VSPLIT:
[[NSCursor resizeUpDownCursor] set];
break;
case CURSOR_HSPLIT:
[[NSCursor resizeLeftRightCursor] set];
break;
case CURSOR_HELP:
[_cursorFromSelector(@selector(_helpCursor)) set];
break;
default: {
}
}

View File

@ -1058,7 +1058,8 @@ void DisplayServerWindows::window_set_flag(WindowFlags p_flag, bool p_enabled, W
wd.no_focus = p_enabled;
_update_window_style(p_window);
} break;
case WINDOW_FLAG_MAX: break;
case WINDOW_FLAG_MAX:
break;
}
}
@ -1089,7 +1090,8 @@ bool DisplayServerWindows::window_get_flag(WindowFlags p_flag, WindowID p_window
return wd.no_focus;
} break;
case WINDOW_FLAG_MAX: break;
case WINDOW_FLAG_MAX:
break;
}
return false;

View File

@ -89,20 +89,36 @@ void WindowsTerminalLogger::log_error(const char *p_function, const char *p_file
uint32_t basecol = 0;
switch (p_type) {
case ERR_ERROR: basecol = FOREGROUND_RED; break;
case ERR_WARNING: basecol = FOREGROUND_RED | FOREGROUND_GREEN; break;
case ERR_SCRIPT: basecol = FOREGROUND_RED | FOREGROUND_BLUE; break;
case ERR_SHADER: basecol = FOREGROUND_GREEN | FOREGROUND_BLUE; break;
case ERR_ERROR:
basecol = FOREGROUND_RED;
break;
case ERR_WARNING:
basecol = FOREGROUND_RED | FOREGROUND_GREEN;
break;
case ERR_SCRIPT:
basecol = FOREGROUND_RED | FOREGROUND_BLUE;
break;
case ERR_SHADER:
basecol = FOREGROUND_GREEN | FOREGROUND_BLUE;
break;
}
basecol |= current_bg;
SetConsoleTextAttribute(hCon, basecol | FOREGROUND_INTENSITY);
switch (p_type) {
case ERR_ERROR: logf("ERROR:"); break;
case ERR_WARNING: logf("WARNING:"); break;
case ERR_SCRIPT: logf("SCRIPT ERROR:"); break;
case ERR_SHADER: logf("SHADER ERROR:"); break;
case ERR_ERROR:
logf("ERROR:");
break;
case ERR_WARNING:
logf("WARNING:");
break;
case ERR_SCRIPT:
logf("SCRIPT ERROR:");
break;
case ERR_SHADER:
logf("SHADER ERROR:");
break;
}
SetConsoleTextAttribute(hCon, basecol);
@ -115,10 +131,18 @@ void WindowsTerminalLogger::log_error(const char *p_function, const char *p_file
// `FOREGROUND_INTENSITY` alone results in gray text.
SetConsoleTextAttribute(hCon, FOREGROUND_INTENSITY);
switch (p_type) {
case ERR_ERROR: logf(" at: "); break;
case ERR_WARNING: logf(" at: "); break;
case ERR_SCRIPT: logf(" at: "); break;
case ERR_SHADER: logf(" at: "); break;
case ERR_ERROR:
logf(" at: ");
break;
case ERR_WARNING:
logf(" at: ");
break;
case ERR_SCRIPT:
logf(" at: ");
break;
case ERR_SHADER:
logf(" at: ");
break;
}
if (p_rationale && p_rationale[0]) {

View File

@ -320,7 +320,8 @@ float AudioStreamPlayer3D::_get_attenuation_db(float p_distance) const {
case ATTENUATION_LOGARITHMIC: {
att = -20 * Math::log(p_distance / unit_size + CMP_EPSILON);
} break;
case ATTENUATION_DISABLED: break;
case ATTENUATION_DISABLED:
break;
default: {
ERR_PRINT("Unknown attenuation type");
break;

View File

@ -326,9 +326,15 @@ Light3D::Light3D(RenderingServer::LightType p_type) {
type = p_type;
switch (p_type) {
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;
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;
default: {
};
}

View File

@ -1479,9 +1479,14 @@ void AnimationPlayer::_set_process(bool p_process, bool p_force) {
switch (animation_process_mode) {
case ANIMATION_PROCESS_PHYSICS: set_physics_process_internal(p_process && active); break;
case ANIMATION_PROCESS_IDLE: set_process_internal(p_process && active); break;
case ANIMATION_PROCESS_MANUAL: break;
case ANIMATION_PROCESS_PHYSICS:
set_physics_process_internal(p_process && active);
break;
case ANIMATION_PROCESS_IDLE:
set_process_internal(p_process && active);
break;
case ANIMATION_PROCESS_MANUAL:
break;
}
processing = p_process;

View File

@ -826,8 +826,12 @@ void Tween::set_active(bool p_active) {
// Depending on physics or idle, set processing
switch (tween_process_mode) {
case TWEEN_PROCESS_IDLE: set_process_internal(p_active); break;
case TWEEN_PROCESS_PHYSICS: set_physics_process_internal(p_active); break;
case TWEEN_PROCESS_IDLE:
set_process_internal(p_active);
break;
case TWEEN_PROCESS_PHYSICS:
set_physics_process_internal(p_active);
break;
}
}

View File

@ -230,10 +230,18 @@ int RichTextLabel::_process_line(ItemFrame *p_frame, const Vector2 &p_ofs, int &
} else { \
int used = wofs - margin; \
switch (align) { \
case ALIGN_LEFT: l.offset_caches.push_back(0); break; \
case ALIGN_CENTER: l.offset_caches.push_back(((p_width - margin) - used) / 2); break; \
case ALIGN_RIGHT: l.offset_caches.push_back(((p_width - margin) - used)); break; \
case ALIGN_FILL: l.offset_caches.push_back(line_wrapped ? ((p_width - margin) - used) : 0); break; \
case ALIGN_LEFT: \
l.offset_caches.push_back(0); \
break; \
case ALIGN_CENTER: \
l.offset_caches.push_back(((p_width - margin) - used) / 2); \
break; \
case ALIGN_RIGHT: \
l.offset_caches.push_back(((p_width - margin) - used)); \
break; \
case ALIGN_FILL: \
l.offset_caches.push_back(line_wrapped ? ((p_width - margin) - used) : 0); \
break; \
} \
l.height_caches.push_back(line_height); \
l.ascent_caches.push_back(line_ascent); \

View File

@ -95,18 +95,35 @@ void CanvasItemMaterial::_update_shader() {
String code = "shader_type canvas_item;\nrender_mode ";
switch (blend_mode) {
case BLEND_MODE_MIX: code += "blend_mix"; break;
case BLEND_MODE_ADD: code += "blend_add"; break;
case BLEND_MODE_SUB: code += "blend_sub"; break;
case BLEND_MODE_MUL: code += "blend_mul"; break;
case BLEND_MODE_PREMULT_ALPHA: code += "blend_premul_alpha"; break;
case BLEND_MODE_DISABLED: code += "blend_disabled"; break;
case BLEND_MODE_MIX:
code += "blend_mix";
break;
case BLEND_MODE_ADD:
code += "blend_add";
break;
case BLEND_MODE_SUB:
code += "blend_sub";
break;
case BLEND_MODE_MUL:
code += "blend_mul";
break;
case BLEND_MODE_PREMULT_ALPHA:
code += "blend_premul_alpha";
break;
case BLEND_MODE_DISABLED:
code += "blend_disabled";
break;
}
switch (light_mode) {
case LIGHT_MODE_NORMAL: break;
case LIGHT_MODE_UNSHADED: code += ",unshaded"; break;
case LIGHT_MODE_LIGHT_ONLY: code += ",light_only"; break;
case LIGHT_MODE_NORMAL:
break;
case LIGHT_MODE_UNSHADED:
code += ",unshaded";
break;
case LIGHT_MODE_LIGHT_ONLY:
code += ",light_only";
break;
}
code += ";\n";
@ -1372,10 +1389,18 @@ void CanvasItem::_update_texture_filter_changed(bool p_propagate) {
} else {
//from viewport
switch (get_viewport()->get_default_canvas_item_texture_filter()) {
case Viewport::DEFAULT_CANVAS_ITEM_TEXTURE_FILTER_NEAREST: texture_filter_cache = RS::CANVAS_ITEM_TEXTURE_FILTER_NEAREST; break;
case Viewport::DEFAULT_CANVAS_ITEM_TEXTURE_FILTER_LINEAR: texture_filter_cache = RS::CANVAS_ITEM_TEXTURE_FILTER_LINEAR; break;
case Viewport::DEFAULT_CANVAS_ITEM_TEXTURE_FILTER_LINEAR_WITH_MIPMAPS: texture_filter_cache = RS::CANVAS_ITEM_TEXTURE_FILTER_LINEAR_WITH_MIPMAPS; break;
case Viewport::DEFAULT_CANVAS_ITEM_TEXTURE_FILTER_NEAREST_WITH_MIPMAPS: texture_filter_cache = RS::CANVAS_ITEM_TEXTURE_FILTER_NEAREST_WITH_MIPMAPS; break;
case Viewport::DEFAULT_CANVAS_ITEM_TEXTURE_FILTER_NEAREST:
texture_filter_cache = RS::CANVAS_ITEM_TEXTURE_FILTER_NEAREST;
break;
case Viewport::DEFAULT_CANVAS_ITEM_TEXTURE_FILTER_LINEAR:
texture_filter_cache = RS::CANVAS_ITEM_TEXTURE_FILTER_LINEAR;
break;
case Viewport::DEFAULT_CANVAS_ITEM_TEXTURE_FILTER_LINEAR_WITH_MIPMAPS:
texture_filter_cache = RS::CANVAS_ITEM_TEXTURE_FILTER_LINEAR_WITH_MIPMAPS;
break;
case Viewport::DEFAULT_CANVAS_ITEM_TEXTURE_FILTER_NEAREST_WITH_MIPMAPS:
texture_filter_cache = RS::CANVAS_ITEM_TEXTURE_FILTER_NEAREST_WITH_MIPMAPS;
break;
default: {
}
}
@ -1421,9 +1446,15 @@ void CanvasItem::_update_texture_repeat_changed(bool p_propagate) {
} else {
//from viewport
switch (get_viewport()->get_default_canvas_item_texture_repeat()) {
case Viewport::DEFAULT_CANVAS_ITEM_TEXTURE_REPEAT_DISABLED: texture_repeat_cache = RS::CANVAS_ITEM_TEXTURE_REPEAT_DISABLED; break;
case Viewport::DEFAULT_CANVAS_ITEM_TEXTURE_REPEAT_ENABLED: texture_repeat_cache = RS::CANVAS_ITEM_TEXTURE_REPEAT_ENABLED; break;
case Viewport::DEFAULT_CANVAS_ITEM_TEXTURE_REPEAT_MIRROR: texture_repeat_cache = RS::CANVAS_ITEM_TEXTURE_REPEAT_MIRROR; break;
case Viewport::DEFAULT_CANVAS_ITEM_TEXTURE_REPEAT_DISABLED:
texture_repeat_cache = RS::CANVAS_ITEM_TEXTURE_REPEAT_DISABLED;
break;
case Viewport::DEFAULT_CANVAS_ITEM_TEXTURE_REPEAT_ENABLED:
texture_repeat_cache = RS::CANVAS_ITEM_TEXTURE_REPEAT_ENABLED;
break;
case Viewport::DEFAULT_CANVAS_ITEM_TEXTURE_REPEAT_MIRROR:
texture_repeat_cache = RS::CANVAS_ITEM_TEXTURE_REPEAT_MIRROR;
break;
default: {
}
}

View File

@ -819,10 +819,14 @@ String Node::get_rpc_md5() const {
bool Node::can_process_notification(int p_what) const {
switch (p_what) {
case NOTIFICATION_PHYSICS_PROCESS: return data.physics_process;
case NOTIFICATION_PROCESS: return data.idle_process;
case NOTIFICATION_INTERNAL_PROCESS: return data.idle_process_internal;
case NOTIFICATION_INTERNAL_PHYSICS_PROCESS: return data.physics_process_internal;
case NOTIFICATION_PHYSICS_PROCESS:
return data.physics_process;
case NOTIFICATION_PROCESS:
return data.idle_process;
case NOTIFICATION_INTERNAL_PROCESS:
return data.idle_process_internal;
case NOTIFICATION_INTERNAL_PHYSICS_PROCESS:
return data.physics_process_internal;
}
return true;
@ -2994,10 +2998,14 @@ void Node::_bind_methods() {
String Node::_get_name_num_separator() {
switch (ProjectSettings::get_singleton()->get("node/name_num_separator").operator int()) {
case 0: return "";
case 1: return " ";
case 2: return "_";
case 3: return "-";
case 0:
return "";
case 1:
return " ";
case 2:
return "_";
case 3:
return "-";
}
return " ";
}

View File

@ -173,8 +173,12 @@ Timer::TimerProcessMode Timer::get_timer_process_mode() const {
void Timer::_set_process(bool p_process, bool p_force) {
switch (timer_process_mode) {
case TIMER_PROCESS_PHYSICS: set_physics_process_internal(p_process && !paused); break;
case TIMER_PROCESS_IDLE: set_process_internal(p_process && !paused); break;
case TIMER_PROCESS_PHYSICS:
set_physics_process_internal(p_process && !paused);
break;
case TIMER_PROCESS_IDLE:
set_process_internal(p_process && !paused);
break;
}
processing = p_process;
}

View File

@ -349,12 +349,24 @@ bool Animation::_get(const StringName &p_name, Variant &r_ret) const {
switch (track_get_type(track)) {
case TYPE_TRANSFORM: r_ret = "transform"; break;
case TYPE_VALUE: r_ret = "value"; break;
case TYPE_METHOD: r_ret = "method"; break;
case TYPE_BEZIER: r_ret = "bezier"; break;
case TYPE_AUDIO: r_ret = "audio"; break;
case TYPE_ANIMATION: r_ret = "animation"; break;
case TYPE_TRANSFORM:
r_ret = "transform";
break;
case TYPE_VALUE:
r_ret = "value";
break;
case TYPE_METHOD:
r_ret = "method";
break;
case TYPE_BEZIER:
r_ret = "bezier";
break;
case TYPE_AUDIO:
r_ret = "audio";
break;
case TYPE_ANIMATION:
r_ret = "animation";
break;
}
return true;
@ -1842,7 +1854,8 @@ T Animation::_interpolate(const Vector<TKey<T>> &p_keys, float p_time, Interpola
return _cubic_interpolate(p_keys[pre].value, p_keys[idx].value, p_keys[next].value, p_keys[post].value, c);
} break;
default: return p_keys[idx].value;
default:
return p_keys[idx].value;
}
// do a barrel roll

View File

@ -230,9 +230,15 @@ void AudioStreamPlaybackSample::mix(AudioFrame *p_buffer, float p_rate_scale, in
int len = base->data_bytes;
switch (base->format) {
case AudioStreamSample::FORMAT_8_BITS: len /= 1; break;
case AudioStreamSample::FORMAT_16_BITS: len /= 2; break;
case AudioStreamSample::FORMAT_IMA_ADPCM: len *= 2; break;
case AudioStreamSample::FORMAT_8_BITS:
len /= 1;
break;
case AudioStreamSample::FORMAT_16_BITS:
len /= 2;
break;
case AudioStreamSample::FORMAT_IMA_ADPCM:
len *= 2;
break;
}
if (base->stereo) {
@ -465,9 +471,15 @@ float AudioStreamSample::get_length() const {
int len = data_bytes;
switch (format) {
case AudioStreamSample::FORMAT_8_BITS: len /= 1; break;
case AudioStreamSample::FORMAT_16_BITS: len /= 2; break;
case AudioStreamSample::FORMAT_IMA_ADPCM: len *= 2; break;
case AudioStreamSample::FORMAT_8_BITS:
len /= 1;
break;
case AudioStreamSample::FORMAT_16_BITS:
len /= 2;
break;
case AudioStreamSample::FORMAT_IMA_ADPCM:
len *= 2;
break;
}
if (stereo) {
@ -536,9 +548,15 @@ Error AudioStreamSample::save_to_wav(const String &p_path) {
int byte_pr_sample = 0;
switch (format) {
case AudioStreamSample::FORMAT_8_BITS: byte_pr_sample = 1; break;
case AudioStreamSample::FORMAT_16_BITS: byte_pr_sample = 2; break;
case AudioStreamSample::FORMAT_IMA_ADPCM: byte_pr_sample = 4; break;
case AudioStreamSample::FORMAT_8_BITS:
byte_pr_sample = 1;
break;
case AudioStreamSample::FORMAT_16_BITS:
byte_pr_sample = 2;
break;
case AudioStreamSample::FORMAT_IMA_ADPCM:
byte_pr_sample = 4;
break;
}
String file_path = p_path;

View File

@ -414,13 +414,26 @@ void BaseMaterial3D::_update_shader() {
String texfilter_str;
switch (texture_filter) {
case TEXTURE_FILTER_NEAREST: texfilter_str = "filter_nearest"; break;
case TEXTURE_FILTER_LINEAR: texfilter_str = "filter_linear"; break;
case TEXTURE_FILTER_NEAREST_WITH_MIPMAPS: texfilter_str = "filter_nearest_mipmap"; break;
case TEXTURE_FILTER_LINEAR_WITH_MIPMAPS: texfilter_str = "filter_linear_mipmap"; break;
case TEXTURE_FILTER_NEAREST_WITH_MIPMAPS_ANISOTROPIC: texfilter_str = "filter_nearest_mipmap_aniso"; break;
case TEXTURE_FILTER_LINEAR_WITH_MIPMAPS_ANISOTROPIC: texfilter_str = "filter_linear_mipmap_aniso"; break;
case TEXTURE_FILTER_MAX: break; // Internal value, skip.
case TEXTURE_FILTER_NEAREST:
texfilter_str = "filter_nearest";
break;
case TEXTURE_FILTER_LINEAR:
texfilter_str = "filter_linear";
break;
case TEXTURE_FILTER_NEAREST_WITH_MIPMAPS:
texfilter_str = "filter_nearest_mipmap";
break;
case TEXTURE_FILTER_LINEAR_WITH_MIPMAPS:
texfilter_str = "filter_linear_mipmap";
break;
case TEXTURE_FILTER_NEAREST_WITH_MIPMAPS_ANISOTROPIC:
texfilter_str = "filter_nearest_mipmap_aniso";
break;
case TEXTURE_FILTER_LINEAR_WITH_MIPMAPS_ANISOTROPIC:
texfilter_str = "filter_linear_mipmap_aniso";
break;
case TEXTURE_FILTER_MAX:
break; // Internal value, skip.
}
if (flags[FLAG_USE_TEXTURE_REPEAT]) {
@ -433,10 +446,18 @@ void BaseMaterial3D::_update_shader() {
String code = "shader_type spatial;\nrender_mode ";
switch (blend_mode) {
case BLEND_MODE_MIX: code += "blend_mix"; break;
case BLEND_MODE_ADD: code += "blend_add"; break;
case BLEND_MODE_SUB: code += "blend_sub"; break;
case BLEND_MODE_MUL: code += "blend_mul"; break;
case BLEND_MODE_MIX:
code += "blend_mix";
break;
case BLEND_MODE_ADD:
code += "blend_add";
break;
case BLEND_MODE_SUB:
code += "blend_sub";
break;
case BLEND_MODE_MUL:
code += "blend_mul";
break;
}
DepthDrawMode ddm = depth_draw_mode;
@ -445,9 +466,15 @@ void BaseMaterial3D::_update_shader() {
}
switch (ddm) {
case DEPTH_DRAW_OPAQUE_ONLY: code += ",depth_draw_opaque"; break;
case DEPTH_DRAW_ALWAYS: code += ",depth_draw_always"; break;
case DEPTH_DRAW_DISABLED: code += ",depth_draw_never"; break;
case DEPTH_DRAW_OPAQUE_ONLY:
code += ",depth_draw_opaque";
break;
case DEPTH_DRAW_ALWAYS:
code += ",depth_draw_always";
break;
case DEPTH_DRAW_DISABLED:
code += ",depth_draw_never";
break;
}
if (transparency == TRANSPARENCY_ALPHA_DEPTH_PRE_PASS) {
@ -455,23 +482,49 @@ void BaseMaterial3D::_update_shader() {
}
switch (cull_mode) {
case CULL_BACK: code += ",cull_back"; break;
case CULL_FRONT: code += ",cull_front"; break;
case CULL_DISABLED: code += ",cull_disabled"; break;
case CULL_BACK:
code += ",cull_back";
break;
case CULL_FRONT:
code += ",cull_front";
break;
case CULL_DISABLED:
code += ",cull_disabled";
break;
}
switch (diffuse_mode) {
case DIFFUSE_BURLEY: code += ",diffuse_burley"; break;
case DIFFUSE_LAMBERT: code += ",diffuse_lambert"; break;
case DIFFUSE_LAMBERT_WRAP: code += ",diffuse_lambert_wrap"; break;
case DIFFUSE_OREN_NAYAR: code += ",diffuse_oren_nayar"; break;
case DIFFUSE_TOON: code += ",diffuse_toon"; break;
case DIFFUSE_BURLEY:
code += ",diffuse_burley";
break;
case DIFFUSE_LAMBERT:
code += ",diffuse_lambert";
break;
case DIFFUSE_LAMBERT_WRAP:
code += ",diffuse_lambert_wrap";
break;
case DIFFUSE_OREN_NAYAR:
code += ",diffuse_oren_nayar";
break;
case DIFFUSE_TOON:
code += ",diffuse_toon";
break;
}
switch (specular_mode) {
case SPECULAR_SCHLICK_GGX: code += ",specular_schlick_ggx"; break;
case SPECULAR_BLINN: code += ",specular_blinn"; break;
case SPECULAR_PHONG: code += ",specular_phong"; break;
case SPECULAR_TOON: code += ",specular_toon"; break;
case SPECULAR_DISABLED: code += ",specular_disabled"; break;
case SPECULAR_SCHLICK_GGX:
code += ",specular_schlick_ggx";
break;
case SPECULAR_BLINN:
code += ",specular_blinn";
break;
case SPECULAR_PHONG:
code += ",specular_phong";
break;
case SPECULAR_TOON:
code += ",specular_toon";
break;
case SPECULAR_DISABLED:
code += ",specular_disabled";
break;
}
if (features[FEATURE_SUBSURFACE_SCATTERING] && flags[FLAG_SUBSURFACE_MODE_SKIN]) {
code += ",sss_mode_skin";

View File

@ -703,7 +703,8 @@ void ParticlesMaterial::set_param(Parameter p_param, float p_value) {
case PARAM_ANIM_OFFSET: {
RenderingServer::get_singleton()->material_set_param(_get_material(), shader_names->anim_offset, p_value);
} break;
case PARAM_MAX: break; // Can't happen, but silences warning
case PARAM_MAX:
break; // Can't happen, but silences warning
}
}
float ParticlesMaterial::get_param(Parameter p_param) const {
@ -756,7 +757,8 @@ void ParticlesMaterial::set_param_randomness(Parameter p_param, float p_value) {
case PARAM_ANIM_OFFSET: {
RenderingServer::get_singleton()->material_set_param(_get_material(), shader_names->anim_offset_random, p_value);
} break;
case PARAM_MAX: break; // Can't happen, but silences warning
case PARAM_MAX:
break; // Can't happen, but silences warning
}
}
float ParticlesMaterial::get_param_randomness(Parameter p_param) const {
@ -828,7 +830,8 @@ void ParticlesMaterial::set_param_texture(Parameter p_param, const Ref<Texture2D
case PARAM_ANIM_OFFSET: {
RenderingServer::get_singleton()->material_set_param(_get_material(), shader_names->anim_offset_texture, p_texture);
} break;
case PARAM_MAX: break; // Can't happen, but silences warning
case PARAM_MAX:
break; // Can't happen, but silences warning
}
_queue_shader_change();

View File

@ -1229,11 +1229,21 @@ Error VisualShader::_write_node(Type type, StringBuilder &global_code, StringBui
for (int i = 0; i < output_count; i++) {
String var_name = "n_out" + itos(node) + "p" + itos(i);
switch (vsnode->get_output_port_type(i)) {
case VisualShaderNode::PORT_TYPE_SCALAR: outputs[i] = "float " + var_name; break;
case VisualShaderNode::PORT_TYPE_SCALAR_INT: outputs[i] = "int " + var_name; break;
case VisualShaderNode::PORT_TYPE_VECTOR: outputs[i] = "vec3 " + var_name; break;
case VisualShaderNode::PORT_TYPE_BOOLEAN: outputs[i] = "bool " + var_name; break;
case VisualShaderNode::PORT_TYPE_TRANSFORM: outputs[i] = "mat4 " + var_name; break;
case VisualShaderNode::PORT_TYPE_SCALAR:
outputs[i] = "float " + var_name;
break;
case VisualShaderNode::PORT_TYPE_SCALAR_INT:
outputs[i] = "int " + var_name;
break;
case VisualShaderNode::PORT_TYPE_VECTOR:
outputs[i] = "vec3 " + var_name;
break;
case VisualShaderNode::PORT_TYPE_BOOLEAN:
outputs[i] = "bool " + var_name;
break;
case VisualShaderNode::PORT_TYPE_TRANSFORM:
outputs[i] = "mat4 " + var_name;
break;
default: {
}
}
@ -1243,11 +1253,21 @@ Error VisualShader::_write_node(Type type, StringBuilder &global_code, StringBui
for (int i = 0; i < output_count; i++) {
outputs[i] = "n_out" + itos(node) + "p" + itos(i);
switch (vsnode->get_output_port_type(i)) {
case VisualShaderNode::PORT_TYPE_SCALAR: code += String() + "\tfloat " + outputs[i] + ";\n"; break;
case VisualShaderNode::PORT_TYPE_SCALAR_INT: code += String() + "\tint " + outputs[i] + ";\n"; break;
case VisualShaderNode::PORT_TYPE_VECTOR: code += String() + "\tvec3 " + outputs[i] + ";\n"; break;
case VisualShaderNode::PORT_TYPE_BOOLEAN: code += String() + "\tbool " + outputs[i] + ";\n"; break;
case VisualShaderNode::PORT_TYPE_TRANSFORM: code += String() + "\tmat4 " + outputs[i] + ";\n"; break;
case VisualShaderNode::PORT_TYPE_SCALAR:
code += String() + "\tfloat " + outputs[i] + ";\n";
break;
case VisualShaderNode::PORT_TYPE_SCALAR_INT:
code += String() + "\tint " + outputs[i] + ";\n";
break;
case VisualShaderNode::PORT_TYPE_VECTOR:
code += String() + "\tvec3 " + outputs[i] + ";\n";
break;
case VisualShaderNode::PORT_TYPE_BOOLEAN:
code += String() + "\tbool " + outputs[i] + ";\n";
break;
case VisualShaderNode::PORT_TYPE_TRANSFORM:
code += String() + "\tmat4 " + outputs[i] + ";\n";
break;
default: {
}
}

View File

@ -497,9 +497,14 @@ String VisualShaderNodeTexture::generate_global(Shader::Mode p_mode, VisualShade
String u = "uniform sampler2D " + make_unique_id(p_type, p_id, "tex");
switch (texture_type) {
case TYPE_DATA: break;
case TYPE_COLOR: u += " : hint_albedo"; break;
case TYPE_NORMALMAP: u += " : hint_normal"; break;
case TYPE_DATA:
break;
case TYPE_COLOR:
u += " : hint_albedo";
break;
case TYPE_NORMALMAP:
u += " : hint_normal";
break;
}
return u + ";\n";
}
@ -869,9 +874,14 @@ String VisualShaderNodeCubemap::generate_global(Shader::Mode p_mode, VisualShade
if (source == SOURCE_TEXTURE) {
String u = "uniform samplerCube " + make_unique_id(p_type, p_id, "cube");
switch (texture_type) {
case TYPE_DATA: break;
case TYPE_COLOR: u += " : hint_albedo"; break;
case TYPE_NORMALMAP: u += " : hint_normal"; break;
case TYPE_DATA:
break;
case TYPE_COLOR:
u += " : hint_albedo";
break;
case TYPE_NORMALMAP:
u += " : hint_normal";
break;
}
return u + ";\n";
}
@ -1032,16 +1042,36 @@ String VisualShaderNodeFloatOp::generate_code(Shader::Mode p_mode, VisualShader:
String code = "\t" + p_output_vars[0] + " = ";
switch (op) {
case OP_ADD: code += p_input_vars[0] + " + " + p_input_vars[1] + ";\n"; break;
case OP_SUB: code += p_input_vars[0] + " - " + p_input_vars[1] + ";\n"; break;
case OP_MUL: code += p_input_vars[0] + " * " + p_input_vars[1] + ";\n"; break;
case OP_DIV: code += p_input_vars[0] + " / " + p_input_vars[1] + ";\n"; break;
case OP_MOD: code += "mod(" + p_input_vars[0] + ", " + p_input_vars[1] + ");\n"; break;
case OP_POW: code += "pow(" + p_input_vars[0] + ", " + p_input_vars[1] + ");\n"; break;
case OP_MAX: code += "max(" + p_input_vars[0] + ", " + p_input_vars[1] + ");\n"; break;
case OP_MIN: code += "min(" + p_input_vars[0] + ", " + p_input_vars[1] + ");\n"; break;
case OP_ATAN2: code += "atan(" + p_input_vars[0] + ", " + p_input_vars[1] + ");\n"; break;
case OP_STEP: code += "step(" + p_input_vars[0] + ", " + p_input_vars[1] + ");\n"; break;
case OP_ADD:
code += p_input_vars[0] + " + " + p_input_vars[1] + ";\n";
break;
case OP_SUB:
code += p_input_vars[0] + " - " + p_input_vars[1] + ";\n";
break;
case OP_MUL:
code += p_input_vars[0] + " * " + p_input_vars[1] + ";\n";
break;
case OP_DIV:
code += p_input_vars[0] + " / " + p_input_vars[1] + ";\n";
break;
case OP_MOD:
code += "mod(" + p_input_vars[0] + ", " + p_input_vars[1] + ");\n";
break;
case OP_POW:
code += "pow(" + p_input_vars[0] + ", " + p_input_vars[1] + ");\n";
break;
case OP_MAX:
code += "max(" + p_input_vars[0] + ", " + p_input_vars[1] + ");\n";
break;
case OP_MIN:
code += "min(" + p_input_vars[0] + ", " + p_input_vars[1] + ");\n";
break;
case OP_ATAN2:
code += "atan(" + p_input_vars[0] + ", " + p_input_vars[1] + ");\n";
break;
case OP_STEP:
code += "step(" + p_input_vars[0] + ", " + p_input_vars[1] + ");\n";
break;
}
return code;
@ -1124,13 +1154,27 @@ String VisualShaderNodeIntOp::generate_code(Shader::Mode p_mode, VisualShader::T
String code = "\t" + p_output_vars[0] + " = ";
switch (op) {
case OP_ADD: code += p_input_vars[0] + " + " + p_input_vars[1] + ";\n"; break;
case OP_SUB: code += p_input_vars[0] + " - " + p_input_vars[1] + ";\n"; break;
case OP_MUL: code += p_input_vars[0] + " * " + p_input_vars[1] + ";\n"; break;
case OP_DIV: code += p_input_vars[0] + " / " + p_input_vars[1] + ";\n"; break;
case OP_MOD: code += p_input_vars[0] + " % " + p_input_vars[1] + ";\n"; break;
case OP_MAX: code += "max(" + p_input_vars[0] + ", " + p_input_vars[1] + ");\n"; break;
case OP_MIN: code += "min(" + p_input_vars[0] + ", " + p_input_vars[1] + ");\n"; break;
case OP_ADD:
code += p_input_vars[0] + " + " + p_input_vars[1] + ";\n";
break;
case OP_SUB:
code += p_input_vars[0] + " - " + p_input_vars[1] + ";\n";
break;
case OP_MUL:
code += p_input_vars[0] + " * " + p_input_vars[1] + ";\n";
break;
case OP_DIV:
code += p_input_vars[0] + " / " + p_input_vars[1] + ";\n";
break;
case OP_MOD:
code += p_input_vars[0] + " % " + p_input_vars[1] + ";\n";
break;
case OP_MAX:
code += "max(" + p_input_vars[0] + ", " + p_input_vars[1] + ");\n";
break;
case OP_MIN:
code += "min(" + p_input_vars[0] + ", " + p_input_vars[1] + ");\n";
break;
}
return code;
@ -1209,18 +1253,42 @@ String VisualShaderNodeVectorOp::generate_code(Shader::Mode p_mode, VisualShader
String code = "\t" + p_output_vars[0] + " = ";
switch (op) {
case OP_ADD: code += p_input_vars[0] + " + " + p_input_vars[1] + ";\n"; break;
case OP_SUB: code += p_input_vars[0] + " - " + p_input_vars[1] + ";\n"; break;
case OP_MUL: code += p_input_vars[0] + " * " + p_input_vars[1] + ";\n"; break;
case OP_DIV: code += p_input_vars[0] + " / " + p_input_vars[1] + ";\n"; break;
case OP_MOD: code += "mod(" + p_input_vars[0] + ", " + p_input_vars[1] + ");\n"; break;
case OP_POW: code += "pow(" + p_input_vars[0] + ", " + p_input_vars[1] + ");\n"; break;
case OP_MAX: code += "max(" + p_input_vars[0] + ", " + p_input_vars[1] + ");\n"; break;
case OP_MIN: code += "min(" + p_input_vars[0] + ", " + p_input_vars[1] + ");\n"; break;
case OP_CROSS: code += "cross(" + p_input_vars[0] + ", " + p_input_vars[1] + ");\n"; break;
case OP_ATAN2: code += "atan(" + p_input_vars[0] + ", " + p_input_vars[1] + ");\n"; break;
case OP_REFLECT: code += "reflect(" + p_input_vars[0] + ", " + p_input_vars[1] + ");\n"; break;
case OP_STEP: code += "step(" + p_input_vars[0] + ", " + p_input_vars[1] + ");\n"; break;
case OP_ADD:
code += p_input_vars[0] + " + " + p_input_vars[1] + ";\n";
break;
case OP_SUB:
code += p_input_vars[0] + " - " + p_input_vars[1] + ";\n";
break;
case OP_MUL:
code += p_input_vars[0] + " * " + p_input_vars[1] + ";\n";
break;
case OP_DIV:
code += p_input_vars[0] + " / " + p_input_vars[1] + ";\n";
break;
case OP_MOD:
code += "mod(" + p_input_vars[0] + ", " + p_input_vars[1] + ");\n";
break;
case OP_POW:
code += "pow(" + p_input_vars[0] + ", " + p_input_vars[1] + ");\n";
break;
case OP_MAX:
code += "max(" + p_input_vars[0] + ", " + p_input_vars[1] + ");\n";
break;
case OP_MIN:
code += "min(" + p_input_vars[0] + ", " + p_input_vars[1] + ");\n";
break;
case OP_CROSS:
code += "cross(" + p_input_vars[0] + ", " + p_input_vars[1] + ");\n";
break;
case OP_ATAN2:
code += "atan(" + p_input_vars[0] + ", " + p_input_vars[1] + ");\n";
break;
case OP_REFLECT:
code += "reflect(" + p_input_vars[0] + ", " + p_input_vars[1] + ");\n";
break;
case OP_STEP:
code += "step(" + p_input_vars[0] + ", " + p_input_vars[1] + ");\n";
break;
}
return code;
@ -3752,8 +3820,12 @@ String VisualShaderNodeTextureUniform::generate_global(Shader::Mode p_mode, Visu
else
code += " : hint_albedo;\n";
break;
case TYPE_NORMALMAP: code += " : hint_normal;\n"; break;
case TYPE_ANISO: code += " : hint_aniso;\n"; break;
case TYPE_NORMALMAP:
code += " : hint_normal;\n";
break;
case TYPE_ANISO:
code += " : hint_aniso;\n";
break;
}
return code;
@ -4003,8 +4075,12 @@ String VisualShaderNodeCubemapUniform::generate_global(Shader::Mode p_mode, Visu
else
code += " : hint_albedo;\n";
break;
case TYPE_NORMALMAP: code += " : hint_normal;\n"; break;
case TYPE_ANISO: code += " : hint_aniso;\n"; break;
case TYPE_NORMALMAP:
code += " : hint_normal;\n";
break;
case TYPE_ANISO:
code += " : hint_aniso;\n";
break;
}
return code;

View File

@ -119,10 +119,18 @@ bool AudioRBResampler::mix(AudioFrame *p_dest, int p_frames) {
{
int src_read = 0;
switch (channels) {
case 1: src_read = _resample<1>(p_dest, target_todo, increment); break;
case 2: src_read = _resample<2>(p_dest, target_todo, increment); break;
case 4: src_read = _resample<4>(p_dest, target_todo, increment); break;
case 6: src_read = _resample<6>(p_dest, target_todo, increment); break;
case 1:
src_read = _resample<1>(p_dest, target_todo, increment);
break;
case 2:
src_read = _resample<2>(p_dest, target_todo, increment);
break;
case 4:
src_read = _resample<4>(p_dest, target_todo, increment);
break;
case 6:
src_read = _resample<6>(p_dest, target_todo, increment);
break;
}
if (src_read > read_space)

View File

@ -109,9 +109,12 @@ void AudioDriver::input_buffer_write(int32_t sample) {
AudioDriver::SpeakerMode AudioDriver::get_speaker_mode_by_total_channels(int p_channels) const {
switch (p_channels) {
case 4: return SPEAKER_SURROUND_31;
case 6: return SPEAKER_SURROUND_51;
case 8: return SPEAKER_SURROUND_71;
case 4:
return SPEAKER_SURROUND_31;
case 6:
return SPEAKER_SURROUND_51;
case 8:
return SPEAKER_SURROUND_71;
}
// Default to STEREO
@ -120,10 +123,14 @@ AudioDriver::SpeakerMode AudioDriver::get_speaker_mode_by_total_channels(int p_c
int AudioDriver::get_total_channels_by_speaker_mode(AudioDriver::SpeakerMode p_mode) const {
switch (p_mode) {
case SPEAKER_MODE_STEREO: return 2;
case SPEAKER_SURROUND_31: return 4;
case SPEAKER_SURROUND_51: return 6;
case SPEAKER_SURROUND_71: return 8;
case SPEAKER_MODE_STEREO:
return 2;
case SPEAKER_SURROUND_31:
return 4;
case SPEAKER_SURROUND_51:
return 6;
case SPEAKER_SURROUND_71:
return 8;
}
ERR_FAIL_V(2);

View File

@ -258,10 +258,14 @@ protected:
public:
_FORCE_INLINE_ int get_channel_count() const {
switch (get_speaker_mode()) {
case SPEAKER_MODE_STEREO: return 1;
case SPEAKER_SURROUND_31: return 2;
case SPEAKER_SURROUND_51: return 3;
case SPEAKER_SURROUND_71: return 4;
case SPEAKER_MODE_STEREO:
return 1;
case SPEAKER_SURROUND_31:
return 2;
case SPEAKER_SURROUND_51:
return 3;
case SPEAKER_SURROUND_71:
return 4;
}
ERR_FAIL_V(1);
}

View File

@ -129,28 +129,52 @@ void Area2DSW::set_space_override_mode(PhysicsServer2D::AreaSpaceOverrideMode p_
void Area2DSW::set_param(PhysicsServer2D::AreaParameter p_param, const Variant &p_value) {
switch (p_param) {
case PhysicsServer2D::AREA_PARAM_GRAVITY: gravity = p_value; break;
case PhysicsServer2D::AREA_PARAM_GRAVITY_VECTOR: gravity_vector = p_value; break;
case PhysicsServer2D::AREA_PARAM_GRAVITY_IS_POINT: gravity_is_point = p_value; break;
case PhysicsServer2D::AREA_PARAM_GRAVITY_DISTANCE_SCALE: gravity_distance_scale = p_value; break;
case PhysicsServer2D::AREA_PARAM_GRAVITY_POINT_ATTENUATION: point_attenuation = p_value; break;
case PhysicsServer2D::AREA_PARAM_LINEAR_DAMP: linear_damp = p_value; break;
case PhysicsServer2D::AREA_PARAM_ANGULAR_DAMP: angular_damp = p_value; break;
case PhysicsServer2D::AREA_PARAM_PRIORITY: priority = p_value; break;
case PhysicsServer2D::AREA_PARAM_GRAVITY:
gravity = p_value;
break;
case PhysicsServer2D::AREA_PARAM_GRAVITY_VECTOR:
gravity_vector = p_value;
break;
case PhysicsServer2D::AREA_PARAM_GRAVITY_IS_POINT:
gravity_is_point = p_value;
break;
case PhysicsServer2D::AREA_PARAM_GRAVITY_DISTANCE_SCALE:
gravity_distance_scale = p_value;
break;
case PhysicsServer2D::AREA_PARAM_GRAVITY_POINT_ATTENUATION:
point_attenuation = p_value;
break;
case PhysicsServer2D::AREA_PARAM_LINEAR_DAMP:
linear_damp = p_value;
break;
case PhysicsServer2D::AREA_PARAM_ANGULAR_DAMP:
angular_damp = p_value;
break;
case PhysicsServer2D::AREA_PARAM_PRIORITY:
priority = p_value;
break;
}
}
Variant Area2DSW::get_param(PhysicsServer2D::AreaParameter p_param) const {
switch (p_param) {
case PhysicsServer2D::AREA_PARAM_GRAVITY: return gravity;
case PhysicsServer2D::AREA_PARAM_GRAVITY_VECTOR: return gravity_vector;
case PhysicsServer2D::AREA_PARAM_GRAVITY_IS_POINT: return gravity_is_point;
case PhysicsServer2D::AREA_PARAM_GRAVITY_DISTANCE_SCALE: return gravity_distance_scale;
case PhysicsServer2D::AREA_PARAM_GRAVITY_POINT_ATTENUATION: return point_attenuation;
case PhysicsServer2D::AREA_PARAM_LINEAR_DAMP: return linear_damp;
case PhysicsServer2D::AREA_PARAM_ANGULAR_DAMP: return angular_damp;
case PhysicsServer2D::AREA_PARAM_PRIORITY: return priority;
case PhysicsServer2D::AREA_PARAM_GRAVITY:
return gravity;
case PhysicsServer2D::AREA_PARAM_GRAVITY_VECTOR:
return gravity_vector;
case PhysicsServer2D::AREA_PARAM_GRAVITY_IS_POINT:
return gravity_is_point;
case PhysicsServer2D::AREA_PARAM_GRAVITY_DISTANCE_SCALE:
return gravity_distance_scale;
case PhysicsServer2D::AREA_PARAM_GRAVITY_POINT_ATTENUATION:
return point_attenuation;
case PhysicsServer2D::AREA_PARAM_LINEAR_DAMP:
return linear_damp;
case PhysicsServer2D::AREA_PARAM_ANGULAR_DAMP:
return angular_damp;
case PhysicsServer2D::AREA_PARAM_PRIORITY:
return priority;
}
return Variant();

View File

@ -1091,9 +1091,15 @@ void PhysicsServer2DSW::joint_set_param(RID p_joint, JointParam p_param, real_t
ERR_FAIL_COND(!joint);
switch (p_param) {
case JOINT_PARAM_BIAS: joint->set_bias(p_value); break;
case JOINT_PARAM_MAX_BIAS: joint->set_max_bias(p_value); break;
case JOINT_PARAM_MAX_FORCE: joint->set_max_force(p_value); break;
case JOINT_PARAM_BIAS:
joint->set_bias(p_value);
break;
case JOINT_PARAM_MAX_BIAS:
joint->set_max_bias(p_value);
break;
case JOINT_PARAM_MAX_FORCE:
joint->set_max_force(p_value);
break;
}
}
@ -1103,9 +1109,15 @@ real_t PhysicsServer2DSW::joint_get_param(RID p_joint, JointParam p_param) const
ERR_FAIL_COND_V(!joint, -1);
switch (p_param) {
case JOINT_PARAM_BIAS: return joint->get_bias(); break;
case JOINT_PARAM_MAX_BIAS: return joint->get_max_bias(); break;
case JOINT_PARAM_MAX_FORCE: return joint->get_max_force(); break;
case JOINT_PARAM_BIAS:
return joint->get_bias();
break;
case JOINT_PARAM_MAX_BIAS:
return joint->get_max_bias();
break;
case JOINT_PARAM_MAX_FORCE:
return joint->get_max_force();
break;
}
return 0;

View File

@ -1281,14 +1281,30 @@ void Space2DSW::set_param(PhysicsServer2D::SpaceParameter p_param, real_t p_valu
switch (p_param) {
case PhysicsServer2D::SPACE_PARAM_CONTACT_RECYCLE_RADIUS: contact_recycle_radius = p_value; break;
case PhysicsServer2D::SPACE_PARAM_CONTACT_MAX_SEPARATION: contact_max_separation = p_value; break;
case PhysicsServer2D::SPACE_PARAM_BODY_MAX_ALLOWED_PENETRATION: contact_max_allowed_penetration = p_value; break;
case PhysicsServer2D::SPACE_PARAM_BODY_LINEAR_VELOCITY_SLEEP_THRESHOLD: body_linear_velocity_sleep_threshold = p_value; break;
case PhysicsServer2D::SPACE_PARAM_BODY_ANGULAR_VELOCITY_SLEEP_THRESHOLD: body_angular_velocity_sleep_threshold = p_value; break;
case PhysicsServer2D::SPACE_PARAM_BODY_TIME_TO_SLEEP: body_time_to_sleep = p_value; break;
case PhysicsServer2D::SPACE_PARAM_CONSTRAINT_DEFAULT_BIAS: constraint_bias = p_value; break;
case PhysicsServer2D::SPACE_PARAM_TEST_MOTION_MIN_CONTACT_DEPTH: test_motion_min_contact_depth = p_value; break;
case PhysicsServer2D::SPACE_PARAM_CONTACT_RECYCLE_RADIUS:
contact_recycle_radius = p_value;
break;
case PhysicsServer2D::SPACE_PARAM_CONTACT_MAX_SEPARATION:
contact_max_separation = p_value;
break;
case PhysicsServer2D::SPACE_PARAM_BODY_MAX_ALLOWED_PENETRATION:
contact_max_allowed_penetration = p_value;
break;
case PhysicsServer2D::SPACE_PARAM_BODY_LINEAR_VELOCITY_SLEEP_THRESHOLD:
body_linear_velocity_sleep_threshold = p_value;
break;
case PhysicsServer2D::SPACE_PARAM_BODY_ANGULAR_VELOCITY_SLEEP_THRESHOLD:
body_angular_velocity_sleep_threshold = p_value;
break;
case PhysicsServer2D::SPACE_PARAM_BODY_TIME_TO_SLEEP:
body_time_to_sleep = p_value;
break;
case PhysicsServer2D::SPACE_PARAM_CONSTRAINT_DEFAULT_BIAS:
constraint_bias = p_value;
break;
case PhysicsServer2D::SPACE_PARAM_TEST_MOTION_MIN_CONTACT_DEPTH:
test_motion_min_contact_depth = p_value;
break;
}
}
@ -1296,14 +1312,22 @@ real_t Space2DSW::get_param(PhysicsServer2D::SpaceParameter p_param) const {
switch (p_param) {
case PhysicsServer2D::SPACE_PARAM_CONTACT_RECYCLE_RADIUS: return contact_recycle_radius;
case PhysicsServer2D::SPACE_PARAM_CONTACT_MAX_SEPARATION: return contact_max_separation;
case PhysicsServer2D::SPACE_PARAM_BODY_MAX_ALLOWED_PENETRATION: return contact_max_allowed_penetration;
case PhysicsServer2D::SPACE_PARAM_BODY_LINEAR_VELOCITY_SLEEP_THRESHOLD: return body_linear_velocity_sleep_threshold;
case PhysicsServer2D::SPACE_PARAM_BODY_ANGULAR_VELOCITY_SLEEP_THRESHOLD: return body_angular_velocity_sleep_threshold;
case PhysicsServer2D::SPACE_PARAM_BODY_TIME_TO_SLEEP: return body_time_to_sleep;
case PhysicsServer2D::SPACE_PARAM_CONSTRAINT_DEFAULT_BIAS: return constraint_bias;
case PhysicsServer2D::SPACE_PARAM_TEST_MOTION_MIN_CONTACT_DEPTH: return test_motion_min_contact_depth;
case PhysicsServer2D::SPACE_PARAM_CONTACT_RECYCLE_RADIUS:
return contact_recycle_radius;
case PhysicsServer2D::SPACE_PARAM_CONTACT_MAX_SEPARATION:
return contact_max_separation;
case PhysicsServer2D::SPACE_PARAM_BODY_MAX_ALLOWED_PENETRATION:
return contact_max_allowed_penetration;
case PhysicsServer2D::SPACE_PARAM_BODY_LINEAR_VELOCITY_SLEEP_THRESHOLD:
return body_linear_velocity_sleep_threshold;
case PhysicsServer2D::SPACE_PARAM_BODY_ANGULAR_VELOCITY_SLEEP_THRESHOLD:
return body_angular_velocity_sleep_threshold;
case PhysicsServer2D::SPACE_PARAM_BODY_TIME_TO_SLEEP:
return body_time_to_sleep;
case PhysicsServer2D::SPACE_PARAM_CONSTRAINT_DEFAULT_BIAS:
return constraint_bias;
case PhysicsServer2D::SPACE_PARAM_TEST_MOTION_MIN_CONTACT_DEPTH:
return test_motion_min_contact_depth;
}
return 0;
}

View File

@ -129,28 +129,52 @@ void Area3DSW::set_space_override_mode(PhysicsServer3D::AreaSpaceOverrideMode p_
void Area3DSW::set_param(PhysicsServer3D::AreaParameter p_param, const Variant &p_value) {
switch (p_param) {
case PhysicsServer3D::AREA_PARAM_GRAVITY: gravity = p_value; break;
case PhysicsServer3D::AREA_PARAM_GRAVITY_VECTOR: gravity_vector = p_value; break;
case PhysicsServer3D::AREA_PARAM_GRAVITY_IS_POINT: gravity_is_point = p_value; break;
case PhysicsServer3D::AREA_PARAM_GRAVITY_DISTANCE_SCALE: gravity_distance_scale = p_value; break;
case PhysicsServer3D::AREA_PARAM_GRAVITY_POINT_ATTENUATION: point_attenuation = p_value; break;
case PhysicsServer3D::AREA_PARAM_LINEAR_DAMP: linear_damp = p_value; break;
case PhysicsServer3D::AREA_PARAM_ANGULAR_DAMP: angular_damp = p_value; break;
case PhysicsServer3D::AREA_PARAM_PRIORITY: priority = p_value; break;
case PhysicsServer3D::AREA_PARAM_GRAVITY:
gravity = p_value;
break;
case PhysicsServer3D::AREA_PARAM_GRAVITY_VECTOR:
gravity_vector = p_value;
break;
case PhysicsServer3D::AREA_PARAM_GRAVITY_IS_POINT:
gravity_is_point = p_value;
break;
case PhysicsServer3D::AREA_PARAM_GRAVITY_DISTANCE_SCALE:
gravity_distance_scale = p_value;
break;
case PhysicsServer3D::AREA_PARAM_GRAVITY_POINT_ATTENUATION:
point_attenuation = p_value;
break;
case PhysicsServer3D::AREA_PARAM_LINEAR_DAMP:
linear_damp = p_value;
break;
case PhysicsServer3D::AREA_PARAM_ANGULAR_DAMP:
angular_damp = p_value;
break;
case PhysicsServer3D::AREA_PARAM_PRIORITY:
priority = p_value;
break;
}
}
Variant Area3DSW::get_param(PhysicsServer3D::AreaParameter p_param) const {
switch (p_param) {
case PhysicsServer3D::AREA_PARAM_GRAVITY: return gravity;
case PhysicsServer3D::AREA_PARAM_GRAVITY_VECTOR: return gravity_vector;
case PhysicsServer3D::AREA_PARAM_GRAVITY_IS_POINT: return gravity_is_point;
case PhysicsServer3D::AREA_PARAM_GRAVITY_DISTANCE_SCALE: return gravity_distance_scale;
case PhysicsServer3D::AREA_PARAM_GRAVITY_POINT_ATTENUATION: return point_attenuation;
case PhysicsServer3D::AREA_PARAM_LINEAR_DAMP: return linear_damp;
case PhysicsServer3D::AREA_PARAM_ANGULAR_DAMP: return angular_damp;
case PhysicsServer3D::AREA_PARAM_PRIORITY: return priority;
case PhysicsServer3D::AREA_PARAM_GRAVITY:
return gravity;
case PhysicsServer3D::AREA_PARAM_GRAVITY_VECTOR:
return gravity_vector;
case PhysicsServer3D::AREA_PARAM_GRAVITY_IS_POINT:
return gravity_is_point;
case PhysicsServer3D::AREA_PARAM_GRAVITY_DISTANCE_SCALE:
return gravity_distance_scale;
case PhysicsServer3D::AREA_PARAM_GRAVITY_POINT_ATTENUATION:
return point_attenuation;
case PhysicsServer3D::AREA_PARAM_LINEAR_DAMP:
return linear_damp;
case PhysicsServer3D::AREA_PARAM_ANGULAR_DAMP:
return angular_damp;
case PhysicsServer3D::AREA_PARAM_PRIORITY:
return priority;
}
return Variant();

View File

@ -332,7 +332,8 @@ void ConeTwistJoint3DSW::set_param(PhysicsServer3D::ConeTwistJointParam p_param,
m_relaxationFactor = p_value;
} break;
case PhysicsServer3D::CONE_TWIST_MAX: break; // Can't happen, but silences warning
case PhysicsServer3D::CONE_TWIST_MAX:
break; // Can't happen, but silences warning
}
}
@ -359,7 +360,8 @@ real_t ConeTwistJoint3DSW::get_param(PhysicsServer3D::ConeTwistJointParam p_para
return m_relaxationFactor;
} break;
case PhysicsServer3D::CONE_TWIST_MAX: break; // Can't happen, but silences warning
case PhysicsServer3D::CONE_TWIST_MAX:
break; // Can't happen, but silences warning
}
return 0;

View File

@ -522,7 +522,8 @@ void Generic6DOFJoint3DSW::set_param(Vector3::Axis p_axis, PhysicsServer3D::G6DO
case PhysicsServer3D::G6DOF_JOINT_ANGULAR_SPRING_EQUILIBRIUM_POINT: {
// Not implemented in GodotPhysics3D backend
} break;
case PhysicsServer3D::G6DOF_JOINT_MAX: break; // Can't happen, but silences warning
case PhysicsServer3D::G6DOF_JOINT_MAX:
break; // Can't happen, but silences warning
}
}
@ -622,7 +623,8 @@ real_t Generic6DOFJoint3DSW::get_param(Vector3::Axis p_axis, PhysicsServer3D::G6
case PhysicsServer3D::G6DOF_JOINT_ANGULAR_SPRING_EQUILIBRIUM_POINT: {
// Not implemented in GodotPhysics3D backend
} break;
case PhysicsServer3D::G6DOF_JOINT_MAX: break; // Can't happen, but silences warning
case PhysicsServer3D::G6DOF_JOINT_MAX:
break; // Can't happen, but silences warning
}
return 0;
}
@ -653,7 +655,8 @@ void Generic6DOFJoint3DSW::set_flag(Vector3::Axis p_axis, PhysicsServer3D::G6DOF
case PhysicsServer3D::G6DOF_JOINT_FLAG_ENABLE_ANGULAR_SPRING: {
// Not implemented in GodotPhysics3D backend
} break;
case PhysicsServer3D::G6DOF_JOINT_FLAG_MAX: break; // Can't happen, but silences warning
case PhysicsServer3D::G6DOF_JOINT_FLAG_MAX:
break; // Can't happen, but silences warning
}
}
bool Generic6DOFJoint3DSW::get_flag(Vector3::Axis p_axis, PhysicsServer3D::G6DOFJointAxisFlag p_flag) const {
@ -681,7 +684,8 @@ bool Generic6DOFJoint3DSW::get_flag(Vector3::Axis p_axis, PhysicsServer3D::G6DOF
case PhysicsServer3D::G6DOF_JOINT_FLAG_ENABLE_ANGULAR_SPRING: {
// Not implemented in GodotPhysics3D backend
} break;
case PhysicsServer3D::G6DOF_JOINT_FLAG_MAX: break; // Can't happen, but silences warning
case PhysicsServer3D::G6DOF_JOINT_FLAG_MAX:
break; // Can't happen, but silences warning
}
return 0;

View File

@ -400,15 +400,32 @@ void HingeJoint3DSW::set_param(PhysicsServer3D::HingeJointParam p_param, real_t
switch (p_param) {
case PhysicsServer3D::HINGE_JOINT_BIAS: tau = p_value; break;
case PhysicsServer3D::HINGE_JOINT_LIMIT_UPPER: m_upperLimit = p_value; break;
case PhysicsServer3D::HINGE_JOINT_LIMIT_LOWER: m_lowerLimit = p_value; break;
case PhysicsServer3D::HINGE_JOINT_LIMIT_BIAS: m_biasFactor = p_value; break;
case PhysicsServer3D::HINGE_JOINT_LIMIT_SOFTNESS: m_limitSoftness = p_value; break;
case PhysicsServer3D::HINGE_JOINT_LIMIT_RELAXATION: m_relaxationFactor = p_value; break;
case PhysicsServer3D::HINGE_JOINT_MOTOR_TARGET_VELOCITY: m_motorTargetVelocity = p_value; break;
case PhysicsServer3D::HINGE_JOINT_MOTOR_MAX_IMPULSE: m_maxMotorImpulse = p_value; break;
case PhysicsServer3D::HINGE_JOINT_MAX: break; // Can't happen, but silences warning
case PhysicsServer3D::HINGE_JOINT_BIAS:
tau = p_value;
break;
case PhysicsServer3D::HINGE_JOINT_LIMIT_UPPER:
m_upperLimit = p_value;
break;
case PhysicsServer3D::HINGE_JOINT_LIMIT_LOWER:
m_lowerLimit = p_value;
break;
case PhysicsServer3D::HINGE_JOINT_LIMIT_BIAS:
m_biasFactor = p_value;
break;
case PhysicsServer3D::HINGE_JOINT_LIMIT_SOFTNESS:
m_limitSoftness = p_value;
break;
case PhysicsServer3D::HINGE_JOINT_LIMIT_RELAXATION:
m_relaxationFactor = p_value;
break;
case PhysicsServer3D::HINGE_JOINT_MOTOR_TARGET_VELOCITY:
m_motorTargetVelocity = p_value;
break;
case PhysicsServer3D::HINGE_JOINT_MOTOR_MAX_IMPULSE:
m_maxMotorImpulse = p_value;
break;
case PhysicsServer3D::HINGE_JOINT_MAX:
break; // Can't happen, but silences warning
}
}
@ -416,15 +433,24 @@ real_t HingeJoint3DSW::get_param(PhysicsServer3D::HingeJointParam p_param) const
switch (p_param) {
case PhysicsServer3D::HINGE_JOINT_BIAS: return tau;
case PhysicsServer3D::HINGE_JOINT_LIMIT_UPPER: return m_upperLimit;
case PhysicsServer3D::HINGE_JOINT_LIMIT_LOWER: return m_lowerLimit;
case PhysicsServer3D::HINGE_JOINT_LIMIT_BIAS: return m_biasFactor;
case PhysicsServer3D::HINGE_JOINT_LIMIT_SOFTNESS: return m_limitSoftness;
case PhysicsServer3D::HINGE_JOINT_LIMIT_RELAXATION: return m_relaxationFactor;
case PhysicsServer3D::HINGE_JOINT_MOTOR_TARGET_VELOCITY: return m_motorTargetVelocity;
case PhysicsServer3D::HINGE_JOINT_MOTOR_MAX_IMPULSE: return m_maxMotorImpulse;
case PhysicsServer3D::HINGE_JOINT_MAX: break; // Can't happen, but silences warning
case PhysicsServer3D::HINGE_JOINT_BIAS:
return tau;
case PhysicsServer3D::HINGE_JOINT_LIMIT_UPPER:
return m_upperLimit;
case PhysicsServer3D::HINGE_JOINT_LIMIT_LOWER:
return m_lowerLimit;
case PhysicsServer3D::HINGE_JOINT_LIMIT_BIAS:
return m_biasFactor;
case PhysicsServer3D::HINGE_JOINT_LIMIT_SOFTNESS:
return m_limitSoftness;
case PhysicsServer3D::HINGE_JOINT_LIMIT_RELAXATION:
return m_relaxationFactor;
case PhysicsServer3D::HINGE_JOINT_MOTOR_TARGET_VELOCITY:
return m_motorTargetVelocity;
case PhysicsServer3D::HINGE_JOINT_MOTOR_MAX_IMPULSE:
return m_maxMotorImpulse;
case PhysicsServer3D::HINGE_JOINT_MAX:
break; // Can't happen, but silences warning
}
return 0;
@ -433,17 +459,25 @@ real_t HingeJoint3DSW::get_param(PhysicsServer3D::HingeJointParam p_param) const
void HingeJoint3DSW::set_flag(PhysicsServer3D::HingeJointFlag p_flag, bool p_value) {
switch (p_flag) {
case PhysicsServer3D::HINGE_JOINT_FLAG_USE_LIMIT: m_useLimit = p_value; break;
case PhysicsServer3D::HINGE_JOINT_FLAG_ENABLE_MOTOR: m_enableAngularMotor = p_value; break;
case PhysicsServer3D::HINGE_JOINT_FLAG_MAX: break; // Can't happen, but silences warning
case PhysicsServer3D::HINGE_JOINT_FLAG_USE_LIMIT:
m_useLimit = p_value;
break;
case PhysicsServer3D::HINGE_JOINT_FLAG_ENABLE_MOTOR:
m_enableAngularMotor = p_value;
break;
case PhysicsServer3D::HINGE_JOINT_FLAG_MAX:
break; // Can't happen, but silences warning
}
}
bool HingeJoint3DSW::get_flag(PhysicsServer3D::HingeJointFlag p_flag) const {
switch (p_flag) {
case PhysicsServer3D::HINGE_JOINT_FLAG_USE_LIMIT: return m_useLimit;
case PhysicsServer3D::HINGE_JOINT_FLAG_ENABLE_MOTOR: return m_enableAngularMotor;
case PhysicsServer3D::HINGE_JOINT_FLAG_MAX: break; // Can't happen, but silences warning
case PhysicsServer3D::HINGE_JOINT_FLAG_USE_LIMIT:
return m_useLimit;
case PhysicsServer3D::HINGE_JOINT_FLAG_ENABLE_MOTOR:
return m_enableAngularMotor;
case PhysicsServer3D::HINGE_JOINT_FLAG_MAX:
break; // Can't happen, but silences warning
}
return false;

View File

@ -129,18 +129,27 @@ void PinJoint3DSW::solve(real_t p_step) {
void PinJoint3DSW::set_param(PhysicsServer3D::PinJointParam p_param, real_t p_value) {
switch (p_param) {
case PhysicsServer3D::PIN_JOINT_BIAS: m_tau = p_value; break;
case PhysicsServer3D::PIN_JOINT_DAMPING: m_damping = p_value; break;
case PhysicsServer3D::PIN_JOINT_IMPULSE_CLAMP: m_impulseClamp = p_value; break;
case PhysicsServer3D::PIN_JOINT_BIAS:
m_tau = p_value;
break;
case PhysicsServer3D::PIN_JOINT_DAMPING:
m_damping = p_value;
break;
case PhysicsServer3D::PIN_JOINT_IMPULSE_CLAMP:
m_impulseClamp = p_value;
break;
}
}
real_t PinJoint3DSW::get_param(PhysicsServer3D::PinJointParam p_param) const {
switch (p_param) {
case PhysicsServer3D::PIN_JOINT_BIAS: return m_tau;
case PhysicsServer3D::PIN_JOINT_DAMPING: return m_damping;
case PhysicsServer3D::PIN_JOINT_IMPULSE_CLAMP: return m_impulseClamp;
case PhysicsServer3D::PIN_JOINT_BIAS:
return m_tau;
case PhysicsServer3D::PIN_JOINT_DAMPING:
return m_damping;
case PhysicsServer3D::PIN_JOINT_IMPULSE_CLAMP:
return m_impulseClamp;
}
return 0;

View File

@ -381,62 +381,130 @@ Vector3 SliderJoint3DSW::getAncorInB(void) {
void SliderJoint3DSW::set_param(PhysicsServer3D::SliderJointParam p_param, real_t p_value) {
switch (p_param) {
case PhysicsServer3D::SLIDER_JOINT_LINEAR_LIMIT_UPPER: m_upperLinLimit = p_value; break;
case PhysicsServer3D::SLIDER_JOINT_LINEAR_LIMIT_LOWER: m_lowerLinLimit = p_value; break;
case PhysicsServer3D::SLIDER_JOINT_LINEAR_LIMIT_SOFTNESS: m_softnessLimLin = p_value; break;
case PhysicsServer3D::SLIDER_JOINT_LINEAR_LIMIT_RESTITUTION: m_restitutionLimLin = p_value; break;
case PhysicsServer3D::SLIDER_JOINT_LINEAR_LIMIT_DAMPING: m_dampingLimLin = p_value; break;
case PhysicsServer3D::SLIDER_JOINT_LINEAR_MOTION_SOFTNESS: m_softnessDirLin = p_value; break;
case PhysicsServer3D::SLIDER_JOINT_LINEAR_MOTION_RESTITUTION: m_restitutionDirLin = p_value; break;
case PhysicsServer3D::SLIDER_JOINT_LINEAR_MOTION_DAMPING: m_dampingDirLin = p_value; break;
case PhysicsServer3D::SLIDER_JOINT_LINEAR_ORTHOGONAL_SOFTNESS: m_softnessOrthoLin = p_value; break;
case PhysicsServer3D::SLIDER_JOINT_LINEAR_ORTHOGONAL_RESTITUTION: m_restitutionOrthoLin = p_value; break;
case PhysicsServer3D::SLIDER_JOINT_LINEAR_ORTHOGONAL_DAMPING: m_dampingOrthoLin = p_value; break;
case PhysicsServer3D::SLIDER_JOINT_LINEAR_LIMIT_UPPER:
m_upperLinLimit = p_value;
break;
case PhysicsServer3D::SLIDER_JOINT_LINEAR_LIMIT_LOWER:
m_lowerLinLimit = p_value;
break;
case PhysicsServer3D::SLIDER_JOINT_LINEAR_LIMIT_SOFTNESS:
m_softnessLimLin = p_value;
break;
case PhysicsServer3D::SLIDER_JOINT_LINEAR_LIMIT_RESTITUTION:
m_restitutionLimLin = p_value;
break;
case PhysicsServer3D::SLIDER_JOINT_LINEAR_LIMIT_DAMPING:
m_dampingLimLin = p_value;
break;
case PhysicsServer3D::SLIDER_JOINT_LINEAR_MOTION_SOFTNESS:
m_softnessDirLin = p_value;
break;
case PhysicsServer3D::SLIDER_JOINT_LINEAR_MOTION_RESTITUTION:
m_restitutionDirLin = p_value;
break;
case PhysicsServer3D::SLIDER_JOINT_LINEAR_MOTION_DAMPING:
m_dampingDirLin = p_value;
break;
case PhysicsServer3D::SLIDER_JOINT_LINEAR_ORTHOGONAL_SOFTNESS:
m_softnessOrthoLin = p_value;
break;
case PhysicsServer3D::SLIDER_JOINT_LINEAR_ORTHOGONAL_RESTITUTION:
m_restitutionOrthoLin = p_value;
break;
case PhysicsServer3D::SLIDER_JOINT_LINEAR_ORTHOGONAL_DAMPING:
m_dampingOrthoLin = p_value;
break;
case PhysicsServer3D::SLIDER_JOINT_ANGULAR_LIMIT_UPPER: m_upperAngLimit = p_value; break;
case PhysicsServer3D::SLIDER_JOINT_ANGULAR_LIMIT_LOWER: m_lowerAngLimit = p_value; break;
case PhysicsServer3D::SLIDER_JOINT_ANGULAR_LIMIT_SOFTNESS: m_softnessLimAng = p_value; break;
case PhysicsServer3D::SLIDER_JOINT_ANGULAR_LIMIT_RESTITUTION: m_restitutionLimAng = p_value; break;
case PhysicsServer3D::SLIDER_JOINT_ANGULAR_LIMIT_DAMPING: m_dampingLimAng = p_value; break;
case PhysicsServer3D::SLIDER_JOINT_ANGULAR_MOTION_SOFTNESS: m_softnessDirAng = p_value; break;
case PhysicsServer3D::SLIDER_JOINT_ANGULAR_MOTION_RESTITUTION: m_restitutionDirAng = p_value; break;
case PhysicsServer3D::SLIDER_JOINT_ANGULAR_MOTION_DAMPING: m_dampingDirAng = p_value; break;
case PhysicsServer3D::SLIDER_JOINT_ANGULAR_ORTHOGONAL_SOFTNESS: m_softnessOrthoAng = p_value; break;
case PhysicsServer3D::SLIDER_JOINT_ANGULAR_ORTHOGONAL_RESTITUTION: m_restitutionOrthoAng = p_value; break;
case PhysicsServer3D::SLIDER_JOINT_ANGULAR_ORTHOGONAL_DAMPING: m_dampingOrthoAng = p_value; break;
case PhysicsServer3D::SLIDER_JOINT_ANGULAR_LIMIT_UPPER:
m_upperAngLimit = p_value;
break;
case PhysicsServer3D::SLIDER_JOINT_ANGULAR_LIMIT_LOWER:
m_lowerAngLimit = p_value;
break;
case PhysicsServer3D::SLIDER_JOINT_ANGULAR_LIMIT_SOFTNESS:
m_softnessLimAng = p_value;
break;
case PhysicsServer3D::SLIDER_JOINT_ANGULAR_LIMIT_RESTITUTION:
m_restitutionLimAng = p_value;
break;
case PhysicsServer3D::SLIDER_JOINT_ANGULAR_LIMIT_DAMPING:
m_dampingLimAng = p_value;
break;
case PhysicsServer3D::SLIDER_JOINT_ANGULAR_MOTION_SOFTNESS:
m_softnessDirAng = p_value;
break;
case PhysicsServer3D::SLIDER_JOINT_ANGULAR_MOTION_RESTITUTION:
m_restitutionDirAng = p_value;
break;
case PhysicsServer3D::SLIDER_JOINT_ANGULAR_MOTION_DAMPING:
m_dampingDirAng = p_value;
break;
case PhysicsServer3D::SLIDER_JOINT_ANGULAR_ORTHOGONAL_SOFTNESS:
m_softnessOrthoAng = p_value;
break;
case PhysicsServer3D::SLIDER_JOINT_ANGULAR_ORTHOGONAL_RESTITUTION:
m_restitutionOrthoAng = p_value;
break;
case PhysicsServer3D::SLIDER_JOINT_ANGULAR_ORTHOGONAL_DAMPING:
m_dampingOrthoAng = p_value;
break;
case PhysicsServer3D::SLIDER_JOINT_MAX: break; // Can't happen, but silences warning
case PhysicsServer3D::SLIDER_JOINT_MAX:
break; // Can't happen, but silences warning
}
}
real_t SliderJoint3DSW::get_param(PhysicsServer3D::SliderJointParam p_param) const {
switch (p_param) {
case PhysicsServer3D::SLIDER_JOINT_LINEAR_LIMIT_UPPER: return m_upperLinLimit;
case PhysicsServer3D::SLIDER_JOINT_LINEAR_LIMIT_LOWER: return m_lowerLinLimit;
case PhysicsServer3D::SLIDER_JOINT_LINEAR_LIMIT_SOFTNESS: return m_softnessLimLin;
case PhysicsServer3D::SLIDER_JOINT_LINEAR_LIMIT_RESTITUTION: return m_restitutionLimLin;
case PhysicsServer3D::SLIDER_JOINT_LINEAR_LIMIT_DAMPING: return m_dampingLimLin;
case PhysicsServer3D::SLIDER_JOINT_LINEAR_MOTION_SOFTNESS: return m_softnessDirLin;
case PhysicsServer3D::SLIDER_JOINT_LINEAR_MOTION_RESTITUTION: return m_restitutionDirLin;
case PhysicsServer3D::SLIDER_JOINT_LINEAR_MOTION_DAMPING: return m_dampingDirLin;
case PhysicsServer3D::SLIDER_JOINT_LINEAR_ORTHOGONAL_SOFTNESS: return m_softnessOrthoLin;
case PhysicsServer3D::SLIDER_JOINT_LINEAR_ORTHOGONAL_RESTITUTION: return m_restitutionOrthoLin;
case PhysicsServer3D::SLIDER_JOINT_LINEAR_ORTHOGONAL_DAMPING: return m_dampingOrthoLin;
case PhysicsServer3D::SLIDER_JOINT_LINEAR_LIMIT_UPPER:
return m_upperLinLimit;
case PhysicsServer3D::SLIDER_JOINT_LINEAR_LIMIT_LOWER:
return m_lowerLinLimit;
case PhysicsServer3D::SLIDER_JOINT_LINEAR_LIMIT_SOFTNESS:
return m_softnessLimLin;
case PhysicsServer3D::SLIDER_JOINT_LINEAR_LIMIT_RESTITUTION:
return m_restitutionLimLin;
case PhysicsServer3D::SLIDER_JOINT_LINEAR_LIMIT_DAMPING:
return m_dampingLimLin;
case PhysicsServer3D::SLIDER_JOINT_LINEAR_MOTION_SOFTNESS:
return m_softnessDirLin;
case PhysicsServer3D::SLIDER_JOINT_LINEAR_MOTION_RESTITUTION:
return m_restitutionDirLin;
case PhysicsServer3D::SLIDER_JOINT_LINEAR_MOTION_DAMPING:
return m_dampingDirLin;
case PhysicsServer3D::SLIDER_JOINT_LINEAR_ORTHOGONAL_SOFTNESS:
return m_softnessOrthoLin;
case PhysicsServer3D::SLIDER_JOINT_LINEAR_ORTHOGONAL_RESTITUTION:
return m_restitutionOrthoLin;
case PhysicsServer3D::SLIDER_JOINT_LINEAR_ORTHOGONAL_DAMPING:
return m_dampingOrthoLin;
case PhysicsServer3D::SLIDER_JOINT_ANGULAR_LIMIT_UPPER: return m_upperAngLimit;
case PhysicsServer3D::SLIDER_JOINT_ANGULAR_LIMIT_LOWER: return m_lowerAngLimit;
case PhysicsServer3D::SLIDER_JOINT_ANGULAR_LIMIT_SOFTNESS: return m_softnessLimAng;
case PhysicsServer3D::SLIDER_JOINT_ANGULAR_LIMIT_RESTITUTION: return m_restitutionLimAng;
case PhysicsServer3D::SLIDER_JOINT_ANGULAR_LIMIT_DAMPING: return m_dampingLimAng;
case PhysicsServer3D::SLIDER_JOINT_ANGULAR_MOTION_SOFTNESS: return m_softnessDirAng;
case PhysicsServer3D::SLIDER_JOINT_ANGULAR_MOTION_RESTITUTION: return m_restitutionDirAng;
case PhysicsServer3D::SLIDER_JOINT_ANGULAR_MOTION_DAMPING: return m_dampingDirAng;
case PhysicsServer3D::SLIDER_JOINT_ANGULAR_ORTHOGONAL_SOFTNESS: return m_softnessOrthoAng;
case PhysicsServer3D::SLIDER_JOINT_ANGULAR_ORTHOGONAL_RESTITUTION: return m_restitutionOrthoAng;
case PhysicsServer3D::SLIDER_JOINT_ANGULAR_ORTHOGONAL_DAMPING: return m_dampingOrthoAng;
case PhysicsServer3D::SLIDER_JOINT_ANGULAR_LIMIT_UPPER:
return m_upperAngLimit;
case PhysicsServer3D::SLIDER_JOINT_ANGULAR_LIMIT_LOWER:
return m_lowerAngLimit;
case PhysicsServer3D::SLIDER_JOINT_ANGULAR_LIMIT_SOFTNESS:
return m_softnessLimAng;
case PhysicsServer3D::SLIDER_JOINT_ANGULAR_LIMIT_RESTITUTION:
return m_restitutionLimAng;
case PhysicsServer3D::SLIDER_JOINT_ANGULAR_LIMIT_DAMPING:
return m_dampingLimAng;
case PhysicsServer3D::SLIDER_JOINT_ANGULAR_MOTION_SOFTNESS:
return m_softnessDirAng;
case PhysicsServer3D::SLIDER_JOINT_ANGULAR_MOTION_RESTITUTION:
return m_restitutionDirAng;
case PhysicsServer3D::SLIDER_JOINT_ANGULAR_MOTION_DAMPING:
return m_dampingDirAng;
case PhysicsServer3D::SLIDER_JOINT_ANGULAR_ORTHOGONAL_SOFTNESS:
return m_softnessOrthoAng;
case PhysicsServer3D::SLIDER_JOINT_ANGULAR_ORTHOGONAL_RESTITUTION:
return m_restitutionOrthoAng;
case PhysicsServer3D::SLIDER_JOINT_ANGULAR_ORTHOGONAL_DAMPING:
return m_dampingOrthoAng;
case PhysicsServer3D::SLIDER_JOINT_MAX: break; // Can't happen, but silences warning
case PhysicsServer3D::SLIDER_JOINT_MAX:
break; // Can't happen, but silences warning
}
return 0;

View File

@ -1154,15 +1154,33 @@ void Space3DSW::set_param(PhysicsServer3D::SpaceParameter p_param, real_t p_valu
switch (p_param) {
case PhysicsServer3D::SPACE_PARAM_CONTACT_RECYCLE_RADIUS: contact_recycle_radius = p_value; break;
case PhysicsServer3D::SPACE_PARAM_CONTACT_MAX_SEPARATION: contact_max_separation = p_value; break;
case PhysicsServer3D::SPACE_PARAM_BODY_MAX_ALLOWED_PENETRATION: contact_max_allowed_penetration = p_value; break;
case PhysicsServer3D::SPACE_PARAM_BODY_LINEAR_VELOCITY_SLEEP_THRESHOLD: body_linear_velocity_sleep_threshold = p_value; break;
case PhysicsServer3D::SPACE_PARAM_BODY_ANGULAR_VELOCITY_SLEEP_THRESHOLD: body_angular_velocity_sleep_threshold = p_value; break;
case PhysicsServer3D::SPACE_PARAM_BODY_TIME_TO_SLEEP: body_time_to_sleep = p_value; break;
case PhysicsServer3D::SPACE_PARAM_BODY_ANGULAR_VELOCITY_DAMP_RATIO: body_angular_velocity_damp_ratio = p_value; break;
case PhysicsServer3D::SPACE_PARAM_CONSTRAINT_DEFAULT_BIAS: constraint_bias = p_value; break;
case PhysicsServer3D::SPACE_PARAM_TEST_MOTION_MIN_CONTACT_DEPTH: test_motion_min_contact_depth = p_value; break;
case PhysicsServer3D::SPACE_PARAM_CONTACT_RECYCLE_RADIUS:
contact_recycle_radius = p_value;
break;
case PhysicsServer3D::SPACE_PARAM_CONTACT_MAX_SEPARATION:
contact_max_separation = p_value;
break;
case PhysicsServer3D::SPACE_PARAM_BODY_MAX_ALLOWED_PENETRATION:
contact_max_allowed_penetration = p_value;
break;
case PhysicsServer3D::SPACE_PARAM_BODY_LINEAR_VELOCITY_SLEEP_THRESHOLD:
body_linear_velocity_sleep_threshold = p_value;
break;
case PhysicsServer3D::SPACE_PARAM_BODY_ANGULAR_VELOCITY_SLEEP_THRESHOLD:
body_angular_velocity_sleep_threshold = p_value;
break;
case PhysicsServer3D::SPACE_PARAM_BODY_TIME_TO_SLEEP:
body_time_to_sleep = p_value;
break;
case PhysicsServer3D::SPACE_PARAM_BODY_ANGULAR_VELOCITY_DAMP_RATIO:
body_angular_velocity_damp_ratio = p_value;
break;
case PhysicsServer3D::SPACE_PARAM_CONSTRAINT_DEFAULT_BIAS:
constraint_bias = p_value;
break;
case PhysicsServer3D::SPACE_PARAM_TEST_MOTION_MIN_CONTACT_DEPTH:
test_motion_min_contact_depth = p_value;
break;
}
}
@ -1170,15 +1188,24 @@ real_t Space3DSW::get_param(PhysicsServer3D::SpaceParameter p_param) const {
switch (p_param) {
case PhysicsServer3D::SPACE_PARAM_CONTACT_RECYCLE_RADIUS: return contact_recycle_radius;
case PhysicsServer3D::SPACE_PARAM_CONTACT_MAX_SEPARATION: return contact_max_separation;
case PhysicsServer3D::SPACE_PARAM_BODY_MAX_ALLOWED_PENETRATION: return contact_max_allowed_penetration;
case PhysicsServer3D::SPACE_PARAM_BODY_LINEAR_VELOCITY_SLEEP_THRESHOLD: return body_linear_velocity_sleep_threshold;
case PhysicsServer3D::SPACE_PARAM_BODY_ANGULAR_VELOCITY_SLEEP_THRESHOLD: return body_angular_velocity_sleep_threshold;
case PhysicsServer3D::SPACE_PARAM_BODY_TIME_TO_SLEEP: return body_time_to_sleep;
case PhysicsServer3D::SPACE_PARAM_BODY_ANGULAR_VELOCITY_DAMP_RATIO: return body_angular_velocity_damp_ratio;
case PhysicsServer3D::SPACE_PARAM_CONSTRAINT_DEFAULT_BIAS: return constraint_bias;
case PhysicsServer3D::SPACE_PARAM_TEST_MOTION_MIN_CONTACT_DEPTH: return test_motion_min_contact_depth;
case PhysicsServer3D::SPACE_PARAM_CONTACT_RECYCLE_RADIUS:
return contact_recycle_radius;
case PhysicsServer3D::SPACE_PARAM_CONTACT_MAX_SEPARATION:
return contact_max_separation;
case PhysicsServer3D::SPACE_PARAM_BODY_MAX_ALLOWED_PENETRATION:
return contact_max_allowed_penetration;
case PhysicsServer3D::SPACE_PARAM_BODY_LINEAR_VELOCITY_SLEEP_THRESHOLD:
return body_linear_velocity_sleep_threshold;
case PhysicsServer3D::SPACE_PARAM_BODY_ANGULAR_VELOCITY_SLEEP_THRESHOLD:
return body_angular_velocity_sleep_threshold;
case PhysicsServer3D::SPACE_PARAM_BODY_TIME_TO_SLEEP:
return body_time_to_sleep;
case PhysicsServer3D::SPACE_PARAM_BODY_ANGULAR_VELOCITY_DAMP_RATIO:
return body_angular_velocity_damp_ratio;
case PhysicsServer3D::SPACE_PARAM_CONSTRAINT_DEFAULT_BIAS:
return constraint_bias;
case PhysicsServer3D::SPACE_PARAM_TEST_MOTION_MIN_CONTACT_DEPTH:
return test_motion_min_contact_depth;
}
return 0;
}

View File

@ -1990,8 +1990,12 @@ int RasterizerSceneRD::get_directional_light_shadow_size(RID p_light_intance) {
switch (storage->light_directional_get_shadow_mode(light_instance->light)) {
case RS::LIGHT_DIRECTIONAL_SHADOW_ORTHOGONAL:
break; //none
case RS::LIGHT_DIRECTIONAL_SHADOW_PARALLEL_2_SPLITS: r.size.height /= 2; break;
case RS::LIGHT_DIRECTIONAL_SHADOW_PARALLEL_4_SPLITS: r.size /= 2; break;
case RS::LIGHT_DIRECTIONAL_SHADOW_PARALLEL_2_SPLITS:
r.size.height /= 2;
break;
case RS::LIGHT_DIRECTIONAL_SHADOW_PARALLEL_4_SPLITS:
r.size /= 2;
break;
}
return MAX(r.size.width, r.size.height);

View File

@ -60,39 +60,68 @@ static int _get_datatype_size(SL::DataType p_type) {
switch (p_type) {
case SL::TYPE_VOID: return 0;
case SL::TYPE_BOOL: return 4;
case SL::TYPE_BVEC2: return 8;
case SL::TYPE_BVEC3: return 12;
case SL::TYPE_BVEC4: return 16;
case SL::TYPE_INT: return 4;
case SL::TYPE_IVEC2: return 8;
case SL::TYPE_IVEC3: return 12;
case SL::TYPE_IVEC4: return 16;
case SL::TYPE_UINT: return 4;
case SL::TYPE_UVEC2: return 8;
case SL::TYPE_UVEC3: return 12;
case SL::TYPE_UVEC4: return 16;
case SL::TYPE_FLOAT: return 4;
case SL::TYPE_VEC2: return 8;
case SL::TYPE_VEC3: return 12;
case SL::TYPE_VEC4: return 16;
case SL::TYPE_VOID:
return 0;
case SL::TYPE_BOOL:
return 4;
case SL::TYPE_BVEC2:
return 8;
case SL::TYPE_BVEC3:
return 12;
case SL::TYPE_BVEC4:
return 16;
case SL::TYPE_INT:
return 4;
case SL::TYPE_IVEC2:
return 8;
case SL::TYPE_IVEC3:
return 12;
case SL::TYPE_IVEC4:
return 16;
case SL::TYPE_UINT:
return 4;
case SL::TYPE_UVEC2:
return 8;
case SL::TYPE_UVEC3:
return 12;
case SL::TYPE_UVEC4:
return 16;
case SL::TYPE_FLOAT:
return 4;
case SL::TYPE_VEC2:
return 8;
case SL::TYPE_VEC3:
return 12;
case SL::TYPE_VEC4:
return 16;
case SL::TYPE_MAT2:
return 32; //4 * 4 + 4 * 4
case SL::TYPE_MAT3:
return 48; // 4 * 4 + 4 * 4 + 4 * 4
case SL::TYPE_MAT4: return 64;
case SL::TYPE_SAMPLER2D: return 16;
case SL::TYPE_ISAMPLER2D: return 16;
case SL::TYPE_USAMPLER2D: return 16;
case SL::TYPE_SAMPLER2DARRAY: return 16;
case SL::TYPE_ISAMPLER2DARRAY: return 16;
case SL::TYPE_USAMPLER2DARRAY: return 16;
case SL::TYPE_SAMPLER3D: return 16;
case SL::TYPE_ISAMPLER3D: return 16;
case SL::TYPE_USAMPLER3D: return 16;
case SL::TYPE_SAMPLERCUBE: return 16;
case SL::TYPE_STRUCT: return 0;
case SL::TYPE_MAT4:
return 64;
case SL::TYPE_SAMPLER2D:
return 16;
case SL::TYPE_ISAMPLER2D:
return 16;
case SL::TYPE_USAMPLER2D:
return 16;
case SL::TYPE_SAMPLER2DARRAY:
return 16;
case SL::TYPE_ISAMPLER2DARRAY:
return 16;
case SL::TYPE_USAMPLER2DARRAY:
return 16;
case SL::TYPE_SAMPLER3D:
return 16;
case SL::TYPE_ISAMPLER3D:
return 16;
case SL::TYPE_USAMPLER3D:
return 16;
case SL::TYPE_SAMPLERCUBE:
return 16;
case SL::TYPE_STRUCT:
return 0;
case SL::TYPE_MAX: {
ERR_FAIL_V(0);
};
@ -105,37 +134,68 @@ static int _get_datatype_alignment(SL::DataType p_type) {
switch (p_type) {
case SL::TYPE_VOID: return 0;
case SL::TYPE_BOOL: return 4;
case SL::TYPE_BVEC2: return 8;
case SL::TYPE_BVEC3: return 16;
case SL::TYPE_BVEC4: return 16;
case SL::TYPE_INT: return 4;
case SL::TYPE_IVEC2: return 8;
case SL::TYPE_IVEC3: return 16;
case SL::TYPE_IVEC4: return 16;
case SL::TYPE_UINT: return 4;
case SL::TYPE_UVEC2: return 8;
case SL::TYPE_UVEC3: return 16;
case SL::TYPE_UVEC4: return 16;
case SL::TYPE_FLOAT: return 4;
case SL::TYPE_VEC2: return 8;
case SL::TYPE_VEC3: return 16;
case SL::TYPE_VEC4: return 16;
case SL::TYPE_MAT2: return 16;
case SL::TYPE_MAT3: return 16;
case SL::TYPE_MAT4: return 16;
case SL::TYPE_SAMPLER2D: return 16;
case SL::TYPE_ISAMPLER2D: return 16;
case SL::TYPE_USAMPLER2D: return 16;
case SL::TYPE_SAMPLER2DARRAY: return 16;
case SL::TYPE_ISAMPLER2DARRAY: return 16;
case SL::TYPE_USAMPLER2DARRAY: return 16;
case SL::TYPE_SAMPLER3D: return 16;
case SL::TYPE_ISAMPLER3D: return 16;
case SL::TYPE_USAMPLER3D: return 16;
case SL::TYPE_SAMPLERCUBE: return 16;
case SL::TYPE_STRUCT: return 0;
case SL::TYPE_VOID:
return 0;
case SL::TYPE_BOOL:
return 4;
case SL::TYPE_BVEC2:
return 8;
case SL::TYPE_BVEC3:
return 16;
case SL::TYPE_BVEC4:
return 16;
case SL::TYPE_INT:
return 4;
case SL::TYPE_IVEC2:
return 8;
case SL::TYPE_IVEC3:
return 16;
case SL::TYPE_IVEC4:
return 16;
case SL::TYPE_UINT:
return 4;
case SL::TYPE_UVEC2:
return 8;
case SL::TYPE_UVEC3:
return 16;
case SL::TYPE_UVEC4:
return 16;
case SL::TYPE_FLOAT:
return 4;
case SL::TYPE_VEC2:
return 8;
case SL::TYPE_VEC3:
return 16;
case SL::TYPE_VEC4:
return 16;
case SL::TYPE_MAT2:
return 16;
case SL::TYPE_MAT3:
return 16;
case SL::TYPE_MAT4:
return 16;
case SL::TYPE_SAMPLER2D:
return 16;
case SL::TYPE_ISAMPLER2D:
return 16;
case SL::TYPE_USAMPLER2D:
return 16;
case SL::TYPE_SAMPLER2DARRAY:
return 16;
case SL::TYPE_ISAMPLER2DARRAY:
return 16;
case SL::TYPE_USAMPLER2DARRAY:
return 16;
case SL::TYPE_SAMPLER3D:
return 16;
case SL::TYPE_ISAMPLER3D:
return 16;
case SL::TYPE_USAMPLER3D:
return 16;
case SL::TYPE_SAMPLERCUBE:
return 16;
case SL::TYPE_STRUCT:
return 0;
case SL::TYPE_MAX: {
ERR_FAIL_V(0);
}
@ -146,8 +206,10 @@ static int _get_datatype_alignment(SL::DataType p_type) {
static String _interpstr(SL::DataInterpolation p_interp) {
switch (p_interp) {
case SL::INTERPOLATION_FLAT: return "flat ";
case SL::INTERPOLATION_SMOOTH: return "";
case SL::INTERPOLATION_FLAT:
return "flat ";
case SL::INTERPOLATION_SMOOTH:
return "";
}
return "";
}
@ -155,10 +217,14 @@ static String _interpstr(SL::DataInterpolation p_interp) {
static String _prestr(SL::DataPrecision p_pres) {
switch (p_pres) {
case SL::PRECISION_LOWP: return "lowp ";
case SL::PRECISION_MEDIUMP: return "mediump ";
case SL::PRECISION_HIGHP: return "highp ";
case SL::PRECISION_DEFAULT: return "";
case SL::PRECISION_LOWP:
return "lowp ";
case SL::PRECISION_MEDIUMP:
return "mediump ";
case SL::PRECISION_HIGHP:
return "highp ";
case SL::PRECISION_DEFAULT:
return "";
}
return "";
}
@ -166,9 +232,12 @@ static String _prestr(SL::DataPrecision p_pres) {
static String _qualstr(SL::ArgumentQualifier p_qual) {
switch (p_qual) {
case SL::ARGUMENT_QUALIFIER_IN: return "";
case SL::ARGUMENT_QUALIFIER_OUT: return "out ";
case SL::ARGUMENT_QUALIFIER_INOUT: return "inout ";
case SL::ARGUMENT_QUALIFIER_IN:
return "";
case SL::ARGUMENT_QUALIFIER_OUT:
return "out ";
case SL::ARGUMENT_QUALIFIER_INOUT:
return "inout ";
}
return "";
}
@ -196,7 +265,8 @@ static String f2sp0(float p_float) {
static String get_constant_text(SL::DataType p_type, const Vector<SL::ConstantNode::Value> &p_values) {
switch (p_type) {
case SL::TYPE_BOOL: return p_values[0].boolean ? "true" : "false";
case SL::TYPE_BOOL:
return p_values[0].boolean ? "true" : "false";
case SL::TYPE_BVEC2:
case SL::TYPE_BVEC3:
case SL::TYPE_BVEC4: {
@ -212,7 +282,8 @@ static String get_constant_text(SL::DataType p_type, const Vector<SL::ConstantNo
return text;
}
case SL::TYPE_INT: return itos(p_values[0].sint);
case SL::TYPE_INT:
return itos(p_values[0].sint);
case SL::TYPE_IVEC2:
case SL::TYPE_IVEC3:
case SL::TYPE_IVEC4: {
@ -228,7 +299,8 @@ static String get_constant_text(SL::DataType p_type, const Vector<SL::ConstantNo
return text;
} break;
case SL::TYPE_UINT: return itos(p_values[0].uint) + "u";
case SL::TYPE_UINT:
return itos(p_values[0].uint) + "u";
case SL::TYPE_UVEC2:
case SL::TYPE_UVEC3:
case SL::TYPE_UVEC4: {
@ -243,7 +315,8 @@ static String get_constant_text(SL::DataType p_type, const Vector<SL::ConstantNo
text += ")";
return text;
} break;
case SL::TYPE_FLOAT: return f2sp0(p_values[0].real);
case SL::TYPE_FLOAT:
return f2sp0(p_values[0].real);
case SL::TYPE_VEC2:
case SL::TYPE_VEC3:
case SL::TYPE_VEC4: {
@ -274,7 +347,8 @@ static String get_constant_text(SL::DataType p_type, const Vector<SL::ConstantNo
return text;
} break;
default: ERR_FAIL_V(String());
default:
ERR_FAIL_V(String());
}
}

View File

@ -130,12 +130,24 @@ void main() {
float strength = 0.0;
switch (side) {
case POS_X: strength = aniso_pos.x; break;
case POS_Y: strength = aniso_pos.y; break;
case POS_Z: strength = aniso_pos.z; break;
case NEG_X: strength = aniso_neg.x; break;
case NEG_Y: strength = aniso_neg.y; break;
case NEG_Z: strength = aniso_neg.z; break;
case POS_X:
strength = aniso_pos.x;
break;
case POS_Y:
strength = aniso_pos.y;
break;
case POS_Z:
strength = aniso_pos.z;
break;
case NEG_X:
strength = aniso_neg.x;
break;
case NEG_Y:
strength = aniso_neg.y;
break;
case NEG_Z:
strength = aniso_neg.z;
break;
}
color_interp.xyz *= strength;

View File

@ -1523,9 +1523,15 @@ bool RenderingServerScene::_light_instance_update_shadow(Instance *p_instance, c
int splits = 0;
switch (RSG::storage->light_directional_get_shadow_mode(p_instance->base)) {
case RS::LIGHT_DIRECTIONAL_SHADOW_ORTHOGONAL: splits = 1; break;
case RS::LIGHT_DIRECTIONAL_SHADOW_PARALLEL_2_SPLITS: splits = 2; break;
case RS::LIGHT_DIRECTIONAL_SHADOW_PARALLEL_4_SPLITS: splits = 4; break;
case RS::LIGHT_DIRECTIONAL_SHADOW_ORTHOGONAL:
splits = 1;
break;
case RS::LIGHT_DIRECTIONAL_SHADOW_PARALLEL_2_SPLITS:
splits = 2;
break;
case RS::LIGHT_DIRECTIONAL_SHADOW_PARALLEL_4_SPLITS:
splits = 4;
break;
}
real_t distances[5];

View File

@ -826,9 +826,12 @@ ShaderLanguage::DataPrecision ShaderLanguage::get_token_precision(TokenType p_ty
String ShaderLanguage::get_precision_name(DataPrecision p_type) {
switch (p_type) {
case PRECISION_LOWP: return "lowp";
case PRECISION_MEDIUMP: return "mediump";
case PRECISION_HIGHP: return "highp";
case PRECISION_LOWP:
return "lowp";
case PRECISION_MEDIUMP:
return "mediump";
case PRECISION_HIGHP:
return "highp";
default:
break;
}
@ -839,38 +842,70 @@ String ShaderLanguage::get_datatype_name(DataType p_type) {
switch (p_type) {
case TYPE_VOID: return "void";
case TYPE_BOOL: return "bool";
case TYPE_BVEC2: return "bvec2";
case TYPE_BVEC3: return "bvec3";
case TYPE_BVEC4: return "bvec4";
case TYPE_INT: return "int";
case TYPE_IVEC2: return "ivec2";
case TYPE_IVEC3: return "ivec3";
case TYPE_IVEC4: return "ivec4";
case TYPE_UINT: return "uint";
case TYPE_UVEC2: return "uvec2";
case TYPE_UVEC3: return "uvec3";
case TYPE_UVEC4: return "uvec4";
case TYPE_FLOAT: return "float";
case TYPE_VEC2: return "vec2";
case TYPE_VEC3: return "vec3";
case TYPE_VEC4: return "vec4";
case TYPE_MAT2: return "mat2";
case TYPE_MAT3: return "mat3";
case TYPE_MAT4: return "mat4";
case TYPE_SAMPLER2D: return "sampler2D";
case TYPE_ISAMPLER2D: return "isampler2D";
case TYPE_USAMPLER2D: return "usampler2D";
case TYPE_SAMPLER2DARRAY: return "sampler2DArray";
case TYPE_ISAMPLER2DARRAY: return "isampler2DArray";
case TYPE_USAMPLER2DARRAY: return "usampler2DArray";
case TYPE_SAMPLER3D: return "sampler3D";
case TYPE_ISAMPLER3D: return "isampler3D";
case TYPE_USAMPLER3D: return "usampler3D";
case TYPE_SAMPLERCUBE: return "samplerCube";
case TYPE_STRUCT: return "struct";
case TYPE_MAX: return "invalid";
case TYPE_VOID:
return "void";
case TYPE_BOOL:
return "bool";
case TYPE_BVEC2:
return "bvec2";
case TYPE_BVEC3:
return "bvec3";
case TYPE_BVEC4:
return "bvec4";
case TYPE_INT:
return "int";
case TYPE_IVEC2:
return "ivec2";
case TYPE_IVEC3:
return "ivec3";
case TYPE_IVEC4:
return "ivec4";
case TYPE_UINT:
return "uint";
case TYPE_UVEC2:
return "uvec2";
case TYPE_UVEC3:
return "uvec3";
case TYPE_UVEC4:
return "uvec4";
case TYPE_FLOAT:
return "float";
case TYPE_VEC2:
return "vec2";
case TYPE_VEC3:
return "vec3";
case TYPE_VEC4:
return "vec4";
case TYPE_MAT2:
return "mat2";
case TYPE_MAT3:
return "mat3";
case TYPE_MAT4:
return "mat4";
case TYPE_SAMPLER2D:
return "sampler2D";
case TYPE_ISAMPLER2D:
return "isampler2D";
case TYPE_USAMPLER2D:
return "usampler2D";
case TYPE_SAMPLER2DARRAY:
return "sampler2DArray";
case TYPE_ISAMPLER2DARRAY:
return "isampler2DArray";
case TYPE_USAMPLER2DARRAY:
return "usampler2DArray";
case TYPE_SAMPLER3D:
return "sampler3D";
case TYPE_ISAMPLER3D:
return "isampler3D";
case TYPE_USAMPLER3D:
return "usampler3D";
case TYPE_SAMPLERCUBE:
return "samplerCube";
case TYPE_STRUCT:
return "struct";
case TYPE_MAX:
return "invalid";
}
return "";
@ -2696,8 +2731,12 @@ Variant ShaderLanguage::constant_value_to_variant(const Vector<ShaderLanguage::C
PropertyInfo ShaderLanguage::uniform_to_property_info(const ShaderNode::Uniform &p_uniform) {
PropertyInfo pi;
switch (p_uniform.type) {
case ShaderLanguage::TYPE_VOID: pi.type = Variant::NIL; break;
case ShaderLanguage::TYPE_BOOL: pi.type = Variant::BOOL; break;
case ShaderLanguage::TYPE_VOID:
pi.type = Variant::NIL;
break;
case ShaderLanguage::TYPE_BOOL:
pi.type = Variant::BOOL;
break;
case ShaderLanguage::TYPE_BVEC2:
pi.type = Variant::INT;
pi.hint = PROPERTY_HINT_FLAGS;
@ -2739,8 +2778,12 @@ PropertyInfo ShaderLanguage::uniform_to_property_info(const ShaderNode::Uniform
}
} break;
case ShaderLanguage::TYPE_VEC2: pi.type = Variant::VECTOR2; break;
case ShaderLanguage::TYPE_VEC3: pi.type = Variant::VECTOR3; break;
case ShaderLanguage::TYPE_VEC2:
pi.type = Variant::VECTOR2;
break;
case ShaderLanguage::TYPE_VEC3:
pi.type = Variant::VECTOR3;
break;
case ShaderLanguage::TYPE_VEC4: {
if (p_uniform.hint == ShaderLanguage::ShaderNode::Uniform::HINT_COLOR) {
pi.type = Variant::COLOR;
@ -2748,9 +2791,15 @@ PropertyInfo ShaderLanguage::uniform_to_property_info(const ShaderNode::Uniform
pi.type = Variant::PLANE;
}
} break;
case ShaderLanguage::TYPE_MAT2: pi.type = Variant::TRANSFORM2D; break;
case ShaderLanguage::TYPE_MAT3: pi.type = Variant::BASIS; break;
case ShaderLanguage::TYPE_MAT4: pi.type = Variant::TRANSFORM; break;
case ShaderLanguage::TYPE_MAT2:
pi.type = Variant::TRANSFORM2D;
break;
case ShaderLanguage::TYPE_MAT3:
pi.type = Variant::BASIS;
break;
case ShaderLanguage::TYPE_MAT4:
pi.type = Variant::TRANSFORM;
break;
case ShaderLanguage::TYPE_SAMPLER2D:
case ShaderLanguage::TYPE_ISAMPLER2D:
case ShaderLanguage::TYPE_USAMPLER2D: {
@ -3758,12 +3807,23 @@ ShaderLanguage::Node *ShaderLanguage::_parse_expression(BlockNode *p_block, cons
e.is_op = true;
switch (tk.type) {
case TK_OP_SUB: e.op = OP_NEGATE; break;
case TK_OP_NOT: e.op = OP_NOT; break;
case TK_OP_BIT_INVERT: e.op = OP_BIT_INVERT; break;
case TK_OP_INCREMENT: e.op = OP_INCREMENT; break;
case TK_OP_DECREMENT: e.op = OP_DECREMENT; break;
default: ERR_FAIL_V(nullptr);
case TK_OP_SUB:
e.op = OP_NEGATE;
break;
case TK_OP_NOT:
e.op = OP_NOT;
break;
case TK_OP_BIT_INVERT:
e.op = OP_BIT_INVERT;
break;
case TK_OP_INCREMENT:
e.op = OP_INCREMENT;
break;
case TK_OP_DECREMENT:
e.op = OP_DECREMENT;
break;
default:
ERR_FAIL_V(nullptr);
}
expression.push_back(e);
@ -4157,12 +4217,23 @@ ShaderLanguage::Node *ShaderLanguage::_parse_expression(BlockNode *p_block, cons
}
switch (expr->get_datatype()) {
case TYPE_BVEC2: member_type = TYPE_BOOL; break;
case TYPE_VEC2: member_type = TYPE_FLOAT; break;
case TYPE_IVEC2: member_type = TYPE_INT; break;
case TYPE_UVEC2: member_type = TYPE_UINT; break;
case TYPE_MAT2: member_type = TYPE_VEC2; break;
default: break;
case TYPE_BVEC2:
member_type = TYPE_BOOL;
break;
case TYPE_VEC2:
member_type = TYPE_FLOAT;
break;
case TYPE_IVEC2:
member_type = TYPE_INT;
break;
case TYPE_UVEC2:
member_type = TYPE_UINT;
break;
case TYPE_MAT2:
member_type = TYPE_VEC2;
break;
default:
break;
}
break;
@ -4180,12 +4251,23 @@ ShaderLanguage::Node *ShaderLanguage::_parse_expression(BlockNode *p_block, cons
}
switch (expr->get_datatype()) {
case TYPE_BVEC3: member_type = TYPE_BOOL; break;
case TYPE_VEC3: member_type = TYPE_FLOAT; break;
case TYPE_IVEC3: member_type = TYPE_INT; break;
case TYPE_UVEC3: member_type = TYPE_UINT; break;
case TYPE_MAT3: member_type = TYPE_VEC3; break;
default: break;
case TYPE_BVEC3:
member_type = TYPE_BOOL;
break;
case TYPE_VEC3:
member_type = TYPE_FLOAT;
break;
case TYPE_IVEC3:
member_type = TYPE_INT;
break;
case TYPE_UVEC3:
member_type = TYPE_UINT;
break;
case TYPE_MAT3:
member_type = TYPE_VEC3;
break;
default:
break;
}
break;
case TYPE_BVEC4:
@ -4202,12 +4284,23 @@ ShaderLanguage::Node *ShaderLanguage::_parse_expression(BlockNode *p_block, cons
}
switch (expr->get_datatype()) {
case TYPE_BVEC4: member_type = TYPE_BOOL; break;
case TYPE_VEC4: member_type = TYPE_FLOAT; break;
case TYPE_IVEC4: member_type = TYPE_INT; break;
case TYPE_UVEC4: member_type = TYPE_UINT; break;
case TYPE_MAT4: member_type = TYPE_VEC4; break;
default: break;
case TYPE_BVEC4:
member_type = TYPE_BOOL;
break;
case TYPE_VEC4:
member_type = TYPE_FLOAT;
break;
case TYPE_IVEC4:
member_type = TYPE_INT;
break;
case TYPE_UVEC4:
member_type = TYPE_UINT;
break;
case TYPE_MAT4:
member_type = TYPE_VEC4;
break;
default:
break;
}
break;
default: {
@ -4267,37 +4360,99 @@ ShaderLanguage::Node *ShaderLanguage::_parse_expression(BlockNode *p_block, cons
switch (tk.type) {
case TK_OP_EQUAL: o.op = OP_EQUAL; break;
case TK_OP_NOT_EQUAL: o.op = OP_NOT_EQUAL; break;
case TK_OP_LESS: o.op = OP_LESS; break;
case TK_OP_LESS_EQUAL: o.op = OP_LESS_EQUAL; break;
case TK_OP_GREATER: o.op = OP_GREATER; break;
case TK_OP_GREATER_EQUAL: o.op = OP_GREATER_EQUAL; break;
case TK_OP_AND: o.op = OP_AND; break;
case TK_OP_OR: o.op = OP_OR; break;
case TK_OP_ADD: o.op = OP_ADD; break;
case TK_OP_SUB: o.op = OP_SUB; break;
case TK_OP_MUL: o.op = OP_MUL; break;
case TK_OP_DIV: o.op = OP_DIV; break;
case TK_OP_MOD: o.op = OP_MOD; break;
case TK_OP_SHIFT_LEFT: o.op = OP_SHIFT_LEFT; break;
case TK_OP_SHIFT_RIGHT: o.op = OP_SHIFT_RIGHT; break;
case TK_OP_ASSIGN: o.op = OP_ASSIGN; break;
case TK_OP_ASSIGN_ADD: o.op = OP_ASSIGN_ADD; break;
case TK_OP_ASSIGN_SUB: o.op = OP_ASSIGN_SUB; break;
case TK_OP_ASSIGN_MUL: o.op = OP_ASSIGN_MUL; break;
case TK_OP_ASSIGN_DIV: o.op = OP_ASSIGN_DIV; break;
case TK_OP_ASSIGN_MOD: o.op = OP_ASSIGN_MOD; break;
case TK_OP_ASSIGN_SHIFT_LEFT: o.op = OP_ASSIGN_SHIFT_LEFT; break;
case TK_OP_ASSIGN_SHIFT_RIGHT: o.op = OP_ASSIGN_SHIFT_RIGHT; break;
case TK_OP_ASSIGN_BIT_AND: o.op = OP_ASSIGN_BIT_AND; break;
case TK_OP_ASSIGN_BIT_OR: o.op = OP_ASSIGN_BIT_OR; break;
case TK_OP_ASSIGN_BIT_XOR: o.op = OP_ASSIGN_BIT_XOR; break;
case TK_OP_BIT_AND: o.op = OP_BIT_AND; break;
case TK_OP_BIT_OR: o.op = OP_BIT_OR; break;
case TK_OP_BIT_XOR: o.op = OP_BIT_XOR; break;
case TK_QUESTION: o.op = OP_SELECT_IF; break;
case TK_COLON: o.op = OP_SELECT_ELSE; break;
case TK_OP_EQUAL:
o.op = OP_EQUAL;
break;
case TK_OP_NOT_EQUAL:
o.op = OP_NOT_EQUAL;
break;
case TK_OP_LESS:
o.op = OP_LESS;
break;
case TK_OP_LESS_EQUAL:
o.op = OP_LESS_EQUAL;
break;
case TK_OP_GREATER:
o.op = OP_GREATER;
break;
case TK_OP_GREATER_EQUAL:
o.op = OP_GREATER_EQUAL;
break;
case TK_OP_AND:
o.op = OP_AND;
break;
case TK_OP_OR:
o.op = OP_OR;
break;
case TK_OP_ADD:
o.op = OP_ADD;
break;
case TK_OP_SUB:
o.op = OP_SUB;
break;
case TK_OP_MUL:
o.op = OP_MUL;
break;
case TK_OP_DIV:
o.op = OP_DIV;
break;
case TK_OP_MOD:
o.op = OP_MOD;
break;
case TK_OP_SHIFT_LEFT:
o.op = OP_SHIFT_LEFT;
break;
case TK_OP_SHIFT_RIGHT:
o.op = OP_SHIFT_RIGHT;
break;
case TK_OP_ASSIGN:
o.op = OP_ASSIGN;
break;
case TK_OP_ASSIGN_ADD:
o.op = OP_ASSIGN_ADD;
break;
case TK_OP_ASSIGN_SUB:
o.op = OP_ASSIGN_SUB;
break;
case TK_OP_ASSIGN_MUL:
o.op = OP_ASSIGN_MUL;
break;
case TK_OP_ASSIGN_DIV:
o.op = OP_ASSIGN_DIV;
break;
case TK_OP_ASSIGN_MOD:
o.op = OP_ASSIGN_MOD;
break;
case TK_OP_ASSIGN_SHIFT_LEFT:
o.op = OP_ASSIGN_SHIFT_LEFT;
break;
case TK_OP_ASSIGN_SHIFT_RIGHT:
o.op = OP_ASSIGN_SHIFT_RIGHT;
break;
case TK_OP_ASSIGN_BIT_AND:
o.op = OP_ASSIGN_BIT_AND;
break;
case TK_OP_ASSIGN_BIT_OR:
o.op = OP_ASSIGN_BIT_OR;
break;
case TK_OP_ASSIGN_BIT_XOR:
o.op = OP_ASSIGN_BIT_XOR;
break;
case TK_OP_BIT_AND:
o.op = OP_BIT_AND;
break;
case TK_OP_BIT_OR:
o.op = OP_BIT_OR;
break;
case TK_OP_BIT_XOR:
o.op = OP_BIT_XOR;
break;
case TK_QUESTION:
o.op = OP_SELECT_IF;
break;
case TK_COLON:
o.op = OP_SELECT_ELSE;
break;
default: {
_set_error("Invalid token for operator: " + get_token_text(tk));
return nullptr;
@ -4333,14 +4488,30 @@ ShaderLanguage::Node *ShaderLanguage::_parse_expression(BlockNode *p_block, cons
int priority;
switch (expression[i].op) {
case OP_EQUAL: priority = 8; break;
case OP_NOT_EQUAL: priority = 8; break;
case OP_LESS: priority = 7; break;
case OP_LESS_EQUAL: priority = 7; break;
case OP_GREATER: priority = 7; break;
case OP_GREATER_EQUAL: priority = 7; break;
case OP_AND: priority = 12; break;
case OP_OR: priority = 14; break;
case OP_EQUAL:
priority = 8;
break;
case OP_NOT_EQUAL:
priority = 8;
break;
case OP_LESS:
priority = 7;
break;
case OP_LESS_EQUAL:
priority = 7;
break;
case OP_GREATER:
priority = 7;
break;
case OP_GREATER_EQUAL:
priority = 7;
break;
case OP_AND:
priority = 12;
break;
case OP_OR:
priority = 14;
break;
case OP_NOT:
priority = 3;
unary = true;
@ -4349,27 +4520,69 @@ ShaderLanguage::Node *ShaderLanguage::_parse_expression(BlockNode *p_block, cons
priority = 3;
unary = true;
break;
case OP_ADD: priority = 5; break;
case OP_SUB: priority = 5; break;
case OP_MUL: priority = 4; break;
case OP_DIV: priority = 4; break;
case OP_MOD: priority = 4; break;
case OP_SHIFT_LEFT: priority = 6; break;
case OP_SHIFT_RIGHT: priority = 6; break;
case OP_ASSIGN: priority = 16; break;
case OP_ASSIGN_ADD: priority = 16; break;
case OP_ASSIGN_SUB: priority = 16; break;
case OP_ASSIGN_MUL: priority = 16; break;
case OP_ASSIGN_DIV: priority = 16; break;
case OP_ASSIGN_MOD: priority = 16; break;
case OP_ASSIGN_SHIFT_LEFT: priority = 16; break;
case OP_ASSIGN_SHIFT_RIGHT: priority = 16; break;
case OP_ASSIGN_BIT_AND: priority = 16; break;
case OP_ASSIGN_BIT_OR: priority = 16; break;
case OP_ASSIGN_BIT_XOR: priority = 16; break;
case OP_BIT_AND: priority = 9; break;
case OP_BIT_OR: priority = 11; break;
case OP_BIT_XOR: priority = 10; break;
case OP_ADD:
priority = 5;
break;
case OP_SUB:
priority = 5;
break;
case OP_MUL:
priority = 4;
break;
case OP_DIV:
priority = 4;
break;
case OP_MOD:
priority = 4;
break;
case OP_SHIFT_LEFT:
priority = 6;
break;
case OP_SHIFT_RIGHT:
priority = 6;
break;
case OP_ASSIGN:
priority = 16;
break;
case OP_ASSIGN_ADD:
priority = 16;
break;
case OP_ASSIGN_SUB:
priority = 16;
break;
case OP_ASSIGN_MUL:
priority = 16;
break;
case OP_ASSIGN_DIV:
priority = 16;
break;
case OP_ASSIGN_MOD:
priority = 16;
break;
case OP_ASSIGN_SHIFT_LEFT:
priority = 16;
break;
case OP_ASSIGN_SHIFT_RIGHT:
priority = 16;
break;
case OP_ASSIGN_BIT_AND:
priority = 16;
break;
case OP_ASSIGN_BIT_OR:
priority = 16;
break;
case OP_ASSIGN_BIT_XOR:
priority = 16;
break;
case OP_BIT_AND:
priority = 9;
break;
case OP_BIT_OR:
priority = 11;
break;
case OP_BIT_XOR:
priority = 10;
break;
case OP_BIT_INVERT:
priority = 3;
unary = true;
@ -7087,9 +7300,15 @@ Error ShaderLanguage::complete(const String &p_code, const Map<StringName, Funct
limit = 4;
} break;
case TYPE_MAT2: limit = 2; break;
case TYPE_MAT3: limit = 3; break;
case TYPE_MAT4: limit = 4; break;
case TYPE_MAT2:
limit = 2;
break;
case TYPE_MAT3:
limit = 3;
break;
case TYPE_MAT4:
limit = 4;
break;
default: {
}
}

View File

@ -1569,35 +1569,64 @@ Array RenderingServer::_mesh_surface_get_skeleton_aabb_bind(RID p_mesh, int p_su
ShaderLanguage::DataType RenderingServer::global_variable_type_get_shader_datatype(GlobalVariableType p_type) {
switch (p_type) {
case RS::GLOBAL_VAR_TYPE_BOOL: return ShaderLanguage::TYPE_BOOL;
case RS::GLOBAL_VAR_TYPE_BVEC2: return ShaderLanguage::TYPE_BVEC2;
case RS::GLOBAL_VAR_TYPE_BVEC3: return ShaderLanguage::TYPE_BVEC3;
case RS::GLOBAL_VAR_TYPE_BVEC4: return ShaderLanguage::TYPE_BVEC4;
case RS::GLOBAL_VAR_TYPE_INT: return ShaderLanguage::TYPE_INT;
case RS::GLOBAL_VAR_TYPE_IVEC2: return ShaderLanguage::TYPE_IVEC2;
case RS::GLOBAL_VAR_TYPE_IVEC3: return ShaderLanguage::TYPE_IVEC3;
case RS::GLOBAL_VAR_TYPE_IVEC4: return ShaderLanguage::TYPE_IVEC4;
case RS::GLOBAL_VAR_TYPE_RECT2I: return ShaderLanguage::TYPE_IVEC4;
case RS::GLOBAL_VAR_TYPE_UINT: return ShaderLanguage::TYPE_UINT;
case RS::GLOBAL_VAR_TYPE_UVEC2: return ShaderLanguage::TYPE_UVEC2;
case RS::GLOBAL_VAR_TYPE_UVEC3: return ShaderLanguage::TYPE_UVEC3;
case RS::GLOBAL_VAR_TYPE_UVEC4: return ShaderLanguage::TYPE_UVEC4;
case RS::GLOBAL_VAR_TYPE_FLOAT: return ShaderLanguage::TYPE_FLOAT;
case RS::GLOBAL_VAR_TYPE_VEC2: return ShaderLanguage::TYPE_VEC2;
case RS::GLOBAL_VAR_TYPE_VEC3: return ShaderLanguage::TYPE_VEC3;
case RS::GLOBAL_VAR_TYPE_VEC4: return ShaderLanguage::TYPE_VEC4;
case RS::GLOBAL_VAR_TYPE_COLOR: return ShaderLanguage::TYPE_VEC4;
case RS::GLOBAL_VAR_TYPE_RECT2: return ShaderLanguage::TYPE_VEC4;
case RS::GLOBAL_VAR_TYPE_MAT2: return ShaderLanguage::TYPE_MAT2;
case RS::GLOBAL_VAR_TYPE_MAT3: return ShaderLanguage::TYPE_MAT3;
case RS::GLOBAL_VAR_TYPE_MAT4: return ShaderLanguage::TYPE_MAT4;
case RS::GLOBAL_VAR_TYPE_TRANSFORM_2D: return ShaderLanguage::TYPE_MAT3;
case RS::GLOBAL_VAR_TYPE_TRANSFORM: return ShaderLanguage::TYPE_MAT4;
case RS::GLOBAL_VAR_TYPE_SAMPLER2D: return ShaderLanguage::TYPE_SAMPLER2D;
case RS::GLOBAL_VAR_TYPE_SAMPLER2DARRAY: return ShaderLanguage::TYPE_SAMPLER2DARRAY;
case RS::GLOBAL_VAR_TYPE_SAMPLER3D: return ShaderLanguage::TYPE_SAMPLER3D;
case RS::GLOBAL_VAR_TYPE_SAMPLERCUBE: return ShaderLanguage::TYPE_SAMPLERCUBE;
default: return ShaderLanguage::TYPE_MAX; //invalid or not found
case RS::GLOBAL_VAR_TYPE_BOOL:
return ShaderLanguage::TYPE_BOOL;
case RS::GLOBAL_VAR_TYPE_BVEC2:
return ShaderLanguage::TYPE_BVEC2;
case RS::GLOBAL_VAR_TYPE_BVEC3:
return ShaderLanguage::TYPE_BVEC3;
case RS::GLOBAL_VAR_TYPE_BVEC4:
return ShaderLanguage::TYPE_BVEC4;
case RS::GLOBAL_VAR_TYPE_INT:
return ShaderLanguage::TYPE_INT;
case RS::GLOBAL_VAR_TYPE_IVEC2:
return ShaderLanguage::TYPE_IVEC2;
case RS::GLOBAL_VAR_TYPE_IVEC3:
return ShaderLanguage::TYPE_IVEC3;
case RS::GLOBAL_VAR_TYPE_IVEC4:
return ShaderLanguage::TYPE_IVEC4;
case RS::GLOBAL_VAR_TYPE_RECT2I:
return ShaderLanguage::TYPE_IVEC4;
case RS::GLOBAL_VAR_TYPE_UINT:
return ShaderLanguage::TYPE_UINT;
case RS::GLOBAL_VAR_TYPE_UVEC2:
return ShaderLanguage::TYPE_UVEC2;
case RS::GLOBAL_VAR_TYPE_UVEC3:
return ShaderLanguage::TYPE_UVEC3;
case RS::GLOBAL_VAR_TYPE_UVEC4:
return ShaderLanguage::TYPE_UVEC4;
case RS::GLOBAL_VAR_TYPE_FLOAT:
return ShaderLanguage::TYPE_FLOAT;
case RS::GLOBAL_VAR_TYPE_VEC2:
return ShaderLanguage::TYPE_VEC2;
case RS::GLOBAL_VAR_TYPE_VEC3:
return ShaderLanguage::TYPE_VEC3;
case RS::GLOBAL_VAR_TYPE_VEC4:
return ShaderLanguage::TYPE_VEC4;
case RS::GLOBAL_VAR_TYPE_COLOR:
return ShaderLanguage::TYPE_VEC4;
case RS::GLOBAL_VAR_TYPE_RECT2:
return ShaderLanguage::TYPE_VEC4;
case RS::GLOBAL_VAR_TYPE_MAT2:
return ShaderLanguage::TYPE_MAT2;
case RS::GLOBAL_VAR_TYPE_MAT3:
return ShaderLanguage::TYPE_MAT3;
case RS::GLOBAL_VAR_TYPE_MAT4:
return ShaderLanguage::TYPE_MAT4;
case RS::GLOBAL_VAR_TYPE_TRANSFORM_2D:
return ShaderLanguage::TYPE_MAT3;
case RS::GLOBAL_VAR_TYPE_TRANSFORM:
return ShaderLanguage::TYPE_MAT4;
case RS::GLOBAL_VAR_TYPE_SAMPLER2D:
return ShaderLanguage::TYPE_SAMPLER2D;
case RS::GLOBAL_VAR_TYPE_SAMPLER2DARRAY:
return ShaderLanguage::TYPE_SAMPLER2DARRAY;
case RS::GLOBAL_VAR_TYPE_SAMPLER3D:
return ShaderLanguage::TYPE_SAMPLER3D;
case RS::GLOBAL_VAR_TYPE_SAMPLERCUBE:
return ShaderLanguage::TYPE_SAMPLERCUBE;
default:
return ShaderLanguage::TYPE_MAX; //invalid or not found
}
}