GPUOpen-LibrariesAndSDKs / RadeonProRender-Baikal

MIT License
334 stars 78 forks source link

Uplift the tiny_obj_loader library to the latest version and put it to 3rdparty directory #183

Open dtarakanov1 opened 6 years ago

dtarakanov1 commented 6 years ago

The copied tiny_obj_loader code seems to be quite old. It needs to be updated. Rationale. The g++-8 compiler generates warnings (which are treated as errors due to -Wall). Warning suppression is not the best way of solving such issues.

In file included from /storage/baikal/BaikalIO/scene_obj_io.cpp:40:
/storage/baikal/Baikal/Utils/tiny_obj_loader.h: In function ‘bool tinyobj::exportFaceGroupToShape(tinyobj::shape_t&, std::map<tinyobj::vertex_index, unsigned int>, const std::vector<float>&, const std::vector<float>&, const std::vector<float>&, const std::vector<std::vector<tinyobj::vertex_index> >&, std::vector<tinyobj::tag_t>&, int, const string&, bool, unsigned int, std::__cxx11::string&)’:
/storage/baikal/Baikal/Utils/tiny_obj_loader.h:672:39: error: ‘void* memcpy(void*, const void*, size_t)’ copying an object of non-trivial type ‘class tinyobj::float3’ from an array of ‘__gnu_cxx::__alloc_traits<std::allocator<float>, float>::value_type’ {aka ‘float’} [-Werror=class-memaccess]
                         sizeof(float3));
                                       ^
In file included from /storage/baikal/BaikalIO/scene_obj_io.cpp:40:
/storage/baikal/Baikal/Utils/tiny_obj_loader.h:109:11: note: ‘class tinyobj::float3’ declared here
     class float3 {
           ^~~~~~
In file included from /storage/baikal/BaikalIO/scene_obj_io.cpp:40:
/storage/baikal/Baikal/Utils/tiny_obj_loader.h:674:39: error: ‘void* memcpy(void*, const void*, size_t)’ copying an object of non-trivial type ‘class tinyobj::float3’ from an array of ‘__gnu_cxx::__alloc_traits<std::allocator<float>, float>::value_type’ {aka ‘float’} [-Werror=class-memaccess]
                         sizeof(float3));
                                       ^
In file included from /storage/baikal/BaikalIO/scene_obj_io.cpp:40:
/storage/baikal/Baikal/Utils/tiny_obj_loader.h:109:11: note: ‘class tinyobj::float3’ declared here
     class float3 {
           ^~~~~~
In file included from /storage/baikal/BaikalIO/scene_obj_io.cpp:40:
/storage/baikal/Baikal/Utils/tiny_obj_loader.h:676:39: error: ‘void* memcpy(void*, const void*, size_t)’ copying an object of non-trivial type ‘class tinyobj::float3’ from an array of ‘__gnu_cxx::__alloc_traits<std::allocator<float>, float>::value_type’ {aka ‘float’} [-Werror=class-memaccess]
                         sizeof(float3));
                                       ^
In file included from /storage/baikal/BaikalIO/scene_obj_io.cpp:40:
/storage/baikal/Baikal/Utils/tiny_obj_loader.h:109:11: note: ‘class tinyobj::float3’ declared here
     class float3 {
           ^~~~~~

Also, it would be good to place the corresponding code into the 3rdparty directory (or even make it a submodule) to avoid confusion.