Skip to content

Commit

Permalink
Update of 2.1 version
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
kmkolasinski committed Feb 15, 2015
1 parent 555883c commit ba078f0
Show file tree
Hide file tree
Showing 46 changed files with 4,678 additions and 471 deletions.
8 changes: 8 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -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
22 changes: 19 additions & 3 deletions AwesomeBump.pro
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,25 @@ 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 \
formimageprop.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
Expand All @@ -30,6 +40,12 @@ RESOURCES += \
FORMS += \
mainwindow.ui \
formimageprop.ui \
dialogheightcalculator.ui
dialogheightcalculator.ui \
formsettingsfield.ui \
formsettingscontainer.ui

ICON = content/icon.icns
INCLUDEPATH += include



2 changes: 1 addition & 1 deletion CommonObjects.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ QString PostfixNames::occlusionName = "_o";

QString PostfixNames::outputFormat = ".png";


bool FBOImages::bUseLinearInterpolation = true;

void TargaImage::write(QImage image, QString fileName){

Expand Down
25 changes: 17 additions & 8 deletions CommonObjects.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,7 @@

#include "qopenglerrorcheck.h"

#define PROGRAM_VERTEX_ATTRIBUTE 0
#define PROGRAM_TEXCOORD_ATTRIBUTE 1


using namespace std;

Expand All @@ -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,
Expand Down Expand Up @@ -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() &&
Expand All @@ -232,7 +240,8 @@ class FBOImages{
GLCHK(FBOImages::create(src ,width,height));
}
}

public:
static bool bUseLinearInterpolation;

};

Expand Down
2 changes: 1 addition & 1 deletion camera.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Loading

0 comments on commit ba078f0

Please sign in to comment.