initial commit-moved from vulkan_guide

This commit is contained in:
2025-10-10 22:53:54 +09:00
commit 8853429937
2484 changed files with 973414 additions and 0 deletions

42
src/render/vk_materials.h Normal file
View File

@@ -0,0 +1,42 @@
#pragma once
#include <core/vk_types.h>
#include <core/vk_descriptors.h>
class VulkanEngine;
struct GLTFMetallic_Roughness
{
MaterialPipeline opaquePipeline;
MaterialPipeline transparentPipeline;
MaterialPipeline gBufferPipeline;
VkDescriptorSetLayout materialLayout;
struct MaterialConstants
{
glm::vec4 colorFactors;
glm::vec4 metal_rough_factors;
glm::vec4 extra[14];
};
struct MaterialResources
{
AllocatedImage colorImage;
VkSampler colorSampler;
AllocatedImage metalRoughImage;
VkSampler metalRoughSampler;
VkBuffer dataBuffer;
uint32_t dataBufferOffset;
};
DescriptorWriter writer;
void build_pipelines(VulkanEngine *engine);
void clear_resources(VkDevice device) const;
MaterialInstance write_material(VkDevice device, MaterialPass pass, const MaterialResources &resources,
DescriptorAllocatorGrowable &descriptorAllocator);
};