From ba078f0e0fd6b2dd4094ee63a03c781d955c0506 Mon Sep 17 00:00:00 2001 From: kmkolasinski Date: Sun, 15 Feb 2015 21:18:47 +0100 Subject: [PATCH] Update of 2.1 version Some changes in 3D viewport. Added 3D model support with 3 types of displacement shaders to choose: relief, parallax normal, and tessellation shader. Now any OBJ mesh can be loaded from file (faces must be triangles). Project manager added: now AB settings can be saved and loaded at run time. Now, each type of textures can be disabled in 3D viewport. --- .gitignore | 8 + AwesomeBump.pro | 22 +- CommonObjects.cpp | 2 +- CommonObjects.h | 25 +- camera.cpp | 2 +- config.ini | 426 +++++++++--------- configs/27_asd.ini | 255 +++++++++++ configs/28_asd.ini | 255 +++++++++++ configs/36_Dragon.ini | 255 +++++++++++ configs/37_Bricks.ini | 255 +++++++++++ configs/38_Doors.ini | 255 +++++++++++ configs/config_list | 2 + content.qrc | 6 + content/plane.frag | 185 ++++++-- content/plane.geom | 103 +++++ content/plane.tcs.vert | 80 ++++ content/plane.tes.vert | 36 ++ content/plane.vert | 126 ++++-- content/text.png | Bin 0 -> 9902 bytes content/trash.png | Bin 0 -> 1531 bytes dialogheightcalculator.cpp | 1 + formimageprop.cpp | 6 +- formsettingscontainer.cpp | 79 ++++ formsettingscontainer.h | 36 ++ formsettingscontainer.ui | 259 +++++++++++ formsettingsfield.cpp | 117 +++++ formsettingsfield.h | 47 ++ formsettingsfield.ui | 192 ++++++++ glimageeditor.cpp | 43 +- glwidget.cpp | 248 ++++++----- glwidget.h | 31 +- mainwindow.cpp | 102 ++++- mainwindow.h | 14 +- mainwindow.ui | 224 ++++++++-- models/Capsule.mtl | 11 + models/Cube.mtl | 10 + models/Cylinder.mtl | 11 + models/Hexagon.mtl | 11 + models/Plane.mtl | 11 + models/SmoothedCube.mtl | 10 + models/Sphere.mtl | 11 + utils/Mesh.cpp | 254 +++++++++++ utils/Mesh.hpp | 73 +++ utils/tinyobj/test.cc | 198 +++++++++ utils/tinyobj/tiny_obj_loader.cc | 742 +++++++++++++++++++++++++++++++ utils/tinyobj/tiny_obj_loader.h | 110 +++++ 46 files changed, 4678 insertions(+), 471 deletions(-) create mode 100644 configs/27_asd.ini create mode 100644 configs/28_asd.ini create mode 100644 configs/36_Dragon.ini create mode 100644 configs/37_Bricks.ini create mode 100644 configs/38_Doors.ini create mode 100644 configs/config_list create mode 100644 content/plane.geom create mode 100644 content/plane.tcs.vert create mode 100644 content/plane.tes.vert create mode 100644 content/text.png create mode 100644 content/trash.png create mode 100644 formsettingscontainer.cpp create mode 100644 formsettingscontainer.h create mode 100644 formsettingscontainer.ui create mode 100644 formsettingsfield.cpp create mode 100644 formsettingsfield.h create mode 100644 formsettingsfield.ui create mode 100644 models/Capsule.mtl create mode 100644 models/Cube.mtl create mode 100644 models/Cylinder.mtl create mode 100644 models/Hexagon.mtl create mode 100644 models/Plane.mtl create mode 100644 models/SmoothedCube.mtl create mode 100644 models/Sphere.mtl create mode 100644 utils/Mesh.cpp create mode 100644 utils/Mesh.hpp create mode 100644 utils/tinyobj/test.cc create mode 100644 utils/tinyobj/tiny_obj_loader.cc create mode 100644 utils/tinyobj/tiny_obj_loader.h diff --git a/.gitignore b/.gitignore index bb29ad2..9c140d3 100644 --- a/.gitignore +++ b/.gitignore @@ -177,3 +177,11 @@ AwesomeBump.pro.user.1ac2611 AwesomeBump.pro.user.d869918 log.txt mainwindow.cpp.xU4760 +formsettingscontainer.h.Jg1292 +formsettingscontainer.h.rv1292 +formsettingscontainer.h.rv1292 +glwidget.cpp.mw6064 +glwidget.cpp.mw6064 +mainwindow.cpp.dm4832 +models/head.mtl +models/2Triangles.mtl diff --git a/AwesomeBump.pro b/AwesomeBump.pro index 2f5b2b6..ccd3740 100644 --- a/AwesomeBump.pro +++ b/AwesomeBump.pro @@ -11,7 +11,12 @@ HEADERS = glwidget.h \ glimageeditor.h \ camera.h \ dialogheightcalculator.h \ - qopenglerrorcheck.h + qopenglerrorcheck.h \ + utils/Mesh.hpp \ + utils/tinyobj/tiny_obj_loader.h \ + formsettingsfield.h \ + formsettingscontainer.h + SOURCES = glwidget.cpp \ main.cpp \ mainwindow.cpp \ @@ -19,7 +24,12 @@ SOURCES = glwidget.cpp \ glimageeditor.cpp \ CommonObjects.cpp \ camera.cpp \ - dialogheightcalculator.cpp + dialogheightcalculator.cpp \ + utils/Mesh.cpp \ + utils/tinyobj/tiny_obj_loader.cc \ + formsettingsfield.cpp \ + formsettingscontainer.cpp + # install INSTALLS += target @@ -30,6 +40,12 @@ RESOURCES += \ FORMS += \ mainwindow.ui \ formimageprop.ui \ - dialogheightcalculator.ui + dialogheightcalculator.ui \ + formsettingsfield.ui \ + formsettingscontainer.ui ICON = content/icon.icns +INCLUDEPATH += include + + + diff --git a/CommonObjects.cpp b/CommonObjects.cpp index 4fe44fa..a98956a 100644 --- a/CommonObjects.cpp +++ b/CommonObjects.cpp @@ -16,7 +16,7 @@ QString PostfixNames::occlusionName = "_o"; QString PostfixNames::outputFormat = ".png"; - +bool FBOImages::bUseLinearInterpolation = true; void TargaImage::write(QImage image, QString fileName){ diff --git a/CommonObjects.h b/CommonObjects.h index 11bba1f..e013a2b 100644 --- a/CommonObjects.h +++ b/CommonObjects.h @@ -8,8 +8,7 @@ #include "qopenglerrorcheck.h" -#define PROGRAM_VERTEX_ATTRIBUTE 0 -#define PROGRAM_TEXCOORD_ATTRIBUTE 1 + using namespace std; @@ -36,6 +35,11 @@ enum UVManipulationMethods{ UV_SCALE_XY }; +enum ShadingType{ + SHADING_RELIEF_MAPPING = 0, + SHADING_PARALLAX_NORMAL_MAPPING +}; + // Compressed texture type enum CompressedFromTypes{ H_TO_D_AND_S_TO_N = 0, @@ -210,15 +214,19 @@ class FBOImages{ glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT); - //glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST); - //glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST); - glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); - glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); + + if(FBOImages::bUseLinearInterpolation){ + glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); + glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); + }else{ + glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST); + glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST); + } float aniso = 0.0; glGetFloatv(GL_MAX_TEXTURE_MAX_ANISOTROPY_EXT, &aniso); glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAX_ANISOTROPY_EXT, aniso); GLCHK(glBindTexture(GL_TEXTURE_2D, 0)); - qDebug() << "FBOImages::creatig new FBO(" << width << "," << height << ") with id=" << fbo->texture() ; + qDebug() << "FBOImages::creating new FBO(" << width << "," << height << ") with id=" << fbo->texture() ; } static void resize(QGLFramebufferObject *&src,QGLFramebufferObject *&ref){ if( ref->width() == src->width() && @@ -232,7 +240,8 @@ class FBOImages{ GLCHK(FBOImages::create(src ,width,height)); } } - +public: + static bool bUseLinearInterpolation; }; diff --git a/camera.cpp b/camera.cpp index 8bfd083..cc0fbbf 100644 --- a/camera.cpp +++ b/camera.cpp @@ -112,6 +112,6 @@ void AwesomeCamera::rotateView(float z_angle,float x_angle){ void AwesomeCamera::mouseWheelMove(int direction){ - radius+=mouse_sens*0.005f*direction; + radius+=mouse_sens*0.0025f*direction; if(radius < 0.3) radius = 0.3; } diff --git a/config.ini b/config.ini index 835ac72..ebf80d3 100644 --- a/config.ini +++ b/config.ini @@ -1,247 +1,255 @@ [General] -d_postfix=_D -n_postfix=_N -s_postfix=_S -h_postfix=_H -recent_dir=C:/Users/mkk/Pictures/DSCN5517_D.png +d_win_w=1600 +d_win_h=838 +recent_dir=C:/Users/mkk/Pictures/Cambodia0055_1_S.jpg +recent_mesh_dir=E:/Doktorat/ZaawansowanaGrafika3D/AwesomeBumpRepo/AwesomeBump/Cube t_d_bGrayScale=false -t_d_bInvertR=false -t_d_bInvertB=false -t_d_bRemoveShading=false -t_d_noRemoveShadingGaussIter=6 -t_d_noBlurPasses=0 -t_d_bSpeclarControl=false -t_d_specularRadius=1 -t_d_specularW1=@Variant(\0\0\0\x87<#\xd7\n) -t_d_specularW2=@Variant(\0\0\0\x87<#\xd7\n) -t_d_specularContrast=@Variant(\0\0\0\x87\xbf\x80\0\0) -t_d_specularAmplifier=@Variant(\0\0\0\x87\xc1 \0\0) -t_d_smallDetails=@Variant(\0\0\0\x87\0\0\0\0) -t_d_mediumDetails=@Variant(\0\0\0\x87\0\0\0\0) -t_d_detailDepth=@Variant(\0\0\0\x87?@\0\0) -t_d_sharpenBlurAmount=0 -t_d_normalsStep=@Variant(\0\0\0\x87>\xdc(\xf6) -t_d_conversionHNDepth=@Variant(\0\0\0\x87?\x19\x99\x9a) -t_d_bConversionHN=false -t_d_bConversionNH=false -t_d_conversionNHIters=4 -t_d_bConversionBaseMap=false -t_d_conversionBaseMapAmplitude=@Variant(\0\0\0\x87\xbf\xf9\x99\x9a) -t_d_conversionBaseMapFlatness=@Variant(\0\0\0\x87\0\0\0\0) -t_d_conversionBaseMapNoIters=25 -t_d_conversionBaseMapFilterRadius=2 -t_d_conversionBaseMapMixNormals=@Variant(\0\0\0\x87>\xcf\\)) -t_d_conversionBaseMapPreSmoothRadius=@Variant(\0\0\0\x87\0\0\0\0) +t_h_bGrayScale=false t_n_bGrayScale=false -t_n_bInvertR=false -t_n_bInvertB=false -t_n_bRemoveShading=false -t_n_noRemoveShadingGaussIter=10 -t_n_noBlurPasses=0 -t_n_bSpeclarControl=false -t_n_specularRadius=10 -t_n_specularW1=@Variant(\0\0\0\x87\x41 \0\0) -t_n_specularW2=@Variant(\0\0\0\x87\x41 \0\0) -t_n_specularContrast="@Variant(\0\0\0\x87=L\xcc\xcd)" -t_n_specularAmplifier=@Variant(\0\0\0\x87@@\0\0) -t_n_smallDetails=@Variant(\0\0\0\x87\0\0\0\0) -t_n_mediumDetails=@Variant(\0\0\0\x87\0\0\0\0) -t_n_detailDepth=@Variant(\0\0\0\x87?@\0\0) -t_n_sharpenBlurAmount=0 -t_n_normalsStep=@Variant(\0\0\0\x87?}p\xa4) -t_n_conversionHNDepth=@Variant(\0\0\0\x87>L\xcc\xcd) -t_n_bConversionHN=false -t_n_bConversionNH=false -t_n_conversionNHIters=12 -t_n_bConversionBaseMap=false -t_n_conversionBaseMapAmplitude=@Variant(\0\0\0\x87\0\0\0\0) -t_n_conversionBaseMapFlatness=@Variant(\0\0\0\x87?\0\0\0) -t_n_conversionBaseMapNoIters=0 -t_n_conversionBaseMapFilterRadius=3 -t_n_conversionBaseMapMixNormals=@Variant(\0\0\0\x87?\0\0\0) -t_n_conversionBaseMapPreSmoothRadius=@Variant(\0\0\0\x87\0\0\0\0) +t_o_bGrayScale=false t_s_bGrayScale=true -t_s_bInvertR=false -t_s_bInvertB=false -t_s_bRemoveShading=false -t_s_noRemoveShadingGaussIter=10 -t_s_noBlurPasses=0 -t_s_bSpeclarControl=true -t_s_specularRadius=20 -t_s_specularW1=@Variant(\0\0\0\x87<#\xd7\n) -t_s_specularW2=@Variant(\0\0\0\x87\x41\xa0\0\0) -t_s_specularContrast=@Variant(\0\0\0\x87\xbf\x33\x33\x33) -t_s_specularAmplifier=@Variant(\0\0\0\x87\xc0\xa0\0\0) -t_s_smallDetails=@Variant(\0\0\0\x87\0\0\0\0) -t_s_mediumDetails=@Variant(\0\0\0\x87\0\0\0\0) -t_s_detailDepth=@Variant(\0\0\0\x87?Y\x99\x9a) -t_s_sharpenBlurAmount=0 -t_s_normalsStep=@Variant(\0\0\0\x87\0\0\0\0) -t_s_conversionHNDepth=@Variant(\0\0\0\x87>L\xcc\xcd) -t_s_bConversionHN=false -t_s_bConversionNH=false -t_s_conversionNHIters=4 -t_s_bConversionBaseMap=false -t_s_conversionBaseMapAmplitude=@Variant(\0\0\0\x87\0\0\0\0) -t_s_conversionBaseMapFlatness=@Variant(\0\0\0\x87?\0\0\0) -t_s_conversionBaseMapNoIters=0 -t_s_conversionBaseMapFilterRadius=3 -t_s_conversionBaseMapMixNormals=@Variant(\0\0\0\x87?\0\0\0) -t_s_conversionBaseMapPreSmoothRadius=@Variant(\0\0\0\x87\0\0\0\0) -t_h_bGrayScale=false +t_d_grayScaleR=@Variant(\0\0\0\x87>\xa8\xa8\xa9) +t_h_grayScaleR=@Variant(\0\0\0\x87>\xa8\xa8\xa9) +t_n_grayScaleR=@Variant(\0\0\0\x87>\xa8\xa8\xa9) +t_o_grayScaleR=@Variant(\0\0\0\x87>\xa8\xa8\xa9) +t_s_grayScaleR=@Variant(\0\0\0\x87>\xa8\xa8\xa9) +t_d_grayScaleG=@Variant(\0\0\0\x87>\xa8\xa8\xa9) +t_h_grayScaleG=@Variant(\0\0\0\x87>\xa8\xa8\xa9) +t_n_grayScaleG=@Variant(\0\0\0\x87>\xa8\xa8\xa9) +t_o_grayScaleG=@Variant(\0\0\0\x87>\xa8\xa8\xa9) +t_s_grayScaleG=@Variant(\0\0\0\x87>\xa8\xa8\xa9) +t_d_grayScaleB=@Variant(\0\0\0\x87>\xa8\xa8\xa9) +t_h_grayScaleB=@Variant(\0\0\0\x87>\xa8\xa8\xa9) +t_n_grayScaleB=@Variant(\0\0\0\x87>\xa8\xa8\xa9) +t_o_grayScaleB=@Variant(\0\0\0\x87>\xa8\xa8\xa9) +t_s_grayScaleB=@Variant(\0\0\0\x87>\xa8\xa8\xa9) +3d_depth=0.38 +t_d_bInvertR=false t_h_bInvertR=false -t_h_bInvertB=false -t_h_bRemoveShading=false -t_h_noRemoveShadingGaussIter=10 -t_h_noBlurPasses=0 -t_h_bSpeclarControl=false -t_h_specularRadius=10 -t_h_specularW1=@Variant(\0\0\0\x87@<\xcc\xcd) -t_h_specularW2=@Variant(\0\0\0\x87\x41 \0\0) -t_h_specularContrast="@Variant(\0\0\0\x87=L\xcc\xcd)" -t_h_specularAmplifier=@Variant(\0\0\0\x87@@\0\0) -t_h_smallDetails=@Variant(\0\0\0\x87\0\0\0\0) -t_h_mediumDetails=@Variant(\0\0\0\x87\0\0\0\0) -t_h_detailDepth=@Variant(\0\0\0\x87?Y\x99\x9a) -t_h_sharpenBlurAmount=0 -t_h_normalsStep=@Variant(\0\0\0\x87\0\0\0\0) -t_h_conversionHNDepth=@Variant(\0\0\0\x87\x41\\\xcc\xcd) -t_h_bConversionHN=false -t_h_bConversionNH=false -t_h_conversionNHIters=4 -t_h_bConversionBaseMap=false -t_h_conversionBaseMapAmplitude=@Variant(\0\0\0\x87\0\0\0\0) -t_h_conversionBaseMapFlatness=@Variant(\0\0\0\x87?\0\0\0) -t_h_conversionBaseMapNoIters=0 -t_h_conversionBaseMapFilterRadius=3 -t_h_conversionBaseMapMixNormals=@Variant(\0\0\0\x87?\0\0\0) -t_h_conversionBaseMapPreSmoothRadius=@Variant(\0\0\0\x87\0\0\0\0) +t_n_bInvertR=false +t_o_bInvertR=false +t_s_bInvertR=false +d_postfix=_d t_d_bInvertG=false -t_n_bInvertG=false -t_s_bInvertG=false t_h_bInvertG=false -d_win_w=1600 -d_win_h=838 -t_d_conversionBaseMapBlending=@Variant(\0\0\0\x87>\xcc\xcc\xcd) -t_o_bGrayScale=false -t_o_bInvertR=false +t_n_bInvertG=false t_o_bInvertG=false +t_s_bInvertG=false +n_postfix=_n +t_d_bInvertB=false +t_h_bInvertB=false +t_n_bInvertB=false t_o_bInvertB=false +t_s_bInvertB=false +s_postfix=_s +t_d_bRemoveShading=false +t_h_bRemoveShading=false +t_n_bRemoveShading=false t_o_bRemoveShading=false +t_s_bRemoveShading=false +h_postfix=_h +t_d_noRemoveShadingGaussIter=1 +t_h_noRemoveShadingGaussIter=4 +t_n_noRemoveShadingGaussIter=1 t_o_noRemoveShadingGaussIter=1 +t_s_noRemoveShadingGaussIter=1 +o_postfix=_o +t_d_noBlurPasses=0 +t_h_noBlurPasses=0 +t_n_noBlurPasses=0 t_o_noBlurPasses=0 +t_s_noBlurPasses=0 +t_d_bSpeclarControl=false +t_h_bSpeclarControl=false +t_n_bSpeclarControl=false t_o_bSpeclarControl=false -t_o_specularRadius=1 -t_o_specularW1=@Variant(\0\0\0\x87<#\xd7\n) -t_o_specularW2=@Variant(\0\0\0\x87<#\xd7\n) +t_s_bSpeclarControl=true +t_d_specularRadius=10 +t_h_specularRadius=10 +t_n_specularRadius=10 +t_o_specularRadius=10 +t_s_specularRadius=17 +gui_style=Fusion +t_d_specularW1="@Variant(\0\0\0\x87=\xcc\xcc\xcd)" +t_h_specularW1="@Variant(\0\0\0\x87=\xcc\xcc\xcd)" +t_n_specularW1="@Variant(\0\0\0\x87=\xcc\xcc\xcd)" +t_o_specularW1="@Variant(\0\0\0\x87=\xcc\xcc\xcd)" +t_s_specularW1="@Variant(\0\0\0\x87=\xcc\xcc\xcd)" +h_attachNormal=true +t_d_specularW2=@Variant(\0\0\0\x87\x41 \0\0) +t_h_specularW2=@Variant(\0\0\0\x87\x41 \0\0) +t_n_specularW2=@Variant(\0\0\0\x87\x41 \0\0) +t_o_specularW2=@Variant(\0\0\0\x87\x41 \0\0) +t_s_specularW2=@Variant(\0\0\0\x87\x41\x80\x14{) +t_d_specularContrast=@Variant(\0\0\0\x87\0\0\0\0) +t_h_specularContrast=@Variant(\0\0\0\x87\0\0\0\0) +t_n_specularContrast=@Variant(\0\0\0\x87\0\0\0\0) t_o_specularContrast=@Variant(\0\0\0\x87\0\0\0\0) -t_o_specularAmplifier=@Variant(\0\0\0\x87\0\0\0\0) +t_s_specularContrast=@Variant(\0\0\0\x87\xbd\xe1G\xae) +use_texture_interpolation=true +t_d_specularAmplifier=@Variant(\0\0\0\x87\xc0@\0\0) +t_h_specularAmplifier=@Variant(\0\0\0\x87\xc0@\0\0) +t_n_specularAmplifier=@Variant(\0\0\0\x87\xc0@\0\0) +t_o_specularAmplifier=@Variant(\0\0\0\x87\xc0@\0\0) +t_s_specularAmplifier=@Variant(\0\0\0\x87\xc0\x33\x33\x33) +t_d_specularBrightness=@Variant(\0\0\0\x87\0\0\0\0) +t_h_specularBrightness=@Variant(\0\0\0\x87\0\0\0\0) +t_n_specularBrightness=@Variant(\0\0\0\x87\0\0\0\0) +t_o_specularBrightness=@Variant(\0\0\0\x87\0\0\0\0) +t_s_specularBrightness=@Variant(\0\0\0\x87\0\0\0\0) +t_d_smallDetails=@Variant(\0\0\0\x87\0\0\0\0) +t_h_smallDetails=@Variant(\0\0\0\x87\0\0\0\0) +t_n_smallDetails=@Variant(\0\0\0\x87\0\0\0\0) t_o_smallDetails=@Variant(\0\0\0\x87\0\0\0\0) +t_s_smallDetails=@Variant(\0\0\0\x87\0\0\0\0) +t_d_mediumDetails=@Variant(\0\0\0\x87\0\0\0\0) +t_h_mediumDetails=@Variant(\0\0\0\x87\0\0\0\0) +t_n_mediumDetails=@Variant(\0\0\0\x87\0\0\0\0) t_o_mediumDetails=@Variant(\0\0\0\x87\0\0\0\0) -t_o_detailDepth=@Variant(\0\0\0\x87?@\0\0) +t_s_mediumDetails=@Variant(\0\0\0\x87\0\0\0\0) +t_d_detailDepth=@Variant(\0\0\0\x87?\x80\0\0) +t_h_detailDepth=@Variant(\0\0\0\x87?\x80\0\0) +t_n_detailDepth=@Variant(\0\0\0\x87?\x80\0\0) +t_o_detailDepth=@Variant(\0\0\0\x87?\x80\0\0) +t_s_detailDepth=@Variant(\0\0\0\x87?\x80\0\0) +t_d_sharpenBlurAmount=0 +t_h_sharpenBlurAmount=0 +t_n_sharpenBlurAmount=0 t_o_sharpenBlurAmount=0 -t_o_normalsStep=@Variant(\0\0\0\x87\0\0\0\0) -t_o_conversionHNDepth=@Variant(\0\0\0\x87\0\0\0\0) +t_s_sharpenBlurAmount=0 +t_d_normalsStep=@Variant(\0\0\0\x87?\x80\0\0) +t_h_normalsStep=@Variant(\0\0\0\x87?\x80\0\0) +t_n_normalsStep=@Variant(\0\0\0\x87?\x80\0\0) +t_o_normalsStep=@Variant(\0\0\0\x87?\x80\0\0) +t_s_normalsStep=@Variant(\0\0\0\x87?\x80\0\0) +t_d_heightMinValue=@Variant(\0\0\0\x87\0\0\0\0) +t_h_heightMinValue=@Variant(\0\0\0\x87\0\0\0\0) +t_n_heightMinValue=@Variant(\0\0\0\x87\0\0\0\0) +t_o_heightMinValue=@Variant(\0\0\0\x87\0\0\0\0) +t_s_heightMinValue=@Variant(\0\0\0\x87\0\0\0\0) +t_d_heightMaxValue=@Variant(\0\0\0\x87?\x80\0\0) +t_h_heightMaxValue=@Variant(\0\0\0\x87?\x80\0\0) +t_n_heightMaxValue=@Variant(\0\0\0\x87?\x80\0\0) +t_o_heightMaxValue=@Variant(\0\0\0\x87?\x80\0\0) +t_s_heightMaxValue=@Variant(\0\0\0\x87?\x80\0\0) +t_d_heightAveragingRadius=1 +t_h_heightAveragingRadius=1 +t_n_heightAveragingRadius=1 +t_o_heightAveragingRadius=1 +t_s_heightAveragingRadius=1 +t_d_conversionHNDepth=@Variant(\0\0\0\x87\x41 \0\0) +t_h_conversionHNDepth=@Variant(\0\0\0\x87\x41\x36\x66\x66) +t_n_conversionHNDepth=@Variant(\0\0\0\x87\x41 \0\0) +t_o_conversionHNDepth=@Variant(\0\0\0\x87\x41 \0\0) +t_s_conversionHNDepth=@Variant(\0\0\0\x87\x41 \0\0) +t_d_bConversionHN=false +t_h_bConversionHN=false +t_n_bConversionHN=false t_o_bConversionHN=false +t_s_bConversionHN=false +t_d_bConversionNH=false +t_h_bConversionNH=false +t_n_bConversionNH=false t_o_bConversionNH=false -t_o_conversionNHIters=0 -t_o_bConversionBaseMap=false -t_o_conversionBaseMapAmplitude=@Variant(\0\0\0\x87\0\0\0\0) -t_o_conversionBaseMapFlatness=@Variant(\0\0\0\x87\0\0\0\0) -t_o_conversionBaseMapNoIters=0 -t_o_conversionBaseMapFilterRadius=1 -t_o_conversionBaseMapMixNormals=@Variant(\0\0\0\x87\0\0\0\0) -t_o_conversionBaseMapPreSmoothRadius=@Variant(\0\0\0\x87\0\0\0\0) -t_o_ssaoNoIters=26 -t_o_ssaoBias="@Variant(\0\0\0\x87\xbf\xb7\n=)" -t_o_ssaoDepth="@Variant(\0\0\0\x87>\x8a=q)" -t_o_ssaoIntensity=@Variant(\0\0\0\x87?^\xb8R) -o_postfix=_O +t_s_bConversionNH=false t_d_conversionNHItersHuge=10 -t_d_conversionNHItersVeryLarge=10 -t_d_conversionNHItersLarge=10 -t_d_conversionNHItersMedium=10 -t_d_conversionNHItersVerySmall=10 -t_d_conversionNHItersSmall=10 -t_n_conversionNHItersHuge=34 -t_n_conversionNHItersVeryLarge=18 -t_n_conversionNHItersLarge=8 -t_n_conversionNHItersMedium=11 -t_n_conversionNHItersVerySmall=10 -t_n_conversionNHItersSmall=5 t_h_conversionNHItersHuge=10 +t_n_conversionNHItersHuge=35 t_o_conversionNHItersHuge=10 t_s_conversionNHItersHuge=10 +t_d_conversionNHItersVeryLarge=10 t_h_conversionNHItersVeryLarge=10 +t_n_conversionNHItersVeryLarge=21 t_o_conversionNHItersVeryLarge=10 t_s_conversionNHItersVeryLarge=10 +t_d_conversionNHItersLarge=10 t_h_conversionNHItersLarge=10 +t_n_conversionNHItersLarge=14 t_o_conversionNHItersLarge=10 t_s_conversionNHItersLarge=10 +t_d_conversionNHItersMedium=10 t_h_conversionNHItersMedium=10 +t_n_conversionNHItersMedium=11 t_o_conversionNHItersMedium=10 t_s_conversionNHItersMedium=10 +t_d_conversionNHItersVerySmall=10 t_h_conversionNHItersVerySmall=10 +t_n_conversionNHItersVerySmall=8 t_o_conversionNHItersVerySmall=10 t_s_conversionNHItersVerySmall=10 +t_d_conversionNHItersSmall=10 t_h_conversionNHItersSmall=10 +t_n_conversionNHItersSmall=9 t_o_conversionNHItersSmall=10 t_s_conversionNHItersSmall=10 -t_h_conversionBaseMapBlending=@Variant(\0\0\0\x87\0\0\0\0) -t_n_conversionBaseMapBlending=@Variant(\0\0\0\x87\0\0\0\0) -t_o_conversionBaseMapBlending=@Variant(\0\0\0\x87\0\0\0\0) -t_s_conversionBaseMapBlending=@Variant(\0\0\0\x87\0\0\0\0) -t_d_ssaoNoIters=2 -t_h_ssaoNoIters=2 -t_n_ssaoNoIters=2 -t_s_ssaoNoIters=2 -t_d_ssaoBias=@Variant(\0\0\0\x87?\0\0\0) -t_h_ssaoBias=@Variant(\0\0\0\x87?\0\0\0) -t_n_ssaoBias=@Variant(\0\0\0\x87?\0\0\0) -t_s_ssaoBias=@Variant(\0\0\0\x87?\0\0\0) -t_d_ssaoDepth=@Variant(\0\0\0\x87?\0\0\0) -t_h_ssaoDepth=@Variant(\0\0\0\x87?\0\0\0) -t_n_ssaoDepth=@Variant(\0\0\0\x87?\0\0\0) -t_s_ssaoDepth=@Variant(\0\0\0\x87?\0\0\0) -t_d_ssaoIntensity=@Variant(\0\0\0\x87\0\0\0\0) -t_h_ssaoIntensity=@Variant(\0\0\0\x87\0\0\0\0) -t_n_ssaoIntensity=@Variant(\0\0\0\x87\0\0\0\0) -t_s_ssaoIntensity=@Variant(\0\0\0\x87\0\0\0\0) -3d_depth=0.23 -t_d_specularBrightness=@Variant(\0\0\0\x87\0\0\0\0) -t_h_specularBrightness=@Variant(\0\0\0\x87\0\0\0\0) -t_n_specularBrightness=@Variant(\0\0\0\x87\0\0\0\0) -t_o_specularBrightness=@Variant(\0\0\0\x87\0\0\0\0) -t_s_specularBrightness=@Variant(\0\0\0\x87\0\0\0\0) -h_attachNormal=true -t_d_grayScaleR=@Variant(\0\0\0\x87>\x98\x98\x99) -t_h_grayScaleR=@Variant(\0\0\0\x87>\xa8\xa8\xa9) -t_n_grayScaleR=@Variant(\0\0\0\x87>\xa8\xa8\xa9) -t_o_grayScaleR=@Variant(\0\0\0\x87>\xa8\xa8\xa9) -t_s_grayScaleR=@Variant(\0\0\0\x87>\x98\x98\x99) -t_d_grayScaleG=@Variant(\0\0\0\x87?\x16\x96\x97) -t_h_grayScaleG=@Variant(\0\0\0\x87>\xa8\xa8\xa9) -t_n_grayScaleG=@Variant(\0\0\0\x87>\xa8\xa8\xa9) -t_o_grayScaleG=@Variant(\0\0\0\x87>\xa8\xa8\xa9) -t_s_grayScaleG=@Variant(\0\0\0\x87?\x16\x96\x97) -t_d_grayScaleB="@Variant(\0\0\0\x87=\xe0\xe0\xe1)" -t_h_grayScaleB=@Variant(\0\0\0\x87>\xa8\xa8\xa9) -t_n_grayScaleB=@Variant(\0\0\0\x87>\xa8\xa8\xa9) -t_o_grayScaleB=@Variant(\0\0\0\x87>\xa8\xa8\xa9) -t_s_grayScaleB="@Variant(\0\0\0\x87=\xe0\xe0\xe1)" -t_d_heightMinValue=@Variant(\0\0\0\x87\0\0\0\0) -t_h_heightMinValue=@Variant(\0\0\0\x87\0\0\0\0) -t_n_heightMinValue=@Variant(\0\0\0\x87\0\0\0\0) -t_o_heightMinValue=@Variant(\0\0\0\x87\0\0\0\0) -t_s_heightMinValue=@Variant(\0\0\0\x87\0\0\0\0) -t_d_heightMaxValue=@Variant(\0\0\0\x87?\x80\0\0) -t_h_heightMaxValue=@Variant(\0\0\0\x87?\x80\0\0) -t_n_heightMaxValue=@Variant(\0\0\0\x87?\x80\0\0) -t_o_heightMaxValue=@Variant(\0\0\0\x87?\x80\0\0) -t_s_heightMaxValue=@Variant(\0\0\0\x87?\x80\0\0) -t_d_heightAveragingRadius=1 -t_h_heightAveragingRadius=1 -t_n_heightAveragingRadius=1 -t_o_heightAveragingRadius=1 -t_s_heightAveragingRadius=1 -gui_style=Fusion +t_d_bConversionBaseMap=false +t_h_bConversionBaseMap=false +t_n_bConversionBaseMap=false +t_o_bConversionBaseMap=false +t_s_bConversionBaseMap=false +t_d_conversionBaseMapAmplitude=@Variant(\0\0\0\x87\xbf\x80\0\0) +t_h_conversionBaseMapAmplitude=@Variant(\0\0\0\x87\xbf\x80\0\0) +t_n_conversionBaseMapAmplitude=@Variant(\0\0\0\x87\xbf\x80\0\0) +t_o_conversionBaseMapAmplitude=@Variant(\0\0\0\x87\xbf\x80\0\0) +t_s_conversionBaseMapAmplitude=@Variant(\0\0\0\x87\xbf\x80\0\0) +t_d_conversionBaseMapFlatness=@Variant(\0\0\0\x87\0\0\0\0) +t_h_conversionBaseMapFlatness=@Variant(\0\0\0\x87\0\0\0\0) +t_n_conversionBaseMapFlatness=@Variant(\0\0\0\x87\0\0\0\0) +t_o_conversionBaseMapFlatness=@Variant(\0\0\0\x87\0\0\0\0) +t_s_conversionBaseMapFlatness=@Variant(\0\0\0\x87\0\0\0\0) +t_d_conversionBaseMapNoIters=9 +t_h_conversionBaseMapNoIters=2 +t_n_conversionBaseMapNoIters=2 +t_o_conversionBaseMapNoIters=2 +t_s_conversionBaseMapNoIters=2 +t_d_conversionBaseMapFilterRadius=2 +t_h_conversionBaseMapFilterRadius=1 +t_n_conversionBaseMapFilterRadius=1 +t_o_conversionBaseMapFilterRadius=1 +t_s_conversionBaseMapFilterRadius=1 +t_d_conversionBaseMapMixNormals=@Variant(\0\0\0\x87?\x14z\xe1) +t_h_conversionBaseMapMixNormals=@Variant(\0\0\0\x87?\0\0\0) +t_n_conversionBaseMapMixNormals=@Variant(\0\0\0\x87?\0\0\0) +t_o_conversionBaseMapMixNormals=@Variant(\0\0\0\x87?\0\0\0) +t_s_conversionBaseMapMixNormals=@Variant(\0\0\0\x87?\0\0\0) +t_d_conversionBaseMapPreSmoothRadius=@Variant(\0\0\0\x87\0\0\0\0) +t_h_conversionBaseMapPreSmoothRadius=@Variant(\0\0\0\x87\0\0\0\0) +t_n_conversionBaseMapPreSmoothRadius=@Variant(\0\0\0\x87\0\0\0\0) +t_o_conversionBaseMapPreSmoothRadius=@Variant(\0\0\0\x87\0\0\0\0) +t_s_conversionBaseMapPreSmoothRadius=@Variant(\0\0\0\x87\0\0\0\0) +t_d_conversionBaseMapBlending="@Variant(\0\0\0\x87=\x8f\\))" +t_h_conversionBaseMapBlending=@Variant(\0\0\0\x87?\0\0\0) +t_n_conversionBaseMapBlending=@Variant(\0\0\0\x87?\0\0\0) +t_o_conversionBaseMapBlending=@Variant(\0\0\0\x87?\0\0\0) +t_s_conversionBaseMapBlending=@Variant(\0\0\0\x87?\0\0\0) +t_d_ssaoNoIters=20 +t_h_ssaoNoIters=20 +t_n_ssaoNoIters=20 +t_o_ssaoNoIters=20 +t_s_ssaoNoIters=20 +t_d_ssaoBias=@Variant(\0\0\0\x87\xbf\xc0\0\0) +t_h_ssaoBias=@Variant(\0\0\0\x87\xbf\xc0\0\0) +t_n_ssaoBias=@Variant(\0\0\0\x87\xbf\xc0\0\0) +t_o_ssaoBias=@Variant(\0\0\0\x87\xbf\xee\x14{) +t_s_ssaoBias=@Variant(\0\0\0\x87\xbf\xc0\0\0) +t_d_ssaoDepth=@Variant(\0\0\0\x87>\x99\x99\x9a) +t_h_ssaoDepth=@Variant(\0\0\0\x87>\x99\x99\x9a) +t_n_ssaoDepth=@Variant(\0\0\0\x87>\x99\x99\x9a) +t_o_ssaoDepth="@Variant(\0\0\0\x87>W\n=)" +t_s_ssaoDepth=@Variant(\0\0\0\x87>\x99\x99\x9a) +t_d_ssaoIntensity=@Variant(\0\0\0\x87?\x80\0\0) +t_h_ssaoIntensity=@Variant(\0\0\0\x87?\x80\0\0) +t_n_ssaoIntensity=@Variant(\0\0\0\x87?\x80\0\0) +t_o_ssaoIntensity=@Variant(\0\0\0\x87?L\xcc\xcd) +t_s_ssaoIntensity=@Variant(\0\0\0\x87?\x80\0\0) +settings_name=Default +settings_description=asd +settings_path=configs/28_asd.ini +uv_tiling_type=0 +uv_tiling_radius=50 +uv_tiling_mirror_x=false +uv_tiling_mirror_y=false +uv_tiling_mirror_xy=true +uv_tiling_random_inner_radius=0 +uv_tiling_random_outer_radius=38 +uv_tiling_random_rotate=-1 diff --git a/configs/27_asd.ini b/configs/27_asd.ini new file mode 100644 index 0000000..945a6bb --- /dev/null +++ b/configs/27_asd.ini @@ -0,0 +1,255 @@ +[General] +d_win_w=1600 +d_win_h=838 +recent_dir= +recent_mesh_dir= +t_d_bGrayScale=false +t_h_bGrayScale=false +t_n_bGrayScale=false +t_o_bGrayScale=false +t_s_bGrayScale=true +t_d_grayScaleR=@Variant(\0\0\0\x87>\xa8\xa8\xa9) +t_h_grayScaleR=@Variant(\0\0\0\x87>\xa8\xa8\xa9) +t_n_grayScaleR=@Variant(\0\0\0\x87>\xa8\xa8\xa9) +t_o_grayScaleR=@Variant(\0\0\0\x87>\xa8\xa8\xa9) +t_s_grayScaleR=@Variant(\0\0\0\x87>\xa8\xa8\xa9) +t_d_grayScaleG=@Variant(\0\0\0\x87>\xa8\xa8\xa9) +t_h_grayScaleG=@Variant(\0\0\0\x87>\xa8\xa8\xa9) +t_n_grayScaleG=@Variant(\0\0\0\x87>\xa8\xa8\xa9) +t_o_grayScaleG=@Variant(\0\0\0\x87>\xa8\xa8\xa9) +t_s_grayScaleG=@Variant(\0\0\0\x87>\xa8\xa8\xa9) +t_d_grayScaleB=@Variant(\0\0\0\x87>\xa8\xa8\xa9) +t_h_grayScaleB=@Variant(\0\0\0\x87>\xa8\xa8\xa9) +t_n_grayScaleB=@Variant(\0\0\0\x87>\xa8\xa8\xa9) +t_o_grayScaleB=@Variant(\0\0\0\x87>\xa8\xa8\xa9) +t_s_grayScaleB=@Variant(\0\0\0\x87>\xa8\xa8\xa9) +3d_depth=0.37 +t_d_bInvertR=false +t_h_bInvertR=false +t_n_bInvertR=false +t_o_bInvertR=false +t_s_bInvertR=false +d_postfix=_d +t_d_bInvertG=false +t_h_bInvertG=false +t_n_bInvertG=false +t_o_bInvertG=false +t_s_bInvertG=false +n_postfix=_n +t_d_bInvertB=false +t_h_bInvertB=false +t_n_bInvertB=false +t_o_bInvertB=false +t_s_bInvertB=false +s_postfix=_s +t_d_bRemoveShading=false +t_h_bRemoveShading=false +t_n_bRemoveShading=false +t_o_bRemoveShading=false +t_s_bRemoveShading=false +h_postfix=_h +t_d_noRemoveShadingGaussIter=1 +t_h_noRemoveShadingGaussIter=4 +t_n_noRemoveShadingGaussIter=1 +t_o_noRemoveShadingGaussIter=1 +t_s_noRemoveShadingGaussIter=1 +o_postfix=_o +t_d_noBlurPasses=0 +t_h_noBlurPasses=0 +t_n_noBlurPasses=0 +t_o_noBlurPasses=0 +t_s_noBlurPasses=0 +t_d_bSpeclarControl=false +t_h_bSpeclarControl=false +t_n_bSpeclarControl=false +t_o_bSpeclarControl=false +t_s_bSpeclarControl=true +t_d_specularRadius=10 +t_h_specularRadius=10 +t_n_specularRadius=10 +t_o_specularRadius=10 +t_s_specularRadius=17 +gui_style=Fusion +t_d_specularW1="@Variant(\0\0\0\x87=\xcc\xcc\xcd)" +t_h_specularW1="@Variant(\0\0\0\x87=\xcc\xcc\xcd)" +t_n_specularW1="@Variant(\0\0\0\x87=\xcc\xcc\xcd)" +t_o_specularW1="@Variant(\0\0\0\x87=\xcc\xcc\xcd)" +t_s_specularW1="@Variant(\0\0\0\x87=\xcc\xcc\xcd)" +h_attachNormal=true +t_d_specularW2=@Variant(\0\0\0\x87\x41 \0\0) +t_h_specularW2=@Variant(\0\0\0\x87\x41 \0\0) +t_n_specularW2=@Variant(\0\0\0\x87\x41 \0\0) +t_o_specularW2=@Variant(\0\0\0\x87\x41 \0\0) +t_s_specularW2=@Variant(\0\0\0\x87\x41\x80\x14{) +t_d_specularContrast=@Variant(\0\0\0\x87\0\0\0\0) +t_h_specularContrast=@Variant(\0\0\0\x87\0\0\0\0) +t_n_specularContrast=@Variant(\0\0\0\x87\0\0\0\0) +t_o_specularContrast=@Variant(\0\0\0\x87\0\0\0\0) +t_s_specularContrast=@Variant(\0\0\0\x87\xbd\xe1G\xae) +use_texture_interpolation=true +t_d_specularAmplifier=@Variant(\0\0\0\x87\xc0@\0\0) +t_h_specularAmplifier=@Variant(\0\0\0\x87\xc0@\0\0) +t_n_specularAmplifier=@Variant(\0\0\0\x87\xc0@\0\0) +t_o_specularAmplifier=@Variant(\0\0\0\x87\xc0@\0\0) +t_s_specularAmplifier=@Variant(\0\0\0\x87\xc0\x33\x33\x33) +t_d_specularBrightness=@Variant(\0\0\0\x87\0\0\0\0) +t_h_specularBrightness=@Variant(\0\0\0\x87\0\0\0\0) +t_n_specularBrightness=@Variant(\0\0\0\x87\0\0\0\0) +t_o_specularBrightness=@Variant(\0\0\0\x87\0\0\0\0) +t_s_specularBrightness=@Variant(\0\0\0\x87\0\0\0\0) +t_d_smallDetails=@Variant(\0\0\0\x87\0\0\0\0) +t_h_smallDetails=@Variant(\0\0\0\x87\0\0\0\0) +t_n_smallDetails=@Variant(\0\0\0\x87\0\0\0\0) +t_o_smallDetails=@Variant(\0\0\0\x87\0\0\0\0) +t_s_smallDetails=@Variant(\0\0\0\x87\0\0\0\0) +t_d_mediumDetails=@Variant(\0\0\0\x87\0\0\0\0) +t_h_mediumDetails=@Variant(\0\0\0\x87\0\0\0\0) +t_n_mediumDetails=@Variant(\0\0\0\x87\0\0\0\0) +t_o_mediumDetails=@Variant(\0\0\0\x87\0\0\0\0) +t_s_mediumDetails=@Variant(\0\0\0\x87\0\0\0\0) +t_d_detailDepth=@Variant(\0\0\0\x87?\x80\0\0) +t_h_detailDepth=@Variant(\0\0\0\x87?\x80\0\0) +t_n_detailDepth=@Variant(\0\0\0\x87?\x80\0\0) +t_o_detailDepth=@Variant(\0\0\0\x87?\x80\0\0) +t_s_detailDepth=@Variant(\0\0\0\x87?\x80\0\0) +t_d_sharpenBlurAmount=0 +t_h_sharpenBlurAmount=0 +t_n_sharpenBlurAmount=0 +t_o_sharpenBlurAmount=0 +t_s_sharpenBlurAmount=0 +t_d_normalsStep=@Variant(\0\0\0\x87?\x80\0\0) +t_h_normalsStep=@Variant(\0\0\0\x87?\x80\0\0) +t_n_normalsStep=@Variant(\0\0\0\x87?\x80\0\0) +t_o_normalsStep=@Variant(\0\0\0\x87?\x80\0\0) +t_s_normalsStep=@Variant(\0\0\0\x87?\x80\0\0) +t_d_heightMinValue=@Variant(\0\0\0\x87\0\0\0\0) +t_h_heightMinValue=@Variant(\0\0\0\x87\0\0\0\0) +t_n_heightMinValue=@Variant(\0\0\0\x87\0\0\0\0) +t_o_heightMinValue=@Variant(\0\0\0\x87\0\0\0\0) +t_s_heightMinValue=@Variant(\0\0\0\x87\0\0\0\0) +t_d_heightMaxValue=@Variant(\0\0\0\x87?\x80\0\0) +t_h_heightMaxValue=@Variant(\0\0\0\x87?\x80\0\0) +t_n_heightMaxValue=@Variant(\0\0\0\x87?\x80\0\0) +t_o_heightMaxValue=@Variant(\0\0\0\x87?\x80\0\0) +t_s_heightMaxValue=@Variant(\0\0\0\x87?\x80\0\0) +t_d_heightAveragingRadius=1 +t_h_heightAveragingRadius=1 +t_n_heightAveragingRadius=1 +t_o_heightAveragingRadius=1 +t_s_heightAveragingRadius=1 +t_d_conversionHNDepth=@Variant(\0\0\0\x87\x41 \0\0) +t_h_conversionHNDepth=@Variant(\0\0\0\x87\x41\x36\x66\x66) +t_n_conversionHNDepth=@Variant(\0\0\0\x87\x41 \0\0) +t_o_conversionHNDepth=@Variant(\0\0\0\x87\x41 \0\0) +t_s_conversionHNDepth=@Variant(\0\0\0\x87\x41 \0\0) +t_d_bConversionHN=false +t_h_bConversionHN=false +t_n_bConversionHN=false +t_o_bConversionHN=false +t_s_bConversionHN=false +t_d_bConversionNH=false +t_h_bConversionNH=false +t_n_bConversionNH=false +t_o_bConversionNH=false +t_s_bConversionNH=false +t_d_conversionNHItersHuge=10 +t_h_conversionNHItersHuge=10 +t_n_conversionNHItersHuge=35 +t_o_conversionNHItersHuge=10 +t_s_conversionNHItersHuge=10 +t_d_conversionNHItersVeryLarge=10 +t_h_conversionNHItersVeryLarge=10 +t_n_conversionNHItersVeryLarge=21 +t_o_conversionNHItersVeryLarge=10 +t_s_conversionNHItersVeryLarge=10 +t_d_conversionNHItersLarge=10 +t_h_conversionNHItersLarge=10 +t_n_conversionNHItersLarge=14 +t_o_conversionNHItersLarge=10 +t_s_conversionNHItersLarge=10 +t_d_conversionNHItersMedium=10 +t_h_conversionNHItersMedium=10 +t_n_conversionNHItersMedium=11 +t_o_conversionNHItersMedium=10 +t_s_conversionNHItersMedium=10 +t_d_conversionNHItersVerySmall=10 +t_h_conversionNHItersVerySmall=10 +t_n_conversionNHItersVerySmall=8 +t_o_conversionNHItersVerySmall=10 +t_s_conversionNHItersVerySmall=10 +t_d_conversionNHItersSmall=10 +t_h_conversionNHItersSmall=10 +t_n_conversionNHItersSmall=9 +t_o_conversionNHItersSmall=10 +t_s_conversionNHItersSmall=10 +t_d_bConversionBaseMap=false +t_h_bConversionBaseMap=false +t_n_bConversionBaseMap=false +t_o_bConversionBaseMap=false +t_s_bConversionBaseMap=false +t_d_conversionBaseMapAmplitude=@Variant(\0\0\0\x87\xbf\x80\0\0) +t_h_conversionBaseMapAmplitude=@Variant(\0\0\0\x87\xbf\x80\0\0) +t_n_conversionBaseMapAmplitude=@Variant(\0\0\0\x87\xbf\x80\0\0) +t_o_conversionBaseMapAmplitude=@Variant(\0\0\0\x87\xbf\x80\0\0) +t_s_conversionBaseMapAmplitude=@Variant(\0\0\0\x87\xbf\x80\0\0) +t_d_conversionBaseMapFlatness=@Variant(\0\0\0\x87\0\0\0\0) +t_h_conversionBaseMapFlatness=@Variant(\0\0\0\x87\0\0\0\0) +t_n_conversionBaseMapFlatness=@Variant(\0\0\0\x87\0\0\0\0) +t_o_conversionBaseMapFlatness=@Variant(\0\0\0\x87\0\0\0\0) +t_s_conversionBaseMapFlatness=@Variant(\0\0\0\x87\0\0\0\0) +t_d_conversionBaseMapNoIters=9 +t_h_conversionBaseMapNoIters=2 +t_n_conversionBaseMapNoIters=2 +t_o_conversionBaseMapNoIters=2 +t_s_conversionBaseMapNoIters=2 +t_d_conversionBaseMapFilterRadius=2 +t_h_conversionBaseMapFilterRadius=1 +t_n_conversionBaseMapFilterRadius=1 +t_o_conversionBaseMapFilterRadius=1 +t_s_conversionBaseMapFilterRadius=1 +t_d_conversionBaseMapMixNormals=@Variant(\0\0\0\x87?\x14z\xe1) +t_h_conversionBaseMapMixNormals=@Variant(\0\0\0\x87?\0\0\0) +t_n_conversionBaseMapMixNormals=@Variant(\0\0\0\x87?\0\0\0) +t_o_conversionBaseMapMixNormals=@Variant(\0\0\0\x87?\0\0\0) +t_s_conversionBaseMapMixNormals=@Variant(\0\0\0\x87?\0\0\0) +t_d_conversionBaseMapPreSmoothRadius=@Variant(\0\0\0\x87\0\0\0\0) +t_h_conversionBaseMapPreSmoothRadius=@Variant(\0\0\0\x87\0\0\0\0) +t_n_conversionBaseMapPreSmoothRadius=@Variant(\0\0\0\x87\0\0\0\0) +t_o_conversionBaseMapPreSmoothRadius=@Variant(\0\0\0\x87\0\0\0\0) +t_s_conversionBaseMapPreSmoothRadius=@Variant(\0\0\0\x87\0\0\0\0) +t_d_conversionBaseMapBlending="@Variant(\0\0\0\x87=\x8f\\))" +t_h_conversionBaseMapBlending=@Variant(\0\0\0\x87?\0\0\0) +t_n_conversionBaseMapBlending=@Variant(\0\0\0\x87?\0\0\0) +t_o_conversionBaseMapBlending=@Variant(\0\0\0\x87?\0\0\0) +t_s_conversionBaseMapBlending=@Variant(\0\0\0\x87?\0\0\0) +t_d_ssaoNoIters=20 +t_h_ssaoNoIters=20 +t_n_ssaoNoIters=20 +t_o_ssaoNoIters=20 +t_s_ssaoNoIters=20 +t_d_ssaoBias=@Variant(\0\0\0\x87\xbf\xc0\0\0) +t_h_ssaoBias=@Variant(\0\0\0\x87\xbf\xc0\0\0) +t_n_ssaoBias=@Variant(\0\0\0\x87\xbf\xc0\0\0) +t_o_ssaoBias=@Variant(\0\0\0\x87\xbf\xee\x14{) +t_s_ssaoBias=@Variant(\0\0\0\x87\xbf\xc0\0\0) +t_d_ssaoDepth=@Variant(\0\0\0\x87>\x99\x99\x9a) +t_h_ssaoDepth=@Variant(\0\0\0\x87>\x99\x99\x9a) +t_n_ssaoDepth=@Variant(\0\0\0\x87>\x99\x99\x9a) +t_o_ssaoDepth="@Variant(\0\0\0\x87>W\n=)" +t_s_ssaoDepth=@Variant(\0\0\0\x87>\x99\x99\x9a) +t_d_ssaoIntensity=@Variant(\0\0\0\x87?\x80\0\0) +t_h_ssaoIntensity=@Variant(\0\0\0\x87?\x80\0\0) +t_n_ssaoIntensity=@Variant(\0\0\0\x87?\x80\0\0) +t_o_ssaoIntensity=@Variant(\0\0\0\x87?L\xcc\xcd) +t_s_ssaoIntensity=@Variant(\0\0\0\x87?\x80\0\0) +settings_name=MirrorMode +settings_description=This is mirro mode settings +settings_path=configs/27_asd.ini +uv_tiling_type=2 +uv_tiling_radius=50 +uv_tiling_mirror_x=false +uv_tiling_mirror_y=false +uv_tiling_mirror_xy=true +uv_tiling_random_inner_radius=0 +uv_tiling_random_outer_radius=38 +uv_tiling_random_rotate=-1 diff --git a/configs/28_asd.ini b/configs/28_asd.ini new file mode 100644 index 0000000..5cc2ca1 --- /dev/null +++ b/configs/28_asd.ini @@ -0,0 +1,255 @@ +[General] +3d_depth=0.29 +d_postfix=_d +d_win_h=876 +d_win_w=1549 +gui_style=Fusion +h_attachNormal=true +h_postfix=_h +n_postfix=_n +o_postfix=_o +recent_dir=/home/mkk/Imagens/OrnamentsShields0013_1_M.jpg +recent_mesh_dir=/media/DANE/Doktorat/ZaawansowanaGrafika3D/AwesomeBumpRepo/build-AwesomeBump-Desktop_Qt_5_4_0_GCC_64bit-Release/Cube +s_postfix=_s +settings_description=asd +settings_name=Default +settings_path=configs/28_asd.ini +t_d_bConversionBaseMap=false +t_d_bConversionHN=false +t_d_bConversionNH=false +t_d_bGrayScale=false +t_d_bInvertB=false +t_d_bInvertG=false +t_d_bInvertR=false +t_d_bRemoveShading=false +t_d_bSpeclarControl=false +t_d_conversionBaseMapAmplitude=@Variant(\0\0\0\x87\xbf\xb5\xc2\x8f) +t_d_conversionBaseMapBlending=@Variant(\0\0\0\x87>\x85\x1e\xb8) +t_d_conversionBaseMapFilterRadius=3 +t_d_conversionBaseMapFlatness=@Variant(\0\0\0\x87\0\0\0\0) +t_d_conversionBaseMapMixNormals=@Variant(\0\0\0\x87>\xa3\xd7\n) +t_d_conversionBaseMapNoIters=12 +t_d_conversionBaseMapPreSmoothRadius=@Variant(\0\0\0\x87@`\0\0) +t_d_conversionHNDepth=@Variant(\0\0\0\x87\x41 \0\0) +t_d_conversionNHItersHuge=10 +t_d_conversionNHItersLarge=10 +t_d_conversionNHItersMedium=10 +t_d_conversionNHItersSmall=10 +t_d_conversionNHItersVeryLarge=10 +t_d_conversionNHItersVerySmall=10 +t_d_detailDepth=@Variant(\0\0\0\x87?\x80\0\0) +t_d_grayScaleB=@Variant(\0\0\0\x87>\xa8\xa8\xa9) +t_d_grayScaleG=@Variant(\0\0\0\x87>\xa8\xa8\xa9) +t_d_grayScaleR=@Variant(\0\0\0\x87>\xa8\xa8\xa9) +t_d_heightAveragingRadius=1 +t_d_heightMaxValue=@Variant(\0\0\0\x87?\x80\0\0) +t_d_heightMinValue=@Variant(\0\0\0\x87\0\0\0\0) +t_d_mediumDetails=@Variant(\0\0\0\x87\0\0\0\0) +t_d_noBlurPasses=0 +t_d_noRemoveShadingGaussIter=1 +t_d_normalsStep=@Variant(\0\0\0\x87?\x80\0\0) +t_d_sharpenBlurAmount=0 +t_d_smallDetails=@Variant(\0\0\0\x87\0\0\0\0) +t_d_specularAmplifier=@Variant(\0\0\0\x87\xc0@\0\0) +t_d_specularBrightness=@Variant(\0\0\0\x87\0\0\0\0) +t_d_specularContrast=@Variant(\0\0\0\x87\0\0\0\0) +t_d_specularRadius=10 +t_d_specularW1="@Variant(\0\0\0\x87=\xcc\xcc\xcd)" +t_d_specularW2=@Variant(\0\0\0\x87\x41 \0\0) +t_d_ssaoBias=@Variant(\0\0\0\x87\xbf\xc0\0\0) +t_d_ssaoDepth=@Variant(\0\0\0\x87>\x99\x99\x9a) +t_d_ssaoIntensity=@Variant(\0\0\0\x87?\x80\0\0) +t_d_ssaoNoIters=20 +t_h_bConversionBaseMap=false +t_h_bConversionHN=false +t_h_bConversionNH=false +t_h_bGrayScale=false +t_h_bInvertB=false +t_h_bInvertG=false +t_h_bInvertR=false +t_h_bRemoveShading=false +t_h_bSpeclarControl=false +t_h_conversionBaseMapAmplitude=@Variant(\0\0\0\x87\xbf\x80\0\0) +t_h_conversionBaseMapBlending=@Variant(\0\0\0\x87?\0\0\0) +t_h_conversionBaseMapFilterRadius=1 +t_h_conversionBaseMapFlatness=@Variant(\0\0\0\x87\0\0\0\0) +t_h_conversionBaseMapMixNormals=@Variant(\0\0\0\x87?\0\0\0) +t_h_conversionBaseMapNoIters=2 +t_h_conversionBaseMapPreSmoothRadius=@Variant(\0\0\0\x87\0\0\0\0) +t_h_conversionHNDepth=@Variant(\0\0\0\x87\x41\xab\x33\x33) +t_h_conversionNHItersHuge=10 +t_h_conversionNHItersLarge=10 +t_h_conversionNHItersMedium=10 +t_h_conversionNHItersSmall=10 +t_h_conversionNHItersVeryLarge=10 +t_h_conversionNHItersVerySmall=10 +t_h_detailDepth=@Variant(\0\0\0\x87?\x80\0\0) +t_h_grayScaleB=@Variant(\0\0\0\x87>\xa8\xa8\xa9) +t_h_grayScaleG=@Variant(\0\0\0\x87>\xa8\xa8\xa9) +t_h_grayScaleR=@Variant(\0\0\0\x87>\xa8\xa8\xa9) +t_h_heightAveragingRadius=1 +t_h_heightMaxValue=@Variant(\0\0\0\x87?\x80\0\0) +t_h_heightMinValue=@Variant(\0\0\0\x87\0\0\0\0) +t_h_mediumDetails=@Variant(\0\0\0\x87\0\0\0\0) +t_h_noBlurPasses=0 +t_h_noRemoveShadingGaussIter=4 +t_h_normalsStep=@Variant(\0\0\0\x87?\x80\0\0) +t_h_sharpenBlurAmount=0 +t_h_smallDetails=@Variant(\0\0\0\x87\0\0\0\0) +t_h_specularAmplifier=@Variant(\0\0\0\x87\xc0@\0\0) +t_h_specularBrightness=@Variant(\0\0\0\x87\0\0\0\0) +t_h_specularContrast=@Variant(\0\0\0\x87\0\0\0\0) +t_h_specularRadius=10 +t_h_specularW1="@Variant(\0\0\0\x87=\xcc\xcc\xcd)" +t_h_specularW2=@Variant(\0\0\0\x87\x41 \0\0) +t_h_ssaoBias=@Variant(\0\0\0\x87\xbf\xc0\0\0) +t_h_ssaoDepth=@Variant(\0\0\0\x87>\x99\x99\x9a) +t_h_ssaoIntensity=@Variant(\0\0\0\x87?\x80\0\0) +t_h_ssaoNoIters=20 +t_n_bConversionBaseMap=false +t_n_bConversionHN=false +t_n_bConversionNH=false +t_n_bGrayScale=false +t_n_bInvertB=false +t_n_bInvertG=false +t_n_bInvertR=false +t_n_bRemoveShading=false +t_n_bSpeclarControl=false +t_n_conversionBaseMapAmplitude=@Variant(\0\0\0\x87\xbf\x80\0\0) +t_n_conversionBaseMapBlending=@Variant(\0\0\0\x87?\0\0\0) +t_n_conversionBaseMapFilterRadius=1 +t_n_conversionBaseMapFlatness=@Variant(\0\0\0\x87\0\0\0\0) +t_n_conversionBaseMapMixNormals=@Variant(\0\0\0\x87?\0\0\0) +t_n_conversionBaseMapNoIters=2 +t_n_conversionBaseMapPreSmoothRadius=@Variant(\0\0\0\x87\0\0\0\0) +t_n_conversionHNDepth=@Variant(\0\0\0\x87\x41 \0\0) +t_n_conversionNHItersHuge=35 +t_n_conversionNHItersLarge=14 +t_n_conversionNHItersMedium=11 +t_n_conversionNHItersSmall=9 +t_n_conversionNHItersVeryLarge=21 +t_n_conversionNHItersVerySmall=8 +t_n_detailDepth=@Variant(\0\0\0\x87?\x80\0\0) +t_n_grayScaleB=@Variant(\0\0\0\x87>\xa8\xa8\xa9) +t_n_grayScaleG=@Variant(\0\0\0\x87>\xa8\xa8\xa9) +t_n_grayScaleR=@Variant(\0\0\0\x87>\xa8\xa8\xa9) +t_n_heightAveragingRadius=1 +t_n_heightMaxValue=@Variant(\0\0\0\x87?\x80\0\0) +t_n_heightMinValue=@Variant(\0\0\0\x87\0\0\0\0) +t_n_mediumDetails=@Variant(\0\0\0\x87\0\0\0\0) +t_n_noBlurPasses=0 +t_n_noRemoveShadingGaussIter=1 +t_n_normalsStep=@Variant(\0\0\0\x87?\x80\0\0) +t_n_sharpenBlurAmount=0 +t_n_smallDetails=@Variant(\0\0\0\x87\0\0\0\0) +t_n_specularAmplifier=@Variant(\0\0\0\x87\xc0@\0\0) +t_n_specularBrightness=@Variant(\0\0\0\x87\0\0\0\0) +t_n_specularContrast=@Variant(\0\0\0\x87\0\0\0\0) +t_n_specularRadius=10 +t_n_specularW1="@Variant(\0\0\0\x87=\xcc\xcc\xcd)" +t_n_specularW2=@Variant(\0\0\0\x87\x41 \0\0) +t_n_ssaoBias=@Variant(\0\0\0\x87\xbf\xc0\0\0) +t_n_ssaoDepth=@Variant(\0\0\0\x87>\x99\x99\x9a) +t_n_ssaoIntensity=@Variant(\0\0\0\x87?\x80\0\0) +t_n_ssaoNoIters=20 +t_o_bConversionBaseMap=false +t_o_bConversionHN=false +t_o_bConversionNH=false +t_o_bGrayScale=false +t_o_bInvertB=false +t_o_bInvertG=false +t_o_bInvertR=false +t_o_bRemoveShading=false +t_o_bSpeclarControl=false +t_o_conversionBaseMapAmplitude=@Variant(\0\0\0\x87\xbf\x80\0\0) +t_o_conversionBaseMapBlending=@Variant(\0\0\0\x87?\0\0\0) +t_o_conversionBaseMapFilterRadius=1 +t_o_conversionBaseMapFlatness=@Variant(\0\0\0\x87\0\0\0\0) +t_o_conversionBaseMapMixNormals=@Variant(\0\0\0\x87?\0\0\0) +t_o_conversionBaseMapNoIters=2 +t_o_conversionBaseMapPreSmoothRadius=@Variant(\0\0\0\x87\0\0\0\0) +t_o_conversionHNDepth=@Variant(\0\0\0\x87\x41 \0\0) +t_o_conversionNHItersHuge=10 +t_o_conversionNHItersLarge=10 +t_o_conversionNHItersMedium=10 +t_o_conversionNHItersSmall=10 +t_o_conversionNHItersVeryLarge=10 +t_o_conversionNHItersVerySmall=10 +t_o_detailDepth=@Variant(\0\0\0\x87?\x80\0\0) +t_o_grayScaleB=@Variant(\0\0\0\x87>\xa8\xa8\xa9) +t_o_grayScaleG=@Variant(\0\0\0\x87>\xa8\xa8\xa9) +t_o_grayScaleR=@Variant(\0\0\0\x87>\xa8\xa8\xa9) +t_o_heightAveragingRadius=1 +t_o_heightMaxValue=@Variant(\0\0\0\x87?\x80\0\0) +t_o_heightMinValue=@Variant(\0\0\0\x87\0\0\0\0) +t_o_mediumDetails=@Variant(\0\0\0\x87\0\0\0\0) +t_o_noBlurPasses=0 +t_o_noRemoveShadingGaussIter=1 +t_o_normalsStep=@Variant(\0\0\0\x87?\x80\0\0) +t_o_sharpenBlurAmount=0 +t_o_smallDetails=@Variant(\0\0\0\x87\0\0\0\0) +t_o_specularAmplifier=@Variant(\0\0\0\x87\xc0@\0\0) +t_o_specularBrightness=@Variant(\0\0\0\x87\0\0\0\0) +t_o_specularContrast=@Variant(\0\0\0\x87\0\0\0\0) +t_o_specularRadius=10 +t_o_specularW1="@Variant(\0\0\0\x87=\xcc\xcc\xcd)" +t_o_specularW2=@Variant(\0\0\0\x87\x41 \0\0) +t_o_ssaoBias=@Variant(\0\0\0\x87\xc0\x1e\x14{) +t_o_ssaoDepth=@Variant(\0\0\0\x87?\x80\0\0) +t_o_ssaoIntensity=@Variant(\0\0\0\x87?\x86\x66\x66) +t_o_ssaoNoIters=20 +t_s_bConversionBaseMap=false +t_s_bConversionHN=false +t_s_bConversionNH=false +t_s_bGrayScale=true +t_s_bInvertB=true +t_s_bInvertG=false +t_s_bInvertR=false +t_s_bRemoveShading=false +t_s_bSpeclarControl=true +t_s_conversionBaseMapAmplitude=@Variant(\0\0\0\x87\xbf\x80\0\0) +t_s_conversionBaseMapBlending=@Variant(\0\0\0\x87?\0\0\0) +t_s_conversionBaseMapFilterRadius=1 +t_s_conversionBaseMapFlatness=@Variant(\0\0\0\x87\0\0\0\0) +t_s_conversionBaseMapMixNormals=@Variant(\0\0\0\x87?\0\0\0) +t_s_conversionBaseMapNoIters=2 +t_s_conversionBaseMapPreSmoothRadius=@Variant(\0\0\0\x87\0\0\0\0) +t_s_conversionHNDepth=@Variant(\0\0\0\x87\x41 \0\0) +t_s_conversionNHItersHuge=10 +t_s_conversionNHItersLarge=10 +t_s_conversionNHItersMedium=10 +t_s_conversionNHItersSmall=10 +t_s_conversionNHItersVeryLarge=10 +t_s_conversionNHItersVerySmall=10 +t_s_detailDepth=@Variant(\0\0\0\x87?\x80\0\0) +t_s_grayScaleB=@Variant(\0\0\0\x87>\xca\xca\xcb) +t_s_grayScaleG=@Variant(\0\0\0\x87>\x86\x86\x87) +t_s_grayScaleR=@Variant(\0\0\0\x87>@\xc0\xc1) +t_s_heightAveragingRadius=30 +t_s_heightMaxValue=@Variant(\0\0\0\x87?\x80\0\0) +t_s_heightMinValue=@Variant(\0\0\0\x87\0\0\0\0) +t_s_mediumDetails=@Variant(\0\0\0\x87\0\0\0\0) +t_s_noBlurPasses=0 +t_s_noRemoveShadingGaussIter=1 +t_s_normalsStep=@Variant(\0\0\0\x87?\x80\0\0) +t_s_sharpenBlurAmount=0 +t_s_smallDetails=@Variant(\0\0\0\x87\0\0\0\0) +t_s_specularAmplifier=@Variant(\0\0\0\x87\xc0\xc6\x66\x66) +t_s_specularBrightness="@Variant(\0\0\0\x87\xbeW\n=)" +t_s_specularContrast=@Variant(\0\0\0\x87\xbe\xb8Q\xec) +t_s_specularRadius=18 +t_s_specularW1="@Variant(\0\0\0\x87=\xcc\xcc\xcd)" +t_s_specularW2=@Variant(\0\0\0\x87\x41\x80\x14{) +t_s_ssaoBias=@Variant(\0\0\0\x87\xbf\xc0\0\0) +t_s_ssaoDepth=@Variant(\0\0\0\x87>\x99\x99\x9a) +t_s_ssaoIntensity=@Variant(\0\0\0\x87?\x80\0\0) +t_s_ssaoNoIters=20 +use_texture_interpolation=true +uv_tiling_mirror_x=false +uv_tiling_mirror_xy=true +uv_tiling_mirror_y=false +uv_tiling_radius=20 +uv_tiling_random_inner_radius=20 +uv_tiling_random_outer_radius=40 +uv_tiling_random_rotate=0 +uv_tiling_type=0 diff --git a/configs/36_Dragon.ini b/configs/36_Dragon.ini new file mode 100644 index 0000000..083218b --- /dev/null +++ b/configs/36_Dragon.ini @@ -0,0 +1,255 @@ +[General] +3d_depth=0.29 +d_postfix=_d +d_win_h=876 +d_win_w=1549 +gui_style=Fusion +h_attachNormal=true +h_postfix=_h +n_postfix=_n +o_postfix=_o +recent_dir=/home/mkk/Imagens/OrnamentsShields0013_1_M.jpg +recent_mesh_dir=/media/DANE/Doktorat/ZaawansowanaGrafika3D/AwesomeBumpRepo/build-AwesomeBump-Desktop_Qt_5_4_0_GCC_64bit-Release/Cube +s_postfix=_s +settings_description=... +settings_name=Dragon +settings_path=configs/36_Dragon.ini +t_d_bConversionBaseMap=false +t_d_bConversionHN=false +t_d_bConversionNH=false +t_d_bGrayScale=false +t_d_bInvertB=false +t_d_bInvertG=false +t_d_bInvertR=false +t_d_bRemoveShading=false +t_d_bSpeclarControl=false +t_d_conversionBaseMapAmplitude=@Variant(\0\0\0\x87\xbf\xb5\xc2\x8f) +t_d_conversionBaseMapBlending=@Variant(\0\0\0\x87>\x85\x1e\xb8) +t_d_conversionBaseMapFilterRadius=3 +t_d_conversionBaseMapFlatness=@Variant(\0\0\0\x87\0\0\0\0) +t_d_conversionBaseMapMixNormals=@Variant(\0\0\0\x87>\xa3\xd7\n) +t_d_conversionBaseMapNoIters=12 +t_d_conversionBaseMapPreSmoothRadius=@Variant(\0\0\0\x87@`\0\0) +t_d_conversionHNDepth=@Variant(\0\0\0\x87\x41 \0\0) +t_d_conversionNHItersHuge=10 +t_d_conversionNHItersLarge=10 +t_d_conversionNHItersMedium=10 +t_d_conversionNHItersSmall=10 +t_d_conversionNHItersVeryLarge=10 +t_d_conversionNHItersVerySmall=10 +t_d_detailDepth=@Variant(\0\0\0\x87?\x80\0\0) +t_d_grayScaleB=@Variant(\0\0\0\x87>\xa8\xa8\xa9) +t_d_grayScaleG=@Variant(\0\0\0\x87>\xa8\xa8\xa9) +t_d_grayScaleR=@Variant(\0\0\0\x87>\xa8\xa8\xa9) +t_d_heightAveragingRadius=1 +t_d_heightMaxValue=@Variant(\0\0\0\x87?\x80\0\0) +t_d_heightMinValue=@Variant(\0\0\0\x87\0\0\0\0) +t_d_mediumDetails=@Variant(\0\0\0\x87\0\0\0\0) +t_d_noBlurPasses=0 +t_d_noRemoveShadingGaussIter=1 +t_d_normalsStep=@Variant(\0\0\0\x87?\x80\0\0) +t_d_sharpenBlurAmount=0 +t_d_smallDetails=@Variant(\0\0\0\x87\0\0\0\0) +t_d_specularAmplifier=@Variant(\0\0\0\x87\xc0@\0\0) +t_d_specularBrightness=@Variant(\0\0\0\x87\0\0\0\0) +t_d_specularContrast=@Variant(\0\0\0\x87\0\0\0\0) +t_d_specularRadius=10 +t_d_specularW1="@Variant(\0\0\0\x87=\xcc\xcc\xcd)" +t_d_specularW2=@Variant(\0\0\0\x87\x41 \0\0) +t_d_ssaoBias=@Variant(\0\0\0\x87\xbf\xc0\0\0) +t_d_ssaoDepth=@Variant(\0\0\0\x87>\x99\x99\x9a) +t_d_ssaoIntensity=@Variant(\0\0\0\x87?\x80\0\0) +t_d_ssaoNoIters=20 +t_h_bConversionBaseMap=false +t_h_bConversionHN=false +t_h_bConversionNH=false +t_h_bGrayScale=false +t_h_bInvertB=false +t_h_bInvertG=false +t_h_bInvertR=false +t_h_bRemoveShading=false +t_h_bSpeclarControl=false +t_h_conversionBaseMapAmplitude=@Variant(\0\0\0\x87\xbf\x80\0\0) +t_h_conversionBaseMapBlending=@Variant(\0\0\0\x87?\0\0\0) +t_h_conversionBaseMapFilterRadius=1 +t_h_conversionBaseMapFlatness=@Variant(\0\0\0\x87\0\0\0\0) +t_h_conversionBaseMapMixNormals=@Variant(\0\0\0\x87?\0\0\0) +t_h_conversionBaseMapNoIters=2 +t_h_conversionBaseMapPreSmoothRadius=@Variant(\0\0\0\x87\0\0\0\0) +t_h_conversionHNDepth=@Variant(\0\0\0\x87\x41\xab\x33\x33) +t_h_conversionNHItersHuge=10 +t_h_conversionNHItersLarge=10 +t_h_conversionNHItersMedium=10 +t_h_conversionNHItersSmall=10 +t_h_conversionNHItersVeryLarge=10 +t_h_conversionNHItersVerySmall=10 +t_h_detailDepth=@Variant(\0\0\0\x87?\x80\0\0) +t_h_grayScaleB=@Variant(\0\0\0\x87>\xa8\xa8\xa9) +t_h_grayScaleG=@Variant(\0\0\0\x87>\xa8\xa8\xa9) +t_h_grayScaleR=@Variant(\0\0\0\x87>\xa8\xa8\xa9) +t_h_heightAveragingRadius=1 +t_h_heightMaxValue=@Variant(\0\0\0\x87?\x80\0\0) +t_h_heightMinValue=@Variant(\0\0\0\x87\0\0\0\0) +t_h_mediumDetails=@Variant(\0\0\0\x87\0\0\0\0) +t_h_noBlurPasses=0 +t_h_noRemoveShadingGaussIter=4 +t_h_normalsStep=@Variant(\0\0\0\x87?\x80\0\0) +t_h_sharpenBlurAmount=0 +t_h_smallDetails=@Variant(\0\0\0\x87\0\0\0\0) +t_h_specularAmplifier=@Variant(\0\0\0\x87\xc0@\0\0) +t_h_specularBrightness=@Variant(\0\0\0\x87\0\0\0\0) +t_h_specularContrast=@Variant(\0\0\0\x87\0\0\0\0) +t_h_specularRadius=10 +t_h_specularW1="@Variant(\0\0\0\x87=\xcc\xcc\xcd)" +t_h_specularW2=@Variant(\0\0\0\x87\x41 \0\0) +t_h_ssaoBias=@Variant(\0\0\0\x87\xbf\xc0\0\0) +t_h_ssaoDepth=@Variant(\0\0\0\x87>\x99\x99\x9a) +t_h_ssaoIntensity=@Variant(\0\0\0\x87?\x80\0\0) +t_h_ssaoNoIters=20 +t_n_bConversionBaseMap=false +t_n_bConversionHN=false +t_n_bConversionNH=false +t_n_bGrayScale=false +t_n_bInvertB=false +t_n_bInvertG=false +t_n_bInvertR=false +t_n_bRemoveShading=false +t_n_bSpeclarControl=false +t_n_conversionBaseMapAmplitude=@Variant(\0\0\0\x87\xbf\x80\0\0) +t_n_conversionBaseMapBlending=@Variant(\0\0\0\x87?\0\0\0) +t_n_conversionBaseMapFilterRadius=1 +t_n_conversionBaseMapFlatness=@Variant(\0\0\0\x87\0\0\0\0) +t_n_conversionBaseMapMixNormals=@Variant(\0\0\0\x87?\0\0\0) +t_n_conversionBaseMapNoIters=2 +t_n_conversionBaseMapPreSmoothRadius=@Variant(\0\0\0\x87\0\0\0\0) +t_n_conversionHNDepth=@Variant(\0\0\0\x87\x41 \0\0) +t_n_conversionNHItersHuge=35 +t_n_conversionNHItersLarge=14 +t_n_conversionNHItersMedium=11 +t_n_conversionNHItersSmall=9 +t_n_conversionNHItersVeryLarge=21 +t_n_conversionNHItersVerySmall=8 +t_n_detailDepth=@Variant(\0\0\0\x87?\x80\0\0) +t_n_grayScaleB=@Variant(\0\0\0\x87>\xa8\xa8\xa9) +t_n_grayScaleG=@Variant(\0\0\0\x87>\xa8\xa8\xa9) +t_n_grayScaleR=@Variant(\0\0\0\x87>\xa8\xa8\xa9) +t_n_heightAveragingRadius=1 +t_n_heightMaxValue=@Variant(\0\0\0\x87?\x80\0\0) +t_n_heightMinValue=@Variant(\0\0\0\x87\0\0\0\0) +t_n_mediumDetails=@Variant(\0\0\0\x87\0\0\0\0) +t_n_noBlurPasses=0 +t_n_noRemoveShadingGaussIter=1 +t_n_normalsStep=@Variant(\0\0\0\x87?\x80\0\0) +t_n_sharpenBlurAmount=0 +t_n_smallDetails=@Variant(\0\0\0\x87\0\0\0\0) +t_n_specularAmplifier=@Variant(\0\0\0\x87\xc0@\0\0) +t_n_specularBrightness=@Variant(\0\0\0\x87\0\0\0\0) +t_n_specularContrast=@Variant(\0\0\0\x87\0\0\0\0) +t_n_specularRadius=10 +t_n_specularW1="@Variant(\0\0\0\x87=\xcc\xcc\xcd)" +t_n_specularW2=@Variant(\0\0\0\x87\x41 \0\0) +t_n_ssaoBias=@Variant(\0\0\0\x87\xbf\xc0\0\0) +t_n_ssaoDepth=@Variant(\0\0\0\x87>\x99\x99\x9a) +t_n_ssaoIntensity=@Variant(\0\0\0\x87?\x80\0\0) +t_n_ssaoNoIters=20 +t_o_bConversionBaseMap=false +t_o_bConversionHN=false +t_o_bConversionNH=false +t_o_bGrayScale=false +t_o_bInvertB=false +t_o_bInvertG=false +t_o_bInvertR=false +t_o_bRemoveShading=false +t_o_bSpeclarControl=false +t_o_conversionBaseMapAmplitude=@Variant(\0\0\0\x87\xbf\x80\0\0) +t_o_conversionBaseMapBlending=@Variant(\0\0\0\x87?\0\0\0) +t_o_conversionBaseMapFilterRadius=1 +t_o_conversionBaseMapFlatness=@Variant(\0\0\0\x87\0\0\0\0) +t_o_conversionBaseMapMixNormals=@Variant(\0\0\0\x87?\0\0\0) +t_o_conversionBaseMapNoIters=2 +t_o_conversionBaseMapPreSmoothRadius=@Variant(\0\0\0\x87\0\0\0\0) +t_o_conversionHNDepth=@Variant(\0\0\0\x87\x41 \0\0) +t_o_conversionNHItersHuge=10 +t_o_conversionNHItersLarge=10 +t_o_conversionNHItersMedium=10 +t_o_conversionNHItersSmall=10 +t_o_conversionNHItersVeryLarge=10 +t_o_conversionNHItersVerySmall=10 +t_o_detailDepth=@Variant(\0\0\0\x87?\x80\0\0) +t_o_grayScaleB=@Variant(\0\0\0\x87>\xa8\xa8\xa9) +t_o_grayScaleG=@Variant(\0\0\0\x87>\xa8\xa8\xa9) +t_o_grayScaleR=@Variant(\0\0\0\x87>\xa8\xa8\xa9) +t_o_heightAveragingRadius=1 +t_o_heightMaxValue=@Variant(\0\0\0\x87?\x80\0\0) +t_o_heightMinValue=@Variant(\0\0\0\x87\0\0\0\0) +t_o_mediumDetails=@Variant(\0\0\0\x87\0\0\0\0) +t_o_noBlurPasses=0 +t_o_noRemoveShadingGaussIter=1 +t_o_normalsStep=@Variant(\0\0\0\x87?\x80\0\0) +t_o_sharpenBlurAmount=0 +t_o_smallDetails=@Variant(\0\0\0\x87\0\0\0\0) +t_o_specularAmplifier=@Variant(\0\0\0\x87\xc0@\0\0) +t_o_specularBrightness=@Variant(\0\0\0\x87\0\0\0\0) +t_o_specularContrast=@Variant(\0\0\0\x87\0\0\0\0) +t_o_specularRadius=10 +t_o_specularW1="@Variant(\0\0\0\x87=\xcc\xcc\xcd)" +t_o_specularW2=@Variant(\0\0\0\x87\x41 \0\0) +t_o_ssaoBias=@Variant(\0\0\0\x87\xc0\x1e\x14{) +t_o_ssaoDepth=@Variant(\0\0\0\x87?\x80\0\0) +t_o_ssaoIntensity=@Variant(\0\0\0\x87?\x86\x66\x66) +t_o_ssaoNoIters=20 +t_s_bConversionBaseMap=false +t_s_bConversionHN=false +t_s_bConversionNH=false +t_s_bGrayScale=true +t_s_bInvertB=true +t_s_bInvertG=false +t_s_bInvertR=false +t_s_bRemoveShading=false +t_s_bSpeclarControl=false +t_s_conversionBaseMapAmplitude=@Variant(\0\0\0\x87\xbf\x80\0\0) +t_s_conversionBaseMapBlending=@Variant(\0\0\0\x87?\0\0\0) +t_s_conversionBaseMapFilterRadius=1 +t_s_conversionBaseMapFlatness=@Variant(\0\0\0\x87\0\0\0\0) +t_s_conversionBaseMapMixNormals=@Variant(\0\0\0\x87?\0\0\0) +t_s_conversionBaseMapNoIters=2 +t_s_conversionBaseMapPreSmoothRadius=@Variant(\0\0\0\x87\0\0\0\0) +t_s_conversionHNDepth=@Variant(\0\0\0\x87\x41 \0\0) +t_s_conversionNHItersHuge=10 +t_s_conversionNHItersLarge=10 +t_s_conversionNHItersMedium=10 +t_s_conversionNHItersSmall=10 +t_s_conversionNHItersVeryLarge=10 +t_s_conversionNHItersVerySmall=10 +t_s_detailDepth=@Variant(\0\0\0\x87?\x80\0\0) +t_s_grayScaleB=@Variant(\0\0\0\x87>\xca\xca\xcb) +t_s_grayScaleG=@Variant(\0\0\0\x87>\x86\x86\x87) +t_s_grayScaleR=@Variant(\0\0\0\x87>@\xc0\xc1) +t_s_heightAveragingRadius=30 +t_s_heightMaxValue=@Variant(\0\0\0\x87?5\xc2\x8f) +t_s_heightMinValue=@Variant(\0\0\0\x87>\xf8Q\xec) +t_s_mediumDetails=@Variant(\0\0\0\x87\0\0\0\0) +t_s_noBlurPasses=0 +t_s_noRemoveShadingGaussIter=1 +t_s_normalsStep=@Variant(\0\0\0\x87?\x80\0\0) +t_s_sharpenBlurAmount=0 +t_s_smallDetails=@Variant(\0\0\0\x87\0\0\0\0) +t_s_specularAmplifier=@Variant(\0\0\0\x87\xc0\xf0\0\0) +t_s_specularBrightness=@Variant(\0\0\0\x87\xbd\xe1G\xae) +t_s_specularContrast=@Variant(\0\0\0\x87\xbe\xe6\x66\x66) +t_s_specularRadius=20 +t_s_specularW1="@Variant(\0\0\0\x87=\xcc\xcc\xcd)" +t_s_specularW2=@Variant(\0\0\0\x87\x41\x80\x14{) +t_s_ssaoBias=@Variant(\0\0\0\x87\xbf\xc0\0\0) +t_s_ssaoDepth=@Variant(\0\0\0\x87>\x99\x99\x9a) +t_s_ssaoIntensity=@Variant(\0\0\0\x87?\x80\0\0) +t_s_ssaoNoIters=20 +use_texture_interpolation=true +uv_tiling_mirror_x=false +uv_tiling_mirror_xy=true +uv_tiling_mirror_y=false +uv_tiling_radius=20 +uv_tiling_random_inner_radius=20 +uv_tiling_random_outer_radius=40 +uv_tiling_random_rotate=0 +uv_tiling_type=0 diff --git a/configs/37_Bricks.ini b/configs/37_Bricks.ini new file mode 100644 index 0000000..0b5bc35 --- /dev/null +++ b/configs/37_Bricks.ini @@ -0,0 +1,255 @@ +[General] +3d_depth=0.51 +d_postfix=_d +d_win_h=876 +d_win_w=1549 +gui_style=Fusion +h_attachNormal=true +h_postfix=_h +n_postfix=_n +o_postfix=_o +recent_dir=/home/mkk/Imagens/BrickRound0103_2_S.jpg +recent_mesh_dir=/media/DANE/Doktorat/ZaawansowanaGrafika3D/AwesomeBumpRepo/build-AwesomeBump-Desktop_Qt_5_4_0_GCC_64bit-Release/Cube +s_postfix=_s +settings_description=... +settings_name=Bricks +settings_path=configs/37_Bricks.ini +t_d_bConversionBaseMap=false +t_d_bConversionHN=false +t_d_bConversionNH=false +t_d_bGrayScale=false +t_d_bInvertB=false +t_d_bInvertG=false +t_d_bInvertR=false +t_d_bRemoveShading=false +t_d_bSpeclarControl=false +t_d_conversionBaseMapAmplitude=@Variant(\0\0\0\x87\xbf\xb5\xc2\x8f) +t_d_conversionBaseMapBlending=@Variant(\0\0\0\x87>\x85\x1e\xb8) +t_d_conversionBaseMapFilterRadius=3 +t_d_conversionBaseMapFlatness=@Variant(\0\0\0\x87\0\0\0\0) +t_d_conversionBaseMapMixNormals=@Variant(\0\0\0\x87>\xa3\xd7\n) +t_d_conversionBaseMapNoIters=12 +t_d_conversionBaseMapPreSmoothRadius=@Variant(\0\0\0\x87@`\0\0) +t_d_conversionHNDepth=@Variant(\0\0\0\x87\x41 \0\0) +t_d_conversionNHItersHuge=10 +t_d_conversionNHItersLarge=10 +t_d_conversionNHItersMedium=10 +t_d_conversionNHItersSmall=10 +t_d_conversionNHItersVeryLarge=10 +t_d_conversionNHItersVerySmall=10 +t_d_detailDepth=@Variant(\0\0\0\x87?\x80\0\0) +t_d_grayScaleB=@Variant(\0\0\0\x87>\xa8\xa8\xa9) +t_d_grayScaleG=@Variant(\0\0\0\x87>\xa8\xa8\xa9) +t_d_grayScaleR=@Variant(\0\0\0\x87>\xa8\xa8\xa9) +t_d_heightAveragingRadius=1 +t_d_heightMaxValue=@Variant(\0\0\0\x87?\x80\0\0) +t_d_heightMinValue=@Variant(\0\0\0\x87\0\0\0\0) +t_d_mediumDetails=@Variant(\0\0\0\x87\0\0\0\0) +t_d_noBlurPasses=0 +t_d_noRemoveShadingGaussIter=1 +t_d_normalsStep=@Variant(\0\0\0\x87?\x80\0\0) +t_d_sharpenBlurAmount=0 +t_d_smallDetails=@Variant(\0\0\0\x87\0\0\0\0) +t_d_specularAmplifier=@Variant(\0\0\0\x87\xc0@\0\0) +t_d_specularBrightness=@Variant(\0\0\0\x87\0\0\0\0) +t_d_specularContrast=@Variant(\0\0\0\x87\0\0\0\0) +t_d_specularRadius=10 +t_d_specularW1="@Variant(\0\0\0\x87=\xcc\xcc\xcd)" +t_d_specularW2=@Variant(\0\0\0\x87\x41 \0\0) +t_d_ssaoBias=@Variant(\0\0\0\x87\xbf\xc0\0\0) +t_d_ssaoDepth=@Variant(\0\0\0\x87>\x99\x99\x9a) +t_d_ssaoIntensity=@Variant(\0\0\0\x87?\x80\0\0) +t_d_ssaoNoIters=20 +t_h_bConversionBaseMap=false +t_h_bConversionHN=false +t_h_bConversionNH=false +t_h_bGrayScale=false +t_h_bInvertB=false +t_h_bInvertG=false +t_h_bInvertR=false +t_h_bRemoveShading=false +t_h_bSpeclarControl=false +t_h_conversionBaseMapAmplitude=@Variant(\0\0\0\x87\xbf\x80\0\0) +t_h_conversionBaseMapBlending=@Variant(\0\0\0\x87?\0\0\0) +t_h_conversionBaseMapFilterRadius=1 +t_h_conversionBaseMapFlatness=@Variant(\0\0\0\x87\0\0\0\0) +t_h_conversionBaseMapMixNormals=@Variant(\0\0\0\x87?\0\0\0) +t_h_conversionBaseMapNoIters=2 +t_h_conversionBaseMapPreSmoothRadius=@Variant(\0\0\0\x87\0\0\0\0) +t_h_conversionHNDepth=@Variant(\0\0\0\x87\x41vff) +t_h_conversionNHItersHuge=10 +t_h_conversionNHItersLarge=10 +t_h_conversionNHItersMedium=10 +t_h_conversionNHItersSmall=10 +t_h_conversionNHItersVeryLarge=10 +t_h_conversionNHItersVerySmall=10 +t_h_detailDepth=@Variant(\0\0\0\x87?\x80\0\0) +t_h_grayScaleB=@Variant(\0\0\0\x87>\xa8\xa8\xa9) +t_h_grayScaleG=@Variant(\0\0\0\x87>\xa8\xa8\xa9) +t_h_grayScaleR=@Variant(\0\0\0\x87>\xa8\xa8\xa9) +t_h_heightAveragingRadius=19 +t_h_heightMaxValue=@Variant(\0\0\0\x87?\x80\0\0) +t_h_heightMinValue=@Variant(\0\0\0\x87\0\0\0\0) +t_h_mediumDetails=@Variant(\0\0\0\x87\0\0\0\0) +t_h_noBlurPasses=2 +t_h_noRemoveShadingGaussIter=4 +t_h_normalsStep=@Variant(\0\0\0\x87?\x80\0\0) +t_h_sharpenBlurAmount=0 +t_h_smallDetails=@Variant(\0\0\0\x87\0\0\0\0) +t_h_specularAmplifier=@Variant(\0\0\0\x87\xc0@\0\0) +t_h_specularBrightness=@Variant(\0\0\0\x87\0\0\0\0) +t_h_specularContrast=@Variant(\0\0\0\x87\0\0\0\0) +t_h_specularRadius=10 +t_h_specularW1="@Variant(\0\0\0\x87=\xcc\xcc\xcd)" +t_h_specularW2=@Variant(\0\0\0\x87\x41 \0\0) +t_h_ssaoBias=@Variant(\0\0\0\x87\xbf\xc0\0\0) +t_h_ssaoDepth=@Variant(\0\0\0\x87>\x99\x99\x9a) +t_h_ssaoIntensity=@Variant(\0\0\0\x87?\x80\0\0) +t_h_ssaoNoIters=20 +t_n_bConversionBaseMap=false +t_n_bConversionHN=false +t_n_bConversionNH=false +t_n_bGrayScale=false +t_n_bInvertB=false +t_n_bInvertG=false +t_n_bInvertR=false +t_n_bRemoveShading=false +t_n_bSpeclarControl=false +t_n_conversionBaseMapAmplitude=@Variant(\0\0\0\x87\xbf\x80\0\0) +t_n_conversionBaseMapBlending=@Variant(\0\0\0\x87?\0\0\0) +t_n_conversionBaseMapFilterRadius=1 +t_n_conversionBaseMapFlatness=@Variant(\0\0\0\x87\0\0\0\0) +t_n_conversionBaseMapMixNormals=@Variant(\0\0\0\x87?\0\0\0) +t_n_conversionBaseMapNoIters=2 +t_n_conversionBaseMapPreSmoothRadius=@Variant(\0\0\0\x87\0\0\0\0) +t_n_conversionHNDepth=@Variant(\0\0\0\x87\x41 \0\0) +t_n_conversionNHItersHuge=35 +t_n_conversionNHItersLarge=14 +t_n_conversionNHItersMedium=11 +t_n_conversionNHItersSmall=9 +t_n_conversionNHItersVeryLarge=21 +t_n_conversionNHItersVerySmall=8 +t_n_detailDepth=@Variant(\0\0\0\x87?\x80\0\0) +t_n_grayScaleB=@Variant(\0\0\0\x87>\xa8\xa8\xa9) +t_n_grayScaleG=@Variant(\0\0\0\x87>\xa8\xa8\xa9) +t_n_grayScaleR=@Variant(\0\0\0\x87>\xa8\xa8\xa9) +t_n_heightAveragingRadius=1 +t_n_heightMaxValue=@Variant(\0\0\0\x87?\x80\0\0) +t_n_heightMinValue=@Variant(\0\0\0\x87\0\0\0\0) +t_n_mediumDetails=@Variant(\0\0\0\x87\0\0\0\0) +t_n_noBlurPasses=0 +t_n_noRemoveShadingGaussIter=1 +t_n_normalsStep=@Variant(\0\0\0\x87?\x80\0\0) +t_n_sharpenBlurAmount=0 +t_n_smallDetails=@Variant(\0\0\0\x87\0\0\0\0) +t_n_specularAmplifier=@Variant(\0\0\0\x87\xc0@\0\0) +t_n_specularBrightness=@Variant(\0\0\0\x87\0\0\0\0) +t_n_specularContrast=@Variant(\0\0\0\x87\0\0\0\0) +t_n_specularRadius=10 +t_n_specularW1="@Variant(\0\0\0\x87=\xcc\xcc\xcd)" +t_n_specularW2=@Variant(\0\0\0\x87\x41 \0\0) +t_n_ssaoBias=@Variant(\0\0\0\x87\xbf\xc0\0\0) +t_n_ssaoDepth=@Variant(\0\0\0\x87>\x99\x99\x9a) +t_n_ssaoIntensity=@Variant(\0\0\0\x87?\x80\0\0) +t_n_ssaoNoIters=20 +t_o_bConversionBaseMap=false +t_o_bConversionHN=false +t_o_bConversionNH=false +t_o_bGrayScale=false +t_o_bInvertB=false +t_o_bInvertG=false +t_o_bInvertR=false +t_o_bRemoveShading=false +t_o_bSpeclarControl=false +t_o_conversionBaseMapAmplitude=@Variant(\0\0\0\x87\xbf\x80\0\0) +t_o_conversionBaseMapBlending=@Variant(\0\0\0\x87?\0\0\0) +t_o_conversionBaseMapFilterRadius=1 +t_o_conversionBaseMapFlatness=@Variant(\0\0\0\x87\0\0\0\0) +t_o_conversionBaseMapMixNormals=@Variant(\0\0\0\x87?\0\0\0) +t_o_conversionBaseMapNoIters=2 +t_o_conversionBaseMapPreSmoothRadius=@Variant(\0\0\0\x87\0\0\0\0) +t_o_conversionHNDepth=@Variant(\0\0\0\x87\x41 \0\0) +t_o_conversionNHItersHuge=10 +t_o_conversionNHItersLarge=10 +t_o_conversionNHItersMedium=10 +t_o_conversionNHItersSmall=10 +t_o_conversionNHItersVeryLarge=10 +t_o_conversionNHItersVerySmall=10 +t_o_detailDepth=@Variant(\0\0\0\x87?\x80\0\0) +t_o_grayScaleB=@Variant(\0\0\0\x87>\xa8\xa8\xa9) +t_o_grayScaleG=@Variant(\0\0\0\x87>\xa8\xa8\xa9) +t_o_grayScaleR=@Variant(\0\0\0\x87>\xa8\xa8\xa9) +t_o_heightAveragingRadius=1 +t_o_heightMaxValue=@Variant(\0\0\0\x87?\x80\0\0) +t_o_heightMinValue=@Variant(\0\0\0\x87\0\0\0\0) +t_o_mediumDetails=@Variant(\0\0\0\x87\0\0\0\0) +t_o_noBlurPasses=0 +t_o_noRemoveShadingGaussIter=1 +t_o_normalsStep=@Variant(\0\0\0\x87?\x80\0\0) +t_o_sharpenBlurAmount=0 +t_o_smallDetails=@Variant(\0\0\0\x87\0\0\0\0) +t_o_specularAmplifier=@Variant(\0\0\0\x87\xc0@\0\0) +t_o_specularBrightness=@Variant(\0\0\0\x87\0\0\0\0) +t_o_specularContrast=@Variant(\0\0\0\x87\0\0\0\0) +t_o_specularRadius=10 +t_o_specularW1="@Variant(\0\0\0\x87=\xcc\xcc\xcd)" +t_o_specularW2=@Variant(\0\0\0\x87\x41 \0\0) +t_o_ssaoBias=@Variant(\0\0\0\x87\xc0\x1e\x14{) +t_o_ssaoDepth=@Variant(\0\0\0\x87?\x80\0\0) +t_o_ssaoIntensity=@Variant(\0\0\0\x87?\x86\x66\x66) +t_o_ssaoNoIters=20 +t_s_bConversionBaseMap=false +t_s_bConversionHN=false +t_s_bConversionNH=false +t_s_bGrayScale=true +t_s_bInvertB=false +t_s_bInvertG=false +t_s_bInvertR=false +t_s_bRemoveShading=false +t_s_bSpeclarControl=true +t_s_conversionBaseMapAmplitude=@Variant(\0\0\0\x87\xbf\x80\0\0) +t_s_conversionBaseMapBlending=@Variant(\0\0\0\x87?\0\0\0) +t_s_conversionBaseMapFilterRadius=1 +t_s_conversionBaseMapFlatness=@Variant(\0\0\0\x87\0\0\0\0) +t_s_conversionBaseMapMixNormals=@Variant(\0\0\0\x87?\0\0\0) +t_s_conversionBaseMapNoIters=2 +t_s_conversionBaseMapPreSmoothRadius=@Variant(\0\0\0\x87\0\0\0\0) +t_s_conversionHNDepth=@Variant(\0\0\0\x87\x41 \0\0) +t_s_conversionNHItersHuge=10 +t_s_conversionNHItersLarge=10 +t_s_conversionNHItersMedium=10 +t_s_conversionNHItersSmall=10 +t_s_conversionNHItersVeryLarge=10 +t_s_conversionNHItersVerySmall=10 +t_s_detailDepth=@Variant(\0\0\0\x87?\x80\0\0) +t_s_grayScaleB=@Variant(\0\0\0\x87>\xca\xca\xcb) +t_s_grayScaleG=@Variant(\0\0\0\x87>\x86\x86\x87) +t_s_grayScaleR=@Variant(\0\0\0\x87>@\xc0\xc1) +t_s_heightAveragingRadius=30 +t_s_heightMaxValue=@Variant(\0\0\0\x87?o\\)) +t_s_heightMinValue=@Variant(\0\0\0\x87\0\0\0\0) +t_s_mediumDetails=@Variant(\0\0\0\x87\0\0\0\0) +t_s_noBlurPasses=0 +t_s_noRemoveShadingGaussIter=1 +t_s_normalsStep=@Variant(\0\0\0\x87?\x80\0\0) +t_s_sharpenBlurAmount=0 +t_s_smallDetails=@Variant(\0\0\0\x87\0\0\0\0) +t_s_specularAmplifier=@Variant(\0\0\0\x87\xc0\x33\x33\x33) +t_s_specularBrightness=@Variant(\0\0\0\x87\xbd\xe1G\xae) +t_s_specularContrast=@Variant(\0\0\0\x87\xbf\x14z\xe1) +t_s_specularRadius=20 +t_s_specularW1="@Variant(\0\0\0\x87=\xcc\xcc\xcd)" +t_s_specularW2="@Variant(\0\0\0\x87\x41\x9d\n=)" +t_s_ssaoBias=@Variant(\0\0\0\x87\xbf\xc0\0\0) +t_s_ssaoDepth=@Variant(\0\0\0\x87>\x99\x99\x9a) +t_s_ssaoIntensity=@Variant(\0\0\0\x87?\x80\0\0) +t_s_ssaoNoIters=20 +use_texture_interpolation=true +uv_tiling_mirror_x=false +uv_tiling_mirror_xy=true +uv_tiling_mirror_y=false +uv_tiling_radius=20 +uv_tiling_random_inner_radius=20 +uv_tiling_random_outer_radius=40 +uv_tiling_random_rotate=0 +uv_tiling_type=0 diff --git a/configs/38_Doors.ini b/configs/38_Doors.ini new file mode 100644 index 0000000..87e120f --- /dev/null +++ b/configs/38_Doors.ini @@ -0,0 +1,255 @@ +[General] +3d_depth=0.5 +d_postfix=_d +d_win_h=876 +d_win_w=1549 +gui_style=Fusion +h_attachNormal=true +h_postfix=_h +n_postfix=_n +o_postfix=_o +recent_dir=/home/mkk/Imagens/DoorsMetalDouble0236_M.jpg +recent_mesh_dir=/media/DANE/Doktorat/ZaawansowanaGrafika3D/AwesomeBumpRepo/build-AwesomeBump-Desktop_Qt_5_4_0_GCC_64bit-Release/Cube +s_postfix=_s +settings_description=... +settings_name=Doors +settings_path=configs/38_Doors.ini +t_d_bConversionBaseMap=true +t_d_bConversionHN=false +t_d_bConversionNH=false +t_d_bGrayScale=false +t_d_bInvertB=false +t_d_bInvertG=false +t_d_bInvertR=false +t_d_bRemoveShading=false +t_d_bSpeclarControl=false +t_d_conversionBaseMapAmplitude=@Variant(\0\0\0\x87\xbf\xee\x14{) +t_d_conversionBaseMapBlending=@Variant(\0\0\0\x87>\x19\x99\x9a) +t_d_conversionBaseMapFilterRadius=2 +t_d_conversionBaseMapFlatness=@Variant(\0\0\0\x87\0\0\0\0) +t_d_conversionBaseMapMixNormals=@Variant(\0\0\0\x87>\xae\x14{) +t_d_conversionBaseMapNoIters=12 +t_d_conversionBaseMapPreSmoothRadius=@Variant(\0\0\0\x87@`\0\0) +t_d_conversionHNDepth=@Variant(\0\0\0\x87\x41 \0\0) +t_d_conversionNHItersHuge=10 +t_d_conversionNHItersLarge=10 +t_d_conversionNHItersMedium=10 +t_d_conversionNHItersSmall=10 +t_d_conversionNHItersVeryLarge=10 +t_d_conversionNHItersVerySmall=10 +t_d_detailDepth=@Variant(\0\0\0\x87?\x80\0\0) +t_d_grayScaleB=@Variant(\0\0\0\x87>\xa8\xa8\xa9) +t_d_grayScaleG=@Variant(\0\0\0\x87>\xa8\xa8\xa9) +t_d_grayScaleR=@Variant(\0\0\0\x87>\xa8\xa8\xa9) +t_d_heightAveragingRadius=1 +t_d_heightMaxValue=@Variant(\0\0\0\x87?\x80\0\0) +t_d_heightMinValue=@Variant(\0\0\0\x87>z\xe1H) +t_d_mediumDetails=@Variant(\0\0\0\x87\0\0\0\0) +t_d_noBlurPasses=0 +t_d_noRemoveShadingGaussIter=1 +t_d_normalsStep=@Variant(\0\0\0\x87?\x80\0\0) +t_d_sharpenBlurAmount=2 +t_d_smallDetails=@Variant(\0\0\0\x87\0\0\0\0) +t_d_specularAmplifier=@Variant(\0\0\0\x87\xc0@\0\0) +t_d_specularBrightness=@Variant(\0\0\0\x87\0\0\0\0) +t_d_specularContrast=@Variant(\0\0\0\x87\0\0\0\0) +t_d_specularRadius=10 +t_d_specularW1="@Variant(\0\0\0\x87=\xcc\xcc\xcd)" +t_d_specularW2=@Variant(\0\0\0\x87\x41 \0\0) +t_d_ssaoBias=@Variant(\0\0\0\x87\xbf\xc0\0\0) +t_d_ssaoDepth=@Variant(\0\0\0\x87>\x99\x99\x9a) +t_d_ssaoIntensity=@Variant(\0\0\0\x87?\x80\0\0) +t_d_ssaoNoIters=20 +t_h_bConversionBaseMap=false +t_h_bConversionHN=false +t_h_bConversionNH=false +t_h_bGrayScale=false +t_h_bInvertB=false +t_h_bInvertG=false +t_h_bInvertR=false +t_h_bRemoveShading=false +t_h_bSpeclarControl=false +t_h_conversionBaseMapAmplitude=@Variant(\0\0\0\x87\xbf\x80\0\0) +t_h_conversionBaseMapBlending=@Variant(\0\0\0\x87?\0\0\0) +t_h_conversionBaseMapFilterRadius=1 +t_h_conversionBaseMapFlatness=@Variant(\0\0\0\x87\0\0\0\0) +t_h_conversionBaseMapMixNormals=@Variant(\0\0\0\x87?\0\0\0) +t_h_conversionBaseMapNoIters=2 +t_h_conversionBaseMapPreSmoothRadius=@Variant(\0\0\0\x87\0\0\0\0) +t_h_conversionHNDepth=@Variant(\0\0\0\x87\x42\x93\x99\x9a) +t_h_conversionNHItersHuge=10 +t_h_conversionNHItersLarge=10 +t_h_conversionNHItersMedium=10 +t_h_conversionNHItersSmall=10 +t_h_conversionNHItersVeryLarge=10 +t_h_conversionNHItersVerySmall=10 +t_h_detailDepth=@Variant(\0\0\0\x87?\x80\0\0) +t_h_grayScaleB=@Variant(\0\0\0\x87>\xa8\xa8\xa9) +t_h_grayScaleG=@Variant(\0\0\0\x87>\xa8\xa8\xa9) +t_h_grayScaleR=@Variant(\0\0\0\x87>\xa8\xa8\xa9) +t_h_heightAveragingRadius=1 +t_h_heightMaxValue=@Variant(\0\0\0\x87?\x80\0\0) +t_h_heightMinValue=@Variant(\0\0\0\x87\0\0\0\0) +t_h_mediumDetails=@Variant(\0\0\0\x87\0\0\0\0) +t_h_noBlurPasses=0 +t_h_noRemoveShadingGaussIter=4 +t_h_normalsStep=@Variant(\0\0\0\x87?\x80\0\0) +t_h_sharpenBlurAmount=0 +t_h_smallDetails=@Variant(\0\0\0\x87\0\0\0\0) +t_h_specularAmplifier=@Variant(\0\0\0\x87\xc0@\0\0) +t_h_specularBrightness=@Variant(\0\0\0\x87\0\0\0\0) +t_h_specularContrast=@Variant(\0\0\0\x87\0\0\0\0) +t_h_specularRadius=10 +t_h_specularW1="@Variant(\0\0\0\x87=\xcc\xcc\xcd)" +t_h_specularW2=@Variant(\0\0\0\x87\x41 \0\0) +t_h_ssaoBias=@Variant(\0\0\0\x87\xbf\xc0\0\0) +t_h_ssaoDepth=@Variant(\0\0\0\x87>\x99\x99\x9a) +t_h_ssaoIntensity=@Variant(\0\0\0\x87?\x80\0\0) +t_h_ssaoNoIters=20 +t_n_bConversionBaseMap=false +t_n_bConversionHN=false +t_n_bConversionNH=false +t_n_bGrayScale=false +t_n_bInvertB=false +t_n_bInvertG=false +t_n_bInvertR=false +t_n_bRemoveShading=false +t_n_bSpeclarControl=false +t_n_conversionBaseMapAmplitude=@Variant(\0\0\0\x87\xbf\x80\0\0) +t_n_conversionBaseMapBlending=@Variant(\0\0\0\x87?\0\0\0) +t_n_conversionBaseMapFilterRadius=1 +t_n_conversionBaseMapFlatness=@Variant(\0\0\0\x87\0\0\0\0) +t_n_conversionBaseMapMixNormals=@Variant(\0\0\0\x87?\0\0\0) +t_n_conversionBaseMapNoIters=2 +t_n_conversionBaseMapPreSmoothRadius=@Variant(\0\0\0\x87\0\0\0\0) +t_n_conversionHNDepth=@Variant(\0\0\0\x87\x41 \0\0) +t_n_conversionNHItersHuge=12 +t_n_conversionNHItersLarge=14 +t_n_conversionNHItersMedium=11 +t_n_conversionNHItersSmall=9 +t_n_conversionNHItersVeryLarge=18 +t_n_conversionNHItersVerySmall=8 +t_n_detailDepth=@Variant(\0\0\0\x87?\x80\0\0) +t_n_grayScaleB=@Variant(\0\0\0\x87>\xa8\xa8\xa9) +t_n_grayScaleG=@Variant(\0\0\0\x87>\xa8\xa8\xa9) +t_n_grayScaleR=@Variant(\0\0\0\x87>\xa8\xa8\xa9) +t_n_heightAveragingRadius=1 +t_n_heightMaxValue=@Variant(\0\0\0\x87?\x80\0\0) +t_n_heightMinValue=@Variant(\0\0\0\x87\0\0\0\0) +t_n_mediumDetails=@Variant(\0\0\0\x87\0\0\0\0) +t_n_noBlurPasses=0 +t_n_noRemoveShadingGaussIter=1 +t_n_normalsStep=@Variant(\0\0\0\x87?\x80\0\0) +t_n_sharpenBlurAmount=0 +t_n_smallDetails=@Variant(\0\0\0\x87\0\0\0\0) +t_n_specularAmplifier=@Variant(\0\0\0\x87\xc0@\0\0) +t_n_specularBrightness=@Variant(\0\0\0\x87\0\0\0\0) +t_n_specularContrast=@Variant(\0\0\0\x87\0\0\0\0) +t_n_specularRadius=10 +t_n_specularW1="@Variant(\0\0\0\x87=\xcc\xcc\xcd)" +t_n_specularW2=@Variant(\0\0\0\x87\x41 \0\0) +t_n_ssaoBias=@Variant(\0\0\0\x87\xbf\xc0\0\0) +t_n_ssaoDepth=@Variant(\0\0\0\x87>\x99\x99\x9a) +t_n_ssaoIntensity=@Variant(\0\0\0\x87?\x80\0\0) +t_n_ssaoNoIters=20 +t_o_bConversionBaseMap=false +t_o_bConversionHN=false +t_o_bConversionNH=false +t_o_bGrayScale=false +t_o_bInvertB=false +t_o_bInvertG=false +t_o_bInvertR=false +t_o_bRemoveShading=false +t_o_bSpeclarControl=false +t_o_conversionBaseMapAmplitude=@Variant(\0\0\0\x87\xbf\x80\0\0) +t_o_conversionBaseMapBlending=@Variant(\0\0\0\x87?\0\0\0) +t_o_conversionBaseMapFilterRadius=1 +t_o_conversionBaseMapFlatness=@Variant(\0\0\0\x87\0\0\0\0) +t_o_conversionBaseMapMixNormals=@Variant(\0\0\0\x87?\0\0\0) +t_o_conversionBaseMapNoIters=2 +t_o_conversionBaseMapPreSmoothRadius=@Variant(\0\0\0\x87\0\0\0\0) +t_o_conversionHNDepth=@Variant(\0\0\0\x87\x41 \0\0) +t_o_conversionNHItersHuge=10 +t_o_conversionNHItersLarge=10 +t_o_conversionNHItersMedium=10 +t_o_conversionNHItersSmall=10 +t_o_conversionNHItersVeryLarge=10 +t_o_conversionNHItersVerySmall=10 +t_o_detailDepth=@Variant(\0\0\0\x87?\x80\0\0) +t_o_grayScaleB=@Variant(\0\0\0\x87>\xa8\xa8\xa9) +t_o_grayScaleG=@Variant(\0\0\0\x87>\xa8\xa8\xa9) +t_o_grayScaleR=@Variant(\0\0\0\x87>\xa8\xa8\xa9) +t_o_heightAveragingRadius=1 +t_o_heightMaxValue=@Variant(\0\0\0\x87?\x80\0\0) +t_o_heightMinValue=@Variant(\0\0\0\x87\0\0\0\0) +t_o_mediumDetails=@Variant(\0\0\0\x87\0\0\0\0) +t_o_noBlurPasses=0 +t_o_noRemoveShadingGaussIter=1 +t_o_normalsStep=@Variant(\0\0\0\x87?\x80\0\0) +t_o_sharpenBlurAmount=0 +t_o_smallDetails=@Variant(\0\0\0\x87\0\0\0\0) +t_o_specularAmplifier=@Variant(\0\0\0\x87\xc0@\0\0) +t_o_specularBrightness=@Variant(\0\0\0\x87\0\0\0\0) +t_o_specularContrast=@Variant(\0\0\0\x87\0\0\0\0) +t_o_specularRadius=10 +t_o_specularW1="@Variant(\0\0\0\x87=\xcc\xcc\xcd)" +t_o_specularW2=@Variant(\0\0\0\x87\x41 \0\0) +t_o_ssaoBias=@Variant(\0\0\0\x87\xc0\x1e\x14{) +t_o_ssaoDepth=@Variant(\0\0\0\x87?\x80\0\0) +t_o_ssaoIntensity=@Variant(\0\0\0\x87?\x86\x66\x66) +t_o_ssaoNoIters=20 +t_s_bConversionBaseMap=false +t_s_bConversionHN=false +t_s_bConversionNH=false +t_s_bGrayScale=true +t_s_bInvertB=false +t_s_bInvertG=false +t_s_bInvertR=false +t_s_bRemoveShading=false +t_s_bSpeclarControl=false +t_s_conversionBaseMapAmplitude=@Variant(\0\0\0\x87\xbf\x80\0\0) +t_s_conversionBaseMapBlending=@Variant(\0\0\0\x87?\0\0\0) +t_s_conversionBaseMapFilterRadius=1 +t_s_conversionBaseMapFlatness=@Variant(\0\0\0\x87\0\0\0\0) +t_s_conversionBaseMapMixNormals=@Variant(\0\0\0\x87?\0\0\0) +t_s_conversionBaseMapNoIters=2 +t_s_conversionBaseMapPreSmoothRadius=@Variant(\0\0\0\x87\0\0\0\0) +t_s_conversionHNDepth=@Variant(\0\0\0\x87\x41 \0\0) +t_s_conversionNHItersHuge=10 +t_s_conversionNHItersLarge=10 +t_s_conversionNHItersMedium=10 +t_s_conversionNHItersSmall=10 +t_s_conversionNHItersVeryLarge=10 +t_s_conversionNHItersVerySmall=10 +t_s_detailDepth=@Variant(\0\0\0\x87?\x80\0\0) +t_s_grayScaleB=@Variant(\0\0\0\x87>\xca\xca\xcb) +t_s_grayScaleG=@Variant(\0\0\0\x87>\x86\x86\x87) +t_s_grayScaleR=@Variant(\0\0\0\x87>@\xc0\xc1) +t_s_heightAveragingRadius=30 +t_s_heightMaxValue=@Variant(\0\0\0\x87?>\xb8R) +t_s_heightMinValue=@Variant(\0\0\0\x87>\xab\x85\x1f) +t_s_mediumDetails=@Variant(\0\0\0\x87\0\0\0\0) +t_s_noBlurPasses=0 +t_s_noRemoveShadingGaussIter=1 +t_s_normalsStep=@Variant(\0\0\0\x87?\x80\0\0) +t_s_sharpenBlurAmount=0 +t_s_smallDetails=@Variant(\0\0\0\x87\0\0\0\0) +t_s_specularAmplifier=@Variant(\0\0\0\x87\xc0\xf0\0\0) +t_s_specularBrightness=@Variant(\0\0\0\x87\xbd\xe1G\xae) +t_s_specularContrast=@Variant(\0\0\0\x87\xbe\xe6\x66\x66) +t_s_specularRadius=20 +t_s_specularW1="@Variant(\0\0\0\x87=\xcc\xcc\xcd)" +t_s_specularW2=@Variant(\0\0\0\x87\x41\x80\x14{) +t_s_ssaoBias=@Variant(\0\0\0\x87\xbf\xc0\0\0) +t_s_ssaoDepth=@Variant(\0\0\0\x87>\x99\x99\x9a) +t_s_ssaoIntensity=@Variant(\0\0\0\x87?\x80\0\0) +t_s_ssaoNoIters=20 +use_texture_interpolation=true +uv_tiling_mirror_x=false +uv_tiling_mirror_xy=true +uv_tiling_mirror_y=false +uv_tiling_radius=27 +uv_tiling_random_inner_radius=20 +uv_tiling_random_outer_radius=40 +uv_tiling_random_rotate=0 +uv_tiling_type=0 diff --git a/configs/config_list b/configs/config_list new file mode 100644 index 0000000..1bd70ac --- /dev/null +++ b/configs/config_list @@ -0,0 +1,2 @@ +[General] +last_id=39 diff --git a/content.qrc b/content.qrc index 322024b..25fb61e 100644 --- a/content.qrc +++ b/content.qrc @@ -34,5 +34,11 @@ content/scaleXYUV.png content/filters.frag content/filters.vert + content/trash.png + content/text.png + content/Capsule.obj + content/plane.geom + content/plane.tcs.vert + content/plane.tes.vert diff --git a/content/plane.frag b/content/plane.frag index 3b5be47..fc13b1d 100644 --- a/content/plane.frag +++ b/content/plane.frag @@ -1,48 +1,165 @@ #version 400 core + + + +// Uniform variables uniform sampler2D texDiffuse; uniform sampler2D texNormal; uniform sampler2D texSpecular; uniform sampler2D texHeight; uniform sampler2D texSSAO; + uniform bool gui_bSpecular; uniform bool gui_bOcclusion; +uniform bool gui_bHeight; +uniform bool gui_bDiffuse; +uniform bool gui_bNormal; +uniform float gui_depthScale; uniform float gui_SpecularIntensity; uniform float gui_DiffuseIntensity; +uniform int gui_shading_type; // 0 - relief , 1 - parallax normal mapping , 2 - tessellation + +// Global variables +vec3 Kd = vec3(gui_DiffuseIntensity); +vec3 Ks = vec3(gui_SpecularIntensity*0.5); +vec3 Ka = vec3(0.0); +float alpha = 30.0; + +vec3 LightSource_diffuse = vec3(1.0); +vec3 LightSource_ambient = vec3(1.0); +vec3 LightSource_specular = vec3(1.0); -in vec4 texc; -in vec3 vertexNormal; -in vec4 vertexPosition; -in vec4 lightPosition; -in vec4 staticLightPosition; +// input variables +in vec3 texcoord; + +const int no_lights = 2; +in vec3 TSLightPosition[no_lights]; +in vec3 TSViewDirection[no_lights]; +in vec3 TSHalfVector; + +// output color out vec4 FragColor; -void main(void) + +vec4 bump_mapping(int lightIndeks,vec2 texcoord){ + + vec3 fvTSLightPosition = normalize( TSLightPosition[lightIndeks] ); + vec3 fvESVertexNormal = normalize( ( texture( texNormal, texcoord.xy ).xyz * 2.0 ) - 1.0 ); + + if(!gui_bNormal) fvESVertexNormal = vec3(0,0,1); + + float fNDotL = dot( fvESVertexNormal, fvTSLightPosition ); + + vec3 fvReflection = normalize( ( ( 2.0 * fvESVertexNormal ) * fNDotL ) - fvTSLightPosition ); + vec3 fvTSViewDirection = normalize( TSViewDirection[lightIndeks] ); + float fRDotV = max( 0.0, dot( fvReflection, fvTSViewDirection ) ); + + vec4 fvBaseColor = texture( texDiffuse, texcoord.xy ); + vec4 fvSpecularColor = texture( texSpecular, texcoord.xy ); + vec4 fvSSAOColor = texture( texSSAO, texcoord.xy ); + + if(!gui_bDiffuse) fvBaseColor = vec4(0.8); // some gray color + if(!gui_bOcclusion)fvSSAOColor = vec4(1.0); + + vec4 fvTotalAmbient = vec4(Ka * LightSource_ambient,1) * fvBaseColor; + vec4 fvTotalDiffuse = vec4(Kd * LightSource_diffuse,1) * fNDotL * fvBaseColor; + vec4 fvTotalSpecular = vec4(Ks * LightSource_specular,1) * ( pow( fRDotV, alpha ) ) * fvSpecularColor * 3; + + if(!gui_bSpecular) fvTotalSpecular = vec4(0); + + + return ( fvTotalAmbient + fvTotalDiffuse*fvSSAOColor + fvTotalSpecular*fvSSAOColor ); +} + +vec2 parallax_normal_mapping(){ + vec2 newTexCoord; + vec3 h = normalize(TSHalfVector);//half vector + + float scale = gui_depthScale*0.04; + float bias = -0.03; + if (gui_bHeight) + { + float height = texture(texHeight, texcoord.st).r; + + height = height * scale + bias; + newTexCoord = texcoord.st + (height * h.xy); + } + else + { + newTexCoord = texcoord.st; + } + return newTexCoord; +} + + + +// Relief shader +in vec3 ESVertexPosition; +in vec3 ESVertexNormal; +in vec3 ESVertexTangent; +in vec3 ESVertexBitangent; + + +uniform vec4 cameraPos; +uniform vec4 lightPos; + +float depth = 0.04*gui_depthScale; + +// based on https://github.com/kiirala/reliefmap +vec2 relief_mapping() { + if (gui_bHeight){ + vec3 N = normalize(ESVertexNormal); + vec3 eview = normalize(ESVertexPosition); + vec3 etangent = normalize(ESVertexTangent); + vec3 ebitangent = normalize(ESVertexBitangent); + + vec3 tview = normalize(vec3(dot(eview, etangent), dot(eview, ebitangent), dot(eview, -N))); + vec2 ds = tview.xy * depth / tview.z; + vec2 dp = texcoord.xy; + + + const int linear_steps = 10; + const int binary_steps = 10; + float depth_step = 1.0 / linear_steps; + float size = depth_step; + float depth = 1.0; + float best_depth = 1.0; + for (int i = 0 ; i < linear_steps - 1 ; ++i) { + depth -= size; + vec4 t = texture(texHeight, dp + ds * depth); + if (depth >= 1.0 - t.r) + best_depth = depth; + } + depth = best_depth - size; + for (int i = 0 ; i < binary_steps ; ++i) { + size *= 0.5; + vec4 t = texture(texHeight, dp + ds * depth); + if (depth >= 1.0 - t.r) { + best_depth = depth; + depth -= 2 * size; + } + depth += size; + } + + return dp + best_depth * ds; + }else return texcoord.st; +} + + + + +void main( void ) { - vec4 diffuseColor = texture(texDiffuse , texc.st); - vec4 normalColor = texture(texNormal , texc.st); - vec4 specularColor = texture(texSpecular, texc.st); - float ambientOclusion = float(gui_bOcclusion)*texture(texSSAO, texc.st).r+float(!gui_bOcclusion); - - - // Phong model - vec3 N = normalize(vertexNormal.xyz); - vec3 L = normalize(lightPosition.xyz-0*vertexPosition.xyz); - vec3 V = normalize(vertexPosition.xyz); - - - vec3 L2 = normalize(staticLightPosition.xyz-0*vertexPosition.xyz); - - // diffuse lightning - float Rd = 1.8*max(0.0, dot(L, N)); - float Rd2 = 0.2*max(0.0, dot(L2, N)); - vec3 diffuse = gui_DiffuseIntensity * (Rd+Rd2) * diffuseColor.rgb / 2.0; - - // specular lightning - vec3 R = reflect(L, N); - vec3 R2 = reflect(L2, N); - float Rs = 15*pow(max(0.0, dot(V, R)), 20); - float Rs2 = 5*pow(max(0.0, dot(V, R2)), 20); - vec3 Ts = specularColor.rgb; - - vec3 specular = gui_SpecularIntensity * (Rs+Rs2) * Ts/40 * float(gui_bSpecular) ; - FragColor = vec4(diffuse*ambientOclusion + specular*ambientOclusion, 1); + // calculate uv coords based on selected algorithm + vec2 texcoords = texcoord.st; + if(gui_shading_type == 0){ + texcoords = relief_mapping(); + }else if(gui_shading_type == 1){ + texcoords = parallax_normal_mapping(); + } + + // apply standarnd normal mapping + FragColor = (bump_mapping(0,texcoords)+bump_mapping(1,texcoords))/2; + + //FragColor = vec4(texcoord.xy,1,1);//texture( texDiffuse, texcoord.xy ); + } diff --git a/content/plane.geom b/content/plane.geom new file mode 100644 index 0000000..4270b8f --- /dev/null +++ b/content/plane.geom @@ -0,0 +1,103 @@ +#version 400 core + +layout(triangles) in; +layout(triangle_strip, max_vertices = 3) out; + + +uniform sampler2D texHeight; + +uniform mat4 ModelViewMatrix; +uniform mat4 ProjectionMatrix; +uniform mat3 NormalMatrix; +uniform float meshScale; +uniform float gui_depthScale; +uniform float gui_uvScale; +uniform vec4 cameraPos; +uniform vec4 lightPos; +uniform bool gui_bHeight; +uniform int gui_shading_type; + +in vec3 tePosition[3]; +in vec3 teTexcoord[3]; +in vec3 teNormal[3]; +in vec3 teTangent[3]; +in vec3 teBitangent[3]; + + +out vec3 texcoord; +out vec3 ESVertexPosition; +out vec3 ESVertexNormal; +out vec3 ESVertexTangent; +out vec3 ESVertexBitangent; + +const int no_lights = 2; +out vec3 TSLightPosition[no_lights]; +out vec3 TSViewDirection[no_lights]; +out vec3 TSHalfVector; + +void bump_mapping(vec3 eyeLightDir[2],vec3 eyeVertexDir[2],vec3 halfVector){ + + + vec3 fvVertexNormal = ESVertexNormal; + vec3 fvBiVertexNormal = ESVertexBitangent; + vec3 fvTangent = ESVertexTangent; + + // Tangent space calculation of two lights + for(int lightIndeks = 0; lightIndeks < 2 ; lightIndeks++){ + TSViewDirection[lightIndeks].x = dot( fvTangent , eyeVertexDir[lightIndeks] ); + TSViewDirection[lightIndeks].y = dot( fvBiVertexNormal , eyeVertexDir[lightIndeks] ); + TSViewDirection[lightIndeks].z = dot( fvVertexNormal , eyeVertexDir[lightIndeks] ); + + TSLightPosition[lightIndeks].x = dot( fvTangent , eyeLightDir[lightIndeks] ); + TSLightPosition[lightIndeks].y = dot( fvBiVertexNormal , eyeLightDir[lightIndeks] ); + TSLightPosition[lightIndeks].z = dot( fvVertexNormal , eyeLightDir[lightIndeks] ); + } + + TSHalfVector.x = dot( fvTangent , halfVector ); + TSHalfVector.y = dot( fvBiVertexNormal , halfVector ); + TSHalfVector.z = dot( fvVertexNormal , halfVector ); + +} + + +void main() +{ + + vec3 newPos[3]; + float hfactor = 0; + if(gui_bHeight && gui_shading_type == 2) hfactor = 1; + for(int i = 0 ; i < 3 ; i++){ + float height = texture( texHeight, teTexcoord[i].xy ).r; + newPos[i] = tePosition[i] + height*normalize(teNormal[i])*gui_depthScale/meshScale*0.04/gui_uvScale*hfactor; + } + + + for(int i = 0 ; i < 3 ; i++){ + texcoord = teTexcoord[i]; + + + ESVertexNormal = NormalMatrix * teNormal[i]; + ESVertexTangent = NormalMatrix * teTangent[i]; + ESVertexBitangent = NormalMatrix * teBitangent[i]; + vec4 eyeVec = ModelViewMatrix * vec4(newPos[i],1); + ESVertexPosition = eyeVec.xyz; + + vec3 eyeLightVectors[2]; + eyeLightVectors[0] = normalize(cameraPos.xyz-eyeVec.xyz); + eyeLightVectors[1] = normalize(lightPos.xyz-eyeVec.xyz); + + vec3 eyeViewVectors[2]; + eyeViewVectors[0] = -normalize(eyeVec.xyz); + eyeViewVectors[1] = -normalize(eyeVec.xyz); + + vec4 lightV = vec4(0,0,5,0); + bump_mapping(eyeLightVectors,eyeViewVectors,normalize(lightV.xyz+eyeVec.xyz)); + gl_Position = ProjectionMatrix * eyeVec; + EmitVertex(); + } + + + + EndPrimitive(); + +} diff --git a/content/plane.tcs.vert b/content/plane.tcs.vert new file mode 100644 index 0000000..e27c341 --- /dev/null +++ b/content/plane.tcs.vert @@ -0,0 +1,80 @@ +#version 400 core +layout(vertices = 3) out; + +#define ID gl_InvocationID + +uniform mat4 ModelViewMatrix; +uniform mat4 ProjectionMatrix; +uniform mat3 NormalMatrix; +uniform int gui_shading_type; +uniform float gui_depthScale; +uniform bool gui_bHeight; +in vec3 vPosition[]; +in vec3 vNormal[]; +in vec3 vTexcoord[]; +in vec3 vTangent[]; +in vec3 vBitangent[]; + + + +out vec3 tcPosition[]; +out vec3 tcNormal[]; +out vec3 tcTexcoord[]; +out vec3 tcTangent[]; +out vec3 tcBitangent[]; + +float lod_factor = 0.003; +float level(vec4 v0, vec4 v1){ + return clamp(distance(v0.xyz, v1.xyz)/lod_factor, 1, 64); + } + +vec4 project(vec3 vertex){ + vec4 result = ModelViewMatrix * vec4(vertex,1); + //result /= result.w; + return result; +} + +void main() +{ + tcPosition[ID] = vPosition[ID]; + tcNormal[ID] = vNormal[ID]; + tcTangent[ID] = vTangent[ID]; + tcBitangent[ID] = vBitangent[ID]; + tcTexcoord[ID] = vTexcoord[ID]; + + if (ID == 0) { + + + if(gui_shading_type != 2 || !gui_bHeight){ + gl_TessLevelInner[0] = 1; + gl_TessLevelOuter[0] = 1; + gl_TessLevelOuter[1] = 1; + gl_TessLevelOuter[2] = 1; + }else{ + vec4 ss0 = project(vPosition[0]); + vec4 ss1 = project(vPosition[1]); + vec4 ss2 = project(vPosition[2]); + float e0 = level(ss1, ss2); + float e1 = level(ss0, ss2); + float e2 = level(ss1, ss0); + + vec3 normal = NormalMatrix * cross( vPosition[2] - vPosition[0] , vPosition[1] - vPosition[0]); + vec4 eyePos = ModelViewMatrix * vec4(vPosition[0],1); + float dtv = dot(normalize(normal),normalize(eyePos.xyz)); + + if( dtv < -0.2 ){ + e0 = 1; + e1 = 1; + e2 = 1; + } + + + gl_TessLevelInner[0] = (e0+e1+e2)/3; + gl_TessLevelOuter[0] = e0; + gl_TessLevelOuter[1] = e1; + gl_TessLevelOuter[2] = e2; + } + + } + +} diff --git a/content/plane.tes.vert b/content/plane.tes.vert new file mode 100644 index 0000000..f178531 --- /dev/null +++ b/content/plane.tes.vert @@ -0,0 +1,36 @@ +#version 400 core +layout(triangles, equal_spacing, cw) in; + +uniform mat4 ModelViewMatrix; +uniform mat4 ProjectionMatrix; +uniform mat3 NormalMatrix; + +in vec3 tcPosition[]; +in vec3 tcNormal[]; +in vec3 tcTexcoord[]; +in vec3 tcTangent[]; +in vec3 tcBitangent[]; + +out vec3 tePosition; +out vec3 teTexcoord; +out vec3 teNormal; +out vec3 teTangent; +out vec3 teBitangent; + + +vec3 average(vec3 a,vec3 b,vec3 c){ + return gl_TessCoord.x * a + gl_TessCoord.y * b + gl_TessCoord.z * c; +} + +void main() +{ + + tePosition = average(tcPosition[0],tcPosition[1],tcPosition[2]); + teTexcoord = average(tcTexcoord[0],tcTexcoord[1],tcTexcoord[2]); + teNormal = normalize(average(tcNormal[0],tcNormal[1],tcNormal[2])); + teTangent = normalize(average(tcTangent[0],tcTangent[1],tcTangent[2])); + teBitangent = normalize(average(tcBitangent[0],tcBitangent[1],tcBitangent[2])); + + + gl_Position = ProjectionMatrix * ModelViewMatrix * vec4(tePosition, 1); +} diff --git a/content/plane.vert b/content/plane.vert index 1d43bf1..99a85ad 100644 --- a/content/plane.vert +++ b/content/plane.vert @@ -1,33 +1,107 @@ #version 400 core -layout(location = 0) in vec4 vertex; -layout(location = 1) in vec4 texCoord; -uniform sampler2D texHeight; -uniform sampler2D texNormal; - -uniform mat4 ModelViewMatrix; -uniform mat4 ProjectionMatrix; -uniform mat3 NormalMatrix; -uniform vec4 lightPos; -uniform float gui_depthScale; +layout(location = 0) in vec3 positionIn; +layout(location = 1) in vec3 texcoordIn; +layout(location = 2) in vec3 normalIn; +layout(location = 3) in vec3 tangentIn; +layout(location = 4) in vec3 bitangentIn; + uniform float gui_uvScale; uniform vec2 gui_uvScaleOffset; -uniform vec4 cameraPos; -out vec4 texc; -out vec3 vertexNormal; -out vec4 vertexPosition; -out vec4 lightPosition; -out vec4 staticLightPosition; - -void main(void) + + +// Sending vertex attributes to the TC shader +out vec3 vPosition; +out vec3 vNormal; +out vec3 vTangent; +out vec3 vBitangent; +out vec3 vTexcoord; + + + +void main() { - texc = (texCoord)*gui_uvScale + vec4(gui_uvScaleOffset,0,1); - float hPos = texture(texHeight , texc.st ).x; - - vertexPosition = ModelViewMatrix * ( vertex + vec4(0,0,(hPos)*gui_depthScale*0.1/gui_uvScale,0)); - lightPosition = lightPos;// ModelViewMatrix * lightPos; - staticLightPosition = ModelViewMatrix * vec4(0,0,5.0,1); - vertexNormal = NormalMatrix * normalize(texture(texNormal , texc.st).rgb - 0.5); - gl_Position = ProjectionMatrix * (vertexPosition); + vPosition = positionIn.xyz; + vNormal = normalIn; + vBitangent = bitangentIn; + vTangent = tangentIn; + vTexcoord = vec3(texcoordIn.st,0)*gui_uvScale + vec3(gui_uvScaleOffset,0); } + +/* +uniform mat4 ModelViewMatrix; +uniform mat4 ProjectionMatrix; +uniform mat3 NormalMatrix; +uniform float meshScale; +uniform float gui_depthScale; +uniform float gui_uvScale; +uniform vec4 cameraPos; +uniform vec4 lightPos; +uniform bool gui_bHeight; +uniform int gui_shading_type; + + +out vec3 texcoord; +out vec3 ESVertexPosition; +out vec3 ESVertexNormal; +out vec3 ESVertexTangent; +out vec3 ESVertexBitangent; + +const int no_lights = 2; +out vec3 TSLightPosition[no_lights]; +out vec3 TSViewDirection[no_lights]; +out vec3 TSHalfVector; + +void bump_mapping(vec3 eyeLightDir[2],vec3 eyeVertexDir[2],vec3 halfVector){ + + + vec3 fvVertexNormal = ESVertexNormal; + vec3 fvBiVertexNormal = ESVertexBitangent; + vec3 fvTangent = ESVertexTangent; + + // Tangent space calculation of two lights + for(int lightIndeks = 0; lightIndeks < 2 ; lightIndeks++){ + TSViewDirection[lightIndeks].x = dot( fvTangent , eyeVertexDir[lightIndeks] ); + TSViewDirection[lightIndeks].y = dot( fvBiVertexNormal , eyeVertexDir[lightIndeks] ); + TSViewDirection[lightIndeks].z = dot( fvVertexNormal , eyeVertexDir[lightIndeks] ); + + TSLightPosition[lightIndeks].x = dot( fvTangent , eyeLightDir[lightIndeks] ); + TSLightPosition[lightIndeks].y = dot( fvBiVertexNormal , eyeLightDir[lightIndeks] ); + TSLightPosition[lightIndeks].z = dot( fvVertexNormal , eyeLightDir[lightIndeks] ); + } + + TSHalfVector.x = dot( fvTangent , halfVector ); + TSHalfVector.y = dot( fvBiVertexNormal , halfVector ); + TSHalfVector.z = dot( fvVertexNormal , halfVector ); + +} + + + +void main() +{ + + + texcoord = texcoordIn; + ESVertexNormal = NormalMatrix * normalIn; + ESVertexTangent = NormalMatrix * tangentIn; + ESVertexBitangent = NormalMatrix * bitangentIn; + vec4 eyeVec = ModelViewMatrix * vec4(positionIn,1); + ESVertexPosition = eyeVec.xyz; + + vec3 eyeLightVectors[2]; + eyeLightVectors[0] = normalize(cameraPos.xyz-eyeVec.xyz); + eyeLightVectors[1] = normalize(lightPos.xyz-eyeVec.xyz); + + vec3 eyeViewVectors[2]; + eyeViewVectors[0] = -normalize(eyeVec.xyz); + eyeViewVectors[1] = -normalize(eyeVec.xyz); + + vec4 lightV = vec4(0,0,5,0); + bump_mapping(eyeLightVectors,eyeViewVectors,normalize(lightV.xyz+eyeVec.xyz)); + gl_Position = ProjectionMatrix * eyeVec; + + +} +*/ diff --git a/content/text.png b/content/text.png new file mode 100644 index 0000000000000000000000000000000000000000..63a9603abcaa2c562dc7be3fe9eba72c559d07aa GIT binary patch literal 9902 zcmbVyXH-+&w)Re_LTG~0i$O6c(t8a`lU}6>1Q9VRO+hIl0ThrXD7{MyAWf++hy-aW zAdsja9eD*p4HBv(xf{RfA5dYr6Q*Cb>2Y!Fwtl;U)Z#^&u!+uSo8b8*@nZ!=^S zMDLlq7*{N?0>dU#5C8@MIB>)NIM4xrEO_t#GN>jy6^`coX0yZo43HN#DHUK^D)l9r z9OOMJ$tzn^OdGjrOY!9cWQ{WLJpt;%#stWH!Vp<2%&dSgL6&GYFTlr;&jzy40S9O; z7c)a^jalKh!vRHcs?PfJ_8|q@WxPbkkWpCFl|t!KTkiKGnGF%v0%R!Fy*L1K&xU$H>zi(8ny}085}Mfw4*ZNJV zZf`n!`=Vfn(L_~GW8!N*DK;wO=xpd19sC>sf6DR9fBxBvM!GXdy_^onpd0Jk%kCeX z5?1`#YkGCWql=(o*4c4gBj@sutIR>HxH$QL#)@u_I$n6Rku~FaPtga*zbCM653z)B zdWzgA4qjHF-g;A11Bi7GIPh2rXeJE4SwZL%SCsp4ZLeX1q~UjigwKaq0Mb1b`hefs9SZ@Wa1gs0eh!%dN^5i6Dvpb6XqsmdxeE?Y~v`hhmu z<_UmHnCbK@u5|VF{0k7rliyVL`L|0wl%@Ng?!iU=Ecj5P+)EYL_1-e1EV=2aJ2Rq` zvaWId71{(#UFiq1XH4o~I^CWv0^*joz;)Y*fNVQ z{k>g;GktblVY+)&&)uuBUWMhr2TUl}glq>)D69^Sa`tNXA z!O?l6hx~0Xj~?I39X`Ig&{5_^Z9l=wcA5c*9jRi@jn`LYlDT9BNrsRw z-RZojY8*>AxWC0~bt;yt^J0oj+izN}Ssap{^~$WFD)+OCBcqUhOfcPwpgF*4K+Ct( z3&~{iFD}+h$mG8xGl~}1-I17KXc0b(9HB=t4x6bS>z}L6-<5%fh0P!nJ`DW$GJ@m$ zQ7EJeH|^Qp)2xXCqd|9_<8x=nEXw-;PS<1eN=XvxkAM>8E!p9wohLFQYIR4rFtFrm zRXW;JC(TP-MBgOU6g2_lj*(dT`_}>)$Rpdgn6)39WhQf3aTysS9qKuNHsl$kAt0am z=*bIzW$kEpScqPLW^$}TA5<=S7SZ*Z<;=rlaT0($^1g?#dH2jby4zBZ@fp^Z@C@J} zV5-httHPf~as&KVWv*#aAzO98mQ{3AEVIyWlmx84Ylz^7awyi$V(gYxg)3~yvKdK0 zko=4D5B3;&P5}JKP?At#Y=gU-&|`FFln&0_0rOYp7v4Uotisv+;PwQWxxh)NK4>0d zvb`iW;k)$PNG!?YYRu5AZEi&49+xX|&Le{FtAru+gss2Y6-=xI0EgoTd^GtVaxl%_ z6pEks^WzXY~aiDOp&AwBQh%xm7MB$fT>;nmY9 zfpgt@&RT)C z)7i4<#Wiw0o0H0oWY+I>kF~mZ#s+GR3mXH#6c5l7g9}T2*6`yO>Af{TOgWC4Tl~5w z>8cka4$=-hyUe@0-XYP`MH=$;%W0JQx7pglB?%-K7rJK(k{~ZL_i%FZXDIZI3gbK8 z^Dl2g#o+KYzuggYMgzYyO+VnK(yjFLcB$5V5Z?JycMNm5%m6*T>kT#$6aHLH4}Ql# zet#OJO+Bt=2s%N}mR|Ws{n*Ib1_$$*S<|;{|9y21`gY{!am!Ag+<52_8N$y&bLuK5 z&WM>pv@zl-p?VBRJw1J~Ec#W06#s7Bud!u7&(p%#*ro5#XFsfY@&`_%)K=OokK&}K zN5F*ooq!>B5Mt#&Oc5dMmo0BKy>Ce0t zhz`zQ%Npu>W1q1|It{};Same1=%Xr!;3hBP5?9t(`n>r=VTI5_`pMp3s&EJRu4+0; zI+eX%_D70bT#2%GS>- zh<@+aNIG$Z=)&5yc$s+{;YTqWx_1+!J8bk?dzS6L&{o-8HFyo@2rh?r4jb3s4GcuT z@s+)se@!I1Is5xow$m$s{7S8babx3)2Ib@rgEL5dWQkw;UySa9u_*pVzN9YUz0;49 zindfm{C0Pv1-IT77Go%Wu>6=J=iIh{1qu8PJ>!?Yhip)%14R1kq8$n z$^jDVzUVbxOt$t3%1gy;%oe*KAS&0gxE11ATSRekY=*OE!6XQomi6g=?w`9k>U&_s zi>V`yDt16P&q3f%>PJM5B?s^u83UGPE{2_^laU-h&^&2OB+Ui!Xr`~ZCSOwao+g2& zhvdzzI4CFihYQ)(4^)jWSGjpn;aZ(3iJi`=5l)cu)=)J`y1*NA&U<36m$<$^ZS!wx z>zhM}MgP=fZ~#-OaIyM*#r(rjx54r+%2Xahc5ziM$vU2(sAsgESky~W##H-AyEfNJ zcP;HJsP8mw?I(8;5PwJkiz*LcQ$tI{fuYd;Lf>+e3hlru{7n7ks5f<-tj`$j)sIBQ za$)0;S%J*{4#MaCwQDYN1+#Q?YuLQ_#LWKpbBaGgBwF75r_$|jsj07>+wObsl=8Qn zQ0PUTN%=hR?pH(Xv zZ(;(Ib0rS8xKYnN4Mb({8dqrEcnr-D(st@PdN+TF{YobTdZ)UgIH&X62or=*v@ z1HLguzI3Z6(daC?;LzNf``cx4NsC@_UqV zXmq;t7_v6&aU-IcCd&U3xIVobZX@P)ruM9De(Ic;(rS@l*TGGwtm!p}Et~p0DOs`Rxf0>>bg0pz>?fy%s{%M`0%b5wmszQeI&*UaS zsZpwLZuu>DmBttRv!~90&7m@(g$2WcD^wM+=_Ac1`3bY&_U@^?i$81m1a4i`KK68U zlm1=QCBNh5oz$sZ`poaYr?iHkq~kwUdBg&zh=%kW9xOalbi+!bH*aro+-53Rq(QZ# z;x{vu!&CBqL2G*XgP8UExR^`^Rtv2k1)m5N6r%fkTN6_;#^Lgm1=CAYaHQ5Hj_9bX zAB1xj;0zG(_7%0<7{QT5RrX$uyV8KTSYjEVyC|>Eedh$mNBwyH2qJ%LfyOD_y#nga z4D&blFkT&gzl5xx!SwRb{_+lvLIwXdw{yT$1K+oAQ?wb!SiB?-^ z(nU!usJY6iZv;Eq7Udv(@9%&$vWvg1hG0jQXD{`pj>c=osyL&9Ru+qwO9NdIAH=6` zLX+pYFhph~LtzfP@BCCa_TBf5i6BN$k;W4P%L~g@Z=mic*#MWGADUpm+IT50t6G^> zwn6Pnx37bMvqI^0p1dqKmArOmIsgjR@UUcx)59HQk4c7E>9-L5>#~y&8Na9ip-A{O zGtMje9MI)^FGdjl>>E^%$wdFYDHE5cvDXbZa_ZRb%`qf4dX-Wy{6*Ee`DRW~D2@e( z+tl-#-e>CQVWqSYt4uz071&-=uA#Ak8;baLx&ec6D~M!E;uMZ zGW0dj^8`BBUyR-5{HZBX0F6BKWo(FMlsgAJzX04wPsMEh>`+?fFSv^&ww5EwsfpQA^u2HWLyd_ayr`MBUGLS>iUdKA+h-`)b3 zdzwZ*`IVoFdFTU6Xls}|I|^Ei*{m|3JjA~4_<&P@HMSHWGIF3>hl;qz(7337R)$<7JYsX}R=--onyUTt$fJNA8Ths##LB7FGYR*}j2!`;=3+ z^A_`sQ>jwMN>6LWs>{>H0_@nb5#AN2xL-=UNeCo286={TEi1eulkE@!J&4H6gGe|t z^YLB=1VVAnlT#ALF7w$m+I=Da-u>|KJELm1hgu&jd~UzDuv)KE(D?4Q+oAL4EsfBE zdx(>)beJdMVN8X06g3Z>f5U|7Fy|mrKXgiS)WPNkjyblnvh0x52LOcu{i5InK2m%L z9{?EON;<*rh|GdJ*aQK)GN}Lm0ItG70O0>J;H1$nXM>4qM0CXkRPwiyP&^cTRIN!r zAs%0EGl4q@@H%+ddfMCc9%wVWsi=jou{UEVHsf1f=5)rp0s)*CFk2Y#okxU9DhfcW zt0#if^7Exl4a?B&d#c@>o8$0oEdv7*C*1{LGze@&JG5=uL1269ccH^=+P6;= zv^t5f;@E^S^JiewYN?b1n^Dr9y+IX>3HJ@!YrYHM_KBPDM{>~Chbo{4e9UM{c@ulx z;T<*hqST7U7@da~T(S)?ZqUcHwCN0GWu3#(mbIB)FB<7589O*K-oicX*g^+{r>&RA z;H=QYzbp>Bw695qb|` zoa4VlI2QxjVAqTf7#?>nIzmIQ^dJ0S9vFZ?!lbY=0znboa~zC-0rFhyv96PcoSf0P zqHrByp#u~!`-BI024e01>AU?~lTHTmevUX6aC2OS4PO!^?`@=Wd9-W;>pBjGbv8D@ zNnLs^f1E`-`AS(m!4Azn%LU{nze|~xWr)!kD9I@8C-86UsDMHDHCe=l5gHj5%P~#eA8md}rFQ72s?eB1xW$0cSxflA76^Qe|*PvfkelZ}8 z2ly{5!hpR+R&{dD=uSiwK?LowECmCC4lc4&TXjtgfmF1_+W0mE+|MrCLJ5y5x#e&h znRO6-o)O^b=|W2nMs>KU@O{f}11!Idp2gc#5I|EF0)FMj&`7wAui?7}Oi0IcyAct~ zD|UgQHT8e)N0V=khvz?_wktZj{Z=FYPV57`A)XJbV_^|R{jvZmuvN8PC$Z9Ze>5ii zQ|F9eFwC-XH40-{mP0VxK8|SBrUy64CD-CpDg=~;Alq{VadU07`xIp$pW(=_ z{nQ{gWzR7_h!)Xi9exZt>HzJSu5+PG5M%gc1MjhsVWIi8ykV;)_bfkAnVy^tM(ur3>Z_&OEwE<}q1<>uykgWPLX0(tf>7)(RvOb> zCe8|yP>`eg=|IS8`m{C17lPc3YvBBPk~S$~SvF(TZ>@90Jwk7AQ61wyHg+)b6zg$? zY6~z&Hiwl(4x?<9vj1*_SSnN3M@P*;!Z34IJIrAU58rzb=FNd1EPS!Zi-rKZKJ#-k zqTl!+YY@*6S*@%iLaMRAmflU8pi)|=ml~z|dy6sOaK#wGR|s`>kTuMkOJ<}D6hUIb z-&y`S>pKmJy*dH;hV2-{Tqs)l#SXsEAaNid_}n5$9{uSXB{vO^H-E?LqFZw&# zvh|Eh+7)c|CPEBc>fQR*$kS2!6%#T|LO8Xed2eGM>~&KbqyyK0L;*-b zZ7zHu({O>9ki84aoJ_LnAvl0gI(f(r7+_{B`Z7VNd7u&i67#=f30&~sAYuokOxjA% znW-aebi9pOK?G`wQ|=#(672~DCuI;$BIfp`wPn8vSHPg3E!i#QEoqAEBD^MkAy)+W zgq+jo-h%c5F(V5B#Daw zUIqn*Tyd&8XLb$||8izC0to{Uac&l@R*kE;m<1%IvEg>MS>6)}z$AS*Jfzg<2SaA% z=igTW5lxCzeb%e1Q~t_H6G~!6DW@H25h^U(LaO)O3697&ru@o_La zP1mKvF@7CDs@-jG7J(cQl1hmgx*5DPZA5t^74rZ({$S68{;G|hot=IL2&X(^Hrcr+ zw%42Hnr+rDL~ZXC$K32;#>i`>)=0rGH4((Y9H}JFk!A4tTkXGVIcT;pCy-t~Tdc(G z^)N5}ngTPlMWNb=S5X8)w%HfJ@9Xpb;(!&Q|(YSFEzv)s+Ns}Bi0b-g#je!(=O3J z98+M{Qx0;BOzwmZBd!yyhFnb{pfnyy+P^5~pC!*9&HGakfyqGnMgA0^r!LkANkx0N zDpZ@!T(&5y23_KsYi?F6C*+(kzr5l?93qtdqwsnDE+t7p081Z(jmNu{OdY8cDTcTz z8J6;xn{bwJRQ5apQz*Oh7;#M!WcDobS>fPC4lI^(Bu{%@M7s*sSvBI`Kgyn_Et;s^ zEpb)lyn-VgNivjqecSHebXd90pA6dj3&nYs)G?E%09HV(b+ zk)BOM%A*?@uV(n1zr|0NCjus#pRT%eJKQdjYxul%*dBIniCa9Q*l^-UvB!LTdxix}Xw+)tAKnP^qMxRC02nTiQ7~K>_nf#j5RR^(%NTU% zAM;uOli;*};^ZF#Mm{hByw={p4T5Rd!5aRxLb=vZlh-ug)uMgzrRhQnV^7%JC{Y1r?ba7RF&J6 z6A7#Mw?6KGpS?hHb7^??IO~{3Ue83^%j+ zD~VS*j2E#T#xfTD`0D_>nOE6)f*h;BUd86_wW;xkRE{>D_|6A}A%Zqq+OzWhEFWLV zC|0Fp0zXr_LTE={I>(9<>U#K$JV}0YfYVW5%RgBpfF9mk?Ag2Tbde7bq0>}VP`GDC zedr-zr(9!FeM_b?lum3E6t)f*cIc){qB2$#u-a zKD`mLwNv8bhbUAS_v0ff*f4XM8>5K{m1W;MTU4s&_kuVsfSvYeS&5Ny&4(6#Rx9&9Ck&9b zcu;zGJ$+h8MyP^89Jr~uRm(wD6xxm#_|+b8c|1ZE2$H9Go?E$5St&5#f;nI)&RDrg z>18(JW)z|hZfZNz+9us1A++$`tr;m0O!$EQC1yTq`z0kqq)9Z;GUYaUyMgD~uW#6R zYj49x0Ot%8bx&P9%>QqaX!Ur64vQk<7C%J)L?T^yS&fjg4|4uDh2oz0fEM3D=eHSD z0P=-j*uf03d+ueMjUld3Bv=9c{X^c<4>OlMot%)3)eisxCfYTfj(c7QR|OP659TKs zGcCgMKNc0BA0>Lh#0x($^Ccu;JS#eS5Z@hfOwSJM93NtLNM9K+7X{Nuv14&YbMKY@JM*i_>qf5?@@b$+9tV2r)&8?r zJl=9!mYo~?BBPk-d$zlCKLQYCwX_UOLm&Z9QJeT$)4;2(owcuh_Ua8X@Bf_2ADbV*SLXohC+bxr?^`MV=3AcgSSa6Jqe=-a-(7w^YaY zS;N9I98g*@edtof2C&_5v$MD`HDP(D?aA!C{kE_%z~pfE#2TXki_$ zQ+G*E$8r-4@y+;4Xpa#_q>k2eALGT6X6%d!Z|QFqKPDVAcp%8^YY((9nIh;C_qVt0 z@em@e!PzCNmuc+k?#%=*tI8~>A(|M$ax geBS@=B96wy9lQblxQW#slmg(gzPVn_MO5T}0rdhlz5oCK literal 0 HcmV?d00001 diff --git a/content/trash.png b/content/trash.png new file mode 100644 index 0000000000000000000000000000000000000000..8bb03baf35b9b55df5d968a8bc434706636c3927 GIT binary patch literal 1531 zcmc(f=Tp-M7{`A}1B4h6C1RKj%ODoaC?lA%5fBJNkT8pc6%Yt9Kq6`b%C1Hk5m2zl zC_+F|5M@{)29IMMWvIw9p_G6k!#HpN{pq{@1-*N|&*z@!?(_DW=S^|hjnG5@0I=K5 z)yWqm_iNxVaMLa8?La^y++Cc2ogCg!H+U&CTm#R5bp4iN{qZ(mpQ#M{7?9j=!AbGu z0H9#(=49{3o_by38LJ(I?)#;+t3Pq2Ib8gZv&)t56$}dxPDJ*+Pr9gb2KzR$5wW%;LMh{9E1Tw#sKY zsnfEwsnEHyt?usUWt^C3nT9vY*$4HH!{fZS)7k9&gb zGl#C3cD)^uN?Xcow&N}csZP*rJgO9X!ubOPsjF25SATLu0=R4>3s$yCS6qrcJAR{2 zgkdOzdHWJxa58ys9#?O5QPE;7Ao*gDS4jFpXdP+b*-FewN{{Lh;h$E*gr2e61<18^ z=9Z%j2i2817ji|Czoj(&r;@7}%1t7(GpzW(*~h(#e<{&M;OW z4~7}5BoI+?Q{9%DIj~T}4xXcrGFqw@0gEhaj*HdGx@2f(aI-1p5xYqZaC<-QV#g0; zMrd`{vRQ;4Q4m%jqlRNIqC*ygZhrOytLj0Y?)Q$zIal+2*Ac^b1On5h65yDE7X-_xIwuB+%? zT?K&jk8N{q;tEt~UoPtfgnDA9=F|v6>w&rz8u5n<;xGm?3#C0$?RvQ0&2`wNt#*kD z_=IZ21^RJW0Nu}Sd@-b_xvHd|srJ(R6{e09kW)9=w};hIfpsgPe=wqXwDMq*%CUCZ;fV*VS;@q)RnV>~1GN%O7v)ctq#55$0G!gQ=%dy~&tW&6Fq5EBK_I!}gEC-t4>+orj41fkNBK z8@mA2{1tIk1#|g-TAp%+$+h+Rx)pn|+``e0?xq$@7pxZE2>;wzbzGJjcog2AFnT%R z)no*{M8bDoTfL8H=Re#D!*&RCV5b*2Cn3U0-oVUD>w$aof>1Iop{+ci1I7)TixQ5O z#EWNtN-SVvkCuk-zp>ma2{cizVHeqwL?x#IXuN%;fYdv(dAjQUCO5k_vIaIpwb`>Y zf6$tN+l*{#Q<68zOd_}OP4J}^S(Urxm~000U}+2LM>rMZ(il-&Pi{42tZxi9PG=*{l9Ag8 z!T9}CovMijOY+Kh{1`{b^>dFMf+3uld@mh5yL};G=|WE(6Dl!{);AM$7dMx}iJZyc zQTdlguQS_vDR|90#Q~e?8(!;5!C6-hMYA)B(&*9L2w0J}RP(I<+V%(XaKDg9pZGLA zY_=*L%k9)%S6d^_Y4RpFZ=o+DlYNRT^KFRQttz6gEd@^P@ofm>i}T9H4azDP!{}0NJxsLM{_^{M=}K+ e0>O_!v4ywC~`3V@q4#p#Yic;>(1+lgfW literal 0 HcmV?d00001 diff --git a/dialogheightcalculator.cpp b/dialogheightcalculator.cpp index b36a06d..c88a90b 100644 --- a/dialogheightcalculator.cpp +++ b/dialogheightcalculator.cpp @@ -13,6 +13,7 @@ DialogHeightCalculator::DialogHeightCalculator(QWidget *parent) : ui->doubleSpinBoxPhysicalHeight->setValue(0.0); ui->doubleSpinBoxPhysicalDepth ->setValue(0.0); + } DialogHeightCalculator::~DialogHeightCalculator() diff --git a/formimageprop.cpp b/formimageprop.cpp index e5be26c..9515ce0 100644 --- a/formimageprop.cpp +++ b/formimageprop.cpp @@ -472,9 +472,9 @@ void FormImageProp::reloadSettings(){ ui->checkBoxInvertR->setChecked(imageProp.bInvertR); ui->checkBoxInvertG->setChecked(imageProp.bInvertG); - ui->checkBoxEnableHeightToNormal ->setChecked(imageProp.bConversionHN); - ui->checkBoxEnableNormalToHeight ->setChecked(imageProp.bConversionNH); - ui->checkBoxEnableBaseMapToOthers ->setChecked(imageProp.bConversionBaseMap); + //ui->checkBoxEnableHeightToNormal ->setChecked(imageProp.bConversionHN); + //ui->checkBoxEnableNormalToHeight ->setChecked(imageProp.bConversionNH); + //ui->checkBoxEnableBaseMapToOthers ->setChecked(imageProp.bConversionBaseMap); ui->horizontalSliderRemoveShadingGaussIter->setValue(imageProp.noRemoveShadingGaussIter); diff --git a/formsettingscontainer.cpp b/formsettingscontainer.cpp new file mode 100644 index 0000000..154cc1a --- /dev/null +++ b/formsettingscontainer.cpp @@ -0,0 +1,79 @@ +#include "formsettingscontainer.h" +#include "ui_formsettingscontainer.h" + +FormSettingsContainer::FormSettingsContainer(QWidget *parent) : + QWidget(parent), + ui(new Ui::FormSettingsContainer) +{ + ui->setupUi(this); + connect(ui->pushButtonConfirm,SIGNAL(released()),this,SLOT(addNewSettingsField())); + connect(ui->pushButtonConfirm,SIGNAL(released()),this,SLOT(toggleAdding())); + connect(ui->pushButtonCancel ,SIGNAL(released()),this,SLOT(toggleAdding())); + ui->groupBoxAddingOptions->hide(); + ui->verticalLayoutSettingsList->setAlignment(Qt::AlignTop); + + + QSettings list_settings("configs/config_list",QSettings::IniFormat); + FormSettingsField::settingsGlobalID = list_settings.value("last_id",0).toInt(); + + + QStringList nameFilter("*.ini"); + QDir directory("configs/"); + QStringList iniFiles = directory.entryList(nameFilter); + qDebug() << "Reading the list of available configs settings:" << iniFiles; + // reading configs + for (int i = 0; i < iniFiles.size(); ++i){ + FormSettingsField* sfield = new FormSettingsField("configs/"+iniFiles[i],this); + connect(sfield,SIGNAL(emitDeleteSettings(FormSettingsField*)),this,SLOT(removeSetting(FormSettingsField*))); + connect(sfield,SIGNAL(emitLoadSettings(FormSettingsField*)) ,this,SLOT(reloadSettings(FormSettingsField*))); + connect(sfield,SIGNAL(emitSaveSettings()) ,this,SLOT(saveSettings())); + ui->verticalLayoutSettingsList->addWidget(sfield); + + + settingsList.push_back(sfield); + } + +} + +FormSettingsContainer::~FormSettingsContainer() +{ + qDebug() << "Removing settings tool."; + for(int i = 0 ; i < settingsList.size() ; i++) delete settingsList[i]; + delete ui; +} + +void FormSettingsContainer::toggleAdding(){ + ui->pushButtonAddNew->setChecked(false); +} + + +void FormSettingsContainer::addNewSettingsField(){ + FormSettingsField* sfield = new FormSettingsField(ui->lineEditName->text(),ui->textEditDescription->toPlainText()); + connect(sfield,SIGNAL(emitDeleteSettings(FormSettingsField*)),this,SLOT(removeSetting(FormSettingsField*))); + connect(sfield,SIGNAL(emitLoadSettings(FormSettingsField*)) ,this,SLOT(reloadSettings(FormSettingsField*))); + connect(sfield,SIGNAL(emitSaveSettings()) ,this,SLOT(saveSettings())); + ui->verticalLayoutSettingsList->addWidget(sfield); + settingsList.push_back(sfield); +} + + +void FormSettingsContainer::removeSetting(FormSettingsField* field){ + // removing from widget + ui->verticalLayoutSettingsList->removeWidget(field); + field->hide(); + repaint(); + // removing from list + settingsList.removeOne(field); + // removing pointer + delete field; +} + +void FormSettingsContainer::reloadSettings(FormSettingsField* field){ + for(int i = 0 ; i < settingsList.size() ; i++){ + settingsList[i]->resetBackGroundColor(); + } + emit reloadConfigFile(); +} +void FormSettingsContainer::saveSettings(){ + emit forceSaveCurrentConfig(); +} diff --git a/formsettingscontainer.h b/formsettingscontainer.h new file mode 100644 index 0000000..7e6895e --- /dev/null +++ b/formsettingscontainer.h @@ -0,0 +1,36 @@ +#ifndef FORMSETTINGSCONTAINER_H +#define FORMSETTINGSCONTAINER_H + +#include +#include +#include +#include "formsettingsfield.h" +#include + +namespace Ui { +class FormSettingsContainer; +} + +class FormSettingsContainer : public QWidget +{ + Q_OBJECT + +public: + explicit FormSettingsContainer(QWidget *parent = 0); + ~FormSettingsContainer(); + +public slots: + void addNewSettingsField(); // create a new settings record + void toggleAdding(); + void removeSetting(FormSettingsField* field); // destroys also files + void reloadSettings(FormSettingsField* field); + void saveSettings(); +signals: + void reloadConfigFile(); // force main window to read config.ini again + void forceSaveCurrentConfig(); // current configs will be save to config.ini file +private: + Ui::FormSettingsContainer *ui; + QVector settingsList; +}; + +#endif // FORMSETTINGSCONTAINER_H diff --git a/formsettingscontainer.ui b/formsettingscontainer.ui new file mode 100644 index 0000000..8dea405 --- /dev/null +++ b/formsettingscontainer.ui @@ -0,0 +1,259 @@ + + + FormSettingsContainer + + + + 0 + 0 + 469 + 434 + + + + Settings Manager + + + + + + Add + + + true + + + + + + + + 0 + 0 + + + + + 16777215 + 150 + + + + Adding options + + + + + + + + name + + + + + + + Project name: + + + + + + + + + Short description: + + + + + + + + 16777215 + 50 + + + + <!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:'MS Shell Dlg 2'; font-size:8.25pt; font-weight:400; font-style:normal;"> +<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">...</p></body></html> + + + + + + + + + Confirm + + + + + + + Cancel + + + + + + + + + + + + + 0 + 0 + + + + Settings list: + + + + + + + 0 + 0 + + + + Qt::ScrollBarAlwaysOff + + + true + + + + + 0 + 0 + 429 + 196 + + + + + + + QLayout::SetMinimumSize + + + + + + + + + + + + + + + + pushButtonAddNew + clicked(bool) + groupBoxAddingOptions + setVisible(bool) + + + 132 + 20 + + + 71 + 45 + + + + + pushButtonCancel + clicked() + groupBoxAddingOptions + hide() + + + 182 + 167 + + + 16 + 58 + + + + + pushButtonConfirm + clicked() + groupBoxAddingOptions + hide() + + + 392 + 163 + + + 459 + 67 + + + + + pushButtonAddNew + clicked() + pushButtonAddNew + hide() + + + 459 + 17 + + + 459 + 28 + + + + + pushButtonCancel + clicked() + pushButtonAddNew + show() + + + 195 + 156 + + + 233 + 20 + + + + + pushButtonConfirm + clicked() + pushButtonAddNew + show() + + + 316 + 160 + + + 374 + 21 + + + + + diff --git a/formsettingsfield.cpp b/formsettingsfield.cpp new file mode 100644 index 0000000..d40911f --- /dev/null +++ b/formsettingsfield.cpp @@ -0,0 +1,117 @@ +#include "formsettingsfield.h" +#include "ui_formsettingsfield.h" + +int FormSettingsField::settingsGlobalID = 0; + +FormSettingsField::FormSettingsField(QString _name,QString _description,QWidget *parent) : + QWidget(parent), + ui(new Ui::FormSettingsField) +{ + ui->setupUi(this); + ui->textEditDescription->hide(); + emit emitSaveSettings(); + name = _name; + description = _description; + settingsPath = "configs/"+QString::number(settingsGlobalID)+"_"+name+".ini"; + settingsGlobalID++; + ui->textEditDescription->setText(description); + ui->lineEditName->setText(name); + connect(ui->pushButtonDelete,SIGNAL(released()),this,SLOT(deleteSettings())); + connect(ui->pushButtonSave ,SIGNAL(released()),this,SLOT(saveSettings())); + connect(ui->pushButtonLoad ,SIGNAL(released()),this,SLOT(loadSettings())); + + connect(ui->lineEditName ,SIGNAL(textChanged(QString)),this,SLOT(nameChanged(QString))); + connect(ui->textEditDescription ,SIGNAL(textChanged()),this,SLOT(dataChanged())); + + QFile::copy("config.ini",settingsPath); + QSettings settings(settingsPath, QSettings::IniFormat); + settings.setValue("settings_name",name); + settings.setValue("settings_description",description); + settings.setValue("settings_path",settingsPath); + + + QSettings list_settings("configs/config_list",QSettings::IniFormat); + list_settings.setValue("last_id",settingsGlobalID); + +} + +FormSettingsField::FormSettingsField(QString config_name, QWidget *parent): + QWidget(parent), + ui(new Ui::FormSettingsField) +{ + + ui->setupUi(this); + ui->textEditDescription->hide(); + qDebug() << "Loading Settings:" << config_name ; + QSettings settings(config_name, QSettings::IniFormat); + name = settings.value("settings_name",QString("name")).toString(); + description = settings.value("settings_description",QString("Nothing here???")).toString(); + settingsPath = settings.value("settings_path",QString("nope")).toString(); + + + ui->textEditDescription->setText(description); + ui->lineEditName->setText(name); + connect(ui->pushButtonDelete,SIGNAL(released()),this,SLOT(deleteSettings())); + connect(ui->pushButtonSave ,SIGNAL(released()),this,SLOT(saveSettings())); + connect(ui->pushButtonLoad ,SIGNAL(released()),this,SLOT(loadSettings())); + + connect(ui->lineEditName ,SIGNAL(textChanged(QString)),this,SLOT(nameChanged(QString))); + connect(ui->textEditDescription ,SIGNAL(textChanged()),this,SLOT(dataChanged())); +} + +FormSettingsField::~FormSettingsField() +{ + delete ui; +} + + +void FormSettingsField::deleteSettings(){ + QFile::remove(settingsPath); + qDebug() << "Removing settings file:" << settingsPath ; + emit emitDeleteSettings(this); +} +void FormSettingsField::saveSettings(){ + + emit emitSaveSettings(); + + description = ui->textEditDescription->toPlainText(); + name = ui->lineEditName->text(); + ui->pushButtonSave->setText(""); + + + QFile::remove(settingsPath); + bool test = QFile::copy("config.ini",settingsPath); + + qDebug() << "Saving current config file to:" << settingsPath + " from config.ini with result:" << test; + + QSettings settings(settingsPath, QSettings::IniFormat); + settings.setValue("settings_name",name); + settings.setValue("settings_description",description); + settings.setValue("settings_path",settingsPath); + + +} +void FormSettingsField::loadSettings(){ + QFile::remove("config.ini"); + bool test = QFile::copy(settingsPath,"config.ini"); + qDebug() << "Copying from file " << settingsPath + " to config.ini with result:" << test; + emit emitLoadSettings(this); + + QPalette p(palette()); + p.setColor(QPalette::Background,QColor(200,200,200) ); + setAutoFillBackground(true); + setPalette(p); +} +void FormSettingsField::resetBackGroundColor(){ + QPalette p(palette()); + p.setColor(QPalette::Background, Qt::transparent); + setAutoFillBackground(false); + setPalette(p); +} +void FormSettingsField::dataChanged(){ + ui->pushButtonSave->setText("Save*"); +} +void FormSettingsField::nameChanged(QString text){ + ui->pushButtonSave->setText("Save*"); +} + diff --git a/formsettingsfield.h b/formsettingsfield.h new file mode 100644 index 0000000..f15e1f8 --- /dev/null +++ b/formsettingsfield.h @@ -0,0 +1,47 @@ +#ifndef FORMSETTINGSFIELD_H +#define FORMSETTINGSFIELD_H + +#include +#include +#include +#include +#include +namespace Ui { +class FormSettingsField; +} + +class FormSettingsField : public QWidget +{ + Q_OBJECT + +public: + // Create new Settings + FormSettingsField(QString _name,QString _description, QWidget *parent = 0); + // Load Settings From File + FormSettingsField(QString _config_name, QWidget *parent = 0); + + ~FormSettingsField(); +public slots: + void deleteSettings();// remove files + void saveSettings(); // copy config.ini file to current settings file + void loadSettings(); // copy settings file to main config.ini file + void dataChanged(); + void nameChanged(QString text); + void resetBackGroundColor(); + +signals: + void emitDeleteSettings(FormSettingsField*); + void emitSaveSettings(); + void emitLoadSettings(FormSettingsField*); + +private: + + Ui::FormSettingsField *ui; + QString settingsPath; + QString name; + QString description; +public: +static int settingsGlobalID; +}; + +#endif // FORMSETTINGSFIELD_H diff --git a/formsettingsfield.ui b/formsettingsfield.ui new file mode 100644 index 0000000..3a9ebcc --- /dev/null +++ b/formsettingsfield.ui @@ -0,0 +1,192 @@ + + + FormSettingsField + + + + 0 + 0 + 379 + 90 + + + + + 0 + 0 + + + + + 16777215 + 90 + + + + Form + + + + + + + + + 0 + 0 + + + + + 100 + 16777215 + + + + name?? + + + false + + + false + + + + + + + + + + + :/content/text.png:/content/text.png + + + true + + + + + + + + 50 + 16777215 + + + + + 6 + + + + Save project + + + Save project + + + + + + + :/content/save.png:/content/save.png + + + + + + + + 50 + 16777215 + + + + Reload Project + + + Reload project + + + + + + + :/content/replot.png:/content/replot.png + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + + 50 + 16777215 + + + + Delete project + + + Delete project + + + + + + + :/content/trash.png:/content/trash.png + + + + + + + + + + 5000 + 40 + + + + + + + + + + + + pushButton + toggled(bool) + textEditDescription + setVisible(bool) + + + 133 + 19 + + + 125 + 42 + + + + + diff --git a/glimageeditor.cpp b/glimageeditor.cpp index e0bbd77..b51e170 100644 --- a/glimageeditor.cpp +++ b/glimageeditor.cpp @@ -124,7 +124,7 @@ void GLImage::initializeGL() program = new QOpenGLShaderProgram(this); program->addShader(vshader); program->addShader(fshader); - program->bindAttributeLocation("positionIn", PROGRAM_VERTEX_ATTRIBUTE); + program->bindAttributeLocation("positionIn", 0); GLCHK( program->link() ); GLCHK( program->bind() ); @@ -132,6 +132,9 @@ void GLImage::initializeGL() GLCHK( program->setUniformValue("layerB" , 1) ); GLCHK( program->setUniformValue("layerC" , 2) ); + delete vshader; + delete fshader; + makeScreenQuad(); GLCHK( subroutines["mode_normal_filter"] = glGetSubroutineIndex(program->programId(),GL_FRAGMENT_SHADER,"mode_normal_filter") ); GLCHK( subroutines["mode_overlay_filter"] = glGetSubroutineIndex(program->programId(),GL_FRAGMENT_SHADER,"mode_overlay_filter") ); @@ -163,7 +166,6 @@ void GLImage::initializeGL() void GLImage::paintGL() { - resizeGL(width(),height()); render(); emit rendered(); } @@ -182,7 +184,7 @@ void GLImage::render(){ // positions glBindBuffer(GL_ARRAY_BUFFER, vbos[0]); - glVertexAttribPointer(PROGRAM_VERTEX_ATTRIBUTE,3,GL_FLOAT,GL_FALSE,sizeof(float)*3,(void*)0); + glVertexAttribPointer(0,3,GL_FLOAT,GL_FALSE,sizeof(float)*3,(void*)0); // indices glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, vbos[2]); @@ -546,6 +548,8 @@ void GLImage::resizeGL(int width, int height) } } else qDebug() << Q_FUNC_INFO << "invalid context."; + + resetView(); } @@ -1354,13 +1358,13 @@ void GLImage::makeScreenQuad() glGenBuffers(3, &vbos[0]); glBindBuffer(GL_ARRAY_BUFFER, vbos[0]); glBufferData(GL_ARRAY_BUFFER, vertices.size() * sizeof(float)*3, vertices.constData(), GL_STATIC_DRAW); - glEnableVertexAttribArray(PROGRAM_VERTEX_ATTRIBUTE); - glVertexAttribPointer(PROGRAM_VERTEX_ATTRIBUTE,3,GL_FLOAT,GL_FALSE,sizeof(float)*3,(void*)0); + glEnableVertexAttribArray(0); + glVertexAttribPointer(0,3,GL_FLOAT,GL_FALSE,sizeof(float)*3,(void*)0); glBindBuffer(GL_ARRAY_BUFFER, vbos[1]); glBufferData(GL_ARRAY_BUFFER, texCoords.size() * sizeof(float)*2, texCoords.constData(), GL_STATIC_DRAW); - glEnableVertexAttribArray(PROGRAM_TEXCOORD_ATTRIBUTE); - glVertexAttribPointer(PROGRAM_TEXCOORD_ATTRIBUTE,2,GL_FLOAT,GL_FALSE,sizeof(float)*2,(void*)0); + glEnableVertexAttribArray(1); + glVertexAttribPointer(1,2,GL_FLOAT,GL_FALSE,sizeof(float)*2,(void*)0); glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, vbos[2]); @@ -1396,12 +1400,31 @@ void GLImage::updateMousePosition(){ void GLImage::wheelEvent(QWheelEvent *event){ - if( event->delta() > 0) zoom+=0.1; - else zoom-=0.1; + if( event->delta() > 0) zoom-=0.1; + else zoom+=0.1; if(zoom < -0.90) zoom = -0.90; updateMousePosition(); - resizeGL(width(),height()); + + //resizeGL(width(),height()); + windowRatio = float(width())/height(); + if (isValid()) { + GLCHK( glViewport(0, 0, width(), height()) ); + + if (activeImage && activeImage->fbo){ + fboRatio = float(activeImage->fbo->width())/activeImage->fbo->height(); + orthographicProjHeight = (1+zoom)/windowRatio; + orthographicProjWidth = (1+zoom)/fboRatio; + } else { + qWarning() << Q_FUNC_INFO; + if (!activeImage) qWarning() << " activeImage is null"; + else + if (!activeImage->fbo) qWarning() << " activeImage->fbo is null"; + } + } else + qDebug() << Q_FUNC_INFO << "invalid context."; + + QPoint p = mapFromGlobal(QCursor::pos());//getting the global position of cursor // restoring the translation after zooming diff --git a/glwidget.cpp b/glwidget.cpp index f3168ac..9f1f39d 100644 --- a/glwidget.cpp +++ b/glwidget.cpp @@ -42,7 +42,7 @@ #include #include #include "glwidget.h" - +QDir* GLWidget::recentMeshDir = NULL; GLWidget::GLWidget(QWidget *parent, QGLWidget * shareWidget) : QGLWidget(QGLFormat::defaultFormat(), parent, shareWidget) @@ -55,13 +55,17 @@ GLWidget::GLWidget(QWidget *parent, QGLWidget * shareWidget) bToggleDiffuseView = true; bToggleSpecularView = true; bToggleOcclusionView = true; - specularIntensity = 1.0; + bToggleHeightView = true; + bToggleNormalView = true; + shadingType = SHADING_RELIEF_MAPPING; + specularIntensity = 0.5; diffuseIntensity = 1.0; - RotatePlaneMatrix.rotate(180.0f,QVector3D(0.0,1.0,0.0)); + setMouseTracking(true); setCursor(Qt::PointingHandCursor); lightCursor = QCursor(QPixmap(":/content/lightCursor.png")); + } GLWidget::~GLWidget() @@ -73,9 +77,10 @@ void GLWidget::cleanup() { makeCurrent(); - glDeleteBuffers(sizeof(vbos)/sizeof(GLuint), &vbos[0]); + delete program; - + delete mesh; + doneCurrent(); } @@ -121,6 +126,21 @@ void GLWidget::toggleOcclusionView(bool enable){ updateGL(); } +void GLWidget::toggleNormalView(bool enable){ + bToggleNormalView = enable; + updateGL(); +} + +void GLWidget::toggleHeightView(bool enable){ + bToggleHeightView = enable; + updateGL(); +} + +void GLWidget::selectShadingType(int indeks){ + shadingType = (ShadingType)indeks; + updateGL(); +} + void GLWidget::setSpecularIntensity(double val){ specularIntensity = val; updateGL(); @@ -140,48 +160,72 @@ void GLWidget::initializeGL() glEnable(GL_DEPTH_TEST); glEnable(GL_MULTISAMPLE); glEnable(GL_DEPTH_TEST); - // glEnable(GL_TEXTURE_2D); // non-core - qDebug() << "Loading quad (fragment shader)"; + qDebug() << "Loading quad (vertex shader)"; QOpenGLShader *vshader = new QOpenGLShader(QOpenGLShader::Vertex, this); vshader->compileSourceFile(":/content/plane.vert"); if (!vshader->log().isEmpty()) qDebug() << vshader->log(); else qDebug() << "done"; - qDebug() << "Loading quad (vertex shader)"; + qDebug() << "Loading quad (fragment shader)"; QOpenGLShader *fshader = new QOpenGLShader(QOpenGLShader::Fragment, this); fshader->compileSourceFile(":/content/plane.frag"); if (!fshader->log().isEmpty()) qDebug() << fshader->log(); else qDebug() << "done"; + qDebug() << "Loading quad (tessellation control shader)"; + QOpenGLShader *tcshader = new QOpenGLShader(QOpenGLShader::TessellationControl, this); + tcshader->compileSourceFile(":/content/plane.tcs.vert"); + if (!tcshader->log().isEmpty()) qDebug() << tcshader->log(); + else qDebug() << "done"; + + qDebug() << "Loading quad (tessellation evaluation shader)"; + QOpenGLShader *teshader = new QOpenGLShader(QOpenGLShader::TessellationEvaluation, this); + teshader->compileSourceFile(":/content/plane.tes.vert"); + if (!teshader->log().isEmpty()) qDebug() << teshader->log(); + else qDebug() << "done"; + + qDebug() << "Loading quad (geometry shader)"; + QOpenGLShader *gshader = new QOpenGLShader(QOpenGLShader::Geometry, this); + gshader->compileSourceFile(":/content/plane.geom"); + if (!gshader->log().isEmpty()) qDebug() << gshader->log(); + else qDebug() << "done"; program = new QOpenGLShaderProgram(this); program->addShader(vshader); program->addShader(fshader); - program->bindAttributeLocation("vertex" , PROGRAM_VERTEX_ATTRIBUTE); - program->bindAttributeLocation("texCoord", PROGRAM_TEXCOORD_ATTRIBUTE); - program->link(); + program->addShader(tcshader); + program->addShader(teshader); + program->addShader(gshader); + GLCHK(program->link()); - program->bind(); + GLCHK(program->bind()); program->setUniformValue("texDiffuse" , 0); program->setUniformValue("texNormal" , 1); program->setUniformValue("texSpecular", 2); program->setUniformValue("texHeight" , 3); program->setUniformValue("texSSAO" , 4); - makeObject(); + + delete vshader; + delete fshader; + delete tcshader; + delete teshader; + delete gshader; camera.position.setZ( -0 ); camera.toggleFreeCamera(false); + + mesh = new Mesh("models/","Cube.obj"); emit readyGL(); } void GLWidget::paintGL() { GLCHK( glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT) ); - GLCHK( glDisable(GL_CULL_FACE) ); + //GLCHK( glEnable(GL_CULL_FACE) ); GLCHK( glEnable(GL_DEPTH_TEST) ); - + GLCHK( program->bind() ); projectionMatrix.setToIdentity(); projectionMatrix.perspective(zoom,ratio,0.1,100.0); @@ -190,15 +234,20 @@ void GLWidget::paintGL() objectMatrix.setToIdentity(); if( fboIdPtrs[0] != NULL){ float fboRatio = float((*(fboIdPtrs[0]))->width())/(*(fboIdPtrs[0]))->height(); - objectMatrix.scale(fboRatio,1,1); + objectMatrix.scale(fboRatio,1,fboRatio); } + if(mesh->isLoaded()){ - modelViewMatrix = camera.updateCamera()*RotatePlaneMatrix*objectMatrix; + objectMatrix.scale(0.5/mesh->radius); + objectMatrix.translate(-mesh->centre_of_mass); + } + modelViewMatrix = camera.updateCamera()*objectMatrix; QMatrix3x3 NormalMatrix = modelViewMatrix.normalMatrix(); - + float mesh_scale = 0.5/mesh->radius; GLCHK( program->setUniformValue("ModelViewMatrix" , modelViewMatrix) ); GLCHK( program->setUniformValue("NormalMatrix" , NormalMatrix) ); - GLCHK( program->setUniformValue("lightPos" , lightPosition) ); + GLCHK( program->setUniformValue("meshScale" , mesh_scale) ); + GLCHK( program->setUniformValue("lightPos" , lightPosition) ); GLCHK( program->setUniformValue("cameraPos" , cursorPositionOnPlane) ); GLCHK( program->setUniformValue("gui_depthScale" , depthScale) ); GLCHK( program->setUniformValue("gui_uvScale" , uvScale) ); @@ -206,21 +255,18 @@ void GLWidget::paintGL() GLCHK( program->setUniformValue("gui_bSpecular" , bToggleSpecularView) ); GLCHK( program->setUniformValue("gui_bDiffuse" , bToggleDiffuseView) ); GLCHK( program->setUniformValue("gui_bOcclusion" , bToggleOcclusionView) ); + GLCHK( program->setUniformValue("gui_bHeight" , bToggleHeightView) ); + GLCHK( program->setUniformValue("gui_bNormal" , bToggleNormalView) ); + GLCHK( program->setUniformValue("gui_shading_type" , shadingType) ); GLCHK( program->setUniformValue("gui_SpecularIntensity" , specularIntensity) ); GLCHK( program->setUniformValue("gui_DiffuseIntensity" , diffuseIntensity) ); if( fboIdPtrs[0] != NULL){ - glBindBuffer(GL_ARRAY_BUFFER, vbos[0]); - glVertexAttribPointer(PROGRAM_VERTEX_ATTRIBUTE,3,GL_FLOAT,GL_FALSE,sizeof(float)*3,(void*)0); - glBindBuffer(GL_ARRAY_BUFFER, vbos[1]); - glVertexAttribPointer(PROGRAM_TEXCOORD_ATTRIBUTE,2,GL_FLOAT,GL_FALSE,sizeof(float)*2,(void*)0); - glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, vbos[2]); + GLCHK( glActiveTexture(GL_TEXTURE0) ); - // if(bToggleDiffuseView) - GLCHK( glBindTexture(GL_TEXTURE_2D, (*(fboIdPtrs[0]))->texture()) ); - // else - // GLCHK( glBindTexture(GL_TEXTURE_2D, (*(fboIdPtrs[1]))->texture()) ); + + GLCHK( glBindTexture(GL_TEXTURE_2D, (*(fboIdPtrs[0]))->texture()) ); GLCHK( glActiveTexture(GL_TEXTURE1) ); GLCHK( glBindTexture(GL_TEXTURE_2D, (*(fboIdPtrs[1]))->texture()) ); @@ -234,12 +280,13 @@ void GLWidget::paintGL() GLCHK( glActiveTexture(GL_TEXTURE4) ); GLCHK( glBindTexture(GL_TEXTURE_2D, (*(fboIdPtrs[4]))->texture()) ); - GLCHK( glDrawElements(GL_TRIANGLES, 3*no_triangles, GL_UNSIGNED_INT, 0) ); - // restore filtering + GLCHK( mesh->drawMesh() ); + + // set default active texture glActiveTexture(GL_TEXTURE0); } - + GLCHK( glDisable(GL_CULL_FACE) ); emit renderGL(); } @@ -301,38 +348,15 @@ void GLWidget::mouseMoveEvent(QMouseEvent *event) int dx = event->x() - lastPos.x(); int dy = event->y() - lastPos.y(); - /* - float zPos, xPos , yPos; - xPos = event->x(); - yPos = event->y(); - glReadPixels(event->x(),height()-event->y(),1,1,GL_DEPTH_COMPONENT,GL_FLOAT,&zPos); - QVector4D oPos; - if(glhUnProjectf(xPos,yPos,zPos,modelViewMatrix,projectionMatrix,oPos)){ - cursorPositionOnPlane = oPos; - } - */ + if ((event->buttons() & Qt::LeftButton) && (event->buttons() & Qt::RightButton)) { - /* - QMatrix4x4 mvp = modelViewMatrix; - QVector4D corner1(-0.5,-0.5,0,1); - QVector4D corner2(+0.5,-0.5,0,1); - QVector4D corner3(-0.5,+0.5,0,1); - corner1 = mvp * corner1; - corner2 = mvp * corner2; - corner3 = mvp * corner3; - QVector3D r21 =QVector3D(corner2-corner1); - QVector3D r31 =QVector3D(corner3-corner1); - QVector3D n = QVector3D::crossProduct(r21,r31); - - QPoint p = mapFromGlobal(QCursor::pos());//getting the global position of cursor - QVector3D l0(double(p.x())/width()-0.5,(1.0-double(p.y()))/height()+0.5,1); - QVector3D l(0.0,0,-1); - QVector3D ll = -l0*QVector3D::dotProduct(l0,n)/QVector3D::dotProduct(l,n); - */ + }else if (event->buttons() & Qt::LeftButton) { camera.rotateView(dx/1.0,dy/1.0); } else if (event->buttons() & Qt::RightButton) { - camera.position += QVector3D(dx/500.0,dy/500.0,0)*camera.radius; + camera.position +=QVector3D(dx/500.0,dy/500.0,0)*camera.radius; + //camera.position += camera.side_direction*0.001*dx;// + //camera.position += QVector3D(0,dy/500.0,0)*camera.radius; } else if (event->buttons() & Qt::MiddleButton) { lightPosition += QVector4D(0.05*dx,-0.05*dy,-0,0); } @@ -342,66 +366,13 @@ void GLWidget::mouseMoveEvent(QMouseEvent *event) //! [10] void GLWidget::wheelEvent(QWheelEvent *event){ - int numDegrees = event->delta(); + int numDegrees = -event->delta(); camera.mouseWheelMove((numDegrees)); + updateGL(); } -void GLWidget::makeObject() -{ - int size = 1024; - QVector vertices; - QVector texCoords; - texCoords = QVector(size*size); - vertices = QVector(size*size); - int iter = 0; - for (int i = 0; i < size; ++i) { - for (int j = 0; j < size; ++j) { - float offset = 0.5; - float x = i/(size-1.0); - float y = j/(size-1.0); - vertices[iter] = (QVector3D(x-offset,y-offset,0)); - texCoords[iter] = (QVector2D(x,y)); - iter++; - }} - - - - glGenBuffers(3, &vbos[0]); - glBindBuffer(GL_ARRAY_BUFFER, vbos[0]); - glBufferData(GL_ARRAY_BUFFER, vertices.size() * sizeof(float)*3, vertices.constData(), GL_STATIC_DRAW); - glEnableVertexAttribArray(PROGRAM_VERTEX_ATTRIBUTE); - glVertexAttribPointer(PROGRAM_VERTEX_ATTRIBUTE,3,GL_FLOAT,GL_FALSE,sizeof(float)*3,(void*)0); - - glBindBuffer(GL_ARRAY_BUFFER, vbos[1]); - glBufferData(GL_ARRAY_BUFFER, texCoords.size() * sizeof(float)*2, texCoords.constData(), GL_STATIC_DRAW); - glEnableVertexAttribArray(PROGRAM_TEXCOORD_ATTRIBUTE); - glVertexAttribPointer(PROGRAM_TEXCOORD_ATTRIBUTE,2,GL_FLOAT,GL_FALSE,sizeof(float)*2,(void*)0); - - - glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, vbos[2]); - - - no_triangles = 2*(size - 1)*(size - 1); - QVector indices(no_triangles*3); - iter = 0; - for(int i = 0 ; i < size -1 ; i++){ - for(int j = 0 ; j < size -1 ; j++){ - GLuint i1 = i + j*size; - GLuint i2 = i + (j+1)*size; - GLuint i3 = i+1 + j*size; - GLuint i4 = i+1 + (j+1)*size; - indices[iter++] = (i1); - indices[iter++] = (i3); - indices[iter++] = (i2); - indices[iter++] = (i2); - indices[iter++] = (i3); - indices[iter++] = (i4); - } - } - glBufferData(GL_ELEMENT_ARRAY_BUFFER, sizeof(GLuint) * no_triangles * 3 , indices.constData(), GL_STATIC_DRAW); -} void GLWidget::setPointerToTexture(QGLFramebufferObject **pointer, TextureTypes tType){ switch(tType){ @@ -428,3 +399,52 @@ QPointF GLWidget::pixelPosToViewPos(const QPointF& p) return QPointF(2.0 * float(p.x()) / width() - 1.0, 1.0 - 2.0 * float(p.y()) / height()); } + + +void GLWidget::loadMeshFromFile() +{ + QStringList picturesLocations; + if(recentMeshDir == NULL ) picturesLocations = QStandardPaths::standardLocations(QStandardPaths::PicturesLocation); + else picturesLocations << recentMeshDir->absolutePath(); + + + QFileDialog dialog(this, + tr("Open Mesh File"), + picturesLocations.isEmpty() ? QDir::currentPath() : picturesLocations.first(), + tr("OBJ file format (*.obj *.OBJ );;")); + dialog.setAcceptMode(QFileDialog::AcceptOpen); + + while (dialog.exec() == QDialog::Accepted && !loadMeshFile(dialog.selectedFiles().first())) {} +} + +bool GLWidget::loadMeshFile(const QString &fileName, bool bAddExtension) +{ + + // loading new mesh + Mesh* new_mesh; + if(bAddExtension){ + new_mesh = new Mesh(QString("models/"),fileName+QString(".obj")); + }else{ + new_mesh = new Mesh(QString(""),fileName); + } + + if(new_mesh->isLoaded()){ + if(mesh != NULL) delete mesh; + mesh = new_mesh; + recentMeshDir->setPath(fileName); + }else{ + QMessageBox msgBox; + msgBox.setText("Error!"); + msgBox.setInformativeText("Sorry, but the loaded mesh is incorrect. See the log file for more info."); + msgBox.setStandardButtons(QMessageBox::Cancel); + msgBox.exec(); + delete new_mesh; + } + + updateGL(); + return true; +} + +void GLWidget::chooseMeshFile(const QString &fileName){ + loadMeshFile(fileName,true); +} diff --git a/glwidget.h b/glwidget.h index 9901dd6..f38701d 100644 --- a/glwidget.h +++ b/glwidget.h @@ -47,7 +47,7 @@ #include "CommonObjects.h" #include "camera.h" - +#include "utils/Mesh.hpp" #include QT_FORWARD_DECLARE_CLASS(QOpenGLShaderProgram); @@ -72,12 +72,22 @@ public slots: void toggleDiffuseView(bool); void toggleSpecularView(bool); void toggleOcclusionView(bool); + void toggleNormalView(bool); + void toggleHeightView(bool); + void selectShadingType(int); void setSpecularIntensity(double); void setDiffuseIntensity(double); void setUVScaleOffset(double x,double y); void cleanup(); + + // mesh loading functions + void loadMeshFromFile();//opens file dialog + // mesh functions + bool loadMeshFile(const QString &fileName,bool bAddExtension = false); + void chooseMeshFile(const QString &fileName); + signals: void renderGL(); void readyGL(); @@ -93,11 +103,15 @@ public slots: void wheelEvent(QWheelEvent *event); private: + + + + // other functions QPointF pixelPosToViewPos(const QPointF& p); int glhUnProjectf(float &winx, float &winy, float &winz, QMatrix4x4 &modelview, QMatrix4x4 &projection, QVector4D& objectCoordinate); - void makeObject(); + QOpenGLShaderProgram *program; QGLFramebufferObject** fboIdPtrs[5]; @@ -111,10 +125,12 @@ public slots: bool bToggleDiffuseView; bool bToggleSpecularView; bool bToggleOcclusionView; + bool bToggleNormalView; + bool bToggleHeightView; + + ShadingType shadingType; // 3D view parameters - GLuint vbos[3]; - GLuint no_triangles; QMatrix4x4 projectionMatrix; QMatrix4x4 modelViewMatrix; QMatrix4x4 objectMatrix; @@ -122,11 +138,14 @@ public slots: QVector4D cursorPositionOnPlane; float ratio; float zoom; - QPoint lastPos; - QMatrix4x4 RotatePlaneMatrix ; + QPoint lastPos; AwesomeCamera camera; QCursor lightCursor; + + + Mesh* mesh; public: + static QDir* recentMeshDir; }; //! [3] diff --git a/mainwindow.cpp b/mainwindow.cpp index 0cb54bd..4482a87 100644 --- a/mainwindow.cpp +++ b/mainwindow.cpp @@ -9,9 +9,12 @@ MainWindow::MainWindow(QWidget *parent) : recentDir = NULL; + recentMeshDir = NULL; bSaveCheckedImages = false; bSaveCompressedFormImages = false; FormImageProp::recentDir = &recentDir; + GLWidget::recentMeshDir = &recentMeshDir; + QGLFormat glFormat(QGL::SampleBuffers); #ifdef Q_OS_MAC @@ -109,7 +112,17 @@ MainWindow::MainWindow(QWidget *parent) : // GUI setup // ------------------------------------------------------ ui->setupUi(this); - ui->widget_2->hide(); + ui->widget3DSettings->hide(); + + // Settings container + settingsContainer = new FormSettingsContainer; + ui->verticalLayout2DImage->addWidget(settingsContainer); + settingsContainer->hide(); + connect(settingsContainer,SIGNAL(reloadConfigFile()),this,SLOT(loadSettings())); + connect(settingsContainer,SIGNAL(forceSaveCurrentConfig()),this,SLOT(saveSettings())); + connect(ui->pushButtonProjectManager,SIGNAL(toggled(bool)),settingsContainer,SLOT(setVisible(bool))); + + ui->verticalLayout3DImage->addWidget(glWidget); ui->verticalLayout2DImage->addWidget(glImage); @@ -170,16 +183,23 @@ MainWindow::MainWindow(QWidget *parent) : connect(ui->pushButtonResizeApply ,SIGNAL(released()),this,SLOT(applyResizeImage())); connect(ui->pushButtonRescaleApply,SIGNAL(released()),this,SLOT(applyScaleImage())); - // Other signals + // Other signals - 3D settings connect(ui->pushButtonReplotAll ,SIGNAL(released()),this,SLOT(replotAllImages())); connect(ui->pushButtonToggleDiffuse ,SIGNAL(toggled(bool)),glWidget,SLOT(toggleDiffuseView(bool))); connect(ui->pushButtonToggleSpecular ,SIGNAL(toggled(bool)),glWidget,SLOT(toggleSpecularView(bool))); connect(ui->pushButtonToggleOcclusion ,SIGNAL(toggled(bool)),glWidget,SLOT(toggleOcclusionView(bool))); + connect(ui->pushButtonToggleNormal ,SIGNAL(toggled(bool)),glWidget,SLOT(toggleNormalView(bool))); + connect(ui->pushButtonToggleHeight ,SIGNAL(toggled(bool)),glWidget,SLOT(toggleHeightView(bool))); connect(ui->pushButtonSaveCurrentSettings ,SIGNAL(released()),this,SLOT(saveSettings())); connect(ui->horizontalSliderSpecularI ,SIGNAL(valueChanged(int)),this,SLOT(setSpecularIntensity(int))); connect(ui->horizontalSliderDiffuseI ,SIGNAL(valueChanged(int)),this,SLOT(setDiffuseIntensity(int))); connect(ui->comboBoxImageOutputFormat ,SIGNAL(activated(int)),this,SLOT(setOutputFormat(int))); + // loading 3d mesh signal + connect(ui->pushButtonLoadMesh ,SIGNAL(released()),glWidget,SLOT(loadMeshFromFile())); + connect(ui->comboBoxChooseOBJModel ,SIGNAL(activated(QString)),glWidget,SLOT(chooseMeshFile(QString))); + connect(ui->comboBoxShadingType ,SIGNAL(activated(int)),glWidget,SLOT(selectShadingType(int))); + // Other staff ui->progressBar->setValue(0); @@ -286,6 +306,7 @@ MainWindow::MainWindow(QWidget *parent) : MainWindow::~MainWindow() { + delete settingsContainer; delete ui; } void MainWindow::closeEvent(QCloseEvent *event) { @@ -293,14 +314,17 @@ void MainWindow::closeEvent(QCloseEvent *event) { qDebug() << "calling" << Q_FUNC_INFO; - QSettings settings(AB_INI, QSettings::IniFormat); + QSettings settings(QString(AB_INI), QSettings::IniFormat); settings.setValue("d_win_w",this->width()); settings.setValue("d_win_h",this->height()); settings.setValue("recent_dir",recentDir.absolutePath()); + settings.setValue("recent_mesh_dir",recentMeshDir.absolutePath()); + settingsContainer->close(); glWidget->close(); glImage->close(); + } void MainWindow::resizeEvent(QResizeEvent* event){ @@ -436,7 +460,8 @@ bool MainWindow::saveAllImages(const QString &dir){ ui->progressBar->setValue(100); }else{ - + QCoreApplication::processEvents(); + glImage->makeCurrent(); QGLFramebufferObject* diffuseFBOImage = diffuseImageProp->getImageProporties()->fbo; QGLFramebufferObject* normalFBOImage = normalImageProp->getImageProporties()->fbo; @@ -852,14 +877,14 @@ void MainWindow::setUVManipulationMethod(){ QSize MainWindow::sizeHint() const { - QSettings settings(AB_INI, QSettings::IniFormat); + QSettings settings(QString(AB_INI), QSettings::IniFormat); return QSize(settings.value("d_win_w",800).toInt(),settings.value("d_win_h",600).toInt()); } void MainWindow::saveImageSettings(QString abbr,FormImageProp* image){ - QSettings settings("AB_INI", QSettings::IniFormat); + QSettings settings(QString(AB_INI), QSettings::IniFormat); settings.setValue("t_"+abbr+"_bGrayScale" ,image->getImageProporties()->bGrayScale); settings.setValue("t_"+abbr+"_grayScaleR" ,image->getImageProporties()->grayScalePreset.R); @@ -917,7 +942,7 @@ void MainWindow::saveImageSettings(QString abbr,FormImageProp* image){ void MainWindow::loadImageSettings(QString abbr,FormImageProp* image){ - QSettings settings("config.ini", QSettings::IniFormat); + QSettings settings(QString(AB_INI), QSettings::IniFormat); image->getImageProporties()->bGrayScale = settings.value("t_"+abbr+"_bGrayScale",false).toBool(); image->getImageProporties()->grayScalePreset.R = settings.value("t_"+abbr+"_grayScaleR",0.333).toFloat(); image->getImageProporties()->grayScalePreset.G = settings.value("t_"+abbr+"_grayScaleG",0.333).toFloat(); @@ -951,8 +976,8 @@ void MainWindow::loadImageSettings(QString abbr,FormImageProp* image){ image->getImageProporties()->conversionHNDepth = settings.value("t_"+abbr+"_conversionHNDepth",10.0).toFloat(); - image->getImageProporties()->bConversionHN = settings.value("t_"+abbr+"_bConversionHN",false).toBool(); - image->getImageProporties()->bConversionNH = settings.value("t_"+abbr+"_bConversionNH",false).toBool(); + //image->getImageProporties()->bConversionHN = settings.value("t_"+abbr+"_bConversionHN",false).toBool(); + //image->getImageProporties()->bConversionNH = settings.value("t_"+abbr+"_bConversionNH",false).toBool(); image->getImageProporties()->conversionNHItersHuge = settings.value("t_"+abbr+"_conversionNHItersHuge",10).toInt(); image->getImageProporties()->conversionNHItersVeryLarge = settings.value("t_"+abbr+"_conversionNHItersVeryLarge",10).toInt(); @@ -961,7 +986,7 @@ void MainWindow::loadImageSettings(QString abbr,FormImageProp* image){ image->getImageProporties()->conversionNHItersSmall = settings.value("t_"+abbr+"_conversionNHItersSmall",10).toInt(); image->getImageProporties()->conversionNHItersVerySmall = settings.value("t_"+abbr+"_conversionNHItersVerySmall",10).toInt(); - image->getImageProporties()->bConversionBaseMap = settings.value("t_"+abbr+"_bConversionBaseMap",false).toBool(); + //image->getImageProporties()->bConversionBaseMap = settings.value("t_"+abbr+"_bConversionBaseMap",false).toBool(); image->getImageProporties()->conversionBaseMapAmplitude = settings.value("t_"+abbr+"_conversionBaseMapAmplitude",-1.0).toFloat(); image->getImageProporties()->conversionBaseMapFlatness = settings.value("t_"+abbr+"_conversionBaseMapFlatness",0.0).toFloat(); image->getImageProporties()->conversionBaseMapNoIters = settings.value("t_"+abbr+"_conversionBaseMapNoIters",2).toInt(); @@ -1000,11 +1025,18 @@ void MainWindow::loadImageSettings(TextureTypes type){ glWidget->repaint(); } +void MainWindow::showSettingsManager(){ + settingsContainer->show(); +} + void MainWindow::saveSettings(){ - qDebug() << "calling" << Q_FUNC_INFO; + qDebug() << "Calling" << Q_FUNC_INFO << "Saving to :"<< QString(AB_INI); - QSettings settings(AB_INI, QSettings::IniFormat); - + QSettings settings(QString(AB_INI), QSettings::IniFormat); + settings.setValue("d_win_w",this->width()); + settings.setValue("d_win_h",this->height()); + settings.setValue("recent_dir",recentDir.absolutePath()); + settings.setValue("recent_mesh_dir",recentMeshDir.absolutePath()); PostfixNames::diffuseName = ui->lineEditPostfixDiffuse->text(); PostfixNames::normalName = ui->lineEditPostfixNormal->text(); @@ -1021,9 +1053,21 @@ void MainWindow::saveSettings(){ settings.setValue("o_postfix",ui->lineEditPostfixOcclusion->text()); settings.setValue("recent_dir",recentDir.absolutePath()); + settings.setValue("recent_mesh_dir",recentMeshDir.absolutePath()); settings.setValue("gui_style",ui->comboBoxGUIStyle->currentText()); + // UV Settings + settings.setValue("uv_tiling_type",ui->comboBoxSeamlessMode->currentIndex()); + settings.setValue("uv_tiling_radius",ui->horizontalSliderMakeSeamlessRadius->value()); + settings.setValue("uv_tiling_mirror_x",ui->radioButtonMirrorModeX->isChecked()); + settings.setValue("uv_tiling_mirror_y",ui->radioButtonMirrorModeY->isChecked()); + settings.setValue("uv_tiling_mirror_xy",ui->radioButtonMirrorModeXY->isChecked()); + settings.setValue("uv_tiling_random_inner_radius",ui->horizontalSliderRandomPatchesInnerRadius->value()); + settings.setValue("uv_tiling_random_outer_radius",ui->horizontalSliderRandomPatchesOuterRadius->value()); + settings.setValue("uv_tiling_random_rotate",ui->horizontalSliderRandomPatchesRotate->value()); + settings.setValue("h_attachNormal",FBOImageProporties::bAttachNormalToHeightMap); + settings.setValue("use_texture_interpolation",ui->checkBoxUseLinearTextureInterpolation->isChecked()); saveImageSettings("d",diffuseImageProp); saveImageSettings("n",normalImageProp); @@ -1038,12 +1082,14 @@ void MainWindow::setOutputFormat(int index){ } void MainWindow::loadSettings(){ - qDebug() << "calling" << Q_FUNC_INFO; - - QSettings settings(AB_INI, QSettings::IniFormat); + static bool bFirstTime = true; + qDebug() << "Calling" << Q_FUNC_INFO << " loading from " << QString(AB_INI); + QSettings settings(QString(AB_INI), QSettings::IniFormat); - this->resize(settings.value("d_win_w",800).toInt(),settings.value("d_win_h",600).toInt()); + if(bFirstTime){ + this->resize(settings.value("d_win_w",800).toInt(),settings.value("d_win_h",600).toInt()); + } PostfixNames::diffuseName = settings.value("d_postfix","_d").toString(); PostfixNames::normalName = settings.value("n_postfix","_n").toString(); @@ -1061,17 +1107,37 @@ void MainWindow::loadSettings(){ FBOImageProporties::bAttachNormalToHeightMap = settings.value("h_attachNormal",true).toBool(); heightImageProp->toggleAttachToNormal(FBOImageProporties::bAttachNormalToHeightMap); - recentDir = settings.value("recent_dir","").toString(); + recentDir = settings.value("recent_dir","").toString(); + recentMeshDir = settings.value("recent_mesh_dir","").toString(); + ui->checkBoxUseLinearTextureInterpolation->setChecked(settings.value("use_texture_interpolation",true).toBool()); + FBOImages::bUseLinearInterpolation = ui->checkBoxUseLinearTextureInterpolation->isChecked(); ui->comboBoxGUIStyle->setCurrentText(settings.value("gui_style","default").toString()); + // UV Settings + ui->comboBoxSeamlessMode->setCurrentIndex(settings.value("uv_tiling_type",0).toInt()); + selectSeamlessMode(ui->comboBoxSeamlessMode->currentIndex()); + ui->horizontalSliderMakeSeamlessRadius->setValue(settings.value("uv_tiling_radius",50).toInt()); + ui->radioButtonMirrorModeX->setChecked(settings.value("uv_tiling_mirror_x",false).toBool()); + ui->radioButtonMirrorModeY->setChecked(settings.value("uv_tiling_mirror_y",false).toBool()); + ui->radioButtonMirrorModeXY->setChecked(settings.value("uv_tiling_mirror_xy",true).toBool()); + ui->horizontalSliderRandomPatchesInnerRadius->setValue(settings.value("uv_tiling_random_inner_radius",50).toInt()); + ui->horizontalSliderRandomPatchesOuterRadius->setValue(settings.value("uv_tiling_random_outer_radius",50).toInt()); + ui->horizontalSliderRandomPatchesRotate->setValue(settings.value("uv_tiling_random_rotate",50).toInt()); + + + loadImageSettings("d",diffuseImageProp); loadImageSettings("n",normalImageProp); loadImageSettings("s",specularImageProp); loadImageSettings("h",heightImageProp); loadImageSettings("o",occlusionImageProp); + replotAllImages(); + glImage ->repaint(); + glWidget->repaint(); + bFirstTime = false; } void MainWindow::about() diff --git a/mainwindow.h b/mainwindow.h index 11baa8c..6225e12 100644 --- a/mainwindow.h +++ b/mainwindow.h @@ -10,6 +10,7 @@ #include "glwidget.h" #include "glimageeditor.h" #include "formimageprop.h" +#include "formsettingscontainer.h" #include "CommonObjects.h" #define TAB_SETTINGS 5 @@ -20,9 +21,9 @@ # define AB_LOG "AwesomeBump.log" // log created in current directory # define AB_LOG_ALT (QString("%1/%2").arg(QStandardPaths::writableLocation(QStandardPaths::HomeLocation)).arg(AB_LOG)) #else -# define AB_INI "config.ini" -# define AB_LOG "log.txt" -# define AB_LOG_ALT "log.txt" + #define AB_INI "config.ini" + #define AB_LOG "log.txt" + #define AB_LOG_ALT "log.txt" #endif namespace Ui { @@ -61,6 +62,7 @@ public slots: void loadImageSettings(QString abbr,FormImageProp* image); // the same as above but Image is choosen by proper switch using the given type void loadImageSettings(TextureTypes type); + void showSettingsManager(); void setOutputFormat(int index); void replotAllImages(); @@ -114,6 +116,8 @@ public slots: void randomizeAngles();// in random mode void resetRandomPatches(); + + private: // saves current settings of given image to config file. The param: abbr is e.g for diffuse image: "d" void saveImageSettings(QString abbr,FormImageProp* image); @@ -129,6 +133,7 @@ public slots: bool bSaveCompressedFormImages; QDir recentDir; + QDir recentMeshDir; // path to last loaded OBJ Mesh folder FormImageProp* diffuseImageProp; FormImageProp* normalImageProp; @@ -136,6 +141,9 @@ public slots: FormImageProp* heightImageProp; FormImageProp* occlusionImageProp; + // Settings container + FormSettingsContainer *settingsContainer; + QAction *aboutQtAction; QAction *aboutAction; diff --git a/mainwindow.ui b/mainwindow.ui index 931d7dd..17099f5 100644 --- a/mainwindow.ui +++ b/mainwindow.ui @@ -6,8 +6,8 @@ 0 0 - 920 - 808 + 998 + 745 @@ -81,8 +81,8 @@ 0 0 - 358 - 685 + 100 + 30 @@ -134,8 +134,8 @@ 0 0 - 358 - 685 + 100 + 30 @@ -187,8 +187,8 @@ 0 0 - 358 - 685 + 100 + 30 @@ -240,8 +240,8 @@ 0 0 - 358 - 685 + 100 + 30 @@ -293,8 +293,8 @@ 0 0 - 358 - 685 + 100 + 30 @@ -347,7 +347,7 @@ 28 0 300 - 637 + 574 @@ -617,6 +617,19 @@ + + + + <html><head/><body><p>If checked the <span style=" font-weight:600;">GL_LINEAR</span> texture parameter is enabled thus all processing is done with texture filtering enabled which will lead to bluring of the orginal image. Otherwise <span style=" font-weight:600;">GL_NEAREST</span> filtering is applied. </p></body></html> + + + Use texture linear interpolation (save and restart) + + + true + + + @@ -1156,8 +1169,8 @@ 0 0 - 356 - 683 + 253 + 369 @@ -1501,7 +1514,7 @@ - + 0 @@ -1523,7 +1536,7 @@ - + 0 @@ -1539,13 +1552,13 @@ 11000 - 200 + 230 - + Toggle occlusion @@ -1574,7 +1587,59 @@ - + + + + Replot all + + + Replot all images + + + + :/content/replot.png:/content/replot.png + + + + 32 + 26 + + + + true + + + + + + + Toggle height + + + + + + + :/content/height.png:/content/height.png + + + + 32 + 26 + + + + true + + + true + + + true + + + + Toggle diffuse @@ -1603,17 +1668,17 @@ - - - - Replot all - + + - Replot all images + Toggle normal + + + - :/content/replot.png:/content/replot.png + :/content/normal.png:/content/normal.png @@ -1621,12 +1686,18 @@ 26 + + true + + + true + true - + Toggle specular @@ -1891,7 +1962,7 @@ 100 - 50 + 25 Qt::Horizontal @@ -1906,6 +1977,9 @@ QAbstractSpinBox::NoButtons + + 0.500000000000000 + @@ -1967,13 +2041,93 @@ + + + + + + + Refief Mapping + + + + + Parallax Normal Mapping + + + + + Tessellation + + + + + + + + + SmoothedCube + + + + + Cube + + + + + Capsule + + + + + Cylinder + + + + + Hexagon + + + + + Plane + + + + + Sphere + + + + + + + + Load OBJ mesh + + + + + - + + + + + Project manager + + + true + + + + @@ -1982,7 +2136,7 @@ 0 0 - 920 + 998 21 @@ -2239,14 +2393,14 @@ - pushButton + pushButton3DSettings toggled(bool) - widget_2 + widget3DSettings setVisible(bool) - 631 - 254 + 720 + 223 640 diff --git a/models/Capsule.mtl b/models/Capsule.mtl new file mode 100644 index 0000000..a3fbcc3 --- /dev/null +++ b/models/Capsule.mtl @@ -0,0 +1,11 @@ +# Blender MTL File: 'None' +# Material Count: 1 + +newmtl None +Ns 96.078431 +Ka 0.000000 0.000000 0.000000 +Kd 0.640000 0.640000 0.640000 +Ks 0.500000 0.500000 0.500000 +Ni 1.000000 +d 1.000000 +illum 2 diff --git a/models/Cube.mtl b/models/Cube.mtl new file mode 100644 index 0000000..70d3ba1 --- /dev/null +++ b/models/Cube.mtl @@ -0,0 +1,10 @@ +# Blender MTL File: 'None' +# Material Count: 1 + +newmtl None +Ns 0 +Ka 0.000000 0.000000 0.000000 +Kd 0.8 0.8 0.8 +Ks 0.8 0.8 0.8 +d 1 +illum 2 diff --git a/models/Cylinder.mtl b/models/Cylinder.mtl new file mode 100644 index 0000000..68dfb84 --- /dev/null +++ b/models/Cylinder.mtl @@ -0,0 +1,11 @@ +# Blender MTL File: 'None' +# Material Count: 1 + +newmtl None.007 +Ns 0.000000 +Ka 0.000000 0.000000 0.000000 +Kd 0.409600 0.409600 0.409600 +Ks 0.800000 0.800000 0.800000 +Ni 1.000000 +d 1.000000 +illum 2 diff --git a/models/Hexagon.mtl b/models/Hexagon.mtl new file mode 100644 index 0000000..3be8216 --- /dev/null +++ b/models/Hexagon.mtl @@ -0,0 +1,11 @@ +# Blender MTL File: 'None' +# Material Count: 1 + +newmtl None.005 +Ns 90.196078 +Ka 0.000000 0.000000 0.000000 +Kd 0.409600 0.409600 0.409600 +Ks 0.500000 0.500000 0.500000 +Ni 1.000000 +d 1.000000 +illum 2 diff --git a/models/Plane.mtl b/models/Plane.mtl new file mode 100644 index 0000000..c25bd05 --- /dev/null +++ b/models/Plane.mtl @@ -0,0 +1,11 @@ +# Blender MTL File: 'None' +# Material Count: 1 + +newmtl None.003 +Ns 92.156863 +Ka 0.000000 0.000000 0.000000 +Kd 0.512000 0.512000 0.512000 +Ks 0.500000 0.500000 0.500000 +Ni 1.000000 +d 1.000000 +illum 2 diff --git a/models/SmoothedCube.mtl b/models/SmoothedCube.mtl new file mode 100644 index 0000000..70d3ba1 --- /dev/null +++ b/models/SmoothedCube.mtl @@ -0,0 +1,10 @@ +# Blender MTL File: 'None' +# Material Count: 1 + +newmtl None +Ns 0 +Ka 0.000000 0.000000 0.000000 +Kd 0.8 0.8 0.8 +Ks 0.8 0.8 0.8 +d 1 +illum 2 diff --git a/models/Sphere.mtl b/models/Sphere.mtl new file mode 100644 index 0000000..68e908c --- /dev/null +++ b/models/Sphere.mtl @@ -0,0 +1,11 @@ +# Blender MTL File: 'None' +# Material Count: 1 + +newmtl None.005 +Ns 92.156863 +Ka 0.000000 0.000000 0.000000 +Kd 0.512000 0.512000 0.512000 +Ks 0.500000 0.500000 0.500000 +Ni 1.000000 +d 1.000000 +illum 2 diff --git a/utils/Mesh.cpp b/utils/Mesh.cpp new file mode 100644 index 0000000..b26f397 --- /dev/null +++ b/utils/Mesh.cpp @@ -0,0 +1,254 @@ +/* + * File: Mesh.cpp + * Author: mkk 2015 + */ + +#include "Mesh.hpp" + + +Mesh::Mesh(QString dir, QString name):mesh_path(name){ + + qDebug() << Q_FUNC_INFO << "Loading new mesh:" << dir + mesh_path ; + + + bLoaded = false; + using namespace tinyobj; + std::string inputfile = (dir + mesh_path).toStdString(); + std::vector shapes; + std::vector materials; + + std::string err = tinyobj::LoadObj(shapes, materials, inputfile.c_str()); + + if (!err.empty()) { + qDebug() << Q_FUNC_INFO << "Loading mesh file failed:" << dir + mesh_path ; + return; + } + if(shapes.size() == 0){ + qDebug() << "Woops:: This model has no shapes, so it cannot be loaded." ; + return; + } + centre_of_mass = QVector3D(0,0,0); + + for (size_t i = 0; i < shapes.size(); i++) { + + if(shapes[i].mesh.texcoords.size() == 0){ + qDebug() << "Warning. Shape i=" << i << " with name: " << QString(shapes[i].name.c_str()) << " has no texcoords." ; + continue; + } + if(shapes[i].mesh.normals.size() == 0){ + qDebug() << "Warning. Shape i=" << i << " with name: " << QString(shapes[i].name.c_str()) << " has no normals." ; + continue; + } + if(shapes[i].mesh.positions.size() == 0){ + qDebug() << "Warning. Shape i=" << i << " with name: " << QString(shapes[i].name.c_str()) << " has no positions." ; + continue; + } + + for (size_t f = 0; f < shapes[i].mesh.indices.size() / 3; f++) { + + for(size_t d = 0 ; d < 3 ; d++){ + unsigned int index = shapes[i].mesh.indices[3*f+d]; + + QVector3D pos = QVector3D( shapes[i].mesh.positions[3*index+0], + shapes[i].mesh.positions[3*index+1], + shapes[i].mesh.positions[3*index+2]); + gl_vertices .push_back(pos); + centre_of_mass += pos; + QVector3D uv(shapes[i].mesh.texcoords[2*index+0], + shapes[i].mesh.texcoords[2*index+1],0); + gl_texcoords.push_back(QVector3D(shapes[i].mesh.texcoords[2*index+0], + shapes[i].mesh.texcoords[2*index+1],0)); + + + QVector3D normal = QVector3D(shapes[i].mesh.normals [3*index+0], + shapes[i].mesh.normals [3*index+1], + shapes[i].mesh.normals [3*index+2]); + + + normal.normalize(); + //qDebug() << f << ": index:" << index << " uv=" << uv << " pos=" << pos << " normal=" << normal ; + gl_normals .push_back(normal); + } + } + } + + if(gl_vertices.size() == 0 || gl_normals.size() == 0 || gl_texcoords.size() == 0){ + qDebug() << "Error. Mesh has no vertices or normals or UVs, so it cannot be loaded." ; + return; + } + + + centre_of_mass /= gl_vertices.size(); + radius = 0; + for(unsigned int i = 0 ; i < gl_vertices.size() ; i++ ){ + float dist = QVector3D(centre_of_mass - gl_vertices[i]).length(); + if(dist > radius) radius = dist; + } + qDebug() << "mesh radius=" << radius; + qDebug() << "mesh center=" << centre_of_mass; + calculateTangents(); + + bLoaded = true; + initializeMesh(); +} + +void Mesh::drawMesh(){ + if(bLoaded == false) return; + + glBindBuffer(GL_ARRAY_BUFFER, mesh_vbos[0]); + glVertexAttribPointer(0,3,GL_FLOAT,GL_FALSE,sizeof(QVector3D),(void*)0); + + glBindBuffer(GL_ARRAY_BUFFER, mesh_vbos[1]); + glVertexAttribPointer(1,3,GL_FLOAT,GL_FALSE,sizeof(QVector3D),(void*)0); + + glBindBuffer(GL_ARRAY_BUFFER, mesh_vbos[2]); + glVertexAttribPointer(2,3,GL_FLOAT,GL_FALSE,sizeof(QVector3D),(void*)0); + + glBindBuffer(GL_ARRAY_BUFFER, mesh_vbos[3]); + glVertexAttribPointer(3,3,GL_FLOAT,GL_FALSE,sizeof(QVector3D),(void*)0); + + glBindBuffer(GL_ARRAY_BUFFER, mesh_vbos[4]); + glVertexAttribPointer(4,3,GL_FLOAT,GL_FALSE,sizeof(QVector3D),(void*)0); + + + // GLCHK(glDrawArrays(GL_TRIANGLES, 0, gl_vertices.size())); + glPatchParameteri(GL_PATCH_VERTICES, 3); // tell OpenGL that every patch has 16 verts + GLCHK(glDrawArrays(GL_PATCHES, 0, gl_vertices.size())); // draw a bunch of patches + + +} + +void Mesh::initializeMesh(){ + //static bool bOneTime = true; + //if(!bOneTime) return; + //bOneTime = false; + + + if(bLoaded == false){ + cerr << Q_FUNC_INFO << " Cannot initialize mesh because is NULL."; + cerr.flush(); + return; + } + initializeOpenGLFunctions(); + glGenBuffers(5, &mesh_vbos[0]); + + + glBindBuffer(GL_ARRAY_BUFFER, mesh_vbos[0]); + glBufferData(GL_ARRAY_BUFFER, gl_vertices.size() * sizeof(QVector3D), gl_vertices.constData(), GL_STATIC_DRAW); + glEnableVertexAttribArray(0); + glVertexAttribPointer(0,3,GL_FLOAT,GL_FALSE,sizeof(QVector3D),(void*)0); + + + glBindBuffer(GL_ARRAY_BUFFER, mesh_vbos[1]); + glBufferData(GL_ARRAY_BUFFER, gl_texcoords.size() * sizeof(QVector3D), gl_texcoords.constData(), GL_STATIC_DRAW); + glEnableVertexAttribArray(1); + glVertexAttribPointer(1,3,GL_FLOAT,GL_FALSE,sizeof(QVector3D),(void*)0); + + glBindBuffer(GL_ARRAY_BUFFER, mesh_vbos[2]); + glBufferData(GL_ARRAY_BUFFER, gl_normals.size() * sizeof(QVector3D), gl_normals.constData(), GL_STATIC_DRAW); + glEnableVertexAttribArray(2); + glVertexAttribPointer(2,3,GL_FLOAT,GL_FALSE,sizeof(QVector3D),(void*)0); + + glBindBuffer(GL_ARRAY_BUFFER, mesh_vbos[3]); + glBufferData(GL_ARRAY_BUFFER, gl_tangents.size() * sizeof(QVector3D), gl_tangents.constData(), GL_STATIC_DRAW); + glEnableVertexAttribArray(3); + glVertexAttribPointer(3,3,GL_FLOAT,GL_FALSE,sizeof(QVector3D),(void*)0); + + glBindBuffer(GL_ARRAY_BUFFER, mesh_vbos[4]); + glBufferData(GL_ARRAY_BUFFER, gl_bitangents.size() * sizeof(QVector3D), gl_bitangents.constData(), GL_STATIC_DRAW); + glEnableVertexAttribArray(4); + glVertexAttribPointer(4,3,GL_FLOAT,GL_FALSE,sizeof(QVector3D),(void*)0); + +} + + +// Calculation based on article: +// Lengyel, Eric. “Computing Tangent Space Basis Vectors for an Arbitrary Mesh”. +// Terathon Software 3D Graphics Library, 2001. http://www.terathon.com/code/tangent.html +void Mesh::calculateTangents() +{ + int vertexCount = gl_vertices.size(); + + QVector3D *tan1 = new QVector3D[vertexCount * 2]; + QVector3D *tan2 = tan1 + vertexCount; + + for(int i = 0; i < 2*vertexCount ; i++){ + tan1[i] = QVector3D(0.0f,0.0f,0.0f); + } + //ZeroMemory(tan1, vertexCount * sizeof(Vector3D) * 2); + + for (unsigned int a = 0; a < vertexCount/3; a++) + { + long i1 = 3*a+0; + long i2 = 3*a+1; + long i3 = 3*a+2; + + const QVector3D& v1 = gl_vertices[i1]; + const QVector3D& v2 = gl_vertices[i2]; + const QVector3D& v3 = gl_vertices[i3]; + + + const QVector3D& w1 = gl_texcoords[i1]; + const QVector3D& w2 = gl_texcoords[i2]; + const QVector3D& w3 = gl_texcoords[i3]; + + + float x1 = v2.x() - v1.x(); + float x2 = v3.x() - v1.x(); + float y1 = v2.y() - v1.y(); + float y2 = v3.y() - v1.y(); + float z1 = v2.z() - v1.z(); + float z2 = v3.z() - v1.z(); + + float s1 = w2.x() - w1.x(); + float s2 = w3.x() - w1.x(); + float t1 = w2.y() - w1.y(); + float t2 = w3.y() - w1.y(); + + float r = 1.0F / (s1 * t2 - s2 * t1); + QVector3D sdir((t2 * x1 - t1 * x2) * r, (t2 * y1 - t1 * y2) * r, + (t2 * z1 - t1 * z2) * r); + QVector3D tdir((s1 * x2 - s2 * x1) * r, (s1 * y2 - s2 * y1) * r, + (s1 * z2 - s2 * z1) * r); + + tan1[i1] += sdir; + tan1[i2] += sdir; + tan1[i3] += sdir; + + tan2[i1] += tdir; + tan2[i2] += tdir; + tan2[i3] += tdir; + + + } + + for (unsigned int a = 0; a < vertexCount; a++) + { + QVector3D& n = gl_normals[a]; + QVector3D& t = tan1[a]; + t.normalize(); + // Gram-Schmidt orthogonalize + QVector3D tangent = t - n * QVector3D::dotProduct(n,t); + tangent.normalize(); + // Calculate handedness + float handedness =(QVector3D::dotProduct(QVector3D::crossProduct(n, t), tan2[a]) < 0.0F) ? -1.0F : 1.0F; + gl_tangents.push_back(tangent); + QVector3D bitangent = QVector3D::crossProduct(n, t) * handedness; + bitangent.normalize(); + gl_bitangents.push_back(bitangent); + + } + + delete[] tan1; +} + + +Mesh::~Mesh() { + qDebug() << Q_FUNC_INFO << " destroying mesh:" << mesh_path; + gl_vertices .clear(); + gl_normals .clear(); + gl_texcoords .clear(); + gl_tangents .clear(); + gl_bitangents.clear(); + if(bLoaded) GLCHK(glDeleteBuffers(5 , mesh_vbos )); +} diff --git a/utils/Mesh.hpp b/utils/Mesh.hpp new file mode 100644 index 0000000..1a4c133 --- /dev/null +++ b/utils/Mesh.hpp @@ -0,0 +1,73 @@ +/* + * File: Mesh.hpp + * Author: mkk + * Klasa ta stanowi konetener dla klasy Actor. Sluzy do wczytywania obiektow prosto z plikow (np. obj, 3ds itp - obslugiwane przez assimp) + */ + +#ifndef Mesh_H +#define Mesh_H + + +#include +#include + +#include +#include +#include +#include +#include +#include "qopenglerrorcheck.h" +#include "utils/tinyobj/tiny_obj_loader.h" +using namespace std; + +class Mesh : public QOpenGLFunctions_4_0_Core { +public: + + /** + * @brief Loads the OBJ mesh from folder "dir" and name "name": eq. Mesh("models/","cube.obj") + * @param dir - mesh location + * @param name - mesh name + */ + Mesh(QString dir, QString name); + + /** + * @brief Draw the mesh if bLoaded is true otherwise does nothing + */ + void drawMesh(); + /** + * @brief isLoaded returns true if mesh was succsesfully loaded from file, + * otherwise returns false. + */ + inline bool isLoaded(){return bLoaded;} + // Cleanings + virtual ~Mesh(); + + void initializeMesh(); + + // utils + QVector3D centre_of_mass; // it helps to aling mesh to the center of the screen + float radius; // contains maxiumum distance from centre of mass to some vertex +private: + + void calculateTangents(); + + + QString mesh_path; + bool bLoaded; + + + // arrays + QVector gl_vertices; + QVector gl_normals; + QVector gl_texcoords; + QVector gl_tangents; + QVector gl_bitangents; + + unsigned int mesh_vbos[5]; // VBO indices + +}; + + + +#endif /* Mesh_H */ + diff --git a/utils/tinyobj/test.cc b/utils/tinyobj/test.cc new file mode 100644 index 0000000..1ad6d8c --- /dev/null +++ b/utils/tinyobj/test.cc @@ -0,0 +1,198 @@ +#include "tiny_obj_loader.h" + +#include +#include +#include +#include +#include +#include + +static void PrintInfo(const std::vector& shapes, const std::vector& materials) +{ + std::cout << "# of shapes : " << shapes.size() << std::endl; + std::cout << "# of materials : " << materials.size() << std::endl; + + for (size_t i = 0; i < shapes.size(); i++) { + printf("shape[%ld].name = %s\n", i, shapes[i].name.c_str()); + printf("Size of shape[%ld].indices: %ld\n", i, shapes[i].mesh.indices.size()); + printf("Size of shape[%ld].material_ids: %ld\n", i, shapes[i].mesh.material_ids.size()); + assert((shapes[i].mesh.indices.size() % 3) == 0); + for (size_t f = 0; f < shapes[i].mesh.indices.size() / 3; f++) { + printf(" idx[%ld] = %d, %d, %d. mat_id = %d\n", f, shapes[i].mesh.indices[3*f+0], shapes[i].mesh.indices[3*f+1], shapes[i].mesh.indices[3*f+2], shapes[i].mesh.material_ids[f]); + } + + printf("shape[%ld].vertices: %ld\n", i, shapes[i].mesh.positions.size()); + assert((shapes[i].mesh.positions.size() % 3) == 0); + for (size_t v = 0; v < shapes[i].mesh.positions.size() / 3; v++) { + printf(" v[%ld] = (%f, %f, %f)\n", v, + shapes[i].mesh.positions[3*v+0], + shapes[i].mesh.positions[3*v+1], + shapes[i].mesh.positions[3*v+2]); + } + } + + for (size_t i = 0; i < materials.size(); i++) { + printf("material[%ld].name = %s\n", i, materials[i].name.c_str()); + printf(" material.Ka = (%f, %f ,%f)\n", materials[i].ambient[0], materials[i].ambient[1], materials[i].ambient[2]); + printf(" material.Kd = (%f, %f ,%f)\n", materials[i].diffuse[0], materials[i].diffuse[1], materials[i].diffuse[2]); + printf(" material.Ks = (%f, %f ,%f)\n", materials[i].specular[0], materials[i].specular[1], materials[i].specular[2]); + printf(" material.Tr = (%f, %f ,%f)\n", materials[i].transmittance[0], materials[i].transmittance[1], materials[i].transmittance[2]); + printf(" material.Ke = (%f, %f ,%f)\n", materials[i].emission[0], materials[i].emission[1], materials[i].emission[2]); + printf(" material.Ns = %f\n", materials[i].shininess); + printf(" material.Ni = %f\n", materials[i].ior); + printf(" material.dissolve = %f\n", materials[i].dissolve); + printf(" material.illum = %d\n", materials[i].illum); + printf(" material.map_Ka = %s\n", materials[i].ambient_texname.c_str()); + printf(" material.map_Kd = %s\n", materials[i].diffuse_texname.c_str()); + printf(" material.map_Ks = %s\n", materials[i].specular_texname.c_str()); + printf(" material.map_Ns = %s\n", materials[i].normal_texname.c_str()); + std::map::const_iterator it(materials[i].unknown_parameter.begin()); + std::map::const_iterator itEnd(materials[i].unknown_parameter.end()); + for (; it != itEnd; it++) { + printf(" material.%s = %s\n", it->first.c_str(), it->second.c_str()); + } + printf("\n"); + } +} + +static bool +TestLoadObj( + const char* filename, + const char* basepath = NULL) +{ + std::cout << "Loading " << filename << std::endl; + + std::vector shapes; + std::vector materials; + std::string err = tinyobj::LoadObj(shapes, materials, filename, basepath); + + if (!err.empty()) { + std::cerr << err << std::endl; + return false; + } + + PrintInfo(shapes, materials); + + return true; +} + + +static bool +TestStreamLoadObj() +{ + std::cout << "Stream Loading " << std::endl; + + std::stringstream objStream; + objStream + << "mtllib cube.mtl\n" + "\n" + "v 0.000000 2.000000 2.000000\n" + "v 0.000000 0.000000 2.000000\n" + "v 2.000000 0.000000 2.000000\n" + "v 2.000000 2.000000 2.000000\n" + "v 0.000000 2.000000 0.000000\n" + "v 0.000000 0.000000 0.000000\n" + "v 2.000000 0.000000 0.000000\n" + "v 2.000000 2.000000 0.000000\n" + "# 8 vertices\n" + "\n" + "g front cube\n" + "usemtl white\n" + "f 1 2 3 4\n" + "g back cube\n" + "# expects white material\n" + "f 8 7 6 5\n" + "g right cube\n" + "usemtl red\n" + "f 4 3 7 8\n" + "g top cube\n" + "usemtl white\n" + "f 5 1 4 8\n" + "g left cube\n" + "usemtl green\n" + "f 5 6 2 1\n" + "g bottom cube\n" + "usemtl white\n" + "f 2 6 7 3\n" + "# 6 elements"; + +std::string matStream( + "newmtl white\n" + "Ka 0 0 0\n" + "Kd 1 1 1\n" + "Ks 0 0 0\n" + "\n" + "newmtl red\n" + "Ka 0 0 0\n" + "Kd 1 0 0\n" + "Ks 0 0 0\n" + "\n" + "newmtl green\n" + "Ka 0 0 0\n" + "Kd 0 1 0\n" + "Ks 0 0 0\n" + "\n" + "newmtl blue\n" + "Ka 0 0 0\n" + "Kd 0 0 1\n" + "Ks 0 0 0\n" + "\n" + "newmtl light\n" + "Ka 20 20 20\n" + "Kd 1 1 1\n" + "Ks 0 0 0"); + + using namespace tinyobj; + class MaterialStringStreamReader: + public MaterialReader + { + public: + MaterialStringStreamReader(const std::string& matSStream): m_matSStream(matSStream) {} + virtual ~MaterialStringStreamReader() {} + virtual std::string operator() ( + const std::string& matId, + std::vector& materials, + std::map& matMap) + { + return LoadMtl(matMap, materials, m_matSStream); + } + + private: + std::stringstream m_matSStream; + }; + + MaterialStringStreamReader matSSReader(matStream); + std::vector shapes; + std::vector materials; + std::string err = tinyobj::LoadObj(shapes, materials, objStream, matSSReader); + + if (!err.empty()) { + std::cerr << err << std::endl; + return false; + } + + PrintInfo(shapes, materials); + + return true; +} + +int +main( + int argc, + char **argv) +{ + + if (argc > 1) { + const char* basepath = NULL; + if (argc > 2) { + basepath = argv[2]; + } + assert(true == TestLoadObj(argv[1], basepath)); + } else { + //assert(true == TestLoadObj("cornell_box.obj")); + //assert(true == TestLoadObj("cube.obj")); + assert(true == TestStreamLoadObj()); + } + + return 0; +} diff --git a/utils/tinyobj/tiny_obj_loader.cc b/utils/tinyobj/tiny_obj_loader.cc new file mode 100644 index 0000000..2306b74 --- /dev/null +++ b/utils/tinyobj/tiny_obj_loader.cc @@ -0,0 +1,742 @@ +// +// Copyright 2012-2015, Syoyo Fujita. +// +// Licensed under 2-clause BSD liecense. +// + +// +// version 0.9.8: Fix multi-materials(per-face material ID). +// version 0.9.7: Support multi-materials(per-face material ID) per object/group. +// version 0.9.6: Support Ni(index of refraction) mtl parameter. +// Parse transmittance material parameter correctly. +// version 0.9.5: Parse multiple group name. +// Add support of specifying the base path to load material file. +// version 0.9.4: Initial suupport of group tag(g) +// version 0.9.3: Fix parsing triple 'x/y/z' +// version 0.9.2: Add more .mtl load support +// version 0.9.1: Add initial .mtl load support +// version 0.9.0: Initial +// + + +#include +#include +#include + +#include +#include +#include +#include +#include + +#include "tiny_obj_loader.h" + +namespace tinyobj { + +struct vertex_index { + int v_idx, vt_idx, vn_idx; + vertex_index() {}; + vertex_index(int idx) : v_idx(idx), vt_idx(idx), vn_idx(idx) {}; + vertex_index(int vidx, int vtidx, int vnidx) : v_idx(vidx), vt_idx(vtidx), vn_idx(vnidx) {}; + +}; +// for std::map +static inline bool operator<(const vertex_index& a, const vertex_index& b) +{ + if (a.v_idx != b.v_idx) return (a.v_idx < b.v_idx); + if (a.vn_idx != b.vn_idx) return (a.vn_idx < b.vn_idx); + if (a.vt_idx != b.vt_idx) return (a.vt_idx < b.vt_idx); + + return false; +} + +struct obj_shape { + std::vector v; + std::vector vn; + std::vector vt; +}; + +static inline bool isSpace(const char c) { + return (c == ' ') || (c == '\t'); +} + +static inline bool isNewLine(const char c) { + return (c == '\r') || (c == '\n') || (c == '\0'); +} + +// Make index zero-base, and also support relative index. +static inline int fixIndex(int idx, int n) +{ + int i; + + if (idx > 0) { + i = idx - 1; + } else if (idx == 0) { + i = 0; + } else { // negative value = relative + i = n + idx; + } + return i; +} + +static inline std::string parseString(const char*& token) +{ + std::string s; + int b = strspn(token, " \t"); + int e = strcspn(token, " \t\r"); + s = std::string(&token[b], &token[e]); + + token += (e - b); + return s; +} + +static inline int parseInt(const char*& token) +{ + token += strspn(token, " \t"); + int i = atoi(token); + token += strcspn(token, " \t\r"); + return i; +} + +static inline float parseFloat(const char*& token) +{ + token += strspn(token, " \t"); + float f = (float)atof(token); + token += strcspn(token, " \t\r"); + return f; +} + +static inline void parseFloat2( + float& x, float& y, + const char*& token) +{ + std::string line(token); + std::stringstream ss; + ss << line; + ss >> x; + ss >> y; + + //x = parseFloat(token); + //y = parseFloat(token); +} + +static inline void parseFloat3( + float& x, float& y, float& z, + const char*& token) +{ + + //std::string line(token); + std::stringstream ss; + ss << token; + ss >> x; + ss >> y; + ss >> z; + + //x = parseFloat(token); + //y = parseFloat(token); + //z = parseFloat(token); +} + + +// Parse triples: i, i/j/k, i//k, i/j +static vertex_index parseTriple( + const char* &token, + int vsize, + int vnsize, + int vtsize) +{ + vertex_index vi(-1); + + vi.v_idx = fixIndex(atoi(token), vsize); + token += strcspn(token, "/ \t\r"); + if (token[0] != '/') { + return vi; + } + token++; + + // i//k + if (token[0] == '/') { + token++; + vi.vn_idx = fixIndex(atoi(token), vnsize); + token += strcspn(token, "/ \t\r"); + return vi; + } + + // i/j/k or i/j + vi.vt_idx = fixIndex(atoi(token), vtsize); + token += strcspn(token, "/ \t\r"); + if (token[0] != '/') { + return vi; + } + + // i/j/k + token++; // skip '/' + vi.vn_idx = fixIndex(atoi(token), vnsize); + token += strcspn(token, "/ \t\r"); + return vi; +} + +static unsigned int +updateVertex( + std::map& vertexCache, + std::vector& positions, + std::vector& normals, + std::vector& texcoords, + const std::vector& in_positions, + const std::vector& in_normals, + const std::vector& in_texcoords, + const vertex_index& i) +{ + const std::map::iterator it = vertexCache.find(i); + + if (it != vertexCache.end()) { + // found cache + return it->second; + } + + assert(in_positions.size() > (unsigned int) (3*i.v_idx+2)); + + positions.push_back(in_positions[3*i.v_idx+0]); + positions.push_back(in_positions[3*i.v_idx+1]); + positions.push_back(in_positions[3*i.v_idx+2]); + + if (i.vn_idx >= 0) { + normals.push_back(in_normals[3*i.vn_idx+0]); + normals.push_back(in_normals[3*i.vn_idx+1]); + normals.push_back(in_normals[3*i.vn_idx+2]); + } + + if (i.vt_idx >= 0) { + texcoords.push_back(in_texcoords[2*i.vt_idx+0]); + texcoords.push_back(in_texcoords[2*i.vt_idx+1]); + } + + unsigned int idx = positions.size() / 3 - 1; + vertexCache[i] = idx; + + return idx; +} + +void InitMaterial(material_t& material) { + material.name = ""; + material.ambient_texname = ""; + material.diffuse_texname = ""; + material.specular_texname = ""; + material.normal_texname = ""; + for (int i = 0; i < 3; i ++) { + material.ambient[i] = 0.f; + material.diffuse[i] = 0.f; + material.specular[i] = 0.f; + material.transmittance[i] = 0.f; + material.emission[i] = 0.f; + } + material.illum = 0; + material.dissolve = 1.f; + material.shininess = 1.f; + material.ior = 1.f; + material.unknown_parameter.clear(); +} + +static bool +exportFaceGroupToShape( + shape_t& shape, + std::map vertexCache, + const std::vector &in_positions, + const std::vector &in_normals, + const std::vector &in_texcoords, + const std::vector >& faceGroup, + const int material_id, + const std::string &name, + bool clearCache) +{ + if (faceGroup.empty()) { + return false; + } + + // Flatten vertices and indices + for (size_t i = 0; i < faceGroup.size(); i++) { + const std::vector& face = faceGroup[i]; + + vertex_index i0 = face[0]; + vertex_index i1(-1); + vertex_index i2 = face[1]; + + size_t npolys = face.size(); + + // Polygon -> triangle fan conversion + for (size_t k = 2; k < npolys; k++) { + i1 = i2; + i2 = face[k]; + + unsigned int v0 = updateVertex(vertexCache, shape.mesh.positions, shape.mesh.normals, shape.mesh.texcoords, in_positions, in_normals, in_texcoords, i0); + unsigned int v1 = updateVertex(vertexCache, shape.mesh.positions, shape.mesh.normals, shape.mesh.texcoords, in_positions, in_normals, in_texcoords, i1); + unsigned int v2 = updateVertex(vertexCache, shape.mesh.positions, shape.mesh.normals, shape.mesh.texcoords, in_positions, in_normals, in_texcoords, i2); + + shape.mesh.indices.push_back(v0); + shape.mesh.indices.push_back(v1); + shape.mesh.indices.push_back(v2); + + shape.mesh.material_ids.push_back(material_id); + } + + } + + shape.name = name; + + if (clearCache) + vertexCache.clear(); + + return true; + +} + +std::string LoadMtl ( + std::map& material_map, + std::vector& materials, + std::istream& inStream) +{ + material_map.clear(); + std::stringstream err; + + material_t material; + + int maxchars = 8192; // Alloc enough size. + std::vector buf(maxchars); // Alloc enough size. + while (inStream.peek() != -1) { + inStream.getline(&buf[0], maxchars); + + std::string linebuf(&buf[0]); + + // Trim newline '\r\n' or '\n' + if (linebuf.size() > 0) { + if (linebuf[linebuf.size()-1] == '\n') linebuf.erase(linebuf.size()-1); + } + if (linebuf.size() > 0) { + if (linebuf[linebuf.size()-1] == '\r') linebuf.erase(linebuf.size()-1); + } + + // Skip if empty line. + if (linebuf.empty()) { + continue; + } + + // Skip leading space. + const char* token = linebuf.c_str(); + token += strspn(token, " \t"); + + assert(token); + if (token[0] == '\0') continue; // empty line + + if (token[0] == '#') continue; // comment line + + // new mtl + if ((0 == strncmp(token, "newmtl", 6)) && isSpace((token[6]))) { + // flush previous material. + if (!material.name.empty()) + { + material_map.insert(std::pair(material.name, materials.size())); + materials.push_back(material); + } + + // initial temporary material + InitMaterial(material); + + // set new mtl name + char namebuf[4096]; + token += 7; + sscanf(token, "%s", namebuf); + material.name = namebuf; + continue; + } + + // ambient + if (token[0] == 'K' && token[1] == 'a' && isSpace((token[2]))) { + token += 2; + float r, g, b; + parseFloat3(r, g, b, token); + material.ambient[0] = r; + material.ambient[1] = g; + material.ambient[2] = b; + continue; + } + + // diffuse + if (token[0] == 'K' && token[1] == 'd' && isSpace((token[2]))) { + token += 2; + float r, g, b; + parseFloat3(r, g, b, token); + material.diffuse[0] = r; + material.diffuse[1] = g; + material.diffuse[2] = b; + continue; + } + + // specular + if (token[0] == 'K' && token[1] == 's' && isSpace((token[2]))) { + token += 2; + float r, g, b; + parseFloat3(r, g, b, token); + material.specular[0] = r; + material.specular[1] = g; + material.specular[2] = b; + continue; + } + + // transmittance + if (token[0] == 'K' && token[1] == 't' && isSpace((token[2]))) { + token += 2; + float r, g, b; + parseFloat3(r, g, b, token); + material.transmittance[0] = r; + material.transmittance[1] = g; + material.transmittance[2] = b; + continue; + } + + // ior(index of refraction) + if (token[0] == 'N' && token[1] == 'i' && isSpace((token[2]))) { + token += 2; + material.ior = parseFloat(token); + continue; + } + + // emission + if(token[0] == 'K' && token[1] == 'e' && isSpace(token[2])) { + token += 2; + float r, g, b; + parseFloat3(r, g, b, token); + material.emission[0] = r; + material.emission[1] = g; + material.emission[2] = b; + continue; + } + + // shininess + if(token[0] == 'N' && token[1] == 's' && isSpace(token[2])) { + token += 2; + material.shininess = parseFloat(token); + continue; + } + + // illum model + if (0 == strncmp(token, "illum", 5) && isSpace(token[5])) { + token += 6; + material.illum = parseInt(token); + continue; + } + + // dissolve + if ((token[0] == 'd' && isSpace(token[1]))) { + token += 1; + material.dissolve = parseFloat(token); + continue; + } + if (token[0] == 'T' && token[1] == 'r' && isSpace(token[2])) { + token += 2; + material.dissolve = parseFloat(token); + continue; + } + + // ambient texture + if ((0 == strncmp(token, "map_Ka", 6)) && isSpace(token[6])) { + token += 7; + material.ambient_texname = token; + continue; + } + + // diffuse texture + if ((0 == strncmp(token, "map_Kd", 6)) && isSpace(token[6])) { + token += 7; + material.diffuse_texname = token; + continue; + } + + // specular texture + if ((0 == strncmp(token, "map_Ks", 6)) && isSpace(token[6])) { + token += 7; + material.specular_texname = token; + continue; + } + + // normal texture + if ((0 == strncmp(token, "map_Ns", 6)) && isSpace(token[6])) { + token += 7; + material.normal_texname = token; + continue; + } + + // unknown parameter + const char* _space = strchr(token, ' '); + if(!_space) { + _space = strchr(token, '\t'); + } + if(_space) { + int len = _space - token; + std::string key(token, len); + std::string value = _space + 1; + material.unknown_parameter.insert(std::pair(key, value)); + } + } + // flush last material. + material_map.insert(std::pair(material.name, materials.size())); + materials.push_back(material); + + return err.str(); +} + +std::string MaterialFileReader::operator() ( + const std::string& matId, + std::vector& materials, + std::map& matMap) +{ + std::string filepath; + + if (!m_mtlBasePath.empty()) { + filepath = std::string(m_mtlBasePath) + matId; + } else { + filepath = matId; + } + + std::ifstream matIStream(filepath.c_str()); + return LoadMtl(matMap, materials, matIStream); +} + +std::string +LoadObj( + std::vector& shapes, + std::vector& materials, // [output] + const char* filename, + const char* mtl_basepath) +{ + + shapes.clear(); + + std::stringstream err; + + std::ifstream ifs(filename); + if (!ifs) { + err << "Cannot open file [" << filename << "]" << std::endl; + return err.str(); + } + + std::string basePath; + if (mtl_basepath) { + basePath = mtl_basepath; + } + MaterialFileReader matFileReader( basePath ); + + return LoadObj(shapes, materials, ifs, matFileReader); +} + +std::string LoadObj( + std::vector& shapes, + std::vector& materials, // [output] + std::istream& inStream, + MaterialReader& readMatFn) +{ + std::stringstream err; + + std::vector v; + std::vector vn; + std::vector vt; + std::vector > faceGroup; + std::string name; + + // material + std::map material_map; + std::map vertexCache; + int material = -1; + + shape_t shape; + + int maxchars = 8192; // Alloc enough size. + std::vector buf(maxchars); // Alloc enough size. + while (inStream.peek() != -1) { + inStream.getline(&buf[0], maxchars); + + std::string linebuf(&buf[0]); + + // Trim newline '\r\n' or '\n' + if (linebuf.size() > 0) { + if (linebuf[linebuf.size()-1] == '\n') linebuf.erase(linebuf.size()-1); + } + if (linebuf.size() > 0) { + if (linebuf[linebuf.size()-1] == '\r') linebuf.erase(linebuf.size()-1); + } + + // Skip if empty line. + if (linebuf.empty()) { + continue; + } + + // Skip leading space. + const char* token = linebuf.c_str(); + token += strspn(token, " \t"); + + assert(token); + if (token[0] == '\0') continue; // empty line + + if (token[0] == '#') continue; // comment line + + // vertex + if (token[0] == 'v' && isSpace((token[1]))) { + token += 2; + float x, y, z; + parseFloat3(x, y, z, token); + v.push_back(x); + v.push_back(y); + v.push_back(z); + continue; + } + + // normal + if (token[0] == 'v' && token[1] == 'n' && isSpace((token[2]))) { + token += 3; + float x, y, z; + parseFloat3(x, y, z, token); + vn.push_back(x); + vn.push_back(y); + vn.push_back(z); + continue; + } + + // texcoord + if (token[0] == 'v' && token[1] == 't' && isSpace((token[2]))) { + token += 3; + float x, y; + + parseFloat2(x, y, token); + //printf("uv = %f %f token=%s\n",x,y,token); + + vt.push_back(x); + vt.push_back(y); + continue; + } + + // face + if (token[0] == 'f' && isSpace((token[1]))) { + token += 2; + token += strspn(token, " \t"); + + std::vector face; + while (!isNewLine(token[0])) { + vertex_index vi = parseTriple(token, v.size() / 3, vn.size() / 3, vt.size() / 2); + face.push_back(vi); + int n = strspn(token, " \t\r"); + token += n; + } + + faceGroup.push_back(face); + + continue; + } + + // use mtl + if ((0 == strncmp(token, "usemtl", 6)) && isSpace((token[6]))) { + + char namebuf[4096]; + token += 7; + sscanf(token, "%s", namebuf); + + // Create face group per material. + bool ret = exportFaceGroupToShape(shape, vertexCache, v, vn, vt, faceGroup, material, name, true); + if (ret) { + faceGroup.clear(); + } + + if (material_map.find(namebuf) != material_map.end()) { + material = material_map[namebuf]; + } else { + // { error!! material not found } + material = -1; + } + + continue; + + } + + // load mtl + if ((0 == strncmp(token, "mtllib", 6)) && isSpace((token[6]))) { + char namebuf[4096]; + token += 7; + sscanf(token, "%s", namebuf); + + std::string err_mtl = readMatFn(namebuf, materials, material_map); + if (!err_mtl.empty()) { + faceGroup.clear(); // for safety + return err_mtl; + } + + continue; + } + + // group name + if (token[0] == 'g' && isSpace((token[1]))) { + + // flush previous face group. + bool ret = exportFaceGroupToShape(shape, vertexCache, v, vn, vt, faceGroup, material, name, true); + if (ret) { + shapes.push_back(shape); + } + + shape = shape_t(); + + //material = -1; + faceGroup.clear(); + + std::vector names; + while (!isNewLine(token[0])) { + std::string str = parseString(token); + names.push_back(str); + token += strspn(token, " \t\r"); // skip tag + } + + assert(names.size() > 0); + + // names[0] must be 'g', so skipt 0th element. + if (names.size() > 1) { + name = names[1]; + } else { + name = ""; + } + + continue; + } + + // object name + if (token[0] == 'o' && isSpace((token[1]))) { + + // flush previous face group. + bool ret = exportFaceGroupToShape(shape, vertexCache, v, vn, vt, faceGroup, material, name, true); + if (ret) { + shapes.push_back(shape); + } + + //material = -1; + faceGroup.clear(); + shape = shape_t(); + + // @todo { multiple object name? } + char namebuf[4096]; + token += 2; + sscanf(token, "%s", namebuf); + name = std::string(namebuf); + + + continue; + } + + // Ignore unknown command. + } + + bool ret = exportFaceGroupToShape(shape, vertexCache, v, vn, vt, faceGroup, material, name, true); + if (ret) { + shapes.push_back(shape); + } + faceGroup.clear(); // for safety + + return err.str(); +} + + +} diff --git a/utils/tinyobj/tiny_obj_loader.h b/utils/tinyobj/tiny_obj_loader.h new file mode 100644 index 0000000..f02b2ef --- /dev/null +++ b/utils/tinyobj/tiny_obj_loader.h @@ -0,0 +1,110 @@ +// +// Copyright 2012-2013, Syoyo Fujita. +// +// Licensed under 2-clause BSD liecense. +// +#ifndef _TINY_OBJ_LOADER_H +#define _TINY_OBJ_LOADER_H + +#include +#include +#include +#include // std::string +#include // std::cout +#include // std::stringstream + +namespace tinyobj { + +typedef struct +{ + std::string name; + + float ambient[3]; + float diffuse[3]; + float specular[3]; + float transmittance[3]; + float emission[3]; + float shininess; + float ior; // index of refraction + float dissolve; // 1 == opaque; 0 == fully transparent + // illumination model (see http://www.fileformat.info/format/material/) + int illum; + + std::string ambient_texname; + std::string diffuse_texname; + std::string specular_texname; + std::string normal_texname; + std::map unknown_parameter; +} material_t; + +typedef struct +{ + std::vector positions; + std::vector normals; + std::vector texcoords; + std::vector indices; + std::vector material_ids; // per-mesh material ID +} mesh_t; + +typedef struct +{ + std::string name; + mesh_t mesh; +} shape_t; + +class MaterialReader +{ +public: + MaterialReader(){} + virtual ~MaterialReader(){} + + virtual std::string operator() ( + const std::string& matId, + std::vector& materials, + std::map& matMap) = 0; +}; + +class MaterialFileReader: + public MaterialReader +{ + public: + MaterialFileReader(const std::string& mtl_basepath): m_mtlBasePath(mtl_basepath) {} + virtual ~MaterialFileReader() {} + virtual std::string operator() ( + const std::string& matId, + std::vector& materials, + std::map& matMap); + + private: + std::string m_mtlBasePath; +}; + +/// Loads .obj from a file. +/// 'shapes' will be filled with parsed shape data +/// The function returns error string. +/// Returns empty string when loading .obj success. +/// 'mtl_basepath' is optional, and used for base path for .mtl file. +std::string LoadObj( + std::vector& shapes, // [output] + std::vector& materials, // [output] + const char* filename, + const char* mtl_basepath = NULL); + +/// Loads object from a std::istream, uses GetMtlIStreamFn to retrieve +/// std::istream for materials. +/// Returns empty string when loading .obj success. +std::string LoadObj( + std::vector& shapes, // [output] + std::vector& materials, // [output] + std::istream& inStream, + MaterialReader& readMatFn); + +/// Loads materials into std::map +/// Returns an empty string if successful +std::string LoadMtl ( + std::map& material_map, + std::vector& materials, + std::istream& inStream); +} + +#endif // _TINY_OBJ_LOADER_H