mirror of
https://github.com/cyberarm/cyberarm_engine.git
synced 2025-12-15 20:52:35 +00:00
Added rendered vertices count to OpenGLRenderer
This commit is contained in:
@@ -3,7 +3,8 @@ module CyberarmEngine
|
|||||||
attr_accessor :objects, :materials, :vertices, :uvs, :texures, :normals, :faces, :colors, :bones, :material_file,
|
attr_accessor :objects, :materials, :vertices, :uvs, :texures, :normals, :faces, :colors, :bones, :material_file,
|
||||||
:current_material, :current_object, :vertex_count, :smoothing
|
:current_material, :current_object, :vertex_count, :smoothing
|
||||||
attr_reader :position, :bounding_box, :textured_material, :file_path, :positions_buffer_id, :colors_buffer_id,
|
attr_reader :position, :bounding_box, :textured_material, :file_path, :positions_buffer_id, :colors_buffer_id,
|
||||||
:normals_buffer_id, :uvs_buffer_id, :textures_buffer_id, :vertex_array_id, :aabb_tree
|
:normals_buffer_id, :uvs_buffer_id, :textures_buffer_id, :vertex_array_id, :aabb_tree,
|
||||||
|
:vertices_count
|
||||||
|
|
||||||
def initialize(file_path:)
|
def initialize(file_path:)
|
||||||
@file_path = file_path
|
@file_path = file_path
|
||||||
@@ -23,6 +24,8 @@ module CyberarmEngine
|
|||||||
@bones = []
|
@bones = []
|
||||||
@smoothing = 0
|
@smoothing = 0
|
||||||
|
|
||||||
|
@vertices_count = 0
|
||||||
|
|
||||||
@bounding_box = BoundingBox.new
|
@bounding_box = BoundingBox.new
|
||||||
start_time = Process.clock_gettime(Process::CLOCK_MONOTONIC, :float_millisecond)
|
start_time = Process.clock_gettime(Process::CLOCK_MONOTONIC, :float_millisecond)
|
||||||
|
|
||||||
@@ -32,6 +35,8 @@ module CyberarmEngine
|
|||||||
|
|
||||||
parse(parser)
|
parse(parser)
|
||||||
|
|
||||||
|
@vertices_count = @vertices.size
|
||||||
|
|
||||||
@has_texture = false
|
@has_texture = false
|
||||||
|
|
||||||
@materials.each do |_key, material|
|
@materials.each do |_key, material|
|
||||||
|
|||||||
@@ -3,12 +3,15 @@ module CyberarmEngine
|
|||||||
@@immediate_mode_warning = false
|
@@immediate_mode_warning = false
|
||||||
|
|
||||||
attr_accessor :show_wireframe
|
attr_accessor :show_wireframe
|
||||||
|
attr_reader :number_of_vertices
|
||||||
|
|
||||||
def initialize(width:, height:, show_wireframe: false)
|
def initialize(width:, height:, show_wireframe: false)
|
||||||
@width = width
|
@width = width
|
||||||
@height = height
|
@height = height
|
||||||
@show_wireframe = show_wireframe
|
@show_wireframe = show_wireframe
|
||||||
|
|
||||||
|
@number_of_vertices = 0
|
||||||
|
|
||||||
@g_buffer = GBuffer.new(width: @width, height: @height)
|
@g_buffer = GBuffer.new(width: @width, height: @height)
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -20,6 +23,8 @@ module CyberarmEngine
|
|||||||
end
|
end
|
||||||
|
|
||||||
def render(camera, lights, entities)
|
def render(camera, lights, entities)
|
||||||
|
@number_of_vertices = 0
|
||||||
|
|
||||||
glViewport(0, 0, @width, @height)
|
glViewport(0, 0, @width, @height)
|
||||||
glEnable(GL_DEPTH_TEST)
|
glEnable(GL_DEPTH_TEST)
|
||||||
|
|
||||||
@@ -44,6 +49,8 @@ module CyberarmEngine
|
|||||||
gl_error?
|
gl_error?
|
||||||
draw_model(entity.model, shader)
|
draw_model(entity.model, shader)
|
||||||
entity.draw
|
entity.draw
|
||||||
|
|
||||||
|
@number_of_vertices += entity.model.vertices_count
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -90,6 +97,8 @@ module CyberarmEngine
|
|||||||
draw_mesh(entity.model)
|
draw_mesh(entity.model)
|
||||||
entity.draw
|
entity.draw
|
||||||
glPopMatrix
|
glPopMatrix
|
||||||
|
|
||||||
|
@number_of_vertices += entity.model.vertices_count
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user