From 0b40e042bfe0db7f42ffecb4851928d11048805a Mon Sep 17 00:00:00 2001 From: Cyberarm Date: Fri, 27 Sep 2019 10:08:57 -0500 Subject: [PATCH] Make wavefront material parser use relative path for textures --- lib/wavefront/parser.rb | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lib/wavefront/parser.rb b/lib/wavefront/parser.rb index c307282..d949827 100644 --- a/lib/wavefront/parser.rb +++ b/lib/wavefront/parser.rb @@ -100,7 +100,9 @@ class IMICFPS when 'd' # Dissolved (Transparency) when 'illum' # Illumination model when 'map_Kd' # Diffuse texture - @model.materials[@model.current_material].set_texture(array[1]) + texture = File.basename(array[1]) + texture_path = "#{File.expand_path("../../", @model.file_path)}/textures/#{texture}" + @model.materials[@model.current_material].set_texture(texture_path) end end end