API Documentation
Loading...
Searching...
No Matches
QtVulkanSession.h
Go to the documentation of this file.
1#pragma once
6#include <QString>
7#include <QIODevice>
8#include <QFile>
9namespace NDEVR
10{
11 /**--------------------------------------------------------------------------------------------------
12 \brief A VulkanSession within the Qt space.
13 **/
15 {
16 public:
20 virtual void readShader(const String& shader) override
21 {
23 {
24 String shader_name = shader + "/" + VulkanShaderManager::formats[i];
25 ResourceResolver::ResolveResource("Shaders/" + shader_name + ".spv", [this, shader, i](bool success, const String& s)
26 {
27 if (success)
28 {
29 QFile file(s.getAs<QString>());
30 uint04 file_size = cast<uint04>(file.size());
31 Buffer<char> code(file_size, '\0');
32 success |= file.open(QIODevice::ReadOnly);
33 if (success)
34 {
35 code.setSize(cast<uint04>(file.read(code.begin(), cast<uint04>(file_size))));
36 shaderManager()->addShader(shader, cast<VulkanShaderManager::ShaderType>(i), code);
37 }
38 }
39 lib_assert(success, "Bad shader: " + s);
40 });
41
42 }
43 }
44 };
45}
#define lib_assert(expression, message)
Definition LibAssert.h:61
The equivelent of std::vector but with a bit more control. The basic array unit of the library.
Definition Buffer.hpp:56
void setSize(t_index_type new_size)
Definition Buffer.hpp:803
decltype(auto) begin()
Definition Buffer.hpp:402
Provides a modifiable pointer that has shared ownership of a dynamically allocated object.
Definition Pointer.hpp:320
A VulkanSession within the Qt space.
Definition QtVulkanSession.h:15
virtual void readShader(const String &shader) override
Definition QtVulkanSession.h:20
QtVulkanSession(const DynamicPointer< VulkanDevice > &device)
Definition QtVulkanSession.h:17
static bool ResolveResource(const String &resource, const std::function< void(bool, const String &)> &on_finished=nullptr, bool ensure_unzipped=false)
Attempts to resolved a resource. Resource could be in an online or offline database,...
The core String class for the NDEVR API.
Definition String.h:69
t_type getAs() const
Converts a string into an object. To use this function an object must have overwritten StringStream<t...
Definition String.h:143
Creates and manages the resources necessary for converting a DesignObjectLookup into 3D rendered data...
Definition VulkanSession.h:49
virtual const ConstPointer< GraphicsDevice > & device() const final override
Definition VulkanSession.h:56
DynamicPointer< VulkanShaderManager > shaderManager()
Definition VulkanSession.h:79
@ e_shader_type_size
Definition VulkanShader.h:79
static const String formats[6]
Definition VulkanShader.h:88
Definition ACIColor.h:37
uint32_t uint04
-Defines an alias representing a 4 byte, unsigned integer -Can represent exact integer values 0 throu...
Definition BaseValues.hpp:96
constexpr t_to cast(const Angle< t_from > &value)
Definition Angle.h:375