small fixes
This commit is contained in:
@@ -14,6 +14,7 @@
|
||||
#include "Scene/SimpleDrawable.hpp"
|
||||
#include "Scene/UI/PerformanceInfo.hpp"
|
||||
#include "Scene/UniformBuffer.hpp"
|
||||
#include "Scene/BillboardControlBlock.hpp"
|
||||
#include "Input/InputManager.hpp"
|
||||
#include "Host/GraphicsAppManager.hpp"
|
||||
#include "Host/GLFW/WindowGLFW.hpp"
|
||||
@@ -31,12 +32,6 @@ namespace OpenVulkano
|
||||
{
|
||||
public:
|
||||
|
||||
struct BillboardControlBlock
|
||||
{
|
||||
Math::Vector2f quadSize;
|
||||
bool isFixedSize;
|
||||
};
|
||||
|
||||
void Init() override
|
||||
{
|
||||
auto engineConfig = OpenVulkano::EngineConfiguration::GetEngineConfiguration();
|
||||
@@ -55,14 +50,14 @@ namespace OpenVulkano
|
||||
m_quadBillboardShader.AddShaderProgram(OpenVulkano::ShaderProgramType::FRAGMENT, "Shader/basic");
|
||||
m_quadBillboardShader.AddVertexInputDescription(OpenVulkano::Vertex::GetVertexInputDescription());
|
||||
m_quadBillboardShader.AddDescriptorSetLayoutBinding(Texture::DESCRIPTOR_SET_LAYOUT_BINDING);
|
||||
m_quadBillboardShader.AddDescriptorSetLayoutBinding(UniformBuffer::DESCRIPTOR_SET_LAYOUT_BINDING);
|
||||
m_quadBillboardShader.AddDescriptorSetLayoutBinding(UniformBuffer::DESCRIPTOR_SET_LAYOUT_BINDING, 4);
|
||||
m_quadBillboardShader.topology = Topology::POINT_LIST;
|
||||
|
||||
m_shader.AddShaderProgram(OpenVulkano::ShaderProgramType::VERTEX, "Shader/billboard");
|
||||
m_shader.AddShaderProgram(OpenVulkano::ShaderProgramType::FRAGMENT, "Shader/basic");
|
||||
m_shader.AddVertexInputDescription(OpenVulkano::Vertex::GetVertexInputDescription());
|
||||
m_shader.AddDescriptorSetLayoutBinding(Texture::DESCRIPTOR_SET_LAYOUT_BINDING);
|
||||
m_shader.AddDescriptorSetLayoutBinding(UniformBuffer::DESCRIPTOR_SET_LAYOUT_BINDING);
|
||||
m_shader.AddDescriptorSetLayoutBinding(UniformBuffer::DESCRIPTOR_SET_LAYOUT_BINDING, 4);
|
||||
m_shader.cullMode = CullMode::NONE;
|
||||
|
||||
constexpr int quadsCnt = 7;
|
||||
@@ -72,7 +67,7 @@ namespace OpenVulkano
|
||||
m_bbContolBlock.quadSize = { 100.f, 100.f };
|
||||
m_bbContolBlock.isFixedSize = false;
|
||||
m_uniBuffer.Init(sizeof(BillboardControlBlock), &m_bbContolBlock);
|
||||
m_uniBuffer.setId = 3;
|
||||
m_uniBuffer.setId = 4;
|
||||
m_drawablesPool.resize(cntDrawables);
|
||||
m_nodesPool.resize(cntDrawables);
|
||||
m_geo.resize(cntDrawables);
|
||||
|
||||
@@ -38,6 +38,8 @@ namespace OpenVulkano
|
||||
using namespace Math;
|
||||
namespace fs = std::filesystem;
|
||||
|
||||
//#define CREATE_NEW_ATLAS 1
|
||||
|
||||
class TextExampleAppImpl final : public TextExampleApp
|
||||
{
|
||||
public:
|
||||
@@ -68,12 +70,12 @@ namespace OpenVulkano
|
||||
m_nodesPool.resize(N * 2);
|
||||
m_drawablesPool.resize(N * 2);
|
||||
|
||||
#ifdef MSDFGEN_AVAILABLE
|
||||
#if defined(MSDFGEN_AVAILABLE) && defined(CREATE_NEW_ATLAS)
|
||||
msdf_atlas::Charset charset = SdfFontAtlasGenerator::LoadAllGlyphs(fontPath);
|
||||
m_atlasGenerator.GenerateAtlas(fontPath, charset);
|
||||
m_msdfAtlasGenerator.GenerateAtlas(fontPath, charset);
|
||||
#else
|
||||
auto sdfMetadataInfo = resourceLoader.GetResource("sdf_atlas_packed");
|
||||
auto sdfMetadataInfo = resourceLoader.GetResource("sdf_atlas_packed.png");
|
||||
auto msdfMetadataInfo = resourceLoader.GetResource("msdf_atlas_packed.png");
|
||||
#endif
|
||||
|
||||
@@ -81,7 +83,7 @@ namespace OpenVulkano
|
||||
{
|
||||
int textIdx = i % texts.size();
|
||||
TextDrawable* t = nullptr;
|
||||
#ifdef MSDFGEN_AVAILABLE
|
||||
#if defined(MSDFGEN_AVAILABLE) && defined(CREATE_NEW_ATLAS)
|
||||
if (i < texts.size())
|
||||
{
|
||||
t = new TextDrawable(&m_atlasGenerator, texts[textIdx].second);
|
||||
|
||||
18
openVulkanoCpp/Scene/BillboardControlBlock.hpp
Normal file
18
openVulkanoCpp/Scene/BillboardControlBlock.hpp
Normal file
@@ -0,0 +1,18 @@
|
||||
/*
|
||||
* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "Math/Math.hpp"
|
||||
|
||||
namespace OpenVulkano::Scene
|
||||
{
|
||||
struct BillboardControlBlock
|
||||
{
|
||||
Math::Vector2f quadSize = { 100.f, 100.f };
|
||||
int32_t isFixedSize = false;
|
||||
};
|
||||
}
|
||||
@@ -60,8 +60,10 @@ namespace OpenVulkano::Scene
|
||||
ShaderProgram(ShaderProgramType type, const std::string& name) : type(type), name(name) {}
|
||||
|
||||
ShaderProgram(const ShaderProgram& program) = default;
|
||||
ShaderProgram& operator=(const ShaderProgram& program) = default;
|
||||
|
||||
ShaderProgram(ShaderProgram&& program) noexcept : type(program.type), name(std::move(program.name)) {}
|
||||
ShaderProgram(ShaderProgram&& program) noexcept = default;
|
||||
ShaderProgram& operator=(ShaderProgram&& program) noexcept = default;
|
||||
|
||||
[[nodiscard]] std::string GetShaderNameOpenGL() const
|
||||
{
|
||||
|
||||
@@ -21,7 +21,7 @@ layout(set = 1, binding = 0) uniform CameraData
|
||||
vec4 camPos;
|
||||
} cam;
|
||||
|
||||
layout(set = 3, binding = 0) uniform BillboardData
|
||||
layout(set = 4, binding = 0) uniform BillboardData
|
||||
{
|
||||
vec2 size;
|
||||
bool isFixedSize;
|
||||
|
||||
@@ -24,7 +24,7 @@ layout(set = 1, binding = 0) uniform CameraData
|
||||
float pixelScaleFactor;
|
||||
} cam;
|
||||
|
||||
layout(set = 3, binding = 0) uniform BillboardData
|
||||
layout(set = 4, binding = 0) uniform BillboardData
|
||||
{
|
||||
vec2 size;
|
||||
bool isFixedSize;
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
#version 450
|
||||
|
||||
layout(location = 0) in vec2 texCoord;
|
||||
layout(location = 1) in vec2 texCoord;
|
||||
|
||||
layout(location = 0) out vec4 outColor;
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
#version 450
|
||||
|
||||
layout(location = 0) in vec2 texCoord;
|
||||
layout(location = 1) in vec2 texCoord;
|
||||
|
||||
layout(location = 0) out vec4 outColor;
|
||||
|
||||
|
||||
@@ -5,7 +5,7 @@ layout(location = 2) in vec3 tangent;
|
||||
layout(location = 3) in vec3 biTangent;
|
||||
layout(location = 4) in vec3 textureCoordinates;
|
||||
layout(location = 5) in vec4 color;
|
||||
layout(location = 0) out vec2 fragTextureCoordinates;
|
||||
layout(location = 1) out vec2 fragTextureCoordinates;
|
||||
|
||||
layout(set = 0, binding = 0) uniform NodeData
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user