1
0
mirror of https://github.com/rwengine/openrw.git synced 2024-11-07 03:12:36 +01:00
Commit Graph

73 Commits

Author SHA1 Message Date
Anonymous Maarten
f14bf308cf rwlib: rwlib has a dependency on glm 2018-01-05 06:21:34 +00:00
Anonymous Maarten
9231ecbcb0 cmake: use OpenGL::GL instead of OpenGL::OpenGL
- OpenGL::GL -> defined to the platform-specific OpenGL libraries
- OpenGL::OpenGL -> defined to libOpenGL if the system is GLVND
2017-12-17 01:36:08 +00:00
Anonymous Maarten
32fb5eb409 rwlib: LoaderIMG accepts rwfs::path 2017-11-17 00:50:50 +00:00
Anonymous Maarten
820c4bd25c rwengine: GameData accepts rwfs::path as path of game data 2017-11-17 00:50:50 +00:00
Anonymous Maarten
6dffed543a rwlib: add error_code to rwfs namespace
Some rwfs functions need an error_code argument.
2017-11-17 00:50:50 +00:00
Daniel Evans
9c48b4424a Add build time option for CXX17 or boost filesystem 2017-10-31 00:55:19 +00:00
Anonymous Maarten
a40a2706a9 cmake: add support for include-what-you-use to check #include's
The output is currently very verbose and includes many false positives.
Adding a mapping file should solve this.

