diff options
-rw-r--r-- | doc/classes/EditorResourcePreview.xml | 4 | ||||
-rw-r--r-- | doc/classes/ImageTexture.xml | 2 | ||||
-rw-r--r-- | drivers/gles3/rasterizer_scene_gles3.cpp | 30 | ||||
-rw-r--r-- | drivers/gles3/rasterizer_scene_gles3.h | 8 | ||||
-rw-r--r-- | drivers/gles3/shader_compiler_gles3.cpp | 4 | ||||
-rw-r--r-- | drivers/gles3/shaders/canvas.glsl | 12 | ||||
-rw-r--r-- | drivers/gles3/shaders/scene.glsl | 7 | ||||
-rw-r--r-- | editor/editor_help.cpp | 29 | ||||
-rw-r--r-- | editor/editor_node.cpp | 4 | ||||
-rw-r--r-- | editor/editor_themes.cpp | 16 | ||||
-rw-r--r-- | editor/import/resource_importer_obj.cpp | 172 | ||||
-rw-r--r-- | editor/import/resource_importer_obj.h | 22 | ||||
-rw-r--r-- | main/performance.cpp | 2 | ||||
-rw-r--r-- | modules/gdscript/gd_editor.cpp | 3 | ||||
-rw-r--r-- | scene/3d/immediate_geometry.h | 2 | ||||
-rw-r--r-- | scene/resources/environment.cpp | 21 | ||||
-rw-r--r-- | scene/resources/environment.h | 6 | ||||
-rw-r--r-- | servers/visual/rasterizer.h | 2 | ||||
-rw-r--r-- | servers/visual/shader_types.cpp | 15 | ||||
-rw-r--r-- | servers/visual/visual_server_raster.h | 2 | ||||
-rw-r--r-- | servers/visual/visual_server_wrap_mt.h | 2 | ||||
-rw-r--r-- | servers/visual_server.h | 4 |
22 files changed, 225 insertions, 144 deletions
diff --git a/doc/classes/EditorResourcePreview.xml b/doc/classes/EditorResourcePreview.xml index e530557a23..acf36b6a08 100644 --- a/doc/classes/EditorResourcePreview.xml +++ b/doc/classes/EditorResourcePreview.xml @@ -41,7 +41,7 @@ <argument index="3" name="userdata" type="Variant"> </argument> <description> - Queue a resource being edited for preview (using an instance). Once the preview is ready, your receiver.receiver_func will be called either containing the preview texture or an empty texure (if no preview was possible). Callback must have the format: (path,texture,userdata). Userdata can be anything. + Queue a resource being edited for preview (using an instance). Once the preview is ready, your receiver.receiver_func will be called either containing the preview texture or an empty texture (if no preview was possible). Callback must have the format: (path,texture,userdata). Userdata can be anything. </description> </method> <method name="queue_resource_preview"> @@ -56,7 +56,7 @@ <argument index="3" name="userdata" type="Variant"> </argument> <description> - Queue a resource file for preview (using a path). Once the preview is ready, your receiver.receiver_func will be called either containing the preview texture or an empty texure (if no preview was possible). Callback must have the format: (path,texture,userdata). Userdata can be anything. + Queue a resource file for preview (using a path). Once the preview is ready, your receiver.receiver_func will be called either containing the preview texture or an empty texture (if no preview was possible). Callback must have the format: (path,texture,userdata). Userdata can be anything. </description> </method> <method name="remove_preview_generator"> diff --git a/doc/classes/ImageTexture.xml b/doc/classes/ImageTexture.xml index 2b74a15fd5..4fcdf684c0 100644 --- a/doc/classes/ImageTexture.xml +++ b/doc/classes/ImageTexture.xml @@ -66,7 +66,7 @@ <argument index="0" name="path" type="String"> </argument> <description> - Load an [ImageTexure]. + Load an [ImageTexture]. </description> </method> <method name="set_data"> diff --git a/drivers/gles3/rasterizer_scene_gles3.cpp b/drivers/gles3/rasterizer_scene_gles3.cpp index 98a9211d0c..ecbd70496c 100644 --- a/drivers/gles3/rasterizer_scene_gles3.cpp +++ b/drivers/gles3/rasterizer_scene_gles3.cpp @@ -799,12 +799,12 @@ void RasterizerSceneGLES3::environment_set_sky(RID p_env, RID p_sky) { env->sky = p_sky; } -void RasterizerSceneGLES3::environment_set_sky_scale(RID p_env, float p_scale) { +void RasterizerSceneGLES3::environment_set_sky_custom_fov(RID p_env, float p_scale) { Environment *env = environment_owner.getornull(p_env); ERR_FAIL_COND(!env); - env->sky_scale = p_scale; + env->sky_custom_fov = p_scale; } void RasterizerSceneGLES3::environment_set_bg_color(RID p_env, const Color &p_color) { @@ -2319,7 +2319,7 @@ void RasterizerSceneGLES3::_add_geometry_with_material(RasterizerStorageGLES3::G } } -void RasterizerSceneGLES3::_draw_sky(RasterizerStorageGLES3::Sky *p_sky, const CameraMatrix &p_projection, const Transform &p_transform, bool p_vflip, float p_scale, float p_energy) { +void RasterizerSceneGLES3::_draw_sky(RasterizerStorageGLES3::Sky *p_sky, const CameraMatrix &p_projection, const Transform &p_transform, bool p_vflip, float p_custom_fov, float p_energy) { if (!p_sky) return; @@ -2365,16 +2365,28 @@ void RasterizerSceneGLES3::_draw_sky(RasterizerStorageGLES3::Sky *p_sky, const C //sky uv vectors float vw, vh, zn; - p_projection.get_viewport_size(vw, vh); - zn = p_projection.get_z_near(); + CameraMatrix camera; + + if (p_custom_fov) { + + float near = p_projection.get_z_near(); + float far = p_projection.get_z_far(); + float aspect = p_projection.get_aspect(); + + camera.set_perspective(p_custom_fov, aspect, near, far); - float scale = p_scale; + } else { + camera = p_projection; + } + + camera.get_viewport_size(vw, vh); + zn = p_projection.get_z_near(); for (int i = 0; i < 4; i++) { Vector3 uv = vertices[i * 2 + 1]; - uv.x = (uv.x * 2.0 - 1.0) * vw * scale; - uv.y = -(uv.y * 2.0 - 1.0) * vh * scale; + uv.x = (uv.x * 2.0 - 1.0) * vw; + uv.y = -(uv.y * 2.0 - 1.0) * vh; uv.z = -zn; vertices[i * 2 + 1] = p_transform.basis.xform(uv).normalized(); vertices[i * 2 + 1].z = -vertices[i * 2 + 1].z; @@ -4258,7 +4270,7 @@ void RasterizerSceneGLES3::render_scene(const Transform &p_cam_transform, const glBindFramebuffer(GL_FRAMEBUFFER,storage->frame.current_rt->buffers.fbo); //switch to alpha fbo for sky, only diffuse/ambient matters */ - _draw_sky(sky, p_cam_projection, p_cam_transform, false, env->sky_scale, env->bg_energy); + _draw_sky(sky, p_cam_projection, p_cam_transform, false, env->sky_custom_fov, env->bg_energy); } //_render_list_forward(&alpha_render_list,camera_transform,camera_transform_inverse,camera_projection,false,fragment_lighting,true); diff --git a/drivers/gles3/rasterizer_scene_gles3.h b/drivers/gles3/rasterizer_scene_gles3.h index 04cb3597da..28a5cef0ee 100644 --- a/drivers/gles3/rasterizer_scene_gles3.h +++ b/drivers/gles3/rasterizer_scene_gles3.h @@ -352,7 +352,7 @@ public: VS::EnvironmentBG bg_mode; RID sky; - float sky_scale; + float sky_custom_fov; Color bg_color; float bg_energy; @@ -435,7 +435,7 @@ public: Environment() { bg_mode = VS::ENV_BG_CLEAR_COLOR; - sky_scale = 1.0; + sky_custom_fov = 0.0; bg_energy = 1.0; sky_ambient = 0; ambient_energy = 1.0; @@ -520,7 +520,7 @@ public: virtual void environment_set_background(RID p_env, VS::EnvironmentBG p_bg); virtual void environment_set_sky(RID p_env, RID p_sky); - virtual void environment_set_sky_scale(RID p_env, float p_scale); + virtual void environment_set_sky_custom_fov(RID p_env, float p_scale); virtual void environment_set_bg_color(RID p_env, const Color &p_color); virtual void environment_set_bg_energy(RID p_env, float p_energy); virtual void environment_set_canvas_max_layer(RID p_env, int p_max_layer); @@ -811,7 +811,7 @@ public: _FORCE_INLINE_ void _add_geometry_with_material(RasterizerStorageGLES3::Geometry *p_geometry, InstanceBase *p_instance, RasterizerStorageGLES3::GeometryOwner *p_owner, RasterizerStorageGLES3::Material *p_material, bool p_depth_pass); - void _draw_sky(RasterizerStorageGLES3::Sky *p_sky, const CameraMatrix &p_projection, const Transform &p_transform, bool p_vflip, float p_scale, float p_energy); + void _draw_sky(RasterizerStorageGLES3::Sky *p_sky, const CameraMatrix &p_projection, const Transform &p_transform, bool p_vflip, float p_custom_fov, float p_energy); void _setup_environment(Environment *env, const CameraMatrix &p_cam_projection, const Transform &p_cam_transform); void _setup_directional_light(int p_index, const Transform &p_camera_inverse_transform, bool p_use_shadows); diff --git a/drivers/gles3/shader_compiler_gles3.cpp b/drivers/gles3/shader_compiler_gles3.cpp index b173958664..91159e3381 100644 --- a/drivers/gles3/shader_compiler_gles3.cpp +++ b/drivers/gles3/shader_compiler_gles3.cpp @@ -700,9 +700,7 @@ ShaderCompilerGLES3::ShaderCompilerGLES3() { /** CANVAS ITEM SHADER **/ - actions[VS::SHADER_CANVAS_ITEM].renames["SRC_VERTEX"] = "vertex"; actions[VS::SHADER_CANVAS_ITEM].renames["VERTEX"] = "outvec.xy"; - actions[VS::SHADER_CANVAS_ITEM].renames["VERTEX_COLOR"] = "vertex_color"; actions[VS::SHADER_CANVAS_ITEM].renames["UV"] = "uv_interp"; actions[VS::SHADER_CANVAS_ITEM].renames["POINT_SIZE"] = "gl_PointSize"; @@ -711,6 +709,7 @@ ShaderCompilerGLES3::ShaderCompilerGLES3() { actions[VS::SHADER_CANVAS_ITEM].renames["EXTRA_MATRIX"] == "extra_matrix"; actions[VS::SHADER_CANVAS_ITEM].renames["TIME"] = "time"; actions[VS::SHADER_CANVAS_ITEM].renames["AT_LIGHT_PASS"] = "at_light_pass"; + actions[VS::SHADER_CANVAS_ITEM].renames["INSTANCE_CUSTOM"] = "instance_custom"; actions[VS::SHADER_CANVAS_ITEM].renames["COLOR"] = "color"; actions[VS::SHADER_CANVAS_ITEM].renames["NORMAL"] = "normal"; @@ -720,6 +719,7 @@ ShaderCompilerGLES3::ShaderCompilerGLES3() { actions[VS::SHADER_CANVAS_ITEM].renames["COLOR"] = "color"; actions[VS::SHADER_CANVAS_ITEM].renames["TEXTURE"] = "color_texture"; actions[VS::SHADER_CANVAS_ITEM].renames["TEXTURE_PIXEL_SIZE"] = "color_texpixel_size"; + actions[VS::SHADER_CANVAS_ITEM].renames["NORMAL_TEXTURE"] = "normal_texture"; actions[VS::SHADER_CANVAS_ITEM].renames["SCREEN_UV"] = "screen_uv"; actions[VS::SHADER_CANVAS_ITEM].renames["SCREEN_TEXTURE"] = "screen_texture"; actions[VS::SHADER_CANVAS_ITEM].renames["SCREEN_PIXEL_SIZE"] = "screen_pixel_size"; diff --git a/drivers/gles3/shaders/canvas.glsl b/drivers/gles3/shaders/canvas.glsl index bf8eaf601d..731d6968ce 100644 --- a/drivers/gles3/shaders/canvas.glsl +++ b/drivers/gles3/shaders/canvas.glsl @@ -105,13 +105,16 @@ VERTEX_SHADER_GLOBALS void main() { - vec4 vertex_color = color_attrib; + vec4 color = color_attrib; #ifdef USE_INSTANCING mat4 extra_matrix2 = extra_matrix * transpose(mat4(instance_xform0,instance_xform1,instance_xform2,vec4(0.0,0.0,0.0,1.0))); - vertex_color*=instance_color; + color*=instance_color; + vec4 instance_custom = instance_custom_data; + #else mat4 extra_matrix2 = extra_matrix; + vec4 instance_custom = vec4(0.0); #endif #ifdef USE_TEXTURE_RECT @@ -135,7 +138,7 @@ void main() { //compute h and v frames and adjust UV interp for animation int total_frames = h_frames * v_frames; - int frame = min(int(float(total_frames) *instance_custom_data.z),total_frames-1); + int frame = min(int(float(total_frames) *instance_custom.z),total_frames-1); float frame_w = 1.0/float(h_frames); float frame_h = 1.0/float(v_frames); uv_interp.x = uv_interp.x * frame_w + frame_w * float(frame % h_frames); @@ -146,7 +149,6 @@ void main() { #define extra_matrix extra_matrix2 { - vec2 src_vtx=outvec.xy; VERTEX_SHADER_CODE @@ -165,7 +167,7 @@ VERTEX_SHADER_CODE #undef extra_matrix - color_interp = vertex_color; + color_interp = color; #ifdef USE_PIXEL_SNAP diff --git a/drivers/gles3/shaders/scene.glsl b/drivers/gles3/shaders/scene.glsl index b6fb69a2aa..5c7cfecf3e 100644 --- a/drivers/gles3/shaders/scene.glsl +++ b/drivers/gles3/shaders/scene.glsl @@ -589,7 +589,7 @@ vec3 textureDualParaboloid(sampler2DArray p_tex, vec3 p_vec,float p_roughness) { norm.xy=norm.xy * vec2(0.5,0.25) + vec2(0.5,0.25); // we need to lie the derivatives (normg) and assume that DP side is always the same - // to get proper texure filtering + // to get proper texture filtering vec2 normg=norm.xy; if (norm.z>0.0) { norm.y=0.5-norm.y+0.5; @@ -920,6 +920,7 @@ LIGHT_SHADER_CODE #elif defined(DIFFUSE_OREN_NAYAR) { + // see http://mimosa-pudica.net/improved-oren-nayar.html float LdotV = dot(L, V); float NdotL = dot(L, N); float NdotV = dot(N, V); @@ -928,10 +929,10 @@ LIGHT_SHADER_CODE float t = mix(1.0, max(NdotL, NdotV), step(0.0, s)); float sigma2 = roughness * roughness; - vec3 A = 1.0 + sigma2 * (diffuse_color / (sigma2 + 0.13) + 0.5 / (sigma2 + 0.33)); + vec3 A = 1.0 + sigma2 * (- 0.5 / (sigma2 + 0.33) + 0.17*diffuse_color / (sigma2 + 0.13) ); float B = 0.45 * sigma2 / (sigma2 + 0.09); - light_amount = max(0.0, NdotL) * (A + vec3(B) * s / t) / M_PI; + light_amount = diffuse_color * dotNL * (A + vec3(B) * s / t) / M_PI; } #elif defined(DIFFUSE_TOON) diff --git a/editor/editor_help.cpp b/editor/editor_help.cpp index f2452df9f0..cb94ea72d1 100644 --- a/editor/editor_help.cpp +++ b/editor/editor_help.cpp @@ -650,8 +650,8 @@ Error EditorHelp::_goto_desc(const String &p_class, int p_vscr) { // Colors const Color title_color = get_color("accent_color", "Editor"); - const Color text_color = get_color("font_color", "RichTextLabel"); - const Color highlight_color = get_color("highlight_color", "RichTextLabel"); + const Color text_color = get_color("default_color", "RichTextLabel"); + const Color headline_color = get_color("headline_color", "EditorHelp"); const Color base_type_color = title_color.linear_interpolate(text_color, 0.5); const Color comment_color = Color(text_color.r, text_color.g, text_color.b, 0.6); const Color symbol_color = comment_color; @@ -669,7 +669,7 @@ Error EditorHelp::_goto_desc(const String &p_class, int p_vscr) { class_desc->push_font(doc_title_font); class_desc->push_color(title_color); class_desc->add_text(TTR("Class:") + " "); - class_desc->push_color(highlight_color); + class_desc->push_color(headline_color); _add_text(p_class); class_desc->pop(); class_desc->pop(); @@ -812,7 +812,7 @@ Error EditorHelp::_goto_desc(const String &p_class, int p_vscr) { } class_desc->push_font(doc_code_font); - class_desc->push_color(highlight_color); + class_desc->push_color(headline_color); _add_text(cd.properties[i].name); if (describe) { @@ -883,7 +883,7 @@ Error EditorHelp::_goto_desc(const String &p_class, int p_vscr) { method_descr = true; class_desc->push_meta("@" + methods[i].name); } - class_desc->push_color(highlight_color); + class_desc->push_color(headline_color); _add_text(methods[i].name); class_desc->pop(); if (methods[i].description != "") @@ -969,7 +969,7 @@ Error EditorHelp::_goto_desc(const String &p_class, int p_vscr) { class_desc->push_cell(); class_desc->push_font(doc_code_font); - class_desc->push_color(highlight_color); + class_desc->push_color(headline_color); _add_text(cd.theme_properties[i].name); class_desc->pop(); class_desc->pop(); @@ -1015,7 +1015,7 @@ Error EditorHelp::_goto_desc(const String &p_class, int p_vscr) { class_desc->push_font(doc_code_font); // monofont //_add_type("void"); //class_desc->add_text(" "); - class_desc->push_color(highlight_color); + class_desc->push_color(headline_color); _add_text(cd.signals[i].name); class_desc->pop(); class_desc->push_color(symbol_color); @@ -1102,7 +1102,7 @@ Error EditorHelp::_goto_desc(const String &p_class, int p_vscr) { e = e.get_slice(".", 1); } - class_desc->push_color(highlight_color); + class_desc->push_color(headline_color); class_desc->add_text(e); class_desc->pop(); class_desc->pop(); @@ -1117,7 +1117,7 @@ Error EditorHelp::_goto_desc(const String &p_class, int p_vscr) { for (int i = 0; i < enum_list.size(); i++) { class_desc->push_font(doc_code_font); - class_desc->push_color(highlight_color); + class_desc->push_color(headline_color); _add_text(enum_list[i].name); class_desc->pop(); class_desc->push_color(symbol_color); @@ -1165,7 +1165,7 @@ Error EditorHelp::_goto_desc(const String &p_class, int p_vscr) { constant_line[constants[i].name] = class_desc->get_line_count() - 2; class_desc->push_font(doc_code_font); - class_desc->push_color(highlight_color); + class_desc->push_color(headline_color); _add_text(constants[i].name); class_desc->pop(); class_desc->push_color(symbol_color); @@ -1235,7 +1235,7 @@ Error EditorHelp::_goto_desc(const String &p_class, int p_vscr) { _add_type(cd.properties[i].type, cd.properties[i].enumeration); class_desc->add_text(" "); - class_desc->push_color(highlight_color); + class_desc->push_color(headline_color); _add_text(cd.properties[i].name); class_desc->pop(); //color @@ -1324,7 +1324,7 @@ Error EditorHelp::_goto_desc(const String &p_class, int p_vscr) { _add_type(methods[i].return_type, methods[i].return_enum); class_desc->add_text(" "); - class_desc->push_color(highlight_color); + class_desc->push_color(headline_color); _add_text(methods[i].name); class_desc->pop(); class_desc->push_color(symbol_color); @@ -1456,7 +1456,7 @@ static void _add_text_to_rt(const String &p_bbcode, RichTextLabel *p_rt) { Ref<Font> doc_font = p_rt->get_font("doc", "EditorFonts"); Ref<Font> doc_code_font = p_rt->get_font("doc_source", "EditorFonts"); - Color font_color_hl = p_rt->get_color("highlight_color", "RichTextLabel"); + Color font_color_hl = p_rt->get_color("headline_color", "EditorHelp"); Color link_color = p_rt->get_color("accent_color", "Editor").linear_interpolate(font_color_hl, 0.8); String bbcode = p_bbcode.replace("\t", " ").replace("\r", " ").strip_edges(); @@ -1695,9 +1695,6 @@ void EditorHelp::_notification(int p_what) { //back->set_icon(get_icon("Back","EditorIcons")); _update_doc(); - class_desc->add_style_override("normal", class_desc->get_stylebox("code_normal", "RichTextLabel")); - class_desc->add_style_override("focus", class_desc->get_stylebox("code_focus", "RichTextLabel")); - } break; case EditorSettings::NOTIFICATION_EDITOR_SETTINGS_CHANGED: { diff --git a/editor/editor_node.cpp b/editor/editor_node.cpp index 49cb2a7e5a..c569f62b5b 100644 --- a/editor/editor_node.cpp +++ b/editor/editor_node.cpp @@ -4623,6 +4623,10 @@ EditorNode::EditorNode() { import_wav.instance(); ResourceFormatImporter::get_singleton()->add_importer(import_wav); + Ref<ResourceImporterOBJ> import_obj; + import_obj.instance(); + ResourceFormatImporter::get_singleton()->add_importer(import_obj); + Ref<ResourceImporterScene> import_scene; import_scene.instance(); ResourceFormatImporter::get_singleton()->add_importer(import_scene); diff --git a/editor/editor_themes.cpp b/editor/editor_themes.cpp index 63cffa125a..2eb5879cad 100644 --- a/editor/editor_themes.cpp +++ b/editor/editor_themes.cpp @@ -809,21 +809,11 @@ Ref<Theme> create_editor_theme(const Ref<Theme> p_theme) { theme->set_stylebox("grabber_area", "VSlider", make_flat_stylebox(contrast_color_1, default_margin_size / 2, 0, default_margin_size / 2, 0)); //RichTextLabel - Color rtl_combined_bg_color = dark_color_1.linear_interpolate(script_bg_color, script_bg_color.a); - Color rtl_mono_color = (rtl_combined_bg_color.r + rtl_combined_bg_color.g + rtl_combined_bg_color.b > 1.5) ? Color(0, 0, 0) : Color(1, 1, 1); - Color rtl_font_color = rtl_mono_color.linear_interpolate(rtl_combined_bg_color, 0.25); - theme->set_color("default_color", "RichTextLabel", rtl_font_color); + theme->set_color("default_color", "RichTextLabel", font_color); theme->set_stylebox("focus", "RichTextLabel", make_empty_stylebox()); theme->set_stylebox("normal", "RichTextLabel", style_tree_bg); - Ref<StyleBoxFlat> style_code = style_tree_bg->duplicate(); - style_code->set_bg_color(rtl_combined_bg_color); - theme->set_stylebox("code_normal", "RichTextLabel", style_code); - Ref<StyleBoxFlat> style_code_focus = style_tree_focus->duplicate(); - style_code_focus->set_bg_color(rtl_combined_bg_color); - theme->set_stylebox("code_focus", "RichTextLabel", style_code_focus); - - theme->set_color("font_color", "RichTextLabel", rtl_font_color); - theme->set_color("highlight_color", "RichTextLabel", rtl_mono_color); + + theme->set_color("headline_color", "EditorHelp", mono_color); // Panel theme->set_stylebox("panel", "Panel", make_flat_stylebox(dark_color_1, 6, 4, 6, 4)); diff --git a/editor/import/resource_importer_obj.cpp b/editor/import/resource_importer_obj.cpp index 6a936649c3..4541c77085 100644 --- a/editor/import/resource_importer_obj.cpp +++ b/editor/import/resource_importer_obj.cpp @@ -40,12 +40,8 @@ uint32_t EditorOBJImporter::get_import_flags() const { return IMPORT_SCENE; } -void EditorOBJImporter::get_extensions(List<String> *r_extensions) const { - r_extensions->push_back("obj"); -} - -Error EditorOBJImporter::_parse_material_library(const String &p_path, Map<String, Ref<SpatialMaterial> > &material_map, List<String> *r_missing_deps) { +static Error _parse_material_library(const String &p_path, Map<String, Ref<SpatialMaterial> > &material_map, List<String> *r_missing_deps) { FileAccessRef f = FileAccess::open(p_path, FileAccess::READ); ERR_FAIL_COND_V(!f, ERR_CANT_OPEN); @@ -134,7 +130,7 @@ Error EditorOBJImporter::_parse_material_library(const String &p_path, Map<Strin if (texture.is_valid()) { current->set_texture(SpatialMaterial::TEXTURE_ALBEDO, texture); - } else { + } else if (r_missing_deps) { r_missing_deps->push_back(path); } @@ -149,7 +145,7 @@ Error EditorOBJImporter::_parse_material_library(const String &p_path, Map<Strin if (texture.is_valid()) { current->set_texture(SpatialMaterial::TEXTURE_METALLIC, texture); - } else { + } else if (r_missing_deps) { r_missing_deps->push_back(path); } @@ -164,7 +160,7 @@ Error EditorOBJImporter::_parse_material_library(const String &p_path, Map<Strin if (texture.is_valid()) { current->set_texture(SpatialMaterial::TEXTURE_ROUGHNESS, texture); - } else { + } else if (r_missing_deps) { r_missing_deps->push_back(path); } } else if (l.begins_with("map_bump ")) { @@ -179,7 +175,7 @@ Error EditorOBJImporter::_parse_material_library(const String &p_path, Map<Strin if (texture.is_valid()) { current->set_feature(SpatialMaterial::FEATURE_NORMAL_MAPPING, true); current->set_texture(SpatialMaterial::TEXTURE_NORMAL, texture); - } else { + } else if (r_missing_deps) { r_missing_deps->push_back(path); } } else if (f->eof_reached()) { @@ -190,28 +186,16 @@ Error EditorOBJImporter::_parse_material_library(const String &p_path, Map<Strin return OK; } -Node *EditorOBJImporter::import_scene(const String &p_path, uint32_t p_flags, int p_bake_fps, List<String> *r_missing_deps, Error *r_err) { +static Error _parse_obj(const String &p_path, List<Ref<Mesh> > &r_meshes, bool p_single_mesh, bool p_generate_tangents, List<String> *r_missing_deps) { FileAccessRef f = FileAccess::open(p_path, FileAccess::READ); - if (r_err) { - *r_err = ERR_CANT_OPEN; - } - - ERR_FAIL_COND_V(!f, NULL); - - if (r_err) { - *r_err = OK; - } - - Spatial *scene = memnew(Spatial); + ERR_FAIL_COND_V(!f, ERR_CANT_OPEN); Ref<ArrayMesh> mesh; mesh.instance(); - Map<String, Ref<Material> > name_map; - - bool generate_tangents = p_flags & IMPORT_GENERATE_TANGENT_ARRAYS; + bool generate_tangents = p_generate_tangents; bool flip_faces = false; //bool flip_faces = p_options["force/flip_faces"]; //bool force_smooth = p_options["force/smooth_shading"]; @@ -239,7 +223,7 @@ Node *EditorOBJImporter::import_scene(const String &p_path, uint32_t p_flags, in if (l.begins_with("v ")) { //vertex Vector<String> v = l.split(" ", false); - ERR_FAIL_COND_V(v.size() < 4, NULL); + ERR_FAIL_COND_V(v.size() < 4, ERR_FILE_CORRUPT); Vector3 vtx; vtx.x = v[1].to_float(); vtx.y = v[2].to_float(); @@ -248,7 +232,7 @@ Node *EditorOBJImporter::import_scene(const String &p_path, uint32_t p_flags, in } else if (l.begins_with("vt ")) { //uv Vector<String> v = l.split(" ", false); - ERR_FAIL_COND_V(v.size() < 3, NULL); + ERR_FAIL_COND_V(v.size() < 3, ERR_FILE_CORRUPT); Vector2 uv; uv.x = v[1].to_float(); uv.y = 1.0 - v[2].to_float(); @@ -257,7 +241,7 @@ Node *EditorOBJImporter::import_scene(const String &p_path, uint32_t p_flags, in } else if (l.begins_with("vn ")) { //normal Vector<String> v = l.split(" ", false); - ERR_FAIL_COND_V(v.size() < 4, NULL); + ERR_FAIL_COND_V(v.size() < 4, ERR_FILE_CORRUPT); Vector3 nrm; nrm.x = v[1].to_float(); nrm.y = v[2].to_float(); @@ -267,19 +251,19 @@ Node *EditorOBJImporter::import_scene(const String &p_path, uint32_t p_flags, in //vertex Vector<String> v = l.split(" ", false); - ERR_FAIL_COND_V(v.size() < 4, NULL); + ERR_FAIL_COND_V(v.size() < 4, ERR_FILE_CORRUPT); //not very fast, could be sped up Vector<String> face[3]; face[0] = v[1].split("/"); face[1] = v[2].split("/"); - ERR_FAIL_COND_V(face[0].size() == 0, NULL); - ERR_FAIL_COND_V(face[0].size() != face[1].size(), NULL); + ERR_FAIL_COND_V(face[0].size() == 0, ERR_FILE_CORRUPT); + ERR_FAIL_COND_V(face[0].size() != face[1].size(), ERR_FILE_CORRUPT); for (int i = 2; i < v.size() - 1; i++) { face[2] = v[i + 1].split("/"); - ERR_FAIL_COND_V(face[0].size() != face[2].size(), NULL); + ERR_FAIL_COND_V(face[0].size() != face[2].size(), ERR_FILE_CORRUPT); for (int j = 0; j < 3; j++) { int idx = j; @@ -292,7 +276,7 @@ Node *EditorOBJImporter::import_scene(const String &p_path, uint32_t p_flags, in int norm = face[idx][2].to_int() - 1; if (norm < 0) norm += normals.size() + 1; - ERR_FAIL_INDEX_V(norm, normals.size(), NULL); + ERR_FAIL_INDEX_V(norm, normals.size(), ERR_FILE_CORRUPT); surf_tool->add_normal(normals[norm]); } @@ -300,14 +284,14 @@ Node *EditorOBJImporter::import_scene(const String &p_path, uint32_t p_flags, in int uv = face[idx][1].to_int() - 1; if (uv < 0) uv += uvs.size() + 1; - ERR_FAIL_INDEX_V(uv, uvs.size(), NULL); + ERR_FAIL_INDEX_V(uv, uvs.size(), ERR_FILE_CORRUPT); surf_tool->add_uv(uvs[uv]); } int vtx = face[idx][0].to_int() - 1; if (vtx < 0) vtx += vertices.size() + 1; - ERR_FAIL_INDEX_V(vtx, vertices.size(), NULL); + ERR_FAIL_INDEX_V(vtx, vertices.size(), ERR_FILE_CORRUPT); Vector3 vertex = vertices[vtx]; //if (weld_vertices) @@ -359,16 +343,13 @@ Node *EditorOBJImporter::import_scene(const String &p_path, uint32_t p_flags, in if (l.begins_with("o ") || f->eof_reached()) { - MeshInstance *mi = memnew(MeshInstance); - mi->set_name(name); - mi->set_mesh(mesh); - - scene->add_child(mi); - mi->set_owner(scene); - - mesh.instance(); - current_group = ""; - current_material = ""; + if (!p_single_mesh) { + mesh->set_name(name); + r_meshes.push_back(mesh); + mesh.instance(); + current_group = ""; + current_material = ""; + } } if (f->eof_reached()) { @@ -406,16 +387,40 @@ Node *EditorOBJImporter::import_scene(const String &p_path, uint32_t p_flags, in } } - /* - TODO, check existing materials and merge? - //re-apply materials if exist - for(int i=0;i<mesh->get_surface_count();i++) { + if (p_single_mesh) { + + r_meshes.push_back(mesh); + } + + return OK; +} + +Node *EditorOBJImporter::import_scene(const String &p_path, uint32_t p_flags, int p_bake_fps, List<String> *r_missing_deps, Error *r_err) { + + List<Ref<Mesh> > meshes; + + Error err = _parse_obj(p_path, meshes, false, p_flags & IMPORT_GENERATE_TANGENT_ARRAYS, r_missing_deps); + + if (err != OK) { + if (r_err) { + *r_err = err; + } + return NULL; + } + + Spatial *scene = memnew(Spatial); + + for (List<Ref<Mesh> >::Element *E = meshes.front(); E; E = E->next()) { + + MeshInstance *mi = memnew(MeshInstance); + mi->set_name(E->get()->get_name()); + scene->add_child(mi); + mi->set_owner(scene); + } - String n = mesh->surface_get_name(i); - if (name_map.has(n)) - mesh->surface_set_material(i,name_map[n]); + if (r_err) { + *r_err = OK; } -*/ return scene; } @@ -423,5 +428,68 @@ Ref<Animation> EditorOBJImporter::import_animation(const String &p_path, uint32_ return Ref<Animation>(); } + +void EditorOBJImporter::get_extensions(List<String> *r_extensions) const { + + r_extensions->push_back("obj"); +} + EditorOBJImporter::EditorOBJImporter() { } +//////////////////////////////////////////////////// + +String ResourceImporterOBJ::get_importer_name() const { + return "wavefront_obj"; +} +String ResourceImporterOBJ::get_visible_name() const { + return "OBJ As Mesh"; +} +void ResourceImporterOBJ::get_recognized_extensions(List<String> *p_extensions) const { + + p_extensions->push_back("obj"); +} +String ResourceImporterOBJ::get_save_extension() const { + return "mesh"; +} +String ResourceImporterOBJ::get_resource_type() const { + return "Mesh"; +} + +int ResourceImporterOBJ::get_preset_count() const { + return 0; +} +String ResourceImporterOBJ::get_preset_name(int p_idx) const { + return ""; +} + +void ResourceImporterOBJ::get_import_options(List<ImportOption> *r_options, int p_preset) const { + + r_options->push_back(ImportOption(PropertyInfo(Variant::BOOL, "generate_tangents"), true)); +} +bool ResourceImporterOBJ::get_option_visibility(const String &p_option, const Map<StringName, Variant> &p_options) const { + + return true; +} + +Error ResourceImporterOBJ::import(const String &p_source_file, const String &p_save_path, const Map<StringName, Variant> &p_options, List<String> *r_platform_variants, List<String> *r_gen_files) { + + List<Ref<Mesh> > meshes; + + Error err = _parse_obj(p_source_file, meshes, true, p_options["generate_tangents"], NULL); + + ERR_FAIL_COND_V(err != OK, err); + ERR_FAIL_COND_V(meshes.size() != 1, ERR_BUG); + + String save_path = p_save_path + ".mesh"; + + err = ResourceSaver::save(save_path, meshes.front()->get()); + + ERR_FAIL_COND_V(err != OK, err); + + r_gen_files->push_back(save_path); + + return OK; +} + +ResourceImporterOBJ::ResourceImporterOBJ() { +} diff --git a/editor/import/resource_importer_obj.h b/editor/import/resource_importer_obj.h index 247d58e148..7eeceeabbe 100644 --- a/editor/import/resource_importer_obj.h +++ b/editor/import/resource_importer_obj.h @@ -36,8 +36,6 @@ class EditorOBJImporter : public EditorSceneImporter { GDCLASS(EditorOBJImporter, EditorSceneImporter); - Error _parse_material_library(const String &p_path, Map<String, Ref<SpatialMaterial> > &material_map, List<String> *r_missing_deps); - public: virtual uint32_t get_import_flags() const; virtual void get_extensions(List<String> *r_extensions) const; @@ -47,4 +45,24 @@ public: EditorOBJImporter(); }; +class ResourceImporterOBJ : public ResourceImporter { + GDCLASS(ResourceImporterOBJ, ResourceImporter) +public: + virtual String get_importer_name() const; + virtual String get_visible_name() const; + virtual void get_recognized_extensions(List<String> *p_extensions) const; + virtual String get_save_extension() const; + virtual String get_resource_type() const; + + virtual int get_preset_count() const; + virtual String get_preset_name(int p_idx) const; + + virtual void get_import_options(List<ImportOption> *r_options, int p_preset = 0) const; + virtual bool get_option_visibility(const String &p_option, const Map<StringName, Variant> &p_options) const; + + virtual Error import(const String &p_source_file, const String &p_save_path, const Map<StringName, Variant> &p_options, List<String> *r_platform_variants, List<String> *r_gen_files = NULL); + + ResourceImporterOBJ(); +}; + #endif // RESOURCEIMPORTEROBJ_H diff --git a/main/performance.cpp b/main/performance.cpp index e85d2bf736..4dac6c119e 100644 --- a/main/performance.cpp +++ b/main/performance.cpp @@ -94,7 +94,7 @@ String Performance::get_monitor_name(Monitor p_monitor) const { "raster/surface_changes", "raster/draw_calls", "video/video_mem", - "video/texure_mem", + "video/texture_mem", "video/vertex_mem", "video/video_mem_max", "physics_2d/active_objects", diff --git a/modules/gdscript/gd_editor.cpp b/modules/gdscript/gd_editor.cpp index aa39ad92c4..b0408917a4 100644 --- a/modules/gdscript/gd_editor.cpp +++ b/modules/gdscript/gd_editor.cpp @@ -1952,7 +1952,6 @@ static void _find_call_arguments(GDCompletionContext &context, const GDParser::N //make sure identifier exists... const GDParser::IdentifierNode *id = static_cast<const GDParser::IdentifierNode *>(op->arguments[1]); - if (op->arguments[0]->type == GDParser::Node::TYPE_SELF) { //self, look up @@ -2021,7 +2020,7 @@ static void _find_call_arguments(GDCompletionContext &context, const GDParser::N base = script->get_native(); } else if (nc.is_valid()) { - if (context.function && !context.function->_static) { + if (!(context.function && context.function->_static)) { GDCompletionIdentifier ci; ci.type = Variant::OBJECT; diff --git a/scene/3d/immediate_geometry.h b/scene/3d/immediate_geometry.h index 6db825bf54..93ef726c6d 100644 --- a/scene/3d/immediate_geometry.h +++ b/scene/3d/immediate_geometry.h @@ -38,7 +38,7 @@ class ImmediateGeometry : public GeometryInstance { GDCLASS(ImmediateGeometry, GeometryInstance); RID im; - //a list of texures drawn need to be kept, to avoid references + //a list of textures drawn need to be kept, to avoid references // in VisualServer from becoming invalid if the texture is no longer used List<Ref<Texture> > cached_textures; bool empty; diff --git a/scene/resources/environment.cpp b/scene/resources/environment.cpp index da3bc6a95b..4c6fa7c8a1 100644 --- a/scene/resources/environment.cpp +++ b/scene/resources/environment.cpp @@ -55,12 +55,11 @@ void Environment::set_sky(const Ref<Sky> &p_sky) { VS::get_singleton()->environment_set_sky(environment, sb_rid); } -void Environment::set_sky_scale(float p_scale) { +void Environment::set_sky_custom_fov(float p_scale) { - bg_sky_scale = p_scale; - VS::get_singleton()->environment_set_sky_scale(environment, p_scale); + bg_sky_custom_fov = p_scale; + VS::get_singleton()->environment_set_sky_custom_fov(environment, p_scale); } - void Environment::set_bg_color(const Color &p_color) { bg_color = p_color; @@ -101,9 +100,9 @@ Ref<Sky> Environment::get_sky() const { return bg_sky; } -float Environment::get_sky_scale() const { +float Environment::get_sky_custom_fov() const { - return bg_sky_scale; + return bg_sky_custom_fov; } Color Environment::get_bg_color() const { @@ -268,7 +267,7 @@ Ref<Texture> Environment::get_adjustment_color_correction() const { void Environment::_validate_property(PropertyInfo &property) const { - if (property.name == "background_sky" || property.name == "background_sky_scale" || property.name == "ambient_light/sky_contribution") { + if (property.name == "background_sky" || property.name == "background_sky_custom_fov" || property.name == "ambient_light/sky_contribution") { if (bg_mode != BG_SKY && bg_mode != BG_COLOR_SKY) { property.usage = PROPERTY_USAGE_NOEDITOR; } @@ -820,7 +819,7 @@ void Environment::_bind_methods() { ClassDB::bind_method(D_METHOD("set_background", "mode"), &Environment::set_background); ClassDB::bind_method(D_METHOD("set_sky", "sky"), &Environment::set_sky); - ClassDB::bind_method(D_METHOD("set_sky_scale", "scale"), &Environment::set_sky_scale); + ClassDB::bind_method(D_METHOD("set_sky_custom_fov", "scale"), &Environment::set_sky_custom_fov); ClassDB::bind_method(D_METHOD("set_bg_color", "color"), &Environment::set_bg_color); ClassDB::bind_method(D_METHOD("set_bg_energy", "energy"), &Environment::set_bg_energy); ClassDB::bind_method(D_METHOD("set_canvas_max_layer", "layer"), &Environment::set_canvas_max_layer); @@ -830,7 +829,7 @@ void Environment::_bind_methods() { ClassDB::bind_method(D_METHOD("get_background"), &Environment::get_background); ClassDB::bind_method(D_METHOD("get_sky"), &Environment::get_sky); - ClassDB::bind_method(D_METHOD("get_sky_scale"), &Environment::get_sky_scale); + ClassDB::bind_method(D_METHOD("get_sky_custom_fov"), &Environment::get_sky_custom_fov); ClassDB::bind_method(D_METHOD("get_bg_color"), &Environment::get_bg_color); ClassDB::bind_method(D_METHOD("get_bg_energy"), &Environment::get_bg_energy); ClassDB::bind_method(D_METHOD("get_canvas_max_layer"), &Environment::get_canvas_max_layer); @@ -841,7 +840,7 @@ void Environment::_bind_methods() { ADD_GROUP("Background", "background_"); ADD_PROPERTY(PropertyInfo(Variant::INT, "background_mode", PROPERTY_HINT_ENUM, "Clear Color,Custom Color,Sky,Color+Sky,Canvas,Keep"), "set_background", "get_background"); ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "background_sky", PROPERTY_HINT_RESOURCE_TYPE, "Sky"), "set_sky", "get_sky"); - ADD_PROPERTY(PropertyInfo(Variant::REAL, "background_sky_scale", PROPERTY_HINT_RANGE, "0,32,0.01"), "set_sky_scale", "get_sky_scale"); + ADD_PROPERTY(PropertyInfo(Variant::REAL, "background_sky_custom_fov", PROPERTY_HINT_RANGE, "0,180,0.1"), "set_sky_custom_fov", "get_sky_custom_fov"); ADD_PROPERTY(PropertyInfo(Variant::COLOR, "background_color"), "set_bg_color", "get_bg_color"); ADD_PROPERTY(PropertyInfo(Variant::REAL, "background_energy", PROPERTY_HINT_RANGE, "0,16,0.01"), "set_bg_energy", "get_bg_energy"); ADD_PROPERTY(PropertyInfo(Variant::INT, "background_canvas_max_layer", PROPERTY_HINT_RANGE, "-1000,1000,1"), "set_canvas_max_layer", "get_canvas_max_layer"); @@ -1142,7 +1141,7 @@ Environment::Environment() { environment = VS::get_singleton()->environment_create(); bg_mode = BG_CLEAR_COLOR; - bg_sky_scale = 1.0; + bg_sky_custom_fov = 0; bg_energy = 1.0; bg_canvas_max_layer = 0; ambient_energy = 1.0; diff --git a/scene/resources/environment.h b/scene/resources/environment.h index 9046ec1e49..5909846074 100644 --- a/scene/resources/environment.h +++ b/scene/resources/environment.h @@ -76,7 +76,7 @@ private: BGMode bg_mode; Ref<Sky> bg_sky; - float bg_sky_scale; + float bg_sky_custom_fov; Color bg_color; float bg_energy; int bg_canvas_max_layer; @@ -162,7 +162,7 @@ protected: public: void set_background(BGMode p_bg); void set_sky(const Ref<Sky> &p_sky); - void set_sky_scale(float p_scale); + void set_sky_custom_fov(float p_scale); void set_bg_color(const Color &p_color); void set_bg_energy(float p_energy); void set_canvas_max_layer(int p_max_layer); @@ -172,7 +172,7 @@ public: BGMode get_background() const; Ref<Sky> get_sky() const; - float get_sky_scale() const; + float get_sky_custom_fov() const; Color get_bg_color() const; float get_bg_energy() const; int get_canvas_max_layer() const; diff --git a/servers/visual/rasterizer.h b/servers/visual/rasterizer.h index 344c10089a..b3f6b243de 100644 --- a/servers/visual/rasterizer.h +++ b/servers/visual/rasterizer.h @@ -53,7 +53,7 @@ public: virtual void environment_set_background(RID p_env, VS::EnvironmentBG p_bg) = 0; virtual void environment_set_sky(RID p_env, RID p_sky) = 0; - virtual void environment_set_sky_scale(RID p_env, float p_scale) = 0; + virtual void environment_set_sky_custom_fov(RID p_env, float p_scale) = 0; virtual void environment_set_bg_color(RID p_env, const Color &p_color) = 0; virtual void environment_set_bg_energy(RID p_env, float p_energy) = 0; virtual void environment_set_canvas_max_layer(RID p_env, int p_max_layer) = 0; diff --git a/servers/visual/shader_types.cpp b/servers/visual/shader_types.cpp index 01e3d7592d..7489ca7e3e 100644 --- a/servers/visual/shader_types.cpp +++ b/servers/visual/shader_types.cpp @@ -50,12 +50,6 @@ ShaderTypes::ShaderTypes() { /*************** SPATIAL ***********************/ - shader_modes[VS::SHADER_SPATIAL].functions["vertex"].built_ins["SRC_VERTEX"] = ShaderLanguage::TYPE_VEC3; - shader_modes[VS::SHADER_SPATIAL].functions["vertex"].built_ins["SRC_NORMAL"] = ShaderLanguage::TYPE_VEC3; - shader_modes[VS::SHADER_SPATIAL].functions["vertex"].built_ins["SRC_BONES"] = ShaderLanguage::TYPE_IVEC4; - shader_modes[VS::SHADER_SPATIAL].functions["vertex"].built_ins["SRC_WEIGHTS"] = ShaderLanguage::TYPE_VEC4; - - shader_modes[VS::SHADER_SPATIAL].functions["vertex"].built_ins["POSITION"] = ShaderLanguage::TYPE_VEC4; shader_modes[VS::SHADER_SPATIAL].functions["vertex"].built_ins["VERTEX"] = ShaderLanguage::TYPE_VEC3; shader_modes[VS::SHADER_SPATIAL].functions["vertex"].built_ins["NORMAL"] = ShaderLanguage::TYPE_VEC3; shader_modes[VS::SHADER_SPATIAL].functions["vertex"].built_ins["TANGENT"] = ShaderLanguage::TYPE_VEC3; @@ -90,7 +84,6 @@ ShaderTypes::ShaderTypes() { shader_modes[VS::SHADER_SPATIAL].functions["fragment"].built_ins["UV"] = ShaderLanguage::TYPE_VEC2; shader_modes[VS::SHADER_SPATIAL].functions["fragment"].built_ins["UV2"] = ShaderLanguage::TYPE_VEC2; shader_modes[VS::SHADER_SPATIAL].functions["fragment"].built_ins["COLOR"] = ShaderLanguage::TYPE_VEC4; - shader_modes[VS::SHADER_SPATIAL].functions["fragment"].built_ins["NORMAL"] = ShaderLanguage::TYPE_VEC3; shader_modes[VS::SHADER_SPATIAL].functions["fragment"].built_ins["ALBEDO"] = ShaderLanguage::TYPE_VEC3; shader_modes[VS::SHADER_SPATIAL].functions["fragment"].built_ins["ALPHA"] = ShaderLanguage::TYPE_FLOAT; shader_modes[VS::SHADER_SPATIAL].functions["fragment"].built_ins["METALLIC"] = ShaderLanguage::TYPE_FLOAT; @@ -179,21 +172,19 @@ ShaderTypes::ShaderTypes() { /************ CANVAS ITEM **************************/ - shader_modes[VS::SHADER_CANVAS_ITEM].functions["vertex"].built_ins["SRC_VERTEX"] = ShaderLanguage::TYPE_VEC2; shader_modes[VS::SHADER_CANVAS_ITEM].functions["vertex"].built_ins["VERTEX"] = ShaderLanguage::TYPE_VEC2; shader_modes[VS::SHADER_CANVAS_ITEM].functions["vertex"].built_ins["UV"] = ShaderLanguage::TYPE_VEC2; - shader_modes[VS::SHADER_CANVAS_ITEM].functions["vertex"].built_ins["VERTEX_COLOR"] = ShaderLanguage::TYPE_VEC4; + shader_modes[VS::SHADER_CANVAS_ITEM].functions["vertex"].built_ins["COLOR"] = ShaderLanguage::TYPE_VEC4; shader_modes[VS::SHADER_CANVAS_ITEM].functions["vertex"].built_ins["POINT_SIZE"] = ShaderLanguage::TYPE_FLOAT; shader_modes[VS::SHADER_CANVAS_ITEM].functions["vertex"].built_ins["WORLD_MATRIX"] = ShaderLanguage::TYPE_MAT4; shader_modes[VS::SHADER_CANVAS_ITEM].functions["vertex"].built_ins["PROJECTION_MATRIX"] = ShaderLanguage::TYPE_MAT4; shader_modes[VS::SHADER_CANVAS_ITEM].functions["vertex"].built_ins["EXTRA_MATRIX"] = ShaderLanguage::TYPE_MAT4; shader_modes[VS::SHADER_CANVAS_ITEM].functions["vertex"].built_ins["TIME"] = ShaderLanguage::TYPE_FLOAT; - shader_modes[VS::SHADER_CANVAS_ITEM].functions["vertex"].built_ins["PARTICLE_CUSTOM"] = ShaderLanguage::TYPE_VEC4; + shader_modes[VS::SHADER_CANVAS_ITEM].functions["vertex"].built_ins["INSTANCE_CUSTOM"] = ShaderLanguage::TYPE_VEC4; shader_modes[VS::SHADER_CANVAS_ITEM].functions["vertex"].built_ins["AT_LIGHT_PASS"] = ShaderLanguage::TYPE_BOOL; shader_modes[VS::SHADER_CANVAS_ITEM].functions["vertex"].can_discard = false; - shader_modes[VS::SHADER_CANVAS_ITEM].functions["fragment"].built_ins["SRC_COLOR"] = ShaderLanguage::TYPE_VEC4; shader_modes[VS::SHADER_CANVAS_ITEM].functions["fragment"].built_ins["FRAGCOORD"] = ShaderLanguage::TYPE_VEC4; shader_modes[VS::SHADER_CANVAS_ITEM].functions["fragment"].built_ins["NORMAL"] = ShaderLanguage::TYPE_VEC3; shader_modes[VS::SHADER_CANVAS_ITEM].functions["fragment"].built_ins["NORMALMAP"] = ShaderLanguage::TYPE_VEC3; @@ -202,13 +193,13 @@ ShaderTypes::ShaderTypes() { shader_modes[VS::SHADER_CANVAS_ITEM].functions["fragment"].built_ins["COLOR"] = ShaderLanguage::TYPE_VEC4; shader_modes[VS::SHADER_CANVAS_ITEM].functions["fragment"].built_ins["TEXTURE"] = ShaderLanguage::TYPE_SAMPLER2D; shader_modes[VS::SHADER_CANVAS_ITEM].functions["fragment"].built_ins["TEXTURE_PIXEL_SIZE"] = ShaderLanguage::TYPE_VEC2; + shader_modes[VS::SHADER_CANVAS_ITEM].functions["fragment"].built_ins["NORMAL_TEXTURE"] = ShaderLanguage::TYPE_SAMPLER2D; shader_modes[VS::SHADER_CANVAS_ITEM].functions["fragment"].built_ins["SCREEN_UV"] = ShaderLanguage::TYPE_VEC2; shader_modes[VS::SHADER_CANVAS_ITEM].functions["fragment"].built_ins["SCREEN_PIXEL_SIZE"] = ShaderLanguage::TYPE_VEC2; shader_modes[VS::SHADER_CANVAS_ITEM].functions["fragment"].built_ins["POINT_COORD"] = ShaderLanguage::TYPE_VEC2; shader_modes[VS::SHADER_CANVAS_ITEM].functions["fragment"].built_ins["TIME"] = ShaderLanguage::TYPE_FLOAT; shader_modes[VS::SHADER_CANVAS_ITEM].functions["fragment"].built_ins["AT_LIGHT_PASS"] = ShaderLanguage::TYPE_BOOL; shader_modes[VS::SHADER_CANVAS_ITEM].functions["fragment"].built_ins["SCREEN_TEXTURE"] = ShaderLanguage::TYPE_SAMPLER2D; - shader_modes[VS::SHADER_CANVAS_ITEM].functions["fragment"].built_ins["SCREEN_UV"] = ShaderLanguage::TYPE_VEC2; shader_modes[VS::SHADER_CANVAS_ITEM].functions["fragment"].can_discard = true; shader_modes[VS::SHADER_CANVAS_ITEM].functions["light"].built_ins["POSITION"] = ShaderLanguage::TYPE_VEC2; diff --git a/servers/visual/visual_server_raster.h b/servers/visual/visual_server_raster.h index b5cae978f5..888fb29f93 100644 --- a/servers/visual/visual_server_raster.h +++ b/servers/visual/visual_server_raster.h @@ -968,7 +968,7 @@ public: BIND2(environment_set_background, RID, EnvironmentBG) BIND2(environment_set_sky, RID, RID) - BIND2(environment_set_sky_scale, RID, float) + BIND2(environment_set_sky_custom_fov, RID, float) BIND2(environment_set_bg_color, RID, const Color &) BIND2(environment_set_bg_energy, RID, float) BIND2(environment_set_canvas_max_layer, RID, int) diff --git a/servers/visual/visual_server_wrap_mt.h b/servers/visual/visual_server_wrap_mt.h index 5cf941b93d..caec890217 100644 --- a/servers/visual/visual_server_wrap_mt.h +++ b/servers/visual/visual_server_wrap_mt.h @@ -381,7 +381,7 @@ public: FUNC2(environment_set_background, RID, EnvironmentBG) FUNC2(environment_set_sky, RID, RID) - FUNC2(environment_set_sky_scale, RID, float) + FUNC2(environment_set_sky_custom_fov, RID, float) FUNC2(environment_set_bg_color, RID, const Color &) FUNC2(environment_set_bg_energy, RID, float) FUNC2(environment_set_canvas_max_layer, RID, int) diff --git a/servers/visual_server.h b/servers/visual_server.h index 72f36f6b65..1cc097f50e 100644 --- a/servers/visual_server.h +++ b/servers/visual_server.h @@ -85,7 +85,7 @@ public: enum TextureFlags { TEXTURE_FLAG_MIPMAPS = 1, /// Enable automatic mipmap generation - when available TEXTURE_FLAG_REPEAT = 2, /// Repeat texture (Tiling), otherwise Clamping - TEXTURE_FLAG_FILTER = 4, /// Create texure with linear (or available) filter + TEXTURE_FLAG_FILTER = 4, /// Create texture with linear (or available) filter TEXTURE_FLAG_ANISOTROPIC_FILTER = 8, TEXTURE_FLAG_CONVERT_TO_LINEAR = 16, TEXTURE_FLAG_MIRRORED_REPEAT = 32, /// Repeat texture, with alternate sections mirrored @@ -637,7 +637,7 @@ public: virtual void environment_set_background(RID p_env, EnvironmentBG p_bg) = 0; virtual void environment_set_sky(RID p_env, RID p_sky) = 0; - virtual void environment_set_sky_scale(RID p_env, float p_scale) = 0; + virtual void environment_set_sky_custom_fov(RID p_env, float p_scale) = 0; virtual void environment_set_bg_color(RID p_env, const Color &p_color) = 0; virtual void environment_set_bg_energy(RID p_env, float p_energy) = 0; virtual void environment_set_canvas_max_layer(RID p_env, int p_max_layer) = 0; |