12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152 |
- #pragma once
-
- #include <DK.h>
-
- // simple wrapper of dk mesh
-
- class StaticMesh
- {
- public:
- StaticMesh();
-
- bool LoadMeshResourceFromFile(DKObject<DKGraphicsDevice> inDevice
- , DKResourcePool& inDKResourcePool, const DKString& inFileName);
-
- bool LoadShaderFromFile(DKResourcePool& inDKResourcePool
- , const DKString& inFileName
- , DKShaderStage inStage);
-
- // Should be seperated
- bool LoadTextureFromFile(DKResourcePool& inDKResourcePool
- , const DKString& inFileName);
-
- bool LoadRenderResourceTexture(DKObject<DKCommandQueue> queue);
- bool LoadRenderResourceShader(DKObject<DKGraphicsDevice> inDevice,
- DKShaderStage inStage);
-
- DKObject<DKMesh> Mesh() { return mesh; }
-
- void SetupPipelineDecriptor(DKRenderPipelineDescriptor& pipelineDescriptor);
- void SetupMaterial(DKObject<DKGraphicsDevice> inDevice);
- void SetupExternalUniformBuffer(DKObject<DKGpuBuffer> uniformBuffer
- , size_t uniformBufferSize, int index);
-
- bool EncodeRenderCommand(DKRenderCommandEncoder* encoder) const;
-
- private:
- DKString fileName;
- DKObject<DKMesh> mesh;
-
- // Temporary variables before material work
- DKObject<DKImage> textureSrc;
-
- DKObject<DKTexture> texture;
- DKObject<DKSamplerState> textureSampler;
-
- DKObject<DKShaderBindingSet> bindSet;
- DKObject<DKData> shaderData[static_cast<int>(DKShaderStage::Compute)];
- DKObject<DKShaderModule> shaderModule[static_cast<int>(DKShaderStage::Compute)];
- DKObject<DKShaderFunction> shaderFunction[static_cast<int>(DKShaderStage::Compute)];
-
- DKAabb aabb;
- };
|