MCPcopy Create free account
hub / github.com/REGoth-project/REGoth / loadTextureDDS

Method loadTextureDDS

src/content/Texture.cpp:32–61  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

30}
31
32Handle::TextureHandle TextureAllocator::loadTextureDDS(const std::vector<uint8_t>& data, const std::string& name)
33{
34 // Check if this was already loaded
35 auto it = m_TexturesByName.find(name);
36 if (it != m_TexturesByName.end())
37 return (*it).second;
38
39 // Make wrapper-object
40 Handle::TextureHandle h = m_Allocator.createObject();
41
42 m_Allocator.getElement(h).textureFormat = bgfx::TextureFormat::Unknown;
43 m_Allocator.getElement(h).imageData = data;
44 //m_Allocator.getElement(h).m_TextureHandle = bth;
45 m_Allocator.getElement(h).m_TextureName = name;
46
47 ZenLoad::DDSURFACEDESC2 desc = ZenLoad::getSurfaceDesc(data);
48 m_Allocator.getElement(h).m_Width = desc.dwWidth;
49 m_Allocator.getElement(h).m_Height = desc.dwHeight;
50
51 // Add handle to name-map, if it got one
52 if (!name.empty())
53 m_TexturesByName[name] = h;
54
55 // Flush the pipeline
56 // TODO: There must be something better than "frame"?
57 //bgfx::touch(0);
58 //bgfx::frame();
59
60 return h;
61}
62
63Handle::TextureHandle TextureAllocator::loadTextureRGBA8(const std::vector<uint8_t>& data, uint16_t width, uint16_t height, const std::string& name)
64{

Callers

nothing calls this directly

Calls 4

findMethod · 0.80
endMethod · 0.45
createObjectMethod · 0.45
emptyMethod · 0.45

Tested by

no test coverage detected