mirror of
https://github.com/cyberarm/i-mic-fps.git
synced 2025-12-15 23:52:35 +00:00
Fixed modern opengl renderer not renderering model textures, framebuffer can be used without crashing, model uv coordinates are now in buffer, minor rendering optimization
This commit is contained in:
20
lib/model.rb
20
lib/model.rb
@@ -44,6 +44,15 @@ class IMICFPS
|
||||
|
||||
puts "#{@file_path.split('/').last} took #{((Process.clock_gettime(Process::CLOCK_MONOTONIC, :float_millisecond)-start_time)/1000.0).round(2)} seconds to parse" if window.config.get(:debug_options, :stats)
|
||||
|
||||
@has_texture = false
|
||||
|
||||
@materials.each do |key, material|
|
||||
if material.texture_id
|
||||
@has_texture = true
|
||||
@textured_material = key
|
||||
end
|
||||
end
|
||||
|
||||
if Shader.available?("default")
|
||||
allocate_gl_objects
|
||||
populate_vertex_buffer
|
||||
@@ -55,13 +64,6 @@ class IMICFPS
|
||||
puts " Model::Object Name: #{o.name}, Vertices: #{o.vertices.size}" if window.config.get(:debug_options, :stats)
|
||||
end
|
||||
window.number_of_vertices+=@vertex_count
|
||||
@has_texture = false
|
||||
@materials.each do |key, material|
|
||||
if material.texture_id
|
||||
@has_texture = true
|
||||
@textured_material = key
|
||||
end
|
||||
end
|
||||
|
||||
start_time = Process.clock_gettime(Process::CLOCK_MONOTONIC, :float_millisecond)
|
||||
# build_collision_tree
|
||||
@@ -160,8 +162,8 @@ class IMICFPS
|
||||
glBindBuffer(GL_ARRAY_BUFFER, @uvs_buffer_id)
|
||||
glBufferData(GL_ARRAY_BUFFER, uvs.flatten.size * Fiddle::SIZEOF_FLOAT, uvs.flatten.pack("f*"), GL_STATIC_DRAW)
|
||||
|
||||
glBindBuffer(GL_ARRAY_BUFFER, @textures_buffer_id)
|
||||
glBufferData(GL_ARRAY_BUFFER, tex_ids.flatten.size * Fiddle::SIZEOF_FLOAT, tex_ids.flatten.pack("f*"), GL_STATIC_DRAW)
|
||||
# glBindBuffer(GL_ARRAY_BUFFER, @textures_buffer_id)
|
||||
# glBufferData(GL_ARRAY_BUFFER, tex_ids.flatten.size * Fiddle::SIZEOF_FLOAT, tex_ids.flatten.pack("f*"), GL_STATIC_DRAW)
|
||||
end
|
||||
|
||||
glBindBuffer(GL_ARRAY_BUFFER, 0)
|
||||
|
||||
Reference in New Issue
Block a user