Showing 67 of 251 total issues
File geometry.rb
has 263 lines of code (exceeds 250 allowed). Consider refactoring. Open
require 'mittsu/opengl/geometry_like'
module Mittsu
class Geometry
include OpenGL::GeometryLike
Method set_program
has 57 lines of code (exceeds 25 allowed). Consider refactoring. Open
def set_program(camera, lights, fog, material, object)
@_used_texture_units = 0
if material.needs_update?
deallocate_material(material) if material.program
Method set
has 57 lines of code (exceeds 25 allowed). Consider refactoring. Open
def set(slot, renderer)
@renderer = renderer
if image.length == 6
if needs_update?
Method init_mesh_buffers
has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring. Open
def init_mesh_buffers(object)
geometry = object.geometry
nvertices = @faces3.length * 3
nvertices2 = nvertices * 2
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Method initialize
has 55 lines of code (exceeds 25 allowed). Consider refactoring. Open
def initialize(width, height, title, antialias: 0)
::GLFW.Init
::GLFW.WindowHint ::GLFW::OPENGL_PROFILE, ::GLFW::OPENGL_CORE_PROFILE
::GLFW.WindowHint ::GLFW::OPENGL_FORWARD_COMPAT, GL::TRUE
Method render_objects
has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring. Open
def render_objects(render_list, camera, lights, fog, override_material)
material = nil
render_list.each do |opengl_object|
puts "-- RENDER_OBJECT #{opengl_object.name}" if DEBUG
object = opengl_object.object
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Method render_objects_immediate
has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring. Open
def render_objects_immediate(render_list, material_type, camera, lights, fog, override_material)
material = nil
render_list.each do |opengl_object|
object = opengl_object.object
if object.visible
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Method set_blending
has 49 lines of code (exceeds 25 allowed). Consider refactoring. Open
def set_blending(blending, blend_equation = nil, blend_src = nil, blend_dst = nil, blend_equation_alpha = nil, blend_src_alpha = nil, blend_dst_alpha = nil)
if blending != @current_blending
case blending
when NoBlending
GL.Disable(GL::BLEND)
Method program_parameters
has 42 lines of code (exceeds 25 allowed). Consider refactoring. Open
def program_parameters(lights, fog, object)
# heuristics to create shader paramaters according to lights in the scene
# (not to blow over max_lights budget)
max_light_count = allocate_lights(lights)
Method set_blending
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
def set_blending(blending, blend_equation = nil, blend_src = nil, blend_dst = nil, blend_equation_alpha = nil, blend_src_alpha = nil, blend_dst_alpha = nil)
if blending != @current_blending
case blending
when NoBlending
GL.Disable(GL::BLEND)
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Method initialize
has 39 lines of code (exceeds 25 allowed). Consider refactoring. Open
def initialize(renderer, lights, opengl_objects, opengl_objects_immediate)
@renderer, @lights = renderer, lights
@opengl_objects = opengl_objects
@opengl_objects_immediate = opengl_objects_immediate
Method setup_buffers
has 39 lines of code (exceeds 25 allowed). Consider refactoring. Open
def setup_buffers
return unless @framebuffer.nil?
# TODO: when OpenGLRenderTargetCube exists
is_cube = false # render_target.is_a? OpenGLRenderTargetCube
Method update_shadow_camera
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
def update_shadow_camera(camera, light)
shadow_camera = light.shadow_camera
points_frustum = light.pointa_frustum
points_world = light.points_world
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Method set_line_buffers
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
def set_line_buffers(hint)
if @vertices_need_update
@vertices.each_with_index do |vertex, v|
offset = v * 3
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Method unroll_buffer_material
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
def unroll_buffer_material(opengl_object)
object = opengl_object.object
buffer = opengl_object.buffer
geometry = object.geometry
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Method make_groups
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
def make_groups(uses_face_material = false)
max_vertices_in_group = 65535 # TODO: OES_element_index_uint ???
hash_map = {}
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Consider simplifying this complex logical expression. Open
if geometry.vertices_need_update || geometry.morph_targets_need_update || geometry.elements_need_update || geometry.uvs_need_update || geometry.normals_need_update || geometry.colors_need_update || geometry.tangents_need_update || custom_attributes_dirty
geometry_group.set_mesh_buffers(self, GL::DYNAMIC_DRAW, !geometry.dynamic, mat)
end
Method create_virtual_light
has 33 lines of code (exceeds 25 allowed). Consider refactoring. Open
def create_virtual_light(light, cascade)
DirectionalLight.new.tap do |virtual_light|
virtual_light.is_virtual = true
virtual_light.only_shadow = true
Method load_uniforms
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
def load_uniforms(uniforms, uniforms_lib)
uniform_strings = nil;
in_uniform = false
uniforms.lines.map(&:strip).each_with_object({}) { |line, hash|
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Method make_groups
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
def make_groups(uses_face_material = false)
max_vertices_in_group = 65535 # TODO: OES_element_index_uint ???
hash_map = {}