mirror of
https://github.com/bailwillharr/engine.git
synced 2024-09-21 04:51:18 +00:00
Fix string overrun error
This commit is contained in:
parent
dec9289d77
commit
d6848fffea
@ -870,6 +870,8 @@ gfx::Pipeline* GFXDevice::CreatePipeline(const gfx::PipelineInfo& info) {
|
|||||||
auto vertShaderCode = util::ReadTextFile(info.vert_shader_path);
|
auto vertShaderCode = util::ReadTextFile(info.vert_shader_path);
|
||||||
auto fragShaderCode = util::ReadTextFile(info.frag_shader_path);
|
auto fragShaderCode = util::ReadTextFile(info.frag_shader_path);
|
||||||
|
|
||||||
|
LOG_INFO("vert shader vector size: {}", vertShaderCode->size());
|
||||||
|
|
||||||
VkShaderModule vertShaderModule =
|
VkShaderModule vertShaderModule =
|
||||||
compileShader(pimpl->device.device, shaderc_vertex_shader,
|
compileShader(pimpl->device.device, shaderc_vertex_shader,
|
||||||
vertShaderCode->data(), info.vert_shader_path);
|
vertShaderCode->data(), info.vert_shader_path);
|
||||||
|
@ -39,7 +39,7 @@ uint32_t Scene::CreateEntity(const std::string& tag, uint32_t parent,
|
|||||||
|
|
||||||
auto t = AddComponent<TransformComponent>(id);
|
auto t = AddComponent<TransformComponent>(id);
|
||||||
|
|
||||||
t->position = {0.0f, 0.0f, 0.0f};
|
t->position = pos;
|
||||||
t->rotation = {};
|
t->rotation = {};
|
||||||
t->scale = {1.0f, 1.0f, 1.0f};
|
t->scale = {1.0f, 1.0f, 1.0f};
|
||||||
|
|
||||||
|
@ -13,7 +13,7 @@ std::unique_ptr<std::vector<char>> ReadTextFile(const std::string& path) {
|
|||||||
throw std::runtime_error("Unable to open file " + path);
|
throw std::runtime_error("Unable to open file " + path);
|
||||||
}
|
}
|
||||||
|
|
||||||
auto buffer = std::make_unique<std::vector<char>>(file.tellg());
|
auto buffer = std::make_unique<std::vector<char>>(static_cast<size_t>(file.tellg()) + 1);
|
||||||
|
|
||||||
file.seekg(0);
|
file.seekg(0);
|
||||||
|
|
||||||
@ -27,6 +27,9 @@ std::unique_ptr<std::vector<char>> ReadTextFile(const std::string& path) {
|
|||||||
++i;
|
++i;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// append zero byte
|
||||||
|
buffer->data()[buffer->size()] = '\0';
|
||||||
|
|
||||||
file.close();
|
file.close();
|
||||||
|
|
||||||
return buffer;
|
return buffer;
|
||||||
|
@ -30,12 +30,6 @@ void CameraControllerSystem::OnUpdate(float ts) {
|
|||||||
|
|
||||||
const float dt = ts;
|
const float dt = ts;
|
||||||
|
|
||||||
constexpr float G = 9.8f;
|
|
||||||
|
|
||||||
glm::vec3 dir =
|
|
||||||
glm::normalize(glm::rotateY(glm::vec3{1.0f, 0.0f, 0.0f}, c->yaw) +
|
|
||||||
glm::rotateY(glm::vec3{0.0f, 0.0f, 1.0f}, c->yaw));
|
|
||||||
|
|
||||||
// in metres per second
|
// in metres per second
|
||||||
float speed = c->kWalkSpeed;
|
float speed = c->kWalkSpeed;
|
||||||
if (scene_->app()->input_manager()->GetButton("sprint")) speed *= 10.0f;
|
if (scene_->app()->input_manager()->GetButton("sprint")) speed *= 10.0f;
|
||||||
|
Loading…
Reference in New Issue
Block a user