From: Mikko Rasa Date: Sun, 25 Sep 2022 17:21:19 +0000 (+0300) Subject: An assortment of minor fixes X-Git-Url: http://git.tdb.fi/?p=libs%2Fgl.git;a=commitdiff_plain;h=857e0a3f684fba4810260697a78a769dff514f1f An assortment of minor fixes Mostly formatting, with a few cleanups of unnecessary things. --- diff --git a/blender/io_mspgl/export.py b/blender/io_mspgl/export.py index 9e60f284..b724eddd 100644 --- a/blender/io_mspgl/export.py +++ b/blender/io_mspgl/export.py @@ -93,9 +93,6 @@ class ProjectExporter: sequences = [] for s in ctx.context.blend_data.scenes: subtask = task.next_slice(s) - if s.export_disposition=='IGNORE': - continue - if s.export_disposition=='SEQUENCE': scene = create_scene_chain(s, scenes) sequences.append(scene) @@ -141,6 +138,7 @@ class ProjectExporter: resources[scene_name] = scene_res dummy_res.create_reference_statement("ref", scene_res) + task = ctx.task("Exporting sequences", 1.0) for s in sequences: subtask = task.task(s, 0.5) seq_name = s.name+".seq" diff --git a/blender/io_mspgl/export_material.py b/blender/io_mspgl/export_material.py index 4c40757f..a0c0432e 100644 --- a/blender/io_mspgl/export_material.py +++ b/blender/io_mspgl/export_material.py @@ -153,7 +153,6 @@ class MaterialExporter: spec_values = {} - color_prop = material.properties[0] if material.cast_shadows and material.alpha_cutoff>0.0: spec_values["use_alpha_cutoff"] = True variant += "_masked" diff --git a/demos/desertpillars/source/desertpillars.h b/demos/desertpillars/source/desertpillars.h index 7aae1c2d..3171da8e 100644 --- a/demos/desertpillars/source/desertpillars.h +++ b/demos/desertpillars/source/desertpillars.h @@ -35,7 +35,6 @@ private: { private: Msp::DataFile::DirectorySource source; - Msp::GL::ResourceManager res_mgr; public: Resources(Msp::GL::ResourceManager *); diff --git a/source/backends/opengl/datatype_backend.cpp b/source/backends/opengl/datatype_backend.cpp index 15709693..da97010f 100644 --- a/source/backends/opengl/datatype_backend.cpp +++ b/source/backends/opengl/datatype_backend.cpp @@ -94,7 +94,7 @@ namespace GL { unsigned get_gl_type(DataType type) { const MappedType *end = type_map+type_map_size; - const MappedType *ptr = lower_bound(type_map, end, type, type_compare); + const MappedType *ptr = std::lower_bound(type_map, end, type, type_compare); if(ptr==end || ptr->type!=type) throw invalid_argument("get_gl_type"); return ptr->gl_type; diff --git a/source/core/batch.cpp b/source/core/batch.cpp index 83b7d49b..56c25efb 100644 --- a/source/core/batch.cpp +++ b/source/core/batch.cpp @@ -47,8 +47,7 @@ namespace GL { Batch::Batch(PrimitiveType t): BatchBackend(t), prim_type(t), - index_type(VOID), - max_index(0) + index_type(VOID) { set_index_type(UNSIGNED_SHORT); } diff --git a/source/core/batch.h b/source/core/batch.h index f3495860..2ac2c43c 100644 --- a/source/core/batch.h +++ b/source/core/batch.h @@ -37,7 +37,7 @@ private: PrimitiveType prim_type; DataType index_type; std::vector data; - unsigned max_index; + unsigned max_index = 0; unsigned patch_size = 3; public: diff --git a/source/glsl/resolve.cpp b/source/glsl/resolve.cpp index aeccd1bf..1d165b7e 100644 --- a/source/glsl/resolve.cpp +++ b/source/glsl/resolve.cpp @@ -96,7 +96,7 @@ void TypeResolver::resolve_type(TypeDeclaration *&type, const string &name, bool } r_any_resolved |= (resolved!=type); - type=resolved; + type = resolved; } void TypeResolver::visit(Block &block) diff --git a/source/render/renderer.cpp b/source/render/renderer.cpp index 352cf420..7e010b3f 100644 --- a/source/render/renderer.cpp +++ b/source/render/renderer.cpp @@ -71,7 +71,7 @@ void Renderer::push_state() void Renderer::pop_state() { - if(state_stack.size()==1) + if(state_stack.size()<=1) throw stack_underflow("Renderer::pop_state"); uintptr_t old_pipeline = current_state->pipeline_key; diff --git a/source/render/renderer.h b/source/render/renderer.h index da2cf8ba..0fa19346 100644 --- a/source/render/renderer.h +++ b/source/render/renderer.h @@ -152,7 +152,7 @@ public: void push_state(); /** Restores a previously saved state. Must be matched with an earlier - push_state call. */ + push_state() call. */ void pop_state(); private: @@ -228,7 +228,8 @@ public: /** Draws a batch of primitives. A shader must be active. */ void draw(const Batch &); - /** Draws multiple instances of a batch of primitives. A shader must be active. */ + /** Draws multiple instances of a batch of primitives. A shader must be + active. */ void draw_instanced(const Batch &, unsigned); private: diff --git a/tests/glsl/ignore_array_in_geometry_passthrough.glsl b/tests/glsl/ignore_array_in_geometry_passthrough.glsl index f491ea34..b6160968 100644 --- a/tests/glsl/ignore_array_in_geometry_passthrough.glsl +++ b/tests/glsl/ignore_array_in_geometry_passthrough.glsl @@ -47,8 +47,8 @@ layout(location=2) in vec4 instance_transform[3]; layout(location=0) out vec2 _vs_out_texcoord; void main() { - _vs_out_texcoord = texcoord; - gl_Position = vp_matrix*transpose(mat4(instance_transform[0], instance_transform[1], instance_transform[2], vec4(0.0, 0.0, 0.0, 1.0)))*position; + _vs_out_texcoord = texcoord; + gl_Position = vp_matrix*transpose(mat4(instance_transform[0], instance_transform[1], instance_transform[2], vec4(0.0, 0.0, 0.0, 1.0)))*position; } */ diff --git a/tests/glsl/keep_spec_constants_in_module.glsl b/tests/glsl/keep_spec_constants_in_module.glsl index 7b9f98c8..2a6b446e 100644 --- a/tests/glsl/keep_spec_constants_in_module.glsl +++ b/tests/glsl/keep_spec_constants_in_module.glsl @@ -57,10 +57,10 @@ layout(location=1) in vec2 _vs_out_texcoord; layout(location=0) in vec4 _vs_out_color; void main() { - frag_color = vec4(1.0); - if(use_texture) - frag_color *= texture(tex, _vs_out_texcoord); - if(use_vertex_color) - frag_color *= _vs_out_color; + frag_color = vec4(1.0); + if(use_texture) + frag_color *= texture(tex, _vs_out_texcoord); + if(use_vertex_color) + frag_color *= _vs_out_color; } */