bugfixes
parent
7b35f849ff
commit
8c72982658
|
@ -11,6 +11,7 @@ Mitsuba makes heavy use of the following amazing libraries and tools:
|
|||
\item Qt 4 by Nokia
|
||||
\item OpenEXR by Industrial Light \& Magic
|
||||
\item Xerces-C+\!+ by the Apache Foundation
|
||||
\item Eigen by Beno\^it Jacob and Ga\"el Guennebaud
|
||||
\item The Boost C+\!+ class library
|
||||
\item GLEW by Milan Ikits, Marcelo E. Magallon and Lev Povalahev
|
||||
\item Mersenne Twister by Makoto Matsumoto and Takuji Nishimura
|
||||
|
|
|
@ -42,9 +42,12 @@ public:
|
|||
|
||||
/// Check whether the gizmo is currently active
|
||||
inline bool isActive() const { return m_active; }
|
||||
|
||||
|
||||
/// Check whether the drag starting point has been set
|
||||
inline bool canDrag() const { return m_drag; }
|
||||
|
||||
/// Check whether the gizmo is currently used in a drag operation
|
||||
inline bool isDragging() const { return m_drag; }
|
||||
inline bool isDragging() const { return m_drag && (m_dragStart != m_dragEnd); }
|
||||
|
||||
/// Check whether a certain ray intersects the gizmo
|
||||
inline void rayIntersect(const Ray &ray, Float &t) const {
|
||||
|
@ -69,7 +72,7 @@ public:
|
|||
inline void reset() { m_active = m_drag = false; }
|
||||
|
||||
/// Stop dragging
|
||||
inline void stopDrag() { m_drag = false; }
|
||||
inline void stopDrag() { m_dragStart = m_dragEnd; }
|
||||
|
||||
/// Return the bounding sphere associated with the gizmo
|
||||
inline const BSphere &getBSphere() const { return m_bsphere; }
|
||||
|
|
|
@ -42,7 +42,6 @@ Transform Gizmo::getTransform() const {
|
|||
}
|
||||
|
||||
void Gizmo::startDrag(const Ray &ray) {
|
||||
m_drag = false;
|
||||
Float nearT, farT;
|
||||
if (!m_bsphere.rayIntersect(ray, nearT, farT)
|
||||
|| (nearT < 0 && farT < 0)) {
|
||||
|
@ -53,8 +52,8 @@ void Gizmo::startDrag(const Ray &ray) {
|
|||
} else {
|
||||
m_dragStart = ray(nearT);
|
||||
}
|
||||
|
||||
m_active = true;
|
||||
m_dragEnd = m_dragStart;
|
||||
m_drag = true;
|
||||
}
|
||||
|
||||
void Gizmo::dragTo(const Ray &ray, const Camera *camera) {
|
||||
|
@ -71,7 +70,6 @@ void Gizmo::dragTo(const Ray &ray, const Camera *camera) {
|
|||
m_dragEnd = m_bsphere.center + normalize(closest -
|
||||
m_bsphere.center) * m_bsphere.radius;
|
||||
}
|
||||
m_drag = true;
|
||||
}
|
||||
|
||||
void Gizmo::draw(Renderer *renderer, const Camera *camera) {
|
||||
|
@ -86,10 +84,12 @@ void Gizmo::draw(Renderer *renderer, const Camera *camera) {
|
|||
Float tcRadius = std::sqrt(length*length - radius*radius)*radius/length;
|
||||
Float tcDist = std::sqrt(radius*radius - tcRadius*tcRadius);
|
||||
|
||||
renderer->setDepthTest(false);
|
||||
renderer->drawCircle(m_bsphere.center - camToSphere * tcDist,
|
||||
camToSphere, tcRadius);
|
||||
renderer->setDepthTest(true);
|
||||
|
||||
if (m_drag) {
|
||||
if (m_drag && m_dragStart != m_dragEnd) {
|
||||
Spectrum color1, color2;
|
||||
color1.fromLinearRGB(0.7f, 0.7f, 1.0f);
|
||||
color2.fromLinearRGB(0.3f, 0.3f, 0.3f);
|
||||
|
|
|
@ -39,11 +39,9 @@ GLEWContextStruct *glewGetContext() {
|
|||
MTS_NAMESPACE_BEGIN
|
||||
|
||||
GLRenderer::GLRenderer(Session *session)
|
||||
: Renderer(session) {
|
||||
}
|
||||
: Renderer(session) { }
|
||||
|
||||
GLRenderer::~GLRenderer() {
|
||||
}
|
||||
GLRenderer::~GLRenderer() { }
|
||||
|
||||
void GLRenderer::init(Device *device, Renderer *other) {
|
||||
Renderer::init(device, other);
|
||||
|
|
|
@ -216,7 +216,7 @@ void GLTexture::init() {
|
|||
Log(EError, "FBO Error: Unknown error status (0x%x)!", status);
|
||||
}
|
||||
|
||||
glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, 0);
|
||||
glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, GL_NONE);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -478,7 +478,7 @@ Spectrum GLTexture::getPixel(int x, int y) const {
|
|||
glViewport(0, 0, m_size.x, m_size.y);
|
||||
glReadPixels(x, y, 1, 1, GL_RGB, GL_FLOAT, &pixels);
|
||||
glPopAttrib();
|
||||
glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, 0);
|
||||
glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, GL_NONE);
|
||||
|
||||
result.fromLinearRGB(pixels[0], pixels[1], pixels[2]);
|
||||
return result;
|
||||
|
@ -488,7 +488,6 @@ Spectrum GLTexture::getPixel(int x, int y) const {
|
|||
void GLTexture::activateTarget() {
|
||||
Assert(m_fbType != ENone);
|
||||
glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, m_fboId);
|
||||
|
||||
glPushAttrib(GL_VIEWPORT_BIT);
|
||||
glViewport(0, 0, m_size.x, m_size.y);
|
||||
}
|
||||
|
@ -525,7 +524,7 @@ void GLTexture::setTargetRegion(const Point2i &offset, const Vector2i &size) {
|
|||
void GLTexture::releaseTarget() {
|
||||
Assert(m_fbType != ENone);
|
||||
glPopAttrib();
|
||||
glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, 0);
|
||||
glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, GL_NONE);
|
||||
if (isMipMapped())
|
||||
m_needsUpdate = true;
|
||||
}
|
||||
|
@ -541,10 +540,11 @@ void GLTexture::bind(int textureUnit, int textureIndex) const {
|
|||
}
|
||||
|
||||
glEnable(m_glType);
|
||||
if (textureIndex == 1 && m_fbType == EColorAndDepthBuffer)
|
||||
if (textureIndex == 1 && m_fbType == EColorAndDepthBuffer) {
|
||||
glBindTexture(m_glType, m_depthId);
|
||||
else
|
||||
} else {
|
||||
glBindTexture(m_glType, m_id);
|
||||
}
|
||||
|
||||
if (isMipMapped() && m_needsUpdate) {
|
||||
glGenerateMipmapEXT(m_glType);
|
||||
|
@ -616,9 +616,9 @@ void GLTexture::blit(GPUTexture *target, int what) const {
|
|||
glBindFramebufferEXT(GL_DRAW_FRAMEBUFFER_EXT, GL_NONE);
|
||||
}
|
||||
|
||||
void GLTexture::blit(GPUTexture *target, int what, const Point2i &sourceOffset,
|
||||
const Vector2i &sourceSize, const Point2i &destOffset,
|
||||
const Vector2i &destSize) const {
|
||||
void GLTexture::blit(GPUTexture *target, int what,
|
||||
const Point2i &sourceOffset, const Vector2i &sourceSize,
|
||||
const Point2i &destOffset, const Vector2i &destSize) const {
|
||||
GLTexture *dest = static_cast<GLTexture *>(target);
|
||||
Assert(m_fbType != ENone && (dest == NULL || dest->m_fbType != ENone));
|
||||
|
||||
|
|
|
@ -265,7 +265,7 @@ void PreviewWorker::processCoherent(const WorkUnit *workUnit, WorkResult *workRe
|
|||
secRay4.dRcp[0].ps = _mm_div_ps(SSEConstants::one.ps, secRay4.d[0].ps);
|
||||
secRay4.dRcp[1].ps = _mm_div_ps(SSEConstants::one.ps, secRay4.d[1].ps);
|
||||
secRay4.dRcp[2].ps = _mm_div_ps(SSEConstants::one.ps, secRay4.d[2].ps);
|
||||
|
||||
|
||||
cosThetaLight.ps = _mm_sub_ps(_mm_setzero_ps(),
|
||||
_mm_add_ps(_mm_add_ps(
|
||||
_mm_mul_ps(nSecD[0].ps, lumDir[0]),
|
||||
|
@ -291,6 +291,12 @@ void PreviewWorker::processCoherent(const WorkUnit *workUnit, WorkResult *workRe
|
|||
const Shape *shape = (*m_shapes)[its4.shapeIndex.i[idx]];
|
||||
const BSDF *bsdf = shape->getBSDF();
|
||||
|
||||
if (EXPECT_NOT_TAKEN(!bsdf)) {
|
||||
memset(&emitted[idx], 0, sizeof(Spectrum));
|
||||
memset(&direct[idx], 0, sizeof(Spectrum));
|
||||
continue;
|
||||
}
|
||||
|
||||
if (EXPECT_TAKEN(primIndex != KNoTriangleFlag)) {
|
||||
const TriMesh *mesh = static_cast<const TriMesh *>(shape);
|
||||
const Triangle &t = mesh->getTriangles()[primIndex];
|
||||
|
|
|
@ -58,6 +58,7 @@ p, li { white-space: pre-wrap; }
|
|||
<ul style="-qt-list-indent: 1;"><li style=" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><a href="http://qt.nokia.com/products"><span style=" text-decoration: underline; color:#0000ff;">Qt 4</span></a> by Nokia</li>
|
||||
<li style=" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><a href="http://www.openexr.com/"><span style=" text-decoration: underline; color:#0000ff;">OpenEXR</span></a> by Industrial Light &amp; Magic</li>
|
||||
<li style=" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><a href="http://xerces.apache.org/xerces-c/"><span style=" text-decoration: underline; color:#0000ff;">Xerces-C++</span></a> by the Apache Foundation</li>
|
||||
<li style=" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><a href="http://eigen.tuxfamily.org"><span style=" text-decoration: underline; color:#0000ff;">Eigen</span></a> by Benoît Jacob and Gaël Guennebaud</li>
|
||||
<li style=" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">The <a href="http://www.boost.org/"><span style=" text-decoration: underline; color:#0000ff;">Boost</span></a> C++ class library</li>
|
||||
<li style=" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><a href="http://glew.sourceforge.net/"><span style=" text-decoration: underline; color:#0000ff;">GLEW</span></a> by Milan Ikits, Marcelo E. Magallon and Lev Povalahev</li>
|
||||
<li style=" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><a href="http://sourceforge.net/projects/collada-dom/"><span style=" text-decoration: underline; color:#0000ff;">COLLADA DOM</span></a> by Sony Computer Entertainment</li>
|
||||
|
|
|
@ -68,6 +68,10 @@ GLWidget::GLWidget(QWidget *parent) :
|
|||
}
|
||||
|
||||
GLWidget::~GLWidget() {
|
||||
shutdown();
|
||||
}
|
||||
|
||||
void GLWidget::shutdown() {
|
||||
if (m_preview)
|
||||
m_preview->quit();
|
||||
}
|
||||
|
@ -157,9 +161,9 @@ void GLWidget::initializeGL() {
|
|||
|
||||
m_gammaTonemap->setSource(GPUProgram::EFragmentProgram,
|
||||
"#version 120\n"
|
||||
"uniform sampler2D source;\n"
|
||||
"uniform sampler2D colorSource, depthSource;\n"
|
||||
"uniform float invWhitePoint, invGamma;\n"
|
||||
"uniform bool sRGB;\n"
|
||||
"uniform bool sRGB, hasDepth;\n"
|
||||
"\n"
|
||||
"float toSRGB(float value) {\n"
|
||||
" if (value < 0.0031308)\n"
|
||||
|
@ -168,11 +172,12 @@ void GLWidget::initializeGL() {
|
|||
"}\n"
|
||||
"\n"
|
||||
"void main() {\n"
|
||||
" vec4 color = texture2D(source, gl_TexCoord[0].xy) * invWhitePoint;\n"
|
||||
" vec4 color = texture2D(colorSource, gl_TexCoord[0].xy) * invWhitePoint;\n"
|
||||
" if (sRGB)\n"
|
||||
" gl_FragColor = vec4(toSRGB(color.r), toSRGB(color.g), toSRGB(color.b), 1);\n"
|
||||
" else\n"
|
||||
" gl_FragColor = vec4(pow(color.rgb, vec3(invGamma)), 1);\n"
|
||||
" gl_FragDepth = hasDepth ? texture2D(depthSource, gl_TexCoord[0].xy).r : 0.5;\n"
|
||||
"}\n"
|
||||
);
|
||||
|
||||
|
@ -185,9 +190,9 @@ void GLWidget::initializeGL() {
|
|||
|
||||
m_reinhardTonemap->setSource(GPUProgram::EFragmentProgram,
|
||||
"#version 120\n"
|
||||
"uniform sampler2D source;\n"
|
||||
"uniform sampler2D colorSource, depthSource;\n"
|
||||
"uniform float key, invWpSqr, invGamma, multiplier;\n"
|
||||
"uniform bool sRGB;\n"
|
||||
"uniform bool sRGB, hasDepth;\n"
|
||||
"\n"
|
||||
"float toSRGB(float value) {\n"
|
||||
" if (value < 0.0031308)\n"
|
||||
|
@ -204,7 +209,7 @@ void GLWidget::initializeGL() {
|
|||
" -0.969256, 1.875991, 0.041556,\n"
|
||||
" 0.055648, -0.204043, 1.057311);\n"
|
||||
"\n"
|
||||
" vec4 color = texture2D(source, gl_TexCoord[0].xy)*multiplier;\n"
|
||||
" vec4 color = texture2D(colorSource, gl_TexCoord[0].xy)*multiplier;\n"
|
||||
" vec3 xyz = rgb2xyz * color.rgb;\n"
|
||||
" float normalization = 1.0/(xyz.x + xyz.y + xyz.z);\n"
|
||||
" vec3 Yxy = vec3(xyz.x*normalization, xyz.y*normalization, xyz.y);\n"
|
||||
|
@ -216,6 +221,7 @@ void GLWidget::initializeGL() {
|
|||
" gl_FragColor = vec4(toSRGB(color.r), toSRGB(color.g), toSRGB(color.b), 1);\n"
|
||||
" else\n"
|
||||
" gl_FragColor = vec4(pow(color.rgb, vec3(invGamma)), 1);\n"
|
||||
" gl_FragDepth = hasDepth ? texture2D(depthSource, gl_TexCoord[0].xy).r : 0.5;\n"
|
||||
"}\n"
|
||||
);
|
||||
|
||||
|
@ -573,15 +579,14 @@ void GLWidget::keyPressEvent(QKeyEvent *event) {
|
|||
case Qt::Key_Down:
|
||||
m_downKeyDown = true; break;
|
||||
case Qt::Key_A: {
|
||||
if (m_context->selectionMode == ENothing) {
|
||||
m_context->selectionMode = EScene;
|
||||
m_gizmo->init(m_context->scene->getBSphere());
|
||||
} else {
|
||||
if (m_context->selectionMode == EScene) {
|
||||
m_context->selectionMode = ENothing;
|
||||
m_gizmo->reset();
|
||||
} else {
|
||||
m_context->selectionMode = EScene;
|
||||
m_gizmo->init(m_context->scene->getBSphere());
|
||||
}
|
||||
m_context->selectedShape = NULL;
|
||||
updateGL();
|
||||
}
|
||||
// break intentionally missing
|
||||
case Qt::Key_F: {
|
||||
|
@ -653,7 +658,7 @@ void GLWidget::mouseMoveEvent(QMouseEvent *event) {
|
|||
bool didMove = false;
|
||||
|
||||
if (m_navigationMode == EArcBall) {
|
||||
if (event->buttons() & Qt::LeftButton) {
|
||||
if (event->buttons() & Qt::LeftButton && m_gizmo->canDrag()) {
|
||||
Ray ray;
|
||||
Point2i offset = upperLeft();
|
||||
Point2 sample = Point2(m_mousePos.x() - offset.x, m_mousePos.y() - offset.y);
|
||||
|
@ -811,8 +816,12 @@ void GLWidget::mousePressEvent(QMouseEvent *event) {
|
|||
if (its.t < t) {
|
||||
SLog(EInfo, "Selected shape \"%s\"", its.shape->getName().c_str());
|
||||
m_context->selectedShape = its.shape;
|
||||
m_gizmo->init(its.shape->getAABB().getBSphere());
|
||||
BSphere bsphere = its.shape->getAABB().getBSphere();
|
||||
bool newSelection = (bsphere != m_gizmo->getBSphere());
|
||||
m_gizmo->init(bsphere);
|
||||
m_context->selectionMode = EShape;
|
||||
if (newSelection)
|
||||
return;
|
||||
}
|
||||
} else {
|
||||
if (t == std::numeric_limits<Float>::infinity()) {
|
||||
|
@ -822,7 +831,7 @@ void GLWidget::mousePressEvent(QMouseEvent *event) {
|
|||
return;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
m_gizmo->startDrag(ray);
|
||||
m_storedViewTransform = camera->getViewTransform();
|
||||
}
|
||||
|
@ -856,7 +865,8 @@ void GLWidget::mouseReleaseEvent(QMouseEvent *event) {
|
|||
}
|
||||
|
||||
void GLWidget::paintGL() {
|
||||
m_renderer->setDepthTest(false);
|
||||
m_renderer->setDepthTest(true);
|
||||
m_renderer->setDepthMask(true);
|
||||
if (m_context == NULL) {
|
||||
glClearColor(0.0f, 0.0f, 0.0f, 1.0f);
|
||||
m_renderer->clear();
|
||||
|
@ -866,7 +876,7 @@ void GLWidget::paintGL() {
|
|||
} else if (m_context != NULL) {
|
||||
Vector2i size;
|
||||
glClearColor(0.2f, 0.2f, 0.2f, 1.0f);
|
||||
glClear(GL_COLOR_BUFFER_BIT);
|
||||
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
|
||||
PreviewQueueEntry entry;
|
||||
GPUTexture *buffer = NULL;
|
||||
|
||||
|
@ -933,7 +943,12 @@ void GLWidget::paintGL() {
|
|||
|
||||
size = Vector2i(m_framebuffer->getSize().x, m_framebuffer->getSize().y);
|
||||
buffer = m_framebuffer;
|
||||
} else {
|
||||
return;
|
||||
}
|
||||
bool hasDepth = m_context->mode == EPreview
|
||||
&& (m_context->previewMethod == EOpenGL ||
|
||||
m_context->previewMethod == EOpenGLSinglePass);
|
||||
|
||||
if (m_softwareFallback) {
|
||||
buffer->bind();
|
||||
|
@ -947,11 +962,15 @@ void GLWidget::paintGL() {
|
|||
if (m_context->mode == EPreview)
|
||||
invWhitePoint /= entry.vplSampleOffset;
|
||||
|
||||
if (hasDepth)
|
||||
buffer->bind(1, 1);
|
||||
m_gammaTonemap->bind();
|
||||
m_gammaTonemap->setParameter("source", 0);
|
||||
m_gammaTonemap->setParameter("colorSource", 0);
|
||||
m_gammaTonemap->setParameter("depthSource", 1);
|
||||
m_gammaTonemap->setParameter("invWhitePoint", invWhitePoint);
|
||||
m_gammaTonemap->setParameter("invGamma", 1/m_context->gamma);
|
||||
m_gammaTonemap->setParameter("sRGB", m_context->srgb);
|
||||
m_gammaTonemap->setParameter("hasDepth", hasDepth);
|
||||
m_renderer->blitTexture(buffer, m_context->mode == EPreview,
|
||||
!m_hScroll->isVisible(), !m_vScroll->isVisible(),
|
||||
-m_context->scrollOffset);
|
||||
|
@ -1015,13 +1034,17 @@ void GLWidget::paintGL() {
|
|||
logLuminance = 1;
|
||||
}
|
||||
|
||||
if (hasDepth)
|
||||
buffer->bind(1, 1);
|
||||
m_reinhardTonemap->bind();
|
||||
m_reinhardTonemap->setParameter("source", 0);
|
||||
m_reinhardTonemap->setParameter("colorSource", 0);
|
||||
m_reinhardTonemap->setParameter("depthSource", 1);
|
||||
m_reinhardTonemap->setParameter("key", m_context->reinhardKey/logLuminance);
|
||||
m_reinhardTonemap->setParameter("multiplier", multiplier);
|
||||
m_reinhardTonemap->setParameter("invWpSqr", std::pow((Float) 2, m_context->reinhardBurn));
|
||||
m_reinhardTonemap->setParameter("invGamma", 1/m_context->gamma);
|
||||
m_reinhardTonemap->setParameter("sRGB", m_context->srgb);
|
||||
m_reinhardTonemap->setParameter("hasDepth", hasDepth);
|
||||
m_renderer->blitTexture(buffer, m_context->mode == EPreview,
|
||||
!m_hScroll->isVisible(), !m_vScroll->isVisible(),
|
||||
-m_context->scrollOffset);
|
||||
|
@ -1059,19 +1082,14 @@ void GLWidget::paintGL() {
|
|||
if (m_context->mode == EPreview) {
|
||||
const ProjectiveCamera *camera = static_cast<const ProjectiveCamera *>
|
||||
(m_context->scene->getCamera());
|
||||
m_renderer->setCamera(camera);
|
||||
|
||||
Point2i offset = upperLeft(true);
|
||||
|
||||
buffer->blit(NULL, GPUTexture::EDepthBuffer, Point2i(0, 0),
|
||||
size, offset, size);
|
||||
glColor4f(1.0f, 1.0f, 1.0f, 1.0f);
|
||||
|
||||
m_renderer->setCamera(camera);
|
||||
glPushAttrib(GL_VIEWPORT_BIT);
|
||||
Point2i offset = upperLeft(true);
|
||||
glViewport(offset.x, offset.y, size.x, size.y);
|
||||
m_renderer->setDepthTest(true);
|
||||
m_renderer->setDepthMask(false);
|
||||
m_renderer->setDepthTest(true);
|
||||
m_renderer->setBlendMode(Renderer::EBlendAdditive);
|
||||
glDepthFunc(GL_LESS);
|
||||
|
||||
if (m_context->showKDTree) {
|
||||
oglRenderKDTree(m_context->scene->getKDTree());
|
||||
|
@ -1085,9 +1103,7 @@ void GLWidget::paintGL() {
|
|||
m_gizmo->draw(m_renderer, camera);
|
||||
|
||||
m_renderer->setBlendMode(Renderer::EBlendNone);
|
||||
m_renderer->setDepthTest(false);
|
||||
m_renderer->setDepthMask(true);
|
||||
glViewport(viewport[0], viewport[1], viewport[2], viewport[3]);
|
||||
glPopAttrib();
|
||||
}
|
||||
}
|
||||
swapBuffers();
|
||||
|
|
|
@ -46,6 +46,7 @@ public:
|
|||
void resumePreview();
|
||||
void refreshScene();
|
||||
void resetPreview();
|
||||
void shutdown();
|
||||
inline const RendererCapabilities *getRendererCapabilities() const {
|
||||
return m_renderer->getCapabilities();
|
||||
}
|
||||
|
|
|
@ -21,6 +21,7 @@
|
|||
#include "rendersettingsdlg.h"
|
||||
#include "previewsettingsdlg.h"
|
||||
#include "programsettingsdlg.h"
|
||||
#include "sceneinfodlg.h"
|
||||
#include "sceneloader.h"
|
||||
#include "logwidget.h"
|
||||
#include "navdlg.h"
|
||||
|
@ -496,6 +497,28 @@ void MainWindow::on_actionShowKDTree_triggered() {
|
|||
ui->glView->resetPreview();
|
||||
}
|
||||
|
||||
void MainWindow::on_actionSceneDescription_triggered() {
|
||||
int currentIndex = ui->tabBar->currentIndex();
|
||||
if (currentIndex == -1)
|
||||
return;
|
||||
SceneContext *context= m_context[currentIndex];
|
||||
SceneInformationDialog *dialog = new SceneInformationDialog(this,
|
||||
context->scene);
|
||||
QDesktopWidget *desktop = QApplication::desktop();
|
||||
dialog->move(QPoint((desktop->width() - dialog->width()) / 2, (desktop->height() - dialog->height())/2));
|
||||
connect(dialog, SIGNAL(finished(int)), this, SLOT(onSceneInformationClose(int)));
|
||||
m_currentChild = dialog;
|
||||
// prevent a tab drawing artifact on Qt/OSX
|
||||
m_activeWindowHack = true;
|
||||
dialog->show();
|
||||
qApp->processEvents();
|
||||
m_activeWindowHack = false;
|
||||
}
|
||||
|
||||
void MainWindow::onSceneInformationClose(int reason) {
|
||||
m_currentChild = NULL;
|
||||
}
|
||||
|
||||
void MainWindow::changeEvent(QEvent *e) {
|
||||
QMainWindow::changeEvent(e);
|
||||
switch (e->type()) {
|
||||
|
@ -700,6 +723,7 @@ void MainWindow::updateUI() {
|
|||
ui->actionAdjustSize->setEnabled(hasTab);
|
||||
ui->actionShowKDTree->setEnabled(hasTab);
|
||||
ui->actionShowKDTree->setChecked(hasTab && context->showKDTree);
|
||||
ui->actionSceneDescription->setEnabled(hasTab);
|
||||
#if !defined(__OSX__)
|
||||
ui->actionPreviewSettings->setEnabled(!fallback && hasTab);
|
||||
#else
|
||||
|
@ -863,6 +887,7 @@ void MainWindow::closeEvent(QCloseEvent *event) {
|
|||
return;
|
||||
}
|
||||
}
|
||||
ui->glView->shutdown();
|
||||
QMainWindow::closeEvent(event);
|
||||
m_logWidget->hide();
|
||||
Logger *logger = Thread::getThread()->getLogger();
|
||||
|
@ -1369,7 +1394,6 @@ void MainWindow::onSaveAsDialogClose(int reason) {
|
|||
QFileDialog *dialog = static_cast<QFileDialog *>(sender());
|
||||
m_currentChild = NULL;
|
||||
if (reason == QDialog::Accepted) {
|
||||
m_currentChild = NULL;
|
||||
QString fileName = dialog->selectedFiles().value(0);
|
||||
settings.setValue("fileDialogState", dialog->saveState());
|
||||
saveScene(this, context, fileName);
|
||||
|
|
|
@ -127,6 +127,7 @@ private slots:
|
|||
void on_actionReportBug_triggered();
|
||||
void on_actionFeedback_triggered();
|
||||
void on_actionShowKDTree_triggered();
|
||||
void on_actionSceneDescription_triggered();
|
||||
void on_tabBar_currentChanged(int index);
|
||||
bool on_tabBar_tabCloseRequested(int index);
|
||||
void on_tabBar_tabMoved(int from, int to);
|
||||
|
@ -153,6 +154,7 @@ private slots:
|
|||
void onExportDialogClose(int reason);
|
||||
void onRenderSettingsClose(int reason);
|
||||
void onImportDialogClose(int reason);
|
||||
void onSceneInformationClose(int reason);
|
||||
|
||||
private:
|
||||
Ui::MainWindow *ui;
|
||||
|
|
|
@ -151,6 +151,7 @@
|
|||
<string>Developer</string>
|
||||
</property>
|
||||
<addaction name="actionShowKDTree"/>
|
||||
<addaction name="actionSceneDescription"/>
|
||||
</widget>
|
||||
<addaction name="actionUpdateCheck"/>
|
||||
<addaction name="actionStartServer"/>
|
||||
|
@ -467,6 +468,11 @@
|
|||
<string>Visualize kd-Tree</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionSceneDescription">
|
||||
<property name="text">
|
||||
<string>Describe Scene..</string>
|
||||
</property>
|
||||
</action>
|
||||
</widget>
|
||||
<layoutdefault spacing="6" margin="11"/>
|
||||
<customwidgets>
|
||||
|
|
|
@ -325,7 +325,7 @@ void PreviewThread::run() {
|
|||
target.buffer->setFormat(GPUTexture::EFloat32RGB);
|
||||
target.buffer->setSize(size);
|
||||
target.buffer->setFilterType(GPUTexture::ENearest);
|
||||
target.buffer->setFrameBufferType(GPUTexture::EColorBuffer);
|
||||
target.buffer->setFrameBufferType(GPUTexture::EColorAndDepthBuffer);
|
||||
target.buffer->setMipMapped(false);
|
||||
target.buffer->init();
|
||||
target.buffer->incRef();
|
||||
|
|
|
@ -0,0 +1,42 @@
|
|||
/*
|
||||
This file is part of Mitsuba, a physically based rendering system.
|
||||
|
||||
Copyright (c) 2007-2010 by Wenzel Jakob and others.
|
||||
|
||||
Mitsuba is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License Version 3
|
||||
as published by the Free Software Foundation.
|
||||
|
||||
Mitsuba is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "ui_sceneinfodlg.h"
|
||||
#include "sceneinfodlg.h"
|
||||
|
||||
SceneInformationDialog::SceneInformationDialog(QWidget *parent, Scene *scene) :
|
||||
QDialog(parent),
|
||||
ui(new Ui::SceneInformationDialog) {
|
||||
ui->setupUi(this);
|
||||
ui->textEdit->setText(scene->toString().c_str());
|
||||
}
|
||||
|
||||
SceneInformationDialog::~SceneInformationDialog() {
|
||||
delete ui;
|
||||
}
|
||||
|
||||
void SceneInformationDialog::changeEvent(QEvent *e) {
|
||||
QDialog::changeEvent(e);
|
||||
switch (e->type()) {
|
||||
case QEvent::LanguageChange:
|
||||
ui->retranslateUi(this);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,39 @@
|
|||
/*
|
||||
This file is part of Mitsuba, a physically based rendering system.
|
||||
|
||||
Copyright (c) 2007-2010 by Wenzel Jakob and others.
|
||||
|
||||
Mitsuba is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License Version 3
|
||||
as published by the Free Software Foundation.
|
||||
|
||||
Mitsuba is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#if !defined(__SCENEINFODLG_H)
|
||||
#define __SCENEINFODLG_H
|
||||
|
||||
#include "common.h"
|
||||
|
||||
namespace Ui {
|
||||
class SceneInformationDialog;
|
||||
}
|
||||
|
||||
class SceneInformationDialog : public QDialog {
|
||||
Q_OBJECT
|
||||
public:
|
||||
SceneInformationDialog(QWidget *parent, Scene *scene);
|
||||
~SceneInformationDialog();
|
||||
protected:
|
||||
void changeEvent(QEvent *e);
|
||||
private:
|
||||
Ui::SceneInformationDialog *ui;
|
||||
};
|
||||
|
||||
#endif // __SCENEINFODLG_H
|
|
@ -0,0 +1,82 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>SceneInformationDialog</class>
|
||||
<widget class="QDialog" name="SceneInformationDialog">
|
||||
<property name="windowModality">
|
||||
<enum>Qt::NonModal</enum>
|
||||
</property>
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>676</width>
|
||||
<height>534</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>Scene Information</string>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout">
|
||||
<item row="1" column="0">
|
||||
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||
<item>
|
||||
<spacer name="horizontalSpacer">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>198</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="pushButton">
|
||||
<property name="text">
|
||||
<string>&Close</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item row="0" column="0">
|
||||
<widget class="QTextEdit" name="textEdit">
|
||||
<property name="font">
|
||||
<font>
|
||||
<family>Monospace</family>
|
||||
<pointsize>8</pointsize>
|
||||
</font>
|
||||
</property>
|
||||
<property name="html">
|
||||
<string><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd">
|
||||
<html><head><meta name="qrichtext" content="1" /><style type="text/css">
|
||||
p, li { white-space: pre-wrap; }
|
||||
</style></head><body style=" font-family:'Monospace'; font-size:8pt; font-weight:400; font-style:normal;">
|
||||
<p style="-qt-paragraph-type:empty; margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-family:'Ubuntu'; font-size:11pt;"></p></body></html></string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<resources/>
|
||||
<connections>
|
||||
<connection>
|
||||
<sender>pushButton</sender>
|
||||
<signal>clicked()</signal>
|
||||
<receiver>SceneInformationDialog</receiver>
|
||||
<slot>accept()</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel">
|
||||
<x>327</x>
|
||||
<y>263</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel">
|
||||
<x>334</x>
|
||||
<y>199</y>
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
</connections>
|
||||
</ui>
|
Loading…
Reference in New Issue