• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

Razakhel / RaZ / 9140897384

18 May 2024 03:32PM UTC coverage: 79.432% (+0.2%) from 79.221%
9140897384

push

github

Razakhel
[Data/PngFormat] Removed PngFormat in favor of ImageFormat

- PNG load/save is entirely handled by stb through ImageFormat

- Removed libpng

7940 of 9996 relevant lines covered (79.43%)

2094.14 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

90.0
/src/RaZ/Script/LuaFileFormat.cpp
1
#include "RaZ/Animation/Skeleton.hpp"
2
#include "RaZ/Audio/Sound.hpp"
3
#include "RaZ/Data/BvhFormat.hpp"
4
#if defined(RAZ_USE_FBX)
5
#include "RaZ/Data/FbxFormat.hpp"
6
#endif
7
#include "RaZ/Data/GltfFormat.hpp"
8
#include "RaZ/Data/Image.hpp"
9
#include "RaZ/Data/ImageFormat.hpp"
10
#include "RaZ/Data/Mesh.hpp"
11
#include "RaZ/Data/MeshFormat.hpp"
12
#include "RaZ/Data/ObjFormat.hpp"
13
#include "RaZ/Data/OffFormat.hpp"
14
#include "RaZ/Data/TgaFormat.hpp"
15
#if defined(RAZ_USE_AUDIO)
16
#include "RaZ/Data/WavFormat.hpp"
17
#endif
18
#include "RaZ/Render/MeshRenderer.hpp"
19
#include "RaZ/Script/LuaWrapper.hpp"
20
#include "RaZ/Utils/FilePath.hpp"
21
#include "RaZ/Utils/TypeUtils.hpp"
22

23
#define SOL_ALL_SAFETIES_ON 1
24
#include "sol/sol.hpp"
25

26
namespace Raz {
27

28
using namespace TypeUtils;
29

30
void LuaWrapper::registerFileFormatTypes() {
2✔
31
  sol::state& state = getState();
2✔
32

33
  {
34
    sol::table bvhFormat = state["BvhFormat"].get_or_create<sol::table>();
2✔
35
    bvhFormat["load"]    = &BvhFormat::load;
2✔
36
  }
2✔
37

38
#if defined(RAZ_USE_FBX)
39
  {
40
    sol::table fbxFormat = state["FbxFormat"].get_or_create<sol::table>();
41
    fbxFormat["load"]    = &FbxFormat::load;
42
  }
43
#endif
44

45
  {
46
    sol::table gltfFormat = state["GltfFormat"].get_or_create<sol::table>();
2✔
47
    gltfFormat["load"]    = &GltfFormat::load;
2✔
48
  }
2✔
49

50
  {
51
    sol::table imageFormat      = state["ImageFormat"].get_or_create<sol::table>();
2✔
52
    imageFormat["load"]         = sol::overload([] (const FilePath& p) { return ImageFormat::load(p); },
×
53
                                                PickOverload<const FilePath&, bool>(&ImageFormat::load));
2✔
54
    imageFormat["loadFromData"] = sol::overload([] (const std::vector<unsigned char>& d) { return ImageFormat::loadFromData(d); },
1✔
55
                                                PickOverload<const std::vector<unsigned char>&, bool>(&ImageFormat::loadFromData),
2✔
56
                                                [] (const unsigned char* d, std::size_t s) { return ImageFormat::loadFromData(d, s); },
×
57
                                                PickOverload<const unsigned char*, std::size_t, bool>(&ImageFormat::loadFromData));
4✔
58
    imageFormat["save"]         = sol::overload([] (const FilePath& p, const Image& i) { ImageFormat::save(p, i); },
×
59
                                                    PickOverload<const FilePath&, const Image&, bool>(&ImageFormat::save));
2✔
60
  }
2✔
61

62
  {
63
    sol::table meshFormat = state["MeshFormat"].get_or_create<sol::table>();
2✔
64
    meshFormat["load"]    = &MeshFormat::load;
2✔
65
    meshFormat["save"]    = sol::overload([] (const FilePath& p, const Mesh& m) { MeshFormat::save(p, m); },
1✔
66
                                          PickOverload<const FilePath&, const Mesh&, const MeshRenderer*>(&MeshFormat::save));
2✔
67
  }
2✔
68

69
  {
70
    sol::table objFormat = state["ObjFormat"].get_or_create<sol::table>();
2✔
71
    objFormat["load"]    = &ObjFormat::load;
2✔
72
    objFormat["save"]    = sol::overload([] (const FilePath& p, const Mesh& m) { ObjFormat::save(p, m); },
1✔
73
                                         PickOverload<const FilePath&, const Mesh&, const MeshRenderer*>(&ObjFormat::save));
2✔
74
  }
2✔
75

76
  {
77
    sol::table offFormat = state["OffFormat"].get_or_create<sol::table>();
2✔
78
    offFormat["load"]    = &OffFormat::load;
2✔
79
  }
2✔
80

81
  {
82
    sol::table tgaFormat = state["TgaFormat"].get_or_create<sol::table>();
2✔
83
    tgaFormat["load"]    = sol::overload([] (const FilePath& p) { return TgaFormat::load(p); },
×
84
                                         PickOverload<const FilePath&, bool>(&TgaFormat::load));
2✔
85
  }
2✔
86

87
#if defined(RAZ_USE_AUDIO)
88
  {
89
    sol::table wavFormat = state["WavFormat"].get_or_create<sol::table>();
2✔
90
    wavFormat["load"]    = &WavFormat::load;
2✔
91
    wavFormat["save"]    = &WavFormat::save;
2✔
92
  }
2✔
93
#endif
94
}
2✔
95

96
} // namespace Raz
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc