| 1 | /**************************************************************************/ |
| 2 | /* rendering_server.cpp */ |
| 3 | /**************************************************************************/ |
| 4 | /* This file is part of: */ |
| 5 | /* GODOT ENGINE */ |
| 6 | /* https://godotengine.org */ |
| 7 | /**************************************************************************/ |
| 8 | /* Copyright (c) 2014-present Godot Engine contributors (see AUTHORS.md). */ |
| 9 | /* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. */ |
| 10 | /* */ |
| 11 | /* Permission is hereby granted, free of charge, to any person obtaining */ |
| 12 | /* a copy of this software and associated documentation files (the */ |
| 13 | /* "Software"), to deal in the Software without restriction, including */ |
| 14 | /* without limitation the rights to use, copy, modify, merge, publish, */ |
| 15 | /* distribute, sublicense, and/or sell copies of the Software, and to */ |
| 16 | /* permit persons to whom the Software is furnished to do so, subject to */ |
| 17 | /* the following conditions: */ |
| 18 | /* */ |
| 19 | /* The above copyright notice and this permission notice shall be */ |
| 20 | /* included in all copies or substantial portions of the Software. */ |
| 21 | /* */ |
| 22 | /* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */ |
| 23 | /* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */ |
| 24 | /* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. */ |
| 25 | /* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */ |
| 26 | /* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */ |
| 27 | /* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ |
| 28 | /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ |
| 29 | /**************************************************************************/ |
| 30 | |
| 31 | #include "rendering_server.h" |
| 32 | |
| 33 | #include "core/config/project_settings.h" |
| 34 | #include "core/object/worker_thread_pool.h" |
| 35 | #include "core/variant/typed_array.h" |
| 36 | #include "servers/rendering/rendering_server_globals.h" |
| 37 | #include "servers/rendering/shader_language.h" |
| 38 | #include "servers/rendering/shader_warnings.h" |
| 39 | |
| 40 | RenderingServer *RenderingServer::singleton = nullptr; |
| 41 | RenderingServer *(*RenderingServer::create_func)() = nullptr; |
| 42 | |
| 43 | RenderingServer *RenderingServer::get_singleton() { |
| 44 | return singleton; |
| 45 | } |
| 46 | |
| 47 | RenderingServer *RenderingServer::create() { |
| 48 | ERR_FAIL_COND_V(singleton, nullptr); |
| 49 | |
| 50 | if (create_func) { |
| 51 | return create_func(); |
| 52 | } |
| 53 | |
| 54 | return nullptr; |
| 55 | } |
| 56 | |
| 57 | Array RenderingServer::_texture_debug_usage_bind() { |
| 58 | List<TextureInfo> list; |
| 59 | texture_debug_usage(&list); |
| 60 | Array arr; |
| 61 | for (const TextureInfo &E : list) { |
| 62 | Dictionary dict; |
| 63 | dict["texture" ] = E.texture; |
| 64 | dict["width" ] = E.width; |
| 65 | dict["height" ] = E.height; |
| 66 | dict["depth" ] = E.depth; |
| 67 | dict["format" ] = E.format; |
| 68 | dict["bytes" ] = E.bytes; |
| 69 | dict["path" ] = E.path; |
| 70 | arr.push_back(dict); |
| 71 | } |
| 72 | return arr; |
| 73 | } |
| 74 | |
| 75 | static PackedInt64Array to_int_array(const Vector<ObjectID> &ids) { |
| 76 | PackedInt64Array a; |
| 77 | a.resize(ids.size()); |
| 78 | for (int i = 0; i < ids.size(); ++i) { |
| 79 | a.write[i] = ids[i]; |
| 80 | } |
| 81 | return a; |
| 82 | } |
| 83 | |
| 84 | PackedInt64Array RenderingServer::_instances_cull_aabb_bind(const AABB &p_aabb, RID p_scenario) const { |
| 85 | if (RSG::threaded) { |
| 86 | WARN_PRINT_ONCE("Using this function with a threaded renderer hurts performance, as it causes a server stall." ); |
| 87 | } |
| 88 | Vector<ObjectID> ids = instances_cull_aabb(p_aabb, p_scenario); |
| 89 | return to_int_array(ids); |
| 90 | } |
| 91 | |
| 92 | PackedInt64Array RenderingServer::_instances_cull_ray_bind(const Vector3 &p_from, const Vector3 &p_to, RID p_scenario) const { |
| 93 | if (RSG::threaded) { |
| 94 | WARN_PRINT_ONCE("Using this function with a threaded renderer hurts performance, as it causes a server stall." ); |
| 95 | } |
| 96 | Vector<ObjectID> ids = instances_cull_ray(p_from, p_to, p_scenario); |
| 97 | return to_int_array(ids); |
| 98 | } |
| 99 | |
| 100 | PackedInt64Array RenderingServer::_instances_cull_convex_bind(const TypedArray<Plane> &p_convex, RID p_scenario) const { |
| 101 | if (RSG::threaded) { |
| 102 | WARN_PRINT_ONCE("Using this function with a threaded renderer hurts performance, as it causes a server stall." ); |
| 103 | } |
| 104 | Vector<Plane> planes; |
| 105 | for (int i = 0; i < p_convex.size(); ++i) { |
| 106 | Variant v = p_convex[i]; |
| 107 | ERR_FAIL_COND_V(v.get_type() != Variant::PLANE, PackedInt64Array()); |
| 108 | planes.push_back(v); |
| 109 | } |
| 110 | |
| 111 | Vector<ObjectID> ids = instances_cull_convex(planes, p_scenario); |
| 112 | return to_int_array(ids); |
| 113 | } |
| 114 | |
| 115 | RID RenderingServer::get_test_texture() { |
| 116 | if (test_texture.is_valid()) { |
| 117 | return test_texture; |
| 118 | }; |
| 119 | |
| 120 | #define TEST_TEXTURE_SIZE 256 |
| 121 | |
| 122 | Vector<uint8_t> test_data; |
| 123 | test_data.resize(TEST_TEXTURE_SIZE * TEST_TEXTURE_SIZE * 3); |
| 124 | |
| 125 | { |
| 126 | uint8_t *w = test_data.ptrw(); |
| 127 | |
| 128 | for (int x = 0; x < TEST_TEXTURE_SIZE; x++) { |
| 129 | for (int y = 0; y < TEST_TEXTURE_SIZE; y++) { |
| 130 | Color c; |
| 131 | int r = 255 - (x + y) / 2; |
| 132 | |
| 133 | if ((x % (TEST_TEXTURE_SIZE / 8)) < 2 || (y % (TEST_TEXTURE_SIZE / 8)) < 2) { |
| 134 | c.r = y; |
| 135 | c.g = r; |
| 136 | c.b = x; |
| 137 | |
| 138 | } else { |
| 139 | c.r = r; |
| 140 | c.g = x; |
| 141 | c.b = y; |
| 142 | } |
| 143 | |
| 144 | w[(y * TEST_TEXTURE_SIZE + x) * 3 + 0] = uint8_t(CLAMP(c.r, 0, 255)); |
| 145 | w[(y * TEST_TEXTURE_SIZE + x) * 3 + 1] = uint8_t(CLAMP(c.g, 0, 255)); |
| 146 | w[(y * TEST_TEXTURE_SIZE + x) * 3 + 2] = uint8_t(CLAMP(c.b, 0, 255)); |
| 147 | } |
| 148 | } |
| 149 | } |
| 150 | |
| 151 | Ref<Image> data = memnew(Image(TEST_TEXTURE_SIZE, TEST_TEXTURE_SIZE, false, Image::FORMAT_RGB8, test_data)); |
| 152 | |
| 153 | test_texture = texture_2d_create(data); |
| 154 | |
| 155 | return test_texture; |
| 156 | } |
| 157 | |
| 158 | void RenderingServer::_free_internal_rids() { |
| 159 | if (test_texture.is_valid()) { |
| 160 | free(test_texture); |
| 161 | } |
| 162 | if (white_texture.is_valid()) { |
| 163 | free(white_texture); |
| 164 | } |
| 165 | if (test_material.is_valid()) { |
| 166 | free(test_material); |
| 167 | } |
| 168 | } |
| 169 | |
| 170 | RID RenderingServer::_make_test_cube() { |
| 171 | Vector<Vector3> vertices; |
| 172 | Vector<Vector3> normals; |
| 173 | Vector<float> tangents; |
| 174 | Vector<Vector3> uvs; |
| 175 | |
| 176 | #define ADD_VTX(m_idx) \ |
| 177 | vertices.push_back(face_points[m_idx]); \ |
| 178 | normals.push_back(normal_points[m_idx]); \ |
| 179 | tangents.push_back(normal_points[m_idx][1]); \ |
| 180 | tangents.push_back(normal_points[m_idx][2]); \ |
| 181 | tangents.push_back(normal_points[m_idx][0]); \ |
| 182 | tangents.push_back(1.0); \ |
| 183 | uvs.push_back(Vector3(uv_points[m_idx * 2 + 0], uv_points[m_idx * 2 + 1], 0)); |
| 184 | |
| 185 | for (int i = 0; i < 6; i++) { |
| 186 | Vector3 face_points[4]; |
| 187 | Vector3 normal_points[4]; |
| 188 | float uv_points[8] = { 0, 0, 0, 1, 1, 1, 1, 0 }; |
| 189 | |
| 190 | for (int j = 0; j < 4; j++) { |
| 191 | float v[3]; |
| 192 | v[0] = 1.0; |
| 193 | v[1] = 1 - 2 * ((j >> 1) & 1); |
| 194 | v[2] = v[1] * (1 - 2 * (j & 1)); |
| 195 | |
| 196 | for (int k = 0; k < 3; k++) { |
| 197 | if (i < 3) { |
| 198 | face_points[j][(i + k) % 3] = v[k]; |
| 199 | } else { |
| 200 | face_points[3 - j][(i + k) % 3] = -v[k]; |
| 201 | } |
| 202 | } |
| 203 | normal_points[j] = Vector3(); |
| 204 | normal_points[j][i % 3] = (i >= 3 ? -1 : 1); |
| 205 | } |
| 206 | |
| 207 | // Tri 1 |
| 208 | ADD_VTX(0); |
| 209 | ADD_VTX(1); |
| 210 | ADD_VTX(2); |
| 211 | // Tri 2 |
| 212 | ADD_VTX(2); |
| 213 | ADD_VTX(3); |
| 214 | ADD_VTX(0); |
| 215 | } |
| 216 | |
| 217 | RID test_cube = mesh_create(); |
| 218 | |
| 219 | Array d; |
| 220 | d.resize(RS::ARRAY_MAX); |
| 221 | d[RenderingServer::ARRAY_NORMAL] = normals; |
| 222 | d[RenderingServer::ARRAY_TANGENT] = tangents; |
| 223 | d[RenderingServer::ARRAY_TEX_UV] = uvs; |
| 224 | d[RenderingServer::ARRAY_VERTEX] = vertices; |
| 225 | |
| 226 | Vector<int> indices; |
| 227 | indices.resize(vertices.size()); |
| 228 | for (int i = 0; i < vertices.size(); i++) { |
| 229 | indices.set(i, i); |
| 230 | } |
| 231 | d[RenderingServer::ARRAY_INDEX] = indices; |
| 232 | |
| 233 | mesh_add_surface_from_arrays(test_cube, PRIMITIVE_TRIANGLES, d); |
| 234 | |
| 235 | /* |
| 236 | test_material = fixed_material_create(); |
| 237 | //material_set_flag(material, MATERIAL_FLAG_BILLBOARD_TOGGLE,true); |
| 238 | fixed_material_set_texture( test_material, FIXED_MATERIAL_PARAM_DIFFUSE, get_test_texture() ); |
| 239 | fixed_material_set_param( test_material, FIXED_MATERIAL_PARAM_SPECULAR_EXP, 70 ); |
| 240 | fixed_material_set_param( test_material, FIXED_MATERIAL_PARAM_EMISSION, Color(0.2,0.2,0.2) ); |
| 241 | |
| 242 | fixed_material_set_param( test_material, FIXED_MATERIAL_PARAM_DIFFUSE, Color(1, 1, 1) ); |
| 243 | fixed_material_set_param( test_material, FIXED_MATERIAL_PARAM_SPECULAR, Color(1,1,1) ); |
| 244 | */ |
| 245 | mesh_surface_set_material(test_cube, 0, test_material); |
| 246 | |
| 247 | return test_cube; |
| 248 | } |
| 249 | |
| 250 | RID RenderingServer::make_sphere_mesh(int p_lats, int p_lons, real_t p_radius) { |
| 251 | Vector<Vector3> vertices; |
| 252 | Vector<Vector3> normals; |
| 253 | const double lat_step = Math_TAU / p_lats; |
| 254 | const double lon_step = Math_TAU / p_lons; |
| 255 | |
| 256 | for (int i = 1; i <= p_lats; i++) { |
| 257 | double lat0 = lat_step * (i - 1) - Math_TAU / 4; |
| 258 | double z0 = Math::sin(lat0); |
| 259 | double zr0 = Math::cos(lat0); |
| 260 | |
| 261 | double lat1 = lat_step * i - Math_TAU / 4; |
| 262 | double z1 = Math::sin(lat1); |
| 263 | double zr1 = Math::cos(lat1); |
| 264 | |
| 265 | for (int j = p_lons; j >= 1; j--) { |
| 266 | double lng0 = lon_step * (j - 1); |
| 267 | double x0 = Math::cos(lng0); |
| 268 | double y0 = Math::sin(lng0); |
| 269 | |
| 270 | double lng1 = lon_step * j; |
| 271 | double x1 = Math::cos(lng1); |
| 272 | double y1 = Math::sin(lng1); |
| 273 | |
| 274 | Vector3 v[4] = { |
| 275 | Vector3(x1 * zr0, z0, y1 * zr0), |
| 276 | Vector3(x1 * zr1, z1, y1 * zr1), |
| 277 | Vector3(x0 * zr1, z1, y0 * zr1), |
| 278 | Vector3(x0 * zr0, z0, y0 * zr0) |
| 279 | }; |
| 280 | |
| 281 | #define ADD_POINT(m_idx) \ |
| 282 | normals.push_back(v[m_idx]); \ |
| 283 | vertices.push_back(v[m_idx] * p_radius); |
| 284 | |
| 285 | ADD_POINT(0); |
| 286 | ADD_POINT(1); |
| 287 | ADD_POINT(2); |
| 288 | |
| 289 | ADD_POINT(2); |
| 290 | ADD_POINT(3); |
| 291 | ADD_POINT(0); |
| 292 | } |
| 293 | } |
| 294 | |
| 295 | RID mesh = mesh_create(); |
| 296 | Array d; |
| 297 | d.resize(RS::ARRAY_MAX); |
| 298 | |
| 299 | d[ARRAY_VERTEX] = vertices; |
| 300 | d[ARRAY_NORMAL] = normals; |
| 301 | |
| 302 | mesh_add_surface_from_arrays(mesh, PRIMITIVE_TRIANGLES, d); |
| 303 | |
| 304 | return mesh; |
| 305 | } |
| 306 | |
| 307 | RID RenderingServer::get_white_texture() { |
| 308 | if (white_texture.is_valid()) { |
| 309 | return white_texture; |
| 310 | } |
| 311 | |
| 312 | Vector<uint8_t> wt; |
| 313 | wt.resize(16 * 3); |
| 314 | { |
| 315 | uint8_t *w = wt.ptrw(); |
| 316 | for (int i = 0; i < 16 * 3; i++) { |
| 317 | w[i] = 255; |
| 318 | } |
| 319 | } |
| 320 | Ref<Image> white = memnew(Image(4, 4, 0, Image::FORMAT_RGB8, wt)); |
| 321 | white_texture = texture_2d_create(white); |
| 322 | return white_texture; |
| 323 | } |
| 324 | |
| 325 | Error RenderingServer::_surface_set_data(Array p_arrays, uint32_t p_format, uint32_t *p_offsets, uint32_t p_vertex_stride, uint32_t p_attrib_stride, uint32_t p_skin_stride, Vector<uint8_t> &r_vertex_array, Vector<uint8_t> &r_attrib_array, Vector<uint8_t> &r_skin_array, int p_vertex_array_len, Vector<uint8_t> &r_index_array, int p_index_array_len, AABB &r_aabb, Vector<AABB> &r_bone_aabb) { |
| 326 | uint8_t *vw = r_vertex_array.ptrw(); |
| 327 | uint8_t *aw = r_attrib_array.ptrw(); |
| 328 | uint8_t *sw = r_skin_array.ptrw(); |
| 329 | |
| 330 | uint8_t *iw = nullptr; |
| 331 | if (r_index_array.size()) { |
| 332 | iw = r_index_array.ptrw(); |
| 333 | } |
| 334 | |
| 335 | int max_bone = 0; |
| 336 | |
| 337 | for (int ai = 0; ai < RS::ARRAY_MAX; ai++) { |
| 338 | if (!(p_format & (1 << ai))) { // No array |
| 339 | continue; |
| 340 | } |
| 341 | |
| 342 | switch (ai) { |
| 343 | case RS::ARRAY_VERTEX: { |
| 344 | if (p_format & RS::ARRAY_FLAG_USE_2D_VERTICES) { |
| 345 | Vector<Vector2> array = p_arrays[ai]; |
| 346 | ERR_FAIL_COND_V(array.size() != p_vertex_array_len, ERR_INVALID_PARAMETER); |
| 347 | |
| 348 | const Vector2 *src = array.ptr(); |
| 349 | |
| 350 | // Setting vertices means regenerating the AABB. |
| 351 | Rect2 aabb; |
| 352 | |
| 353 | { |
| 354 | for (int i = 0; i < p_vertex_array_len; i++) { |
| 355 | float vector[2] = { (float)src[i].x, (float)src[i].y }; |
| 356 | |
| 357 | memcpy(&vw[p_offsets[ai] + i * p_vertex_stride], vector, sizeof(float) * 2); |
| 358 | |
| 359 | if (i == 0) { |
| 360 | aabb = Rect2(src[i], SMALL_VEC2); // Must have a bit of size. |
| 361 | } else { |
| 362 | aabb.expand_to(src[i]); |
| 363 | } |
| 364 | } |
| 365 | } |
| 366 | |
| 367 | r_aabb = AABB(Vector3(aabb.position.x, aabb.position.y, 0), Vector3(aabb.size.x, aabb.size.y, 0)); |
| 368 | |
| 369 | } else { |
| 370 | Vector<Vector3> array = p_arrays[ai]; |
| 371 | ERR_FAIL_COND_V(array.size() != p_vertex_array_len, ERR_INVALID_PARAMETER); |
| 372 | |
| 373 | const Vector3 *src = array.ptr(); |
| 374 | |
| 375 | // Setting vertices means regenerating the AABB. |
| 376 | AABB aabb; |
| 377 | |
| 378 | { |
| 379 | for (int i = 0; i < p_vertex_array_len; i++) { |
| 380 | float vector[3] = { (float)src[i].x, (float)src[i].y, (float)src[i].z }; |
| 381 | |
| 382 | memcpy(&vw[p_offsets[ai] + i * p_vertex_stride], vector, sizeof(float) * 3); |
| 383 | |
| 384 | if (i == 0) { |
| 385 | aabb = AABB(src[i], SMALL_VEC3); |
| 386 | } else { |
| 387 | aabb.expand_to(src[i]); |
| 388 | } |
| 389 | } |
| 390 | } |
| 391 | |
| 392 | r_aabb = aabb; |
| 393 | } |
| 394 | |
| 395 | } break; |
| 396 | case RS::ARRAY_NORMAL: { |
| 397 | ERR_FAIL_COND_V(p_arrays[ai].get_type() != Variant::PACKED_VECTOR3_ARRAY, ERR_INVALID_PARAMETER); |
| 398 | |
| 399 | Vector<Vector3> array = p_arrays[ai]; |
| 400 | ERR_FAIL_COND_V(array.size() != p_vertex_array_len, ERR_INVALID_PARAMETER); |
| 401 | |
| 402 | const Vector3 *src = array.ptr(); |
| 403 | for (int i = 0; i < p_vertex_array_len; i++) { |
| 404 | Vector2 res = src[i].octahedron_encode(); |
| 405 | uint16_t vector[2] = { |
| 406 | (uint16_t)CLAMP(res.x * 65535, 0, 65535), |
| 407 | (uint16_t)CLAMP(res.y * 65535, 0, 65535), |
| 408 | }; |
| 409 | |
| 410 | memcpy(&vw[p_offsets[ai] + i * p_vertex_stride], vector, 4); |
| 411 | } |
| 412 | } break; |
| 413 | |
| 414 | case RS::ARRAY_TANGENT: { |
| 415 | Variant::Type type = p_arrays[ai].get_type(); |
| 416 | ERR_FAIL_COND_V(type != Variant::PACKED_FLOAT32_ARRAY && type != Variant::PACKED_FLOAT64_ARRAY, ERR_INVALID_PARAMETER); |
| 417 | if (type == Variant::PACKED_FLOAT32_ARRAY) { |
| 418 | Vector<float> array = p_arrays[ai]; |
| 419 | ERR_FAIL_COND_V(array.size() != p_vertex_array_len * 4, ERR_INVALID_PARAMETER); |
| 420 | const float *src_ptr = array.ptr(); |
| 421 | |
| 422 | for (int i = 0; i < p_vertex_array_len; i++) { |
| 423 | const Vector3 src(src_ptr[i * 4 + 0], src_ptr[i * 4 + 1], src_ptr[i * 4 + 2]); |
| 424 | Vector2 res = src.octahedron_tangent_encode(src_ptr[i * 4 + 3]); |
| 425 | uint16_t vector[2] = { |
| 426 | (uint16_t)CLAMP(res.x * 65535, 0, 65535), |
| 427 | (uint16_t)CLAMP(res.y * 65535, 0, 65535), |
| 428 | }; |
| 429 | |
| 430 | memcpy(&vw[p_offsets[ai] + i * p_vertex_stride], vector, 4); |
| 431 | } |
| 432 | } else { // PACKED_FLOAT64_ARRAY |
| 433 | Vector<double> array = p_arrays[ai]; |
| 434 | ERR_FAIL_COND_V(array.size() != p_vertex_array_len * 4, ERR_INVALID_PARAMETER); |
| 435 | const double *src_ptr = array.ptr(); |
| 436 | |
| 437 | for (int i = 0; i < p_vertex_array_len; i++) { |
| 438 | const Vector3 src(src_ptr[i * 4 + 0], src_ptr[i * 4 + 1], src_ptr[i * 4 + 2]); |
| 439 | Vector2 res = src.octahedron_tangent_encode(src_ptr[i * 4 + 3]); |
| 440 | uint16_t vector[2] = { |
| 441 | (uint16_t)CLAMP(res.x * 65535, 0, 65535), |
| 442 | (uint16_t)CLAMP(res.y * 65535, 0, 65535), |
| 443 | }; |
| 444 | |
| 445 | memcpy(&vw[p_offsets[ai] + i * p_vertex_stride], vector, 4); |
| 446 | } |
| 447 | } |
| 448 | } break; |
| 449 | case RS::ARRAY_COLOR: { |
| 450 | ERR_FAIL_COND_V(p_arrays[ai].get_type() != Variant::PACKED_COLOR_ARRAY, ERR_INVALID_PARAMETER); |
| 451 | |
| 452 | Vector<Color> array = p_arrays[ai]; |
| 453 | |
| 454 | ERR_FAIL_COND_V(array.size() != p_vertex_array_len, ERR_INVALID_PARAMETER); |
| 455 | |
| 456 | const Color *src = array.ptr(); |
| 457 | for (int i = 0; i < p_vertex_array_len; i++) { |
| 458 | uint8_t color8[4] = { |
| 459 | uint8_t(CLAMP(src[i].r * 255.0, 0.0, 255.0)), |
| 460 | uint8_t(CLAMP(src[i].g * 255.0, 0.0, 255.0)), |
| 461 | uint8_t(CLAMP(src[i].b * 255.0, 0.0, 255.0)), |
| 462 | uint8_t(CLAMP(src[i].a * 255.0, 0.0, 255.0)) |
| 463 | }; |
| 464 | memcpy(&aw[p_offsets[ai] + i * p_attrib_stride], color8, 4); |
| 465 | } |
| 466 | } break; |
| 467 | case RS::ARRAY_TEX_UV: { |
| 468 | ERR_FAIL_COND_V(p_arrays[ai].get_type() != Variant::PACKED_VECTOR3_ARRAY && p_arrays[ai].get_type() != Variant::PACKED_VECTOR2_ARRAY, ERR_INVALID_PARAMETER); |
| 469 | |
| 470 | Vector<Vector2> array = p_arrays[ai]; |
| 471 | |
| 472 | ERR_FAIL_COND_V(array.size() != p_vertex_array_len, ERR_INVALID_PARAMETER); |
| 473 | |
| 474 | const Vector2 *src = array.ptr(); |
| 475 | |
| 476 | for (int i = 0; i < p_vertex_array_len; i++) { |
| 477 | float uv[2] = { (float)src[i].x, (float)src[i].y }; |
| 478 | |
| 479 | memcpy(&aw[p_offsets[ai] + i * p_attrib_stride], uv, 2 * 4); |
| 480 | } |
| 481 | |
| 482 | } break; |
| 483 | |
| 484 | case RS::ARRAY_TEX_UV2: { |
| 485 | ERR_FAIL_COND_V(p_arrays[ai].get_type() != Variant::PACKED_VECTOR3_ARRAY && p_arrays[ai].get_type() != Variant::PACKED_VECTOR2_ARRAY, ERR_INVALID_PARAMETER); |
| 486 | |
| 487 | Vector<Vector2> array = p_arrays[ai]; |
| 488 | |
| 489 | ERR_FAIL_COND_V(array.size() != p_vertex_array_len, ERR_INVALID_PARAMETER); |
| 490 | |
| 491 | const Vector2 *src = array.ptr(); |
| 492 | |
| 493 | for (int i = 0; i < p_vertex_array_len; i++) { |
| 494 | float uv[2] = { (float)src[i].x, (float)src[i].y }; |
| 495 | memcpy(&aw[p_offsets[ai] + i * p_attrib_stride], uv, 2 * 4); |
| 496 | } |
| 497 | } break; |
| 498 | case RS::ARRAY_CUSTOM0: |
| 499 | case RS::ARRAY_CUSTOM1: |
| 500 | case RS::ARRAY_CUSTOM2: |
| 501 | case RS::ARRAY_CUSTOM3: { |
| 502 | uint32_t type = (p_format >> (ARRAY_FORMAT_CUSTOM_BASE + ARRAY_FORMAT_CUSTOM_BITS * (ai - RS::ARRAY_CUSTOM0))) & ARRAY_FORMAT_CUSTOM_MASK; |
| 503 | switch (type) { |
| 504 | case ARRAY_CUSTOM_RGBA8_UNORM: |
| 505 | case ARRAY_CUSTOM_RGBA8_SNORM: |
| 506 | case ARRAY_CUSTOM_RG_HALF: { |
| 507 | // Size 4 |
| 508 | ERR_FAIL_COND_V(p_arrays[ai].get_type() != Variant::PACKED_BYTE_ARRAY, ERR_INVALID_PARAMETER); |
| 509 | |
| 510 | Vector<uint8_t> array = p_arrays[ai]; |
| 511 | |
| 512 | ERR_FAIL_COND_V(array.size() != p_vertex_array_len * 4, ERR_INVALID_PARAMETER); |
| 513 | |
| 514 | const uint8_t *src = array.ptr(); |
| 515 | |
| 516 | for (int i = 0; i < p_vertex_array_len; i++) { |
| 517 | memcpy(&aw[p_offsets[ai] + i * p_attrib_stride], &src[i * 4], 4); |
| 518 | } |
| 519 | |
| 520 | } break; |
| 521 | case ARRAY_CUSTOM_RGBA_HALF: { |
| 522 | // Size 8 |
| 523 | ERR_FAIL_COND_V(p_arrays[ai].get_type() != Variant::PACKED_BYTE_ARRAY, ERR_INVALID_PARAMETER); |
| 524 | |
| 525 | Vector<uint8_t> array = p_arrays[ai]; |
| 526 | |
| 527 | ERR_FAIL_COND_V(array.size() != p_vertex_array_len * 8, ERR_INVALID_PARAMETER); |
| 528 | |
| 529 | const uint8_t *src = array.ptr(); |
| 530 | |
| 531 | for (int i = 0; i < p_vertex_array_len; i++) { |
| 532 | memcpy(&aw[p_offsets[ai] + i * p_attrib_stride], &src[i * 8], 8); |
| 533 | } |
| 534 | } break; |
| 535 | case ARRAY_CUSTOM_R_FLOAT: |
| 536 | case ARRAY_CUSTOM_RG_FLOAT: |
| 537 | case ARRAY_CUSTOM_RGB_FLOAT: |
| 538 | case ARRAY_CUSTOM_RGBA_FLOAT: { |
| 539 | // RF |
| 540 | ERR_FAIL_COND_V(p_arrays[ai].get_type() != Variant::PACKED_FLOAT32_ARRAY, ERR_INVALID_PARAMETER); |
| 541 | |
| 542 | Vector<float> array = p_arrays[ai]; |
| 543 | int32_t s = type - ARRAY_CUSTOM_R_FLOAT + 1; |
| 544 | |
| 545 | ERR_FAIL_COND_V(array.size() != p_vertex_array_len * s, ERR_INVALID_PARAMETER); |
| 546 | |
| 547 | const float *src = array.ptr(); |
| 548 | |
| 549 | for (int i = 0; i < p_vertex_array_len; i++) { |
| 550 | memcpy(&aw[p_offsets[ai] + i * p_attrib_stride], &src[i * s], sizeof(float) * s); |
| 551 | } |
| 552 | } break; |
| 553 | default: { |
| 554 | } |
| 555 | } |
| 556 | |
| 557 | } break; |
| 558 | case RS::ARRAY_WEIGHTS: { |
| 559 | Variant::Type type = p_arrays[ai].get_type(); |
| 560 | ERR_FAIL_COND_V(type != Variant::PACKED_FLOAT32_ARRAY && type != Variant::PACKED_FLOAT64_ARRAY, ERR_INVALID_PARAMETER); |
| 561 | uint32_t bone_count = (p_format & ARRAY_FLAG_USE_8_BONE_WEIGHTS) ? 8 : 4; |
| 562 | if (type == Variant::PACKED_FLOAT32_ARRAY) { |
| 563 | Vector<float> array = p_arrays[ai]; |
| 564 | ERR_FAIL_COND_V(array.size() != (int32_t)(p_vertex_array_len * bone_count), ERR_INVALID_PARAMETER); |
| 565 | const float *src = array.ptr(); |
| 566 | { |
| 567 | uint16_t data[8]; |
| 568 | for (int i = 0; i < p_vertex_array_len; i++) { |
| 569 | for (uint32_t j = 0; j < bone_count; j++) { |
| 570 | data[j] = CLAMP(src[i * bone_count + j] * 65535, 0, 65535); |
| 571 | } |
| 572 | |
| 573 | memcpy(&sw[p_offsets[ai] + i * p_skin_stride], data, 2 * bone_count); |
| 574 | } |
| 575 | } |
| 576 | } else { // PACKED_FLOAT64_ARRAY |
| 577 | Vector<double> array = p_arrays[ai]; |
| 578 | ERR_FAIL_COND_V(array.size() != (int32_t)(p_vertex_array_len * bone_count), ERR_INVALID_PARAMETER); |
| 579 | const double *src = array.ptr(); |
| 580 | { |
| 581 | uint16_t data[8]; |
| 582 | for (int i = 0; i < p_vertex_array_len; i++) { |
| 583 | for (uint32_t j = 0; j < bone_count; j++) { |
| 584 | data[j] = CLAMP(src[i * bone_count + j] * 65535, 0, 65535); |
| 585 | } |
| 586 | |
| 587 | memcpy(&sw[p_offsets[ai] + i * p_skin_stride], data, 2 * bone_count); |
| 588 | } |
| 589 | } |
| 590 | } |
| 591 | } break; |
| 592 | case RS::ARRAY_BONES: { |
| 593 | ERR_FAIL_COND_V(p_arrays[ai].get_type() != Variant::PACKED_INT32_ARRAY && p_arrays[ai].get_type() != Variant::PACKED_FLOAT32_ARRAY, ERR_INVALID_PARAMETER); |
| 594 | |
| 595 | Vector<int> array = p_arrays[ai]; |
| 596 | |
| 597 | uint32_t bone_count = (p_format & ARRAY_FLAG_USE_8_BONE_WEIGHTS) ? 8 : 4; |
| 598 | |
| 599 | ERR_FAIL_COND_V(array.size() != (int32_t)(p_vertex_array_len * bone_count), ERR_INVALID_PARAMETER); |
| 600 | |
| 601 | const int *src = array.ptr(); |
| 602 | |
| 603 | uint16_t data[8]; |
| 604 | |
| 605 | for (int i = 0; i < p_vertex_array_len; i++) { |
| 606 | for (uint32_t j = 0; j < bone_count; j++) { |
| 607 | data[j] = src[i * bone_count + j]; |
| 608 | max_bone = MAX(data[j], max_bone); |
| 609 | } |
| 610 | |
| 611 | memcpy(&sw[p_offsets[ai] + i * p_skin_stride], data, 2 * bone_count); |
| 612 | } |
| 613 | |
| 614 | } break; |
| 615 | |
| 616 | case RS::ARRAY_INDEX: { |
| 617 | ERR_FAIL_NULL_V(iw, ERR_INVALID_DATA); |
| 618 | ERR_FAIL_COND_V(p_index_array_len <= 0, ERR_INVALID_DATA); |
| 619 | ERR_FAIL_COND_V(p_arrays[ai].get_type() != Variant::PACKED_INT32_ARRAY, ERR_INVALID_PARAMETER); |
| 620 | |
| 621 | Vector<int> indices = p_arrays[ai]; |
| 622 | ERR_FAIL_COND_V(indices.size() == 0, ERR_INVALID_PARAMETER); |
| 623 | ERR_FAIL_COND_V(indices.size() != p_index_array_len, ERR_INVALID_PARAMETER); |
| 624 | |
| 625 | /* determine whether using 16 or 32 bits indices */ |
| 626 | |
| 627 | const int *src = indices.ptr(); |
| 628 | |
| 629 | for (int i = 0; i < p_index_array_len; i++) { |
| 630 | if (p_vertex_array_len <= (1 << 16) && p_vertex_array_len > 0) { |
| 631 | uint16_t v = src[i]; |
| 632 | |
| 633 | memcpy(&iw[i * 2], &v, 2); |
| 634 | } else { |
| 635 | uint32_t v = src[i]; |
| 636 | |
| 637 | memcpy(&iw[i * 4], &v, 4); |
| 638 | } |
| 639 | } |
| 640 | } break; |
| 641 | default: { |
| 642 | ERR_FAIL_V(ERR_INVALID_DATA); |
| 643 | } |
| 644 | } |
| 645 | } |
| 646 | |
| 647 | if (p_format & RS::ARRAY_FORMAT_BONES) { |
| 648 | // Create AABBs for each detected bone. |
| 649 | int total_bones = max_bone + 1; |
| 650 | |
| 651 | bool first = r_bone_aabb.size() == 0; |
| 652 | |
| 653 | r_bone_aabb.resize(total_bones); |
| 654 | |
| 655 | int weight_count = (p_format & ARRAY_FLAG_USE_8_BONE_WEIGHTS) ? 8 : 4; |
| 656 | |
| 657 | if (first) { |
| 658 | for (int i = 0; i < total_bones; i++) { |
| 659 | r_bone_aabb.write[i].size = Vector3(-1, -1, -1); // Negative means unused. |
| 660 | } |
| 661 | } |
| 662 | |
| 663 | Vector<Vector3> vertices = p_arrays[RS::ARRAY_VERTEX]; |
| 664 | Vector<int> bones = p_arrays[RS::ARRAY_BONES]; |
| 665 | Vector<float> weights = p_arrays[RS::ARRAY_WEIGHTS]; |
| 666 | |
| 667 | bool any_valid = false; |
| 668 | |
| 669 | if (vertices.size() && bones.size() == vertices.size() * weight_count && weights.size() == bones.size()) { |
| 670 | int vs = vertices.size(); |
| 671 | const Vector3 *rv = vertices.ptr(); |
| 672 | const int *rb = bones.ptr(); |
| 673 | const float *rw = weights.ptr(); |
| 674 | |
| 675 | AABB *bptr = r_bone_aabb.ptrw(); |
| 676 | |
| 677 | for (int i = 0; i < vs; i++) { |
| 678 | Vector3 v = rv[i]; |
| 679 | for (int j = 0; j < weight_count; j++) { |
| 680 | int idx = rb[i * weight_count + j]; |
| 681 | float w = rw[i * weight_count + j]; |
| 682 | if (w == 0) { |
| 683 | continue; //break; |
| 684 | } |
| 685 | ERR_FAIL_INDEX_V(idx, total_bones, ERR_INVALID_DATA); |
| 686 | |
| 687 | if (bptr[idx].size.x < 0) { |
| 688 | // First |
| 689 | bptr[idx] = AABB(v, SMALL_VEC3); |
| 690 | any_valid = true; |
| 691 | } else { |
| 692 | bptr[idx].expand_to(v); |
| 693 | } |
| 694 | } |
| 695 | } |
| 696 | } |
| 697 | |
| 698 | if (!any_valid && first) { |
| 699 | r_bone_aabb.clear(); |
| 700 | } |
| 701 | } |
| 702 | return OK; |
| 703 | } |
| 704 | |
| 705 | uint32_t RenderingServer::mesh_surface_get_format_offset(BitField<ArrayFormat> p_format, int p_vertex_len, int p_array_index) const { |
| 706 | ERR_FAIL_INDEX_V(p_array_index, ARRAY_MAX, 0); |
| 707 | p_format = int64_t(p_format) & ~ARRAY_FORMAT_INDEX; |
| 708 | uint32_t offsets[ARRAY_MAX]; |
| 709 | uint32_t vstr; |
| 710 | uint32_t astr; |
| 711 | uint32_t sstr; |
| 712 | mesh_surface_make_offsets_from_format(p_format, p_vertex_len, 0, offsets, vstr, astr, sstr); |
| 713 | return offsets[p_array_index]; |
| 714 | } |
| 715 | |
| 716 | uint32_t RenderingServer::mesh_surface_get_format_vertex_stride(BitField<ArrayFormat> p_format, int p_vertex_len) const { |
| 717 | p_format = int64_t(p_format) & ~ARRAY_FORMAT_INDEX; |
| 718 | uint32_t offsets[ARRAY_MAX]; |
| 719 | uint32_t vstr; |
| 720 | uint32_t astr; |
| 721 | uint32_t sstr; |
| 722 | mesh_surface_make_offsets_from_format(p_format, p_vertex_len, 0, offsets, vstr, astr, sstr); |
| 723 | return vstr; |
| 724 | } |
| 725 | uint32_t RenderingServer::mesh_surface_get_format_attribute_stride(BitField<ArrayFormat> p_format, int p_vertex_len) const { |
| 726 | p_format = int64_t(p_format) & ~ARRAY_FORMAT_INDEX; |
| 727 | uint32_t offsets[ARRAY_MAX]; |
| 728 | uint32_t vstr; |
| 729 | uint32_t astr; |
| 730 | uint32_t sstr; |
| 731 | mesh_surface_make_offsets_from_format(p_format, p_vertex_len, 0, offsets, vstr, astr, sstr); |
| 732 | return astr; |
| 733 | } |
| 734 | uint32_t RenderingServer::mesh_surface_get_format_skin_stride(BitField<ArrayFormat> p_format, int p_vertex_len) const { |
| 735 | p_format = int64_t(p_format) & ~ARRAY_FORMAT_INDEX; |
| 736 | uint32_t offsets[ARRAY_MAX]; |
| 737 | uint32_t vstr; |
| 738 | uint32_t astr; |
| 739 | uint32_t sstr; |
| 740 | mesh_surface_make_offsets_from_format(p_format, p_vertex_len, 0, offsets, vstr, astr, sstr); |
| 741 | return sstr; |
| 742 | } |
| 743 | |
| 744 | void RenderingServer::mesh_surface_make_offsets_from_format(uint32_t p_format, int p_vertex_len, int p_index_len, uint32_t *r_offsets, uint32_t &r_vertex_element_size, uint32_t &r_attrib_element_size, uint32_t &r_skin_element_size) const { |
| 745 | r_vertex_element_size = 0; |
| 746 | r_attrib_element_size = 0; |
| 747 | r_skin_element_size = 0; |
| 748 | |
| 749 | uint32_t *size_accum = nullptr; |
| 750 | |
| 751 | for (int i = 0; i < RS::ARRAY_MAX; i++) { |
| 752 | r_offsets[i] = 0; // Reset |
| 753 | |
| 754 | if (i == RS::ARRAY_VERTEX) { |
| 755 | size_accum = &r_vertex_element_size; |
| 756 | } else if (i == RS::ARRAY_COLOR) { |
| 757 | size_accum = &r_attrib_element_size; |
| 758 | } else if (i == RS::ARRAY_BONES) { |
| 759 | size_accum = &r_skin_element_size; |
| 760 | } |
| 761 | |
| 762 | if (!(p_format & (1 << i))) { // No array |
| 763 | continue; |
| 764 | } |
| 765 | |
| 766 | int elem_size = 0; |
| 767 | |
| 768 | switch (i) { |
| 769 | case RS::ARRAY_VERTEX: { |
| 770 | if (p_format & ARRAY_FLAG_USE_2D_VERTICES) { |
| 771 | elem_size = 2; |
| 772 | } else { |
| 773 | elem_size = 3; |
| 774 | } |
| 775 | |
| 776 | elem_size *= sizeof(float); |
| 777 | } break; |
| 778 | case RS::ARRAY_NORMAL: { |
| 779 | elem_size = 4; |
| 780 | } break; |
| 781 | case RS::ARRAY_TANGENT: { |
| 782 | elem_size = 4; |
| 783 | } break; |
| 784 | case RS::ARRAY_COLOR: { |
| 785 | elem_size = 4; |
| 786 | } break; |
| 787 | case RS::ARRAY_TEX_UV: { |
| 788 | elem_size = 8; |
| 789 | } break; |
| 790 | case RS::ARRAY_TEX_UV2: { |
| 791 | elem_size = 8; |
| 792 | } break; |
| 793 | case RS::ARRAY_CUSTOM0: |
| 794 | case RS::ARRAY_CUSTOM1: |
| 795 | case RS::ARRAY_CUSTOM2: |
| 796 | case RS::ARRAY_CUSTOM3: { |
| 797 | uint32_t format = (p_format >> (ARRAY_FORMAT_CUSTOM_BASE + (ARRAY_FORMAT_CUSTOM_BITS * (i - ARRAY_CUSTOM0)))) & ARRAY_FORMAT_CUSTOM_MASK; |
| 798 | switch (format) { |
| 799 | case ARRAY_CUSTOM_RGBA8_UNORM: { |
| 800 | elem_size = 4; |
| 801 | } break; |
| 802 | case ARRAY_CUSTOM_RGBA8_SNORM: { |
| 803 | elem_size = 4; |
| 804 | } break; |
| 805 | case ARRAY_CUSTOM_RG_HALF: { |
| 806 | elem_size = 4; |
| 807 | } break; |
| 808 | case ARRAY_CUSTOM_RGBA_HALF: { |
| 809 | elem_size = 8; |
| 810 | } break; |
| 811 | case ARRAY_CUSTOM_R_FLOAT: { |
| 812 | elem_size = 4; |
| 813 | } break; |
| 814 | case ARRAY_CUSTOM_RG_FLOAT: { |
| 815 | elem_size = 8; |
| 816 | } break; |
| 817 | case ARRAY_CUSTOM_RGB_FLOAT: { |
| 818 | elem_size = 12; |
| 819 | } break; |
| 820 | case ARRAY_CUSTOM_RGBA_FLOAT: { |
| 821 | elem_size = 16; |
| 822 | } break; |
| 823 | } |
| 824 | } break; |
| 825 | case RS::ARRAY_WEIGHTS: { |
| 826 | uint32_t bone_count = (p_format & ARRAY_FLAG_USE_8_BONE_WEIGHTS) ? 8 : 4; |
| 827 | elem_size = sizeof(uint16_t) * bone_count; |
| 828 | |
| 829 | } break; |
| 830 | case RS::ARRAY_BONES: { |
| 831 | uint32_t bone_count = (p_format & ARRAY_FLAG_USE_8_BONE_WEIGHTS) ? 8 : 4; |
| 832 | elem_size = sizeof(uint16_t) * bone_count; |
| 833 | } break; |
| 834 | case RS::ARRAY_INDEX: { |
| 835 | if (p_index_len <= 0) { |
| 836 | ERR_PRINT("index_array_len==NO_INDEX_ARRAY" ); |
| 837 | break; |
| 838 | } |
| 839 | /* determine whether using 16 or 32 bits indices */ |
| 840 | if (p_vertex_len <= (1 << 16) && p_vertex_len > 0) { |
| 841 | elem_size = 2; |
| 842 | } else { |
| 843 | elem_size = 4; |
| 844 | } |
| 845 | r_offsets[i] = elem_size; |
| 846 | continue; |
| 847 | } |
| 848 | default: { |
| 849 | ERR_FAIL(); |
| 850 | } |
| 851 | } |
| 852 | |
| 853 | if (size_accum != nullptr) { |
| 854 | r_offsets[i] = (*size_accum); |
| 855 | (*size_accum) += elem_size; |
| 856 | } else { |
| 857 | r_offsets[i] = 0; |
| 858 | } |
| 859 | } |
| 860 | } |
| 861 | |
| 862 | Error RenderingServer::mesh_create_surface_data_from_arrays(SurfaceData *r_surface_data, PrimitiveType p_primitive, const Array &p_arrays, const Array &p_blend_shapes, const Dictionary &p_lods, uint32_t p_compress_format) { |
| 863 | ERR_FAIL_INDEX_V(p_primitive, RS::PRIMITIVE_MAX, ERR_INVALID_PARAMETER); |
| 864 | ERR_FAIL_COND_V(p_arrays.size() != RS::ARRAY_MAX, ERR_INVALID_PARAMETER); |
| 865 | |
| 866 | uint32_t format = 0; |
| 867 | |
| 868 | // Validation |
| 869 | int index_array_len = 0; |
| 870 | int array_len = 0; |
| 871 | |
| 872 | for (int i = 0; i < p_arrays.size(); i++) { |
| 873 | if (p_arrays[i].get_type() == Variant::NIL) { |
| 874 | continue; |
| 875 | } |
| 876 | |
| 877 | format |= (1 << i); |
| 878 | |
| 879 | if (i == RS::ARRAY_VERTEX) { |
| 880 | switch (p_arrays[i].get_type()) { |
| 881 | case Variant::PACKED_VECTOR2_ARRAY: { |
| 882 | Vector<Vector2> v2 = p_arrays[i]; |
| 883 | array_len = v2.size(); |
| 884 | format |= ARRAY_FLAG_USE_2D_VERTICES; |
| 885 | } break; |
| 886 | case Variant::PACKED_VECTOR3_ARRAY: { |
| 887 | ERR_FAIL_COND_V(p_compress_format & ARRAY_FLAG_USE_2D_VERTICES, ERR_INVALID_PARAMETER); |
| 888 | Vector<Vector3> v3 = p_arrays[i]; |
| 889 | array_len = v3.size(); |
| 890 | } break; |
| 891 | default: { |
| 892 | ERR_FAIL_V(ERR_INVALID_DATA); |
| 893 | } break; |
| 894 | } |
| 895 | ERR_FAIL_COND_V(array_len == 0, ERR_INVALID_DATA); |
| 896 | } else if (i == RS::ARRAY_BONES) { |
| 897 | switch (p_arrays[i].get_type()) { |
| 898 | case Variant::PACKED_INT32_ARRAY: { |
| 899 | Vector<Vector3> vertices = p_arrays[RS::ARRAY_VERTEX]; |
| 900 | Vector<int32_t> bones = p_arrays[i]; |
| 901 | int32_t bone_8_group_count = bones.size() / (ARRAY_WEIGHTS_SIZE * 2); |
| 902 | int32_t vertex_count = vertices.size(); |
| 903 | if (vertex_count == bone_8_group_count) { |
| 904 | format |= RS::ARRAY_FLAG_USE_8_BONE_WEIGHTS; |
| 905 | } |
| 906 | } break; |
| 907 | default: { |
| 908 | ERR_FAIL_V(ERR_INVALID_DATA); |
| 909 | } break; |
| 910 | } |
| 911 | } else if (i == RS::ARRAY_INDEX) { |
| 912 | index_array_len = PackedInt32Array(p_arrays[i]).size(); |
| 913 | } |
| 914 | } |
| 915 | |
| 916 | if (p_blend_shapes.size()) { |
| 917 | // Validate format for morphs. |
| 918 | for (int i = 0; i < p_blend_shapes.size(); i++) { |
| 919 | uint32_t bsformat = 0; |
| 920 | Array arr = p_blend_shapes[i]; |
| 921 | for (int j = 0; j < arr.size(); j++) { |
| 922 | if (arr[j].get_type() != Variant::NIL) { |
| 923 | bsformat |= (1 << j); |
| 924 | } |
| 925 | } |
| 926 | |
| 927 | ERR_FAIL_COND_V_MSG(bsformat != (format & RS::ARRAY_FORMAT_BLEND_SHAPE_MASK), ERR_INVALID_PARAMETER, "Blend shape format must match the main array format for Vertex, Normal and Tangent arrays." ); |
| 928 | } |
| 929 | } |
| 930 | |
| 931 | for (uint32_t i = 0; i < RS::ARRAY_CUSTOM_COUNT; ++i) { |
| 932 | // Include custom array format type. |
| 933 | if (format & (1 << (ARRAY_CUSTOM0 + i))) { |
| 934 | format |= (RS::ARRAY_FORMAT_CUSTOM_MASK << (RS::ARRAY_FORMAT_CUSTOM_BASE + i * RS::ARRAY_FORMAT_CUSTOM_BITS)) & p_compress_format; |
| 935 | } |
| 936 | } |
| 937 | |
| 938 | uint32_t offsets[RS::ARRAY_MAX]; |
| 939 | |
| 940 | uint32_t vertex_element_size; |
| 941 | uint32_t attrib_element_size; |
| 942 | uint32_t skin_element_size; |
| 943 | |
| 944 | mesh_surface_make_offsets_from_format(format, array_len, index_array_len, offsets, vertex_element_size, attrib_element_size, skin_element_size); |
| 945 | |
| 946 | uint32_t mask = (1 << ARRAY_MAX) - 1; |
| 947 | format |= (~mask) & p_compress_format; // Make the full format. |
| 948 | |
| 949 | if ((format & RS::ARRAY_FORMAT_VERTEX) == 0 && !(format & RS::ARRAY_FLAG_USES_EMPTY_VERTEX_ARRAY)) { |
| 950 | ERR_PRINT("Mesh created without vertex array. This mesh will not be visible with the default shader. If using an empty vertex array is intentional, create the mesh with the ARRAY_FLAG_USES_EMPTY_VERTEX_ARRAY flag to silence this error." ); |
| 951 | // Set the flag here after warning to suppress errors down the pipeline. |
| 952 | format |= RS::ARRAY_FLAG_USES_EMPTY_VERTEX_ARRAY; |
| 953 | } |
| 954 | |
| 955 | int vertex_array_size = vertex_element_size * array_len; |
| 956 | int attrib_array_size = attrib_element_size * array_len; |
| 957 | int skin_array_size = skin_element_size * array_len; |
| 958 | int index_array_size = offsets[RS::ARRAY_INDEX] * index_array_len; |
| 959 | |
| 960 | Vector<uint8_t> vertex_array; |
| 961 | vertex_array.resize(vertex_array_size); |
| 962 | |
| 963 | Vector<uint8_t> attrib_array; |
| 964 | attrib_array.resize(attrib_array_size); |
| 965 | |
| 966 | Vector<uint8_t> skin_array; |
| 967 | skin_array.resize(skin_array_size); |
| 968 | |
| 969 | Vector<uint8_t> index_array; |
| 970 | index_array.resize(index_array_size); |
| 971 | |
| 972 | AABB aabb; |
| 973 | Vector<AABB> bone_aabb; |
| 974 | |
| 975 | Error err = _surface_set_data(p_arrays, format, offsets, vertex_element_size, attrib_element_size, skin_element_size, vertex_array, attrib_array, skin_array, array_len, index_array, index_array_len, aabb, bone_aabb); |
| 976 | ERR_FAIL_COND_V_MSG(err != OK, ERR_INVALID_DATA, "Invalid array format for surface." ); |
| 977 | |
| 978 | Vector<uint8_t> blend_shape_data; |
| 979 | |
| 980 | if (p_blend_shapes.size()) { |
| 981 | uint32_t bs_format = format & RS::ARRAY_FORMAT_BLEND_SHAPE_MASK; |
| 982 | for (int i = 0; i < p_blend_shapes.size(); i++) { |
| 983 | Vector<uint8_t> vertex_array_shape; |
| 984 | vertex_array_shape.resize(vertex_array_size); |
| 985 | Vector<uint8_t> noindex; |
| 986 | Vector<uint8_t> noattrib; |
| 987 | Vector<uint8_t> noskin; |
| 988 | |
| 989 | AABB laabb; |
| 990 | Error err2 = _surface_set_data(p_blend_shapes[i], bs_format, offsets, vertex_element_size, 0, 0, vertex_array_shape, noattrib, noskin, array_len, noindex, 0, laabb, bone_aabb); |
| 991 | aabb.merge_with(laabb); |
| 992 | ERR_FAIL_COND_V_MSG(err2 != OK, ERR_INVALID_DATA, "Invalid blend shape array format for surface." ); |
| 993 | |
| 994 | blend_shape_data.append_array(vertex_array_shape); |
| 995 | } |
| 996 | } |
| 997 | Vector<SurfaceData::LOD> lods; |
| 998 | if (index_array_len) { |
| 999 | List<Variant> keys; |
| 1000 | p_lods.get_key_list(&keys); |
| 1001 | keys.sort(); // otherwise lod levels may get skipped |
| 1002 | for (const Variant &E : keys) { |
| 1003 | float distance = E; |
| 1004 | ERR_CONTINUE(distance <= 0.0); |
| 1005 | Vector<int> indices = p_lods[E]; |
| 1006 | ERR_CONTINUE(indices.size() == 0); |
| 1007 | uint32_t index_count = indices.size(); |
| 1008 | ERR_CONTINUE(index_count >= (uint32_t)index_array_len); // Should be smaller.. |
| 1009 | |
| 1010 | const int *r = indices.ptr(); |
| 1011 | |
| 1012 | Vector<uint8_t> data; |
| 1013 | if (array_len <= 65536) { |
| 1014 | // 16 bits indices |
| 1015 | data.resize(indices.size() * 2); |
| 1016 | uint8_t *w = data.ptrw(); |
| 1017 | uint16_t *index_ptr = (uint16_t *)w; |
| 1018 | for (uint32_t i = 0; i < index_count; i++) { |
| 1019 | index_ptr[i] = r[i]; |
| 1020 | } |
| 1021 | } else { |
| 1022 | // 32 bits indices |
| 1023 | data.resize(indices.size() * 4); |
| 1024 | uint8_t *w = data.ptrw(); |
| 1025 | uint32_t *index_ptr = (uint32_t *)w; |
| 1026 | for (uint32_t i = 0; i < index_count; i++) { |
| 1027 | index_ptr[i] = r[i]; |
| 1028 | } |
| 1029 | } |
| 1030 | |
| 1031 | SurfaceData::LOD lod; |
| 1032 | lod.edge_length = distance; |
| 1033 | lod.index_data = data; |
| 1034 | lods.push_back(lod); |
| 1035 | } |
| 1036 | } |
| 1037 | |
| 1038 | SurfaceData &surface_data = *r_surface_data; |
| 1039 | surface_data.format = format; |
| 1040 | surface_data.primitive = p_primitive; |
| 1041 | surface_data.aabb = aabb; |
| 1042 | surface_data.vertex_data = vertex_array; |
| 1043 | surface_data.attribute_data = attrib_array; |
| 1044 | surface_data.skin_data = skin_array; |
| 1045 | surface_data.vertex_count = array_len; |
| 1046 | surface_data.index_data = index_array; |
| 1047 | surface_data.index_count = index_array_len; |
| 1048 | surface_data.blend_shape_data = blend_shape_data; |
| 1049 | surface_data.bone_aabbs = bone_aabb; |
| 1050 | surface_data.lods = lods; |
| 1051 | |
| 1052 | return OK; |
| 1053 | } |
| 1054 | |
| 1055 | void RenderingServer::mesh_add_surface_from_arrays(RID p_mesh, PrimitiveType p_primitive, const Array &p_arrays, const Array &p_blend_shapes, const Dictionary &p_lods, BitField<ArrayFormat> p_compress_format) { |
| 1056 | SurfaceData sd; |
| 1057 | Error err = mesh_create_surface_data_from_arrays(&sd, p_primitive, p_arrays, p_blend_shapes, p_lods, p_compress_format); |
| 1058 | if (err != OK) { |
| 1059 | return; |
| 1060 | } |
| 1061 | mesh_add_surface(p_mesh, sd); |
| 1062 | } |
| 1063 | |
| 1064 | Array RenderingServer::_get_array_from_surface(uint32_t p_format, Vector<uint8_t> p_vertex_data, Vector<uint8_t> p_attrib_data, Vector<uint8_t> p_skin_data, int p_vertex_len, Vector<uint8_t> p_index_data, int p_index_len) const { |
| 1065 | uint32_t offsets[RS::ARRAY_MAX]; |
| 1066 | |
| 1067 | uint32_t vertex_elem_size; |
| 1068 | uint32_t attrib_elem_size; |
| 1069 | uint32_t skin_elem_size; |
| 1070 | mesh_surface_make_offsets_from_format(p_format, p_vertex_len, p_index_len, offsets, vertex_elem_size, attrib_elem_size, skin_elem_size); |
| 1071 | |
| 1072 | Array ret; |
| 1073 | ret.resize(RS::ARRAY_MAX); |
| 1074 | |
| 1075 | const uint8_t *r = p_vertex_data.ptr(); |
| 1076 | const uint8_t *ar = p_attrib_data.ptr(); |
| 1077 | const uint8_t *sr = p_skin_data.ptr(); |
| 1078 | |
| 1079 | for (int i = 0; i < RS::ARRAY_MAX; i++) { |
| 1080 | if (!(p_format & (1 << i))) { |
| 1081 | continue; |
| 1082 | } |
| 1083 | |
| 1084 | switch (i) { |
| 1085 | case RS::ARRAY_VERTEX: { |
| 1086 | if (p_format & ARRAY_FLAG_USE_2D_VERTICES) { |
| 1087 | Vector<Vector2> arr_2d; |
| 1088 | arr_2d.resize(p_vertex_len); |
| 1089 | |
| 1090 | { |
| 1091 | Vector2 *w = arr_2d.ptrw(); |
| 1092 | |
| 1093 | for (int j = 0; j < p_vertex_len; j++) { |
| 1094 | const float *v = reinterpret_cast<const float *>(&r[j * vertex_elem_size + offsets[i]]); |
| 1095 | w[j] = Vector2(v[0], v[1]); |
| 1096 | } |
| 1097 | } |
| 1098 | |
| 1099 | ret[i] = arr_2d; |
| 1100 | } else { |
| 1101 | Vector<Vector3> arr_3d; |
| 1102 | arr_3d.resize(p_vertex_len); |
| 1103 | |
| 1104 | { |
| 1105 | Vector3 *w = arr_3d.ptrw(); |
| 1106 | |
| 1107 | for (int j = 0; j < p_vertex_len; j++) { |
| 1108 | const float *v = reinterpret_cast<const float *>(&r[j * vertex_elem_size + offsets[i]]); |
| 1109 | w[j] = Vector3(v[0], v[1], v[2]); |
| 1110 | } |
| 1111 | } |
| 1112 | |
| 1113 | ret[i] = arr_3d; |
| 1114 | } |
| 1115 | |
| 1116 | } break; |
| 1117 | case RS::ARRAY_NORMAL: { |
| 1118 | Vector<Vector3> arr; |
| 1119 | arr.resize(p_vertex_len); |
| 1120 | |
| 1121 | Vector3 *w = arr.ptrw(); |
| 1122 | |
| 1123 | for (int j = 0; j < p_vertex_len; j++) { |
| 1124 | const uint32_t v = *(const uint32_t *)&r[j * vertex_elem_size + offsets[i]]; |
| 1125 | |
| 1126 | w[j] = Vector3::octahedron_decode(Vector2((v & 0xFFFF) / 65535.0, ((v >> 16) & 0xFFFF) / 65535.0)); |
| 1127 | } |
| 1128 | |
| 1129 | ret[i] = arr; |
| 1130 | |
| 1131 | } break; |
| 1132 | |
| 1133 | case RS::ARRAY_TANGENT: { |
| 1134 | Vector<float> arr; |
| 1135 | arr.resize(p_vertex_len * 4); |
| 1136 | |
| 1137 | float *w = arr.ptrw(); |
| 1138 | |
| 1139 | for (int j = 0; j < p_vertex_len; j++) { |
| 1140 | const uint32_t v = *(const uint32_t *)&r[j * vertex_elem_size + offsets[i]]; |
| 1141 | float tangent_sign; |
| 1142 | Vector3 res = Vector3::octahedron_tangent_decode(Vector2((v & 0xFFFF) / 65535.0, ((v >> 16) & 0xFFFF) / 65535.0), &tangent_sign); |
| 1143 | w[j * 4 + 0] = res.x; |
| 1144 | w[j * 4 + 1] = res.y; |
| 1145 | w[j * 4 + 2] = res.z; |
| 1146 | w[j * 4 + 3] = tangent_sign; |
| 1147 | } |
| 1148 | |
| 1149 | ret[i] = arr; |
| 1150 | |
| 1151 | } break; |
| 1152 | case RS::ARRAY_COLOR: { |
| 1153 | Vector<Color> arr; |
| 1154 | arr.resize(p_vertex_len); |
| 1155 | |
| 1156 | Color *w = arr.ptrw(); |
| 1157 | |
| 1158 | for (int32_t j = 0; j < p_vertex_len; j++) { |
| 1159 | const uint8_t *v = reinterpret_cast<const uint8_t *>(&ar[j * attrib_elem_size + offsets[i]]); |
| 1160 | |
| 1161 | w[j] = Color(v[0] / 255.0, v[1] / 255.0, v[2] / 255.0, v[3] / 255.0); |
| 1162 | } |
| 1163 | |
| 1164 | ret[i] = arr; |
| 1165 | } break; |
| 1166 | case RS::ARRAY_TEX_UV: { |
| 1167 | Vector<Vector2> arr; |
| 1168 | arr.resize(p_vertex_len); |
| 1169 | |
| 1170 | Vector2 *w = arr.ptrw(); |
| 1171 | |
| 1172 | for (int j = 0; j < p_vertex_len; j++) { |
| 1173 | const float *v = reinterpret_cast<const float *>(&ar[j * attrib_elem_size + offsets[i]]); |
| 1174 | w[j] = Vector2(v[0], v[1]); |
| 1175 | } |
| 1176 | |
| 1177 | ret[i] = arr; |
| 1178 | } break; |
| 1179 | |
| 1180 | case RS::ARRAY_TEX_UV2: { |
| 1181 | Vector<Vector2> arr; |
| 1182 | arr.resize(p_vertex_len); |
| 1183 | |
| 1184 | Vector2 *w = arr.ptrw(); |
| 1185 | |
| 1186 | for (int j = 0; j < p_vertex_len; j++) { |
| 1187 | const float *v = reinterpret_cast<const float *>(&ar[j * attrib_elem_size + offsets[i]]); |
| 1188 | w[j] = Vector2(v[0], v[1]); |
| 1189 | } |
| 1190 | |
| 1191 | ret[i] = arr; |
| 1192 | |
| 1193 | } break; |
| 1194 | case RS::ARRAY_CUSTOM0: |
| 1195 | case RS::ARRAY_CUSTOM1: |
| 1196 | case RS::ARRAY_CUSTOM2: |
| 1197 | case RS::ARRAY_CUSTOM3: { |
| 1198 | uint32_t type = (p_format >> (ARRAY_FORMAT_CUSTOM_BASE + ARRAY_FORMAT_CUSTOM_BITS * (i - RS::ARRAY_CUSTOM0))) & ARRAY_FORMAT_CUSTOM_MASK; |
| 1199 | switch (type) { |
| 1200 | case ARRAY_CUSTOM_RGBA8_UNORM: |
| 1201 | case ARRAY_CUSTOM_RGBA8_SNORM: |
| 1202 | case ARRAY_CUSTOM_RG_HALF: |
| 1203 | case ARRAY_CUSTOM_RGBA_HALF: { |
| 1204 | // Size 4 |
| 1205 | int s = type == ARRAY_CUSTOM_RGBA_HALF ? 8 : 4; |
| 1206 | Vector<uint8_t> arr; |
| 1207 | arr.resize(p_vertex_len * s); |
| 1208 | |
| 1209 | uint8_t *w = arr.ptrw(); |
| 1210 | |
| 1211 | for (int j = 0; j < p_vertex_len; j++) { |
| 1212 | const uint8_t *v = reinterpret_cast<const uint8_t *>(&ar[j * attrib_elem_size + offsets[i]]); |
| 1213 | memcpy(&w[j * s], v, s); |
| 1214 | } |
| 1215 | |
| 1216 | ret[i] = arr; |
| 1217 | |
| 1218 | } break; |
| 1219 | case ARRAY_CUSTOM_R_FLOAT: |
| 1220 | case ARRAY_CUSTOM_RG_FLOAT: |
| 1221 | case ARRAY_CUSTOM_RGB_FLOAT: |
| 1222 | case ARRAY_CUSTOM_RGBA_FLOAT: { |
| 1223 | uint32_t s = type - ARRAY_CUSTOM_R_FLOAT + 1; |
| 1224 | |
| 1225 | Vector<float> arr; |
| 1226 | arr.resize(s * p_vertex_len); |
| 1227 | |
| 1228 | float *w = arr.ptrw(); |
| 1229 | |
| 1230 | for (int j = 0; j < p_vertex_len; j++) { |
| 1231 | const float *v = reinterpret_cast<const float *>(&ar[j * attrib_elem_size + offsets[i]]); |
| 1232 | memcpy(&w[j * s], v, s * sizeof(float)); |
| 1233 | } |
| 1234 | ret[i] = arr; |
| 1235 | |
| 1236 | } break; |
| 1237 | default: { |
| 1238 | } |
| 1239 | } |
| 1240 | |
| 1241 | } break; |
| 1242 | case RS::ARRAY_WEIGHTS: { |
| 1243 | uint32_t bone_count = (p_format & ARRAY_FLAG_USE_8_BONE_WEIGHTS) ? 8 : 4; |
| 1244 | |
| 1245 | Vector<float> arr; |
| 1246 | arr.resize(p_vertex_len * bone_count); |
| 1247 | { |
| 1248 | float *w = arr.ptrw(); |
| 1249 | |
| 1250 | for (int j = 0; j < p_vertex_len; j++) { |
| 1251 | const uint16_t *v = (const uint16_t *)&sr[j * skin_elem_size + offsets[i]]; |
| 1252 | for (uint32_t k = 0; k < bone_count; k++) { |
| 1253 | w[j * bone_count + k] = float(v[k] / 65535.0); |
| 1254 | } |
| 1255 | } |
| 1256 | } |
| 1257 | |
| 1258 | ret[i] = arr; |
| 1259 | |
| 1260 | } break; |
| 1261 | case RS::ARRAY_BONES: { |
| 1262 | uint32_t bone_count = (p_format & ARRAY_FLAG_USE_8_BONE_WEIGHTS) ? 8 : 4; |
| 1263 | |
| 1264 | Vector<int> arr; |
| 1265 | arr.resize(p_vertex_len * bone_count); |
| 1266 | |
| 1267 | int *w = arr.ptrw(); |
| 1268 | |
| 1269 | for (int j = 0; j < p_vertex_len; j++) { |
| 1270 | const uint16_t *v = (const uint16_t *)&sr[j * skin_elem_size + offsets[i]]; |
| 1271 | for (uint32_t k = 0; k < bone_count; k++) { |
| 1272 | w[j * bone_count + k] = v[k]; |
| 1273 | } |
| 1274 | } |
| 1275 | |
| 1276 | ret[i] = arr; |
| 1277 | |
| 1278 | } break; |
| 1279 | case RS::ARRAY_INDEX: { |
| 1280 | /* determine whether using 16 or 32 bits indices */ |
| 1281 | |
| 1282 | const uint8_t *ir = p_index_data.ptr(); |
| 1283 | |
| 1284 | Vector<int> arr; |
| 1285 | arr.resize(p_index_len); |
| 1286 | if (p_vertex_len <= (1 << 16)) { |
| 1287 | int *w = arr.ptrw(); |
| 1288 | |
| 1289 | for (int j = 0; j < p_index_len; j++) { |
| 1290 | const uint16_t *v = (const uint16_t *)&ir[j * 2]; |
| 1291 | w[j] = *v; |
| 1292 | } |
| 1293 | } else { |
| 1294 | int *w = arr.ptrw(); |
| 1295 | |
| 1296 | for (int j = 0; j < p_index_len; j++) { |
| 1297 | const int *v = (const int *)&ir[j * 4]; |
| 1298 | w[j] = *v; |
| 1299 | } |
| 1300 | } |
| 1301 | ret[i] = arr; |
| 1302 | } break; |
| 1303 | default: { |
| 1304 | ERR_FAIL_V(ret); |
| 1305 | } |
| 1306 | } |
| 1307 | } |
| 1308 | |
| 1309 | return ret; |
| 1310 | } |
| 1311 | |
| 1312 | Array RenderingServer::mesh_surface_get_arrays(RID p_mesh, int p_surface) const { |
| 1313 | SurfaceData sd = mesh_get_surface(p_mesh, p_surface); |
| 1314 | return mesh_create_arrays_from_surface_data(sd); |
| 1315 | } |
| 1316 | |
| 1317 | Dictionary RenderingServer::mesh_surface_get_lods(RID p_mesh, int p_surface) const { |
| 1318 | SurfaceData sd = mesh_get_surface(p_mesh, p_surface); |
| 1319 | ERR_FAIL_COND_V(sd.vertex_count == 0, Dictionary()); |
| 1320 | |
| 1321 | Dictionary ret; |
| 1322 | |
| 1323 | for (int i = 0; i < sd.lods.size(); i++) { |
| 1324 | Vector<int> lods; |
| 1325 | if (sd.vertex_count <= 65536) { |
| 1326 | uint32_t lc = sd.lods[i].index_data.size() / 2; |
| 1327 | lods.resize(lc); |
| 1328 | const uint8_t *r = sd.lods[i].index_data.ptr(); |
| 1329 | const uint16_t *rptr = (const uint16_t *)r; |
| 1330 | int *w = lods.ptrw(); |
| 1331 | for (uint32_t j = 0; j < lc; j++) { |
| 1332 | w[j] = rptr[i]; |
| 1333 | } |
| 1334 | } else { |
| 1335 | uint32_t lc = sd.lods[i].index_data.size() / 4; |
| 1336 | lods.resize(lc); |
| 1337 | const uint8_t *r = sd.lods[i].index_data.ptr(); |
| 1338 | const uint32_t *rptr = (const uint32_t *)r; |
| 1339 | int *w = lods.ptrw(); |
| 1340 | for (uint32_t j = 0; j < lc; j++) { |
| 1341 | w[j] = rptr[i]; |
| 1342 | } |
| 1343 | } |
| 1344 | |
| 1345 | ret[sd.lods[i].edge_length] = lods; |
| 1346 | } |
| 1347 | |
| 1348 | return ret; |
| 1349 | } |
| 1350 | |
| 1351 | TypedArray<Array> RenderingServer::mesh_surface_get_blend_shape_arrays(RID p_mesh, int p_surface) const { |
| 1352 | SurfaceData sd = mesh_get_surface(p_mesh, p_surface); |
| 1353 | ERR_FAIL_COND_V(sd.vertex_count == 0, Array()); |
| 1354 | |
| 1355 | Vector<uint8_t> blend_shape_data = sd.blend_shape_data; |
| 1356 | |
| 1357 | if (blend_shape_data.size() > 0) { |
| 1358 | uint32_t bs_offsets[RS::ARRAY_MAX]; |
| 1359 | uint32_t bs_format = (sd.format & RS::ARRAY_FORMAT_BLEND_SHAPE_MASK); |
| 1360 | uint32_t vertex_elem_size; |
| 1361 | uint32_t attrib_elem_size; |
| 1362 | uint32_t skin_elem_size; |
| 1363 | |
| 1364 | mesh_surface_make_offsets_from_format(bs_format, sd.vertex_count, 0, bs_offsets, vertex_elem_size, attrib_elem_size, skin_elem_size); |
| 1365 | |
| 1366 | int divisor = vertex_elem_size * sd.vertex_count; |
| 1367 | ERR_FAIL_COND_V((blend_shape_data.size() % divisor) != 0, Array()); |
| 1368 | |
| 1369 | uint32_t blend_shape_count = blend_shape_data.size() / divisor; |
| 1370 | |
| 1371 | ERR_FAIL_COND_V(blend_shape_count != (uint32_t)mesh_get_blend_shape_count(p_mesh), Array()); |
| 1372 | |
| 1373 | TypedArray<Array> blend_shape_array; |
| 1374 | blend_shape_array.resize(mesh_get_blend_shape_count(p_mesh)); |
| 1375 | for (uint32_t i = 0; i < blend_shape_count; i++) { |
| 1376 | Vector<uint8_t> bs_data = blend_shape_data.slice(i * divisor, (i + 1) * divisor); |
| 1377 | Vector<uint8_t> unused; |
| 1378 | blend_shape_array.set(i, _get_array_from_surface(bs_format, bs_data, unused, unused, sd.vertex_count, unused, 0)); |
| 1379 | } |
| 1380 | |
| 1381 | return blend_shape_array; |
| 1382 | } else { |
| 1383 | return TypedArray<Array>(); |
| 1384 | } |
| 1385 | } |
| 1386 | |
| 1387 | Array RenderingServer::mesh_create_arrays_from_surface_data(const SurfaceData &p_data) const { |
| 1388 | Vector<uint8_t> vertex_data = p_data.vertex_data; |
| 1389 | Vector<uint8_t> attrib_data = p_data.attribute_data; |
| 1390 | Vector<uint8_t> skin_data = p_data.skin_data; |
| 1391 | |
| 1392 | ERR_FAIL_COND_V(vertex_data.size() == 0 && (p_data.format & RS::ARRAY_FORMAT_VERTEX), Array()); |
| 1393 | int vertex_len = p_data.vertex_count; |
| 1394 | |
| 1395 | Vector<uint8_t> index_data = p_data.index_data; |
| 1396 | int index_len = p_data.index_count; |
| 1397 | |
| 1398 | uint32_t format = p_data.format; |
| 1399 | |
| 1400 | return _get_array_from_surface(format, vertex_data, attrib_data, skin_data, vertex_len, index_data, index_len); |
| 1401 | } |
| 1402 | #if 0 |
| 1403 | Array RenderingServer::_mesh_surface_get_skeleton_aabb_bind(RID p_mesh, int p_surface) const { |
| 1404 | Vector<AABB> vec = RS::get_singleton()->mesh_surface_get_skeleton_aabb(p_mesh, p_surface); |
| 1405 | Array arr; |
| 1406 | for (int i = 0; i < vec.size(); i++) { |
| 1407 | arr[i] = vec[i]; |
| 1408 | } |
| 1409 | return arr; |
| 1410 | } |
| 1411 | #endif |
| 1412 | |
| 1413 | int RenderingServer::global_shader_uniform_type_get_shader_datatype(GlobalShaderParameterType p_type) { |
| 1414 | switch (p_type) { |
| 1415 | case RS::GLOBAL_VAR_TYPE_BOOL: |
| 1416 | return ShaderLanguage::TYPE_BOOL; |
| 1417 | case RS::GLOBAL_VAR_TYPE_BVEC2: |
| 1418 | return ShaderLanguage::TYPE_BVEC2; |
| 1419 | case RS::GLOBAL_VAR_TYPE_BVEC3: |
| 1420 | return ShaderLanguage::TYPE_BVEC3; |
| 1421 | case RS::GLOBAL_VAR_TYPE_BVEC4: |
| 1422 | return ShaderLanguage::TYPE_BVEC4; |
| 1423 | case RS::GLOBAL_VAR_TYPE_INT: |
| 1424 | return ShaderLanguage::TYPE_INT; |
| 1425 | case RS::GLOBAL_VAR_TYPE_IVEC2: |
| 1426 | return ShaderLanguage::TYPE_IVEC2; |
| 1427 | case RS::GLOBAL_VAR_TYPE_IVEC3: |
| 1428 | return ShaderLanguage::TYPE_IVEC3; |
| 1429 | case RS::GLOBAL_VAR_TYPE_IVEC4: |
| 1430 | return ShaderLanguage::TYPE_IVEC4; |
| 1431 | case RS::GLOBAL_VAR_TYPE_RECT2I: |
| 1432 | return ShaderLanguage::TYPE_IVEC4; |
| 1433 | case RS::GLOBAL_VAR_TYPE_UINT: |
| 1434 | return ShaderLanguage::TYPE_UINT; |
| 1435 | case RS::GLOBAL_VAR_TYPE_UVEC2: |
| 1436 | return ShaderLanguage::TYPE_UVEC2; |
| 1437 | case RS::GLOBAL_VAR_TYPE_UVEC3: |
| 1438 | return ShaderLanguage::TYPE_UVEC3; |
| 1439 | case RS::GLOBAL_VAR_TYPE_UVEC4: |
| 1440 | return ShaderLanguage::TYPE_UVEC4; |
| 1441 | case RS::GLOBAL_VAR_TYPE_FLOAT: |
| 1442 | return ShaderLanguage::TYPE_FLOAT; |
| 1443 | case RS::GLOBAL_VAR_TYPE_VEC2: |
| 1444 | return ShaderLanguage::TYPE_VEC2; |
| 1445 | case RS::GLOBAL_VAR_TYPE_VEC3: |
| 1446 | return ShaderLanguage::TYPE_VEC3; |
| 1447 | case RS::GLOBAL_VAR_TYPE_VEC4: |
| 1448 | return ShaderLanguage::TYPE_VEC4; |
| 1449 | case RS::GLOBAL_VAR_TYPE_COLOR: |
| 1450 | return ShaderLanguage::TYPE_VEC4; |
| 1451 | case RS::GLOBAL_VAR_TYPE_RECT2: |
| 1452 | return ShaderLanguage::TYPE_VEC4; |
| 1453 | case RS::GLOBAL_VAR_TYPE_MAT2: |
| 1454 | return ShaderLanguage::TYPE_MAT2; |
| 1455 | case RS::GLOBAL_VAR_TYPE_MAT3: |
| 1456 | return ShaderLanguage::TYPE_MAT3; |
| 1457 | case RS::GLOBAL_VAR_TYPE_MAT4: |
| 1458 | return ShaderLanguage::TYPE_MAT4; |
| 1459 | case RS::GLOBAL_VAR_TYPE_TRANSFORM_2D: |
| 1460 | return ShaderLanguage::TYPE_MAT3; |
| 1461 | case RS::GLOBAL_VAR_TYPE_TRANSFORM: |
| 1462 | return ShaderLanguage::TYPE_MAT4; |
| 1463 | case RS::GLOBAL_VAR_TYPE_SAMPLER2D: |
| 1464 | return ShaderLanguage::TYPE_SAMPLER2D; |
| 1465 | case RS::GLOBAL_VAR_TYPE_SAMPLER2DARRAY: |
| 1466 | return ShaderLanguage::TYPE_SAMPLER2DARRAY; |
| 1467 | case RS::GLOBAL_VAR_TYPE_SAMPLER3D: |
| 1468 | return ShaderLanguage::TYPE_SAMPLER3D; |
| 1469 | case RS::GLOBAL_VAR_TYPE_SAMPLERCUBE: |
| 1470 | return ShaderLanguage::TYPE_SAMPLERCUBE; |
| 1471 | default: |
| 1472 | return ShaderLanguage::TYPE_MAX; // Invalid or not found. |
| 1473 | } |
| 1474 | } |
| 1475 | |
| 1476 | RenderingDevice *RenderingServer::get_rendering_device() const { |
| 1477 | // Return the rendering device we're using globally. |
| 1478 | return RenderingDevice::get_singleton(); |
| 1479 | } |
| 1480 | |
| 1481 | RenderingDevice *RenderingServer::create_local_rendering_device() const { |
| 1482 | RenderingDevice *device = RenderingDevice::get_singleton(); |
| 1483 | if (!device) { |
| 1484 | return nullptr; |
| 1485 | } |
| 1486 | return device->create_local_device(); |
| 1487 | } |
| 1488 | |
| 1489 | static Vector<Ref<Image>> _get_imgvec(const TypedArray<Image> &p_layers) { |
| 1490 | Vector<Ref<Image>> images; |
| 1491 | images.resize(p_layers.size()); |
| 1492 | for (int i = 0; i < p_layers.size(); i++) { |
| 1493 | images.write[i] = p_layers[i]; |
| 1494 | } |
| 1495 | return images; |
| 1496 | } |
| 1497 | RID RenderingServer::_texture_2d_layered_create(const TypedArray<Image> &p_layers, TextureLayeredType p_layered_type) { |
| 1498 | return texture_2d_layered_create(_get_imgvec(p_layers), p_layered_type); |
| 1499 | } |
| 1500 | RID RenderingServer::_texture_3d_create(Image::Format p_format, int p_width, int p_height, int p_depth, bool p_mipmaps, const TypedArray<Image> &p_data) { |
| 1501 | return texture_3d_create(p_format, p_width, p_height, p_depth, p_mipmaps, _get_imgvec(p_data)); |
| 1502 | } |
| 1503 | |
| 1504 | void RenderingServer::_texture_3d_update(RID p_texture, const TypedArray<Image> &p_data) { |
| 1505 | texture_3d_update(p_texture, _get_imgvec(p_data)); |
| 1506 | } |
| 1507 | |
| 1508 | TypedArray<Image> RenderingServer::_texture_3d_get(RID p_texture) const { |
| 1509 | Vector<Ref<Image>> images = texture_3d_get(p_texture); |
| 1510 | TypedArray<Image> ret; |
| 1511 | ret.resize(images.size()); |
| 1512 | for (int i = 0; i < images.size(); i++) { |
| 1513 | ret[i] = images[i]; |
| 1514 | } |
| 1515 | return ret; |
| 1516 | } |
| 1517 | |
| 1518 | TypedArray<Dictionary> RenderingServer::_shader_get_shader_parameter_list(RID p_shader) const { |
| 1519 | List<PropertyInfo> l; |
| 1520 | get_shader_parameter_list(p_shader, &l); |
| 1521 | return convert_property_list(&l); |
| 1522 | } |
| 1523 | |
| 1524 | static RS::SurfaceData _dict_to_surf(const Dictionary &p_dictionary) { |
| 1525 | ERR_FAIL_COND_V(!p_dictionary.has("primitive" ), RS::SurfaceData()); |
| 1526 | ERR_FAIL_COND_V(!p_dictionary.has("format" ), RS::SurfaceData()); |
| 1527 | ERR_FAIL_COND_V(!p_dictionary.has("vertex_data" ), RS::SurfaceData()); |
| 1528 | ERR_FAIL_COND_V(!p_dictionary.has("vertex_count" ), RS::SurfaceData()); |
| 1529 | ERR_FAIL_COND_V(!p_dictionary.has("aabb" ), RS::SurfaceData()); |
| 1530 | |
| 1531 | RS::SurfaceData sd; |
| 1532 | |
| 1533 | sd.primitive = RS::PrimitiveType(int(p_dictionary["primitive" ])); |
| 1534 | sd.format = p_dictionary["format" ]; |
| 1535 | sd.vertex_data = p_dictionary["vertex_data" ]; |
| 1536 | if (p_dictionary.has("attribute_data" )) { |
| 1537 | sd.attribute_data = p_dictionary["attribute_data" ]; |
| 1538 | } |
| 1539 | if (p_dictionary.has("skin_data" )) { |
| 1540 | sd.skin_data = p_dictionary["skin_data" ]; |
| 1541 | } |
| 1542 | |
| 1543 | sd.vertex_count = p_dictionary["vertex_count" ]; |
| 1544 | |
| 1545 | if (p_dictionary.has("index_data" )) { |
| 1546 | sd.index_data = p_dictionary["index_data" ]; |
| 1547 | ERR_FAIL_COND_V(!p_dictionary.has("index_count" ), RS::SurfaceData()); |
| 1548 | sd.index_count = p_dictionary["index_count" ]; |
| 1549 | } |
| 1550 | |
| 1551 | sd.aabb = p_dictionary["aabb" ]; |
| 1552 | |
| 1553 | if (p_dictionary.has("lods" )) { |
| 1554 | Array lods = p_dictionary["lods" ]; |
| 1555 | for (int i = 0; i < lods.size(); i++) { |
| 1556 | Dictionary lod = lods[i]; |
| 1557 | ERR_CONTINUE(!lod.has("edge_length" )); |
| 1558 | ERR_CONTINUE(!lod.has("index_data" )); |
| 1559 | RS::SurfaceData::LOD l; |
| 1560 | l.edge_length = lod["edge_length" ]; |
| 1561 | l.index_data = lod["index_data" ]; |
| 1562 | sd.lods.push_back(l); |
| 1563 | } |
| 1564 | } |
| 1565 | |
| 1566 | if (p_dictionary.has("bone_aabbs" )) { |
| 1567 | Array aabbs = p_dictionary["bone_aabbs" ]; |
| 1568 | for (int i = 0; i < aabbs.size(); i++) { |
| 1569 | AABB aabb = aabbs[i]; |
| 1570 | sd.bone_aabbs.push_back(aabb); |
| 1571 | } |
| 1572 | } |
| 1573 | |
| 1574 | if (p_dictionary.has("blend_shape_data" )) { |
| 1575 | sd.blend_shape_data = p_dictionary["blend_shape_data" ]; |
| 1576 | } |
| 1577 | |
| 1578 | if (p_dictionary.has("material" )) { |
| 1579 | sd.material = p_dictionary["material" ]; |
| 1580 | } |
| 1581 | |
| 1582 | return sd; |
| 1583 | } |
| 1584 | RID RenderingServer::_mesh_create_from_surfaces(const TypedArray<Dictionary> &p_surfaces, int p_blend_shape_count) { |
| 1585 | Vector<RS::SurfaceData> surfaces; |
| 1586 | for (int i = 0; i < p_surfaces.size(); i++) { |
| 1587 | surfaces.push_back(_dict_to_surf(p_surfaces[i])); |
| 1588 | } |
| 1589 | return mesh_create_from_surfaces(surfaces); |
| 1590 | } |
| 1591 | void RenderingServer::_mesh_add_surface(RID p_mesh, const Dictionary &p_surface) { |
| 1592 | mesh_add_surface(p_mesh, _dict_to_surf(p_surface)); |
| 1593 | } |
| 1594 | Dictionary RenderingServer::_mesh_get_surface(RID p_mesh, int p_idx) { |
| 1595 | RS::SurfaceData sd = mesh_get_surface(p_mesh, p_idx); |
| 1596 | |
| 1597 | Dictionary d; |
| 1598 | d["primitive" ] = sd.primitive; |
| 1599 | d["format" ] = sd.format; |
| 1600 | d["vertex_data" ] = sd.vertex_data; |
| 1601 | if (sd.attribute_data.size()) { |
| 1602 | d["attribute_data" ] = sd.attribute_data; |
| 1603 | } |
| 1604 | if (sd.skin_data.size()) { |
| 1605 | d["skin_data" ] = sd.skin_data; |
| 1606 | } |
| 1607 | d["vertex_count" ] = sd.vertex_count; |
| 1608 | if (sd.index_count) { |
| 1609 | d["index_data" ] = sd.index_data; |
| 1610 | d["index_count" ] = sd.index_count; |
| 1611 | } |
| 1612 | d["aabb" ] = sd.aabb; |
| 1613 | |
| 1614 | if (sd.lods.size()) { |
| 1615 | Array lods; |
| 1616 | for (int i = 0; i < sd.lods.size(); i++) { |
| 1617 | Dictionary ld; |
| 1618 | ld["edge_length" ] = sd.lods[i].edge_length; |
| 1619 | ld["index_data" ] = sd.lods[i].index_data; |
| 1620 | lods.push_back(lods); |
| 1621 | } |
| 1622 | d["lods" ] = lods; |
| 1623 | } |
| 1624 | |
| 1625 | if (sd.bone_aabbs.size()) { |
| 1626 | Array aabbs; |
| 1627 | for (int i = 0; i < sd.bone_aabbs.size(); i++) { |
| 1628 | aabbs.push_back(sd.bone_aabbs[i]); |
| 1629 | } |
| 1630 | d["bone_aabbs" ] = aabbs; |
| 1631 | } |
| 1632 | |
| 1633 | if (sd.blend_shape_data.size()) { |
| 1634 | d["blend_shape_data" ] = sd.blend_shape_data; |
| 1635 | } |
| 1636 | |
| 1637 | if (sd.material.is_valid()) { |
| 1638 | d["material" ] = sd.material; |
| 1639 | } |
| 1640 | return d; |
| 1641 | } |
| 1642 | |
| 1643 | TypedArray<Dictionary> RenderingServer::_instance_geometry_get_shader_parameter_list(RID p_instance) const { |
| 1644 | List<PropertyInfo> params; |
| 1645 | instance_geometry_get_shader_parameter_list(p_instance, ¶ms); |
| 1646 | return convert_property_list(¶ms); |
| 1647 | } |
| 1648 | |
| 1649 | TypedArray<Image> RenderingServer::_bake_render_uv2(RID p_base, const TypedArray<RID> &p_material_overrides, const Size2i &p_image_size) { |
| 1650 | TypedArray<RID> mat_overrides; |
| 1651 | for (int i = 0; i < p_material_overrides.size(); i++) { |
| 1652 | mat_overrides.push_back(p_material_overrides[i]); |
| 1653 | } |
| 1654 | return bake_render_uv2(p_base, mat_overrides, p_image_size); |
| 1655 | } |
| 1656 | |
| 1657 | void RenderingServer::_particles_set_trail_bind_poses(RID p_particles, const TypedArray<Transform3D> &p_bind_poses) { |
| 1658 | Vector<Transform3D> tbposes; |
| 1659 | tbposes.resize(p_bind_poses.size()); |
| 1660 | for (int i = 0; i < p_bind_poses.size(); i++) { |
| 1661 | tbposes.write[i] = p_bind_poses[i]; |
| 1662 | } |
| 1663 | particles_set_trail_bind_poses(p_particles, tbposes); |
| 1664 | } |
| 1665 | |
| 1666 | void RenderingServer::_bind_methods() { |
| 1667 | BIND_CONSTANT(NO_INDEX_ARRAY); |
| 1668 | BIND_CONSTANT(ARRAY_WEIGHTS_SIZE); |
| 1669 | BIND_CONSTANT(CANVAS_ITEM_Z_MIN); |
| 1670 | BIND_CONSTANT(CANVAS_ITEM_Z_MAX); |
| 1671 | BIND_CONSTANT(MAX_GLOW_LEVELS); |
| 1672 | BIND_CONSTANT(MAX_CURSORS); |
| 1673 | BIND_CONSTANT(MAX_2D_DIRECTIONAL_LIGHTS); |
| 1674 | |
| 1675 | /* TEXTURE */ |
| 1676 | |
| 1677 | ClassDB::bind_method(D_METHOD("texture_2d_create" , "image" ), &RenderingServer::texture_2d_create); |
| 1678 | ClassDB::bind_method(D_METHOD("texture_2d_layered_create" , "layers" , "layered_type" ), &RenderingServer::_texture_2d_layered_create); |
| 1679 | ClassDB::bind_method(D_METHOD("texture_3d_create" , "format" , "width" , "height" , "depth" , "mipmaps" , "data" ), &RenderingServer::_texture_3d_create); |
| 1680 | ClassDB::bind_method(D_METHOD("texture_proxy_create" , "base" ), &RenderingServer::texture_proxy_create); |
| 1681 | |
| 1682 | ClassDB::bind_method(D_METHOD("texture_2d_update" , "texture" , "image" , "layer" ), &RenderingServer::texture_2d_update); |
| 1683 | ClassDB::bind_method(D_METHOD("texture_3d_update" , "texture" , "data" ), &RenderingServer::_texture_3d_update); |
| 1684 | ClassDB::bind_method(D_METHOD("texture_proxy_update" , "texture" , "proxy_to" ), &RenderingServer::texture_proxy_update); |
| 1685 | |
| 1686 | ClassDB::bind_method(D_METHOD("texture_2d_placeholder_create" ), &RenderingServer::texture_2d_placeholder_create); |
| 1687 | ClassDB::bind_method(D_METHOD("texture_2d_layered_placeholder_create" , "layered_type" ), &RenderingServer::texture_2d_layered_placeholder_create); |
| 1688 | ClassDB::bind_method(D_METHOD("texture_3d_placeholder_create" ), &RenderingServer::texture_3d_placeholder_create); |
| 1689 | |
| 1690 | ClassDB::bind_method(D_METHOD("texture_2d_get" , "texture" ), &RenderingServer::texture_2d_get); |
| 1691 | ClassDB::bind_method(D_METHOD("texture_2d_layer_get" , "texture" , "layer" ), &RenderingServer::texture_2d_layer_get); |
| 1692 | ClassDB::bind_method(D_METHOD("texture_3d_get" , "texture" ), &RenderingServer::_texture_3d_get); |
| 1693 | |
| 1694 | ClassDB::bind_method(D_METHOD("texture_replace" , "texture" , "by_texture" ), &RenderingServer::texture_replace); |
| 1695 | ClassDB::bind_method(D_METHOD("texture_set_size_override" , "texture" , "width" , "height" ), &RenderingServer::texture_set_size_override); |
| 1696 | |
| 1697 | ClassDB::bind_method(D_METHOD("texture_set_path" , "texture" , "path" ), &RenderingServer::texture_set_path); |
| 1698 | ClassDB::bind_method(D_METHOD("texture_get_path" , "texture" ), &RenderingServer::texture_get_path); |
| 1699 | |
| 1700 | ClassDB::bind_method(D_METHOD("texture_get_format" , "texture" ), &RenderingServer::texture_get_format); |
| 1701 | |
| 1702 | ClassDB::bind_method(D_METHOD("texture_set_force_redraw_if_visible" , "texture" , "enable" ), &RenderingServer::texture_set_force_redraw_if_visible); |
| 1703 | ClassDB::bind_method(D_METHOD("texture_rd_create" , "rd_texture" , "layer_type" ), &RenderingServer::texture_rd_create, DEFVAL(RenderingServer::TEXTURE_LAYERED_2D_ARRAY)); |
| 1704 | ClassDB::bind_method(D_METHOD("texture_get_rd_texture" , "texture" , "srgb" ), &RenderingServer::texture_get_rd_texture, DEFVAL(false)); |
| 1705 | ClassDB::bind_method(D_METHOD("texture_get_native_handle" , "texture" , "srgb" ), &RenderingServer::texture_get_native_handle, DEFVAL(false)); |
| 1706 | |
| 1707 | BIND_ENUM_CONSTANT(TEXTURE_LAYERED_2D_ARRAY); |
| 1708 | BIND_ENUM_CONSTANT(TEXTURE_LAYERED_CUBEMAP); |
| 1709 | BIND_ENUM_CONSTANT(TEXTURE_LAYERED_CUBEMAP_ARRAY); |
| 1710 | |
| 1711 | BIND_ENUM_CONSTANT(CUBEMAP_LAYER_LEFT); |
| 1712 | BIND_ENUM_CONSTANT(CUBEMAP_LAYER_RIGHT); |
| 1713 | BIND_ENUM_CONSTANT(CUBEMAP_LAYER_BOTTOM); |
| 1714 | BIND_ENUM_CONSTANT(CUBEMAP_LAYER_TOP); |
| 1715 | BIND_ENUM_CONSTANT(CUBEMAP_LAYER_FRONT); |
| 1716 | BIND_ENUM_CONSTANT(CUBEMAP_LAYER_BACK); |
| 1717 | |
| 1718 | /* SHADER */ |
| 1719 | |
| 1720 | ClassDB::bind_method(D_METHOD("shader_create" ), &RenderingServer::shader_create); |
| 1721 | ClassDB::bind_method(D_METHOD("shader_set_code" , "shader" , "code" ), &RenderingServer::shader_set_code); |
| 1722 | ClassDB::bind_method(D_METHOD("shader_set_path_hint" , "shader" , "path" ), &RenderingServer::shader_set_path_hint); |
| 1723 | ClassDB::bind_method(D_METHOD("shader_get_code" , "shader" ), &RenderingServer::shader_get_code); |
| 1724 | ClassDB::bind_method(D_METHOD("get_shader_parameter_list" , "shader" ), &RenderingServer::_shader_get_shader_parameter_list); |
| 1725 | ClassDB::bind_method(D_METHOD("shader_get_parameter_default" , "shader" , "name" ), &RenderingServer::shader_get_parameter_default); |
| 1726 | |
| 1727 | ClassDB::bind_method(D_METHOD("shader_set_default_texture_parameter" , "shader" , "name" , "texture" , "index" ), &RenderingServer::shader_set_default_texture_parameter, DEFVAL(0)); |
| 1728 | ClassDB::bind_method(D_METHOD("shader_get_default_texture_parameter" , "shader" , "name" , "index" ), &RenderingServer::shader_get_default_texture_parameter, DEFVAL(0)); |
| 1729 | |
| 1730 | BIND_ENUM_CONSTANT(SHADER_SPATIAL); |
| 1731 | BIND_ENUM_CONSTANT(SHADER_CANVAS_ITEM); |
| 1732 | BIND_ENUM_CONSTANT(SHADER_PARTICLES); |
| 1733 | BIND_ENUM_CONSTANT(SHADER_SKY); |
| 1734 | BIND_ENUM_CONSTANT(SHADER_FOG); |
| 1735 | BIND_ENUM_CONSTANT(SHADER_MAX); |
| 1736 | |
| 1737 | /* MATERIAL */ |
| 1738 | |
| 1739 | ClassDB::bind_method(D_METHOD("material_create" ), &RenderingServer::material_create); |
| 1740 | ClassDB::bind_method(D_METHOD("material_set_shader" , "shader_material" , "shader" ), &RenderingServer::material_set_shader); |
| 1741 | ClassDB::bind_method(D_METHOD("material_set_param" , "material" , "parameter" , "value" ), &RenderingServer::material_set_param); |
| 1742 | ClassDB::bind_method(D_METHOD("material_get_param" , "material" , "parameter" ), &RenderingServer::material_get_param); |
| 1743 | ClassDB::bind_method(D_METHOD("material_set_render_priority" , "material" , "priority" ), &RenderingServer::material_set_render_priority); |
| 1744 | |
| 1745 | ClassDB::bind_method(D_METHOD("material_set_next_pass" , "material" , "next_material" ), &RenderingServer::material_set_next_pass); |
| 1746 | |
| 1747 | BIND_CONSTANT(MATERIAL_RENDER_PRIORITY_MIN); |
| 1748 | BIND_CONSTANT(MATERIAL_RENDER_PRIORITY_MAX); |
| 1749 | |
| 1750 | /* MESH API */ |
| 1751 | |
| 1752 | ClassDB::bind_method(D_METHOD("mesh_create_from_surfaces" , "surfaces" , "blend_shape_count" ), &RenderingServer::_mesh_create_from_surfaces, DEFVAL(0)); |
| 1753 | ClassDB::bind_method(D_METHOD("mesh_create" ), &RenderingServer::mesh_create); |
| 1754 | ClassDB::bind_method(D_METHOD("mesh_surface_get_format_offset" , "format" , "vertex_count" , "array_index" ), &RenderingServer::mesh_surface_get_format_offset); |
| 1755 | ClassDB::bind_method(D_METHOD("mesh_surface_get_format_vertex_stride" , "format" , "vertex_count" ), &RenderingServer::mesh_surface_get_format_vertex_stride); |
| 1756 | ClassDB::bind_method(D_METHOD("mesh_surface_get_format_attribute_stride" , "format" , "vertex_count" ), &RenderingServer::mesh_surface_get_format_attribute_stride); |
| 1757 | ClassDB::bind_method(D_METHOD("mesh_surface_get_format_skin_stride" , "format" , "vertex_count" ), &RenderingServer::mesh_surface_get_format_skin_stride); |
| 1758 | ClassDB::bind_method(D_METHOD("mesh_add_surface" , "mesh" , "surface" ), &RenderingServer::_mesh_add_surface); |
| 1759 | ClassDB::bind_method(D_METHOD("mesh_add_surface_from_arrays" , "mesh" , "primitive" , "arrays" , "blend_shapes" , "lods" , "compress_format" ), &RenderingServer::mesh_add_surface_from_arrays, DEFVAL(Array()), DEFVAL(Dictionary()), DEFVAL(0)); |
| 1760 | ClassDB::bind_method(D_METHOD("mesh_get_blend_shape_count" , "mesh" ), &RenderingServer::mesh_get_blend_shape_count); |
| 1761 | ClassDB::bind_method(D_METHOD("mesh_set_blend_shape_mode" , "mesh" , "mode" ), &RenderingServer::mesh_set_blend_shape_mode); |
| 1762 | ClassDB::bind_method(D_METHOD("mesh_get_blend_shape_mode" , "mesh" ), &RenderingServer::mesh_get_blend_shape_mode); |
| 1763 | |
| 1764 | ClassDB::bind_method(D_METHOD("mesh_surface_set_material" , "mesh" , "surface" , "material" ), &RenderingServer::mesh_surface_set_material); |
| 1765 | ClassDB::bind_method(D_METHOD("mesh_surface_get_material" , "mesh" , "surface" ), &RenderingServer::mesh_surface_get_material); |
| 1766 | ClassDB::bind_method(D_METHOD("mesh_get_surface" , "mesh" , "surface" ), &RenderingServer::_mesh_get_surface); |
| 1767 | ClassDB::bind_method(D_METHOD("mesh_surface_get_arrays" , "mesh" , "surface" ), &RenderingServer::mesh_surface_get_arrays); |
| 1768 | ClassDB::bind_method(D_METHOD("mesh_surface_get_blend_shape_arrays" , "mesh" , "surface" ), &RenderingServer::mesh_surface_get_blend_shape_arrays); |
| 1769 | ClassDB::bind_method(D_METHOD("mesh_get_surface_count" , "mesh" ), &RenderingServer::mesh_get_surface_count); |
| 1770 | ClassDB::bind_method(D_METHOD("mesh_set_custom_aabb" , "mesh" , "aabb" ), &RenderingServer::mesh_set_custom_aabb); |
| 1771 | ClassDB::bind_method(D_METHOD("mesh_get_custom_aabb" , "mesh" ), &RenderingServer::mesh_get_custom_aabb); |
| 1772 | ClassDB::bind_method(D_METHOD("mesh_clear" , "mesh" ), &RenderingServer::mesh_clear); |
| 1773 | |
| 1774 | ClassDB::bind_method(D_METHOD("mesh_surface_update_vertex_region" , "mesh" , "surface" , "offset" , "data" ), &RenderingServer::mesh_surface_update_vertex_region); |
| 1775 | ClassDB::bind_method(D_METHOD("mesh_surface_update_attribute_region" , "mesh" , "surface" , "offset" , "data" ), &RenderingServer::mesh_surface_update_attribute_region); |
| 1776 | ClassDB::bind_method(D_METHOD("mesh_surface_update_skin_region" , "mesh" , "surface" , "offset" , "data" ), &RenderingServer::mesh_surface_update_skin_region); |
| 1777 | |
| 1778 | ClassDB::bind_method(D_METHOD("mesh_set_shadow_mesh" , "mesh" , "shadow_mesh" ), &RenderingServer::mesh_set_shadow_mesh); |
| 1779 | |
| 1780 | BIND_ENUM_CONSTANT(ARRAY_VERTEX); |
| 1781 | BIND_ENUM_CONSTANT(ARRAY_NORMAL); |
| 1782 | BIND_ENUM_CONSTANT(ARRAY_TANGENT); |
| 1783 | BIND_ENUM_CONSTANT(ARRAY_COLOR); |
| 1784 | BIND_ENUM_CONSTANT(ARRAY_TEX_UV); |
| 1785 | BIND_ENUM_CONSTANT(ARRAY_TEX_UV2); |
| 1786 | BIND_ENUM_CONSTANT(ARRAY_CUSTOM0); |
| 1787 | BIND_ENUM_CONSTANT(ARRAY_CUSTOM1); |
| 1788 | BIND_ENUM_CONSTANT(ARRAY_CUSTOM2); |
| 1789 | BIND_ENUM_CONSTANT(ARRAY_CUSTOM3); |
| 1790 | BIND_ENUM_CONSTANT(ARRAY_BONES); |
| 1791 | BIND_ENUM_CONSTANT(ARRAY_WEIGHTS); |
| 1792 | BIND_ENUM_CONSTANT(ARRAY_INDEX); |
| 1793 | BIND_ENUM_CONSTANT(ARRAY_MAX); |
| 1794 | |
| 1795 | BIND_CONSTANT(ARRAY_CUSTOM_COUNT); |
| 1796 | |
| 1797 | BIND_ENUM_CONSTANT(ARRAY_CUSTOM_RGBA8_UNORM); |
| 1798 | BIND_ENUM_CONSTANT(ARRAY_CUSTOM_RGBA8_SNORM); |
| 1799 | BIND_ENUM_CONSTANT(ARRAY_CUSTOM_RG_HALF); |
| 1800 | BIND_ENUM_CONSTANT(ARRAY_CUSTOM_RGBA_HALF); |
| 1801 | BIND_ENUM_CONSTANT(ARRAY_CUSTOM_R_FLOAT); |
| 1802 | BIND_ENUM_CONSTANT(ARRAY_CUSTOM_RG_FLOAT); |
| 1803 | BIND_ENUM_CONSTANT(ARRAY_CUSTOM_RGB_FLOAT); |
| 1804 | BIND_ENUM_CONSTANT(ARRAY_CUSTOM_RGBA_FLOAT); |
| 1805 | BIND_ENUM_CONSTANT(ARRAY_CUSTOM_MAX); |
| 1806 | |
| 1807 | BIND_BITFIELD_FLAG(ARRAY_FORMAT_VERTEX); |
| 1808 | BIND_BITFIELD_FLAG(ARRAY_FORMAT_NORMAL); |
| 1809 | BIND_BITFIELD_FLAG(ARRAY_FORMAT_TANGENT); |
| 1810 | BIND_BITFIELD_FLAG(ARRAY_FORMAT_COLOR); |
| 1811 | BIND_BITFIELD_FLAG(ARRAY_FORMAT_TEX_UV); |
| 1812 | BIND_BITFIELD_FLAG(ARRAY_FORMAT_TEX_UV2); |
| 1813 | BIND_BITFIELD_FLAG(ARRAY_FORMAT_CUSTOM0); |
| 1814 | BIND_BITFIELD_FLAG(ARRAY_FORMAT_CUSTOM1); |
| 1815 | BIND_BITFIELD_FLAG(ARRAY_FORMAT_CUSTOM2); |
| 1816 | BIND_BITFIELD_FLAG(ARRAY_FORMAT_CUSTOM3); |
| 1817 | BIND_BITFIELD_FLAG(ARRAY_FORMAT_BONES); |
| 1818 | BIND_BITFIELD_FLAG(ARRAY_FORMAT_WEIGHTS); |
| 1819 | BIND_BITFIELD_FLAG(ARRAY_FORMAT_INDEX); |
| 1820 | |
| 1821 | BIND_BITFIELD_FLAG(ARRAY_FORMAT_BLEND_SHAPE_MASK); |
| 1822 | |
| 1823 | BIND_BITFIELD_FLAG(ARRAY_FORMAT_CUSTOM_BASE); |
| 1824 | BIND_BITFIELD_FLAG(ARRAY_FORMAT_CUSTOM_BITS); |
| 1825 | BIND_BITFIELD_FLAG(ARRAY_FORMAT_CUSTOM0_SHIFT); |
| 1826 | BIND_BITFIELD_FLAG(ARRAY_FORMAT_CUSTOM1_SHIFT); |
| 1827 | BIND_BITFIELD_FLAG(ARRAY_FORMAT_CUSTOM2_SHIFT); |
| 1828 | BIND_BITFIELD_FLAG(ARRAY_FORMAT_CUSTOM3_SHIFT); |
| 1829 | |
| 1830 | BIND_BITFIELD_FLAG(ARRAY_FORMAT_CUSTOM_MASK); |
| 1831 | BIND_BITFIELD_FLAG(ARRAY_COMPRESS_FLAGS_BASE); |
| 1832 | |
| 1833 | BIND_BITFIELD_FLAG(ARRAY_FLAG_USE_2D_VERTICES); |
| 1834 | BIND_BITFIELD_FLAG(ARRAY_FLAG_USE_DYNAMIC_UPDATE); |
| 1835 | BIND_BITFIELD_FLAG(ARRAY_FLAG_USE_8_BONE_WEIGHTS); |
| 1836 | BIND_BITFIELD_FLAG(ARRAY_FLAG_USES_EMPTY_VERTEX_ARRAY); |
| 1837 | |
| 1838 | BIND_ENUM_CONSTANT(PRIMITIVE_POINTS); |
| 1839 | BIND_ENUM_CONSTANT(PRIMITIVE_LINES); |
| 1840 | BIND_ENUM_CONSTANT(PRIMITIVE_LINE_STRIP); |
| 1841 | BIND_ENUM_CONSTANT(PRIMITIVE_TRIANGLES); |
| 1842 | BIND_ENUM_CONSTANT(PRIMITIVE_TRIANGLE_STRIP); |
| 1843 | BIND_ENUM_CONSTANT(PRIMITIVE_MAX); |
| 1844 | |
| 1845 | BIND_ENUM_CONSTANT(BLEND_SHAPE_MODE_NORMALIZED); |
| 1846 | BIND_ENUM_CONSTANT(BLEND_SHAPE_MODE_RELATIVE); |
| 1847 | |
| 1848 | /* MULTIMESH API */ |
| 1849 | |
| 1850 | ClassDB::bind_method(D_METHOD("multimesh_create" ), &RenderingServer::multimesh_create); |
| 1851 | ClassDB::bind_method(D_METHOD("multimesh_allocate_data" , "multimesh" , "instances" , "transform_format" , "color_format" , "custom_data_format" ), &RenderingServer::multimesh_allocate_data, DEFVAL(false), DEFVAL(false)); |
| 1852 | ClassDB::bind_method(D_METHOD("multimesh_get_instance_count" , "multimesh" ), &RenderingServer::multimesh_get_instance_count); |
| 1853 | ClassDB::bind_method(D_METHOD("multimesh_set_mesh" , "multimesh" , "mesh" ), &RenderingServer::multimesh_set_mesh); |
| 1854 | ClassDB::bind_method(D_METHOD("multimesh_instance_set_transform" , "multimesh" , "index" , "transform" ), &RenderingServer::multimesh_instance_set_transform); |
| 1855 | ClassDB::bind_method(D_METHOD("multimesh_instance_set_transform_2d" , "multimesh" , "index" , "transform" ), &RenderingServer::multimesh_instance_set_transform_2d); |
| 1856 | ClassDB::bind_method(D_METHOD("multimesh_instance_set_color" , "multimesh" , "index" , "color" ), &RenderingServer::multimesh_instance_set_color); |
| 1857 | ClassDB::bind_method(D_METHOD("multimesh_instance_set_custom_data" , "multimesh" , "index" , "custom_data" ), &RenderingServer::multimesh_instance_set_custom_data); |
| 1858 | ClassDB::bind_method(D_METHOD("multimesh_get_mesh" , "multimesh" ), &RenderingServer::multimesh_get_mesh); |
| 1859 | ClassDB::bind_method(D_METHOD("multimesh_get_aabb" , "multimesh" ), &RenderingServer::multimesh_get_aabb); |
| 1860 | ClassDB::bind_method(D_METHOD("multimesh_instance_get_transform" , "multimesh" , "index" ), &RenderingServer::multimesh_instance_get_transform); |
| 1861 | ClassDB::bind_method(D_METHOD("multimesh_instance_get_transform_2d" , "multimesh" , "index" ), &RenderingServer::multimesh_instance_get_transform_2d); |
| 1862 | ClassDB::bind_method(D_METHOD("multimesh_instance_get_color" , "multimesh" , "index" ), &RenderingServer::multimesh_instance_get_color); |
| 1863 | ClassDB::bind_method(D_METHOD("multimesh_instance_get_custom_data" , "multimesh" , "index" ), &RenderingServer::multimesh_instance_get_custom_data); |
| 1864 | ClassDB::bind_method(D_METHOD("multimesh_set_visible_instances" , "multimesh" , "visible" ), &RenderingServer::multimesh_set_visible_instances); |
| 1865 | ClassDB::bind_method(D_METHOD("multimesh_get_visible_instances" , "multimesh" ), &RenderingServer::multimesh_get_visible_instances); |
| 1866 | ClassDB::bind_method(D_METHOD("multimesh_set_buffer" , "multimesh" , "buffer" ), &RenderingServer::multimesh_set_buffer); |
| 1867 | ClassDB::bind_method(D_METHOD("multimesh_get_buffer" , "multimesh" ), &RenderingServer::multimesh_get_buffer); |
| 1868 | |
| 1869 | BIND_ENUM_CONSTANT(MULTIMESH_TRANSFORM_2D); |
| 1870 | BIND_ENUM_CONSTANT(MULTIMESH_TRANSFORM_3D); |
| 1871 | |
| 1872 | /* SKELETON API */ |
| 1873 | |
| 1874 | ClassDB::bind_method(D_METHOD("skeleton_create" ), &RenderingServer::skeleton_create); |
| 1875 | ClassDB::bind_method(D_METHOD("skeleton_allocate_data" , "skeleton" , "bones" , "is_2d_skeleton" ), &RenderingServer::skeleton_allocate_data, DEFVAL(false)); |
| 1876 | ClassDB::bind_method(D_METHOD("skeleton_get_bone_count" , "skeleton" ), &RenderingServer::skeleton_get_bone_count); |
| 1877 | ClassDB::bind_method(D_METHOD("skeleton_bone_set_transform" , "skeleton" , "bone" , "transform" ), &RenderingServer::skeleton_bone_set_transform); |
| 1878 | ClassDB::bind_method(D_METHOD("skeleton_bone_get_transform" , "skeleton" , "bone" ), &RenderingServer::skeleton_bone_get_transform); |
| 1879 | ClassDB::bind_method(D_METHOD("skeleton_bone_set_transform_2d" , "skeleton" , "bone" , "transform" ), &RenderingServer::skeleton_bone_set_transform_2d); |
| 1880 | ClassDB::bind_method(D_METHOD("skeleton_bone_get_transform_2d" , "skeleton" , "bone" ), &RenderingServer::skeleton_bone_get_transform_2d); |
| 1881 | ClassDB::bind_method(D_METHOD("skeleton_set_base_transform_2d" , "skeleton" , "base_transform" ), &RenderingServer::skeleton_set_base_transform_2d); |
| 1882 | |
| 1883 | /* Light API */ |
| 1884 | |
| 1885 | ClassDB::bind_method(D_METHOD("directional_light_create" ), &RenderingServer::directional_light_create); |
| 1886 | ClassDB::bind_method(D_METHOD("omni_light_create" ), &RenderingServer::omni_light_create); |
| 1887 | ClassDB::bind_method(D_METHOD("spot_light_create" ), &RenderingServer::spot_light_create); |
| 1888 | |
| 1889 | ClassDB::bind_method(D_METHOD("light_set_color" , "light" , "color" ), &RenderingServer::light_set_color); |
| 1890 | ClassDB::bind_method(D_METHOD("light_set_param" , "light" , "param" , "value" ), &RenderingServer::light_set_param); |
| 1891 | ClassDB::bind_method(D_METHOD("light_set_shadow" , "light" , "enabled" ), &RenderingServer::light_set_shadow); |
| 1892 | ClassDB::bind_method(D_METHOD("light_set_projector" , "light" , "texture" ), &RenderingServer::light_set_projector); |
| 1893 | ClassDB::bind_method(D_METHOD("light_set_negative" , "light" , "enable" ), &RenderingServer::light_set_negative); |
| 1894 | ClassDB::bind_method(D_METHOD("light_set_cull_mask" , "light" , "mask" ), &RenderingServer::light_set_cull_mask); |
| 1895 | ClassDB::bind_method(D_METHOD("light_set_distance_fade" , "decal" , "enabled" , "begin" , "shadow" , "length" ), &RenderingServer::light_set_distance_fade); |
| 1896 | ClassDB::bind_method(D_METHOD("light_set_reverse_cull_face_mode" , "light" , "enabled" ), &RenderingServer::light_set_reverse_cull_face_mode); |
| 1897 | ClassDB::bind_method(D_METHOD("light_set_bake_mode" , "light" , "bake_mode" ), &RenderingServer::light_set_bake_mode); |
| 1898 | ClassDB::bind_method(D_METHOD("light_set_max_sdfgi_cascade" , "light" , "cascade" ), &RenderingServer::light_set_max_sdfgi_cascade); |
| 1899 | |
| 1900 | ClassDB::bind_method(D_METHOD("light_omni_set_shadow_mode" , "light" , "mode" ), &RenderingServer::light_omni_set_shadow_mode); |
| 1901 | |
| 1902 | ClassDB::bind_method(D_METHOD("light_directional_set_shadow_mode" , "light" , "mode" ), &RenderingServer::light_directional_set_shadow_mode); |
| 1903 | ClassDB::bind_method(D_METHOD("light_directional_set_blend_splits" , "light" , "enable" ), &RenderingServer::light_directional_set_blend_splits); |
| 1904 | ClassDB::bind_method(D_METHOD("light_directional_set_sky_mode" , "light" , "mode" ), &RenderingServer::light_directional_set_sky_mode); |
| 1905 | |
| 1906 | ClassDB::bind_method(D_METHOD("light_projectors_set_filter" , "filter" ), &RenderingServer::light_projectors_set_filter); |
| 1907 | |
| 1908 | BIND_ENUM_CONSTANT(LIGHT_PROJECTOR_FILTER_NEAREST); |
| 1909 | BIND_ENUM_CONSTANT(LIGHT_PROJECTOR_FILTER_LINEAR); |
| 1910 | BIND_ENUM_CONSTANT(LIGHT_PROJECTOR_FILTER_NEAREST_MIPMAPS); |
| 1911 | BIND_ENUM_CONSTANT(LIGHT_PROJECTOR_FILTER_LINEAR_MIPMAPS); |
| 1912 | BIND_ENUM_CONSTANT(LIGHT_PROJECTOR_FILTER_NEAREST_MIPMAPS_ANISOTROPIC); |
| 1913 | BIND_ENUM_CONSTANT(LIGHT_PROJECTOR_FILTER_LINEAR_MIPMAPS_ANISOTROPIC); |
| 1914 | |
| 1915 | BIND_ENUM_CONSTANT(LIGHT_DIRECTIONAL); |
| 1916 | BIND_ENUM_CONSTANT(LIGHT_OMNI); |
| 1917 | BIND_ENUM_CONSTANT(LIGHT_SPOT); |
| 1918 | |
| 1919 | BIND_ENUM_CONSTANT(LIGHT_PARAM_ENERGY); |
| 1920 | BIND_ENUM_CONSTANT(LIGHT_PARAM_INDIRECT_ENERGY); |
| 1921 | BIND_ENUM_CONSTANT(LIGHT_PARAM_VOLUMETRIC_FOG_ENERGY); |
| 1922 | BIND_ENUM_CONSTANT(LIGHT_PARAM_SPECULAR); |
| 1923 | BIND_ENUM_CONSTANT(LIGHT_PARAM_RANGE); |
| 1924 | BIND_ENUM_CONSTANT(LIGHT_PARAM_SIZE); |
| 1925 | BIND_ENUM_CONSTANT(LIGHT_PARAM_ATTENUATION); |
| 1926 | BIND_ENUM_CONSTANT(LIGHT_PARAM_SPOT_ANGLE); |
| 1927 | BIND_ENUM_CONSTANT(LIGHT_PARAM_SPOT_ATTENUATION); |
| 1928 | BIND_ENUM_CONSTANT(LIGHT_PARAM_SHADOW_MAX_DISTANCE); |
| 1929 | BIND_ENUM_CONSTANT(LIGHT_PARAM_SHADOW_SPLIT_1_OFFSET); |
| 1930 | BIND_ENUM_CONSTANT(LIGHT_PARAM_SHADOW_SPLIT_2_OFFSET); |
| 1931 | BIND_ENUM_CONSTANT(LIGHT_PARAM_SHADOW_SPLIT_3_OFFSET); |
| 1932 | BIND_ENUM_CONSTANT(LIGHT_PARAM_SHADOW_FADE_START); |
| 1933 | BIND_ENUM_CONSTANT(LIGHT_PARAM_SHADOW_NORMAL_BIAS); |
| 1934 | BIND_ENUM_CONSTANT(LIGHT_PARAM_SHADOW_BIAS); |
| 1935 | BIND_ENUM_CONSTANT(LIGHT_PARAM_SHADOW_PANCAKE_SIZE); |
| 1936 | BIND_ENUM_CONSTANT(LIGHT_PARAM_SHADOW_OPACITY); |
| 1937 | BIND_ENUM_CONSTANT(LIGHT_PARAM_SHADOW_BLUR); |
| 1938 | BIND_ENUM_CONSTANT(LIGHT_PARAM_TRANSMITTANCE_BIAS); |
| 1939 | BIND_ENUM_CONSTANT(LIGHT_PARAM_INTENSITY); |
| 1940 | BIND_ENUM_CONSTANT(LIGHT_PARAM_MAX); |
| 1941 | |
| 1942 | BIND_ENUM_CONSTANT(LIGHT_BAKE_DISABLED); |
| 1943 | BIND_ENUM_CONSTANT(LIGHT_BAKE_STATIC); |
| 1944 | BIND_ENUM_CONSTANT(LIGHT_BAKE_DYNAMIC); |
| 1945 | |
| 1946 | BIND_ENUM_CONSTANT(LIGHT_OMNI_SHADOW_DUAL_PARABOLOID); |
| 1947 | BIND_ENUM_CONSTANT(LIGHT_OMNI_SHADOW_CUBE); |
| 1948 | |
| 1949 | BIND_ENUM_CONSTANT(LIGHT_DIRECTIONAL_SHADOW_ORTHOGONAL); |
| 1950 | BIND_ENUM_CONSTANT(LIGHT_DIRECTIONAL_SHADOW_PARALLEL_2_SPLITS); |
| 1951 | BIND_ENUM_CONSTANT(LIGHT_DIRECTIONAL_SHADOW_PARALLEL_4_SPLITS); |
| 1952 | |
| 1953 | BIND_ENUM_CONSTANT(LIGHT_DIRECTIONAL_SKY_MODE_LIGHT_AND_SKY); |
| 1954 | BIND_ENUM_CONSTANT(LIGHT_DIRECTIONAL_SKY_MODE_LIGHT_ONLY); |
| 1955 | BIND_ENUM_CONSTANT(LIGHT_DIRECTIONAL_SKY_MODE_SKY_ONLY); |
| 1956 | |
| 1957 | ClassDB::bind_method(D_METHOD("positional_soft_shadow_filter_set_quality" , "quality" ), &RenderingServer::positional_soft_shadow_filter_set_quality); |
| 1958 | ClassDB::bind_method(D_METHOD("directional_soft_shadow_filter_set_quality" , "quality" ), &RenderingServer::directional_soft_shadow_filter_set_quality); |
| 1959 | ClassDB::bind_method(D_METHOD("directional_shadow_atlas_set_size" , "size" , "is_16bits" ), &RenderingServer::directional_shadow_atlas_set_size); |
| 1960 | |
| 1961 | BIND_ENUM_CONSTANT(SHADOW_QUALITY_HARD); |
| 1962 | BIND_ENUM_CONSTANT(SHADOW_QUALITY_SOFT_VERY_LOW); |
| 1963 | BIND_ENUM_CONSTANT(SHADOW_QUALITY_SOFT_LOW); |
| 1964 | BIND_ENUM_CONSTANT(SHADOW_QUALITY_SOFT_MEDIUM); |
| 1965 | BIND_ENUM_CONSTANT(SHADOW_QUALITY_SOFT_HIGH); |
| 1966 | BIND_ENUM_CONSTANT(SHADOW_QUALITY_SOFT_ULTRA); |
| 1967 | BIND_ENUM_CONSTANT(SHADOW_QUALITY_MAX); |
| 1968 | |
| 1969 | /* REFLECTION PROBE */ |
| 1970 | |
| 1971 | ClassDB::bind_method(D_METHOD("reflection_probe_create" ), &RenderingServer::reflection_probe_create); |
| 1972 | ClassDB::bind_method(D_METHOD("reflection_probe_set_update_mode" , "probe" , "mode" ), &RenderingServer::reflection_probe_set_update_mode); |
| 1973 | ClassDB::bind_method(D_METHOD("reflection_probe_set_intensity" , "probe" , "intensity" ), &RenderingServer::reflection_probe_set_intensity); |
| 1974 | ClassDB::bind_method(D_METHOD("reflection_probe_set_ambient_mode" , "probe" , "mode" ), &RenderingServer::reflection_probe_set_ambient_mode); |
| 1975 | ClassDB::bind_method(D_METHOD("reflection_probe_set_ambient_color" , "probe" , "color" ), &RenderingServer::reflection_probe_set_ambient_color); |
| 1976 | ClassDB::bind_method(D_METHOD("reflection_probe_set_ambient_energy" , "probe" , "energy" ), &RenderingServer::reflection_probe_set_ambient_energy); |
| 1977 | ClassDB::bind_method(D_METHOD("reflection_probe_set_max_distance" , "probe" , "distance" ), &RenderingServer::reflection_probe_set_max_distance); |
| 1978 | ClassDB::bind_method(D_METHOD("reflection_probe_set_size" , "probe" , "size" ), &RenderingServer::reflection_probe_set_size); |
| 1979 | ClassDB::bind_method(D_METHOD("reflection_probe_set_origin_offset" , "probe" , "offset" ), &RenderingServer::reflection_probe_set_origin_offset); |
| 1980 | ClassDB::bind_method(D_METHOD("reflection_probe_set_as_interior" , "probe" , "enable" ), &RenderingServer::reflection_probe_set_as_interior); |
| 1981 | ClassDB::bind_method(D_METHOD("reflection_probe_set_enable_box_projection" , "probe" , "enable" ), &RenderingServer::reflection_probe_set_enable_box_projection); |
| 1982 | ClassDB::bind_method(D_METHOD("reflection_probe_set_enable_shadows" , "probe" , "enable" ), &RenderingServer::reflection_probe_set_enable_shadows); |
| 1983 | ClassDB::bind_method(D_METHOD("reflection_probe_set_cull_mask" , "probe" , "layers" ), &RenderingServer::reflection_probe_set_cull_mask); |
| 1984 | ClassDB::bind_method(D_METHOD("reflection_probe_set_resolution" , "probe" , "resolution" ), &RenderingServer::reflection_probe_set_resolution); |
| 1985 | ClassDB::bind_method(D_METHOD("reflection_probe_set_mesh_lod_threshold" , "probe" , "pixels" ), &RenderingServer::reflection_probe_set_mesh_lod_threshold); |
| 1986 | |
| 1987 | BIND_ENUM_CONSTANT(REFLECTION_PROBE_UPDATE_ONCE); |
| 1988 | BIND_ENUM_CONSTANT(REFLECTION_PROBE_UPDATE_ALWAYS); |
| 1989 | |
| 1990 | BIND_ENUM_CONSTANT(REFLECTION_PROBE_AMBIENT_DISABLED); |
| 1991 | BIND_ENUM_CONSTANT(REFLECTION_PROBE_AMBIENT_ENVIRONMENT); |
| 1992 | BIND_ENUM_CONSTANT(REFLECTION_PROBE_AMBIENT_COLOR); |
| 1993 | |
| 1994 | /* DECAL */ |
| 1995 | |
| 1996 | ClassDB::bind_method(D_METHOD("decal_create" ), &RenderingServer::decal_create); |
| 1997 | ClassDB::bind_method(D_METHOD("decal_set_size" , "decal" , "size" ), &RenderingServer::decal_set_size); |
| 1998 | ClassDB::bind_method(D_METHOD("decal_set_texture" , "decal" , "type" , "texture" ), &RenderingServer::decal_set_texture); |
| 1999 | ClassDB::bind_method(D_METHOD("decal_set_emission_energy" , "decal" , "energy" ), &RenderingServer::decal_set_emission_energy); |
| 2000 | ClassDB::bind_method(D_METHOD("decal_set_albedo_mix" , "decal" , "albedo_mix" ), &RenderingServer::decal_set_albedo_mix); |
| 2001 | ClassDB::bind_method(D_METHOD("decal_set_modulate" , "decal" , "color" ), &RenderingServer::decal_set_modulate); |
| 2002 | ClassDB::bind_method(D_METHOD("decal_set_cull_mask" , "decal" , "mask" ), &RenderingServer::decal_set_cull_mask); |
| 2003 | ClassDB::bind_method(D_METHOD("decal_set_distance_fade" , "decal" , "enabled" , "begin" , "length" ), &RenderingServer::decal_set_distance_fade); |
| 2004 | ClassDB::bind_method(D_METHOD("decal_set_fade" , "decal" , "above" , "below" ), &RenderingServer::decal_set_fade); |
| 2005 | ClassDB::bind_method(D_METHOD("decal_set_normal_fade" , "decal" , "fade" ), &RenderingServer::decal_set_normal_fade); |
| 2006 | |
| 2007 | ClassDB::bind_method(D_METHOD("decals_set_filter" , "filter" ), &RenderingServer::decals_set_filter); |
| 2008 | |
| 2009 | BIND_ENUM_CONSTANT(DECAL_TEXTURE_ALBEDO); |
| 2010 | BIND_ENUM_CONSTANT(DECAL_TEXTURE_NORMAL); |
| 2011 | BIND_ENUM_CONSTANT(DECAL_TEXTURE_ORM); |
| 2012 | BIND_ENUM_CONSTANT(DECAL_TEXTURE_EMISSION); |
| 2013 | BIND_ENUM_CONSTANT(DECAL_TEXTURE_MAX); |
| 2014 | |
| 2015 | BIND_ENUM_CONSTANT(DECAL_FILTER_NEAREST); |
| 2016 | BIND_ENUM_CONSTANT(DECAL_FILTER_LINEAR); |
| 2017 | BIND_ENUM_CONSTANT(DECAL_FILTER_NEAREST_MIPMAPS); |
| 2018 | BIND_ENUM_CONSTANT(DECAL_FILTER_LINEAR_MIPMAPS); |
| 2019 | BIND_ENUM_CONSTANT(DECAL_FILTER_NEAREST_MIPMAPS_ANISOTROPIC); |
| 2020 | BIND_ENUM_CONSTANT(DECAL_FILTER_LINEAR_MIPMAPS_ANISOTROPIC); |
| 2021 | |
| 2022 | /* GI API (affects VoxelGI and SDFGI) */ |
| 2023 | |
| 2024 | ClassDB::bind_method(D_METHOD("gi_set_use_half_resolution" , "half_resolution" ), &RenderingServer::gi_set_use_half_resolution); |
| 2025 | |
| 2026 | /* VOXEL GI API */ |
| 2027 | |
| 2028 | ClassDB::bind_method(D_METHOD("voxel_gi_create" ), &RenderingServer::voxel_gi_create); |
| 2029 | ClassDB::bind_method(D_METHOD("voxel_gi_allocate_data" , "voxel_gi" , "to_cell_xform" , "aabb" , "octree_size" , "octree_cells" , "data_cells" , "distance_field" , "level_counts" ), &RenderingServer::voxel_gi_allocate_data); |
| 2030 | ClassDB::bind_method(D_METHOD("voxel_gi_get_octree_size" , "voxel_gi" ), &RenderingServer::voxel_gi_get_octree_size); |
| 2031 | ClassDB::bind_method(D_METHOD("voxel_gi_get_octree_cells" , "voxel_gi" ), &RenderingServer::voxel_gi_get_octree_cells); |
| 2032 | ClassDB::bind_method(D_METHOD("voxel_gi_get_data_cells" , "voxel_gi" ), &RenderingServer::voxel_gi_get_data_cells); |
| 2033 | ClassDB::bind_method(D_METHOD("voxel_gi_get_distance_field" , "voxel_gi" ), &RenderingServer::voxel_gi_get_distance_field); |
| 2034 | ClassDB::bind_method(D_METHOD("voxel_gi_get_level_counts" , "voxel_gi" ), &RenderingServer::voxel_gi_get_level_counts); |
| 2035 | ClassDB::bind_method(D_METHOD("voxel_gi_get_to_cell_xform" , "voxel_gi" ), &RenderingServer::voxel_gi_get_to_cell_xform); |
| 2036 | |
| 2037 | ClassDB::bind_method(D_METHOD("voxel_gi_set_dynamic_range" , "voxel_gi" , "range" ), &RenderingServer::voxel_gi_set_dynamic_range); |
| 2038 | ClassDB::bind_method(D_METHOD("voxel_gi_set_propagation" , "voxel_gi" , "amount" ), &RenderingServer::voxel_gi_set_propagation); |
| 2039 | ClassDB::bind_method(D_METHOD("voxel_gi_set_energy" , "voxel_gi" , "energy" ), &RenderingServer::voxel_gi_set_energy); |
| 2040 | ClassDB::bind_method(D_METHOD("voxel_gi_set_baked_exposure_normalization" , "voxel_gi" , "baked_exposure" ), &RenderingServer::voxel_gi_set_baked_exposure_normalization); |
| 2041 | ClassDB::bind_method(D_METHOD("voxel_gi_set_bias" , "voxel_gi" , "bias" ), &RenderingServer::voxel_gi_set_bias); |
| 2042 | ClassDB::bind_method(D_METHOD("voxel_gi_set_normal_bias" , "voxel_gi" , "bias" ), &RenderingServer::voxel_gi_set_normal_bias); |
| 2043 | ClassDB::bind_method(D_METHOD("voxel_gi_set_interior" , "voxel_gi" , "enable" ), &RenderingServer::voxel_gi_set_interior); |
| 2044 | ClassDB::bind_method(D_METHOD("voxel_gi_set_use_two_bounces" , "voxel_gi" , "enable" ), &RenderingServer::voxel_gi_set_use_two_bounces); |
| 2045 | |
| 2046 | ClassDB::bind_method(D_METHOD("voxel_gi_set_quality" , "quality" ), &RenderingServer::voxel_gi_set_quality); |
| 2047 | |
| 2048 | BIND_ENUM_CONSTANT(VOXEL_GI_QUALITY_LOW); |
| 2049 | BIND_ENUM_CONSTANT(VOXEL_GI_QUALITY_HIGH); |
| 2050 | |
| 2051 | /* LIGHTMAP */ |
| 2052 | |
| 2053 | ClassDB::bind_method(D_METHOD("lightmap_create" ), &RenderingServer::lightmap_create); |
| 2054 | ClassDB::bind_method(D_METHOD("lightmap_set_textures" , "lightmap" , "light" , "uses_sh" ), &RenderingServer::lightmap_set_textures); |
| 2055 | ClassDB::bind_method(D_METHOD("lightmap_set_probe_bounds" , "lightmap" , "bounds" ), &RenderingServer::lightmap_set_probe_bounds); |
| 2056 | ClassDB::bind_method(D_METHOD("lightmap_set_probe_interior" , "lightmap" , "interior" ), &RenderingServer::lightmap_set_probe_interior); |
| 2057 | ClassDB::bind_method(D_METHOD("lightmap_set_probe_capture_data" , "lightmap" , "points" , "point_sh" , "tetrahedra" , "bsp_tree" ), &RenderingServer::lightmap_set_probe_capture_data); |
| 2058 | ClassDB::bind_method(D_METHOD("lightmap_get_probe_capture_points" , "lightmap" ), &RenderingServer::lightmap_get_probe_capture_points); |
| 2059 | ClassDB::bind_method(D_METHOD("lightmap_get_probe_capture_sh" , "lightmap" ), &RenderingServer::lightmap_get_probe_capture_sh); |
| 2060 | ClassDB::bind_method(D_METHOD("lightmap_get_probe_capture_tetrahedra" , "lightmap" ), &RenderingServer::lightmap_get_probe_capture_tetrahedra); |
| 2061 | ClassDB::bind_method(D_METHOD("lightmap_get_probe_capture_bsp_tree" , "lightmap" ), &RenderingServer::lightmap_get_probe_capture_bsp_tree); |
| 2062 | ClassDB::bind_method(D_METHOD("lightmap_set_baked_exposure_normalization" , "lightmap" , "baked_exposure" ), &RenderingServer::lightmap_set_baked_exposure_normalization); |
| 2063 | |
| 2064 | ClassDB::bind_method(D_METHOD("lightmap_set_probe_capture_update_speed" , "speed" ), &RenderingServer::lightmap_set_probe_capture_update_speed); |
| 2065 | |
| 2066 | /* PARTICLES API */ |
| 2067 | |
| 2068 | ClassDB::bind_method(D_METHOD("particles_create" ), &RenderingServer::particles_create); |
| 2069 | ClassDB::bind_method(D_METHOD("particles_set_mode" , "particles" , "mode" ), &RenderingServer::particles_set_mode); |
| 2070 | ClassDB::bind_method(D_METHOD("particles_set_emitting" , "particles" , "emitting" ), &RenderingServer::particles_set_emitting); |
| 2071 | ClassDB::bind_method(D_METHOD("particles_get_emitting" , "particles" ), &RenderingServer::particles_get_emitting); |
| 2072 | ClassDB::bind_method(D_METHOD("particles_set_amount" , "particles" , "amount" ), &RenderingServer::particles_set_amount); |
| 2073 | ClassDB::bind_method(D_METHOD("particles_set_lifetime" , "particles" , "lifetime" ), &RenderingServer::particles_set_lifetime); |
| 2074 | ClassDB::bind_method(D_METHOD("particles_set_one_shot" , "particles" , "one_shot" ), &RenderingServer::particles_set_one_shot); |
| 2075 | ClassDB::bind_method(D_METHOD("particles_set_pre_process_time" , "particles" , "time" ), &RenderingServer::particles_set_pre_process_time); |
| 2076 | ClassDB::bind_method(D_METHOD("particles_set_explosiveness_ratio" , "particles" , "ratio" ), &RenderingServer::particles_set_explosiveness_ratio); |
| 2077 | ClassDB::bind_method(D_METHOD("particles_set_randomness_ratio" , "particles" , "ratio" ), &RenderingServer::particles_set_randomness_ratio); |
| 2078 | ClassDB::bind_method(D_METHOD("particles_set_custom_aabb" , "particles" , "aabb" ), &RenderingServer::particles_set_custom_aabb); |
| 2079 | ClassDB::bind_method(D_METHOD("particles_set_speed_scale" , "particles" , "scale" ), &RenderingServer::particles_set_speed_scale); |
| 2080 | ClassDB::bind_method(D_METHOD("particles_set_use_local_coordinates" , "particles" , "enable" ), &RenderingServer::particles_set_use_local_coordinates); |
| 2081 | ClassDB::bind_method(D_METHOD("particles_set_process_material" , "particles" , "material" ), &RenderingServer::particles_set_process_material); |
| 2082 | ClassDB::bind_method(D_METHOD("particles_set_fixed_fps" , "particles" , "fps" ), &RenderingServer::particles_set_fixed_fps); |
| 2083 | ClassDB::bind_method(D_METHOD("particles_set_interpolate" , "particles" , "enable" ), &RenderingServer::particles_set_interpolate); |
| 2084 | ClassDB::bind_method(D_METHOD("particles_set_fractional_delta" , "particles" , "enable" ), &RenderingServer::particles_set_fractional_delta); |
| 2085 | ClassDB::bind_method(D_METHOD("particles_set_collision_base_size" , "particles" , "size" ), &RenderingServer::particles_set_collision_base_size); |
| 2086 | ClassDB::bind_method(D_METHOD("particles_set_transform_align" , "particles" , "align" ), &RenderingServer::particles_set_transform_align); |
| 2087 | ClassDB::bind_method(D_METHOD("particles_set_trails" , "particles" , "enable" , "length_sec" ), &RenderingServer::particles_set_trails); |
| 2088 | ClassDB::bind_method(D_METHOD("particles_set_trail_bind_poses" , "particles" , "bind_poses" ), &RenderingServer::_particles_set_trail_bind_poses); |
| 2089 | |
| 2090 | ClassDB::bind_method(D_METHOD("particles_is_inactive" , "particles" ), &RenderingServer::particles_is_inactive); |
| 2091 | ClassDB::bind_method(D_METHOD("particles_request_process" , "particles" ), &RenderingServer::particles_request_process); |
| 2092 | ClassDB::bind_method(D_METHOD("particles_restart" , "particles" ), &RenderingServer::particles_restart); |
| 2093 | |
| 2094 | ClassDB::bind_method(D_METHOD("particles_set_subemitter" , "particles" , "subemitter_particles" ), &RenderingServer::particles_set_subemitter); |
| 2095 | ClassDB::bind_method(D_METHOD("particles_emit" , "particles" , "transform" , "velocity" , "color" , "custom" , "emit_flags" ), &RenderingServer::particles_emit); |
| 2096 | |
| 2097 | ClassDB::bind_method(D_METHOD("particles_set_draw_order" , "particles" , "order" ), &RenderingServer::particles_set_draw_order); |
| 2098 | ClassDB::bind_method(D_METHOD("particles_set_draw_passes" , "particles" , "count" ), &RenderingServer::particles_set_draw_passes); |
| 2099 | ClassDB::bind_method(D_METHOD("particles_set_draw_pass_mesh" , "particles" , "pass" , "mesh" ), &RenderingServer::particles_set_draw_pass_mesh); |
| 2100 | ClassDB::bind_method(D_METHOD("particles_get_current_aabb" , "particles" ), &RenderingServer::particles_get_current_aabb); |
| 2101 | ClassDB::bind_method(D_METHOD("particles_set_emission_transform" , "particles" , "transform" ), &RenderingServer::particles_set_emission_transform); |
| 2102 | |
| 2103 | BIND_ENUM_CONSTANT(PARTICLES_MODE_2D); |
| 2104 | BIND_ENUM_CONSTANT(PARTICLES_MODE_3D); |
| 2105 | |
| 2106 | BIND_ENUM_CONSTANT(PARTICLES_TRANSFORM_ALIGN_DISABLED); |
| 2107 | BIND_ENUM_CONSTANT(PARTICLES_TRANSFORM_ALIGN_Z_BILLBOARD); |
| 2108 | BIND_ENUM_CONSTANT(PARTICLES_TRANSFORM_ALIGN_Y_TO_VELOCITY); |
| 2109 | BIND_ENUM_CONSTANT(PARTICLES_TRANSFORM_ALIGN_Z_BILLBOARD_Y_TO_VELOCITY); |
| 2110 | |
| 2111 | BIND_CONSTANT(PARTICLES_EMIT_FLAG_POSITION); |
| 2112 | BIND_CONSTANT(PARTICLES_EMIT_FLAG_ROTATION_SCALE); |
| 2113 | BIND_CONSTANT(PARTICLES_EMIT_FLAG_VELOCITY); |
| 2114 | BIND_CONSTANT(PARTICLES_EMIT_FLAG_COLOR); |
| 2115 | BIND_CONSTANT(PARTICLES_EMIT_FLAG_CUSTOM); |
| 2116 | |
| 2117 | BIND_ENUM_CONSTANT(PARTICLES_DRAW_ORDER_INDEX); |
| 2118 | BIND_ENUM_CONSTANT(PARTICLES_DRAW_ORDER_LIFETIME); |
| 2119 | BIND_ENUM_CONSTANT(PARTICLES_DRAW_ORDER_REVERSE_LIFETIME); |
| 2120 | BIND_ENUM_CONSTANT(PARTICLES_DRAW_ORDER_VIEW_DEPTH); |
| 2121 | |
| 2122 | /* PARTICLES COLLISION */ |
| 2123 | |
| 2124 | ClassDB::bind_method(D_METHOD("particles_collision_create" ), &RenderingServer::particles_collision_create); |
| 2125 | ClassDB::bind_method(D_METHOD("particles_collision_set_collision_type" , "particles_collision" , "type" ), &RenderingServer::particles_collision_set_collision_type); |
| 2126 | ClassDB::bind_method(D_METHOD("particles_collision_set_cull_mask" , "particles_collision" , "mask" ), &RenderingServer::particles_collision_set_cull_mask); |
| 2127 | ClassDB::bind_method(D_METHOD("particles_collision_set_sphere_radius" , "particles_collision" , "radius" ), &RenderingServer::particles_collision_set_sphere_radius); |
| 2128 | ClassDB::bind_method(D_METHOD("particles_collision_set_box_extents" , "particles_collision" , "extents" ), &RenderingServer::particles_collision_set_box_extents); |
| 2129 | ClassDB::bind_method(D_METHOD("particles_collision_set_attractor_strength" , "particles_collision" , "strength" ), &RenderingServer::particles_collision_set_attractor_strength); |
| 2130 | ClassDB::bind_method(D_METHOD("particles_collision_set_attractor_directionality" , "particles_collision" , "amount" ), &RenderingServer::particles_collision_set_attractor_directionality); |
| 2131 | ClassDB::bind_method(D_METHOD("particles_collision_set_attractor_attenuation" , "particles_collision" , "curve" ), &RenderingServer::particles_collision_set_attractor_attenuation); |
| 2132 | ClassDB::bind_method(D_METHOD("particles_collision_set_field_texture" , "particles_collision" , "texture" ), &RenderingServer::particles_collision_set_field_texture); |
| 2133 | |
| 2134 | ClassDB::bind_method(D_METHOD("particles_collision_height_field_update" , "particles_collision" ), &RenderingServer::particles_collision_height_field_update); |
| 2135 | ClassDB::bind_method(D_METHOD("particles_collision_set_height_field_resolution" , "particles_collision" , "resolution" ), &RenderingServer::particles_collision_set_height_field_resolution); |
| 2136 | |
| 2137 | BIND_ENUM_CONSTANT(PARTICLES_COLLISION_TYPE_SPHERE_ATTRACT); |
| 2138 | BIND_ENUM_CONSTANT(PARTICLES_COLLISION_TYPE_BOX_ATTRACT); |
| 2139 | BIND_ENUM_CONSTANT(PARTICLES_COLLISION_TYPE_VECTOR_FIELD_ATTRACT); |
| 2140 | BIND_ENUM_CONSTANT(PARTICLES_COLLISION_TYPE_SPHERE_COLLIDE); |
| 2141 | BIND_ENUM_CONSTANT(PARTICLES_COLLISION_TYPE_BOX_COLLIDE); |
| 2142 | BIND_ENUM_CONSTANT(PARTICLES_COLLISION_TYPE_SDF_COLLIDE); |
| 2143 | BIND_ENUM_CONSTANT(PARTICLES_COLLISION_TYPE_HEIGHTFIELD_COLLIDE); |
| 2144 | |
| 2145 | BIND_ENUM_CONSTANT(PARTICLES_COLLISION_HEIGHTFIELD_RESOLUTION_256); |
| 2146 | BIND_ENUM_CONSTANT(PARTICLES_COLLISION_HEIGHTFIELD_RESOLUTION_512); |
| 2147 | BIND_ENUM_CONSTANT(PARTICLES_COLLISION_HEIGHTFIELD_RESOLUTION_1024); |
| 2148 | BIND_ENUM_CONSTANT(PARTICLES_COLLISION_HEIGHTFIELD_RESOLUTION_2048); |
| 2149 | BIND_ENUM_CONSTANT(PARTICLES_COLLISION_HEIGHTFIELD_RESOLUTION_4096); |
| 2150 | BIND_ENUM_CONSTANT(PARTICLES_COLLISION_HEIGHTFIELD_RESOLUTION_8192); |
| 2151 | BIND_ENUM_CONSTANT(PARTICLES_COLLISION_HEIGHTFIELD_RESOLUTION_MAX); |
| 2152 | |
| 2153 | /* FOG VOLUMES */ |
| 2154 | |
| 2155 | ClassDB::bind_method(D_METHOD("fog_volume_create" ), &RenderingServer::fog_volume_create); |
| 2156 | ClassDB::bind_method(D_METHOD("fog_volume_set_shape" , "fog_volume" , "shape" ), &RenderingServer::fog_volume_set_shape); |
| 2157 | ClassDB::bind_method(D_METHOD("fog_volume_set_size" , "fog_volume" , "size" ), &RenderingServer::fog_volume_set_size); |
| 2158 | ClassDB::bind_method(D_METHOD("fog_volume_set_material" , "fog_volume" , "material" ), &RenderingServer::fog_volume_set_material); |
| 2159 | |
| 2160 | BIND_ENUM_CONSTANT(FOG_VOLUME_SHAPE_ELLIPSOID); |
| 2161 | BIND_ENUM_CONSTANT(FOG_VOLUME_SHAPE_CONE); |
| 2162 | BIND_ENUM_CONSTANT(FOG_VOLUME_SHAPE_CYLINDER); |
| 2163 | BIND_ENUM_CONSTANT(FOG_VOLUME_SHAPE_BOX); |
| 2164 | BIND_ENUM_CONSTANT(FOG_VOLUME_SHAPE_WORLD); |
| 2165 | BIND_ENUM_CONSTANT(FOG_VOLUME_SHAPE_MAX); |
| 2166 | |
| 2167 | /* VISIBILITY NOTIFIER */ |
| 2168 | |
| 2169 | ClassDB::bind_method(D_METHOD("visibility_notifier_create" ), &RenderingServer::visibility_notifier_create); |
| 2170 | ClassDB::bind_method(D_METHOD("visibility_notifier_set_aabb" , "notifier" , "aabb" ), &RenderingServer::visibility_notifier_set_aabb); |
| 2171 | ClassDB::bind_method(D_METHOD("visibility_notifier_set_callbacks" , "notifier" , "enter_callable" , "exit_callable" ), &RenderingServer::visibility_notifier_set_callbacks); |
| 2172 | |
| 2173 | /* OCCLUDER */ |
| 2174 | |
| 2175 | ClassDB::bind_method(D_METHOD("occluder_create" ), &RenderingServer::occluder_create); |
| 2176 | ClassDB::bind_method(D_METHOD("occluder_set_mesh" , "occluder" , "vertices" , "indices" ), &RenderingServer::occluder_set_mesh); |
| 2177 | |
| 2178 | /* CAMERA */ |
| 2179 | |
| 2180 | ClassDB::bind_method(D_METHOD("camera_create" ), &RenderingServer::camera_create); |
| 2181 | ClassDB::bind_method(D_METHOD("camera_set_perspective" , "camera" , "fovy_degrees" , "z_near" , "z_far" ), &RenderingServer::camera_set_perspective); |
| 2182 | ClassDB::bind_method(D_METHOD("camera_set_orthogonal" , "camera" , "size" , "z_near" , "z_far" ), &RenderingServer::camera_set_orthogonal); |
| 2183 | ClassDB::bind_method(D_METHOD("camera_set_frustum" , "camera" , "size" , "offset" , "z_near" , "z_far" ), &RenderingServer::camera_set_frustum); |
| 2184 | ClassDB::bind_method(D_METHOD("camera_set_transform" , "camera" , "transform" ), &RenderingServer::camera_set_transform); |
| 2185 | ClassDB::bind_method(D_METHOD("camera_set_cull_mask" , "camera" , "layers" ), &RenderingServer::camera_set_cull_mask); |
| 2186 | ClassDB::bind_method(D_METHOD("camera_set_environment" , "camera" , "env" ), &RenderingServer::camera_set_environment); |
| 2187 | ClassDB::bind_method(D_METHOD("camera_set_camera_attributes" , "camera" , "effects" ), &RenderingServer::camera_set_camera_attributes); |
| 2188 | ClassDB::bind_method(D_METHOD("camera_set_use_vertical_aspect" , "camera" , "enable" ), &RenderingServer::camera_set_use_vertical_aspect); |
| 2189 | |
| 2190 | /* VIEWPORT */ |
| 2191 | |
| 2192 | ClassDB::bind_method(D_METHOD("viewport_create" ), &RenderingServer::viewport_create); |
| 2193 | ClassDB::bind_method(D_METHOD("viewport_set_use_xr" , "viewport" , "use_xr" ), &RenderingServer::viewport_set_use_xr); |
| 2194 | ClassDB::bind_method(D_METHOD("viewport_set_size" , "viewport" , "width" , "height" ), &RenderingServer::viewport_set_size); |
| 2195 | ClassDB::bind_method(D_METHOD("viewport_set_active" , "viewport" , "active" ), &RenderingServer::viewport_set_active); |
| 2196 | ClassDB::bind_method(D_METHOD("viewport_set_parent_viewport" , "viewport" , "parent_viewport" ), &RenderingServer::viewport_set_parent_viewport); |
| 2197 | ClassDB::bind_method(D_METHOD("viewport_attach_to_screen" , "viewport" , "rect" , "screen" ), &RenderingServer::viewport_attach_to_screen, DEFVAL(Rect2()), DEFVAL(DisplayServer::MAIN_WINDOW_ID)); |
| 2198 | ClassDB::bind_method(D_METHOD("viewport_set_render_direct_to_screen" , "viewport" , "enabled" ), &RenderingServer::viewport_set_render_direct_to_screen); |
| 2199 | ClassDB::bind_method(D_METHOD("viewport_set_canvas_cull_mask" , "viewport" , "canvas_cull_mask" ), &RenderingServer::viewport_set_canvas_cull_mask); |
| 2200 | |
| 2201 | ClassDB::bind_method(D_METHOD("viewport_set_scaling_3d_mode" , "viewport" , "scaling_3d_mode" ), &RenderingServer::viewport_set_scaling_3d_mode); |
| 2202 | ClassDB::bind_method(D_METHOD("viewport_set_scaling_3d_scale" , "viewport" , "scale" ), &RenderingServer::viewport_set_scaling_3d_scale); |
| 2203 | ClassDB::bind_method(D_METHOD("viewport_set_fsr_sharpness" , "viewport" , "sharpness" ), &RenderingServer::viewport_set_fsr_sharpness); |
| 2204 | ClassDB::bind_method(D_METHOD("viewport_set_texture_mipmap_bias" , "viewport" , "mipmap_bias" ), &RenderingServer::viewport_set_texture_mipmap_bias); |
| 2205 | ClassDB::bind_method(D_METHOD("viewport_set_update_mode" , "viewport" , "update_mode" ), &RenderingServer::viewport_set_update_mode); |
| 2206 | ClassDB::bind_method(D_METHOD("viewport_set_clear_mode" , "viewport" , "clear_mode" ), &RenderingServer::viewport_set_clear_mode); |
| 2207 | ClassDB::bind_method(D_METHOD("viewport_get_render_target" , "viewport" ), &RenderingServer::viewport_get_render_target); |
| 2208 | ClassDB::bind_method(D_METHOD("viewport_get_texture" , "viewport" ), &RenderingServer::viewport_get_texture); |
| 2209 | ClassDB::bind_method(D_METHOD("viewport_set_disable_3d" , "viewport" , "disable" ), &RenderingServer::viewport_set_disable_3d); |
| 2210 | ClassDB::bind_method(D_METHOD("viewport_set_disable_2d" , "viewport" , "disable" ), &RenderingServer::viewport_set_disable_2d); |
| 2211 | ClassDB::bind_method(D_METHOD("viewport_set_environment_mode" , "viewport" , "mode" ), &RenderingServer::viewport_set_environment_mode); |
| 2212 | ClassDB::bind_method(D_METHOD("viewport_attach_camera" , "viewport" , "camera" ), &RenderingServer::viewport_attach_camera); |
| 2213 | ClassDB::bind_method(D_METHOD("viewport_set_scenario" , "viewport" , "scenario" ), &RenderingServer::viewport_set_scenario); |
| 2214 | ClassDB::bind_method(D_METHOD("viewport_attach_canvas" , "viewport" , "canvas" ), &RenderingServer::viewport_attach_canvas); |
| 2215 | ClassDB::bind_method(D_METHOD("viewport_remove_canvas" , "viewport" , "canvas" ), &RenderingServer::viewport_remove_canvas); |
| 2216 | ClassDB::bind_method(D_METHOD("viewport_set_snap_2d_transforms_to_pixel" , "viewport" , "enabled" ), &RenderingServer::viewport_set_snap_2d_transforms_to_pixel); |
| 2217 | ClassDB::bind_method(D_METHOD("viewport_set_snap_2d_vertices_to_pixel" , "viewport" , "enabled" ), &RenderingServer::viewport_set_snap_2d_vertices_to_pixel); |
| 2218 | |
| 2219 | ClassDB::bind_method(D_METHOD("viewport_set_default_canvas_item_texture_filter" , "viewport" , "filter" ), &RenderingServer::viewport_set_default_canvas_item_texture_filter); |
| 2220 | ClassDB::bind_method(D_METHOD("viewport_set_default_canvas_item_texture_repeat" , "viewport" , "repeat" ), &RenderingServer::viewport_set_default_canvas_item_texture_repeat); |
| 2221 | |
| 2222 | ClassDB::bind_method(D_METHOD("viewport_set_canvas_transform" , "viewport" , "canvas" , "offset" ), &RenderingServer::viewport_set_canvas_transform); |
| 2223 | ClassDB::bind_method(D_METHOD("viewport_set_canvas_stacking" , "viewport" , "canvas" , "layer" , "sublayer" ), &RenderingServer::viewport_set_canvas_stacking); |
| 2224 | |
| 2225 | ClassDB::bind_method(D_METHOD("viewport_set_transparent_background" , "viewport" , "enabled" ), &RenderingServer::viewport_set_transparent_background); |
| 2226 | ClassDB::bind_method(D_METHOD("viewport_set_global_canvas_transform" , "viewport" , "transform" ), &RenderingServer::viewport_set_global_canvas_transform); |
| 2227 | |
| 2228 | ClassDB::bind_method(D_METHOD("viewport_set_sdf_oversize_and_scale" , "viewport" , "oversize" , "scale" ), &RenderingServer::viewport_set_sdf_oversize_and_scale); |
| 2229 | |
| 2230 | ClassDB::bind_method(D_METHOD("viewport_set_positional_shadow_atlas_size" , "viewport" , "size" , "use_16_bits" ), &RenderingServer::viewport_set_positional_shadow_atlas_size, DEFVAL(false)); |
| 2231 | ClassDB::bind_method(D_METHOD("viewport_set_positional_shadow_atlas_quadrant_subdivision" , "viewport" , "quadrant" , "subdivision" ), &RenderingServer::viewport_set_positional_shadow_atlas_quadrant_subdivision); |
| 2232 | ClassDB::bind_method(D_METHOD("viewport_set_msaa_3d" , "viewport" , "msaa" ), &RenderingServer::viewport_set_msaa_3d); |
| 2233 | ClassDB::bind_method(D_METHOD("viewport_set_msaa_2d" , "viewport" , "msaa" ), &RenderingServer::viewport_set_msaa_2d); |
| 2234 | ClassDB::bind_method(D_METHOD("viewport_set_use_hdr_2d" , "viewport" , "enabled" ), &RenderingServer::viewport_set_use_hdr_2d); |
| 2235 | ClassDB::bind_method(D_METHOD("viewport_set_screen_space_aa" , "viewport" , "mode" ), &RenderingServer::viewport_set_screen_space_aa); |
| 2236 | ClassDB::bind_method(D_METHOD("viewport_set_use_taa" , "viewport" , "enable" ), &RenderingServer::viewport_set_use_taa); |
| 2237 | ClassDB::bind_method(D_METHOD("viewport_set_use_debanding" , "viewport" , "enable" ), &RenderingServer::viewport_set_use_debanding); |
| 2238 | ClassDB::bind_method(D_METHOD("viewport_set_use_occlusion_culling" , "viewport" , "enable" ), &RenderingServer::viewport_set_use_occlusion_culling); |
| 2239 | ClassDB::bind_method(D_METHOD("viewport_set_occlusion_rays_per_thread" , "rays_per_thread" ), &RenderingServer::viewport_set_occlusion_rays_per_thread); |
| 2240 | ClassDB::bind_method(D_METHOD("viewport_set_occlusion_culling_build_quality" , "quality" ), &RenderingServer::viewport_set_occlusion_culling_build_quality); |
| 2241 | |
| 2242 | ClassDB::bind_method(D_METHOD("viewport_get_render_info" , "viewport" , "type" , "info" ), &RenderingServer::viewport_get_render_info); |
| 2243 | ClassDB::bind_method(D_METHOD("viewport_set_debug_draw" , "viewport" , "draw" ), &RenderingServer::viewport_set_debug_draw); |
| 2244 | |
| 2245 | ClassDB::bind_method(D_METHOD("viewport_set_measure_render_time" , "viewport" , "enable" ), &RenderingServer::viewport_set_measure_render_time); |
| 2246 | ClassDB::bind_method(D_METHOD("viewport_get_measured_render_time_cpu" , "viewport" ), &RenderingServer::viewport_get_measured_render_time_cpu); |
| 2247 | |
| 2248 | ClassDB::bind_method(D_METHOD("viewport_get_measured_render_time_gpu" , "viewport" ), &RenderingServer::viewport_get_measured_render_time_gpu); |
| 2249 | |
| 2250 | ClassDB::bind_method(D_METHOD("viewport_set_vrs_mode" , "viewport" , "mode" ), &RenderingServer::viewport_set_vrs_mode); |
| 2251 | ClassDB::bind_method(D_METHOD("viewport_set_vrs_texture" , "viewport" , "texture" ), &RenderingServer::viewport_set_vrs_texture); |
| 2252 | |
| 2253 | BIND_ENUM_CONSTANT(VIEWPORT_SCALING_3D_MODE_BILINEAR); |
| 2254 | BIND_ENUM_CONSTANT(VIEWPORT_SCALING_3D_MODE_FSR); |
| 2255 | BIND_ENUM_CONSTANT(VIEWPORT_SCALING_3D_MODE_MAX); |
| 2256 | |
| 2257 | BIND_ENUM_CONSTANT(VIEWPORT_UPDATE_DISABLED); |
| 2258 | BIND_ENUM_CONSTANT(VIEWPORT_UPDATE_ONCE); // Then goes to disabled); must be manually updated. |
| 2259 | BIND_ENUM_CONSTANT(VIEWPORT_UPDATE_WHEN_VISIBLE); // Default |
| 2260 | BIND_ENUM_CONSTANT(VIEWPORT_UPDATE_WHEN_PARENT_VISIBLE); |
| 2261 | BIND_ENUM_CONSTANT(VIEWPORT_UPDATE_ALWAYS); |
| 2262 | |
| 2263 | BIND_ENUM_CONSTANT(VIEWPORT_CLEAR_ALWAYS); |
| 2264 | BIND_ENUM_CONSTANT(VIEWPORT_CLEAR_NEVER); |
| 2265 | BIND_ENUM_CONSTANT(VIEWPORT_CLEAR_ONLY_NEXT_FRAME); |
| 2266 | |
| 2267 | BIND_ENUM_CONSTANT(VIEWPORT_ENVIRONMENT_DISABLED); |
| 2268 | BIND_ENUM_CONSTANT(VIEWPORT_ENVIRONMENT_ENABLED); |
| 2269 | BIND_ENUM_CONSTANT(VIEWPORT_ENVIRONMENT_INHERIT); |
| 2270 | BIND_ENUM_CONSTANT(VIEWPORT_ENVIRONMENT_MAX); |
| 2271 | |
| 2272 | BIND_ENUM_CONSTANT(VIEWPORT_SDF_OVERSIZE_100_PERCENT); |
| 2273 | BIND_ENUM_CONSTANT(VIEWPORT_SDF_OVERSIZE_120_PERCENT); |
| 2274 | BIND_ENUM_CONSTANT(VIEWPORT_SDF_OVERSIZE_150_PERCENT); |
| 2275 | BIND_ENUM_CONSTANT(VIEWPORT_SDF_OVERSIZE_200_PERCENT); |
| 2276 | BIND_ENUM_CONSTANT(VIEWPORT_SDF_OVERSIZE_MAX); |
| 2277 | |
| 2278 | BIND_ENUM_CONSTANT(VIEWPORT_SDF_SCALE_100_PERCENT); |
| 2279 | BIND_ENUM_CONSTANT(VIEWPORT_SDF_SCALE_50_PERCENT); |
| 2280 | BIND_ENUM_CONSTANT(VIEWPORT_SDF_SCALE_25_PERCENT); |
| 2281 | BIND_ENUM_CONSTANT(VIEWPORT_SDF_SCALE_MAX); |
| 2282 | |
| 2283 | BIND_ENUM_CONSTANT(VIEWPORT_MSAA_DISABLED); |
| 2284 | BIND_ENUM_CONSTANT(VIEWPORT_MSAA_2X); |
| 2285 | BIND_ENUM_CONSTANT(VIEWPORT_MSAA_4X); |
| 2286 | BIND_ENUM_CONSTANT(VIEWPORT_MSAA_8X); |
| 2287 | BIND_ENUM_CONSTANT(VIEWPORT_MSAA_MAX); |
| 2288 | |
| 2289 | BIND_ENUM_CONSTANT(VIEWPORT_SCREEN_SPACE_AA_DISABLED); |
| 2290 | BIND_ENUM_CONSTANT(VIEWPORT_SCREEN_SPACE_AA_FXAA); |
| 2291 | BIND_ENUM_CONSTANT(VIEWPORT_SCREEN_SPACE_AA_MAX); |
| 2292 | |
| 2293 | BIND_ENUM_CONSTANT(VIEWPORT_OCCLUSION_BUILD_QUALITY_LOW); |
| 2294 | BIND_ENUM_CONSTANT(VIEWPORT_OCCLUSION_BUILD_QUALITY_MEDIUM); |
| 2295 | BIND_ENUM_CONSTANT(VIEWPORT_OCCLUSION_BUILD_QUALITY_HIGH); |
| 2296 | |
| 2297 | BIND_ENUM_CONSTANT(VIEWPORT_RENDER_INFO_OBJECTS_IN_FRAME); |
| 2298 | BIND_ENUM_CONSTANT(VIEWPORT_RENDER_INFO_PRIMITIVES_IN_FRAME); |
| 2299 | BIND_ENUM_CONSTANT(VIEWPORT_RENDER_INFO_DRAW_CALLS_IN_FRAME); |
| 2300 | BIND_ENUM_CONSTANT(VIEWPORT_RENDER_INFO_MAX); |
| 2301 | |
| 2302 | BIND_ENUM_CONSTANT(VIEWPORT_RENDER_INFO_TYPE_VISIBLE); |
| 2303 | BIND_ENUM_CONSTANT(VIEWPORT_RENDER_INFO_TYPE_SHADOW); |
| 2304 | BIND_ENUM_CONSTANT(VIEWPORT_RENDER_INFO_TYPE_MAX); |
| 2305 | |
| 2306 | BIND_ENUM_CONSTANT(VIEWPORT_DEBUG_DRAW_DISABLED); |
| 2307 | BIND_ENUM_CONSTANT(VIEWPORT_DEBUG_DRAW_UNSHADED); |
| 2308 | BIND_ENUM_CONSTANT(VIEWPORT_DEBUG_DRAW_LIGHTING); |
| 2309 | BIND_ENUM_CONSTANT(VIEWPORT_DEBUG_DRAW_OVERDRAW); |
| 2310 | BIND_ENUM_CONSTANT(VIEWPORT_DEBUG_DRAW_WIREFRAME); |
| 2311 | BIND_ENUM_CONSTANT(VIEWPORT_DEBUG_DRAW_NORMAL_BUFFER); |
| 2312 | BIND_ENUM_CONSTANT(VIEWPORT_DEBUG_DRAW_VOXEL_GI_ALBEDO); |
| 2313 | BIND_ENUM_CONSTANT(VIEWPORT_DEBUG_DRAW_VOXEL_GI_LIGHTING); |
| 2314 | BIND_ENUM_CONSTANT(VIEWPORT_DEBUG_DRAW_VOXEL_GI_EMISSION); |
| 2315 | BIND_ENUM_CONSTANT(VIEWPORT_DEBUG_DRAW_SHADOW_ATLAS); |
| 2316 | BIND_ENUM_CONSTANT(VIEWPORT_DEBUG_DRAW_DIRECTIONAL_SHADOW_ATLAS); |
| 2317 | BIND_ENUM_CONSTANT(VIEWPORT_DEBUG_DRAW_SCENE_LUMINANCE); |
| 2318 | BIND_ENUM_CONSTANT(VIEWPORT_DEBUG_DRAW_SSAO); |
| 2319 | BIND_ENUM_CONSTANT(VIEWPORT_DEBUG_DRAW_SSIL); |
| 2320 | BIND_ENUM_CONSTANT(VIEWPORT_DEBUG_DRAW_PSSM_SPLITS); |
| 2321 | BIND_ENUM_CONSTANT(VIEWPORT_DEBUG_DRAW_DECAL_ATLAS); |
| 2322 | BIND_ENUM_CONSTANT(VIEWPORT_DEBUG_DRAW_SDFGI); |
| 2323 | BIND_ENUM_CONSTANT(VIEWPORT_DEBUG_DRAW_SDFGI_PROBES); |
| 2324 | BIND_ENUM_CONSTANT(VIEWPORT_DEBUG_DRAW_GI_BUFFER); |
| 2325 | BIND_ENUM_CONSTANT(VIEWPORT_DEBUG_DRAW_DISABLE_LOD); |
| 2326 | BIND_ENUM_CONSTANT(VIEWPORT_DEBUG_DRAW_CLUSTER_OMNI_LIGHTS); |
| 2327 | BIND_ENUM_CONSTANT(VIEWPORT_DEBUG_DRAW_CLUSTER_SPOT_LIGHTS); |
| 2328 | BIND_ENUM_CONSTANT(VIEWPORT_DEBUG_DRAW_CLUSTER_DECALS); |
| 2329 | BIND_ENUM_CONSTANT(VIEWPORT_DEBUG_DRAW_CLUSTER_REFLECTION_PROBES); |
| 2330 | BIND_ENUM_CONSTANT(VIEWPORT_DEBUG_DRAW_OCCLUDERS); |
| 2331 | BIND_ENUM_CONSTANT(VIEWPORT_DEBUG_DRAW_MOTION_VECTORS); |
| 2332 | |
| 2333 | BIND_ENUM_CONSTANT(VIEWPORT_VRS_DISABLED); |
| 2334 | BIND_ENUM_CONSTANT(VIEWPORT_VRS_TEXTURE); |
| 2335 | BIND_ENUM_CONSTANT(VIEWPORT_VRS_XR); |
| 2336 | BIND_ENUM_CONSTANT(VIEWPORT_VRS_MAX); |
| 2337 | |
| 2338 | /* SKY API */ |
| 2339 | |
| 2340 | ClassDB::bind_method(D_METHOD("sky_create" ), &RenderingServer::sky_create); |
| 2341 | ClassDB::bind_method(D_METHOD("sky_set_radiance_size" , "sky" , "radiance_size" ), &RenderingServer::sky_set_radiance_size); |
| 2342 | ClassDB::bind_method(D_METHOD("sky_set_mode" , "sky" , "mode" ), &RenderingServer::sky_set_mode); |
| 2343 | ClassDB::bind_method(D_METHOD("sky_set_material" , "sky" , "material" ), &RenderingServer::sky_set_material); |
| 2344 | ClassDB::bind_method(D_METHOD("sky_bake_panorama" , "sky" , "energy" , "bake_irradiance" , "size" ), &RenderingServer::sky_bake_panorama); |
| 2345 | |
| 2346 | BIND_ENUM_CONSTANT(SKY_MODE_AUTOMATIC); |
| 2347 | BIND_ENUM_CONSTANT(SKY_MODE_QUALITY); |
| 2348 | BIND_ENUM_CONSTANT(SKY_MODE_INCREMENTAL); |
| 2349 | BIND_ENUM_CONSTANT(SKY_MODE_REALTIME); |
| 2350 | |
| 2351 | /* ENVIRONMENT */ |
| 2352 | |
| 2353 | ClassDB::bind_method(D_METHOD("environment_create" ), &RenderingServer::environment_create); |
| 2354 | ClassDB::bind_method(D_METHOD("environment_set_background" , "env" , "bg" ), &RenderingServer::environment_set_background); |
| 2355 | ClassDB::bind_method(D_METHOD("environment_set_sky" , "env" , "sky" ), &RenderingServer::environment_set_sky); |
| 2356 | ClassDB::bind_method(D_METHOD("environment_set_sky_custom_fov" , "env" , "scale" ), &RenderingServer::environment_set_sky_custom_fov); |
| 2357 | ClassDB::bind_method(D_METHOD("environment_set_sky_orientation" , "env" , "orientation" ), &RenderingServer::environment_set_sky_orientation); |
| 2358 | ClassDB::bind_method(D_METHOD("environment_set_bg_color" , "env" , "color" ), &RenderingServer::environment_set_bg_color); |
| 2359 | ClassDB::bind_method(D_METHOD("environment_set_bg_energy" , "env" , "multiplier" , "exposure_value" ), &RenderingServer::environment_set_bg_energy); |
| 2360 | ClassDB::bind_method(D_METHOD("environment_set_canvas_max_layer" , "env" , "max_layer" ), &RenderingServer::environment_set_canvas_max_layer); |
| 2361 | ClassDB::bind_method(D_METHOD("environment_set_ambient_light" , "env" , "color" , "ambient" , "energy" , "sky_contibution" , "reflection_source" ), &RenderingServer::environment_set_ambient_light, DEFVAL(RS::ENV_AMBIENT_SOURCE_BG), DEFVAL(1.0), DEFVAL(0.0), DEFVAL(RS::ENV_REFLECTION_SOURCE_BG)); |
| 2362 | ClassDB::bind_method(D_METHOD("environment_set_glow" , "env" , "enable" , "levels" , "intensity" , "strength" , "mix" , "bloom_threshold" , "blend_mode" , "hdr_bleed_threshold" , "hdr_bleed_scale" , "hdr_luminance_cap" , "glow_map_strength" , "glow_map" ), &RenderingServer::environment_set_glow); |
| 2363 | ClassDB::bind_method(D_METHOD("environment_set_tonemap" , "env" , "tone_mapper" , "exposure" , "white" ), &RenderingServer::environment_set_tonemap); |
| 2364 | ClassDB::bind_method(D_METHOD("environment_set_adjustment" , "env" , "enable" , "brightness" , "contrast" , "saturation" , "use_1d_color_correction" , "color_correction" ), &RenderingServer::environment_set_adjustment); |
| 2365 | ClassDB::bind_method(D_METHOD("environment_set_ssr" , "env" , "enable" , "max_steps" , "fade_in" , "fade_out" , "depth_tolerance" ), &RenderingServer::environment_set_ssr); |
| 2366 | ClassDB::bind_method(D_METHOD("environment_set_ssao" , "env" , "enable" , "radius" , "intensity" , "power" , "detail" , "horizon" , "sharpness" , "light_affect" , "ao_channel_affect" ), &RenderingServer::environment_set_ssao); |
| 2367 | ClassDB::bind_method(D_METHOD("environment_set_fog" , "env" , "enable" , "light_color" , "light_energy" , "sun_scatter" , "density" , "height" , "height_density" , "aerial_perspective" , "sky_affect" ), &RenderingServer::environment_set_fog); |
| 2368 | ClassDB::bind_method(D_METHOD("environment_set_sdfgi" , "env" , "enable" , "cascades" , "min_cell_size" , "y_scale" , "use_occlusion" , "bounce_feedback" , "read_sky" , "energy" , "normal_bias" , "probe_bias" ), &RenderingServer::environment_set_sdfgi); |
| 2369 | ClassDB::bind_method(D_METHOD("environment_set_volumetric_fog" , "env" , "enable" , "density" , "albedo" , "emission" , "emission_energy" , "anisotropy" , "length" , "p_detail_spread" , "gi_inject" , "temporal_reprojection" , "temporal_reprojection_amount" , "ambient_inject" , "sky_affect" ), &RenderingServer::environment_set_volumetric_fog); |
| 2370 | |
| 2371 | ClassDB::bind_method(D_METHOD("environment_glow_set_use_bicubic_upscale" , "enable" ), &RenderingServer::environment_glow_set_use_bicubic_upscale); |
| 2372 | ClassDB::bind_method(D_METHOD("environment_set_ssr_roughness_quality" , "quality" ), &RenderingServer::environment_set_ssr_roughness_quality); |
| 2373 | ClassDB::bind_method(D_METHOD("environment_set_ssao_quality" , "quality" , "half_size" , "adaptive_target" , "blur_passes" , "fadeout_from" , "fadeout_to" ), &RenderingServer::environment_set_ssao_quality); |
| 2374 | ClassDB::bind_method(D_METHOD("environment_set_ssil_quality" , "quality" , "half_size" , "adaptive_target" , "blur_passes" , "fadeout_from" , "fadeout_to" ), &RenderingServer::environment_set_ssil_quality); |
| 2375 | ClassDB::bind_method(D_METHOD("environment_set_sdfgi_ray_count" , "ray_count" ), &RenderingServer::environment_set_sdfgi_ray_count); |
| 2376 | ClassDB::bind_method(D_METHOD("environment_set_sdfgi_frames_to_converge" , "frames" ), &RenderingServer::environment_set_sdfgi_frames_to_converge); |
| 2377 | ClassDB::bind_method(D_METHOD("environment_set_sdfgi_frames_to_update_light" , "frames" ), &RenderingServer::environment_set_sdfgi_frames_to_update_light); |
| 2378 | ClassDB::bind_method(D_METHOD("environment_set_volumetric_fog_volume_size" , "size" , "depth" ), &RenderingServer::environment_set_volumetric_fog_volume_size); |
| 2379 | ClassDB::bind_method(D_METHOD("environment_set_volumetric_fog_filter_active" , "active" ), &RenderingServer::environment_set_volumetric_fog_filter_active); |
| 2380 | |
| 2381 | ClassDB::bind_method(D_METHOD("environment_bake_panorama" , "environment" , "bake_irradiance" , "size" ), &RenderingServer::environment_bake_panorama); |
| 2382 | |
| 2383 | ClassDB::bind_method(D_METHOD("screen_space_roughness_limiter_set_active" , "enable" , "amount" , "limit" ), &RenderingServer::screen_space_roughness_limiter_set_active); |
| 2384 | ClassDB::bind_method(D_METHOD("sub_surface_scattering_set_quality" , "quality" ), &RenderingServer::sub_surface_scattering_set_quality); |
| 2385 | ClassDB::bind_method(D_METHOD("sub_surface_scattering_set_scale" , "scale" , "depth_scale" ), &RenderingServer::sub_surface_scattering_set_scale); |
| 2386 | |
| 2387 | BIND_ENUM_CONSTANT(ENV_BG_CLEAR_COLOR); |
| 2388 | BIND_ENUM_CONSTANT(ENV_BG_COLOR); |
| 2389 | BIND_ENUM_CONSTANT(ENV_BG_SKY); |
| 2390 | BIND_ENUM_CONSTANT(ENV_BG_CANVAS); |
| 2391 | BIND_ENUM_CONSTANT(ENV_BG_KEEP); |
| 2392 | BIND_ENUM_CONSTANT(ENV_BG_CAMERA_FEED); |
| 2393 | BIND_ENUM_CONSTANT(ENV_BG_MAX); |
| 2394 | |
| 2395 | BIND_ENUM_CONSTANT(ENV_AMBIENT_SOURCE_BG); |
| 2396 | BIND_ENUM_CONSTANT(ENV_AMBIENT_SOURCE_DISABLED); |
| 2397 | BIND_ENUM_CONSTANT(ENV_AMBIENT_SOURCE_COLOR); |
| 2398 | BIND_ENUM_CONSTANT(ENV_AMBIENT_SOURCE_SKY); |
| 2399 | |
| 2400 | BIND_ENUM_CONSTANT(ENV_REFLECTION_SOURCE_BG); |
| 2401 | BIND_ENUM_CONSTANT(ENV_REFLECTION_SOURCE_DISABLED); |
| 2402 | BIND_ENUM_CONSTANT(ENV_REFLECTION_SOURCE_SKY); |
| 2403 | |
| 2404 | BIND_ENUM_CONSTANT(ENV_GLOW_BLEND_MODE_ADDITIVE); |
| 2405 | BIND_ENUM_CONSTANT(ENV_GLOW_BLEND_MODE_SCREEN); |
| 2406 | BIND_ENUM_CONSTANT(ENV_GLOW_BLEND_MODE_SOFTLIGHT); |
| 2407 | BIND_ENUM_CONSTANT(ENV_GLOW_BLEND_MODE_REPLACE); |
| 2408 | BIND_ENUM_CONSTANT(ENV_GLOW_BLEND_MODE_MIX); |
| 2409 | |
| 2410 | BIND_ENUM_CONSTANT(ENV_TONE_MAPPER_LINEAR); |
| 2411 | BIND_ENUM_CONSTANT(ENV_TONE_MAPPER_REINHARD); |
| 2412 | BIND_ENUM_CONSTANT(ENV_TONE_MAPPER_FILMIC); |
| 2413 | BIND_ENUM_CONSTANT(ENV_TONE_MAPPER_ACES); |
| 2414 | |
| 2415 | BIND_ENUM_CONSTANT(ENV_SSR_ROUGHNESS_QUALITY_DISABLED); |
| 2416 | BIND_ENUM_CONSTANT(ENV_SSR_ROUGHNESS_QUALITY_LOW); |
| 2417 | BIND_ENUM_CONSTANT(ENV_SSR_ROUGHNESS_QUALITY_MEDIUM); |
| 2418 | BIND_ENUM_CONSTANT(ENV_SSR_ROUGHNESS_QUALITY_HIGH); |
| 2419 | |
| 2420 | BIND_ENUM_CONSTANT(ENV_SSAO_QUALITY_VERY_LOW); |
| 2421 | BIND_ENUM_CONSTANT(ENV_SSAO_QUALITY_LOW); |
| 2422 | BIND_ENUM_CONSTANT(ENV_SSAO_QUALITY_MEDIUM); |
| 2423 | BIND_ENUM_CONSTANT(ENV_SSAO_QUALITY_HIGH); |
| 2424 | BIND_ENUM_CONSTANT(ENV_SSAO_QUALITY_ULTRA); |
| 2425 | |
| 2426 | BIND_ENUM_CONSTANT(ENV_SSIL_QUALITY_VERY_LOW); |
| 2427 | BIND_ENUM_CONSTANT(ENV_SSIL_QUALITY_LOW); |
| 2428 | BIND_ENUM_CONSTANT(ENV_SSIL_QUALITY_MEDIUM); |
| 2429 | BIND_ENUM_CONSTANT(ENV_SSIL_QUALITY_HIGH); |
| 2430 | BIND_ENUM_CONSTANT(ENV_SSIL_QUALITY_ULTRA); |
| 2431 | |
| 2432 | BIND_ENUM_CONSTANT(ENV_SDFGI_Y_SCALE_50_PERCENT); |
| 2433 | BIND_ENUM_CONSTANT(ENV_SDFGI_Y_SCALE_75_PERCENT); |
| 2434 | BIND_ENUM_CONSTANT(ENV_SDFGI_Y_SCALE_100_PERCENT); |
| 2435 | |
| 2436 | BIND_ENUM_CONSTANT(ENV_SDFGI_RAY_COUNT_4); |
| 2437 | BIND_ENUM_CONSTANT(ENV_SDFGI_RAY_COUNT_8); |
| 2438 | BIND_ENUM_CONSTANT(ENV_SDFGI_RAY_COUNT_16); |
| 2439 | BIND_ENUM_CONSTANT(ENV_SDFGI_RAY_COUNT_32); |
| 2440 | BIND_ENUM_CONSTANT(ENV_SDFGI_RAY_COUNT_64); |
| 2441 | BIND_ENUM_CONSTANT(ENV_SDFGI_RAY_COUNT_96); |
| 2442 | BIND_ENUM_CONSTANT(ENV_SDFGI_RAY_COUNT_128); |
| 2443 | BIND_ENUM_CONSTANT(ENV_SDFGI_RAY_COUNT_MAX); |
| 2444 | |
| 2445 | BIND_ENUM_CONSTANT(ENV_SDFGI_CONVERGE_IN_5_FRAMES); |
| 2446 | BIND_ENUM_CONSTANT(ENV_SDFGI_CONVERGE_IN_10_FRAMES); |
| 2447 | BIND_ENUM_CONSTANT(ENV_SDFGI_CONVERGE_IN_15_FRAMES); |
| 2448 | BIND_ENUM_CONSTANT(ENV_SDFGI_CONVERGE_IN_20_FRAMES); |
| 2449 | BIND_ENUM_CONSTANT(ENV_SDFGI_CONVERGE_IN_25_FRAMES); |
| 2450 | BIND_ENUM_CONSTANT(ENV_SDFGI_CONVERGE_IN_30_FRAMES); |
| 2451 | BIND_ENUM_CONSTANT(ENV_SDFGI_CONVERGE_MAX); |
| 2452 | |
| 2453 | BIND_ENUM_CONSTANT(ENV_SDFGI_UPDATE_LIGHT_IN_1_FRAME); |
| 2454 | BIND_ENUM_CONSTANT(ENV_SDFGI_UPDATE_LIGHT_IN_2_FRAMES); |
| 2455 | BIND_ENUM_CONSTANT(ENV_SDFGI_UPDATE_LIGHT_IN_4_FRAMES); |
| 2456 | BIND_ENUM_CONSTANT(ENV_SDFGI_UPDATE_LIGHT_IN_8_FRAMES); |
| 2457 | BIND_ENUM_CONSTANT(ENV_SDFGI_UPDATE_LIGHT_IN_16_FRAMES); |
| 2458 | BIND_ENUM_CONSTANT(ENV_SDFGI_UPDATE_LIGHT_MAX); |
| 2459 | |
| 2460 | BIND_ENUM_CONSTANT(SUB_SURFACE_SCATTERING_QUALITY_DISABLED); |
| 2461 | BIND_ENUM_CONSTANT(SUB_SURFACE_SCATTERING_QUALITY_LOW); |
| 2462 | BIND_ENUM_CONSTANT(SUB_SURFACE_SCATTERING_QUALITY_MEDIUM); |
| 2463 | BIND_ENUM_CONSTANT(SUB_SURFACE_SCATTERING_QUALITY_HIGH); |
| 2464 | |
| 2465 | /* CAMERA EFFECTS */ |
| 2466 | |
| 2467 | ClassDB::bind_method(D_METHOD("camera_attributes_create" ), &RenderingServer::camera_attributes_create); |
| 2468 | |
| 2469 | ClassDB::bind_method(D_METHOD("camera_attributes_set_dof_blur_quality" , "quality" , "use_jitter" ), &RenderingServer::camera_attributes_set_dof_blur_quality); |
| 2470 | ClassDB::bind_method(D_METHOD("camera_attributes_set_dof_blur_bokeh_shape" , "shape" ), &RenderingServer::camera_attributes_set_dof_blur_bokeh_shape); |
| 2471 | |
| 2472 | ClassDB::bind_method(D_METHOD("camera_attributes_set_dof_blur" , "camera_attributes" , "far_enable" , "far_distance" , "far_transition" , "near_enable" , "near_distance" , "near_transition" , "amount" ), &RenderingServer::camera_attributes_set_dof_blur); |
| 2473 | ClassDB::bind_method(D_METHOD("camera_attributes_set_exposure" , "camera_attributes" , "multiplier" , "normalization" ), &RenderingServer::camera_attributes_set_exposure); |
| 2474 | ClassDB::bind_method(D_METHOD("camera_attributes_set_auto_exposure" , "camera_attributes" , "enable" , "min_sensitivity" , "max_sensitivity" , "speed" , "scale" ), &RenderingServer::camera_attributes_set_auto_exposure); |
| 2475 | |
| 2476 | BIND_ENUM_CONSTANT(DOF_BOKEH_BOX); |
| 2477 | BIND_ENUM_CONSTANT(DOF_BOKEH_HEXAGON); |
| 2478 | BIND_ENUM_CONSTANT(DOF_BOKEH_CIRCLE); |
| 2479 | |
| 2480 | BIND_ENUM_CONSTANT(DOF_BLUR_QUALITY_VERY_LOW); |
| 2481 | BIND_ENUM_CONSTANT(DOF_BLUR_QUALITY_LOW); |
| 2482 | BIND_ENUM_CONSTANT(DOF_BLUR_QUALITY_MEDIUM); |
| 2483 | BIND_ENUM_CONSTANT(DOF_BLUR_QUALITY_HIGH); |
| 2484 | |
| 2485 | /* SCENARIO */ |
| 2486 | |
| 2487 | ClassDB::bind_method(D_METHOD("scenario_create" ), &RenderingServer::scenario_create); |
| 2488 | ClassDB::bind_method(D_METHOD("scenario_set_environment" , "scenario" , "environment" ), &RenderingServer::scenario_set_environment); |
| 2489 | ClassDB::bind_method(D_METHOD("scenario_set_fallback_environment" , "scenario" , "environment" ), &RenderingServer::scenario_set_fallback_environment); |
| 2490 | ClassDB::bind_method(D_METHOD("scenario_set_camera_attributes" , "scenario" , "effects" ), &RenderingServer::scenario_set_camera_attributes); |
| 2491 | |
| 2492 | /* INSTANCE */ |
| 2493 | |
| 2494 | ClassDB::bind_method(D_METHOD("instance_create2" , "base" , "scenario" ), &RenderingServer::instance_create2); |
| 2495 | ClassDB::bind_method(D_METHOD("instance_create" ), &RenderingServer::instance_create); |
| 2496 | ClassDB::bind_method(D_METHOD("instance_set_base" , "instance" , "base" ), &RenderingServer::instance_set_base); |
| 2497 | ClassDB::bind_method(D_METHOD("instance_set_scenario" , "instance" , "scenario" ), &RenderingServer::instance_set_scenario); |
| 2498 | ClassDB::bind_method(D_METHOD("instance_set_layer_mask" , "instance" , "mask" ), &RenderingServer::instance_set_layer_mask); |
| 2499 | ClassDB::bind_method(D_METHOD("instance_set_pivot_data" , "instance" , "sorting_offset" , "use_aabb_center" ), &RenderingServer::instance_set_pivot_data); |
| 2500 | ClassDB::bind_method(D_METHOD("instance_set_transform" , "instance" , "transform" ), &RenderingServer::instance_set_transform); |
| 2501 | ClassDB::bind_method(D_METHOD("instance_attach_object_instance_id" , "instance" , "id" ), &RenderingServer::instance_attach_object_instance_id); |
| 2502 | ClassDB::bind_method(D_METHOD("instance_set_blend_shape_weight" , "instance" , "shape" , "weight" ), &RenderingServer::instance_set_blend_shape_weight); |
| 2503 | ClassDB::bind_method(D_METHOD("instance_set_surface_override_material" , "instance" , "surface" , "material" ), &RenderingServer::instance_set_surface_override_material); |
| 2504 | ClassDB::bind_method(D_METHOD("instance_set_visible" , "instance" , "visible" ), &RenderingServer::instance_set_visible); |
| 2505 | ClassDB::bind_method(D_METHOD("instance_geometry_set_transparency" , "instance" , "transparency" ), &RenderingServer::instance_geometry_set_transparency); |
| 2506 | |
| 2507 | ClassDB::bind_method(D_METHOD("instance_set_custom_aabb" , "instance" , "aabb" ), &RenderingServer::instance_set_custom_aabb); |
| 2508 | |
| 2509 | ClassDB::bind_method(D_METHOD("instance_attach_skeleton" , "instance" , "skeleton" ), &RenderingServer::instance_attach_skeleton); |
| 2510 | ClassDB::bind_method(D_METHOD("instance_set_extra_visibility_margin" , "instance" , "margin" ), &RenderingServer::instance_set_extra_visibility_margin); |
| 2511 | ClassDB::bind_method(D_METHOD("instance_set_visibility_parent" , "instance" , "parent" ), &RenderingServer::instance_set_visibility_parent); |
| 2512 | ClassDB::bind_method(D_METHOD("instance_set_ignore_culling" , "instance" , "enabled" ), &RenderingServer::instance_set_ignore_culling); |
| 2513 | |
| 2514 | ClassDB::bind_method(D_METHOD("instance_geometry_set_flag" , "instance" , "flag" , "enabled" ), &RenderingServer::instance_geometry_set_flag); |
| 2515 | ClassDB::bind_method(D_METHOD("instance_geometry_set_cast_shadows_setting" , "instance" , "shadow_casting_setting" ), &RenderingServer::instance_geometry_set_cast_shadows_setting); |
| 2516 | ClassDB::bind_method(D_METHOD("instance_geometry_set_material_override" , "instance" , "material" ), &RenderingServer::instance_geometry_set_material_override); |
| 2517 | ClassDB::bind_method(D_METHOD("instance_geometry_set_material_overlay" , "instance" , "material" ), &RenderingServer::instance_geometry_set_material_overlay); |
| 2518 | ClassDB::bind_method(D_METHOD("instance_geometry_set_visibility_range" , "instance" , "min" , "max" , "min_margin" , "max_margin" , "fade_mode" ), &RenderingServer::instance_geometry_set_visibility_range); |
| 2519 | ClassDB::bind_method(D_METHOD("instance_geometry_set_lightmap" , "instance" , "lightmap" , "lightmap_uv_scale" , "lightmap_slice" ), &RenderingServer::instance_geometry_set_lightmap); |
| 2520 | ClassDB::bind_method(D_METHOD("instance_geometry_set_lod_bias" , "instance" , "lod_bias" ), &RenderingServer::instance_geometry_set_lod_bias); |
| 2521 | |
| 2522 | ClassDB::bind_method(D_METHOD("instance_geometry_set_shader_parameter" , "instance" , "parameter" , "value" ), &RenderingServer::instance_geometry_set_shader_parameter); |
| 2523 | ClassDB::bind_method(D_METHOD("instance_geometry_get_shader_parameter" , "instance" , "parameter" ), &RenderingServer::instance_geometry_get_shader_parameter); |
| 2524 | ClassDB::bind_method(D_METHOD("instance_geometry_get_shader_parameter_default_value" , "instance" , "parameter" ), &RenderingServer::instance_geometry_get_shader_parameter_default_value); |
| 2525 | ClassDB::bind_method(D_METHOD("instance_geometry_get_shader_parameter_list" , "instance" ), &RenderingServer::_instance_geometry_get_shader_parameter_list); |
| 2526 | |
| 2527 | ClassDB::bind_method(D_METHOD("instances_cull_aabb" , "aabb" , "scenario" ), &RenderingServer::_instances_cull_aabb_bind, DEFVAL(RID())); |
| 2528 | ClassDB::bind_method(D_METHOD("instances_cull_ray" , "from" , "to" , "scenario" ), &RenderingServer::_instances_cull_ray_bind, DEFVAL(RID())); |
| 2529 | ClassDB::bind_method(D_METHOD("instances_cull_convex" , "convex" , "scenario" ), &RenderingServer::_instances_cull_convex_bind, DEFVAL(RID())); |
| 2530 | |
| 2531 | BIND_ENUM_CONSTANT(INSTANCE_NONE); |
| 2532 | BIND_ENUM_CONSTANT(INSTANCE_MESH); |
| 2533 | BIND_ENUM_CONSTANT(INSTANCE_MULTIMESH); |
| 2534 | BIND_ENUM_CONSTANT(INSTANCE_PARTICLES); |
| 2535 | BIND_ENUM_CONSTANT(INSTANCE_PARTICLES_COLLISION); |
| 2536 | BIND_ENUM_CONSTANT(INSTANCE_LIGHT); |
| 2537 | BIND_ENUM_CONSTANT(INSTANCE_REFLECTION_PROBE); |
| 2538 | BIND_ENUM_CONSTANT(INSTANCE_DECAL); |
| 2539 | BIND_ENUM_CONSTANT(INSTANCE_VOXEL_GI); |
| 2540 | BIND_ENUM_CONSTANT(INSTANCE_LIGHTMAP); |
| 2541 | BIND_ENUM_CONSTANT(INSTANCE_OCCLUDER); |
| 2542 | BIND_ENUM_CONSTANT(INSTANCE_VISIBLITY_NOTIFIER); |
| 2543 | BIND_ENUM_CONSTANT(INSTANCE_FOG_VOLUME); |
| 2544 | BIND_ENUM_CONSTANT(INSTANCE_MAX); |
| 2545 | |
| 2546 | BIND_ENUM_CONSTANT(INSTANCE_GEOMETRY_MASK); |
| 2547 | |
| 2548 | BIND_ENUM_CONSTANT(INSTANCE_FLAG_USE_BAKED_LIGHT); |
| 2549 | BIND_ENUM_CONSTANT(INSTANCE_FLAG_USE_DYNAMIC_GI); |
| 2550 | BIND_ENUM_CONSTANT(INSTANCE_FLAG_DRAW_NEXT_FRAME_IF_VISIBLE); |
| 2551 | BIND_ENUM_CONSTANT(INSTANCE_FLAG_IGNORE_OCCLUSION_CULLING); |
| 2552 | BIND_ENUM_CONSTANT(INSTANCE_FLAG_MAX); |
| 2553 | |
| 2554 | BIND_ENUM_CONSTANT(SHADOW_CASTING_SETTING_OFF); |
| 2555 | BIND_ENUM_CONSTANT(SHADOW_CASTING_SETTING_ON); |
| 2556 | BIND_ENUM_CONSTANT(SHADOW_CASTING_SETTING_DOUBLE_SIDED); |
| 2557 | BIND_ENUM_CONSTANT(SHADOW_CASTING_SETTING_SHADOWS_ONLY); |
| 2558 | |
| 2559 | BIND_ENUM_CONSTANT(VISIBILITY_RANGE_FADE_DISABLED); |
| 2560 | BIND_ENUM_CONSTANT(VISIBILITY_RANGE_FADE_SELF); |
| 2561 | BIND_ENUM_CONSTANT(VISIBILITY_RANGE_FADE_DEPENDENCIES); |
| 2562 | |
| 2563 | /* Bake 3D Object */ |
| 2564 | |
| 2565 | ClassDB::bind_method(D_METHOD("bake_render_uv2" , "base" , "material_overrides" , "image_size" ), &RenderingServer::bake_render_uv2); |
| 2566 | |
| 2567 | BIND_ENUM_CONSTANT(BAKE_CHANNEL_ALBEDO_ALPHA); |
| 2568 | BIND_ENUM_CONSTANT(BAKE_CHANNEL_NORMAL); |
| 2569 | BIND_ENUM_CONSTANT(BAKE_CHANNEL_ORM); |
| 2570 | BIND_ENUM_CONSTANT(BAKE_CHANNEL_EMISSION); |
| 2571 | |
| 2572 | /* CANVAS (2D) */ |
| 2573 | |
| 2574 | ClassDB::bind_method(D_METHOD("canvas_create" ), &RenderingServer::canvas_create); |
| 2575 | ClassDB::bind_method(D_METHOD("canvas_set_item_mirroring" , "canvas" , "item" , "mirroring" ), &RenderingServer::canvas_set_item_mirroring); |
| 2576 | ClassDB::bind_method(D_METHOD("canvas_set_modulate" , "canvas" , "color" ), &RenderingServer::canvas_set_modulate); |
| 2577 | ClassDB::bind_method(D_METHOD("canvas_set_disable_scale" , "disable" ), &RenderingServer::canvas_set_disable_scale); |
| 2578 | |
| 2579 | /* CANVAS TEXTURE */ |
| 2580 | |
| 2581 | ClassDB::bind_method(D_METHOD("canvas_texture_create" ), &RenderingServer::canvas_texture_create); |
| 2582 | ClassDB::bind_method(D_METHOD("canvas_texture_set_channel" , "canvas_texture" , "channel" , "texture" ), &RenderingServer::canvas_texture_set_channel); |
| 2583 | ClassDB::bind_method(D_METHOD("canvas_texture_set_shading_parameters" , "canvas_texture" , "base_color" , "shininess" ), &RenderingServer::canvas_texture_set_shading_parameters); |
| 2584 | |
| 2585 | ClassDB::bind_method(D_METHOD("canvas_texture_set_texture_filter" , "canvas_texture" , "filter" ), &RenderingServer::canvas_texture_set_texture_filter); |
| 2586 | ClassDB::bind_method(D_METHOD("canvas_texture_set_texture_repeat" , "canvas_texture" , "repeat" ), &RenderingServer::canvas_texture_set_texture_repeat); |
| 2587 | |
| 2588 | BIND_ENUM_CONSTANT(CANVAS_TEXTURE_CHANNEL_DIFFUSE); |
| 2589 | BIND_ENUM_CONSTANT(CANVAS_TEXTURE_CHANNEL_NORMAL); |
| 2590 | BIND_ENUM_CONSTANT(CANVAS_TEXTURE_CHANNEL_SPECULAR); |
| 2591 | |
| 2592 | /* CANVAS ITEM */ |
| 2593 | |
| 2594 | ClassDB::bind_method(D_METHOD("canvas_item_create" ), &RenderingServer::canvas_item_create); |
| 2595 | ClassDB::bind_method(D_METHOD("canvas_item_set_parent" , "item" , "parent" ), &RenderingServer::canvas_item_set_parent); |
| 2596 | ClassDB::bind_method(D_METHOD("canvas_item_set_default_texture_filter" , "item" , "filter" ), &RenderingServer::canvas_item_set_default_texture_filter); |
| 2597 | ClassDB::bind_method(D_METHOD("canvas_item_set_default_texture_repeat" , "item" , "repeat" ), &RenderingServer::canvas_item_set_default_texture_repeat); |
| 2598 | ClassDB::bind_method(D_METHOD("canvas_item_set_visible" , "item" , "visible" ), &RenderingServer::canvas_item_set_visible); |
| 2599 | ClassDB::bind_method(D_METHOD("canvas_item_set_light_mask" , "item" , "mask" ), &RenderingServer::canvas_item_set_light_mask); |
| 2600 | ClassDB::bind_method(D_METHOD("canvas_item_set_visibility_layer" , "item" , "visibility_layer" ), &RenderingServer::canvas_item_set_visibility_layer); |
| 2601 | ClassDB::bind_method(D_METHOD("canvas_item_set_transform" , "item" , "transform" ), &RenderingServer::canvas_item_set_transform); |
| 2602 | ClassDB::bind_method(D_METHOD("canvas_item_set_clip" , "item" , "clip" ), &RenderingServer::canvas_item_set_clip); |
| 2603 | ClassDB::bind_method(D_METHOD("canvas_item_set_distance_field_mode" , "item" , "enabled" ), &RenderingServer::canvas_item_set_distance_field_mode); |
| 2604 | ClassDB::bind_method(D_METHOD("canvas_item_set_custom_rect" , "item" , "use_custom_rect" , "rect" ), &RenderingServer::canvas_item_set_custom_rect, DEFVAL(Rect2())); |
| 2605 | ClassDB::bind_method(D_METHOD("canvas_item_set_modulate" , "item" , "color" ), &RenderingServer::canvas_item_set_modulate); |
| 2606 | ClassDB::bind_method(D_METHOD("canvas_item_set_self_modulate" , "item" , "color" ), &RenderingServer::canvas_item_set_self_modulate); |
| 2607 | ClassDB::bind_method(D_METHOD("canvas_item_set_draw_behind_parent" , "item" , "enabled" ), &RenderingServer::canvas_item_set_draw_behind_parent); |
| 2608 | |
| 2609 | /* Primitives */ |
| 2610 | |
| 2611 | ClassDB::bind_method(D_METHOD("canvas_item_add_line" , "item" , "from" , "to" , "color" , "width" , "antialiased" ), &RenderingServer::canvas_item_add_line, DEFVAL(-1.0), DEFVAL(false)); |
| 2612 | ClassDB::bind_method(D_METHOD("canvas_item_add_polyline" , "item" , "points" , "colors" , "width" , "antialiased" ), &RenderingServer::canvas_item_add_polyline, DEFVAL(-1.0), DEFVAL(false)); |
| 2613 | ClassDB::bind_method(D_METHOD("canvas_item_add_multiline" , "item" , "points" , "colors" , "width" ), &RenderingServer::canvas_item_add_multiline, DEFVAL(-1.0)); |
| 2614 | ClassDB::bind_method(D_METHOD("canvas_item_add_rect" , "item" , "rect" , "color" ), &RenderingServer::canvas_item_add_rect); |
| 2615 | ClassDB::bind_method(D_METHOD("canvas_item_add_circle" , "item" , "pos" , "radius" , "color" ), &RenderingServer::canvas_item_add_circle); |
| 2616 | ClassDB::bind_method(D_METHOD("canvas_item_add_texture_rect" , "item" , "rect" , "texture" , "tile" , "modulate" , "transpose" ), &RenderingServer::canvas_item_add_texture_rect, DEFVAL(false), DEFVAL(Color(1, 1, 1)), DEFVAL(false)); |
| 2617 | ClassDB::bind_method(D_METHOD("canvas_item_add_msdf_texture_rect_region" , "item" , "rect" , "texture" , "src_rect" , "modulate" , "outline_size" , "px_range" , "scale" ), &RenderingServer::canvas_item_add_msdf_texture_rect_region, DEFVAL(Color(1, 1, 1)), DEFVAL(0), DEFVAL(1.0), DEFVAL(1.0)); |
| 2618 | ClassDB::bind_method(D_METHOD("canvas_item_add_lcd_texture_rect_region" , "item" , "rect" , "texture" , "src_rect" , "modulate" ), &RenderingServer::canvas_item_add_lcd_texture_rect_region); |
| 2619 | ClassDB::bind_method(D_METHOD("canvas_item_add_texture_rect_region" , "item" , "rect" , "texture" , "src_rect" , "modulate" , "transpose" , "clip_uv" ), &RenderingServer::canvas_item_add_texture_rect_region, DEFVAL(Color(1, 1, 1)), DEFVAL(false), DEFVAL(true)); |
| 2620 | ClassDB::bind_method(D_METHOD("canvas_item_add_nine_patch" , "item" , "rect" , "source" , "texture" , "topleft" , "bottomright" , "x_axis_mode" , "y_axis_mode" , "draw_center" , "modulate" ), &RenderingServer::canvas_item_add_nine_patch, DEFVAL(NINE_PATCH_STRETCH), DEFVAL(NINE_PATCH_STRETCH), DEFVAL(true), DEFVAL(Color(1, 1, 1))); |
| 2621 | ClassDB::bind_method(D_METHOD("canvas_item_add_primitive" , "item" , "points" , "colors" , "uvs" , "texture" ), &RenderingServer::canvas_item_add_primitive); |
| 2622 | ClassDB::bind_method(D_METHOD("canvas_item_add_polygon" , "item" , "points" , "colors" , "uvs" , "texture" ), &RenderingServer::canvas_item_add_polygon, DEFVAL(Vector<Point2>()), DEFVAL(RID())); |
| 2623 | ClassDB::bind_method(D_METHOD("canvas_item_add_triangle_array" , "item" , "indices" , "points" , "colors" , "uvs" , "bones" , "weights" , "texture" , "count" ), &RenderingServer::canvas_item_add_triangle_array, DEFVAL(Vector<Point2>()), DEFVAL(Vector<int>()), DEFVAL(Vector<float>()), DEFVAL(RID()), DEFVAL(-1)); |
| 2624 | ClassDB::bind_method(D_METHOD("canvas_item_add_mesh" , "item" , "mesh" , "transform" , "modulate" , "texture" ), &RenderingServer::canvas_item_add_mesh, DEFVAL(Transform2D()), DEFVAL(Color(1, 1, 1)), DEFVAL(RID())); |
| 2625 | ClassDB::bind_method(D_METHOD("canvas_item_add_multimesh" , "item" , "mesh" , "texture" ), &RenderingServer::canvas_item_add_multimesh, DEFVAL(RID())); |
| 2626 | ClassDB::bind_method(D_METHOD("canvas_item_add_particles" , "item" , "particles" , "texture" ), &RenderingServer::canvas_item_add_particles); |
| 2627 | ClassDB::bind_method(D_METHOD("canvas_item_add_set_transform" , "item" , "transform" ), &RenderingServer::canvas_item_add_set_transform); |
| 2628 | ClassDB::bind_method(D_METHOD("canvas_item_add_clip_ignore" , "item" , "ignore" ), &RenderingServer::canvas_item_add_clip_ignore); |
| 2629 | ClassDB::bind_method(D_METHOD("canvas_item_add_animation_slice" , "item" , "animation_length" , "slice_begin" , "slice_end" , "offset" ), &RenderingServer::canvas_item_add_animation_slice, DEFVAL(0.0)); |
| 2630 | ClassDB::bind_method(D_METHOD("canvas_item_set_sort_children_by_y" , "item" , "enabled" ), &RenderingServer::canvas_item_set_sort_children_by_y); |
| 2631 | ClassDB::bind_method(D_METHOD("canvas_item_set_z_index" , "item" , "z_index" ), &RenderingServer::canvas_item_set_z_index); |
| 2632 | ClassDB::bind_method(D_METHOD("canvas_item_set_z_as_relative_to_parent" , "item" , "enabled" ), &RenderingServer::canvas_item_set_z_as_relative_to_parent); |
| 2633 | ClassDB::bind_method(D_METHOD("canvas_item_set_copy_to_backbuffer" , "item" , "enabled" , "rect" ), &RenderingServer::canvas_item_set_copy_to_backbuffer); |
| 2634 | |
| 2635 | ClassDB::bind_method(D_METHOD("canvas_item_clear" , "item" ), &RenderingServer::canvas_item_clear); |
| 2636 | ClassDB::bind_method(D_METHOD("canvas_item_set_draw_index" , "item" , "index" ), &RenderingServer::canvas_item_set_draw_index); |
| 2637 | ClassDB::bind_method(D_METHOD("canvas_item_set_material" , "item" , "material" ), &RenderingServer::canvas_item_set_material); |
| 2638 | ClassDB::bind_method(D_METHOD("canvas_item_set_use_parent_material" , "item" , "enabled" ), &RenderingServer::canvas_item_set_use_parent_material); |
| 2639 | |
| 2640 | ClassDB::bind_method(D_METHOD("canvas_item_set_visibility_notifier" , "item" , "enable" , "area" , "enter_callable" , "exit_callable" ), &RenderingServer::canvas_item_set_visibility_notifier); |
| 2641 | ClassDB::bind_method(D_METHOD("canvas_item_set_canvas_group_mode" , "item" , "mode" , "clear_margin" , "fit_empty" , "fit_margin" , "blur_mipmaps" ), &RenderingServer::canvas_item_set_canvas_group_mode, DEFVAL(5.0), DEFVAL(false), DEFVAL(0.0), DEFVAL(false)); |
| 2642 | |
| 2643 | BIND_ENUM_CONSTANT(NINE_PATCH_STRETCH); |
| 2644 | BIND_ENUM_CONSTANT(NINE_PATCH_TILE); |
| 2645 | BIND_ENUM_CONSTANT(NINE_PATCH_TILE_FIT); |
| 2646 | |
| 2647 | BIND_ENUM_CONSTANT(CANVAS_ITEM_TEXTURE_FILTER_DEFAULT); |
| 2648 | BIND_ENUM_CONSTANT(CANVAS_ITEM_TEXTURE_FILTER_NEAREST); |
| 2649 | BIND_ENUM_CONSTANT(CANVAS_ITEM_TEXTURE_FILTER_LINEAR); |
| 2650 | BIND_ENUM_CONSTANT(CANVAS_ITEM_TEXTURE_FILTER_NEAREST_WITH_MIPMAPS); |
| 2651 | BIND_ENUM_CONSTANT(CANVAS_ITEM_TEXTURE_FILTER_LINEAR_WITH_MIPMAPS); |
| 2652 | BIND_ENUM_CONSTANT(CANVAS_ITEM_TEXTURE_FILTER_NEAREST_WITH_MIPMAPS_ANISOTROPIC); |
| 2653 | BIND_ENUM_CONSTANT(CANVAS_ITEM_TEXTURE_FILTER_LINEAR_WITH_MIPMAPS_ANISOTROPIC); |
| 2654 | BIND_ENUM_CONSTANT(CANVAS_ITEM_TEXTURE_FILTER_MAX); |
| 2655 | |
| 2656 | BIND_ENUM_CONSTANT(CANVAS_ITEM_TEXTURE_REPEAT_DEFAULT); |
| 2657 | BIND_ENUM_CONSTANT(CANVAS_ITEM_TEXTURE_REPEAT_DISABLED); |
| 2658 | BIND_ENUM_CONSTANT(CANVAS_ITEM_TEXTURE_REPEAT_ENABLED); |
| 2659 | BIND_ENUM_CONSTANT(CANVAS_ITEM_TEXTURE_REPEAT_MIRROR); |
| 2660 | BIND_ENUM_CONSTANT(CANVAS_ITEM_TEXTURE_REPEAT_MAX); |
| 2661 | |
| 2662 | BIND_ENUM_CONSTANT(CANVAS_GROUP_MODE_DISABLED); |
| 2663 | BIND_ENUM_CONSTANT(CANVAS_GROUP_MODE_CLIP_ONLY); |
| 2664 | BIND_ENUM_CONSTANT(CANVAS_GROUP_MODE_CLIP_AND_DRAW); |
| 2665 | BIND_ENUM_CONSTANT(CANVAS_GROUP_MODE_TRANSPARENT); |
| 2666 | |
| 2667 | /* CANVAS LIGHT */ |
| 2668 | |
| 2669 | ClassDB::bind_method(D_METHOD("canvas_light_create" ), &RenderingServer::canvas_light_create); |
| 2670 | ClassDB::bind_method(D_METHOD("canvas_light_attach_to_canvas" , "light" , "canvas" ), &RenderingServer::canvas_light_attach_to_canvas); |
| 2671 | ClassDB::bind_method(D_METHOD("canvas_light_set_enabled" , "light" , "enabled" ), &RenderingServer::canvas_light_set_enabled); |
| 2672 | ClassDB::bind_method(D_METHOD("canvas_light_set_texture_scale" , "light" , "scale" ), &RenderingServer::canvas_light_set_texture_scale); |
| 2673 | ClassDB::bind_method(D_METHOD("canvas_light_set_transform" , "light" , "transform" ), &RenderingServer::canvas_light_set_transform); |
| 2674 | ClassDB::bind_method(D_METHOD("canvas_light_set_texture" , "light" , "texture" ), &RenderingServer::canvas_light_set_texture); |
| 2675 | ClassDB::bind_method(D_METHOD("canvas_light_set_texture_offset" , "light" , "offset" ), &RenderingServer::canvas_light_set_texture_offset); |
| 2676 | ClassDB::bind_method(D_METHOD("canvas_light_set_color" , "light" , "color" ), &RenderingServer::canvas_light_set_color); |
| 2677 | ClassDB::bind_method(D_METHOD("canvas_light_set_height" , "light" , "height" ), &RenderingServer::canvas_light_set_height); |
| 2678 | ClassDB::bind_method(D_METHOD("canvas_light_set_energy" , "light" , "energy" ), &RenderingServer::canvas_light_set_energy); |
| 2679 | ClassDB::bind_method(D_METHOD("canvas_light_set_z_range" , "light" , "min_z" , "max_z" ), &RenderingServer::canvas_light_set_z_range); |
| 2680 | ClassDB::bind_method(D_METHOD("canvas_light_set_layer_range" , "light" , "min_layer" , "max_layer" ), &RenderingServer::canvas_light_set_layer_range); |
| 2681 | ClassDB::bind_method(D_METHOD("canvas_light_set_item_cull_mask" , "light" , "mask" ), &RenderingServer::canvas_light_set_item_cull_mask); |
| 2682 | ClassDB::bind_method(D_METHOD("canvas_light_set_item_shadow_cull_mask" , "light" , "mask" ), &RenderingServer::canvas_light_set_item_shadow_cull_mask); |
| 2683 | ClassDB::bind_method(D_METHOD("canvas_light_set_mode" , "light" , "mode" ), &RenderingServer::canvas_light_set_mode); |
| 2684 | ClassDB::bind_method(D_METHOD("canvas_light_set_shadow_enabled" , "light" , "enabled" ), &RenderingServer::canvas_light_set_shadow_enabled); |
| 2685 | ClassDB::bind_method(D_METHOD("canvas_light_set_shadow_filter" , "light" , "filter" ), &RenderingServer::canvas_light_set_shadow_filter); |
| 2686 | ClassDB::bind_method(D_METHOD("canvas_light_set_shadow_color" , "light" , "color" ), &RenderingServer::canvas_light_set_shadow_color); |
| 2687 | ClassDB::bind_method(D_METHOD("canvas_light_set_shadow_smooth" , "light" , "smooth" ), &RenderingServer::canvas_light_set_shadow_smooth); |
| 2688 | ClassDB::bind_method(D_METHOD("canvas_light_set_blend_mode" , "light" , "mode" ), &RenderingServer::canvas_light_set_blend_mode); |
| 2689 | |
| 2690 | BIND_ENUM_CONSTANT(CANVAS_LIGHT_MODE_POINT); |
| 2691 | BIND_ENUM_CONSTANT(CANVAS_LIGHT_MODE_DIRECTIONAL); |
| 2692 | |
| 2693 | BIND_ENUM_CONSTANT(CANVAS_LIGHT_BLEND_MODE_ADD); |
| 2694 | BIND_ENUM_CONSTANT(CANVAS_LIGHT_BLEND_MODE_SUB); |
| 2695 | BIND_ENUM_CONSTANT(CANVAS_LIGHT_BLEND_MODE_MIX); |
| 2696 | |
| 2697 | BIND_ENUM_CONSTANT(CANVAS_LIGHT_FILTER_NONE); |
| 2698 | BIND_ENUM_CONSTANT(CANVAS_LIGHT_FILTER_PCF5); |
| 2699 | BIND_ENUM_CONSTANT(CANVAS_LIGHT_FILTER_PCF13); |
| 2700 | BIND_ENUM_CONSTANT(CANVAS_LIGHT_FILTER_MAX); |
| 2701 | |
| 2702 | /* CANVAS OCCLUDER */ |
| 2703 | |
| 2704 | ClassDB::bind_method(D_METHOD("canvas_light_occluder_create" ), &RenderingServer::canvas_light_occluder_create); |
| 2705 | ClassDB::bind_method(D_METHOD("canvas_light_occluder_attach_to_canvas" , "occluder" , "canvas" ), &RenderingServer::canvas_light_occluder_attach_to_canvas); |
| 2706 | ClassDB::bind_method(D_METHOD("canvas_light_occluder_set_enabled" , "occluder" , "enabled" ), &RenderingServer::canvas_light_occluder_set_enabled); |
| 2707 | ClassDB::bind_method(D_METHOD("canvas_light_occluder_set_polygon" , "occluder" , "polygon" ), &RenderingServer::canvas_light_occluder_set_polygon); |
| 2708 | ClassDB::bind_method(D_METHOD("canvas_light_occluder_set_as_sdf_collision" , "occluder" , "enable" ), &RenderingServer::canvas_light_occluder_set_as_sdf_collision); |
| 2709 | ClassDB::bind_method(D_METHOD("canvas_light_occluder_set_transform" , "occluder" , "transform" ), &RenderingServer::canvas_light_occluder_set_transform); |
| 2710 | ClassDB::bind_method(D_METHOD("canvas_light_occluder_set_light_mask" , "occluder" , "mask" ), &RenderingServer::canvas_light_occluder_set_light_mask); |
| 2711 | |
| 2712 | /* CANVAS LIGHT OCCLUDER POLYGON */ |
| 2713 | |
| 2714 | ClassDB::bind_method(D_METHOD("canvas_occluder_polygon_create" ), &RenderingServer::canvas_occluder_polygon_create); |
| 2715 | ClassDB::bind_method(D_METHOD("canvas_occluder_polygon_set_shape" , "occluder_polygon" , "shape" , "closed" ), &RenderingServer::canvas_occluder_polygon_set_shape); |
| 2716 | ClassDB::bind_method(D_METHOD("canvas_occluder_polygon_set_cull_mode" , "occluder_polygon" , "mode" ), &RenderingServer::canvas_occluder_polygon_set_cull_mode); |
| 2717 | |
| 2718 | ClassDB::bind_method(D_METHOD("canvas_set_shadow_texture_size" , "size" ), &RenderingServer::canvas_set_shadow_texture_size); |
| 2719 | |
| 2720 | BIND_ENUM_CONSTANT(CANVAS_OCCLUDER_POLYGON_CULL_DISABLED); |
| 2721 | BIND_ENUM_CONSTANT(CANVAS_OCCLUDER_POLYGON_CULL_CLOCKWISE); |
| 2722 | BIND_ENUM_CONSTANT(CANVAS_OCCLUDER_POLYGON_CULL_COUNTER_CLOCKWISE); |
| 2723 | |
| 2724 | /* GLOBAL SHADER UNIFORMS */ |
| 2725 | |
| 2726 | ClassDB::bind_method(D_METHOD("global_shader_parameter_add" , "name" , "type" , "default_value" ), &RenderingServer::global_shader_parameter_add); |
| 2727 | ClassDB::bind_method(D_METHOD("global_shader_parameter_remove" , "name" ), &RenderingServer::global_shader_parameter_remove); |
| 2728 | ClassDB::bind_method(D_METHOD("global_shader_parameter_get_list" ), &RenderingServer::_global_shader_parameter_get_list); |
| 2729 | ClassDB::bind_method(D_METHOD("global_shader_parameter_set" , "name" , "value" ), &RenderingServer::global_shader_parameter_set); |
| 2730 | ClassDB::bind_method(D_METHOD("global_shader_parameter_set_override" , "name" , "value" ), &RenderingServer::global_shader_parameter_set_override); |
| 2731 | ClassDB::bind_method(D_METHOD("global_shader_parameter_get" , "name" ), &RenderingServer::global_shader_parameter_get); |
| 2732 | ClassDB::bind_method(D_METHOD("global_shader_parameter_get_type" , "name" ), &RenderingServer::global_shader_parameter_get_type); |
| 2733 | |
| 2734 | BIND_ENUM_CONSTANT(GLOBAL_VAR_TYPE_BOOL); |
| 2735 | BIND_ENUM_CONSTANT(GLOBAL_VAR_TYPE_BVEC2); |
| 2736 | BIND_ENUM_CONSTANT(GLOBAL_VAR_TYPE_BVEC3); |
| 2737 | BIND_ENUM_CONSTANT(GLOBAL_VAR_TYPE_BVEC4); |
| 2738 | BIND_ENUM_CONSTANT(GLOBAL_VAR_TYPE_INT); |
| 2739 | BIND_ENUM_CONSTANT(GLOBAL_VAR_TYPE_IVEC2); |
| 2740 | BIND_ENUM_CONSTANT(GLOBAL_VAR_TYPE_IVEC3); |
| 2741 | BIND_ENUM_CONSTANT(GLOBAL_VAR_TYPE_IVEC4); |
| 2742 | BIND_ENUM_CONSTANT(GLOBAL_VAR_TYPE_RECT2I); |
| 2743 | BIND_ENUM_CONSTANT(GLOBAL_VAR_TYPE_UINT); |
| 2744 | BIND_ENUM_CONSTANT(GLOBAL_VAR_TYPE_UVEC2); |
| 2745 | BIND_ENUM_CONSTANT(GLOBAL_VAR_TYPE_UVEC3); |
| 2746 | BIND_ENUM_CONSTANT(GLOBAL_VAR_TYPE_UVEC4); |
| 2747 | BIND_ENUM_CONSTANT(GLOBAL_VAR_TYPE_FLOAT); |
| 2748 | BIND_ENUM_CONSTANT(GLOBAL_VAR_TYPE_VEC2); |
| 2749 | BIND_ENUM_CONSTANT(GLOBAL_VAR_TYPE_VEC3); |
| 2750 | BIND_ENUM_CONSTANT(GLOBAL_VAR_TYPE_VEC4); |
| 2751 | BIND_ENUM_CONSTANT(GLOBAL_VAR_TYPE_COLOR); |
| 2752 | BIND_ENUM_CONSTANT(GLOBAL_VAR_TYPE_RECT2); |
| 2753 | BIND_ENUM_CONSTANT(GLOBAL_VAR_TYPE_MAT2); |
| 2754 | BIND_ENUM_CONSTANT(GLOBAL_VAR_TYPE_MAT3); |
| 2755 | BIND_ENUM_CONSTANT(GLOBAL_VAR_TYPE_MAT4); |
| 2756 | BIND_ENUM_CONSTANT(GLOBAL_VAR_TYPE_TRANSFORM_2D); |
| 2757 | BIND_ENUM_CONSTANT(GLOBAL_VAR_TYPE_TRANSFORM); |
| 2758 | BIND_ENUM_CONSTANT(GLOBAL_VAR_TYPE_SAMPLER2D); |
| 2759 | BIND_ENUM_CONSTANT(GLOBAL_VAR_TYPE_SAMPLER2DARRAY); |
| 2760 | BIND_ENUM_CONSTANT(GLOBAL_VAR_TYPE_SAMPLER3D); |
| 2761 | BIND_ENUM_CONSTANT(GLOBAL_VAR_TYPE_SAMPLERCUBE); |
| 2762 | BIND_ENUM_CONSTANT(GLOBAL_VAR_TYPE_MAX); |
| 2763 | |
| 2764 | /* Free */ |
| 2765 | ClassDB::bind_method(D_METHOD("free_rid" , "rid" ), &RenderingServer::free); // Shouldn't conflict with Object::free(). |
| 2766 | |
| 2767 | /* Misc */ |
| 2768 | |
| 2769 | ClassDB::bind_method(D_METHOD("request_frame_drawn_callback" , "callable" ), &RenderingServer::request_frame_drawn_callback); |
| 2770 | ClassDB::bind_method(D_METHOD("has_changed" ), &RenderingServer::has_changed); |
| 2771 | ClassDB::bind_method(D_METHOD("get_rendering_info" , "info" ), &RenderingServer::get_rendering_info); |
| 2772 | ClassDB::bind_method(D_METHOD("get_video_adapter_name" ), &RenderingServer::get_video_adapter_name); |
| 2773 | ClassDB::bind_method(D_METHOD("get_video_adapter_vendor" ), &RenderingServer::get_video_adapter_vendor); |
| 2774 | ClassDB::bind_method(D_METHOD("get_video_adapter_type" ), &RenderingServer::get_video_adapter_type); |
| 2775 | ClassDB::bind_method(D_METHOD("get_video_adapter_api_version" ), &RenderingServer::get_video_adapter_api_version); |
| 2776 | |
| 2777 | ClassDB::bind_method(D_METHOD("make_sphere_mesh" , "latitudes" , "longitudes" , "radius" ), &RenderingServer::make_sphere_mesh); |
| 2778 | ClassDB::bind_method(D_METHOD("get_test_cube" ), &RenderingServer::get_test_cube); |
| 2779 | |
| 2780 | ClassDB::bind_method(D_METHOD("get_test_texture" ), &RenderingServer::get_test_texture); |
| 2781 | ClassDB::bind_method(D_METHOD("get_white_texture" ), &RenderingServer::get_white_texture); |
| 2782 | |
| 2783 | ClassDB::bind_method(D_METHOD("set_boot_image" , "image" , "color" , "scale" , "use_filter" ), &RenderingServer::set_boot_image, DEFVAL(true)); |
| 2784 | ClassDB::bind_method(D_METHOD("get_default_clear_color" ), &RenderingServer::get_default_clear_color); |
| 2785 | ClassDB::bind_method(D_METHOD("set_default_clear_color" , "color" ), &RenderingServer::set_default_clear_color); |
| 2786 | |
| 2787 | ClassDB::bind_method(D_METHOD("has_feature" , "feature" ), &RenderingServer::has_feature); |
| 2788 | ClassDB::bind_method(D_METHOD("has_os_feature" , "feature" ), &RenderingServer::has_os_feature); |
| 2789 | ClassDB::bind_method(D_METHOD("set_debug_generate_wireframes" , "generate" ), &RenderingServer::set_debug_generate_wireframes); |
| 2790 | |
| 2791 | ClassDB::bind_method(D_METHOD("is_render_loop_enabled" ), &RenderingServer::is_render_loop_enabled); |
| 2792 | ClassDB::bind_method(D_METHOD("set_render_loop_enabled" , "enabled" ), &RenderingServer::set_render_loop_enabled); |
| 2793 | |
| 2794 | ClassDB::bind_method(D_METHOD("get_frame_setup_time_cpu" ), &RenderingServer::get_frame_setup_time_cpu); |
| 2795 | |
| 2796 | ADD_PROPERTY(PropertyInfo(Variant::BOOL, "render_loop_enabled" ), "set_render_loop_enabled" , "is_render_loop_enabled" ); |
| 2797 | |
| 2798 | BIND_ENUM_CONSTANT(RENDERING_INFO_TOTAL_OBJECTS_IN_FRAME); |
| 2799 | BIND_ENUM_CONSTANT(RENDERING_INFO_TOTAL_PRIMITIVES_IN_FRAME); |
| 2800 | BIND_ENUM_CONSTANT(RENDERING_INFO_TOTAL_DRAW_CALLS_IN_FRAME); |
| 2801 | BIND_ENUM_CONSTANT(RENDERING_INFO_TEXTURE_MEM_USED); |
| 2802 | BIND_ENUM_CONSTANT(RENDERING_INFO_BUFFER_MEM_USED); |
| 2803 | BIND_ENUM_CONSTANT(RENDERING_INFO_VIDEO_MEM_USED); |
| 2804 | |
| 2805 | BIND_ENUM_CONSTANT(FEATURE_SHADERS); |
| 2806 | BIND_ENUM_CONSTANT(FEATURE_MULTITHREADED); |
| 2807 | |
| 2808 | ADD_SIGNAL(MethodInfo("frame_pre_draw" )); |
| 2809 | ADD_SIGNAL(MethodInfo("frame_post_draw" )); |
| 2810 | |
| 2811 | ClassDB::bind_method(D_METHOD("force_sync" ), &RenderingServer::sync); |
| 2812 | ClassDB::bind_method(D_METHOD("force_draw" , "swap_buffers" , "frame_step" ), &RenderingServer::draw, DEFVAL(true), DEFVAL(0.0)); |
| 2813 | ClassDB::bind_method(D_METHOD("get_rendering_device" ), &RenderingServer::get_rendering_device); |
| 2814 | ClassDB::bind_method(D_METHOD("create_local_rendering_device" ), &RenderingServer::create_local_rendering_device); |
| 2815 | |
| 2816 | ClassDB::bind_method(D_METHOD("call_on_render_thread" , "callable" ), &RenderingServer::call_on_render_thread); |
| 2817 | } |
| 2818 | |
| 2819 | void RenderingServer::mesh_add_surface_from_mesh_data(RID p_mesh, const Geometry3D::MeshData &p_mesh_data) { |
| 2820 | Vector<Vector3> vertices; |
| 2821 | Vector<Vector3> normals; |
| 2822 | |
| 2823 | for (const Geometry3D::MeshData::Face &f : p_mesh_data.faces) { |
| 2824 | for (uint32_t j = 2; j < f.indices.size(); j++) { |
| 2825 | vertices.push_back(p_mesh_data.vertices[f.indices[0]]); |
| 2826 | normals.push_back(f.plane.normal); |
| 2827 | |
| 2828 | vertices.push_back(p_mesh_data.vertices[f.indices[j - 1]]); |
| 2829 | normals.push_back(f.plane.normal); |
| 2830 | |
| 2831 | vertices.push_back(p_mesh_data.vertices[f.indices[j]]); |
| 2832 | normals.push_back(f.plane.normal); |
| 2833 | } |
| 2834 | } |
| 2835 | |
| 2836 | Array d; |
| 2837 | d.resize(RS::ARRAY_MAX); |
| 2838 | d[ARRAY_VERTEX] = vertices; |
| 2839 | d[ARRAY_NORMAL] = normals; |
| 2840 | mesh_add_surface_from_arrays(p_mesh, PRIMITIVE_TRIANGLES, d); |
| 2841 | } |
| 2842 | |
| 2843 | void RenderingServer::mesh_add_surface_from_planes(RID p_mesh, const Vector<Plane> &p_planes) { |
| 2844 | Geometry3D::MeshData mdata = Geometry3D::build_convex_mesh(p_planes); |
| 2845 | mesh_add_surface_from_mesh_data(p_mesh, mdata); |
| 2846 | } |
| 2847 | |
| 2848 | RID RenderingServer::instance_create2(RID p_base, RID p_scenario) { |
| 2849 | RID instance = instance_create(); |
| 2850 | instance_set_base(instance, p_base); |
| 2851 | instance_set_scenario(instance, p_scenario); |
| 2852 | return instance; |
| 2853 | } |
| 2854 | |
| 2855 | bool RenderingServer::is_render_loop_enabled() const { |
| 2856 | return render_loop_enabled; |
| 2857 | } |
| 2858 | |
| 2859 | void RenderingServer::set_render_loop_enabled(bool p_enabled) { |
| 2860 | render_loop_enabled = p_enabled; |
| 2861 | } |
| 2862 | |
| 2863 | RenderingServer::RenderingServer() { |
| 2864 | //ERR_FAIL_COND(singleton); |
| 2865 | |
| 2866 | singleton = this; |
| 2867 | } |
| 2868 | |
| 2869 | TypedArray<StringName> RenderingServer::_global_shader_parameter_get_list() const { |
| 2870 | TypedArray<StringName> gsp; |
| 2871 | Vector<StringName> gsp_sn = global_shader_parameter_get_list(); |
| 2872 | gsp.resize(gsp_sn.size()); |
| 2873 | for (int i = 0; i < gsp_sn.size(); i++) { |
| 2874 | gsp[i] = gsp_sn[i]; |
| 2875 | } |
| 2876 | return gsp; |
| 2877 | } |
| 2878 | |
| 2879 | void RenderingServer::init() { |
| 2880 | // These are overrides, even if they are false Godot will still |
| 2881 | // import the texture formats that the host platform needs. |
| 2882 | // See `const bool can_s3tc_bptc` in the resource importer. |
| 2883 | GLOBAL_DEF_RST("rendering/textures/vram_compression/import_s3tc_bptc" , false); |
| 2884 | GLOBAL_DEF_RST("rendering/textures/vram_compression/import_etc2_astc" , false); |
| 2885 | |
| 2886 | GLOBAL_DEF("rendering/textures/lossless_compression/force_png" , false); |
| 2887 | |
| 2888 | GLOBAL_DEF(PropertyInfo(Variant::INT, "rendering/textures/webp_compression/compression_method" , PROPERTY_HINT_RANGE, "0,6,1" ), 2); |
| 2889 | GLOBAL_DEF(PropertyInfo(Variant::FLOAT, "rendering/textures/webp_compression/lossless_compression_factor" , PROPERTY_HINT_RANGE, "0,100,1" ), 25); |
| 2890 | |
| 2891 | GLOBAL_DEF(PropertyInfo(Variant::FLOAT, "rendering/limits/time/time_rollover_secs" , PROPERTY_HINT_RANGE, "0,10000,1,or_greater" ), 3600); |
| 2892 | |
| 2893 | GLOBAL_DEF_RST("rendering/lights_and_shadows/use_physical_light_units" , false); |
| 2894 | |
| 2895 | GLOBAL_DEF(PropertyInfo(Variant::INT, "rendering/lights_and_shadows/directional_shadow/size" , PROPERTY_HINT_RANGE, "256,16384" ), 4096); |
| 2896 | GLOBAL_DEF("rendering/lights_and_shadows/directional_shadow/size.mobile" , 2048); |
| 2897 | GLOBAL_DEF(PropertyInfo(Variant::INT, "rendering/lights_and_shadows/directional_shadow/soft_shadow_filter_quality" , PROPERTY_HINT_ENUM, "Hard (Fastest),Soft Very Low (Faster),Soft Low (Fast),Soft Medium (Average),Soft High (Slow),Soft Ultra (Slowest)" ), 2); |
| 2898 | GLOBAL_DEF("rendering/lights_and_shadows/directional_shadow/soft_shadow_filter_quality.mobile" , 0); |
| 2899 | GLOBAL_DEF("rendering/lights_and_shadows/directional_shadow/16_bits" , true); |
| 2900 | |
| 2901 | GLOBAL_DEF(PropertyInfo(Variant::INT, "rendering/lights_and_shadows/positional_shadow/soft_shadow_filter_quality" , PROPERTY_HINT_ENUM, "Hard (Fastest),Soft Very Low (Faster),Soft Low (Fast),Soft Medium (Average),Soft High (Slow),Soft Ultra (Slowest)" ), 2); |
| 2902 | GLOBAL_DEF("rendering/lights_and_shadows/positional_shadow/soft_shadow_filter_quality.mobile" , 0); |
| 2903 | |
| 2904 | GLOBAL_DEF("rendering/2d/shadow_atlas/size" , 2048); |
| 2905 | |
| 2906 | // Number of commands that can be drawn per frame. |
| 2907 | GLOBAL_DEF_RST(PropertyInfo(Variant::INT, "rendering/gl_compatibility/item_buffer_size" , PROPERTY_HINT_RANGE, "128,1048576,1" ), 16384); |
| 2908 | |
| 2909 | GLOBAL_DEF("rendering/shader_compiler/shader_cache/enabled" , true); |
| 2910 | GLOBAL_DEF("rendering/shader_compiler/shader_cache/compress" , true); |
| 2911 | GLOBAL_DEF("rendering/shader_compiler/shader_cache/use_zstd_compression" , true); |
| 2912 | GLOBAL_DEF("rendering/shader_compiler/shader_cache/strip_debug" , false); |
| 2913 | GLOBAL_DEF("rendering/shader_compiler/shader_cache/strip_debug.release" , true); |
| 2914 | |
| 2915 | GLOBAL_DEF_RST("rendering/reflections/sky_reflections/roughness_layers" , 8); // Assumes a 256x256 cubemap |
| 2916 | GLOBAL_DEF_RST("rendering/reflections/sky_reflections/texture_array_reflections" , true); |
| 2917 | GLOBAL_DEF("rendering/reflections/sky_reflections/texture_array_reflections.mobile" , false); |
| 2918 | GLOBAL_DEF_RST("rendering/reflections/sky_reflections/ggx_samples" , 32); |
| 2919 | GLOBAL_DEF("rendering/reflections/sky_reflections/ggx_samples.mobile" , 16); |
| 2920 | GLOBAL_DEF("rendering/reflections/sky_reflections/fast_filter_high_quality" , false); |
| 2921 | GLOBAL_DEF("rendering/reflections/reflection_atlas/reflection_size" , 256); |
| 2922 | GLOBAL_DEF("rendering/reflections/reflection_atlas/reflection_size.mobile" , 128); |
| 2923 | GLOBAL_DEF("rendering/reflections/reflection_atlas/reflection_count" , 64); |
| 2924 | |
| 2925 | GLOBAL_DEF("rendering/global_illumination/gi/use_half_resolution" , false); |
| 2926 | |
| 2927 | GLOBAL_DEF(PropertyInfo(Variant::INT, "rendering/global_illumination/voxel_gi/quality" , PROPERTY_HINT_ENUM, "Low (4 Cones - Fast),High (6 Cones - Slow)" ), 0); |
| 2928 | |
| 2929 | GLOBAL_DEF("rendering/shading/overrides/force_vertex_shading" , false); |
| 2930 | GLOBAL_DEF("rendering/shading/overrides/force_vertex_shading.mobile" , true); |
| 2931 | GLOBAL_DEF("rendering/shading/overrides/force_lambert_over_burley" , false); |
| 2932 | GLOBAL_DEF("rendering/shading/overrides/force_lambert_over_burley.mobile" , true); |
| 2933 | |
| 2934 | GLOBAL_DEF("rendering/driver/depth_prepass/enable" , true); |
| 2935 | GLOBAL_DEF("rendering/driver/depth_prepass/disable_for_vendors" , "PowerVR,Mali,Adreno,Apple" ); |
| 2936 | |
| 2937 | GLOBAL_DEF_RST("rendering/textures/default_filters/use_nearest_mipmap_filter" , false); |
| 2938 | GLOBAL_DEF_RST(PropertyInfo(Variant::INT, "rendering/textures/default_filters/anisotropic_filtering_level" , PROPERTY_HINT_ENUM, String::utf8("Disabled (Fastest),2× (Faster),4× (Fast),8× (Average),16× (Slow)" )), 2); |
| 2939 | |
| 2940 | GLOBAL_DEF(PropertyInfo(Variant::INT, "rendering/camera/depth_of_field/depth_of_field_bokeh_shape" , PROPERTY_HINT_ENUM, "Box (Fast),Hexagon (Average),Circle (Slowest)" ), 1); |
| 2941 | GLOBAL_DEF(PropertyInfo(Variant::INT, "rendering/camera/depth_of_field/depth_of_field_bokeh_quality" , PROPERTY_HINT_ENUM, "Very Low (Fastest),Low (Fast),Medium (Average),High (Slow)" ), 1); |
| 2942 | GLOBAL_DEF("rendering/camera/depth_of_field/depth_of_field_use_jitter" , false); |
| 2943 | |
| 2944 | GLOBAL_DEF(PropertyInfo(Variant::INT, "rendering/environment/ssao/quality" , PROPERTY_HINT_ENUM, "Very Low (Fast),Low (Fast),Medium (Average),High (Slow),Ultra (Custom)" ), 2); |
| 2945 | GLOBAL_DEF("rendering/environment/ssao/half_size" , true); |
| 2946 | GLOBAL_DEF(PropertyInfo(Variant::FLOAT, "rendering/environment/ssao/adaptive_target" , PROPERTY_HINT_RANGE, "0.0,1.0,0.01" ), 0.5); |
| 2947 | GLOBAL_DEF(PropertyInfo(Variant::INT, "rendering/environment/ssao/blur_passes" , PROPERTY_HINT_RANGE, "0,6" ), 2); |
| 2948 | GLOBAL_DEF(PropertyInfo(Variant::FLOAT, "rendering/environment/ssao/fadeout_from" , PROPERTY_HINT_RANGE, "0.0,512,0.1,or_greater" ), 50.0); |
| 2949 | GLOBAL_DEF(PropertyInfo(Variant::FLOAT, "rendering/environment/ssao/fadeout_to" , PROPERTY_HINT_RANGE, "64,65536,0.1,or_greater" ), 300.0); |
| 2950 | |
| 2951 | GLOBAL_DEF(PropertyInfo(Variant::INT, "rendering/environment/ssil/quality" , PROPERTY_HINT_ENUM, "Very Low (Fast),Low (Fast),Medium (Average),High (Slow),Ultra (Custom)" ), 2); |
| 2952 | GLOBAL_DEF("rendering/environment/ssil/half_size" , true); |
| 2953 | GLOBAL_DEF(PropertyInfo(Variant::FLOAT, "rendering/environment/ssil/adaptive_target" , PROPERTY_HINT_RANGE, "0.0,1.0,0.01" ), 0.5); |
| 2954 | GLOBAL_DEF(PropertyInfo(Variant::INT, "rendering/environment/ssil/blur_passes" , PROPERTY_HINT_RANGE, "0,6" ), 4); |
| 2955 | GLOBAL_DEF(PropertyInfo(Variant::FLOAT, "rendering/environment/ssil/fadeout_from" , PROPERTY_HINT_RANGE, "0.0,512,0.1,or_greater" ), 50.0); |
| 2956 | GLOBAL_DEF(PropertyInfo(Variant::FLOAT, "rendering/environment/ssil/fadeout_to" , PROPERTY_HINT_RANGE, "64,65536,0.1,or_greater" ), 300.0); |
| 2957 | |
| 2958 | GLOBAL_DEF("rendering/anti_aliasing/screen_space_roughness_limiter/enabled" , true); |
| 2959 | GLOBAL_DEF(PropertyInfo(Variant::FLOAT, "rendering/anti_aliasing/screen_space_roughness_limiter/amount" , PROPERTY_HINT_RANGE, "0.01,4.0,0.01" ), 0.25); |
| 2960 | GLOBAL_DEF(PropertyInfo(Variant::FLOAT, "rendering/anti_aliasing/screen_space_roughness_limiter/limit" , PROPERTY_HINT_RANGE, "0.01,1.0,0.01" ), 0.18); |
| 2961 | |
| 2962 | GLOBAL_DEF(PropertyInfo(Variant::INT, "rendering/scaling_3d/mode" , PROPERTY_HINT_ENUM, "Bilinear (Fastest),FSR 1.0 (Fast)" ), 0); |
| 2963 | GLOBAL_DEF(PropertyInfo(Variant::FLOAT, "rendering/scaling_3d/scale" , PROPERTY_HINT_RANGE, "0.25,2.0,0.01" ), 1.0); |
| 2964 | GLOBAL_DEF(PropertyInfo(Variant::FLOAT, "rendering/scaling_3d/fsr_sharpness" , PROPERTY_HINT_RANGE, "0,2,0.1" ), 0.2f); |
| 2965 | GLOBAL_DEF(PropertyInfo(Variant::FLOAT, "rendering/textures/default_filters/texture_mipmap_bias" , PROPERTY_HINT_RANGE, "-2,2,0.001" ), 0.0f); |
| 2966 | |
| 2967 | GLOBAL_DEF(PropertyInfo(Variant::INT, "rendering/textures/decals/filter" , PROPERTY_HINT_ENUM, "Nearest (Fast),Linear (Fast),Nearest Mipmap (Fast),Linear Mipmap (Fast),Nearest Mipmap Anisotropic (Average),Linear Mipmap Anisotropic (Average)" ), DECAL_FILTER_LINEAR_MIPMAPS); |
| 2968 | GLOBAL_DEF(PropertyInfo(Variant::INT, "rendering/textures/light_projectors/filter" , PROPERTY_HINT_ENUM, "Nearest (Fast),Linear (Fast),Nearest Mipmap (Fast),Linear Mipmap (Fast),Nearest Mipmap Anisotropic (Average),Linear Mipmap Anisotropic (Average)" ), LIGHT_PROJECTOR_FILTER_LINEAR_MIPMAPS); |
| 2969 | |
| 2970 | GLOBAL_DEF_RST("rendering/occlusion_culling/occlusion_rays_per_thread" , 512); |
| 2971 | |
| 2972 | GLOBAL_DEF(PropertyInfo(Variant::INT, "rendering/environment/glow/upscale_mode" , PROPERTY_HINT_ENUM, "Linear (Fast),Bicubic (Slow)" ), 1); |
| 2973 | GLOBAL_DEF("rendering/environment/glow/upscale_mode.mobile" , 0); |
| 2974 | |
| 2975 | GLOBAL_DEF(PropertyInfo(Variant::INT, "rendering/environment/screen_space_reflection/roughness_quality" , PROPERTY_HINT_ENUM, "Disabled (Fastest),Low (Fast),Medium (Average),High (Slow)" ), 1); |
| 2976 | |
| 2977 | GLOBAL_DEF(PropertyInfo(Variant::INT, "rendering/environment/subsurface_scattering/subsurface_scattering_quality" , PROPERTY_HINT_ENUM, "Disabled (Fastest),Low (Fast),Medium (Average),High (Slow)" ), 1); |
| 2978 | GLOBAL_DEF(PropertyInfo(Variant::FLOAT, "rendering/environment/subsurface_scattering/subsurface_scattering_scale" , PROPERTY_HINT_RANGE, "0.001,1,0.001" ), 0.05); |
| 2979 | GLOBAL_DEF(PropertyInfo(Variant::FLOAT, "rendering/environment/subsurface_scattering/subsurface_scattering_depth_scale" , PROPERTY_HINT_RANGE, "0.001,1,0.001" ), 0.01); |
| 2980 | |
| 2981 | GLOBAL_DEF("rendering/limits/global_shader_variables/buffer_size" , 65536); |
| 2982 | |
| 2983 | GLOBAL_DEF(PropertyInfo(Variant::FLOAT, "rendering/lightmapping/probe_capture/update_speed" , PROPERTY_HINT_RANGE, "0.001,256,0.001" ), 15); |
| 2984 | |
| 2985 | GLOBAL_DEF(PropertyInfo(Variant::INT, "rendering/global_illumination/sdfgi/probe_ray_count" , PROPERTY_HINT_ENUM, "8 (Fastest),16,32,64,96,128 (Slowest)" ), 1); |
| 2986 | GLOBAL_DEF(PropertyInfo(Variant::INT, "rendering/global_illumination/sdfgi/frames_to_converge" , PROPERTY_HINT_ENUM, "5 (Less Latency but Lower Quality),10,15,20,25,30 (More Latency but Higher Quality)" ), 5); |
| 2987 | GLOBAL_DEF(PropertyInfo(Variant::INT, "rendering/global_illumination/sdfgi/frames_to_update_lights" , PROPERTY_HINT_ENUM, "1 (Slower),2,4,8,16 (Faster)" ), 2); |
| 2988 | |
| 2989 | GLOBAL_DEF(PropertyInfo(Variant::INT, "rendering/environment/volumetric_fog/volume_size" , PROPERTY_HINT_RANGE, "16,512,1" ), 64); |
| 2990 | GLOBAL_DEF(PropertyInfo(Variant::INT, "rendering/environment/volumetric_fog/volume_depth" , PROPERTY_HINT_RANGE, "16,512,1" ), 64); |
| 2991 | GLOBAL_DEF(PropertyInfo(Variant::INT, "rendering/environment/volumetric_fog/use_filter" , PROPERTY_HINT_ENUM, "No (Faster),Yes (Higher Quality)" ), 1); |
| 2992 | |
| 2993 | GLOBAL_DEF_RST(PropertyInfo(Variant::INT, "rendering/limits/spatial_indexer/update_iterations_per_frame" , PROPERTY_HINT_RANGE, "0,1024,1" ), 10); |
| 2994 | GLOBAL_DEF_RST(PropertyInfo(Variant::INT, "rendering/limits/spatial_indexer/threaded_cull_minimum_instances" , PROPERTY_HINT_RANGE, "32,65536,1" ), 1000); |
| 2995 | GLOBAL_DEF_RST(PropertyInfo(Variant::INT, "rendering/limits/forward_renderer/threaded_render_minimum_instances" , PROPERTY_HINT_RANGE, "32,65536,1" ), 500); |
| 2996 | |
| 2997 | GLOBAL_DEF(PropertyInfo(Variant::FLOAT, "rendering/limits/cluster_builder/max_clustered_elements" , PROPERTY_HINT_RANGE, "32,8192,1" ), 512); |
| 2998 | |
| 2999 | // OpenGL limits |
| 3000 | GLOBAL_DEF_RST(PropertyInfo(Variant::INT, "rendering/limits/opengl/max_renderable_elements" , PROPERTY_HINT_RANGE, "1024,65536,1" ), 65536); |
| 3001 | GLOBAL_DEF_RST(PropertyInfo(Variant::INT, "rendering/limits/opengl/max_renderable_lights" , PROPERTY_HINT_RANGE, "2,256,1" ), 32); |
| 3002 | GLOBAL_DEF_RST(PropertyInfo(Variant::INT, "rendering/limits/opengl/max_lights_per_object" , PROPERTY_HINT_RANGE, "2,1024,1" ), 8); |
| 3003 | |
| 3004 | GLOBAL_DEF_RST_BASIC("xr/shaders/enabled" , false); |
| 3005 | |
| 3006 | GLOBAL_DEF("debug/shader_language/warnings/enable" , true); |
| 3007 | GLOBAL_DEF("debug/shader_language/warnings/treat_warnings_as_errors" , false); |
| 3008 | |
| 3009 | #ifdef DEBUG_ENABLED |
| 3010 | for (int i = 0; i < (int)ShaderWarning::WARNING_MAX; i++) { |
| 3011 | GLOBAL_DEF("debug/shader_language/warnings/" + ShaderWarning::get_name_from_code((ShaderWarning::Code)i).to_lower(), true); |
| 3012 | } |
| 3013 | #endif |
| 3014 | } |
| 3015 | |
| 3016 | RenderingServer::~RenderingServer() { |
| 3017 | singleton = nullptr; |
| 3018 | } |
| 3019 | |