mirror of
https://github.com/bailwillharr/engine.git
synced 2024-09-21 04:51:18 +00:00
change reference to pointer
This commit is contained in:
parent
15d62ecf6b
commit
8cbcce5ce4
@ -20,7 +20,7 @@ public:
|
||||
ANISOTROPIC,
|
||||
};
|
||||
|
||||
Texture(RenderData& renderData, const std::string& path, Filtering filtering);
|
||||
Texture(RenderData* renderData, const std::string& path, Filtering filtering);
|
||||
~Texture();
|
||||
Texture(const Texture&) = delete;
|
||||
Texture& operator=(const Texture&) = delete;
|
||||
|
@ -143,7 +143,7 @@ namespace engine {
|
||||
}
|
||||
{
|
||||
auto whiteTexture = std::make_unique<resources::Texture>(
|
||||
renderData,
|
||||
&renderData,
|
||||
getResourcePath("engine/textures/white.png"),
|
||||
resources::Texture::Filtering::OFF
|
||||
);
|
||||
|
@ -8,8 +8,8 @@
|
||||
|
||||
namespace engine::resources {
|
||||
|
||||
Texture::Texture(RenderData& renderData, const std::string& path, Filtering filtering)
|
||||
: m_gfxDevice(renderData.gfxdev.get())
|
||||
Texture::Texture(RenderData* renderData, const std::string& path, Filtering filtering)
|
||||
: m_gfxDevice(renderData->gfxdev.get())
|
||||
{
|
||||
|
||||
int width, height;
|
||||
@ -41,13 +41,13 @@ Texture::Texture(RenderData& renderData, const std::string& path, Filtering filt
|
||||
samplerInfo.anisotropicFiltering = true;
|
||||
}
|
||||
|
||||
if (renderData.samplers.contains(samplerInfo) == false) {
|
||||
renderData.samplers.insert(std::make_pair(samplerInfo, m_gfxDevice->createSampler(samplerInfo)));
|
||||
if (renderData->samplers.contains(samplerInfo) == false) {
|
||||
renderData->samplers.insert(std::make_pair(samplerInfo, m_gfxDevice->createSampler(samplerInfo)));
|
||||
}
|
||||
|
||||
m_image = m_gfxDevice->createImage(width, height, texbuf->data());
|
||||
m_descriptorSet = m_gfxDevice->allocateDescriptorSet(renderData.materialSetLayout);
|
||||
m_gfxDevice->updateDescriptorCombinedImageSampler(m_descriptorSet, 0, m_image, renderData.samplers.at(samplerInfo));
|
||||
m_descriptorSet = m_gfxDevice->allocateDescriptorSet(renderData->materialSetLayout);
|
||||
m_gfxDevice->updateDescriptorCombinedImageSampler(m_descriptorSet, 0, m_image, renderData->samplers.at(samplerInfo));
|
||||
|
||||
LOG_INFO("Loaded texture: {}, width: {} height: {}", path, width, height);
|
||||
|
||||
|
@ -182,7 +182,7 @@ namespace engine::util {
|
||||
absPath /= texPath.C_Str();
|
||||
try {
|
||||
textures[i] = std::make_shared<resources::Texture>(
|
||||
parent->app()->renderData, absPath.string(),
|
||||
&parent->app()->renderData, absPath.string(),
|
||||
resources::Texture::Filtering::TRILINEAR);
|
||||
} catch (const std::runtime_error&) {
|
||||
textures[i] = parent->app()->getResource<resources::Texture>("builtin.white");
|
||||
|
@ -84,12 +84,12 @@ void playGame(GameSettings settings)
|
||||
|
||||
/* shared resources */
|
||||
auto grassTexture = std::make_shared<engine::resources::Texture>(
|
||||
app.renderData,
|
||||
&app.renderData,
|
||||
app.getResourcePath("textures/grass.jpg"),
|
||||
engine::resources::Texture::Filtering::ANISOTROPIC
|
||||
);
|
||||
auto spaceTexture = std::make_shared<engine::resources::Texture>(
|
||||
app.renderData,
|
||||
&app.renderData,
|
||||
app.getResourcePath("textures/space2.png"),
|
||||
engine::resources::Texture::Filtering::ANISOTROPIC
|
||||
);
|
||||
|
Loading…
Reference in New Issue
Block a user