git-svn-id: svn://db.shs.com.ru/libs@51 a8b55f48-bf90-11e4-a774-851b48703e85

This commit is contained in:
2015-11-30 14:45:48 +00:00
parent 8f3506b4a0
commit fc0b593329
15 changed files with 294 additions and 284 deletions

View File

@@ -37,11 +37,12 @@ QGLView::QGLView(QWidget * parent): QGraphicsView(parent), fbo_selection(3) {
ambientColor_ = QColor(10, 10, 10);
lastPos = QPoint(-1, -1);
lineWidth_ = 1.;
linearFiltering_ = cameraOrbit_ = lightEnabled_ = true;
max_anisotropic = 1;
max_texture_chanels = 8;
cameraOrbit_ = lightEnabled_ = true;
shaders_supported = selecting_ = customMouseMove_ = false;
sel_button = Qt::LeftButton;
sel_mod = Qt::NoModifier;
anisotropicLevel_ = 8;
renderer_ = 0;
fps_cnt = 0;
fps_tm = fps_ = 0.;
@@ -51,19 +52,30 @@ QGLView::QGLView(QWidget * parent): QGraphicsView(parent), fbo_selection(3) {
fogMode_ = Exp;
hoverHaloFill_ = 0.333;
selectionHaloFill_ = 0.5;
shadow_map_size = dynamic_cubemap_size = 512;
//lmode = Simple;
shader_select = shader_halo = 0;
cur_luminance = 1.;
m_bloomFactor = 0.5;
m_bloomRadius = 8;
accom_time = 16.;
accom_max_speed = 0.2;
m_motionBlurFactor = 1.;
m_motionBlurSteps = 8;
mouse_first = mouseSelect_ = accomodation_ = hoverHalo_ = selectionHalo_ = true;
fogEnabled_ = is_init = grabMouse_ = mouseRotate_ = mouseThis_ = shaders_bind = m_motionBlurEnabled =
shadows_ = shadows_soft = dynamic_reflections = hdr_ = bloom_ = msaa_ = fxaa_ = changed_ = false;
setFeature(qglMSAA, false);
setFeature(qglFXAA, false);
setFeature(qglLinearFiltering, true);
setFeature(qglAnisotropicLevel, 8);
setFeature(qglHDR, false);
setFeature(qglEyeAccomodationEnabled, false);
setFeature(qglEyeAccomodationTime, 16.);
setFeature(qglEyeAccomodationMaxSpeed, 0.2);
setFeature(qglBloomEnabled, false);
setFeature(qglBloomThreshold, 0.9);
setFeature(qglBloomFactor, 1.);
setFeature(qglBloomRadius, 8);
setFeature(qglMotionBlurEnabled, false);
setFeature(qglMotionBlurFactor, 1.);
setFeature(qglMotionBlurSteps, 8);
setFeature(qglShadowsEnabled, false);
setFeature(qglShadowsMapSize, 512);
setFeature(qglShadowsSoftEnabled, false);
setFeature(qglDynamicReflectionsEnabled, false);
setFeature(qglDynamicReflectionsMapSize, 512);
mouse_first = mouseSelect_ = hoverHalo_ = selectionHalo_ = true;
fogEnabled_ = is_init = grabMouse_ = mouseRotate_ = mouseThis_ = shaders_bind = changed_ = false;
rmode = GLObjectBase::Fill;
sel_mode = QGLView::SingleSelection;
sel_pen = QPen(Qt::black, 1, Qt::DashLine);
@@ -73,8 +85,6 @@ QGLView::QGLView(QWidget * parent): QGraphicsView(parent), fbo_selection(3) {
emit cameraPosChanged(camera().pos());
//camera().aim_ = camera().pos_;
ktm_.restart();
sh_lm_diff << "Phong_diffuse" << "Cook_Torrance_diffuse" << "Minnaert_diffuse" << "Strauss_diffuse" << "Oren_Nayar_diffuse";
sh_lm_spec << "Phong_specular" << "Cook_Torrance_specular" << "Minnaert_specular" << "Strauss_specular" << "Oren_Nayar_specular";
}
@@ -400,7 +410,7 @@ void QGLView::renderSelection() {
void QGLView::renderShadow() {
glPushMatrix();
renderSingleShadow(objects_);
//renderSingleShadow(objects_);
glPopMatrix();
}
@@ -434,7 +444,7 @@ void QGLView::renderSingleSelection(GLObjectBase & o) {
renderSingleSelection(*i);
}
/**
void QGLView::renderSingleShadow(GLObjectBase & o) {
if (!o.isInit()) {
o.init();
@@ -449,7 +459,7 @@ void QGLView::renderSingleShadow(GLObjectBase & o) {
foreach (GLObjectBase * i, o.children_)
renderSingleSelection(*i);
}
*/
void QGLView::collectLights() {
lights_.clear();
@@ -483,6 +493,8 @@ void QGLView::collectObjectLights(GLObjectBase * o) {
void QGLView::checkCaps() {
glGetIntegerv(GL_MAX_TEXTURE_MAX_ANISOTROPY_EXT, &max_anisotropic);
glGetIntegerv(GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS, &max_texture_chanels);
//qDebug() << max_texture_chanels;
shaders_supported = QGLShaderProgram::hasOpenGLShaderPrograms();
}
@@ -495,7 +507,7 @@ void QGLView::reloadThisShaders() {
}
inline void QGLView::applyFog() {
void QGLView::applyFog() {
GLfloat fog_col[4] = {float(fogColor_.redF()), float(fogColor_.greenF()), float(fogColor_.blueF()), .0f};
if (fogEnabled_) {
glEnable(GL_FOG);