Fix glTFViewer (bind group + y-flip) (#222)

Doesn't completely fix the viewer - there is still a TODO about uniform buffers being updated incorrectly.
This commit is contained in:
Kai Ninomiya 2018-07-16 10:30:16 -07:00 committed by GitHub
parent d8c068fb4f
commit e320182f40
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 4 additions and 3 deletions

View File

@ -54,7 +54,7 @@ class Camera {
eye4 = glm::rotate(glm::mat4(), _azimuth, glm::vec3(0, 1, 0)) * eye4;
_eyeDir = glm::vec3(eye4);
_view = glm::lookAt(_center + _eyeDir * _radius, _center, glm::vec3(0, 1, 0));
_view = glm::lookAt(_center + _eyeDir * _radius, _center, glm::vec3(0, -1, 0));
_dirty = false;
}
float _azimuth;

View File

@ -274,7 +274,8 @@ namespace {
nxt::BindGroupLayout bindGroupLayout = utils::MakeBindGroupLayout(
device, {
{0, nxt::ShaderStageBit::Vertex, nxt::BindingType::UniformBuffer},
{1, nxt::ShaderStageBit::Fragment, nxt::BindingType::Sampler},
{1, hasTexture ? nxt::ShaderStageBit::Fragment : kNoStages,
nxt::BindingType::Sampler},
{2, hasTexture ? nxt::ShaderStageBit::Fragment : kNoStages,
nxt::BindingType::SampledTexture},
});
@ -608,7 +609,7 @@ namespace {
if (buttons[2] || (buttons[0] && buttons[1])) {
camera.pan(-dX * 0.002f, dY * 0.002f);
} else if (buttons[0]) {
camera.rotate(dX * -0.01f, dY * 0.01f);
camera.rotate(dX * 0.01f, dY * 0.01f);
} else if (buttons[1]) {
camera.zoom(dY * -0.005f);
}