diff options
Diffstat (limited to 'servers/visual')
-rw-r--r-- | servers/visual/rasterizer.h | 1 | ||||
-rw-r--r-- | servers/visual/shader_language.cpp | 4 | ||||
-rw-r--r-- | servers/visual/shader_types.cpp | 3 | ||||
-rw-r--r-- | servers/visual/visual_server_raster.h | 1 | ||||
-rw-r--r-- | servers/visual/visual_server_scene.cpp | 42 | ||||
-rw-r--r-- | servers/visual/visual_server_wrap_mt.h | 1 |
6 files changed, 28 insertions, 24 deletions
diff --git a/servers/visual/rasterizer.h b/servers/visual/rasterizer.h index 9e4acac25d..187a0b180b 100644 --- a/servers/visual/rasterizer.h +++ b/servers/visual/rasterizer.h @@ -213,6 +213,7 @@ public: virtual RID material_create() = 0; + virtual void material_set_render_priority(RID p_material, int priority) = 0; virtual void material_set_shader(RID p_shader_material, RID p_shader) = 0; virtual RID material_get_shader(RID p_shader_material) const = 0; diff --git a/servers/visual/shader_language.cpp b/servers/visual/shader_language.cpp index d17cf472b3..c7b537c8ea 100644 --- a/servers/visual/shader_language.cpp +++ b/servers/visual/shader_language.cpp @@ -2586,7 +2586,7 @@ ShaderLanguage::Node *ShaderLanguage::_parse_expression(BlockNode *p_block, cons } bool index_valid = false; - DataType member_type; + DataType member_type = TYPE_VOID; switch (expr->get_datatype()) { case TYPE_BVEC2: @@ -3349,7 +3349,7 @@ Error ShaderLanguage::_parse_shader(const Map<StringName, FunctionInfo> &p_funct Token tk = _get_token(); if (tk.type != TK_SHADER_TYPE) { - _set_error("Expected 'shader_type' at the begining of shader."); + _set_error("Expected 'shader_type' at the beginning of shader."); return ERR_PARSE_ERROR; } diff --git a/servers/visual/shader_types.cpp b/servers/visual/shader_types.cpp index d8d1b1c1b1..ef0d063f83 100644 --- a/servers/visual/shader_types.cpp +++ b/servers/visual/shader_types.cpp @@ -128,12 +128,13 @@ ShaderTypes::ShaderTypes() { shader_modes[VS::SHADER_SPATIAL].modes.insert("depth_draw_never"); shader_modes[VS::SHADER_SPATIAL].modes.insert("depth_draw_alpha_prepass"); + shader_modes[VS::SHADER_SPATIAL].modes.insert("depth_test_disable"); + shader_modes[VS::SHADER_SPATIAL].modes.insert("cull_front"); shader_modes[VS::SHADER_SPATIAL].modes.insert("cull_back"); shader_modes[VS::SHADER_SPATIAL].modes.insert("cull_disabled"); shader_modes[VS::SHADER_SPATIAL].modes.insert("unshaded"); - shader_modes[VS::SHADER_SPATIAL].modes.insert("ontop"); shader_modes[VS::SHADER_SPATIAL].modes.insert("diffuse_lambert"); shader_modes[VS::SHADER_SPATIAL].modes.insert("diffuse_half_lambert"); diff --git a/servers/visual/visual_server_raster.h b/servers/visual/visual_server_raster.h index 774b692a22..3953bc5f48 100644 --- a/servers/visual/visual_server_raster.h +++ b/servers/visual/visual_server_raster.h @@ -690,6 +690,7 @@ public: BIND3(material_set_param, RID, const StringName &, const Variant &) BIND2RC(Variant, material_get_param, RID, const StringName &) + BIND2(material_set_render_priority, RID, int) BIND2(material_set_line_width, RID, float) BIND2(material_set_next_pass, RID, RID) diff --git a/servers/visual/visual_server_scene.cpp b/servers/visual/visual_server_scene.cpp index cd68c14de8..0d70b7fc0e 100644 --- a/servers/visual/visual_server_scene.cpp +++ b/servers/visual/visual_server_scene.cpp @@ -948,13 +948,13 @@ void VisualServerScene::_light_instance_update_shadow(Instance *p_instance, cons Vector3 z_vec = transform.basis.get_axis(Vector3::AXIS_Z).normalized(); //z_vec points agsint the camera, like in default opengl - float x_min, x_max; - float y_min, y_max; - float z_min, z_max; + float x_min = 0.f, x_max = 0.f; + float y_min = 0.f, y_max = 0.f; + float z_min = 0.f, z_max = 0.f; - float x_min_cam, x_max_cam; - float y_min_cam, y_max_cam; - float z_min_cam, z_max_cam; + float x_min_cam = 0.f, x_max_cam = 0.f; + float y_min_cam = 0.f, y_max_cam = 0.f; + float z_min_cam = 0.f, z_max_cam = 0.f; float bias_scale = 1.0; @@ -1434,7 +1434,7 @@ void VisualServerScene::_render_scene(const Transform p_cam_transform, const Cam } ins->depth = near_plane.distance_to(ins->transform.origin); - ins->depth_layer = CLAMP(int(ins->depth * 8 / z_far), 0, 7); + ins->depth_layer = CLAMP(int(ins->depth * 16 / z_far), 0, 15); } if (!keep) { @@ -1503,7 +1503,7 @@ void VisualServerScene::_render_scene(const Transform p_cam_transform, const Cam InstanceLightData *light = static_cast<InstanceLightData *>(ins->base_data); - float coverage; + float coverage = 0.f; { //compute coverage @@ -1687,7 +1687,7 @@ bool VisualServerScene::_render_reflection_probe_step(Instance *p_instance, int void VisualServerScene::_gi_probe_fill_local_data(int p_idx, int p_level, int p_x, int p_y, int p_z, const GIProbeDataCell *p_cell, const GIProbeDataHeader *p_header, InstanceGIProbeData::LocalData *p_local_data, Vector<uint32_t> *prev_cell) { - if (p_level == p_header->cell_subdiv - 1) { + if ((uint32_t)p_level == p_header->cell_subdiv - 1) { Vector3 emission; emission.x = (p_cell[p_idx].emission >> 24) / 255.0; @@ -1798,9 +1798,9 @@ void VisualServerScene::_setup_gi_probe(Instance *p_instance) { } for (int i = 0; i < (int)header->cell_subdiv; i++) { - uint32_t x = header->width >> i; - uint32_t y = header->height >> i; - uint32_t z = header->depth >> i; + int x = header->width >> i; + int y = header->height >> i; + int z = header->depth >> i; //create and clear mipmap PoolVector<uint8_t> mipmap; @@ -1896,7 +1896,7 @@ void VisualServerScene::_setup_gi_probe(Instance *p_instance) { uint8_t alpha_block[4][4] = { { 0, 0, 0, 0 }, { 0, 0, 0, 0 }, { 0, 0, 0, 0 }, { 0, 0, 0, 0 } }; - for (int j = 0; j < k.source_count; j++) { + for (uint32_t j = 0; j < k.source_count; j++) { int alpha = (cells[k.sources[j]].level_alpha >> 8) & 0xFF; if (alpha < min_alpha) @@ -2389,7 +2389,7 @@ void VisualServerScene::_bake_gi_probe(Instance *p_gi_probe) { Vector3 colors[16]; - for (int j = 0; j < b.source_count; j++) { + for (uint32_t j = 0; j < b.source_count; j++) { colors[j].x = (local_data[b.sources[j]].energy[0] / float(probe_data->dynamic.bake_dynamic_range)) / 1024.0; colors[j].y = (local_data[b.sources[j]].energy[1] / float(probe_data->dynamic.bake_dynamic_range)) / 1024.0; @@ -2403,8 +2403,8 @@ void VisualServerScene::_bake_gi_probe(Instance *p_gi_probe) { if (b.source_count == 16) { //all cells are used so, find minmax between them int further_apart[2] = { 0, 0 }; - for (int j = 0; j < b.source_count; j++) { - for (int k = j + 1; k < b.source_count; k++) { + for (uint32_t j = 0; j < b.source_count; j++) { + for (uint32_t k = j + 1; k < b.source_count; k++) { float d = colors[j].distance_squared_to(colors[k]); if (d > distance) { distance = d; @@ -2424,12 +2424,12 @@ void VisualServerScene::_bake_gi_probe(Instance *p_gi_probe) { //average all colors first Vector3 average; - for (int j = 0; j < b.source_count; j++) { + for (uint32_t j = 0; j < b.source_count; j++) { average += colors[j]; } average.normalize(); //find max distance in normal from average - for (int j = 0; j < b.source_count; j++) { + for (uint32_t j = 0; j < b.source_count; j++) { float d = average.dot(colors[j]); distance = MAX(d, distance); } @@ -2459,7 +2459,7 @@ void VisualServerScene::_bake_gi_probe(Instance *p_gi_probe) { Vector3 dir = (to - from).normalized(); - for (int j = 0; j < b.source_count; j++) { + for (uint32_t j = 0; j < b.source_count; j++) { float d = (colors[j] - from).dot(dir) / distance; indices[j] = int(d * 3 + 0.5); @@ -2469,7 +2469,7 @@ void VisualServerScene::_bake_gi_probe(Instance *p_gi_probe) { indices[j] = index_swap[CLAMP(indices[j], 0, 3)]; } } else { - for (int j = 0; j < b.source_count; j++) { + for (uint32_t j = 0; j < b.source_count; j++) { indices[j] = 0; } } @@ -2478,7 +2478,7 @@ void VisualServerScene::_bake_gi_probe(Instance *p_gi_probe) { uint32_t index_block[16] = { 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 }; - for (int j = 0; j < b.source_count; j++) { + for (uint32_t j = 0; j < b.source_count; j++) { int x = local_data[b.sources[j]].pos[0] % 4; int y = local_data[b.sources[j]].pos[1] % 4; diff --git a/servers/visual/visual_server_wrap_mt.h b/servers/visual/visual_server_wrap_mt.h index 7143178b04..f24049be92 100644 --- a/servers/visual/visual_server_wrap_mt.h +++ b/servers/visual/visual_server_wrap_mt.h @@ -128,6 +128,7 @@ public: FUNC3(material_set_param, RID, const StringName &, const Variant &) FUNC2RC(Variant, material_get_param, RID, const StringName &) + FUNC2(material_set_render_priority, RID, int) FUNC2(material_set_line_width, RID, float) FUNC2(material_set_next_pass, RID, RID) |