Fix some cutscene bugs
This commit is contained in:
parent
7a526a4cab
commit
8ea112e26c
2 changed files with 20 additions and 16 deletions
|
@ -102,24 +102,27 @@ void CommonEditor::update(float deltaTime) {
|
|||
platform::capture_mouse(willCaptureMouse);
|
||||
|
||||
if(willCaptureMouse) {
|
||||
yaw += engine->get_input()->get_value("lookX") * 50.0f * deltaTime;
|
||||
pitch += engine->get_input()->get_value("lookY") * 50.0f * deltaTime;
|
||||
|
||||
const float speed = 7.00f;
|
||||
if(engine->get_scene() != nullptr && !engine->get_scene()->get_all<Camera>().empty()) {
|
||||
|
||||
prism::float3 forward, right;
|
||||
forward = normalize(angle_axis(yaw, prism::float3(0, 1, 0)) * angle_axis(pitch, prism::float3(1, 0, 0)) * prism::float3(0, 0, 1));
|
||||
right = normalize(angle_axis(yaw, prism::float3(0, 1, 0)) * prism::float3(1, 0, 0));
|
||||
yaw += engine->get_input()->get_value("lookX") * 50.0f * deltaTime;
|
||||
pitch += engine->get_input()->get_value("lookY") * 50.0f * deltaTime;
|
||||
|
||||
float movX = engine->get_input()->get_value("movementX");
|
||||
float movY = engine->get_input()->get_value("movementY");
|
||||
const float speed = 7.00f;
|
||||
|
||||
prism::float3 forward, right;
|
||||
forward = normalize(angle_axis(yaw, prism::float3(0, 1, 0)) * angle_axis(pitch, prism::float3(1, 0, 0)) * prism::float3(0, 0, 1));
|
||||
right = normalize(angle_axis(yaw, prism::float3(0, 1, 0)) * prism::float3(1, 0, 0));
|
||||
|
||||
auto [obj, cam] = engine->get_scene()->get_all<Camera>()[0];
|
||||
float movX = engine->get_input()->get_value("movementX");
|
||||
float movY = engine->get_input()->get_value("movementY");
|
||||
|
||||
engine->get_scene()->get<Transform>(obj).position += right * movX * speed * deltaTime;
|
||||
engine->get_scene()->get<Transform>(obj).position += forward * -movY * speed * deltaTime;
|
||||
auto [obj, cam] = engine->get_scene()->get_all<Camera>()[0];
|
||||
|
||||
engine->get_scene()->get<Transform>(obj).rotation = angle_axis(yaw, prism::float3(0, 1, 0)) * angle_axis(pitch, prism::float3(1, 0, 0));
|
||||
engine->get_scene()->get<Transform>(obj).position += right * movX * speed * deltaTime;
|
||||
engine->get_scene()->get<Transform>(obj).position += forward * -movY * speed * deltaTime;
|
||||
|
||||
engine->get_scene()->get<Transform>(obj).rotation = angle_axis(yaw, prism::float3(0, 1, 0)) * angle_axis(pitch, prism::float3(1, 0, 0));
|
||||
}
|
||||
}
|
||||
|
||||
doing_viewport_input = willCaptureMouse;
|
||||
|
@ -925,7 +928,7 @@ GFXTexture* CommonEditor::generate_common_preview(Scene& scene, const prism::flo
|
|||
texture_create_info.width = thumbnail_resolution;
|
||||
texture_create_info.height = thumbnail_resolution;
|
||||
texture_create_info.format = GFXPixelFormat::RGBA8_UNORM;
|
||||
texture_create_info.usage = GFXTextureUsage::Attachment | GFXTextureUsage::Sampled;
|
||||
texture_create_info.usage = GFXTextureUsage::Attachment | GFXTextureUsage::Sampled | GFXTextureUsage::TransferDst;
|
||||
|
||||
auto final_texture = gfx->create_texture(texture_create_info);
|
||||
|
||||
|
@ -1085,7 +1088,7 @@ void CommonEditor::load_thumbnail_cache() {
|
|||
info.width = thumbnail_resolution;
|
||||
info.height = thumbnail_resolution;
|
||||
info.format = GFXPixelFormat::RGBA8_UNORM;
|
||||
info.usage = GFXTextureUsage::Sampled;
|
||||
info.usage = GFXTextureUsage::Sampled | GFXTextureUsage::TransferDst;
|
||||
|
||||
GFXTexture* texture = engine->get_gfx()->create_texture(info);
|
||||
|
||||
|
|
|
@ -425,7 +425,8 @@ void CutsceneEditor::drawUI() {
|
|||
ImGui::End();
|
||||
|
||||
if(ImGui::Begin("Viewport")) {
|
||||
drawViewport(engine->get_scene());
|
||||
if(currentShot != nullptr && currentShot->scene != nullptr)
|
||||
drawViewport(currentShot->scene);
|
||||
}
|
||||
|
||||
ImGui::End();
|
||||
|
|
Reference in a new issue