Function fro getting asset base path depending on operating system
This commit is contained in:
parent
d7bbb0c7a2
commit
29ac49fb6a
2 changed files with 15 additions and 6 deletions
|
|
@ -86,6 +86,15 @@ std::string VulkanExampleBase::getWindowTitle()
|
|||
return windowTitle;
|
||||
}
|
||||
|
||||
const std::string VulkanExampleBase::getAssetPath()
|
||||
{
|
||||
#if defined(__ANDROID__)
|
||||
return "";
|
||||
#else
|
||||
return "./../data/";
|
||||
#endif
|
||||
}
|
||||
|
||||
bool VulkanExampleBase::checkCommandBuffers()
|
||||
{
|
||||
for (auto& cmdBuffer : drawCmdBuffers)
|
||||
|
|
@ -213,15 +222,15 @@ void VulkanExampleBase::prepare()
|
|||
textureLoader = new vkTools::VulkanTextureLoader(physicalDevice, device, queue, cmdPool);
|
||||
}
|
||||
|
||||
VkPipelineShaderStageCreateInfo VulkanExampleBase::loadShader(const char * fileName, VkShaderStageFlagBits stage)
|
||||
VkPipelineShaderStageCreateInfo VulkanExampleBase::loadShader(std::string fileName, VkShaderStageFlagBits stage)
|
||||
{
|
||||
VkPipelineShaderStageCreateInfo shaderStage = {};
|
||||
shaderStage.sType = VK_STRUCTURE_TYPE_PIPELINE_SHADER_STAGE_CREATE_INFO;
|
||||
shaderStage.stage = stage;
|
||||
#if defined(__ANDROID__)
|
||||
shaderStage.module = vkTools::loadShader(androidApp->activity->assetManager, fileName, device, stage);
|
||||
shaderStage.module = vkTools::loadShader(androidApp->activity->assetManager, fileName.c_str(), device, stage);
|
||||
#else
|
||||
shaderStage.module = vkTools::loadShader(fileName, device, stage);
|
||||
shaderStage.module = vkTools::loadShader(fileName.c_str(), device, stage);
|
||||
#endif
|
||||
shaderStage.pName = "main"; // todo : make param
|
||||
assert(shaderStage.module != NULL);
|
||||
|
|
|
|||
|
|
@ -112,10 +112,10 @@ protected:
|
|||
// Command buffer submission and execution
|
||||
VkSemaphore renderComplete;
|
||||
} semaphores;
|
||||
|
||||
|
||||
// Simple texture loader
|
||||
vkTools::VulkanTextureLoader *textureLoader = nullptr;
|
||||
// Returns the base asset path (for shaders, models, textures) depending on the os
|
||||
const std::string getAssetPath();
|
||||
public:
|
||||
bool prepared = false;
|
||||
uint32_t width = 1280;
|
||||
|
|
@ -247,7 +247,7 @@ public:
|
|||
virtual void prepare();
|
||||
|
||||
// Load a SPIR-V shader
|
||||
VkPipelineShaderStageCreateInfo loadShader(const char* fileName, VkShaderStageFlagBits stage);
|
||||
VkPipelineShaderStageCreateInfo loadShader(std::string fileName, VkShaderStageFlagBits stage);
|
||||
|
||||
// Create a buffer, fill it with data and bind buffer memory
|
||||
// Can be used for e.g. vertex or index buffer based on mesh data
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue