asset browser: beautify camera angles and viewport
This commit is contained in:
@@ -34,7 +34,7 @@ void ModelViewer::initializeGL()
|
||||
{
|
||||
opengl::context::scoped_setter const _ (::gl, context());
|
||||
gl.viewport(0.0f, 0.0f, width(), height());
|
||||
gl.clearColor (0.7f, 0.5f, 0.5f, 1.0f);
|
||||
gl.clearColor (0.5f, 0.5f, 0.5f, 1.0f);
|
||||
}
|
||||
|
||||
void ModelViewer::paintGL()
|
||||
@@ -165,46 +165,46 @@ void ModelViewer::keyPressEvent(QKeyEvent* event)
|
||||
{
|
||||
if (event->key() == Qt::Key_W)
|
||||
{
|
||||
moving = 1.0f;
|
||||
moving = 0.5f;
|
||||
}
|
||||
if (event->key() == Qt::Key_S)
|
||||
{
|
||||
moving = -1.0f;
|
||||
moving = -0.5f;
|
||||
}
|
||||
|
||||
if (event->key() == Qt::Key_Up)
|
||||
{
|
||||
lookat = 0.75f;
|
||||
lookat = 0.5f;
|
||||
}
|
||||
if (event->key() == Qt::Key_Down)
|
||||
{
|
||||
lookat = -0.75f;
|
||||
lookat = -0.5f;
|
||||
}
|
||||
|
||||
if (event->key() == Qt::Key_Right)
|
||||
{
|
||||
turn = 0.75f;
|
||||
turn = 0.5f;
|
||||
}
|
||||
if (event->key() == Qt::Key_Left)
|
||||
{
|
||||
turn = -0.75f;
|
||||
turn = -0.5f;
|
||||
}
|
||||
|
||||
if (event->key() == Qt::Key_D)
|
||||
{
|
||||
strafing = 1.0f;
|
||||
strafing = 0.5f;
|
||||
}
|
||||
if (event->key() == Qt::Key_A)
|
||||
{
|
||||
strafing = -1.0f;
|
||||
strafing = -0.5f;
|
||||
}
|
||||
|
||||
if (event->key() == Qt::Key_Q)
|
||||
{
|
||||
updown = 1.0f;
|
||||
updown = 0.5f;
|
||||
}
|
||||
if (event->key() == Qt::Key_E)
|
||||
{
|
||||
updown = -1.0f;
|
||||
updown = -0.5f;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -92,7 +92,7 @@ void PreviewRenderer::resetCamera()
|
||||
radius = std::max((_camera.position - extents[0]).length(), (_camera.position - extents[1]).length());
|
||||
|
||||
float distance_factor = abs( aspect_ratio() * radius / sin(_camera.fov()._ / 2.f));
|
||||
_camera.move_forward_factor(-1.f, 0.75f * distance_factor);
|
||||
_camera.move_forward_factor(-1.f, distance_factor);
|
||||
|
||||
}
|
||||
|
||||
@@ -302,7 +302,7 @@ math::matrix_4x4 PreviewRenderer::model_view() const
|
||||
math::matrix_4x4 PreviewRenderer::projection() const
|
||||
{
|
||||
float far_z = _settings->value("farZ", 2048).toFloat();
|
||||
return math::perspective(_camera.fov(), aspect_ratio(), 1.f, far_z);
|
||||
return math::perspective(_camera.fov(), aspect_ratio(), 0.1f, far_z);
|
||||
}
|
||||
|
||||
float PreviewRenderer::aspect_ratio() const
|
||||
@@ -359,7 +359,7 @@ QPixmap* PreviewRenderer::renderToPixmap()
|
||||
pixel_buffer.bind();
|
||||
|
||||
gl.viewport(0, 0, _width, _height);
|
||||
gl.clearColor(0.75f, 0.5f, 0.5f, 1.f);
|
||||
gl.clearColor(0.5f, 0.5f, 0.5f, 1.f);
|
||||
gl.clear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
|
||||
|
||||
draw();
|
||||
@@ -372,6 +372,8 @@ QPixmap* PreviewRenderer::renderToPixmap()
|
||||
gl.clear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
|
||||
draw();
|
||||
} while (async_loader.is_loading());
|
||||
gl.clear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
|
||||
draw();
|
||||
|
||||
// Clearing alpha from image
|
||||
gl.colorMask(false, false, false, true);
|
||||
|
||||
@@ -115,7 +115,7 @@ namespace noggit
|
||||
{
|
||||
position = {0.f, 0.f, 0.f};
|
||||
_roll = math::degrees(0.0f);
|
||||
_yaw = math::degrees(45.f);
|
||||
_pitch = math::degrees(0.f);
|
||||
_yaw = math::degrees(105.f);
|
||||
_pitch = math::degrees(20.f);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -53,7 +53,7 @@ namespace noggit
|
||||
|
||||
if (!_fonts.count (rect.height()))
|
||||
{
|
||||
auto id (QFontDatabase::addApplicationFont (":/fonts/fa-solid-900.ttf"));
|
||||
auto id (QFontDatabase::addApplicationFont (":/fonts/Font Awesome 5 Pro-Regular-400.otf"));
|
||||
|
||||
if (id == -1)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user