diff --git a/Documentation/DeveloperHelpSources/changelog.docu b/Documentation/DeveloperHelpSources/changelog.docu index 59779796b49034101a0446cee2de53e28c47edd1..ee4a05ce4accfa2f760a682903dab49a249a1238 100644 --- a/Documentation/DeveloperHelpSources/changelog.docu +++ b/Documentation/DeveloperHelpSources/changelog.docu @@ -9,11 +9,27 @@ - Queued cross plugin interconnection feature - Use QOpenGLWidget - Switched to Qt command line parsing and removed SimpleOpt + - ACG + - Clamp shininess in Materialnode (caused GL Errors) + - Better Material support in Materialnode (emissive and refractive materials) - Plugins + - File-OBJ + - Read emissive and refractive materials + - File-STL + - Binary STL support for scripting + - HoleFiller + - Bounding box diagonal and boundary length where exchanged in the toolbox table - Primitives - Added Torus + - Added Hexahedral cube + - PropertyViz + - Support Build without OVM (Thanks to Matthias Moeller for the patch) + - Added normalized checkbox to vizualize vectors as colors + - Fixed a typo - SelectionBase - added signal and slot to add widgets for selectionParameters to the selectioninterface + - Type OpenVolumemesh + - added drawmode faces_colored_flat_shaded - VSI - Fixed picking in Object selection - Moved Icon into Plugin @@ -28,6 +44,8 @@ - Make sure that resource filenames are unique - Split Type plugins into separate builds and remove types from pluginlib - Make all plugins submodules and therefore standalone git repositories + - don't recognize type dependency as fulfilled when type plugin is in source tree but not built (e.g. type plugin misses dependencies) (Thanks to Matthias Moeller for the patch) + - Reduced number of includes to speedup comilation - OpenFlipper 3.1 ( 2016/10/12 ) - General diff --git a/cmake/ACGQt.cmake b/cmake/ACGQt.cmake index 9d06d8b46c8cf4fdd07858d46bff6a63a94f7096..609493538c37385d8ba04515a14e1e8523676a74 100644 --- a/cmake/ACGQt.cmake +++ b/cmake/ACGQt.cmake @@ -47,7 +47,7 @@ macro (acg_qt5) endif(Qt5Core_VERSION) string(REGEX REPLACE "^([0-9]+)\\.[0-9]+\\.[0-9]+.*" "\\1" QT_VERSION_MAJOR "${Qt5Core_VERSION_STRING}") - string(REGEX REPLACE "^[0-9]+\\.([0-9])+\\.[0-9]+.*" "\\1" QT_VERSION_MINOR "${Qt5Core_VERSION_STRING}") + string(REGEX REPLACE "^[0-9]+\\.([0-9]+)\\.[0-9]+.*" "\\1" QT_VERSION_MINOR "${Qt5Core_VERSION_STRING}") string(REGEX REPLACE "^[0-9]+\\.[0-9]+\\.([0-9]+).*" "\\1" QT_VERSION_PATCH "${Qt5Core_VERSION_STRING}") find_package (Qt5Widgets QUIET PATHS ${QT_DEFAULT_PATH} ${QT5_FINDER_FLAGS}) diff --git a/cmake/FindANDRESGRAPH.cmake b/cmake/FindANDRESGRAPH.cmake new file mode 100644 index 0000000000000000000000000000000000000000..d7fab4b643d1f83fe8b73e1197588721d3eea388 --- /dev/null +++ b/cmake/FindANDRESGRAPH.cmake @@ -0,0 +1,34 @@ +# http://www.andres.sc/graph.html +# We call it andresgraph to avoid ambiguity + +# - Try to find ANDRESGRAPH +# Once done this will define +# ANDRESGRAPH_FOUND - System has ANDRESGRAPH +# ANDRESGRAPH_INCLUDE_DIRS - The ANDRESGRAPH include directories + +if (ANDRESGRAPH_INCLUDE_DIR) + # in cache already + set(ANDRESGRAPH_FOUND TRUE) + set(ANDRESGRAPH_INCLUDE_DIRS "${ANDRESGRAPH_INCLUDE_DIR}" ) +else (ANDRESGRAPH_INCLUDE_DIR) + +find_path( ANDRESGRAPH_INCLUDE_DIR + NAMES andres/graph/multicut-lifted/kernighan-lin.hxx + PATHS $ENV{ANDRESGRAPH_DIR} + /usr/include/ + /usr/local/include/ + /opt/local/include/ + ) + +set(ANDRESGRAPH_INCLUDE_DIRS "${ANDRESGRAPH_INCLUDE_DIR}" ) + + +include(FindPackageHandleStandardArgs) +# handle the QUIETLY and REQUIRED arguments and set LIBCPLEX_FOUND to TRUE +# if all listed variables are TRUE +find_package_handle_standard_args(ANDRESGRAPH DEFAULT_MSG + ANDRESGRAPH_INCLUDE_DIR) + +mark_as_advanced(ANDRESGRAPH_INCLUDE_DIR) + +endif(ANDRESGRAPH_INCLUDE_DIR) diff --git a/cmake/FindGUROBI.cmake b/cmake/FindGUROBI.cmake index 3358f378b5fea1a6b056e0b2e272bf410be6ad89..9ce26a34816d9fe36786358863175a826ff8369f 100644 --- a/cmake/FindGUROBI.cmake +++ b/cmake/FindGUROBI.cmake @@ -27,6 +27,7 @@ find_path(GUROBI_INCLUDE_DIR "/Library/gurobi502/mac64/include" "/Library/gurobi562/mac64/include" "/Library/gurobi650/mac64/include" + "/Library/gurobi751/mac64/include" "C:\\libs\\gurobi502\\include" "C:\\libs\\gurobi562\\include" "${GUROBI_BASE}/include" @@ -34,6 +35,7 @@ find_path(GUROBI_INCLUDE_DIR find_library( GUROBI_LIBRARY NAMES gurobi + gurobi75 gurobi70 gurobi65 gurobi60 @@ -45,9 +47,10 @@ find_library( GUROBI_LIBRARY gurobi45 PATHS "$ENV{GUROBI_HOME}/lib" - "/Library/gurobi562/mac64/lib" "/Library/gurobi502/mac64/lib" + "/Library/gurobi562/mac64/lib" "/Library/gurobi650/mac64/lib" + "/Library/gurobi751/mac64/lib" "C:\\libs\\gurobi562\\lib" "C:\\libs\\gurobi502\\lib" "${GUROBI_BASE}/lib" @@ -63,6 +66,7 @@ find_library( GUROBI_CXX_LIBRARY PATHS "$ENV{GUROBI_HOME}/lib" "/Library/gurobi562/mac64/lib" "/Library/gurobi502/mac64/lib" + "/Library/gurobi751/mac64/lib" "C:\\libs\\gurobi562\\lib" "C:\\libs\\gurobi502\\lib" "${GUROBI_BASE}/lib" diff --git a/cmake/FindQwt6.cmake b/cmake/FindQwt6.cmake index 4eebccd2e41b2d4541197dfc06d7c75b9e24c478..80ea2e3ae4b7a4d1bbd263e3e65444ad5629bcf3 100644 --- a/cmake/FindQwt6.cmake +++ b/cmake/FindQwt6.cmake @@ -61,6 +61,7 @@ find_path(QWT6_INCLUDE_DIR qwt.h c:\\libs\\qwt-6.1.0 c:\\libs\\qwt-6.0.2 c:\\libs\\qwt-6.0.1 + /opt/local/libexec/qt5/lib/qwt.framework/Versions/6/Headers/ #PATH_SUFFIXES qwt qwt6 qwt-6.1.0 qwt-6.0.2 qwt-6.0.1 include qwt/include qwt6/include #deactivated for acg dir ENV PATH ) @@ -123,8 +124,9 @@ if (QWT6_VERSION_FOUND) ) if (NOT QWT6_LIBRARY) # if not the specific acg qwt installation was found, try system wide - find_library(QWT6_LIBRARY NAMES qwt + find_library(QWT6_LIBRARY NAMES qwt qwt-qt5 PATHS + /opt/local/libexec/qt5/lib /usr/local/qwt/lib /opt/local/lib /usr/local/lib diff --git a/cmake/plugin.cmake b/cmake/plugin.cmake index c8a8c71084cf07f72534efe3ce68b787dab0a8d2..5e6b1684f844890ce89fad5d71db5534de1c4b16 100644 --- a/cmake/plugin.cmake +++ b/cmake/plugin.cmake @@ -329,7 +329,7 @@ macro (_check_plugin_deps _prefix _optional ) if ( DEFINED ${_prefix}_TYPES ) foreach (_TYPE ${${_prefix}_TYPES}) - if ( DEFINED ${_TYPE}_INCLUDE ) + if ( TARGET ${_TYPE} ) list(APPEND ${_prefix}_TYPE_INCLUDES "${${_TYPE}_INCLUDE}") list(APPEND ${_prefix}_TYPE_DEPENDENCIES "${_TYPE}") list(APPEND ${_prefix}_TYPE_DEFINITIONS "-DENABLE_${_TYPE}_SUPPORT") @@ -348,12 +348,12 @@ macro (_check_plugin_deps _prefix _optional ) foreach (_TYPE ${${_prefix}_OPT_TYPES}) - if ( DEFINED ${_TYPE}_INCLUDE ) + if ( TARGET ${_TYPE} ) list(APPEND ${_prefix}_TYPE_INCLUDES "${${_TYPE}_INCLUDE}") list(APPEND ${_prefix}_TYPE_DEPENDENCIES "${_TYPE}") list(APPEND ${_prefix}_TYPE_DEFINITIONS "-DENABLE_${_TYPE}_SUPPORT") else() - message(warning "Optional Datatype ${_TYPE} not available, proceeding without it") + message("Optional Datatype ${_TYPE} not available, proceeding without it") endif() endforeach() diff --git a/common/BaseObjectData.cc b/common/BaseObjectData.cc index 2bba4b40c34903b997585d03f8ee89a89f8c58eb..38e8f87626b34a40158fffd16e9b60c9506d2728 100644 --- a/common/BaseObjectData.cc +++ b/common/BaseObjectData.cc @@ -270,6 +270,10 @@ MaterialNode* BaseObjectData::materialNode() { return materialNode_; } +const MaterialNode* BaseObjectData::materialNode() const { + return materialNode_; +} + BoundingBoxNode* BaseObjectData::boundingBoxNode() { return boundingBoxNode_; } diff --git a/common/BaseObjectData.hh b/common/BaseObjectData.hh index 61807d044080ab2ddac066eea16e827dd21137f1..82abfba5f2f0c40faf3f5099e3c78d736a1bc986 100644 --- a/common/BaseObjectData.hh +++ b/common/BaseObjectData.hh @@ -193,7 +193,10 @@ class DLLEXPORT BaseObjectData : public BaseObject /// get a pointer to the materialnode MaterialNode* materialNode(); - + + /// get a const pointer to the materialnode + const MaterialNode* materialNode() const; + /// get a pointer to the bounding box node BoundingBoxNode* boundingBoxNode(); diff --git a/libs_required/ACG/GL/DrawMesh.hh b/libs_required/ACG/GL/DrawMesh.hh index e3bf040cae9010d351a63d5a8bebc46bd62ba0e7..3a5317f1b64aa601ab9e43079b469c15c1d7f496 100644 --- a/libs_required/ACG/GL/DrawMesh.hh +++ b/libs_required/ACG/GL/DrawMesh.hh @@ -65,7 +65,7 @@ #include #include #include -#include +#include #include #include diff --git a/libs_required/ACG/GL/GLState.cc b/libs_required/ACG/GL/GLState.cc index fab4067fefe85f7e5ab93b4ffc6349ef2f6b40c1..13bb9d52727151c256d781f6b4afd69d84b7de26 100644 --- a/libs_required/ACG/GL/GLState.cc +++ b/libs_required/ACG/GL/GLState.cc @@ -134,7 +134,7 @@ GLState::GLState(bool _updateGL, bool _compatibilityProfile) glheight_(2), near_plane_(1.0), far_plane_(100.0), - multisampling_(false), + multisampling_(false), allow_multisampling_(true), mipmapping_(true), updateGL_(_updateGL), @@ -198,9 +198,9 @@ void GLState::initialize() // Get max number of texture units GLint value; glGetIntegerv(GL_MAX_TEXTURE_IMAGE_UNITS_ARB, &value); - + num_texture_units_ = value; - + // lighting set_twosided_lighting(true); } @@ -399,8 +399,8 @@ void GLState::set_modelview(const GLMatrixd& _m, const GLMatrixd& _inv_m) void GLState::ortho( double _left, double _right, - double _bottom, double _top, - double _n, double _f ) + double _bottom, double _top, + double _n, double _f ) { near_plane_ = _n; far_plane_ = _f; @@ -422,8 +422,8 @@ void GLState::ortho( double _left, double _right, void GLState::frustum( double _left, double _right, - double _bottom, double _top, - double _n, double _f ) + double _bottom, double _top, + double _n, double _f ) { near_plane_ = _n; far_plane_ = _f; @@ -445,7 +445,7 @@ void GLState::frustum( double _left, double _right, void GLState::perspective( double _fovY, double _aspect, - double _n, double _f ) + double _n, double _f ) { near_plane_ = _n; far_plane_ = _f; @@ -467,8 +467,8 @@ void GLState::perspective( double _fovY, double _aspect, void GLState::viewport( int _left, int _bottom, - int _width, int _height, - int _glwidth, int _glheight) + int _width, int _height, + int _glwidth, int _glheight) { left_ = _left; bottom_ = _bottom; @@ -512,8 +512,8 @@ void GLState::viewport( int _left, int _bottom, void GLState::lookAt( const Vec3d& _eye, - const Vec3d& _center, - const Vec3d& _up ) + const Vec3d& _center, + const Vec3d& _up ) { modelview_.lookAt(_eye, _center, _up); inverse_modelview_.inverse_lookAt(_eye, _center, _up); @@ -530,7 +530,7 @@ void GLState::lookAt( const Vec3d& _eye, void GLState::translate( double _x, double _y, double _z, - MultiplyFrom _mult_from ) + MultiplyFrom _mult_from ) { if (_mult_from == MULT_FROM_RIGHT) { @@ -561,7 +561,7 @@ void GLState::translate( Vec3d _vector, void GLState::rotate( double _angle, double _x, double _y, double _z, - MultiplyFrom _mult_from ) + MultiplyFrom _mult_from ) { if (_mult_from == MULT_FROM_RIGHT) { @@ -586,7 +586,7 @@ void GLState::rotate( double _angle, double _x, double _y, double _z, void GLState::scale( double _sx, double _sy, double _sz, - MultiplyFrom _mult_from ) + MultiplyFrom _mult_from ) { if (_mult_from == MULT_FROM_RIGHT) { @@ -611,7 +611,7 @@ void GLState::scale( double _sx, double _sy, double _sz, void GLState::mult_matrix( const GLMatrixd& _m, const GLMatrixd& _inv_m, - MultiplyFrom _mult_from ) + MultiplyFrom _mult_from ) { if (_mult_from == MULT_FROM_RIGHT) { @@ -758,13 +758,13 @@ void GLState::set_overlay_color(const Vec4f& _col) void GLState::set_shininess(float _shininess) -{ - shininess_ = _shininess; +{ + shininess_ = _shininess; if (updateGL_ && compatibilityProfile_) { makeCurrent(); - glMaterialf(GL_FRONT_AND_BACK, GL_SHININESS, _shininess); + glMaterialf(GL_FRONT_AND_BACK, GL_SHININESS, std::min(128.f, _shininess)); } } @@ -891,7 +891,7 @@ Vec3d GLState::eye() const Vec3d GLState::viewing_direction(int _x, int _y) const { Vec3d dir = ( unproject(Vec3d(_x, _y, 1.0)) - - unproject(Vec3d(_x, _y, 0.0)) ); + unproject(Vec3d(_x, _y, 0.0)) ); dir.normalize(); return dir; } @@ -903,7 +903,7 @@ Vec3d GLState::viewing_direction(int _x, int _y) const Vec3d GLState::up() const { Vec3d dir( unproject(Vec3d(0.5*width_, height_-1, 0.0)) - - unproject(Vec3d(0.5*width_, 0.5*height_, 0.0)) ); + unproject(Vec3d(0.5*width_, 0.5*height_, 0.0)) ); dir.normalize(); return dir; } @@ -915,7 +915,7 @@ Vec3d GLState::up() const Vec3d GLState::right() const { Vec3d dir( unproject(Vec3d(width_-1, 0.5*height_, 0.0)) - - unproject(Vec3d(0.5*width_, 0.5*height_, 0.0)) ); + unproject(Vec3d(0.5*width_, 0.5*height_, 0.0)) ); dir.normalize(); return dir; } @@ -925,7 +925,7 @@ Vec3d GLState::right() const void GLState::viewing_ray( int _x, int _y, - Vec3d& _origin, Vec3d& _direction) const + Vec3d& _origin, Vec3d& _direction) const { _origin = unproject(Vec3d(_x, _y, 0.0)); _direction = unproject(Vec3d(_x, _y, 1.0)) - _origin; @@ -1338,7 +1338,7 @@ void GLState::syncFromGL() if (glIsEnabled(caps[i])) stateStack_.back().glStateEnabled_.set(caps[i]); else stateStack_.back().glStateEnabled_.reset(caps[i]); } - + GLint getparam; #ifdef GL_VERSION_1_4 @@ -1364,9 +1364,9 @@ void GLState::syncFromGL() glGetIntegerv(GL_BLEND_EQUATION_RGB, &getparam); stateStack_.back().blendEquationState_ = getparam; - + glGetFloatv(GL_BLEND_COLOR, stateStack_.back().blendColorState_); - + glGetIntegerv(GL_ALPHA_TEST_FUNC, &getparam); stateStack_.back().alphaFuncState_ = getparam; @@ -1381,7 +1381,7 @@ void GLState::syncFromGL() GLenum bufGets[8] = { GL_ARRAY_BUFFER_BINDING, GL_ARRAY_BUFFER, - GL_ELEMENT_ARRAY_BUFFER_BINDING, GL_ELEMENT_ARRAY_BUFFER, + GL_ELEMENT_ARRAY_BUFFER_BINDING, GL_ELEMENT_ARRAY_BUFFER, GL_PIXEL_PACK_BUFFER_BINDING, GL_PIXEL_PACK_BUFFER, GL_PIXEL_UNPACK_BUFFER_BINDING, GL_PIXEL_UNPACK_BUFFER}; @@ -1452,7 +1452,7 @@ void GLState::syncFromGL() GL_TEXTURE_COORD_ARRAY_SIZE, GL_TEXTURE_COORD_ARRAY_TYPE, GL_TEXTURE_COORD_ARRAY_STRIDE, GL_TEXTURE_COORD_ARRAY_POINTER}; - GLStateContext::GLVertexPointer* ptrs[] = {&stateStack_.back().vertexPointer_, + GLStateContext::GLVertexPointer* ptrs[] = {&stateStack_.back().vertexPointer_, &stateStack_.back().colorPointer_, &stateStack_.back().texcoordPointer_}; for (int i = 0; i < 3 ; ++i) @@ -1743,7 +1743,7 @@ void GLState::depthRange(GLclampd _zNear, GLclampd _zFar) { if (!depthRangeLock_) { - #ifdef GLSTATE_AVOID_REDUNDANT_GLCALLS + #ifdef GLSTATE_AVOID_REDUNDANT_GLCALLS if (abs(_zNear - stateStack_.back().depthRange_[0]) > 1e-6 || abs(_zFar - stateStack_.back().depthRange_[1]) > 1e-6) #endif diff --git a/libs_required/ACG/Scenegraph/MaterialNode.cc b/libs_required/ACG/Scenegraph/MaterialNode.cc index 79c5cf2ca5e3c33eb5351d8446f0f972d572dbb5..9ec2f07f9c14d26c7beaf496523eeb3619959f73 100644 --- a/libs_required/ACG/Scenegraph/MaterialNode.cc +++ b/libs_required/ACG/Scenegraph/MaterialNode.cc @@ -142,6 +142,8 @@ QString Material::serializeToJson() const { matMap["overlayColor"] = col2vl(overlayColor_); matMap["shininess"] = shininess_; matMap["reflectance"] = reflectance_; + matMap["indexOfRefraction"] = indexOfRefraction_; + matMap["isRefractive"] = isRefractive_; matMap["pointSize"] = pointSize_; matMap["lineWidth"] = lineWidth_; matMap["roundPoints"] = roundPoints_; @@ -178,6 +180,8 @@ void Material::deserializeFromVariantMap(const QVariantMap &matMap) { if (matMap.contains("overlayColor")) overlayColor_ = vl2col(matMap["overlayColor"].toList()); if (matMap.contains("shininess")) shininess_ = matMap["shininess"].toFloat(); if (matMap.contains("reflectance")) reflectance_ = matMap["reflectance"].toDouble(); + if (matMap.contains("indexOfRefraction")) indexOfRefraction_ = matMap["indexOfRefraction"].toDouble(); + if (matMap.contains("isRefractive")) isRefractive_ = matMap["isRefractive"].toBool(); if (matMap.contains("pointSize")) pointSize_ = matMap["pointSize"].toFloat(); if (matMap.contains("lineWidth")) lineWidth_ = matMap["lineWidth"].toFloat(); if (matMap.contains("roundPoints")) roundPoints_ = matMap["roundPoints"].toBool(); @@ -217,11 +221,11 @@ void MaterialNode::enter(GLState& _state, const DrawModes::DrawMode& _drawmode if (applyProperties_ & Material) { - materialBackup_.ambientColor_ = _state.ambient_color(); - materialBackup_.diffuseColor_ = _state.diffuse_color(); - materialBackup_.specularColor_ = _state.specular_color(); - materialBackup_.overlayColor_ = _state.overlay_color(); - materialBackup_.shininess_ = _state.shininess(); + materialBackup_.ambientColor_ = _state.ambient_color(); + materialBackup_.diffuseColor_ = _state.diffuse_color(); + materialBackup_.specularColor_ = _state.specular_color(); + materialBackup_.overlayColor_ = _state.overlay_color(); + materialBackup_.shininess_ = _state.shininess(); _state.set_ambient_color(material_.ambientColor_); _state.set_diffuse_color(material_.diffuseColor_); @@ -480,6 +484,7 @@ MaterialNode::read(std::istream& _is) char s[200]; float x, y, z, u; + bool b; while (_is && (!_is.eof()) && _is.getline(s,200) ) { std::istringstream buffer(s); @@ -541,6 +546,22 @@ MaterialNode::read(std::istream& _is) material_.shininess(x); } } + // Refractive + else if (specifier == "isRefractive") { + buffer >> b; + + if (buffer.good()) { + material_.setRefractive(b); + } + } + // Refraction Index + else if (specifier == "indexOfRefraction") { + buffer >> x; + + if (buffer.good()) { + material_.indexOfRefraction(x); + } + } // PointSize else if (specifier == "PointSize") { buffer >> x; diff --git a/libs_required/ACG/Scenegraph/MaterialNode.hh b/libs_required/ACG/Scenegraph/MaterialNode.hh index 4646910f698a9688a6a06f843ff00d06e159f469..649ecd126b8e417d030659ff22328d5ae1156c96 100644 --- a/libs_required/ACG/Scenegraph/MaterialNode.hh +++ b/libs_required/ACG/Scenegraph/MaterialNode.hh @@ -83,9 +83,9 @@ namespace SceneGraph { **/ class ACGDLLEXPORT Material { - + friend class MaterialNode; - + public: /// Default constructor Material() : @@ -96,6 +96,8 @@ public: overlayColor_(GLState::default_overlay_color), shininess_(GLState::default_shininess), reflectance_(0.0), + indexOfRefraction_(1.0), + isRefractive_(false), pointSize_(1.0), lineWidth_(1.0), roundPoints_(false), @@ -108,10 +110,10 @@ public: colorMaterial_(true), backfaceCulling_(false), multiSampling_(true) {}; - + /// Deconstructor virtual ~Material() {}; - + /// Copy constructor Material(const Material& _m) : baseColor_(_m.baseColor_), @@ -121,6 +123,8 @@ public: overlayColor_(_m.overlayColor_), shininess_(_m.shininess_), reflectance_(_m.reflectance_), + indexOfRefraction_(_m.indexOfRefraction_), + isRefractive_(_m.isRefractive_), pointSize_(_m.pointSize_), lineWidth_(_m.lineWidth_), roundPoints_(_m.roundPoints_), @@ -138,7 +142,7 @@ public: QString serializeToJson() const; void deserializeFromJson(const QString &json); void deserializeFromVariantMap(const QVariantMap &matMap); - + /** \brief Set color based on _c * * Basecolor (which is the emitted color is set to zero) @@ -154,7 +158,7 @@ public: c = _c * 0.6f; c[3]=_c[3]; diffuseColor(c); c = _c * 0.8f; c[3]=_c[3]; specularColor(c); } - + /// Creates a randomized color and sets it void generateRandomColor() { color( Vec4f(0.2 + double(rand())/double(RAND_MAX)*0.8, @@ -163,11 +167,16 @@ public: 1.0)); } - /// set the base color + /// set the base color (Sets the baseColor which is the same as the emission(const Vec4f& _c) ) void baseColor(const Vec4f& _c) { baseColor_ = _c;} - /// get the base color + /// get the base color ( Same as emission() ) const Vec4f& baseColor() const { return baseColor_; } + /// set emission ( Same as baseColor( const Vec4f& _c )) ) + void emissionColor(const Vec4f& _c) { baseColor_ = _c;} + /// get emission ( Same as baseColor() ) + const Vec4f& emissionColor() const { return baseColor_; } + /// set the ambient color. void ambientColor(const Vec4f& _a) { ambientColor_ = _a; } /// get the ambient color. @@ -201,12 +210,22 @@ public: void shininess(float _s) { shininess_ = _s; } /// get shininess float shininess() const { return shininess_; } - + /// set reflectance ( not used in OpenGL Rendering) void reflectance(double _m) { reflectance_ = _m; } /// get reflectance ( not used in OpenGL Rendering) double reflectance() const { return reflectance_; } - + + /// set index of refraction + void indexOfRefraction(double _m) { indexOfRefraction_ = _m; } + /// get index of refraction ( not used in OpenGL Rendering) + double indexOfRefraction() const { return indexOfRefraction_; } + + /// set refractive flag + void setRefractive(bool _r) { isRefractive_ = _r; } + /// get refractive flag + bool isRefractive() const {return isRefractive_;} + /// set point size (default: 1.0) void pointSize(float _sz) { pointSize_ = _sz; } /// get point size @@ -226,7 +245,7 @@ public: void lineSmooth(bool _b) { linesSmooth_ = _b; } /// get: rsmooth lines enabled bool lineSmooth() const { return linesSmooth_; } - + /// enable alpha test (draw pixels if alpha >= _clip) void enableAlphaTest(float _clip) { alphaTest_ = true; alphaClip_ = _clip; @@ -237,7 +256,7 @@ public: /// Return state of Alpha test bool alphaTest() const { return alphaTest_; }; - + /// Enable Multisampling void enableMultisampling() { multiSampling_ = true; @@ -280,32 +299,36 @@ public: /// disable backface culling (not active by default, see applyProperties) void disableBackfaceCulling() { backfaceCulling_ = false; } + bool isEmissive() const { return (baseColor_[0] > 0.f || baseColor_[1] > 0.f || baseColor_[2] > 0.f); } + protected: - + Vec4f baseColor_; Vec4f ambientColor_; Vec4f diffuseColor_; Vec4f specularColor_; Vec4f overlayColor_; - + float shininess_; double reflectance_; + double indexOfRefraction_; + bool isRefractive_; float pointSize_; float lineWidth_; - + bool roundPoints_; bool linesSmooth_; - + bool alphaTest_; float alphaClip_; - + bool blending_; GLenum blendParam1_; GLenum blendParam2_; - + bool colorMaterial_; bool backfaceCulling_; - + bool multiSampling_; }; @@ -355,8 +378,8 @@ public: /// Default constructor. Applies all properties. MaterialNode( BaseNode* _parent = 0, - const std::string& _name = "", - unsigned int _applyProperties = (All & ~BackFaceCulling)); + const std::string& _name = "", + unsigned int _applyProperties = (All & ~BackFaceCulling)); /// Destructor. virtual ~MaterialNode() {}; @@ -394,17 +417,22 @@ public: void set_color(const Vec4f& _c) { material_.color(_c); } - + /// Generates a random color and sets it void set_random_color() { material_.generateRandomColor(); } - /// set the base color + /// set the base color ( Same as set_emission(const Vec4f& _c) ) void set_base_color(const Vec4f& _c) { material_.baseColor(_c); } - /// get the base color + /// get the base color ( same as emission() ) const Vec4f& base_color() const { return material_.baseColor(); } + /// set emission ( same as set_base_color(const Vec4f& _c) ) + void set_emission(const Vec4f& _c) { material_.baseColor(_c); } + /// get emission ( same as base_color() ) + const Vec4f& emission() const { return material_.baseColor(); } + /// set the ambient color. void set_ambient_color(const Vec4f& _a) { material_.ambientColor(_a); } /// get the ambient color. @@ -438,12 +466,22 @@ public: void set_shininess(float _s) { material_.shininess(_s); } /// get shininess float shininess() const { return material_.shininess(); } - + /// set reflectance void set_reflectance(double _m) { material_.reflectance(_m); } /// get reflectance double reflectance() const { return material_.reflectance(); } + /// set index of refraction + void set_indexOfRefraction(double _m) { material_.indexOfRefraction(_m); } + /// get index of refraction + double indexOfRefraction() const { return material_.indexOfRefraction(); } + + /// set refractive flag + void set_refractive(bool _r) { material_.isRefractive_ = _r; } + /// get refractive flag + bool isRefractive() const {return material_.isRefractive_;} + /** @} */ //=========================================================================== @@ -517,7 +555,7 @@ public: /// enable blending with Parameters (_p1, _p2) void enable_blending(GLenum _p1 = GL_SRC_ALPHA, - GLenum _p2 = GL_ONE_MINUS_SRC_ALPHA) { + GLenum _p2 = GL_ONE_MINUS_SRC_ALPHA) { material_.enableBlending(_p1, _p2); } /// disable blending @@ -527,7 +565,7 @@ public: /// enable backface culling (not active by default, see applyProperties) void enable_backface_culling() { material_.enableBackfaceCulling(); } - + /// disable backface culling (not active by default, see applyProperties) void disable_backface_culling() { material_.disableBackfaceCulling(); } @@ -538,10 +576,10 @@ public: void applyProperties(unsigned int _applyProperties) { applyProperties_ = _applyProperties; } - + /// Get material object reference ACG::SceneGraph::Material& material() { return material_; } - + /// Set material object void set_material(const ACG::SceneGraph::Material& _m) { material_ = _m; } diff --git a/libs_required/OpenMesh b/libs_required/OpenMesh index c48e95785d9c16f00799726204f488c9170b7f63..7856a4371b5f3607942cb9e0587f4596a3c5ef60 160000 --- a/libs_required/OpenMesh +++ b/libs_required/OpenMesh @@ -1 +1 @@ -Subproject commit c48e95785d9c16f00799726204f488c9170b7f63 +Subproject commit 7856a4371b5f3607942cb9e0587f4596a3c5ef60