16#include "vulkan/vulkan.h"
22#define GLM_FORCE_RADIANS
23#define GLM_FORCE_DEPTH_ZERO_TO_ONE
25#include <glm/gtc/matrix_transform.hpp>
26#include <glm/gtc/type_ptr.hpp>
28#define TINYGLTF_NO_STB_IMAGE_WRITE
29#ifdef VK_USE_PLATFORM_ANDROID_KHR
30#define TINYGLTF_ANDROID_LOAD_FROM_ASSETS
34#if defined(__ANDROID__)
35#include <android/asset_manager.h>
72 void fromglTfImage(tinygltf::Image& gltfimage, std::string path);
113 glm::vec3
min = glm::vec3(FLT_MAX);
114 glm::vec3
max = glm::vec3(-FLT_MAX);
129 Mesh(glm::mat4 matrix);
211 float start = std::numeric_limits<float>::max();
212 float end = std::numeric_limits<float>::min();
233 static std::vector<VkVertexInputAttributeDescription>
inputAttributeDescriptions(uint32_t binding,
const std::vector<VertexComponent> components);
260 void loadNode(
vkglTF::Node* parent,
const tinygltf::Node& node, uint32_t nodeIndex,
const tinygltf::Model& model, std::vector<uint32_t>& indexBuffer, std::vector<Vertex>& vertexBuffer,
float globalscale);
261 void loadSkins(tinygltf::Model& gltfModel);
267 void drawNode(
Node* node, VkCommandBuffer commandBuffer, uint32_t renderFlags = 0, VkPipelineLayout pipelineLayout = VK_NULL_HANDLE, uint32_t bindImageSet = 1);
268 void draw(VkCommandBuffer commandBuffer, uint32_t renderFlags = 0, VkPipelineLayout pipelineLayout = VK_NULL_HANDLE, uint32_t bindImageSet = 1);
308 glm::vec3
min = glm::vec3(FLT_MAX);
309 glm::vec3
max = glm::vec3(-FLT_MAX);
vkglTF::Texture * specularGlossinessTexture
vkglTF::Texture * diffuseTexture
Material(dyno::VkContext *device)
vkglTF::Texture * metallicRoughnessTexture
VkDescriptorSet descriptorSet
void createDescriptorSet(VkDescriptorPool descriptorPool, VkDescriptorSetLayout descriptorSetLayout, uint32_t descriptorBindingFlags)
vkglTF::Texture * normalTexture
glm::vec4 baseColorFactor
vkglTF::Texture * occlusionTexture
vkglTF::Texture * emissiveTexture
vkglTF::Texture * baseColorTexture
void loadFromFile(std::string filename, uint32_t fileLoadingFlags=vkglTF::FileLoadingFlags::None, float scale=1.0f)
void drawNode(Node *node, VkCommandBuffer commandBuffer, uint32_t renderFlags=0, VkPipelineLayout pipelineLayout=VK_NULL_HANDLE, uint32_t bindImageSet=1)
struct vkglTF::Model::Indices indices
void loadNode(vkglTF::Node *parent, const tinygltf::Node &node, uint32_t nodeIndex, const tinygltf::Model &model, std::vector< uint32_t > &indexBuffer, std::vector< Vertex > &vertexBuffer, float globalscale)
std::vector< Node * > nodes
struct vkglTF::Model::Vertices vertices
void bindBuffers(VkCommandBuffer commandBuffer)
vkglTF::Texture * getTexture(uint32_t index)
void getSceneDimensions()
std::vector< Texture > textures
void loadMaterials(tinygltf::Model &gltfModel)
void createEmptyTexture(VkQueue transferQueue)
void prepareNodeDescriptor(vkglTF::Node *node, VkDescriptorSetLayout descriptorSetLayout)
void updateAnimation(uint32_t index, float time)
VkDescriptorPool descriptorPool
Node * findNode(Node *parent, uint32_t index)
void getNodeDimensions(Node *node, glm::vec3 &min, glm::vec3 &max)
std::vector< Material > materials
void loadAnimations(tinygltf::Model &gltfModel)
std::vector< Animation > animations
std::vector< Skin * > skins
bool metallicRoughnessWorkflow
std::vector< Node * > linearNodes
void draw(VkCommandBuffer commandBuffer, uint32_t renderFlags=0, VkPipelineLayout pipelineLayout=VK_NULL_HANDLE, uint32_t bindImageSet=1)
Node * nodeFromIndex(uint32_t index)
void loadImages(tinygltf::Model &gltfModel)
vkglTF::Texture emptyTexture
struct vkglTF::Model::Dimensions dimensions
void loadSkins(tinygltf::Model &gltfModel)
void fromglTfImage(tinygltf::Image &gltfimage, std::string path)
VkDescriptorImageInfo descriptor
VkImageLayout imageLayout
VkDeviceMemory deviceMemory
VkDescriptorSetLayout descriptorSetLayoutImage
VkMemoryPropertyFlags memoryPropertyFlags
VkDescriptorSetLayout descriptorSetLayoutUbo
uint32_t descriptorBindingFlags
@ PreMultiplyVertexColors
@ RenderAlphaBlendedNodes
std::vector< AnimationSampler > samplers
std::vector< AnimationChannel > channels
InterpolationType interpolation
std::vector< glm::vec4 > outputsVec4
std::vector< float > inputs
std::vector< Primitive * > primitives
struct vkglTF::Mesh::UniformBuffer uniformBuffer
struct vkglTF::Mesh::UniformBlock uniformBlock
std::vector< Node * > children
Primitive(uint32_t firstIndex, uint32_t indexCount, Material &material)
struct vkglTF::Primitive::Dimensions dimensions
void setDimensions(glm::vec3 min, glm::vec3 max)
std::vector< glm::mat4 > inverseBindMatrices
std::vector< Node * > joints
static std::vector< VkVertexInputAttributeDescription > vertexInputAttributeDescriptions
static VkVertexInputAttributeDescription inputAttributeDescription(uint32_t binding, uint32_t location, VertexComponent component)
static VkPipelineVertexInputStateCreateInfo * getPipelineVertexInputState(const std::vector< VertexComponent > components)
Returns the default pipeline vertex input state create info structure for the requested vertex compon...
static VkVertexInputBindingDescription inputBindingDescription(uint32_t binding)
static std::vector< VkVertexInputAttributeDescription > inputAttributeDescriptions(uint32_t binding, const std::vector< VertexComponent > components)
static VkPipelineVertexInputStateCreateInfo pipelineVertexInputStateCreateInfo
static VkVertexInputBindingDescription vertexInputBindingDescription