See
https://github.com/include-what-you-use/include-what-you-use/blob/master/docs/IWYUMappings.md
2017-10-29 20:40:57 +00:00
Anonymous Maarten
06c4bf09f7 cmake: make OpenGL an imported target 2017-10-29 20:40:57 +00:00
Anonymous Maarten
e555331748 cmake: be more specific about Boost library to link with
CMake 3.2's FindBoost.cmake does not support boost:: namespaces
2017-10-29 20:40:57 +00:00
Anonymous Maarten
99951b9e05 cmake: reformat rwlib/CMakeLists.txt 2017-10-29 20:40:57 +00:00
Anonymous Maarten
1926795d63 cmake: use rwengine::interface + no more add_definitions & include_directories 2017-10-29 20:40:57 +00:00
Filip
c54cfa0ae8 Avoid making unnecessary copies (#337)
* frames.emplace_back

* vehicleColours.emplace_back

* colours.emplace_back

* waterBlocks.emplace_back

* state.garages.emplace_back

* bonedata->frames.emplace_back

* lines.emplace_back

* circleVerts.emplace_back

* geo.emplace_back

* Water renderer

* perf_colours.emplace_back
2017-10-29 17:14:07 +00:00
Anonymous Maarten
2282734425 rwlib: free Geometry OpenGL buffers
Should fix this memory leak:
==31441== 576 bytes in 4 blocks are possibly lost in loss record 2,109 of 2,723
==31441==    at 0x4C30A1E: calloc (vg_replace_malloc.c:711)
==31441==    by 0x14F98CEF: ??? (in /usr/lib64/dri/i965_dri.so)
==31441==    by 0x14FD8303: ??? (in /usr/lib64/dri/i965_dri.so)
==31441==    by 0x14FD8B6F: ??? (in /usr/lib64/dri/i965_dri.so)
==31441==    by 0x14BF0C40: ??? (in /usr/lib64/dri/i965_dri.so)
==31441==    by 0x14BF0E27: ??? (in /usr/lib64/dri/i965_dri.so)
==31441==    by 0x910D28: LoaderDFF::readGeometry(RWBStream const&) (LoaderDFF.cpp:253)
==31441==    by 0x9104E2: LoaderDFF::readGeometryList(RWBStream const&) (LoaderDFF.cpp:129)
==31441==    by 0x911CED: LoaderDFF::loadFromMemory(std::shared_ptr<FileContentsInfo>) (LoaderDFF.cpp:474)
==31441==    by 0x7BE007: GameData::loadModel(unsigned short) (GameData.cpp:474)
==31441==    by 0x7E0DD2: GameWorld::createInstance(unsigned short, glm::tvec3<float, (glm::precision)0> const&, glm::tquat<float, (glm::precision)0> const&) (GameWorld.cpp:144)
==31441==    by 0x86E0BE: opcode_029b(ScriptArguments const&, int, glm::tvec3<float, (glm::precision)0>, ScriptObjectType<InstanceObject>&) (GTA3ModuleImpl.inl:7234)
==31441==
==31441== 696 bytes in 3 blocks are possibly lost in loss record 2,197 of 2,723
==31441==    at 0x4C30A1E: calloc (vg_replace_malloc.c:711)
==31441==    by 0x14FD8298: ??? (in /usr/lib64/dri/i965_dri.so)
==31441==    by 0x14BEEF21: ??? (in /usr/lib64/dri/i965_dri.so)
==31441==    by 0x14BEF057: ??? (in /usr/lib64/dri/i965_dri.so)
==31441==    by 0x910CA6: LoaderDFF::readGeometry(RWBStream const&) (LoaderDFF.cpp:248)
==31441==    by 0x9104E2: LoaderDFF::readGeometryList(RWBStream const&) (LoaderDFF.cpp:129)
==31441==    by 0x911CED: LoaderDFF::loadFromMemory(std::shared_ptr<FileContentsInfo>) (LoaderDFF.cpp:474)
==31441==    by 0x7BD346: GameData::loadClump(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) (GameData.cpp:394)
==31441==    by 0x75914F: RWGame::RWGame(Logger&, int, char**) (RWGame.cpp:54)
==31441==    by 0x749175: main (main.cpp:13)
2017-10-18 21:52:29 +01:00
Anonymous Maarten
c2da40d0a0 rwlib/rwengine: Use AnimationPtr instead of Animation*
Should fix these memory leaks:
==31441== 3,694,699 (17,248 direct, 3,677,451 indirect) bytes in 196 blocks are definitely lost in loss record 2,720 of 2,723
==31441==    at 0x4C2F1CA: operator new(unsigned long) (vg_replace_malloc.c:334)
==31441==    by 0x81D98E: LoaderIFP::loadFromMemory(char*) (LoaderIFP.cpp:69)
==31441==    by 0x7BE5D2: GameData::loadIFP(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) (GameData.cpp:506)
==31441==    by 0x7B9B4A: GameData::load() (GameData.cpp:59)
==31441==    by 0x7590C5: RWGame::RWGame(Logger&, int, char**) (RWGame.cpp:51)
==31441==    by 0x749175: main (main.cpp:13)
==31441==
==31441== 5,298,984 (1,080 direct, 5,297,904 indirect) bytes in 15 blocks are definitely lost in loss record 2,722 of 2,723
==31441==    at 0x4C2F1CA: operator new(unsigned long) (vg_replace_malloc.c:334)
==31441==    by 0x820253: __gnu_cxx::new_allocator<std::_Rb_tree_node<std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const, AnimationBone*> > >::allocate(unsigned long, void const*) (new_allocator.h:111)
==31441==    by 0x820175: std::allocator_traits<std::allocator<std::_Rb_tree_node<std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const, AnimationBone*> > > >::allocate(std::allocator<std::_Rb_tree_node<std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const, AnimationBone*> > >&, unsigned long) (alloc_traits.h:436)
==31441==    by 0x81FFB4: std::_Rb_tree<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const, AnimationBone*>, std::_Select1st<std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const, AnimationBone*> >, std::less<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::allocator<std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const, AnimationBone*> > >::_M_get_node() (stl_tree.h:588)
==31441==    by 0x81FE03: std::_Rb_tree_node<std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const, AnimationBone*> >* std::_Rb_tree<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const, AnimationBone*>, std::_Select1st<std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const, AnimationBone*> >, std::less<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::allocator<std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const, AnimationBone*> > >::_M_create_node<std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const, AnimationBone*> const&>(std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const, AnimationBone*> const&) (stl_tree.h:642)
==31441==    by 0x81FC26: std::_Rb_tree_node<std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const, AnimationBone*> >* std::_Rb_tree<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const, AnimationBone*>, std::_Select1st<std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const, AnimationBone*> >, std::less<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::allocator<std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const, AnimationBone*> > >::_Alloc_node::operator()<std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const, AnimationBone*> const&>(std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const, AnimationBone*> const&) const (stl_tree.h:556)
==31441==    by 0x81F620: std::_Rb_tree_iterator<std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const, AnimationBone*> > std::_Rb_tree<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const, AnimationBone*>, std::_Select1st<std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const, AnimationBone*> >, std::less<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::allocator<std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const, AnimationBone*> > >::_M_insert_<std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const, AnimationBone*> const&, std::_Rb_tree<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const, AnimationBone*>, std::_Select1st<std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const, AnimationBone*> >, std::less<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::allocator<std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const, AnimationBone*> > >::_Alloc_node>(std::_Rb_tree_node_base*, std::_Rb_tree_node_base*, std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const, AnimationBone*> const&, std::_Rb_tree<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const, AnimationBone*>, std::_Select1st<std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const, AnimationBone*> >, std::less<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::allocator<std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const, AnimationBone*> > >::_Alloc_node&) (stl_tree.h:1753)
==31441==    by 0x81EDFD: std::pair<std::_Rb_tree_iterator<std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const, AnimationBone*> >, bool> std::_Rb_tree<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const, AnimationBone*>, std::_Select1st<std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const, AnimationBone*> >, std::less<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::allocator<std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const, AnimationBone*> > >::_M_insert_unique<std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const, AnimationBone*> const&>(std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const, AnimationBone*> const&) (stl_tree.h:2096)
==31441==    by 0x81E9F0: std::map<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, AnimationBone*, std::less<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::allocator<std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const, AnimationBone*> > >::insert(std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const, AnimationBone*> const&) (stl_map.h:796)
==31441==    by 0x81E0BB: LoaderIFP::loadFromMemory(char*) (LoaderIFP.cpp:132)
==31441==    by 0x7BE5D2: GameData::loadIFP(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) (GameData.cpp:506)
==31441==    by 0x7E4060: GameWorld::loadCutscene(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) (GameWorld.cpp:692)
2017-10-18 21:52:29 +01:00
Anonymous Maarten
5ff31db04f rwlib: Delete textures on close
Should fix these memory leaks:
==22737== 513,622,016 bytes in 6,650 blocks are definitely lost in loss record 3,126 of 3,126
==22737==    at 0x14F996E4: ??? (in /usr/lib64/dri/i965_dri.so)
==22737==    by 0x14FE717A: ??? (in /usr/lib64/dri/i965_dri.so)
==22737==    by 0x14FE622E: ??? (in /usr/lib64/dri/i965_dri.so)
==22737==    by 0x14CDED2A: ??? (in /usr/lib64/dri/i965_dri.so)
==22737==    by 0x14CDF85F: ??? (in /usr/lib64/dri/i965_dri.so)
==22737==    by 0x91602C: createTexture(RW::BSTextureNative&, RW::BinaryStreamSection&) (LoaderTXD.cpp:79)
==22737==    by 0x91649E: TextureLoader::loadFromMemory(std::shared_ptr<FileContentsInfo>, std::map<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::shared_ptr<TextureData>, std::less<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::allocator<std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const, std::shared_ptr<TextureData> > > >&) (LoaderTXD.cpp:183)
==22737==    by 0x7BBCE0: GameData::loadTextureArchive(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) (GameData.cpp:372)
==22737==    by 0x7BBABA: GameData::loadTXD(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) (GameData.cpp:358)
==22737==    by 0x7BCA80: GameData::loadModel(unsigned short) (GameData.cpp:466)
==22737==    by 0x7DF7BC: GameWorld::createInstance(unsigned short, glm::tvec3<float, (glm::precision)0> const&, glm::tquat<float, (glm::precision)0> const&) (GameWorld.cpp:144)
==22737==    by 0x7DF44C: GameWorld::placeItems(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) (GameWorld.cpp:120)
2017-10-18 21:52:29 +01:00
Anonymous Maarten
7e4e1db85d rwlib: Use ClumpPtr instead of Clump*
Should fix these memory leaks:
==22737== 14,598,040 (131,472 direct, 14,466,568 indirect) bytes in 2,739 blocks are definitely lost in loss record 3,124 of 3,126
==22737==    at 0x4C2F1CA: operator new(unsigned long) (vg_replace_malloc.c:334)
==22737==    by 0x90FE4B: LoaderDFF::loadFromMemory(std::shared_ptr<FileContentsInfo>) (LoaderDFF.cpp:443)
==22737==    by 0x7BCC86: GameData::loadModel(unsigned short) (GameData.cpp:474)
==22737==    by 0x7DF7BC: GameWorld::createInstance(unsigned short, glm::tvec3<float, (glm::precision)0> const&, glm::tquat<float, (glm::precision)0> const&) (GameWorld.cpp:144)
==22737==    by 0x7DF44C: GameWorld::placeItems(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) (GameWorld.cpp:120)
==22737==    by 0x758D38: RWGame::newGame() (RWGame.cpp:116)
==22737==    by 0x786389: LoadingState::enter() (LoadingState.cpp:9)
==22737==    by 0x75DC59: void StateManager::enter<LoadingState, RWGame*, RWGame::RWGame(Logger&, int, char**)::{lambda()#1}>(RWGame*&&, RWGame::RWGame(Logger&, int, char**)::{lambda()#1}&&) (StateManager.hpp:40)
==22737==    by 0x758484: RWGame::RWGame(Logger&, int, char**) (RWGame.cpp:81)
==22737==    by 0x747815: main (main.cpp:13)
2017-10-18 21:52:29 +01:00
Christoph Heiss
fab9047ef9 Update OpenGL loader files.
Generated using:
lua LoadGen.lua -style=noload_c -spec=gl -version=3.3 -profile=core core_3_3 -stdext=gl_ubiquitous.txt -stdext=gl_core_post_3_3.txt
2017-10-13 19:54:10 +01:00
Anonymous Maarten
02c60311ee rwlib/rwengine: make use of RW_ASSERT instead of assert 2017-09-16 22:19:39 +01:00
Anonymous Maarten
a1333360c5 rwlib: Add option to abort/break on failed checks or at request
- RW_ABORT/RW_ASSERT/RW_BREAKPOINT are only defined in debug mode
- the callback is needed to unlock the mouse when entering
    the debugger
2017-09-16 22:19:39 +01:00
Daniel Evans
ac8d6733cb Add clone methods to Clump, Atomic and ModelFrame to permit copying 2017-02-08 21:44:25 +00:00
Daniel Evans
d798509f93 Use Atomic instead of ModelFrame in ObjectRenderer 2017-02-08 21:44:25 +00:00
Daniel Evans
34c70b0be2 Allow ModelFrame, Atomic, Geometry to exist outside of a Clump
This changes the Clump data structure to simplify it and move some
of the concerns into the Atomic and Frame types.
2017-02-08 21:44:25 +00:00
Daniel Evans
a0eaf5b8b0 Move Atomic and Geometry out of Clump class 2017-02-08 21:44:25 +00:00
Daniel Evans
8e4d73fca9 Rename Model -> Clump 2017-02-08 21:44:25 +00:00
Daniel Evans
6ca849dd8f Drop alpha name from TextureArchive lookup 2016-12-03 21:59:37 +00:00
Daniel Evans
15427b8f99 Add texture lookup callback to LoaderDFF 2016-12-03 21:59:37 +00:00
Daniel Evans
8d10c80196 Remove all traces of WorkContext 2016-12-02 01:00:22 +00:00
Daniel Evans
7ad8ae5e40 Make loadTXD synchronous only 2016-12-02 00:42:38 +00:00
Daniel Evans
462479b992 Remove ResourceHandle.hpp 2016-10-05 22:38:35 +01:00
Daniel Evans
8a19f9b5d0 clang-format files in rwlib/source/platform 2016-09-09 21:13:21 +01:00
Daniel Evans
c4bb714e54 clang-format files in rwlib/source/gl 2016-09-09 21:13:21 +01:00
Daniel Evans
4308a55ee8 clang-format files in rwlib/source/data 2016-09-09 21:13:21 +01:00
Daniel Evans
1219075e1a clang-format files in rwlib/source/job 2016-09-09 21:13:21 +01:00
Daniel Evans
981d68713b clang-format files in rwlib/source/loaders 2016-09-09 21:13:21 +01:00
Daniel Evans
94cc76d36a clang-format files in rwlib/source/rw 2016-09-09 21:13:21 +01:00
Daniel Evans
239d19a310 Don't cast from wide chars to chars on windows 2016-09-09 00:07:17 +01:00
PerikiyoXD
62d0bf796a Fixed .native() and some cast errors
Signed-off-by: PerikiyoXD <perikiyoxd@gmail.com>
2016-09-08 21:17:30 +02:00
Daniel Evans
d7dea62f04 remove unused method FileIndex::findFile 2016-09-07 22:06:38 +01:00
dan
23e25ed751 Add new openFilePath method to FileIndex 2016-09-07 01:34:42 +01:00
Daniel Evans
674ce55af3 Replace findPathRealCase with FileIndex methods
This introduces indexGameDirectory and findFilePath.
indexGameDirectory indexes the files in the game directory.
findFilePath returns the on-disk location of a case-insensitive
game data path.
2016-09-06 00:23:25 +01:00
dan
772c93d463 Use correct header guards in FileHandle.hpp 2016-09-06 00:23:25 +01:00
Daniel Evans
ad7f3ba071 Use correct header guard in FileIndex.hpp 2016-09-06 00:23:25 +01:00
Jannik Vogel
571fd08631 Replace strcasecmp with boost::iequals 2016-08-12 02:14:15 +02:00
Jannik Vogel
cb347143f8 Cleanup: Replace non-std C++ code 2016-08-12 02:14:15 +02:00
Jannik Vogel
bda0107bb1 Cleanup: include-what-you-use 2016-08-12 02:14:15 +02:00
Daniel Evans
3a26d09b5f Delete a.out that shouldn't be here 2016-08-07 17:53:02 +01:00
Daniel Evans
a0057d1a01 Merge pull request #184 from darkf/omgthreadz
Fix the construction of WorkContext
2016-08-06 18:23:13 +01:00
darkf
0242868caa Use boost::make_iterator_range, as older boost lacks ranges in filesystem iterators 2016-08-06 08:43:28 -07:00
darkf
e58be26be8 Fix the construction of WorkContext
Previously the worker thread was constructed before the queue was, leading to
unfortunate race conditions. This fixes that, along with unrelated minor cleanup.
2016-08-05 09:42:03 -07:00
darkf
2147b3abdf Remove unneeded msdirent.h 2016-08-03 18:31:47 -07:00