mirror of
https://github.com/bailwillharr/engine.git
synced 2024-09-21 04:51:18 +00:00
tidy up graphics code
This commit is contained in:
parent
7e2da23398
commit
6d49f022ec
@ -22,14 +22,22 @@ class GFXDevice {
|
||||
|
||||
gfx::DrawBuffer* BeginRender();
|
||||
|
||||
/* - draw_buffer MUST be a valid pointer returned by BeginRender().
|
||||
- draw_buffer is invalid after this function has been called. */
|
||||
void FinishRender(gfx::DrawBuffer* draw_buffer);
|
||||
|
||||
/* - draw_buffer MUST be a valid pointer returned by BeginRender()
|
||||
- pipeline MUST be a valid pointer returned by CreatePipeline() */
|
||||
void CmdBindPipeline(gfx::DrawBuffer* draw_buffer,
|
||||
const gfx::Pipeline* pipeline);
|
||||
|
||||
/* - draw_buffer MUST be a valid pointer returned by BeginRender()
|
||||
- buffer MUST be a valid pointer returned by CreateBuffer */
|
||||
void CmdBindVertexBuffer(gfx::DrawBuffer* draw_buffer, uint32_t binding,
|
||||
const gfx::Buffer* buffer);
|
||||
|
||||
/* - draw_buffer MUST be a valid pointer returned by BeginRender()
|
||||
- buffer MUST be a valid pointer returned by CreateBuffer */
|
||||
void CmdBindIndexBuffer(gfx::DrawBuffer* draw_buffer,
|
||||
const gfx::Buffer* buffer);
|
||||
|
||||
@ -57,6 +65,8 @@ class GFXDevice {
|
||||
gfx::DescriptorSet* AllocateDescriptorSet(
|
||||
const gfx::DescriptorSetLayout* layout);
|
||||
|
||||
void FreeDescriptorSet(const gfx::DescriptorSet* set);
|
||||
|
||||
// This updates all copies of the descriptor.
|
||||
// This cannot be used after any frames have been renderered
|
||||
void UpdateDescriptorUniformBuffer(const gfx::DescriptorSet* set,
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -55,7 +55,7 @@ std::unique_ptr<std::vector<uint8_t>> Font::GetTextBitmap(
|
||||
|
||||
CharacterRenderInfo renderInfo{};
|
||||
|
||||
renderInfo.advance = advanceWidth * sf;
|
||||
renderInfo.advance = static_cast<int>(static_cast<float>(advanceWidth) * sf);
|
||||
|
||||
if (stbtt_IsGlyphEmpty(font_info_.get(), glyph_index) == 0) {
|
||||
renderInfo.isEmpty = false;
|
||||
|
@ -100,6 +100,7 @@ Texture::Texture(RenderData* render_data, const uint8_t* bitmap, int width,
|
||||
|
||||
Texture::~Texture() {
|
||||
LOG_INFO("Destroying texture...");
|
||||
gfx_->FreeDescriptorSet(descriptor_set_);
|
||||
gfx_->DestroyImage(image_);
|
||||
}
|
||||
|
||||
|
@ -175,16 +175,18 @@ void PlayGame(GameSettings settings) {
|
||||
time_elapsed += ts;
|
||||
if (time_elapsed >= 1.0f) {
|
||||
time_elapsed = 0;
|
||||
LOG_INFO("Time step: {}", ts);
|
||||
|
||||
int fpsWidth, fpsHeight;
|
||||
auto fpsBitmap =
|
||||
LOG_INFO("Creating new bitmap...");
|
||||
/*auto fpsBitmap =
|
||||
app.GetResource<engine::resources::Font>("builtin.mono")
|
||||
->GetTextBitmap("fps", 768.0f, fpsWidth, fpsHeight);
|
||||
textbox_renderable->material->texture_ =
|
||||
->GetTextBitmap(std::to_string(ts), 768.0f, fpsWidth, fpsHeight);*/
|
||||
LOG_INFO("Bitmap created! Loading into new texture...");
|
||||
/*textbox_renderable->material->texture_ =
|
||||
std::make_unique<engine::resources::Texture>(
|
||||
&app.render_data_, fpsBitmap->data(), fpsWidth, fpsHeight,
|
||||
engine::resources::Texture::Filtering::kBilinear);
|
||||
engine::resources::Texture::Filtering::kBilinear);*/
|
||||
LOG_INFO("Texture created!");
|
||||
}
|
||||
};
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user