From a5c4cec1757b3eb2f1b5acdaae296b57a2346aa6 Mon Sep 17 00:00:00 2001 From: Jeongseok Lee Date: Wed, 18 Jul 2018 22:52:33 -0700 Subject: [PATCH 01/12] Reorganize glut (preparation for glfw) --- dart/gui/CMakeLists.txt | 27 +++- dart/gui/GLFuncs.cpp | 36 +---- dart/gui/GLFuncs.hpp | 11 +- dart/gui/GlutWindow.hpp | 62 +------- dart/gui/GraphWindow.hpp | 27 +--- dart/gui/LoadGlut.hpp | 14 +- dart/gui/MotionBlurSimWindow.hpp | 44 +----- dart/gui/SimWindow.hpp | 113 +------------- dart/gui/SoftSimWindow.hpp | 26 +--- dart/gui/Win2D.hpp | 43 +----- dart/gui/Win3D.hpp | 36 +---- dart/gui/glut/CMakeLists.txt | 25 +++ dart/gui/glut/GLUTFuncs.cpp | 79 ++++++++++ dart/gui/glut/GLUTFuncs.hpp | 48 ++++++ dart/gui/{ => glut}/GlutWindow.cpp | 52 ++++--- dart/gui/glut/GlutWindow.hpp | 100 ++++++++++++ dart/gui/{ => glut}/GraphWindow.cpp | 12 +- dart/gui/glut/GraphWindow.hpp | 76 +++++++++ dart/gui/glut/LoadGlut.hpp | 46 ++++++ dart/gui/{ => glut}/MotionBlurSimWindow.cpp | 2 +- dart/gui/glut/MotionBlurSimWindow.hpp | 58 +++++++ dart/gui/{ => glut}/SimWindow.cpp | 12 +- dart/gui/glut/SimWindow.hpp | 161 ++++++++++++++++++++ dart/gui/{ => glut}/SoftSimWindow.cpp | 6 +- dart/gui/glut/SoftSimWindow.hpp | 72 +++++++++ dart/gui/{ => glut}/Win2D.cpp | 8 +- dart/gui/glut/Win2D.hpp | 83 ++++++++++ dart/gui/{ => glut}/Win3D.cpp | 47 ++++-- dart/gui/glut/Win3D.hpp | 78 ++++++++++ dart/gui/glut/glut.hpp.in | 3 + dart/simulation/World.hpp | 5 +- examples/rigidCubes/MyWindow.hpp | 11 +- examples/rigidCubes/{Main.cpp => main.cpp} | 18 ++- 33 files changed, 1005 insertions(+), 436 deletions(-) create mode 100644 dart/gui/glut/CMakeLists.txt create mode 100644 dart/gui/glut/GLUTFuncs.cpp create mode 100644 dart/gui/glut/GLUTFuncs.hpp rename dart/gui/{ => glut}/GlutWindow.cpp (82%) create mode 100644 dart/gui/glut/GlutWindow.hpp rename dart/gui/{ => glut}/GraphWindow.cpp (93%) create mode 100644 dart/gui/glut/GraphWindow.hpp create mode 100644 dart/gui/glut/LoadGlut.hpp rename dart/gui/{ => glut}/MotionBlurSimWindow.cpp (99%) create mode 100644 dart/gui/glut/MotionBlurSimWindow.hpp rename dart/gui/{ => glut}/SimWindow.cpp (98%) create mode 100644 dart/gui/glut/SimWindow.hpp rename dart/gui/{ => glut}/SoftSimWindow.cpp (96%) create mode 100644 dart/gui/glut/SoftSimWindow.hpp rename dart/gui/{ => glut}/Win2D.cpp (96%) create mode 100644 dart/gui/glut/Win2D.hpp rename dart/gui/{ => glut}/Win3D.cpp (88%) create mode 100644 dart/gui/glut/Win3D.hpp create mode 100644 dart/gui/glut/glut.hpp.in rename examples/rigidCubes/{Main.cpp => main.cpp} (86%) diff --git a/dart/gui/CMakeLists.txt b/dart/gui/CMakeLists.txt index 795de42bf41ad..f52ba67c7dc2c 100644 --- a/dart/gui/CMakeLists.txt +++ b/dart/gui/CMakeLists.txt @@ -21,15 +21,31 @@ else() endif() # Search all header and source files -file(GLOB hdrs "*.hpp") -file(GLOB srcs "*.cpp") +file(GLOB hdrs "*.hpp" "*.h" "detail/*.hpp") +file(GLOB srcs "*.cpp" "*.c" "detail/*.cpp") + +function(dart_add_gui_headers) + dart_property_add(DART_GUI_HEADERS ${ARGN}) +endfunction() + +function(dart_add_gui_sources) + dart_property_add(DART_GUI_SOURCES ${ARGN}) +endfunction() + +# Add required subdirectory +add_subdirectory(glut) + +get_property(dart_gui_headers GLOBAL PROPERTY DART_GUI_HEADERS) +get_property(dart_gui_sources GLOBAL PROPERTY DART_GUI_SOURCES) # Set local target name set(target_name ${PROJECT_NAME}-gui) set(component_name gui) # Add target -dart_add_library(${target_name} ${hdrs} ${srcs}) +dart_add_library(${target_name} + ${hdrs} ${srcs} ${dart_gui_headers} ${dart_gui_sources} +) target_include_directories( ${target_name} SYSTEM PUBLIC @@ -62,6 +78,11 @@ add_subdirectory(osg) # Generate header for this namespace dart_get_filename_components(header_names "gui headers" ${hdrs}) +set( + header_names + ${header_names} + glut/glut.hpp +) dart_generate_include_header_list( gui_headers "dart/gui/" diff --git a/dart/gui/GLFuncs.cpp b/dart/gui/GLFuncs.cpp index 5b1183e32b1d3..7369c4e0eb39f 100644 --- a/dart/gui/GLFuncs.cpp +++ b/dart/gui/GLFuncs.cpp @@ -38,40 +38,20 @@ #include +#include "dart/common/Console.hpp" #include "dart/math/Constants.hpp" #include "dart/gui/LoadOpengl.hpp" -#include "dart/gui/LoadGlut.hpp" +#include "dart/gui/glut/GLUTFuncs.hpp" +// TODO(JS): remove once glut become an optional dependency namespace dart { namespace gui { - void drawStringOnScreen(float _x, float _y, const std::string& _s, - bool _bigFont) { - // draws text on the screen - GLint oldMode; - glGetIntegerv(GL_MATRIX_MODE, &oldMode); - glMatrixMode(GL_PROJECTION); - - glPushMatrix(); - glLoadIdentity(); - gluOrtho2D(0.0, 1.0, 0.0, 1.0); - - glMatrixMode(GL_MODELVIEW); - glPushMatrix(); - glLoadIdentity(); - glRasterPos2f(_x, _y); - unsigned int length = _s.length(); - for (unsigned int c = 0; c < length; c++) { - if (_bigFont) - glutBitmapCharacter(GLUT_BITMAP_HELVETICA_18, _s.at(c) ); - else - glutBitmapCharacter(GLUT_BITMAP_HELVETICA_10, _s.at(c) ); - } - glPopMatrix(); - - glMatrixMode(GL_PROJECTION); - glPopMatrix(); - glMatrixMode(oldMode); +void drawStringOnScreen(float, float, const std::string&, bool) +{ + dtwarn << "dart::gui::drawStringOnScreen() is deprecated in DART 6.1. " + << "Please use dart::gui::glut::drawStringOnScreen() instead. " + << "Ignoring this action.\n"; } // draw a 3D arrow starting from pt along dir, the arrowhead is on the other end diff --git a/dart/gui/GLFuncs.hpp b/dart/gui/GLFuncs.hpp index d213a5a474e47..d52d97ddf2d47 100644 --- a/dart/gui/GLFuncs.hpp +++ b/dart/gui/GLFuncs.hpp @@ -34,15 +34,18 @@ #define DART_GUI_GLFUNCS_HPP_ #include - #include +#include "dart/common/Deprecated.hpp" namespace dart { namespace gui { -/// \brief - void drawStringOnScreen(float _x, float _y, const std::string& _s, - bool _bigFont = true); +/// \deprecated Deprecated in 6.1. Please use +/// dart::gui::glut::drawStringOnScreen() instead in +/// dart/gui/glut/GLUTFuncs.hpp file. +DART_DEPRECATED(6.1) +void drawStringOnScreen(float _x, float _y, const std::string& _s, + bool _bigFont = true); /// \brief void drawArrow3D(const Eigen::Vector3d& _pt, const Eigen::Vector3d& _dir, diff --git a/dart/gui/GlutWindow.hpp b/dart/gui/GlutWindow.hpp index d1b7abeeccdb9..b9afbf8cb5999 100644 --- a/dart/gui/GlutWindow.hpp +++ b/dart/gui/GlutWindow.hpp @@ -33,67 +33,17 @@ #ifndef DART_GUI_GLUTWINDOW_HPP_ #define DART_GUI_GLUTWINDOW_HPP_ -#include +#include "dart/gui/glut/GlutWindow.hpp" -#include "dart/gui/LoadOpengl.hpp" -#include "dart/gui/RenderInterface.hpp" +#warning "This file is deprecated in DART 6.1. "\ + "Please use dart/gui/glut/GlutWindow.hpp instead." namespace dart { namespace gui { -/// \brief -class GlutWindow { -public: - GlutWindow(); - virtual ~GlutWindow(); +using GlutWindow = ::dart::gui::glut::Window; - /// \warning This function should be called once. - virtual void initWindow(int _w, int _h, const char* _name); - - // callback functions - static void reshape(int _w, int _h); - static void keyEvent(unsigned char _key, int _x, int _y); - static void specKeyEvent(int _key, int _x, int _y); - static void mouseClick(int _button, int _state, int _x, int _y); - static void mouseDrag(int _x, int _y); - static void mouseMove(int _x, int _y); - static void refresh(); - static void refreshTimer(int _val); - static void runTimer(int _val); - - static GlutWindow* current(); - static std::vector mWindows; - static std::vector mWinIDs; - -protected: - // callback implementation - virtual void resize(int _w, int _h) = 0; - virtual void render() = 0; - virtual void keyboard(unsigned char _key, int _x, int _y); - virtual void specKey(int _key, int _x, int _y); - virtual void click(int _button, int _state, int _x, int _y); - virtual void drag(int _x, int _y); - virtual void move(int _x, int _y); - virtual void displayTimer(int _val); - virtual void simTimer(int _val); - - virtual bool screenshot(); - - int mWinWidth; - int mWinHeight; - int mMouseX; - int mMouseY; - double mDisplayTimeout; - bool mMouseDown; - bool mMouseDrag; - bool mCapture; - double mBackground[4]; - gui::RenderInterface* mRI; - std::vector mScreenshotTemp; - std::vector mScreenshotTemp2; -}; - -} // namespace gui -} // namespace dart +} // namespace gui +} // namespace dart #endif // DART_GUI_GLUTWINDOW_HPP_ diff --git a/dart/gui/GraphWindow.hpp b/dart/gui/GraphWindow.hpp index e71382ba9380a..c394cdfb07074 100644 --- a/dart/gui/GraphWindow.hpp +++ b/dart/gui/GraphWindow.hpp @@ -39,35 +39,12 @@ #ifndef DART_GUI_GRAPHWINDOW_HPP_ #define DART_GUI_GRAPHWINDOW_HPP_ -#include - -#include - -#include "dart/gui/Win2D.hpp" +#include "dart/gui/glut/GraphWindow.hpp" namespace dart { namespace gui { -/// \brief -class GraphWindow : public Win2D { -public: - /// \brief - GraphWindow(); - - /// \brief - virtual ~GraphWindow(); - - /// \brief - void draw() override; - - /// \brief - void keyboard(unsigned char _key, int _x, int _y) override; - - void setData(Eigen::VectorXd _data); - -protected: - Eigen::VectorXd mData; -}; +using GraphWindow = ::dart::gui::glut::GraphWindow; } // namespace gui } // namespace dart diff --git a/dart/gui/LoadGlut.hpp b/dart/gui/LoadGlut.hpp index 18cf436eddf81..d062baed1afea 100644 --- a/dart/gui/LoadGlut.hpp +++ b/dart/gui/LoadGlut.hpp @@ -33,15 +33,9 @@ #ifndef DART_GUI_LOADGLUT_HPP_ #define DART_GUI_LOADGLUT_HPP_ -#if defined(_WIN32) - #include // To disable glut::exit() function - #include -#elif defined(__linux__) - #include -#elif defined(__APPLE__) - #include -#else - #error "Load OpenGL Error: What's your operating system?" -#endif +#warning "This file is deprecated in DART 6.1. "\ + "Please use dart/gui/glut/LoadGlut.hpp instead." + +#include "dart/gui/glut/LoadGlut.hpp" #endif // DART_GUI_LOADGLUT_HPP_ diff --git a/dart/gui/MotionBlurSimWindow.hpp b/dart/gui/MotionBlurSimWindow.hpp index 0950fb2688059..fc50ddc994383 100644 --- a/dart/gui/MotionBlurSimWindow.hpp +++ b/dart/gui/MotionBlurSimWindow.hpp @@ -9,49 +9,17 @@ #ifndef DART_GUI_MOTIONBLURSIMWINDOW_HPP_ #define DART_GUI_MOTIONBLURSIMWINDOW_HPP_ -#include -#include +#warning "This file is deprecated in DART 6.1. "\ + "Please use dart/gui/glut/MotionBlurSimWindow.hpp instead." -#include "dart/gui/SimWindow.hpp" +#include "dart/gui/glut/MotionBlurSimWindow.hpp" namespace dart { namespace gui { -class MotionBlurSimWindow : public SimWindow -{ -public: +using MotionBlurSimWindow = ::dart::gui::glut::MotionBlurSimWindow; - /// \brief - MotionBlurSimWindow(); - - /// \brief - virtual ~MotionBlurSimWindow(); - - // Set the Quality of Motion Blur - // Default is 5 (record position of every frame) - // int from 0 (No motion blur) - 5 (Highest) - // The function takes value smaller than 0 as 0, larger than 5 as 5 - void setMotionBlurQuality(int _val); - - // Override the render function in dart/gui/Win3D.hpp - // To draw the motion image - // Render function is called once per GUI display time - // but in MotionBlurSimWindow, draw function will run in motion blur frequency - void render() override; - - // Override the display timer, - // Move the part of "step" in world function to the render function - void displayTimer(int _val) override; - -protected: - // Determines the frequency of the motion blur - // Default is 1, which means motion blur effect has the highest quality - // When set to m, motion blur record data every m frames - int mMotionBlurFrequency; - -}; // End of Class Definition - -} // namespace gui -} // namespace dart +} // namespace gui +} // namespace dart #endif // DART_GUI_MOTIONBLURSIMWINDOW_HPP_ diff --git a/dart/gui/SimWindow.hpp b/dart/gui/SimWindow.hpp index 2948aa3e6daf0..d7135d5aac3c4 100644 --- a/dart/gui/SimWindow.hpp +++ b/dart/gui/SimWindow.hpp @@ -39,120 +39,15 @@ #ifndef DART_GUI_SIMWINDOW_HPP_ #define DART_GUI_SIMWINDOW_HPP_ -#include +#warning "This file is deprecated in DART 6.1. "\ + "Please use dart/gui/glut/SimWindow.hpp instead." -#include - -#include "dart/common/Deprecated.hpp" -#include "dart/gui/Win3D.hpp" -#include "dart/simulation/World.hpp" +#include "dart/gui/glut/SimWindow.hpp" namespace dart { namespace gui { -class GraphWindow; - -/// \brief -class SimWindow : public Win3D { -public: - /// \brief - SimWindow(); - - /// \brief - virtual ~SimWindow(); - - /// \brief - virtual void timeStepping(); - - virtual void drawWorld() const; - - virtual void drawSkeletons() const; - - DART_DEPRECATED(6.0) - virtual void drawSkels(); - - DART_DEPRECATED(6.0) - virtual void drawEntities(); - - /// \brief - void displayTimer(int _val) override; - - /// \brief - void draw() override; - - /// \brief - void keyboard(unsigned char _key, int _x, int _y) override; - - /// \brief - void setWorld(dart::simulation::WorldPtr _world); - - /// \brief Save world in 'tempWorld.txt' - void saveWorld(); - - /// \brief Plot _data in a 2D window - void plot(Eigen::VectorXd& _data); -// bool isSimulating() const { return mSimulating; } - -// void setSimulatingFlag(int _flag) { mSimulating = _flag; } - -protected: - - virtual void drawSkeleton( - const dynamics::Skeleton* skeleton, - const Eigen::Vector4d& color = Eigen::Vector4d::Constant(0.5), - bool useDefaultColor = true) const; - - virtual void drawEntity( - const dynamics::Entity* entity, - const Eigen::Vector4d& color = Eigen::Vector4d::Constant(0.5), - bool useDefaultColor = true) const; - - virtual void drawBodyNode( - const dynamics::BodyNode* bodyNode, - const Eigen::Vector4d& color = Eigen::Vector4d::Constant(0.5), - bool useDefaultColor = true, - bool recursive = false) const; - - virtual void drawShapeFrame( - const dynamics::ShapeFrame* shapeFrame, - const Eigen::Vector4d& color = Eigen::Vector4d::Constant(0.5), - bool useDefaultColor = true) const; - - virtual void drawShape( - const dynamics::Shape* shape, - const Eigen::Vector4d& color = Eigen::Vector4d::Constant(0.5)) const; - - virtual void drawPointMasses( - const std::vector pointMasses, - const Eigen::Vector4d& color = Eigen::Vector4d::Constant(0.5), - bool useDefaultColor = true) const; - - virtual void drawMarker( - const dynamics::Marker* marker, - const Eigen::Vector4d& color = Eigen::Vector4d::Constant(0.5), - bool useDefaultColor = true) const; - - /// \brief - simulation::WorldPtr mWorld; - - /// \brief - int mPlayFrame; - - /// \brief - bool mPlay; - - /// \brief - bool mSimulating; - - /// If true, render point masses of soft bodies - bool mShowPointMasses; - - /// If true, render markers - bool mShowMarkers; - - /// \brief Array of graph windows - std::vector mGraphWindows; -}; +using SimWindow = ::dart::gui::glut::SimWindow; } // namespace gui } // namespace dart diff --git a/dart/gui/SoftSimWindow.hpp b/dart/gui/SoftSimWindow.hpp index 0fde069c84968..93f36c7c2c00e 100644 --- a/dart/gui/SoftSimWindow.hpp +++ b/dart/gui/SoftSimWindow.hpp @@ -39,31 +39,15 @@ #ifndef DART_GUI_SOFTSIMWINDOW_HPP_ #define DART_GUI_SOFTSIMWINDOW_HPP_ -#include "dart/gui/SimWindow.hpp" +#warning "This file is deprecated in DART 6.1. "\ + "Please use dart/gui/glut/SoftSimWindow.hpp instead." + +#include "dart/gui/glut/SoftSimWindow.hpp" namespace dart { namespace gui { -/// \brief -class SoftSimWindow : public SimWindow -{ -public: - /// \brief - SoftSimWindow(); - - /// \brief - virtual ~SoftSimWindow(); - - /// \brief - void keyboard(unsigned char key, int x, int y) override; - -protected: - /// \brief - bool mShowPointMasses; - - /// \brief - bool mShowMeshs; -}; +using SoftSimWindow = ::dart::gui::glut::SoftSimWindow; } // namespace gui } // namespace dart diff --git a/dart/gui/Win2D.hpp b/dart/gui/Win2D.hpp index c985c09320fee..823dcf450a650 100644 --- a/dart/gui/Win2D.hpp +++ b/dart/gui/Win2D.hpp @@ -33,48 +33,15 @@ #ifndef DART_GUI_WIN2D_HPP_ #define DART_GUI_WIN2D_HPP_ -#include "dart/gui/GlutWindow.hpp" +#warning "This file is deprecated in DART 6.1. "\ + "Please use dart/gui/glut/Win2D.hpp instead." + +#include "dart/gui/glut/Win2D.hpp" namespace dart { namespace gui { -/// \brief -class Win2D : public GlutWindow { -public: - /// \brief - Win2D(); - - /// \brief - void resize(int _w, int _h) override; - - /// \brief - void render() override; - - /// \brief - void keyboard(unsigned char _key, int _x, int _y) override; - - /// \brief - void click(int _button, int _state, int _x, int _y) override; - - /// \brief - void drag(int _x, int _y) override; - - /// \brief - virtual void initGL(); - - /// \brief - virtual void draw() = 0; - -protected: - /// \brief - bool mTranslate; - - /// \brief - double mTransX; - - /// \brief - double mTransY; -}; +using Win2D = ::dart::gui::glut::Win2D; } // namespace gui } // namespace dart diff --git a/dart/gui/Win3D.hpp b/dart/gui/Win3D.hpp index 8407f889c7ba9..fcf418743aa23 100644 --- a/dart/gui/Win3D.hpp +++ b/dart/gui/Win3D.hpp @@ -33,43 +33,15 @@ #ifndef DART_GUI_WIN3D_HPP_ #define DART_GUI_WIN3D_HPP_ -#include +#warning "This file is deprecated in DART 6.1. "\ + "Please use dart/gui/glut/Win3D.hpp instead." -#include "dart/gui/GlutWindow.hpp" -#include "dart/gui/Trackball.hpp" +#include "dart/gui/glut/Win3D.hpp" namespace dart { namespace gui { -class Win3D : public GlutWindow { -public: - Win3D(); - - void initWindow(int _w, int _h, const char* _name) override; - void resize(int _w, int _h) override; - void render() override; - - void keyboard(unsigned char _key, int _x, int _y) override; - void click(int _button, int _state, int _x, int _y) override; - void drag(int _x, int _y) override; - - virtual void initGL(); - virtual void initLights(); - - virtual void draw()=0; - -protected: - Trackball mTrackBall; - Eigen::Vector3d mTrans; - Eigen::Vector3d mEye; - Eigen::Vector3d mUp; - float mZoom; - float mPersp; - - bool mRotate; - bool mTranslate; - bool mZooming; -}; +using Win3D = ::dart::gui::glut::Win3D; } // namespace gui } // namespace dart diff --git a/dart/gui/glut/CMakeLists.txt b/dart/gui/glut/CMakeLists.txt new file mode 100644 index 0000000000000..9ddaccad48d3d --- /dev/null +++ b/dart/gui/glut/CMakeLists.txt @@ -0,0 +1,25 @@ +# Search all header and source files +file(GLOB hdrs "*.hpp") +file(GLOB srcs "*.cpp") +dart_add_gui_headers(${hdrs} ${detail_hdrs}) +dart_add_gui_sources(${srcs} ${detail_srcs}) + +# Generate header for this namespace +dart_get_filename_components(header_names "gui_glut_headers headers" ${hdrs}) +dart_generate_include_header_list( + gui_glut_headers + "dart/gui/glut/" + "gui_glut_headers headers" + ${header_names} +) +configure_file( + ${CMAKE_CURRENT_SOURCE_DIR}/glut.hpp.in + ${CMAKE_CURRENT_BINARY_DIR}/glut.hpp +) + +# Install +install( + FILES ${hdrs} ${CMAKE_CURRENT_BINARY_DIR}/glut.hpp + DESTINATION include/dart/gui/glut + COMPONENT headers +) diff --git a/dart/gui/glut/GLUTFuncs.cpp b/dart/gui/glut/GLUTFuncs.cpp new file mode 100644 index 0000000000000..8b763ba6f1351 --- /dev/null +++ b/dart/gui/glut/GLUTFuncs.cpp @@ -0,0 +1,79 @@ +/* + * Copyright (c) 2011-2016, Graphics Lab, Georgia Tech Research Corporation + * Copyright (c) 2011-2016, Humanoid Lab, Georgia Tech Research Corporation + * Copyright (c) 2016, Personal Robotics Lab, Carnegie Mellon University + * All rights reserved. + * + * This file is provided under the following "BSD-style" License: + * Redistribution and use in source and binary forms, with or + * without modification, are permitted provided that the following + * conditions are met: + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following + * disclaimer in the documentation and/or other materials provided + * with the distribution. + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND + * CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, + * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF + * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN + * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ + +#include "dart/gui/glut/GLUTFuncs.hpp" + +#include +#include +#include + +#include + +#include "dart/gui/LoadOpengl.hpp" +#include "dart/gui/glut/LoadGlut.hpp" + +namespace dart { +namespace gui { +namespace glut { + +void drawStringOnScreen(float x, float y, const std::string& s, bool bigFont) +{ + // draws text on the screen + GLint oldMode; + glGetIntegerv(GL_MATRIX_MODE, &oldMode); + glMatrixMode(GL_PROJECTION); + + glPushMatrix(); + glLoadIdentity(); + gluOrtho2D(0.0, 1.0, 0.0, 1.0); + + glMatrixMode(GL_MODELVIEW); + glPushMatrix(); + glLoadIdentity(); + glRasterPos2f(x, y); + unsigned int length = s.length(); + for (unsigned int c = 0; c < length; c++) + { + if (bigFont) + glutBitmapCharacter(GLUT_BITMAP_HELVETICA_18, s.at(c) ); + else + glutBitmapCharacter(GLUT_BITMAP_HELVETICA_10, s.at(c) ); + } + glPopMatrix(); + + glMatrixMode(GL_PROJECTION); + glPopMatrix(); + glMatrixMode(oldMode); +} + +} // namespace glut +} // namespace gui +} // namespace dart diff --git a/dart/gui/glut/GLUTFuncs.hpp b/dart/gui/glut/GLUTFuncs.hpp new file mode 100644 index 0000000000000..061dbb674fd94 --- /dev/null +++ b/dart/gui/glut/GLUTFuncs.hpp @@ -0,0 +1,48 @@ +/* + * Copyright (c) 2011-2016, Graphics Lab, Georgia Tech Research Corporation + * Copyright (c) 2011-2016, Humanoid Lab, Georgia Tech Research Corporation + * Copyright (c) 2016, Personal Robotics Lab, Carnegie Mellon University + * All rights reserved. + * + * This file is provided under the following "BSD-style" License: + * Redistribution and use in source and binary forms, with or + * without modification, are permitted provided that the following + * conditions are met: + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following + * disclaimer in the documentation and/or other materials provided + * with the distribution. + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND + * CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, + * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF + * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN + * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef DART_GUI_GLUT_GLFUNCS_HPP_ +#define DART_GUI_GLUT_GLFUNCS_HPP_ + +#include + +namespace dart { +namespace gui { +namespace glut { + +void drawStringOnScreen( + float x, float y, const std::string& s, bool bigFont = true); + +} // namespace glut +} // namespace gui +} // namespace dart + +#endif // DART_GUI_GLUT_GLFUNCS_HPP_ diff --git a/dart/gui/GlutWindow.cpp b/dart/gui/glut/GlutWindow.cpp similarity index 82% rename from dart/gui/GlutWindow.cpp rename to dart/gui/glut/GlutWindow.cpp index bdeaf8e7b582a..46045eb295e76 100644 --- a/dart/gui/GlutWindow.cpp +++ b/dart/gui/glut/GlutWindow.cpp @@ -30,7 +30,7 @@ * POSSIBILITY OF SUCH DAMAGE. */ -#include "dart/gui/GlutWindow.hpp" +#include "dart/gui/glut/GlutWindow.hpp" #include "dart/external/lodepng/lodepng.h" @@ -48,17 +48,18 @@ #include #include "dart/common/Console.hpp" -#include "dart/gui/LoadGlut.hpp" +#include "dart/gui/glut/LoadGlut.hpp" #include "dart/gui/GLFuncs.hpp" #include "dart/gui/OpenGLRenderInterface.hpp" namespace dart { namespace gui { +namespace glut { -std::vector GlutWindow::mWindows; -std::vector GlutWindow::mWinIDs; +std::vector Window::mWindows; +std::vector Window::mWinIDs; -GlutWindow::GlutWindow() { +Window::Window() { mWinWidth = 0; mWinHeight = 0; mMouseX = 0; @@ -74,11 +75,11 @@ GlutWindow::GlutWindow() { mRI = nullptr; } -GlutWindow::~GlutWindow() { +Window::~Window() { delete mRI; } -void GlutWindow::initWindow(int _w, int _h, const char* _name) { +void Window::initWindow(int _w, int _h, const char* _name) { mWindows.push_back(this); mWinWidth = _w; @@ -113,53 +114,53 @@ void GlutWindow::initWindow(int _w, int _h, const char* _name) { // Note: We book the timer id 0 for the main rendering purpose. } -void GlutWindow::reshape(int _w, int _h) { +void Window::reshape(int _w, int _h) { current()->mScreenshotTemp = std::vector(_w*_h*4); current()->mScreenshotTemp2 = std::vector(_w*_h*4); current()->resize(_w, _h); } -void GlutWindow::keyEvent(unsigned char _key, int _x, int _y) { +void Window::keyEvent(unsigned char _key, int _x, int _y) { current()->keyboard(_key, _x, _y); } -void GlutWindow::specKeyEvent(int _key, int _x, int _y) { +void Window::specKeyEvent(int _key, int _x, int _y) { current()->specKey(_key, _x, _y); } -void GlutWindow::mouseClick(int _button, int _state, int _x, int _y) { +void Window::mouseClick(int _button, int _state, int _x, int _y) { current()->click(_button, _state, _x, _y); } -void GlutWindow::mouseDrag(int _x, int _y) { +void Window::mouseDrag(int _x, int _y) { current()->drag(_x, _y); } -void GlutWindow::mouseMove(int _x, int _y) { +void Window::mouseMove(int _x, int _y) { current()->move(_x, _y); } -void GlutWindow::refresh() { +void Window::refresh() { current()->render(); } -void GlutWindow::refreshTimer(int _val) { +void Window::refreshTimer(int _val) { current()->displayTimer(_val); } -void GlutWindow::displayTimer(int _val) { +void Window::displayTimer(int _val) { glutPostRedisplay(); glutTimerFunc(mDisplayTimeout, refreshTimer, _val); } -void GlutWindow::simTimer(int /*_val*/) { +void Window::simTimer(int /*_val*/) { } -void GlutWindow::runTimer(int _val) { +void Window::runTimer(int _val) { current()->simTimer(_val); } -bool GlutWindow::screenshot() { +bool Window::screenshot() { static int count = 0; const char directory[8] = "frames"; const char fileBase[8] = "Capture"; @@ -218,7 +219,7 @@ bool GlutWindow::screenshot() { } } -inline GlutWindow* GlutWindow::current() { +inline Window* Window::current() { int id = glutGetWindow(); for (unsigned int i = 0; i < mWinIDs.size(); i++) { if (mWinIDs.at(i) == id) { @@ -229,21 +230,22 @@ inline GlutWindow* GlutWindow::current() { exit(0); } -void GlutWindow::keyboard(unsigned char /*_key*/, int /*_x*/, int /*_y*/) { +void Window::keyboard(unsigned char /*_key*/, int /*_x*/, int /*_y*/) { // TODO(JS): Is 2d point information necessary for keyboard event? } -void GlutWindow::specKey(int /*_key*/, int /*_x*/, int /*_y*/) { +void Window::specKey(int /*_key*/, int /*_x*/, int /*_y*/) { } -void GlutWindow::click(int /*_button*/, int /*_state*/, int /*_x*/, int /*_y*/) { +void Window::click(int /*_button*/, int /*_state*/, int /*_x*/, int /*_y*/) { } -void GlutWindow::drag(int /*_x*/, int /*_y*/) { +void Window::drag(int /*_x*/, int /*_y*/) { } -void GlutWindow::move(int /*_x*/, int /*_y*/) { +void Window::move(int /*_x*/, int /*_y*/) { } +} // namespace glut } // namespace gui } // namespace dart diff --git a/dart/gui/glut/GlutWindow.hpp b/dart/gui/glut/GlutWindow.hpp new file mode 100644 index 0000000000000..a46f94048fe6b --- /dev/null +++ b/dart/gui/glut/GlutWindow.hpp @@ -0,0 +1,100 @@ +/* + * Copyright (c) 2011-2016, Graphics Lab, Georgia Tech Research Corporation + * Copyright (c) 2011-2016, Humanoid Lab, Georgia Tech Research Corporation + * Copyright (c) 2016, Personal Robotics Lab, Carnegie Mellon University + * All rights reserved. + * + * This file is provided under the following "BSD-style" License: + * Redistribution and use in source and binary forms, with or + * without modification, are permitted provided that the following + * conditions are met: + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following + * disclaimer in the documentation and/or other materials provided + * with the distribution. + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND + * CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, + * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF + * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN + * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef DART_GUI_GLUT_GLUTWINDOW_HPP_ +#define DART_GUI_GLUT_GLUTWINDOW_HPP_ + +#include + +#include "dart/gui/LoadOpengl.hpp" +#include "dart/gui/RenderInterface.hpp" + +namespace dart { +namespace gui { +namespace glut { + +/// \brief +class Window { +public: + Window(); + virtual ~Window(); + + /// \warning This function should be called once. + virtual void initWindow(int _w, int _h, const char* _name); + + // callback functions + static void reshape(int _w, int _h); + static void keyEvent(unsigned char _key, int _x, int _y); + static void specKeyEvent(int _key, int _x, int _y); + static void mouseClick(int _button, int _state, int _x, int _y); + static void mouseDrag(int _x, int _y); + static void mouseMove(int _x, int _y); + static void refresh(); + static void refreshTimer(int _val); + static void runTimer(int _val); + + static Window* current(); + static std::vector mWindows; + static std::vector mWinIDs; + +protected: + // callback implementation + virtual void resize(int _w, int _h) = 0; + virtual void render() = 0; + virtual void keyboard(unsigned char _key, int _x, int _y); + virtual void specKey(int _key, int _x, int _y); + virtual void click(int _button, int _state, int _x, int _y); + virtual void drag(int _x, int _y); + virtual void move(int _x, int _y); + virtual void displayTimer(int _val); + virtual void simTimer(int _val); + + virtual bool screenshot(); + + int mWinWidth; + int mWinHeight; + int mMouseX; + int mMouseY; + double mDisplayTimeout; + bool mMouseDown; + bool mMouseDrag; + bool mCapture; + double mBackground[4]; + gui::RenderInterface* mRI; + std::vector mScreenshotTemp; + std::vector mScreenshotTemp2; +}; + +} // namespace glut +} // namespace gui +} // namespace dart + +#endif // DART_GUI_GLUT_GLUTWINDOW_HPP_ diff --git a/dart/gui/GraphWindow.cpp b/dart/gui/glut/GraphWindow.cpp similarity index 93% rename from dart/gui/GraphWindow.cpp rename to dart/gui/glut/GraphWindow.cpp index 5c201f7704070..7b17172c9cde6 100644 --- a/dart/gui/GraphWindow.cpp +++ b/dart/gui/glut/GraphWindow.cpp @@ -36,17 +36,18 @@ * POSSIBILITY OF SUCH DAMAGE. */ -#include "dart/gui/GraphWindow.hpp" +#include "dart/gui/glut/GraphWindow.hpp" #include #include #include -#include "dart/gui/GLFuncs.hpp" -#include "dart/gui/LoadGlut.hpp" +#include "dart/gui/glut/GLUTFuncs.hpp" +#include "dart/gui/glut/LoadGlut.hpp" namespace dart { namespace gui { +namespace glut { GraphWindow::GraphWindow() : Win2D() { @@ -94,7 +95,7 @@ void GraphWindow::draw() { #endif std::string frame(buff); glColor3f(0.0, 0.0, 0.0); - gui::drawStringOnScreen(xPos, 0.01f, frame, false); + drawStringOnScreen(xPos, 0.01f, frame, false); xPos += 0.2; } @@ -109,7 +110,7 @@ void GraphWindow::draw() { #endif std::string frame(buff); glColor3f(0.0, 0.0, 0.0); - gui::drawStringOnScreen(0.01f, yPos, frame, false); + drawStringOnScreen(0.01f, yPos, frame, false); yPos += 0.2; } } @@ -126,5 +127,6 @@ void GraphWindow::setData(Eigen::VectorXd _data) { mData = _data; } +} // namespace glut } // namespace gui } // namespace dart diff --git a/dart/gui/glut/GraphWindow.hpp b/dart/gui/glut/GraphWindow.hpp new file mode 100644 index 0000000000000..2996a95fc6e54 --- /dev/null +++ b/dart/gui/glut/GraphWindow.hpp @@ -0,0 +1,76 @@ +/* + * Copyright (c) 2015-2016, Graphics Lab, Georgia Tech Research Corporation + * Copyright (c) 2015-2016, Humanoid Lab, Georgia Tech Research Corporation + * Copyright (c) 2016, Personal Robotics Lab, Carnegie Mellon University + * All rights reserved. + * + * This file is provided under the following "BSD-style" License: + * Redistribution and use in source and binary forms, with or + * without modification, are permitted provided that the following + * conditions are met: + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following + * disclaimer in the documentation and/or other materials provided + * with the distribution. + * * This code incorporates portions of Open Dynamics Engine + * (Copyright (c) 2001-2004, Russell L. Smith. All rights + * reserved.) and portions of FCL (Copyright (c) 2011, Willow + * Garage, Inc. All rights reserved.), which were released under + * the same BSD license as below + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND + * CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, + * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF + * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN + * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef DART_GUI_GLUT_GRAPHWINDOW_HPP_ +#define DART_GUI_GLUT_GRAPHWINDOW_HPP_ + +#include + +#include + +#include "dart/gui/glut/Win2D.hpp" + +namespace dart { +namespace gui { +namespace glut { + +/// \brief +class GraphWindow : public Win2D { +public: + /// \brief + GraphWindow(); + + /// \brief + virtual ~GraphWindow(); + + /// \brief + void draw() override; + + /// \brief + void keyboard(unsigned char _key, int _x, int _y) override; + + void setData(Eigen::VectorXd _data); + +protected: + Eigen::VectorXd mData; +}; + +} // namespace glut +} // namespace gui +} // namespace dart + +#endif // DART_GUI_GLUT_GRAPHWINDOW_HPP_ diff --git a/dart/gui/glut/LoadGlut.hpp b/dart/gui/glut/LoadGlut.hpp new file mode 100644 index 0000000000000..006c363f97742 --- /dev/null +++ b/dart/gui/glut/LoadGlut.hpp @@ -0,0 +1,46 @@ +/* + * Copyright (c) 2015-2016, Graphics Lab, Georgia Tech Research Corporation + * Copyright (c) 2015-2016, Humanoid Lab, Georgia Tech Research Corporation + * Copyright (c) 2016, Personal Robotics Lab, Carnegie Mellon University + * All rights reserved. + * + * This file is provided under the following "BSD-style" License: + * Redistribution and use in source and binary forms, with or + * without modification, are permitted provided that the following + * conditions are met: + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following + * disclaimer in the documentation and/or other materials provided + * with the distribution. + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND + * CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, + * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF + * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN + * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef DART_GUI_GLUT_LOADGLUT_HPP_ +#define DART_GUI_GLUT_LOADGLUT_HPP_ + +#if defined(_WIN32) + #include // To disable glut::exit() function + #include +#elif defined(__linux__) + #include +#elif defined(__APPLE__) + #include +#else + #error "Load OpenGL Error: What's your operating system?" +#endif + +#endif // DART_GUI_GLUT_LOADGLUT_HPP_ diff --git a/dart/gui/MotionBlurSimWindow.cpp b/dart/gui/glut/MotionBlurSimWindow.cpp similarity index 99% rename from dart/gui/MotionBlurSimWindow.cpp rename to dart/gui/glut/MotionBlurSimWindow.cpp index 6bad000c29f62..bddfedaa2a196 100644 --- a/dart/gui/MotionBlurSimWindow.cpp +++ b/dart/gui/glut/MotionBlurSimWindow.cpp @@ -19,7 +19,7 @@ #include "dart/constraint/ConstraintSolver.hpp" #include "dart/gui/GLFuncs.hpp" -#include "dart/gui/LoadGlut.hpp" +#include "dart/gui/glut/LoadGlut.hpp" namespace dart { namespace gui { diff --git a/dart/gui/glut/MotionBlurSimWindow.hpp b/dart/gui/glut/MotionBlurSimWindow.hpp new file mode 100644 index 0000000000000..070f232d302da --- /dev/null +++ b/dart/gui/glut/MotionBlurSimWindow.hpp @@ -0,0 +1,58 @@ +// +// MotionBlurSimWindow.hpp +// dart +// +// Created by Dong Xu on 1/22/17. +// +// + +#ifndef DART_GUI_GLUT_MOTIONBLURSIMWINDOW_HPP_ +#define DART_GUI_GLUT_MOTIONBLURSIMWINDOW_HPP_ + +#include +#include + +#include "dart/gui/glut/SimWindow.hpp" + +namespace dart { +namespace gui { +namespace glut { + +class MotionBlurSimWindow : public glut::SimWindow +{ +public: + /// \brief + MotionBlurSimWindow(); + + /// \brief + virtual ~MotionBlurSimWindow(); + + // Set the Quality of Motion Blur + // Default is 5 (record position of every frame) + // int from 0 (No motion blur) - 5 (Highest) + // The function takes value smaller than 0 as 0, larger than 5 as 5 + void setMotionBlurQuality(int _val); + + // Override the render function in dart/gui/Win3D.hpp + // To draw the motion image + // Render function is called once per GUI display time + // but in MotionBlurSimWindow, draw function will run in motion blur frequency + void render() override; + + // Override the display timer, + // Move the part of "step" in world function to the render function + void displayTimer(int _val) override; + +protected: + // Determines the frequency of the motion blur + // Default is 1, which means motion blur effect has the highest quality + // When set to m, motion blur record data every m frames + int mMotionBlurFrequency; + +}; // End of Class Definition + +} // namespace glut +} // namespace gui +} // namespace dart + +#endif // DART_GUI_GLUT_MOTIONBLURSIMWINDOW_HPP_ diff --git a/dart/gui/SimWindow.cpp b/dart/gui/glut/SimWindow.cpp similarity index 98% rename from dart/gui/SimWindow.cpp rename to dart/gui/glut/SimWindow.cpp index dec29f8592060..922f50993e362 100644 --- a/dart/gui/SimWindow.cpp +++ b/dart/gui/glut/SimWindow.cpp @@ -36,7 +36,7 @@ * POSSIBILITY OF SUCH DAMAGE. */ -#include "dart/gui/SimWindow.hpp" +#include "dart/gui/glut/SimWindow.hpp" #include #include @@ -59,13 +59,14 @@ #include "dart/dynamics/Marker.hpp" #include "dart/constraint/ConstraintSolver.hpp" #include "dart/collision/CollisionDetector.hpp" -#include "dart/gui/LoadGlut.hpp" -#include "dart/gui/GLFuncs.hpp" -#include "dart/gui/GraphWindow.hpp" +#include "dart/gui/glut/GLUTFuncs.hpp" +#include "dart/gui/glut/GraphWindow.hpp" +#include "dart/gui/glut/LoadGlut.hpp" #include "dart/utils/FileInfoWorld.hpp" namespace dart { namespace gui { +namespace glut { SimWindow::SimWindow() : Win3D() { @@ -207,7 +208,7 @@ void SimWindow::draw() { #endif std::string frame(buff); glColor3f(0.0, 0.0, 0.0); - gui::drawStringOnScreen(0.02f, 0.02f, frame); + gui::glut::drawStringOnScreen(0.02f, 0.02f, frame); glEnable(GL_LIGHTING); } @@ -551,5 +552,6 @@ void SimWindow::drawMarker(const dynamics::Marker* marker, mRI->popName(); } +} // namespace glut } // namespace gui } // namespace dart diff --git a/dart/gui/glut/SimWindow.hpp b/dart/gui/glut/SimWindow.hpp new file mode 100644 index 0000000000000..3e9595782eae0 --- /dev/null +++ b/dart/gui/glut/SimWindow.hpp @@ -0,0 +1,161 @@ +/* + * Copyright (c) 2013-2016, Graphics Lab, Georgia Tech Research Corporation + * Copyright (c) 2013-2016, Humanoid Lab, Georgia Tech Research Corporation + * Copyright (c) 2016, Personal Robotics Lab, Carnegie Mellon University + * All rights reserved. + * + * This file is provided under the following "BSD-style" License: + * Redistribution and use in source and binary forms, with or + * without modification, are permitted provided that the following + * conditions are met: + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following + * disclaimer in the documentation and/or other materials provided + * with the distribution. + * * This code incorporates portions of Open Dynamics Engine + * (Copyright (c) 2001-2004, Russell L. Smith. All rights + * reserved.) and portions of FCL (Copyright (c) 2011, Willow + * Garage, Inc. All rights reserved.), which were released under + * the same BSD license as below + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND + * CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, + * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF + * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN + * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef DART_GUI_GLUT_SIMWINDOW_HPP_ +#define DART_GUI_GLUT_SIMWINDOW_HPP_ + +#include + +#include + +#include "dart/common/Deprecated.hpp" +#include "dart/gui/glut/Win3D.hpp" +#include "dart/simulation/World.hpp" + +namespace dart { +namespace gui { +namespace glut { + +class GraphWindow; + +/// \brief +class SimWindow : public Win3D { +public: + /// \brief + SimWindow(); + + /// \brief + virtual ~SimWindow(); + + /// \brief + virtual void timeStepping(); + + virtual void drawWorld() const; + + virtual void drawSkeletons() const; + + DART_DEPRECATED(6.0) + virtual void drawSkels(); + + DART_DEPRECATED(6.0) + virtual void drawEntities(); + + /// \brief + void displayTimer(int _val) override; + + /// \brief + void draw() override; + + /// \brief + void keyboard(unsigned char _key, int _x, int _y) override; + + /// \brief + void setWorld(dart::simulation::WorldPtr _world); + + /// \brief Save world in 'tempWorld.txt' + void saveWorld(); + + /// \brief Plot _data in a 2D window + void plot(Eigen::VectorXd& _data); +// bool isSimulating() const { return mSimulating; } + +// void setSimulatingFlag(int _flag) { mSimulating = _flag; } + +protected: + + virtual void drawSkeleton( + const dynamics::Skeleton* skeleton, + const Eigen::Vector4d& color = Eigen::Vector4d::Constant(0.5), + bool useDefaultColor = true) const; + + virtual void drawEntity( + const dynamics::Entity* entity, + const Eigen::Vector4d& color = Eigen::Vector4d::Constant(0.5), + bool useDefaultColor = true) const; + + virtual void drawBodyNode( + const dynamics::BodyNode* bodyNode, + const Eigen::Vector4d& color = Eigen::Vector4d::Constant(0.5), + bool useDefaultColor = true, + bool recursive = false) const; + + virtual void drawShapeFrame( + const dynamics::ShapeFrame* shapeFrame, + const Eigen::Vector4d& color = Eigen::Vector4d::Constant(0.5), + bool useDefaultColor = true) const; + + virtual void drawShape( + const dynamics::Shape* shape, + const Eigen::Vector4d& color = Eigen::Vector4d::Constant(0.5)) const; + + virtual void drawPointMasses( + const std::vector pointMasses, + const Eigen::Vector4d& color = Eigen::Vector4d::Constant(0.5), + bool useDefaultColor = true) const; + + virtual void drawMarker( + const dynamics::Marker* marker, + const Eigen::Vector4d& color = Eigen::Vector4d::Constant(0.5), + bool useDefaultColor = true) const; + + /// \brief + simulation::WorldPtr mWorld; + + /// \brief + int mPlayFrame; + + /// \brief + bool mPlay; + + /// \brief + bool mSimulating; + + /// If true, render point masses of soft bodies + bool mShowPointMasses; + + /// If true, render markers + bool mShowMarkers; + + /// \brief Array of graph windows + std::vector mGraphWindows; +}; + +} // namespace glut +} // namespace gui +} // namespace dart + +#endif // DART_GUI_GLUT_SIMWINDOW_HPP_ diff --git a/dart/gui/SoftSimWindow.cpp b/dart/gui/glut/SoftSimWindow.cpp similarity index 96% rename from dart/gui/SoftSimWindow.cpp rename to dart/gui/glut/SoftSimWindow.cpp index 3433ac8779adb..55b2df26762ee 100644 --- a/dart/gui/SoftSimWindow.cpp +++ b/dart/gui/glut/SoftSimWindow.cpp @@ -36,12 +36,13 @@ * POSSIBILITY OF SUCH DAMAGE. */ -#include "dart/gui/SoftSimWindow.hpp" +#include "dart/gui/glut/SoftSimWindow.hpp" -#include "dart/gui/LoadGlut.hpp" +#include "dart/gui/glut/LoadGlut.hpp" namespace dart { namespace gui { +namespace glut { SoftSimWindow::SoftSimWindow() : SimWindow(), @@ -101,5 +102,6 @@ void SoftSimWindow::keyboard(unsigned char key, int x, int y) glutPostRedisplay(); } +} // namespace glut } // namespace gui } // namespace dart diff --git a/dart/gui/glut/SoftSimWindow.hpp b/dart/gui/glut/SoftSimWindow.hpp new file mode 100644 index 0000000000000..4776febf36d09 --- /dev/null +++ b/dart/gui/glut/SoftSimWindow.hpp @@ -0,0 +1,72 @@ +/* + * Copyright (c) 2013-2016, Graphics Lab, Georgia Tech Research Corporation + * Copyright (c) 2013-2016, Humanoid Lab, Georgia Tech Research Corporation + * Copyright (c) 2016, Personal Robotics Lab, Carnegie Mellon University + * All rights reserved. + * + * This file is provided under the following "BSD-style" License: + * Redistribution and use in source and binary forms, with or + * without modification, are permitted provided that the following + * conditions are met: + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following + * disclaimer in the documentation and/or other materials provided + * with the distribution. + * * This code incorporates portions of Open Dynamics Engine + * (Copyright (c) 2001-2004, Russell L. Smith. All rights + * reserved.) and portions of FCL (Copyright (c) 2011, Willow + * Garage, Inc. All rights reserved.), which were released under + * the same BSD license as below + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND + * CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, + * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF + * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN + * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef DART_GUI_GLUT_SOFTSIMWINDOW_HPP_ +#define DART_GUI_GLUT_SOFTSIMWINDOW_HPP_ + +#include "dart/gui/glut/SimWindow.hpp" + +namespace dart { +namespace gui { +namespace glut { + +/// \brief +class SoftSimWindow : public SimWindow +{ +public: + /// \brief + SoftSimWindow(); + + /// \brief + virtual ~SoftSimWindow(); + + /// \brief + void keyboard(unsigned char key, int x, int y) override; + +protected: + /// \brief + bool mShowPointMasses; + + /// \brief + bool mShowMeshs; +}; + +} // namespace glut +} // namespace gui +} // namespace dart + +#endif // DART_GUI_SOFTSIMWINDOW_HPP_ diff --git a/dart/gui/Win2D.cpp b/dart/gui/glut/Win2D.cpp similarity index 96% rename from dart/gui/Win2D.cpp rename to dart/gui/glut/Win2D.cpp index 999f05a6f7795..315edf8cafb3f 100644 --- a/dart/gui/Win2D.cpp +++ b/dart/gui/glut/Win2D.cpp @@ -30,16 +30,17 @@ * POSSIBILITY OF SUCH DAMAGE. */ -#include "dart/gui/Win2D.hpp" +#include "dart/gui/glut/Win2D.hpp" #include -#include "dart/gui/LoadGlut.hpp" +#include "dart/gui/glut/LoadGlut.hpp" namespace dart { namespace gui { +namespace glut { -Win2D::Win2D() : GlutWindow() { +Win2D::Win2D() : glut::Window() { mTransX = 0; mTransY = 0; mTranslate = false; @@ -154,5 +155,6 @@ void Win2D::initGL() { glEnable(GL_LINE_SMOOTH); } +} // namespace glut } // namespace gui } // namespace dart diff --git a/dart/gui/glut/Win2D.hpp b/dart/gui/glut/Win2D.hpp new file mode 100644 index 0000000000000..e94c0d2a0d485 --- /dev/null +++ b/dart/gui/glut/Win2D.hpp @@ -0,0 +1,83 @@ +/* + * Copyright (c) 2011-2016, Graphics Lab, Georgia Tech Research Corporation + * Copyright (c) 2011-2016, Humanoid Lab, Georgia Tech Research Corporation + * Copyright (c) 2016, Personal Robotics Lab, Carnegie Mellon University + * All rights reserved. + * + * This file is provided under the following "BSD-style" License: + * Redistribution and use in source and binary forms, with or + * without modification, are permitted provided that the following + * conditions are met: + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following + * disclaimer in the documentation and/or other materials provided + * with the distribution. + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND + * CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, + * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF + * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN + * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef DART_GUI_GLUT_WIN2D_HPP_ +#define DART_GUI_GLUT_WIN2D_HPP_ + +#include "dart/gui/glut/GlutWindow.hpp" + +namespace dart { +namespace gui { +namespace glut { + +/// \brief +class Win2D : public glut::Window { +public: + /// \brief + Win2D(); + + /// \brief + void resize(int _w, int _h) override; + + /// \brief + void render() override; + + /// \brief + void keyboard(unsigned char _key, int _x, int _y) override; + + /// \brief + void click(int _button, int _state, int _x, int _y) override; + + /// \brief + void drag(int _x, int _y) override; + + /// \brief + virtual void initGL(); + + /// \brief + virtual void draw() = 0; + +protected: + /// \brief + bool mTranslate; + + /// \brief + double mTransX; + + /// \brief + double mTransY; +}; + +} // namespace glut +} // namespace gui +} // namespace dart + +#endif // DART_GUI_GLUT_WIN2D_HPP_ diff --git a/dart/gui/Win3D.cpp b/dart/gui/glut/Win3D.cpp similarity index 88% rename from dart/gui/Win3D.cpp rename to dart/gui/glut/Win3D.cpp index 1ad6de1714e7c..87e7dc6a5b432 100644 --- a/dart/gui/Win3D.cpp +++ b/dart/gui/glut/Win3D.cpp @@ -30,18 +30,20 @@ * POSSIBILITY OF SUCH DAMAGE. */ -#include "dart/gui/Win3D.hpp" +#include "dart/gui/glut/Win3D.hpp" #include #include "dart/math/Constants.hpp" -#include "dart/gui/LoadGlut.hpp" +#include "dart/gui/glut/LoadGlut.hpp" namespace dart { namespace gui { +namespace glut { +//============================================================================== Win3D::Win3D() - : GlutWindow(), + : Window(), mTrans(0.0, 0.0, 0.0), mEye(0.0, 0.0, 1.0), mUp(0.0, 1.0, 0.0), @@ -49,17 +51,23 @@ Win3D::Win3D() mPersp(45.0), mRotate(false), mTranslate(false), - mZooming(false) { + mZooming(false) +{ + // Do nothing } -void Win3D::initWindow(int _w, int _h, const char* _name) { - GlutWindow::initWindow(_w, _h, _name); +//============================================================================== +void Win3D::initWindow(int _w, int _h, const char* _name) +{ + Window::initWindow(_w, _h, _name); int smaller = _w < _h ? _w : _h; mTrackBall.setTrackball(Eigen::Vector2d(_w*0.5, _h*0.5), smaller/2.5); } -void Win3D::resize(int _w, int _h) { +//============================================================================== +void Win3D::resize(int _w, int _h) +{ mWinWidth = _w; mWinHeight = _h; @@ -79,7 +87,9 @@ void Win3D::resize(int _w, int _h) { glutPostRedisplay(); } -void Win3D::keyboard(unsigned char _key, int /*_x*/, int /*_y*/) { +//============================================================================== +void Win3D::keyboard(unsigned char _key, int /*_x*/, int /*_y*/) +{ switch (_key) { case ',': // slow down mDisplayTimeout +=2; @@ -109,7 +119,9 @@ void Win3D::keyboard(unsigned char _key, int /*_x*/, int /*_y*/) { // printf("ascii key: %lu\n", key); } -void Win3D::click(int _button, int _state, int _x, int _y) { +//============================================================================== +void Win3D::click(int _button, int _state, int _x, int _y) +{ mMouseDown = !mMouseDown; int mask = glutGetModifiers(); if (mMouseDown) { @@ -141,7 +153,9 @@ void Win3D::click(int _button, int _state, int _x, int _y) { glutPostRedisplay(); } -void Win3D::drag(int _x, int _y) { +//============================================================================== +void Win3D::drag(int _x, int _y) +{ double deltaX = _x - mMouseX; double deltaY = _y - mMouseY; @@ -162,7 +176,9 @@ void Win3D::drag(int _x, int _y) { glutPostRedisplay(); } -void Win3D::render() { +//============================================================================== +void Win3D::render() +{ glMatrixMode(GL_PROJECTION); glLoadIdentity(); gluPerspective(mPersp, @@ -220,7 +236,9 @@ void Win3D::render() { screenshot(); } -void Win3D::initGL() { +//============================================================================== +void Win3D::initGL() +{ glClearColor(mBackground[0], mBackground[1], mBackground[2], mBackground[3]); glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); glEnable(GL_BLEND); @@ -230,7 +248,9 @@ void Win3D::initGL() { glPolygonMode(GL_FRONT, GL_FILL); } -void Win3D::initLights() { +//============================================================================== +void Win3D::initLights() +{ static float ambient[] = {0.2, 0.2, 0.2, 1.0}; static float diffuse[] = {0.6, 0.6, 0.6, 1.0}; static float front_mat_shininess[] = {60.0}; @@ -308,5 +328,6 @@ void accPerspective(GLdouble fovy, GLdouble aspect, pixdx, pixdy, eyedx, eyedy, focus); } +} // namespace glut } // namespace gui } // namespace dart diff --git a/dart/gui/glut/Win3D.hpp b/dart/gui/glut/Win3D.hpp new file mode 100644 index 0000000000000..912d15128c64b --- /dev/null +++ b/dart/gui/glut/Win3D.hpp @@ -0,0 +1,78 @@ +/* + * Copyright (c) 2011-2016, Graphics Lab, Georgia Tech Research Corporation + * Copyright (c) 2011-2016, Humanoid Lab, Georgia Tech Research Corporation + * Copyright (c) 2016, Personal Robotics Lab, Carnegie Mellon University + * All rights reserved. + * + * This file is provided under the following "BSD-style" License: + * Redistribution and use in source and binary forms, with or + * without modification, are permitted provided that the following + * conditions are met: + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following + * disclaimer in the documentation and/or other materials provided + * with the distribution. + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND + * CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, + * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF + * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN + * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef DART_GUI_GLUT_WIN3D_HPP_ +#define DART_GUI_GLUT_WIN3D_HPP_ + +#include + +#include "dart/gui/Trackball.hpp" +#include "dart/gui/glut/GlutWindow.hpp" + +namespace dart { +namespace gui { +namespace glut { + +class Win3D : public glut::Window { +public: + Win3D(); + + void initWindow(int _w, int _h, const char* _name) override; + void resize(int _w, int _h) override; + void render() override; + + void keyboard(unsigned char _key, int _x, int _y) override; + void click(int _button, int _state, int _x, int _y) override; + void drag(int _x, int _y) override; + + virtual void initGL(); + virtual void initLights(); + + virtual void draw()=0; + +protected: + Trackball mTrackBall; + Eigen::Vector3d mTrans; + Eigen::Vector3d mEye; + Eigen::Vector3d mUp; + float mZoom; + float mPersp; + + bool mRotate; + bool mTranslate; + bool mZooming; +}; + +} // namespace glut +} // namespace gui +} // namespace dart + +#endif // DART_GUI_GLUT_WIN3D_HPP_ diff --git a/dart/gui/glut/glut.hpp.in b/dart/gui/glut/glut.hpp.in new file mode 100644 index 0000000000000..22537f837dbb5 --- /dev/null +++ b/dart/gui/glut/glut.hpp.in @@ -0,0 +1,3 @@ +// Automatically generated file by cmake + +${gui_glut_headers} diff --git a/dart/simulation/World.hpp b/dart/simulation/World.hpp index 865f34524fd78..c3e65384da294 100644 --- a/dart/simulation/World.hpp +++ b/dart/simulation/World.hpp @@ -47,6 +47,7 @@ #include "dart/common/Timer.hpp" #include "dart/common/NameManager.hpp" +#include "dart/common/SmartPointer.hpp" #include "dart/common/Subject.hpp" #include "dart/dynamics/SimpleFrame.hpp" #include "dart/dynamics/Skeleton.hpp" @@ -73,6 +74,8 @@ class CollisionResult; namespace simulation { +DART_COMMON_DECLARE_SHARED_WEAK(World) + /// class World class World : public virtual common::Subject { @@ -310,8 +313,6 @@ class World : public virtual common::Subject }; -typedef std::shared_ptr WorldPtr; - } // namespace simulation } // namespace dart diff --git a/examples/rigidCubes/MyWindow.hpp b/examples/rigidCubes/MyWindow.hpp index c2192f2675084..c1d82a621672a 100644 --- a/examples/rigidCubes/MyWindow.hpp +++ b/examples/rigidCubes/MyWindow.hpp @@ -34,24 +34,19 @@ #define EXAMPLES_CUBES_MYWINDOW_HPP_ #include -#include +#include -/// \brief -class MyWindow : public dart::gui::SimWindow { +class MyWindow : public dart::gui::glut::SimWindow +{ public: - /// \brief MyWindow(); - /// \brief virtual ~MyWindow(); - /// \brief void timeStepping() override; - /// \brief void drawWorld() const override; - /// \brief void keyboard(unsigned char _key, int _x, int _y) override; private: diff --git a/examples/rigidCubes/Main.cpp b/examples/rigidCubes/main.cpp similarity index 86% rename from examples/rigidCubes/Main.cpp rename to examples/rigidCubes/main.cpp index aba51e820b90a..11e558f7c49b1 100644 --- a/examples/rigidCubes/Main.cpp +++ b/examples/rigidCubes/main.cpp @@ -39,16 +39,18 @@ int main(int argc, char* argv[]) { - // create and initialize the world - dart::simulation::WorldPtr myWorld - = dart::utils::SkelParser::readWorld("dart://sample/skel/cubes.skel"); - assert(myWorld != nullptr); - Eigen::Vector3d gravity(0.0, -9.81, 0.0); - myWorld->setGravity(gravity); + // Create and initialize the world + auto world = dart::utils::SkelParser::readWorld("dart://sample/skel/cubes.skel"); + if (!world) + { + dterr << "Failed to load world.\n"; + exit(EXIT_FAILURE); + } + world->setGravity(Eigen::Vector3d(0.0, -9.81, 0.0)); - // create a window and link it to the world + // Create a window and link it to the world MyWindow window; - window.setWorld(myWorld); + window.setWorld(world); std::cout << "space bar: simulation on/off" << std::endl; std::cout << "'p': playback/stop" << std::endl; From 8a62cb2370b15ca2cb45d5b164d920d70d260f0b Mon Sep 17 00:00:00 2001 From: Jeongseok Lee Date: Wed, 18 Jul 2018 23:04:01 -0700 Subject: [PATCH 02/12] Fix incorrect deprecation version --- dart/gui/GLFuncs.cpp | 6 ++---- dart/gui/GLFuncs.hpp | 4 ++-- dart/gui/GlutWindow.hpp | 2 +- dart/gui/LoadGlut.hpp | 2 +- dart/gui/MotionBlurSimWindow.hpp | 2 +- dart/gui/SimWindow.hpp | 2 +- dart/gui/SoftSimWindow.hpp | 2 +- dart/gui/Win2D.hpp | 2 +- dart/gui/Win3D.hpp | 2 +- 9 files changed, 11 insertions(+), 13 deletions(-) diff --git a/dart/gui/GLFuncs.cpp b/dart/gui/GLFuncs.cpp index 7369c4e0eb39f..bce15c9c581d1 100644 --- a/dart/gui/GLFuncs.cpp +++ b/dart/gui/GLFuncs.cpp @@ -47,11 +47,9 @@ namespace dart { namespace gui { -void drawStringOnScreen(float, float, const std::string&, bool) +void drawStringOnScreen(float x, float y, const std::string& s, bool bigFont) { - dtwarn << "dart::gui::drawStringOnScreen() is deprecated in DART 6.1. " - << "Please use dart::gui::glut::drawStringOnScreen() instead. " - << "Ignoring this action.\n"; + glut::drawStringOnScreen(x, y, s, bigFont); } // draw a 3D arrow starting from pt along dir, the arrowhead is on the other end diff --git a/dart/gui/GLFuncs.hpp b/dart/gui/GLFuncs.hpp index d52d97ddf2d47..2e6df3c662918 100644 --- a/dart/gui/GLFuncs.hpp +++ b/dart/gui/GLFuncs.hpp @@ -40,10 +40,10 @@ namespace dart { namespace gui { -/// \deprecated Deprecated in 6.1. Please use +/// \deprecated Deprecated in 6.6. Please use /// dart::gui::glut::drawStringOnScreen() instead in /// dart/gui/glut/GLUTFuncs.hpp file. -DART_DEPRECATED(6.1) +DART_DEPRECATED(6.6) void drawStringOnScreen(float _x, float _y, const std::string& _s, bool _bigFont = true); diff --git a/dart/gui/GlutWindow.hpp b/dart/gui/GlutWindow.hpp index b9afbf8cb5999..18b72c34526fa 100644 --- a/dart/gui/GlutWindow.hpp +++ b/dart/gui/GlutWindow.hpp @@ -35,7 +35,7 @@ #include "dart/gui/glut/GlutWindow.hpp" -#warning "This file is deprecated in DART 6.1. "\ +#warning "This file is deprecated in DART 6.6. "\ "Please use dart/gui/glut/GlutWindow.hpp instead." namespace dart { diff --git a/dart/gui/LoadGlut.hpp b/dart/gui/LoadGlut.hpp index d062baed1afea..f568afa532972 100644 --- a/dart/gui/LoadGlut.hpp +++ b/dart/gui/LoadGlut.hpp @@ -33,7 +33,7 @@ #ifndef DART_GUI_LOADGLUT_HPP_ #define DART_GUI_LOADGLUT_HPP_ -#warning "This file is deprecated in DART 6.1. "\ +#warning "This file is deprecated in DART 6.6. "\ "Please use dart/gui/glut/LoadGlut.hpp instead." #include "dart/gui/glut/LoadGlut.hpp" diff --git a/dart/gui/MotionBlurSimWindow.hpp b/dart/gui/MotionBlurSimWindow.hpp index fc50ddc994383..edc432c71577f 100644 --- a/dart/gui/MotionBlurSimWindow.hpp +++ b/dart/gui/MotionBlurSimWindow.hpp @@ -9,7 +9,7 @@ #ifndef DART_GUI_MOTIONBLURSIMWINDOW_HPP_ #define DART_GUI_MOTIONBLURSIMWINDOW_HPP_ -#warning "This file is deprecated in DART 6.1. "\ +#warning "This file is deprecated in DART 6.6. "\ "Please use dart/gui/glut/MotionBlurSimWindow.hpp instead." #include "dart/gui/glut/MotionBlurSimWindow.hpp" diff --git a/dart/gui/SimWindow.hpp b/dart/gui/SimWindow.hpp index d7135d5aac3c4..1f8fa86a42ebf 100644 --- a/dart/gui/SimWindow.hpp +++ b/dart/gui/SimWindow.hpp @@ -39,7 +39,7 @@ #ifndef DART_GUI_SIMWINDOW_HPP_ #define DART_GUI_SIMWINDOW_HPP_ -#warning "This file is deprecated in DART 6.1. "\ +#warning "This file is deprecated in DART 6.6. "\ "Please use dart/gui/glut/SimWindow.hpp instead." #include "dart/gui/glut/SimWindow.hpp" diff --git a/dart/gui/SoftSimWindow.hpp b/dart/gui/SoftSimWindow.hpp index 93f36c7c2c00e..4f97b01721657 100644 --- a/dart/gui/SoftSimWindow.hpp +++ b/dart/gui/SoftSimWindow.hpp @@ -39,7 +39,7 @@ #ifndef DART_GUI_SOFTSIMWINDOW_HPP_ #define DART_GUI_SOFTSIMWINDOW_HPP_ -#warning "This file is deprecated in DART 6.1. "\ +#warning "This file is deprecated in DART 6.6. "\ "Please use dart/gui/glut/SoftSimWindow.hpp instead." #include "dart/gui/glut/SoftSimWindow.hpp" diff --git a/dart/gui/Win2D.hpp b/dart/gui/Win2D.hpp index 823dcf450a650..e17bd2ca1912a 100644 --- a/dart/gui/Win2D.hpp +++ b/dart/gui/Win2D.hpp @@ -33,7 +33,7 @@ #ifndef DART_GUI_WIN2D_HPP_ #define DART_GUI_WIN2D_HPP_ -#warning "This file is deprecated in DART 6.1. "\ +#warning "This file is deprecated in DART 6.6. "\ "Please use dart/gui/glut/Win2D.hpp instead." #include "dart/gui/glut/Win2D.hpp" diff --git a/dart/gui/Win3D.hpp b/dart/gui/Win3D.hpp index fcf418743aa23..d803c48198726 100644 --- a/dart/gui/Win3D.hpp +++ b/dart/gui/Win3D.hpp @@ -33,7 +33,7 @@ #ifndef DART_GUI_WIN3D_HPP_ #define DART_GUI_WIN3D_HPP_ -#warning "This file is deprecated in DART 6.1. "\ +#warning "This file is deprecated in DART 6.6. "\ "Please use dart/gui/glut/Win3D.hpp instead." #include "dart/gui/glut/Win3D.hpp" From 91080d3244ec1cd7d70f3590c3d98cc85ce656de Mon Sep 17 00:00:00 2001 From: Jeongseok Lee Date: Thu, 19 Jul 2018 19:23:12 -0700 Subject: [PATCH 03/12] Add more occupancy update functions to VoxelGridShape (#1083) --- CHANGELOG.md | 2 +- dart/dynamics/VoxelGridShape.cpp | 58 +++++++++++++++++++++++++++--- dart/dynamics/VoxelGridShape.hpp | 60 +++++++++++++++++++++++++++++--- 3 files changed, 110 insertions(+), 10 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index c7c2b230a05df..fd22f91f40d97 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,7 +4,7 @@ * Dynamics - * Added VoxelGridShape: [#1076](https://github.com/dartsim/dart/pull/1076) + * Added VoxelGridShape: [#1076](https://github.com/dartsim/dart/pull/1076), [#1083](https://github.com/dartsim/dart/pull/1083) ### [DART 6.5.0 (2018-05-12)](https://github.com/dartsim/dart/milestone/41?closed=1) diff --git a/dart/dynamics/VoxelGridShape.cpp b/dart/dynamics/VoxelGridShape.cpp index 60986aa8be6ca..9ad75a5461ad8 100644 --- a/dart/dynamics/VoxelGridShape.cpp +++ b/dart/dynamics/VoxelGridShape.cpp @@ -40,6 +40,30 @@ namespace dart { namespace dynamics { +namespace { + +//============================================================================== +octomap::point3d toPoint3d(const Eigen::Vector3d& point) +{ + return octomap::point3d(point.x(), point.y(), point.z()); +} + +//============================================================================== +octomath::Quaternion toQuaternion(const Eigen::Matrix3d& rotation) +{ + Eigen::Quaterniond quat(rotation); + return octomath::Quaternion(quat.w(), quat.x(), quat.y(), quat.z()); +} + +//============================================================================== +octomap::pose6d toPose6d(const Eigen::Isometry3d& frame) +{ + return octomap::pose6d( + toPoint3d(frame.translation()), toQuaternion(frame.linear())); +} + +} // namespace + //============================================================================== VoxelGridShape::VoxelGridShape(double resolution) : Shape() { @@ -107,16 +131,42 @@ fcl_shared_ptr VoxelGridShape::getOctree() const //============================================================================== void VoxelGridShape::updateOccupancy( - const octomap::Pointcloud& pointCloud, const octomap::point3d& sensorOrigin) + const Eigen::Vector3d& point, bool occupied) { - mOctree->insertPointCloud(pointCloud, sensorOrigin); + mOctree->updateNode(toPoint3d(point), occupied); } //============================================================================== void VoxelGridShape::updateOccupancy( - const Eigen::Vector3d& point, bool occupied) + const Eigen::Vector3d& from, const Eigen::Vector3d& to) +{ + mOctree->insertRay(toPoint3d(from), toPoint3d(to)); +} + +//============================================================================== +void VoxelGridShape::updateOccupancy( + const octomap::Pointcloud& pointCloud, + const Eigen::Vector3d& sensorOrigin, + const Frame* relativeTo) +{ + if (relativeTo == Frame::World()) + { + mOctree->insertPointCloud(pointCloud, toPoint3d(sensorOrigin)); + } + else + { + updateOccupancy(pointCloud, sensorOrigin, relativeTo->getWorldTransform()); + } +} + +//============================================================================== +void VoxelGridShape::updateOccupancy( + const octomap::Pointcloud& pointCloud, + const Eigen::Vector3d& sensorOrigin, + const Eigen::Isometry3d& relativeTo) { - mOctree->updateNode(point.x(), point.y(), point.z(), occupied); + mOctree->insertPointCloud( + pointCloud, toPoint3d(sensorOrigin), toPose6d(relativeTo)); } //============================================================================== diff --git a/dart/dynamics/VoxelGridShape.hpp b/dart/dynamics/VoxelGridShape.hpp index 6e385a6d7ea7b..b5ea2b9d4c703 100644 --- a/dart/dynamics/VoxelGridShape.hpp +++ b/dart/dynamics/VoxelGridShape.hpp @@ -39,6 +39,7 @@ #include #include "dart/collision/fcl/BackwardCompatibility.hpp" +#include "dart/dynamics/Frame.hpp" #include "dart/dynamics/Shape.hpp" namespace dart { @@ -74,18 +75,67 @@ class VoxelGridShape : public Shape /// Returns octree. fcl_shared_ptr getOctree() const; - /// Integrates a sensor measurement at \c point. The occupancy probability of - /// a node that contains \c point will be updated based on the value of - /// \c occupied; true will increase while false will decrease. + /// Updates the occupancy probability of the voxels where \c point is located. + /// + /// Note that the probability is computed by both of the current probability + /// and the new sensor measurement. /// /// \param[in] point Location of the sensor measurement. /// \param[in] occupied True if the location was measured occupied. void updateOccupancy(const Eigen::Vector3d& point, bool occupied = true); - /// Integrates a point cloud sensor measurement. + /// Updates the occupancy probability of the voxels given sensor measurement, + /// which is a single ray. + /// + /// Note that the probability is computed by both of the current probability + /// and the new sensor measurement. + /// + /// If you have a ray cloud, then using updateOccupancy(PointClout, ...) is + /// more efficient. + /// + /// \param from Origin of sensor in global coordinates. + /// \param to Endpoint of measurement in global coordinates. + void updateOccupancy(const Eigen::Vector3d& from, const Eigen::Vector3d& to); + + /// Updates the occupancy probability of the voxels given sensor measurement. + /// + /// Note that the probability is computed by both of the current probability + /// and the new sensor measurement. + /// + /// The voxels where the ray endpoints are located will increase the + /// probabilities because that’s where the rays hit objects. On the other + /// hand, the voxels that the rays pass through will decrease the + /// probabilities because it means there are no objects. + /// + /// \param[in] pointCloud Point cloud relative to frame. Points represent the + /// end points of the rays from the sensor origin. + /// \param[in] sensorOrigin Origin of sensor relative to frame. + /// \param[in] relativeTo Reference frame, determines transform to be + /// applied to point cloud and sensor origin. + void updateOccupancy( + const octomap::Pointcloud& pointCloud, + const Eigen::Vector3d& sensorOrigin = Eigen::Vector3d::Zero(), + const Frame* relativeTo = Frame::World()); + + /// Updates the occupancy probability of the voxels given sensor measurement. + /// + /// Note that the probability is computed by both of the current probability + /// and the new sensor measurement. + /// + /// The voxels where the ray endpoints are located will increase the + /// probabilities because that’s where the rays hit objects. On the other + /// hand, the voxels that the rays pass through will decrease the + /// probabilities because it means there are no objects. + /// + /// \param[in] pointCloud Point cloud relative to frame. Points represent the + /// end points of the rays from the sensor origin. + /// \param[in] sensorOrigin Origin of sensor relative to frame. + /// \param[in] relativeTo Reference frame, determines transform to be + /// applied to point cloud and sensor origin. void updateOccupancy( const octomap::Pointcloud& pointCloud, - const octomap::point3d& sensorOrigin); + const Eigen::Vector3d& sensorOrigin, + const Eigen::Isometry3d& relativeTo); /// Returns occupancy probability of a node that contains \c point. double getOccupancy(const Eigen::Vector3d& point) const; From 7d7d7c387aab315fd5f0b851c0811c267ceced98 Mon Sep 17 00:00:00 2001 From: Jeongseok Lee Date: Thu, 19 Jul 2018 20:15:57 -0700 Subject: [PATCH 04/12] Fix including deprecated header --- dart/gui/glut/MotionBlurSimWindow.cpp | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/dart/gui/glut/MotionBlurSimWindow.cpp b/dart/gui/glut/MotionBlurSimWindow.cpp index bddfedaa2a196..4d849110b94eb 100644 --- a/dart/gui/glut/MotionBlurSimWindow.cpp +++ b/dart/gui/glut/MotionBlurSimWindow.cpp @@ -15,7 +15,7 @@ ///////////////////////////////////////////////////////////////////////// -#include "dart/gui/MotionBlurSimWindow.hpp" +#include "dart/gui/glut/MotionBlurSimWindow.hpp" #include "dart/constraint/ConstraintSolver.hpp" #include "dart/gui/GLFuncs.hpp" @@ -23,15 +23,19 @@ namespace dart { namespace gui { +namespace glut { +//============================================================================== MotionBlurSimWindow::MotionBlurSimWindow() : SimWindow() { mMotionBlurFrequency = 1; } +//============================================================================== MotionBlurSimWindow::~MotionBlurSimWindow() { + // Do nothing } //============================================================================== @@ -218,8 +222,7 @@ void MotionBlurSimWindow::displayTimer(int _val) glutPostRedisplay(); glutTimerFunc(mDisplayTimeout, refreshTimer, _val); } - +} // namespace glut } // namespace gui } // namespace dart - From b0d564e65f88da12d39484e0dd9472b57b76c278 Mon Sep 17 00:00:00 2001 From: Jeongseok Lee Date: Thu, 19 Jul 2018 20:16:21 -0700 Subject: [PATCH 05/12] Fix using deprecated APIs --- dart/gui/CMakeLists.txt | 14 ++++++++++++++ examples/addDeleteSkels/MyWindow.hpp | 2 +- examples/atlasSimbicon/MyWindow.cpp | 2 ++ examples/atlasSimbicon/MyWindow.hpp | 2 +- examples/bipedStand/MyWindow.cpp | 2 ++ examples/bipedStand/MyWindow.hpp | 2 +- examples/hardcodedDesign/MyWindow.hpp | 2 +- examples/hybridDynamics/MyWindow.hpp | 2 +- examples/jointConstraints/MyWindow.cpp | 2 ++ examples/jointConstraints/MyWindow.hpp | 2 +- examples/mixedChain/MyWindow.cpp | 2 ++ examples/mixedChain/MyWindow.hpp | 2 +- examples/operationalSpaceControl/MyWindow.hpp | 2 +- examples/rigidChain/MyWindow.hpp | 2 +- examples/rigidLoop/MyWindow.hpp | 2 +- examples/rigidShapes/MyWindow.hpp | 2 +- examples/simpleFrames/Main.cpp | 2 +- examples/softBodies/MyWindow.cpp | 2 ++ examples/softBodies/MyWindow.hpp | 2 +- examples/vehicle/MyWindow.hpp | 2 +- .../tutorialBiped-Finished.cpp | 1 + tutorials/tutorialBiped/tutorialBiped.cpp | 1 + .../tutorialCollisions-Finished.cpp | 2 +- .../tutorialCollisions/tutorialCollisions.cpp | 1 + .../tutorialDominoes-Finished.cpp | 2 +- tutorials/tutorialDominoes/tutorialDominoes.cpp | 2 +- .../tutorialMultiPendulum-Finished.cpp | 2 +- .../tutorialMultiPendulum.cpp | 2 +- 28 files changed, 46 insertions(+), 19 deletions(-) diff --git a/dart/gui/CMakeLists.txt b/dart/gui/CMakeLists.txt index f52ba67c7dc2c..8988c85aa226a 100644 --- a/dart/gui/CMakeLists.txt +++ b/dart/gui/CMakeLists.txt @@ -78,6 +78,20 @@ add_subdirectory(osg) # Generate header for this namespace dart_get_filename_components(header_names "gui headers" ${hdrs}) + +# Remove deprecated files from the list +list(REMOVE_ITEM header_names + "GLFuncs.hpp" + "GlutWindow.hpp" + "GraphWindow.hpp" + "LoadGlut.hpp" + "MotionBlurSimWindow.hpp" + "SimWindow.hpp" + "SoftSimWindow.hpp" + "Win2D.hpp" + "Win3D.hpp" +) + set( header_names ${header_names} diff --git a/examples/addDeleteSkels/MyWindow.hpp b/examples/addDeleteSkels/MyWindow.hpp index b3f471bb3eea4..442a455a87874 100644 --- a/examples/addDeleteSkels/MyWindow.hpp +++ b/examples/addDeleteSkels/MyWindow.hpp @@ -37,7 +37,7 @@ #include /// \brief -class MyWindow : public dart::gui::SimWindow { +class MyWindow : public dart::gui::glut::SimWindow { public: /// \brief MyWindow(); diff --git a/examples/atlasSimbicon/MyWindow.cpp b/examples/atlasSimbicon/MyWindow.cpp index 645be908f8566..ad6398852b28f 100644 --- a/examples/atlasSimbicon/MyWindow.cpp +++ b/examples/atlasSimbicon/MyWindow.cpp @@ -32,6 +32,8 @@ #include "MyWindow.hpp" +#include + //============================================================================== MyWindow::MyWindow(Controller* _controller) : SimWindow(), diff --git a/examples/atlasSimbicon/MyWindow.hpp b/examples/atlasSimbicon/MyWindow.hpp index a8fbb53a10ec9..1ce14ce639774 100644 --- a/examples/atlasSimbicon/MyWindow.hpp +++ b/examples/atlasSimbicon/MyWindow.hpp @@ -39,7 +39,7 @@ #include "Controller.hpp" /// \brief class MyWindow -class MyWindow : public dart::gui::SimWindow +class MyWindow : public dart::gui::glut::SimWindow { public: /// \brief Constructor diff --git a/examples/bipedStand/MyWindow.cpp b/examples/bipedStand/MyWindow.cpp index 0df0cc3f61447..3b9b461020ee6 100644 --- a/examples/bipedStand/MyWindow.cpp +++ b/examples/bipedStand/MyWindow.cpp @@ -32,6 +32,8 @@ #include "MyWindow.hpp" +#include + MyWindow::MyWindow(): SimWindow() { mForce = Eigen::Vector3d::Zero(); mController = nullptr; diff --git a/examples/bipedStand/MyWindow.hpp b/examples/bipedStand/MyWindow.hpp index e29a98ce314e8..058102ff724b4 100644 --- a/examples/bipedStand/MyWindow.hpp +++ b/examples/bipedStand/MyWindow.hpp @@ -42,7 +42,7 @@ #include "Controller.hpp" -class MyWindow : public dart::gui::SimWindow { +class MyWindow : public dart::gui::glut::SimWindow { public: MyWindow(); virtual ~MyWindow(); diff --git a/examples/hardcodedDesign/MyWindow.hpp b/examples/hardcodedDesign/MyWindow.hpp index eeb7eb07c00b5..9077dc2d4475c 100644 --- a/examples/hardcodedDesign/MyWindow.hpp +++ b/examples/hardcodedDesign/MyWindow.hpp @@ -46,7 +46,7 @@ #include #include -class MyWindow : public dart::gui::SimWindow { +class MyWindow : public dart::gui::glut::SimWindow { public: /// \brief The constructor - set the position of the skeleton explicit MyWindow(dart::dynamics::SkeletonPtr _skel): SimWindow(), skel(_skel) { diff --git a/examples/hybridDynamics/MyWindow.hpp b/examples/hybridDynamics/MyWindow.hpp index e2c125bd0074c..a13936a5bde78 100644 --- a/examples/hybridDynamics/MyWindow.hpp +++ b/examples/hybridDynamics/MyWindow.hpp @@ -37,7 +37,7 @@ #include /// \brief -class MyWindow : public dart::gui::SimWindow +class MyWindow : public dart::gui::glut::SimWindow { public: /// \brief diff --git a/examples/jointConstraints/MyWindow.cpp b/examples/jointConstraints/MyWindow.cpp index a42c35dcf475b..d534c3338e390 100644 --- a/examples/jointConstraints/MyWindow.cpp +++ b/examples/jointConstraints/MyWindow.cpp @@ -32,6 +32,8 @@ #include "MyWindow.hpp" +#include + using namespace dart; using namespace math; using namespace dynamics; diff --git a/examples/jointConstraints/MyWindow.hpp b/examples/jointConstraints/MyWindow.hpp index 4017dd0145bc0..d5301537c785b 100644 --- a/examples/jointConstraints/MyWindow.hpp +++ b/examples/jointConstraints/MyWindow.hpp @@ -41,7 +41,7 @@ #include #include -class MyWindow : public dart::gui::SimWindow +class MyWindow : public dart::gui::glut::SimWindow { public: MyWindow(): SimWindow() diff --git a/examples/mixedChain/MyWindow.cpp b/examples/mixedChain/MyWindow.cpp index 450fa29e01a29..8dff888230ae8 100644 --- a/examples/mixedChain/MyWindow.cpp +++ b/examples/mixedChain/MyWindow.cpp @@ -38,6 +38,8 @@ #include "MyWindow.hpp" +#include + #define FORCE_ON_RIGIDBODY 500.0; #define FORCE_ON_VERTEX 1.00; diff --git a/examples/mixedChain/MyWindow.hpp b/examples/mixedChain/MyWindow.hpp index 54b3930316007..509e49199c1dc 100644 --- a/examples/mixedChain/MyWindow.hpp +++ b/examples/mixedChain/MyWindow.hpp @@ -43,7 +43,7 @@ #include /// \brief -class MyWindow : public dart::gui::SoftSimWindow +class MyWindow : public dart::gui::glut::SoftSimWindow { public: /// \brief diff --git a/examples/operationalSpaceControl/MyWindow.hpp b/examples/operationalSpaceControl/MyWindow.hpp index af139b078a5de..b271f886043ca 100644 --- a/examples/operationalSpaceControl/MyWindow.hpp +++ b/examples/operationalSpaceControl/MyWindow.hpp @@ -39,7 +39,7 @@ #include "Controller.hpp" /// \brief class MyWindow -class MyWindow : public dart::gui::SimWindow +class MyWindow : public dart::gui::glut::SimWindow { public: /// \brief Default constructor diff --git a/examples/rigidChain/MyWindow.hpp b/examples/rigidChain/MyWindow.hpp index 3dc51c3f3c98c..5044867be5d76 100644 --- a/examples/rigidChain/MyWindow.hpp +++ b/examples/rigidChain/MyWindow.hpp @@ -36,7 +36,7 @@ #include #include -class MyWindow : public dart::gui::SimWindow { +class MyWindow : public dart::gui::glut::SimWindow { public: MyWindow(); diff --git a/examples/rigidLoop/MyWindow.hpp b/examples/rigidLoop/MyWindow.hpp index 229f9b2ac602b..d175e972f8227 100644 --- a/examples/rigidLoop/MyWindow.hpp +++ b/examples/rigidLoop/MyWindow.hpp @@ -36,7 +36,7 @@ #include #include -class MyWindow : public dart::gui::SimWindow +class MyWindow : public dart::gui::glut::SimWindow { public: MyWindow() : SimWindow() {} diff --git a/examples/rigidShapes/MyWindow.hpp b/examples/rigidShapes/MyWindow.hpp index 1f362361e15f7..a676c34437cf2 100644 --- a/examples/rigidShapes/MyWindow.hpp +++ b/examples/rigidShapes/MyWindow.hpp @@ -43,7 +43,7 @@ #include /// MyWindow -class MyWindow : public dart::gui::SimWindow +class MyWindow : public dart::gui::glut::SimWindow { public: /// Constructor diff --git a/examples/simpleFrames/Main.cpp b/examples/simpleFrames/Main.cpp index 2f54d06eaca60..1370f5ffd3189 100644 --- a/examples/simpleFrames/Main.cpp +++ b/examples/simpleFrames/Main.cpp @@ -92,7 +92,7 @@ int main(int argc, char* argv[]) // rendered correctly, it must be a child of the World Frame // TODO(MXG): Fix this issue ^ - dart::gui::SimWindow window; + dart::gui::glut::SimWindow window; window.setWorld(myWorld); glutInit(&argc, argv); diff --git a/examples/softBodies/MyWindow.cpp b/examples/softBodies/MyWindow.cpp index c6059dd5334c4..f1b6507a069bc 100644 --- a/examples/softBodies/MyWindow.cpp +++ b/examples/softBodies/MyWindow.cpp @@ -38,6 +38,8 @@ #include "MyWindow.hpp" +#include + #define FORCE_ON_RIGIDBODY 25.0; #define FORCE_ON_VERTEX 1.00; diff --git a/examples/softBodies/MyWindow.hpp b/examples/softBodies/MyWindow.hpp index 390a140298139..2943e21b52f9a 100644 --- a/examples/softBodies/MyWindow.hpp +++ b/examples/softBodies/MyWindow.hpp @@ -43,7 +43,7 @@ #include /// \brief -class MyWindow : public dart::gui::SoftSimWindow +class MyWindow : public dart::gui::glut::SoftSimWindow { public: /// \brief diff --git a/examples/vehicle/MyWindow.hpp b/examples/vehicle/MyWindow.hpp index 5a427dcf6ba63..8d603dfad60ac 100644 --- a/examples/vehicle/MyWindow.hpp +++ b/examples/vehicle/MyWindow.hpp @@ -38,7 +38,7 @@ #include /// \brief -class MyWindow : public dart::gui::SimWindow { +class MyWindow : public dart::gui::glut::SimWindow { public: /// \brief MyWindow(); diff --git a/tutorials/tutorialBiped-Finished/tutorialBiped-Finished.cpp b/tutorials/tutorialBiped-Finished/tutorialBiped-Finished.cpp index 9035f837f5b3f..9b9fc53f6eff7 100644 --- a/tutorials/tutorialBiped-Finished/tutorialBiped-Finished.cpp +++ b/tutorials/tutorialBiped-Finished/tutorialBiped-Finished.cpp @@ -45,6 +45,7 @@ using namespace dart::common; using namespace dart::dynamics; using namespace dart::simulation; using namespace dart::gui; +using namespace dart::gui::glut; using namespace dart::utils; using namespace dart::math; diff --git a/tutorials/tutorialBiped/tutorialBiped.cpp b/tutorials/tutorialBiped/tutorialBiped.cpp index 0a8347312e87b..09f7373f27309 100644 --- a/tutorials/tutorialBiped/tutorialBiped.cpp +++ b/tutorials/tutorialBiped/tutorialBiped.cpp @@ -45,6 +45,7 @@ using namespace dart::common; using namespace dart::dynamics; using namespace dart::simulation; using namespace dart::gui; +using namespace dart::gui::glut; using namespace dart::utils; using namespace dart::math; diff --git a/tutorials/tutorialCollisions-Finished/tutorialCollisions-Finished.cpp b/tutorials/tutorialCollisions-Finished/tutorialCollisions-Finished.cpp index 14b66b5f35e4e..07ec2a2df325b 100644 --- a/tutorials/tutorialCollisions-Finished/tutorialCollisions-Finished.cpp +++ b/tutorials/tutorialCollisions-Finished/tutorialCollisions-Finished.cpp @@ -105,7 +105,7 @@ void setupRing(const SkeletonPtr& ring) } } -class MyWindow : public dart::gui::SimWindow +class MyWindow : public dart::gui::glut::SimWindow { public: diff --git a/tutorials/tutorialCollisions/tutorialCollisions.cpp b/tutorials/tutorialCollisions/tutorialCollisions.cpp index c1b1c465aa60e..8a7082d7b6eca 100644 --- a/tutorials/tutorialCollisions/tutorialCollisions.cpp +++ b/tutorials/tutorialCollisions/tutorialCollisions.cpp @@ -71,6 +71,7 @@ const double default_soft_damping = 5.0; using namespace dart::dynamics; using namespace dart::simulation; using namespace dart::gui; +using namespace dart::gui::glut; void setupRing(const SkeletonPtr& /*ring*/) { diff --git a/tutorials/tutorialDominoes-Finished/tutorialDominoes-Finished.cpp b/tutorials/tutorialDominoes-Finished/tutorialDominoes-Finished.cpp index 8cc6a618beae1..8b19842268671 100644 --- a/tutorials/tutorialDominoes-Finished/tutorialDominoes-Finished.cpp +++ b/tutorials/tutorialDominoes-Finished/tutorialDominoes-Finished.cpp @@ -219,7 +219,7 @@ class Controller Eigen::VectorXd mForces; }; -class MyWindow : public dart::gui::SimWindow +class MyWindow : public dart::gui::glut::SimWindow { public: diff --git a/tutorials/tutorialDominoes/tutorialDominoes.cpp b/tutorials/tutorialDominoes/tutorialDominoes.cpp index 189ae5a0b811f..322f760e7de44 100644 --- a/tutorials/tutorialDominoes/tutorialDominoes.cpp +++ b/tutorials/tutorialDominoes/tutorialDominoes.cpp @@ -132,7 +132,7 @@ class Controller Eigen::VectorXd mForces; }; -class MyWindow : public dart::gui::SimWindow +class MyWindow : public dart::gui::glut::SimWindow { public: diff --git a/tutorials/tutorialMultiPendulum-Finished/tutorialMultiPendulum-Finished.cpp b/tutorials/tutorialMultiPendulum-Finished/tutorialMultiPendulum-Finished.cpp index fc395703dbaea..0d2a7c5144cb4 100644 --- a/tutorials/tutorialMultiPendulum-Finished/tutorialMultiPendulum-Finished.cpp +++ b/tutorials/tutorialMultiPendulum-Finished/tutorialMultiPendulum-Finished.cpp @@ -53,7 +53,7 @@ const double delta_damping = 1.0; using namespace dart::dynamics; using namespace dart::simulation; -class MyWindow : public dart::gui::SimWindow +class MyWindow : public dart::gui::glut::SimWindow { public: diff --git a/tutorials/tutorialMultiPendulum/tutorialMultiPendulum.cpp b/tutorials/tutorialMultiPendulum/tutorialMultiPendulum.cpp index f1a9a9364f6fe..c99dc70655a2a 100644 --- a/tutorials/tutorialMultiPendulum/tutorialMultiPendulum.cpp +++ b/tutorials/tutorialMultiPendulum/tutorialMultiPendulum.cpp @@ -53,7 +53,7 @@ const double delta_damping = 1.0; using namespace dart::dynamics; using namespace dart::simulation; -class MyWindow : public dart::gui::SimWindow +class MyWindow : public dart::gui::glut::SimWindow { public: From a8b6c7b49fb28a3b7eb32dcbb123a4a2c4b30a8c Mon Sep 17 00:00:00 2001 From: Jeongseok Lee Date: Thu, 19 Jul 2018 20:18:36 -0700 Subject: [PATCH 06/12] Update changelog --- CHANGELOG.md | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index fd22f91f40d97..a54123ff0b5c3 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,10 @@ * Added VoxelGridShape: [#1076](https://github.com/dartsim/dart/pull/1076), [#1083](https://github.com/dartsim/dart/pull/1083) +* GUI + + * Reorganized OpenGL and GLUT files: [#1088](https://github.com/dartsim/dart/pull/1088) + ### [DART 6.5.0 (2018-05-12)](https://github.com/dartsim/dart/milestone/41?closed=1) * Common @@ -361,7 +365,7 @@ 1. Improved camera movement of OpenGL GUI: smooth zooming and translation * [Pull request #843](https://github.com/dartsim/dart/pull/843) -1. Removed debian meta files from the main DART repository +2. Removed debian meta files from the main DART repository * [Pull request #853](https://github.com/dartsim/dart/pull/853) ### Version 5.1.5 (2017-01-20) From 65a6f31261431b4cf951040cbdbd7d31e111c69c Mon Sep 17 00:00:00 2001 From: Jeongseok Lee Date: Thu, 19 Jul 2018 21:06:04 -0700 Subject: [PATCH 07/12] Update license headers --- dart/gui/glut/GLUTFuncs.cpp | 7 +++--- dart/gui/glut/GLUTFuncs.hpp | 7 +++--- dart/gui/glut/GlutWindow.hpp | 7 +++--- dart/gui/glut/GraphWindow.hpp | 13 ++++------- dart/gui/glut/LoadGlut.hpp | 7 +++--- dart/gui/glut/MotionBlurSimWindow.hpp | 32 +++++++++++++++++++++++++++ dart/gui/glut/SimWindow.hpp | 13 ++++------- dart/gui/glut/SoftSimWindow.hpp | 13 ++++------- dart/gui/glut/Win2D.hpp | 7 +++--- dart/gui/glut/Win3D.hpp | 7 +++--- 10 files changed, 68 insertions(+), 45 deletions(-) diff --git a/dart/gui/glut/GLUTFuncs.cpp b/dart/gui/glut/GLUTFuncs.cpp index 8b763ba6f1351..a694cc6d6385a 100644 --- a/dart/gui/glut/GLUTFuncs.cpp +++ b/dart/gui/glut/GLUTFuncs.cpp @@ -1,9 +1,10 @@ /* - * Copyright (c) 2011-2016, Graphics Lab, Georgia Tech Research Corporation - * Copyright (c) 2011-2016, Humanoid Lab, Georgia Tech Research Corporation - * Copyright (c) 2016, Personal Robotics Lab, Carnegie Mellon University + * Copyright (c) 2011-2018, The DART development contributors * All rights reserved. * + * The list of contributors can be found at: + * https://github.com/dartsim/dart/blob/master/LICENSE + * * This file is provided under the following "BSD-style" License: * Redistribution and use in source and binary forms, with or * without modification, are permitted provided that the following diff --git a/dart/gui/glut/GLUTFuncs.hpp b/dart/gui/glut/GLUTFuncs.hpp index 061dbb674fd94..605ad78fc21f1 100644 --- a/dart/gui/glut/GLUTFuncs.hpp +++ b/dart/gui/glut/GLUTFuncs.hpp @@ -1,9 +1,10 @@ /* - * Copyright (c) 2011-2016, Graphics Lab, Georgia Tech Research Corporation - * Copyright (c) 2011-2016, Humanoid Lab, Georgia Tech Research Corporation - * Copyright (c) 2016, Personal Robotics Lab, Carnegie Mellon University + * Copyright (c) 2011-2018, The DART development contributors * All rights reserved. * + * The list of contributors can be found at: + * https://github.com/dartsim/dart/blob/master/LICENSE + * * This file is provided under the following "BSD-style" License: * Redistribution and use in source and binary forms, with or * without modification, are permitted provided that the following diff --git a/dart/gui/glut/GlutWindow.hpp b/dart/gui/glut/GlutWindow.hpp index a46f94048fe6b..e1693a63563b3 100644 --- a/dart/gui/glut/GlutWindow.hpp +++ b/dart/gui/glut/GlutWindow.hpp @@ -1,9 +1,10 @@ /* - * Copyright (c) 2011-2016, Graphics Lab, Georgia Tech Research Corporation - * Copyright (c) 2011-2016, Humanoid Lab, Georgia Tech Research Corporation - * Copyright (c) 2016, Personal Robotics Lab, Carnegie Mellon University + * Copyright (c) 2011-2018, The DART development contributors * All rights reserved. * + * The list of contributors can be found at: + * https://github.com/dartsim/dart/blob/master/LICENSE + * * This file is provided under the following "BSD-style" License: * Redistribution and use in source and binary forms, with or * without modification, are permitted provided that the following diff --git a/dart/gui/glut/GraphWindow.hpp b/dart/gui/glut/GraphWindow.hpp index 2996a95fc6e54..1fe561994a1ad 100644 --- a/dart/gui/glut/GraphWindow.hpp +++ b/dart/gui/glut/GraphWindow.hpp @@ -1,9 +1,10 @@ /* - * Copyright (c) 2015-2016, Graphics Lab, Georgia Tech Research Corporation - * Copyright (c) 2015-2016, Humanoid Lab, Georgia Tech Research Corporation - * Copyright (c) 2016, Personal Robotics Lab, Carnegie Mellon University + * Copyright (c) 2011-2018, The DART development contributors * All rights reserved. * + * The list of contributors can be found at: + * https://github.com/dartsim/dart/blob/master/LICENSE + * * This file is provided under the following "BSD-style" License: * Redistribution and use in source and binary forms, with or * without modification, are permitted provided that the following @@ -14,12 +15,6 @@ * copyright notice, this list of conditions and the following * disclaimer in the documentation and/or other materials provided * with the distribution. - * * This code incorporates portions of Open Dynamics Engine - * (Copyright (c) 2001-2004, Russell L. Smith. All rights - * reserved.) and portions of FCL (Copyright (c) 2011, Willow - * Garage, Inc. All rights reserved.), which were released under - * the same BSD license as below - * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND * CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF diff --git a/dart/gui/glut/LoadGlut.hpp b/dart/gui/glut/LoadGlut.hpp index 006c363f97742..2ea3c0d7419c9 100644 --- a/dart/gui/glut/LoadGlut.hpp +++ b/dart/gui/glut/LoadGlut.hpp @@ -1,9 +1,10 @@ /* - * Copyright (c) 2015-2016, Graphics Lab, Georgia Tech Research Corporation - * Copyright (c) 2015-2016, Humanoid Lab, Georgia Tech Research Corporation - * Copyright (c) 2016, Personal Robotics Lab, Carnegie Mellon University + * Copyright (c) 2011-2018, The DART development contributors * All rights reserved. * + * The list of contributors can be found at: + * https://github.com/dartsim/dart/blob/master/LICENSE + * * This file is provided under the following "BSD-style" License: * Redistribution and use in source and binary forms, with or * without modification, are permitted provided that the following diff --git a/dart/gui/glut/MotionBlurSimWindow.hpp b/dart/gui/glut/MotionBlurSimWindow.hpp index 070f232d302da..448ee40f5b28d 100644 --- a/dart/gui/glut/MotionBlurSimWindow.hpp +++ b/dart/gui/glut/MotionBlurSimWindow.hpp @@ -1,3 +1,35 @@ +/* + * Copyright (c) 2011-2018, The DART development contributors + * All rights reserved. + * + * The list of contributors can be found at: + * https://github.com/dartsim/dart/blob/master/LICENSE + * + * This file is provided under the following "BSD-style" License: + * Redistribution and use in source and binary forms, with or + * without modification, are permitted provided that the following + * conditions are met: + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following + * disclaimer in the documentation and/or other materials provided + * with the distribution. + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND + * CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, + * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF + * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN + * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ + // // MotionBlurSimWindow.hpp // dart diff --git a/dart/gui/glut/SimWindow.hpp b/dart/gui/glut/SimWindow.hpp index 3e9595782eae0..3ec0438218e9a 100644 --- a/dart/gui/glut/SimWindow.hpp +++ b/dart/gui/glut/SimWindow.hpp @@ -1,9 +1,10 @@ /* - * Copyright (c) 2013-2016, Graphics Lab, Georgia Tech Research Corporation - * Copyright (c) 2013-2016, Humanoid Lab, Georgia Tech Research Corporation - * Copyright (c) 2016, Personal Robotics Lab, Carnegie Mellon University + * Copyright (c) 2011-2018, The DART development contributors * All rights reserved. * + * The list of contributors can be found at: + * https://github.com/dartsim/dart/blob/master/LICENSE + * * This file is provided under the following "BSD-style" License: * Redistribution and use in source and binary forms, with or * without modification, are permitted provided that the following @@ -14,12 +15,6 @@ * copyright notice, this list of conditions and the following * disclaimer in the documentation and/or other materials provided * with the distribution. - * * This code incorporates portions of Open Dynamics Engine - * (Copyright (c) 2001-2004, Russell L. Smith. All rights - * reserved.) and portions of FCL (Copyright (c) 2011, Willow - * Garage, Inc. All rights reserved.), which were released under - * the same BSD license as below - * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND * CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF diff --git a/dart/gui/glut/SoftSimWindow.hpp b/dart/gui/glut/SoftSimWindow.hpp index 4776febf36d09..e8af653816287 100644 --- a/dart/gui/glut/SoftSimWindow.hpp +++ b/dart/gui/glut/SoftSimWindow.hpp @@ -1,9 +1,10 @@ /* - * Copyright (c) 2013-2016, Graphics Lab, Georgia Tech Research Corporation - * Copyright (c) 2013-2016, Humanoid Lab, Georgia Tech Research Corporation - * Copyright (c) 2016, Personal Robotics Lab, Carnegie Mellon University + * Copyright (c) 2011-2018, The DART development contributors * All rights reserved. * + * The list of contributors can be found at: + * https://github.com/dartsim/dart/blob/master/LICENSE + * * This file is provided under the following "BSD-style" License: * Redistribution and use in source and binary forms, with or * without modification, are permitted provided that the following @@ -14,12 +15,6 @@ * copyright notice, this list of conditions and the following * disclaimer in the documentation and/or other materials provided * with the distribution. - * * This code incorporates portions of Open Dynamics Engine - * (Copyright (c) 2001-2004, Russell L. Smith. All rights - * reserved.) and portions of FCL (Copyright (c) 2011, Willow - * Garage, Inc. All rights reserved.), which were released under - * the same BSD license as below - * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND * CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF diff --git a/dart/gui/glut/Win2D.hpp b/dart/gui/glut/Win2D.hpp index e94c0d2a0d485..1a6cd392228f4 100644 --- a/dart/gui/glut/Win2D.hpp +++ b/dart/gui/glut/Win2D.hpp @@ -1,9 +1,10 @@ /* - * Copyright (c) 2011-2016, Graphics Lab, Georgia Tech Research Corporation - * Copyright (c) 2011-2016, Humanoid Lab, Georgia Tech Research Corporation - * Copyright (c) 2016, Personal Robotics Lab, Carnegie Mellon University + * Copyright (c) 2011-2018, The DART development contributors * All rights reserved. * + * The list of contributors can be found at: + * https://github.com/dartsim/dart/blob/master/LICENSE + * * This file is provided under the following "BSD-style" License: * Redistribution and use in source and binary forms, with or * without modification, are permitted provided that the following diff --git a/dart/gui/glut/Win3D.hpp b/dart/gui/glut/Win3D.hpp index 912d15128c64b..4fe753eba089f 100644 --- a/dart/gui/glut/Win3D.hpp +++ b/dart/gui/glut/Win3D.hpp @@ -1,9 +1,10 @@ /* - * Copyright (c) 2011-2016, Graphics Lab, Georgia Tech Research Corporation - * Copyright (c) 2011-2016, Humanoid Lab, Georgia Tech Research Corporation - * Copyright (c) 2016, Personal Robotics Lab, Carnegie Mellon University + * Copyright (c) 2011-2018, The DART development contributors * All rights reserved. * + * The list of contributors can be found at: + * https://github.com/dartsim/dart/blob/master/LICENSE + * * This file is provided under the following "BSD-style" License: * Redistribution and use in source and binary forms, with or * without modification, are permitted provided that the following From 0411d9c243e64bf6460b22d22fc3468f1b62b8e6 Mon Sep 17 00:00:00 2001 From: Jeongseok Lee Date: Thu, 19 Jul 2018 22:51:12 -0700 Subject: [PATCH 08/12] Revert unintended change --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index a54123ff0b5c3..5ff67cf512e18 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -365,7 +365,7 @@ 1. Improved camera movement of OpenGL GUI: smooth zooming and translation * [Pull request #843](https://github.com/dartsim/dart/pull/843) -2. Removed debian meta files from the main DART repository +1. Removed debian meta files from the main DART repository * [Pull request #853](https://github.com/dartsim/dart/pull/853) ### Version 5.1.5 (2017-01-20) From 8034eb07a77b5d62d84934c978482fad21903655 Mon Sep 17 00:00:00 2001 From: "Michael X. Grey" Date: Fri, 27 Jul 2018 17:56:40 +0800 Subject: [PATCH 09/12] Use a more portable warning directive --- dart/collision/Option.hpp | 4 ++-- dart/collision/Result.hpp | 4 ++-- dart/dynamics/MultiSphereShape.hpp | 4 ++-- dart/gui/GlutWindow.hpp | 6 +++--- dart/gui/LoadGlut.hpp | 4 ++-- dart/gui/MotionBlurSimWindow.hpp | 4 ++-- dart/gui/SimWindow.hpp | 4 ++-- dart/gui/SoftSimWindow.hpp | 4 ++-- dart/gui/Win2D.hpp | 4 ++-- dart/gui/Win3D.hpp | 4 ++-- dart/utils/urdf/URDFTypes.hpp | 4 ++-- 11 files changed, 23 insertions(+), 23 deletions(-) diff --git a/dart/collision/Option.hpp b/dart/collision/Option.hpp index dcfda7ce57157..375ba8c83778c 100644 --- a/dart/collision/Option.hpp +++ b/dart/collision/Option.hpp @@ -33,8 +33,8 @@ #ifndef DART_COLLISION_OPTION_HPP_ #define DART_COLLISION_OPTION_HPP_ -#warning "This header has been deprecated in DART 6.1. "\ - "Please include CollisionOption.hpp intead." +#pragma message("This header has been deprecated in DART 6.1. "\ + "Please include CollisionOption.hpp intead.") #include "dart/collision/CollisionOption.hpp" diff --git a/dart/collision/Result.hpp b/dart/collision/Result.hpp index 8c7324d753bc0..989081c54e514 100644 --- a/dart/collision/Result.hpp +++ b/dart/collision/Result.hpp @@ -33,8 +33,8 @@ #ifndef DART_COLLISION_RESULT_HPP_ #define DART_COLLISION_RESULT_HPP_ -#warning "This header has been deprecated in DART 6.1. "\ - "Please include CollisionResult.hpp intead." +#pragma message("This header has been deprecated in DART 6.1. "\ + "Please include CollisionResult.hpp intead.") #include "dart/collision/CollisionResult.hpp" diff --git a/dart/dynamics/MultiSphereShape.hpp b/dart/dynamics/MultiSphereShape.hpp index cad555e5b28d4..e474767d97113 100644 --- a/dart/dynamics/MultiSphereShape.hpp +++ b/dart/dynamics/MultiSphereShape.hpp @@ -33,8 +33,8 @@ #ifndef DART_DYNAMICS_MULTISPHERESHAPE_HPP_ #define DART_DYNAMICS_MULTISPHERESHAPE_HPP_ -#warning "This header has been deprecated in DART 6.2. "\ - "Please include MultiSphereConvexHullShape.hpp intead." +#pragma message("This header has been deprecated in DART 6.2. "\ + "Please include MultiSphereConvexHullShape.hpp intead.") #include "dart/dynamics/MultiSphereConvexHullShape.hpp" diff --git a/dart/gui/GlutWindow.hpp b/dart/gui/GlutWindow.hpp index 18b72c34526fa..da3f38c2e063a 100644 --- a/dart/gui/GlutWindow.hpp +++ b/dart/gui/GlutWindow.hpp @@ -35,13 +35,13 @@ #include "dart/gui/glut/GlutWindow.hpp" -#warning "This file is deprecated in DART 6.6. "\ - "Please use dart/gui/glut/GlutWindow.hpp instead." +#pragma message("This header is deprecated as of DART 6.6. "\ + "Please use dart/gui/glut/GlutWindow.hpp instead.") namespace dart { namespace gui { -using GlutWindow = ::dart::gui::glut::Window; +using GlutWindow DART_DEPRECATED(6.6) = ::dart::gui::glut::Window; } // namespace gui } // namespace dart diff --git a/dart/gui/LoadGlut.hpp b/dart/gui/LoadGlut.hpp index f568afa532972..c5baa79309211 100644 --- a/dart/gui/LoadGlut.hpp +++ b/dart/gui/LoadGlut.hpp @@ -33,8 +33,8 @@ #ifndef DART_GUI_LOADGLUT_HPP_ #define DART_GUI_LOADGLUT_HPP_ -#warning "This file is deprecated in DART 6.6. "\ - "Please use dart/gui/glut/LoadGlut.hpp instead." +#pragma message("This file is deprecated as of DART 6.6. "\ + "Please use dart/gui/glut/LoadGlut.hpp instead.") #include "dart/gui/glut/LoadGlut.hpp" diff --git a/dart/gui/MotionBlurSimWindow.hpp b/dart/gui/MotionBlurSimWindow.hpp index edc432c71577f..6c6dadbd31908 100644 --- a/dart/gui/MotionBlurSimWindow.hpp +++ b/dart/gui/MotionBlurSimWindow.hpp @@ -9,8 +9,8 @@ #ifndef DART_GUI_MOTIONBLURSIMWINDOW_HPP_ #define DART_GUI_MOTIONBLURSIMWINDOW_HPP_ -#warning "This file is deprecated in DART 6.6. "\ - "Please use dart/gui/glut/MotionBlurSimWindow.hpp instead." +#pragma message("This header is deprecated as of DART 6.6. "\ + "Please use dart/gui/glut/MotionBlurSimWindow.hpp instead.") #include "dart/gui/glut/MotionBlurSimWindow.hpp" diff --git a/dart/gui/SimWindow.hpp b/dart/gui/SimWindow.hpp index 1f8fa86a42ebf..4c613a7456a7f 100644 --- a/dart/gui/SimWindow.hpp +++ b/dart/gui/SimWindow.hpp @@ -39,8 +39,8 @@ #ifndef DART_GUI_SIMWINDOW_HPP_ #define DART_GUI_SIMWINDOW_HPP_ -#warning "This file is deprecated in DART 6.6. "\ - "Please use dart/gui/glut/SimWindow.hpp instead." +#pragma message("This header is deprecated as of DART 6.6. "\ + "Please use dart/gui/glut/SimWindow.hpp instead.") #include "dart/gui/glut/SimWindow.hpp" diff --git a/dart/gui/SoftSimWindow.hpp b/dart/gui/SoftSimWindow.hpp index 4f97b01721657..ee544e34e544b 100644 --- a/dart/gui/SoftSimWindow.hpp +++ b/dart/gui/SoftSimWindow.hpp @@ -39,8 +39,8 @@ #ifndef DART_GUI_SOFTSIMWINDOW_HPP_ #define DART_GUI_SOFTSIMWINDOW_HPP_ -#warning "This file is deprecated in DART 6.6. "\ - "Please use dart/gui/glut/SoftSimWindow.hpp instead." +#pragma message("This header is deprecated as of DART 6.6. "\ + "Please use dart/gui/glut/SoftSimWindow.hpp instead.") #include "dart/gui/glut/SoftSimWindow.hpp" diff --git a/dart/gui/Win2D.hpp b/dart/gui/Win2D.hpp index e17bd2ca1912a..965e1549479ca 100644 --- a/dart/gui/Win2D.hpp +++ b/dart/gui/Win2D.hpp @@ -33,8 +33,8 @@ #ifndef DART_GUI_WIN2D_HPP_ #define DART_GUI_WIN2D_HPP_ -#warning "This file is deprecated in DART 6.6. "\ - "Please use dart/gui/glut/Win2D.hpp instead." +#pragma message("This header is deprecated as of DART 6.6. "\ + "Please use dart/gui/glut/Win2D.hpp instead.") #include "dart/gui/glut/Win2D.hpp" diff --git a/dart/gui/Win3D.hpp b/dart/gui/Win3D.hpp index d803c48198726..bd73147a7e6f7 100644 --- a/dart/gui/Win3D.hpp +++ b/dart/gui/Win3D.hpp @@ -33,8 +33,8 @@ #ifndef DART_GUI_WIN3D_HPP_ #define DART_GUI_WIN3D_HPP_ -#warning "This file is deprecated in DART 6.6. "\ - "Please use dart/gui/glut/Win3D.hpp instead." +#pragma message("This header is deprecated as of DART 6.6. "\ + "Please use dart/gui/glut/Win3D.hpp instead.") #include "dart/gui/glut/Win3D.hpp" diff --git a/dart/utils/urdf/URDFTypes.hpp b/dart/utils/urdf/URDFTypes.hpp index 117e33c558cec..1a5864323d03f 100644 --- a/dart/utils/urdf/URDFTypes.hpp +++ b/dart/utils/urdf/URDFTypes.hpp @@ -33,8 +33,8 @@ #ifndef DART_UTILS_URDF_URDFTYPES_HPP_ #define DART_UTILS_URDF_URDFTYPES_HPP_ -#warning "This header has been deprecated in DART 6.2. "\ - "Please include dart/utils/urdf/BackwardCompatibility.hpp intead." +#pragma message("This header has been deprecated in DART 6.2. "\ + "Please include dart/utils/urdf/BackwardCompatibility.hpp intead.") #include "dart/utils/urdf/BackwardCompatibility.hpp" From b99b10c94bd39ffdcc071ca1984fba824ce747c1 Mon Sep 17 00:00:00 2001 From: "Michael X. Grey" Date: Fri, 27 Jul 2018 18:00:52 +0800 Subject: [PATCH 10/12] Explicitly mark backwards compatibility aliases as deprecated --- dart/gui/MotionBlurSimWindow.hpp | 3 ++- dart/gui/SimWindow.hpp | 2 +- dart/gui/SoftSimWindow.hpp | 2 +- dart/gui/Win2D.hpp | 2 +- dart/gui/Win3D.hpp | 2 +- 5 files changed, 6 insertions(+), 5 deletions(-) diff --git a/dart/gui/MotionBlurSimWindow.hpp b/dart/gui/MotionBlurSimWindow.hpp index 6c6dadbd31908..f46a00d3cafda 100644 --- a/dart/gui/MotionBlurSimWindow.hpp +++ b/dart/gui/MotionBlurSimWindow.hpp @@ -17,7 +17,8 @@ namespace dart { namespace gui { -using MotionBlurSimWindow = ::dart::gui::glut::MotionBlurSimWindow; +using MotionBlurSimWindow DART_DEPRECATED(6.6) = + ::dart::gui::glut::MotionBlurSimWindow; } // namespace gui } // namespace dart diff --git a/dart/gui/SimWindow.hpp b/dart/gui/SimWindow.hpp index 4c613a7456a7f..455ccf774c17f 100644 --- a/dart/gui/SimWindow.hpp +++ b/dart/gui/SimWindow.hpp @@ -47,7 +47,7 @@ namespace dart { namespace gui { -using SimWindow = ::dart::gui::glut::SimWindow; +using SimWindow DART_DEPRECATED(6.6) = ::dart::gui::glut::SimWindow; } // namespace gui } // namespace dart diff --git a/dart/gui/SoftSimWindow.hpp b/dart/gui/SoftSimWindow.hpp index ee544e34e544b..5e5eda0ded3e6 100644 --- a/dart/gui/SoftSimWindow.hpp +++ b/dart/gui/SoftSimWindow.hpp @@ -47,7 +47,7 @@ namespace dart { namespace gui { -using SoftSimWindow = ::dart::gui::glut::SoftSimWindow; +using SoftSimWindow DART_DEPRECATED(6.6) = ::dart::gui::glut::SoftSimWindow; } // namespace gui } // namespace dart diff --git a/dart/gui/Win2D.hpp b/dart/gui/Win2D.hpp index 965e1549479ca..195d6636ef043 100644 --- a/dart/gui/Win2D.hpp +++ b/dart/gui/Win2D.hpp @@ -41,7 +41,7 @@ namespace dart { namespace gui { -using Win2D = ::dart::gui::glut::Win2D; +using Win2D DART_DEPRECATED(6.6) = ::dart::gui::glut::Win2D; } // namespace gui } // namespace dart diff --git a/dart/gui/Win3D.hpp b/dart/gui/Win3D.hpp index bd73147a7e6f7..20edf324a3abd 100644 --- a/dart/gui/Win3D.hpp +++ b/dart/gui/Win3D.hpp @@ -41,7 +41,7 @@ namespace dart { namespace gui { -using Win3D = ::dart::gui::glut::Win3D; +using Win3D DART_DEPRECATED(6.6) = ::dart::gui::glut::Win3D; } // namespace gui } // namespace dart From dcde2dd48147b87eea92abec57f08541bdd2b454 Mon Sep 17 00:00:00 2001 From: "Michael X. Grey" Date: Fri, 27 Jul 2018 18:06:09 +0800 Subject: [PATCH 11/12] Make style consistent --- dart/gui/GlutWindow.hpp | 5 +++-- dart/gui/GraphWindow.hpp | 6 +++++- dart/gui/MotionBlurSimWindow.hpp | 1 + dart/gui/SimWindow.hpp | 1 + dart/gui/SoftSimWindow.hpp | 1 + dart/gui/Win2D.hpp | 1 + dart/gui/Win3D.hpp | 1 + 7 files changed, 13 insertions(+), 3 deletions(-) diff --git a/dart/gui/GlutWindow.hpp b/dart/gui/GlutWindow.hpp index da3f38c2e063a..ad9ab962e0f27 100644 --- a/dart/gui/GlutWindow.hpp +++ b/dart/gui/GlutWindow.hpp @@ -33,11 +33,12 @@ #ifndef DART_GUI_GLUTWINDOW_HPP_ #define DART_GUI_GLUTWINDOW_HPP_ -#include "dart/gui/glut/GlutWindow.hpp" - #pragma message("This header is deprecated as of DART 6.6. "\ "Please use dart/gui/glut/GlutWindow.hpp instead.") +#include "dart/gui/glut/GlutWindow.hpp" +#include "dart/common/Deprecated.hpp" + namespace dart { namespace gui { diff --git a/dart/gui/GraphWindow.hpp b/dart/gui/GraphWindow.hpp index c394cdfb07074..624220f392d8f 100644 --- a/dart/gui/GraphWindow.hpp +++ b/dart/gui/GraphWindow.hpp @@ -39,12 +39,16 @@ #ifndef DART_GUI_GRAPHWINDOW_HPP_ #define DART_GUI_GRAPHWINDOW_HPP_ +#pragma message("This header is deprecated as of DART 6.6. "\ + "Please use dart/gui/glut/GraphWindow.hpp instead.") + #include "dart/gui/glut/GraphWindow.hpp" +#include "dart/common/Deprecated.hpp" namespace dart { namespace gui { -using GraphWindow = ::dart::gui::glut::GraphWindow; +using GraphWindow DART_DEPRECATED(6.6) = ::dart::gui::glut::GraphWindow; } // namespace gui } // namespace dart diff --git a/dart/gui/MotionBlurSimWindow.hpp b/dart/gui/MotionBlurSimWindow.hpp index f46a00d3cafda..ca53ebbc801b2 100644 --- a/dart/gui/MotionBlurSimWindow.hpp +++ b/dart/gui/MotionBlurSimWindow.hpp @@ -13,6 +13,7 @@ "Please use dart/gui/glut/MotionBlurSimWindow.hpp instead.") #include "dart/gui/glut/MotionBlurSimWindow.hpp" +#include "dart/common/Deprecated.hpp" namespace dart { namespace gui { diff --git a/dart/gui/SimWindow.hpp b/dart/gui/SimWindow.hpp index 455ccf774c17f..1915008c8fa2e 100644 --- a/dart/gui/SimWindow.hpp +++ b/dart/gui/SimWindow.hpp @@ -43,6 +43,7 @@ "Please use dart/gui/glut/SimWindow.hpp instead.") #include "dart/gui/glut/SimWindow.hpp" +#include "dart/common/Deprecated.hpp" namespace dart { namespace gui { diff --git a/dart/gui/SoftSimWindow.hpp b/dart/gui/SoftSimWindow.hpp index 5e5eda0ded3e6..c1588361b7cfd 100644 --- a/dart/gui/SoftSimWindow.hpp +++ b/dart/gui/SoftSimWindow.hpp @@ -43,6 +43,7 @@ "Please use dart/gui/glut/SoftSimWindow.hpp instead.") #include "dart/gui/glut/SoftSimWindow.hpp" +#include "dart/common/Deprecated.hpp" namespace dart { namespace gui { diff --git a/dart/gui/Win2D.hpp b/dart/gui/Win2D.hpp index 195d6636ef043..9fa6f78cc687d 100644 --- a/dart/gui/Win2D.hpp +++ b/dart/gui/Win2D.hpp @@ -37,6 +37,7 @@ "Please use dart/gui/glut/Win2D.hpp instead.") #include "dart/gui/glut/Win2D.hpp" +#include "dart/common/Deprecated.hpp" namespace dart { namespace gui { diff --git a/dart/gui/Win3D.hpp b/dart/gui/Win3D.hpp index 20edf324a3abd..49eaa093af915 100644 --- a/dart/gui/Win3D.hpp +++ b/dart/gui/Win3D.hpp @@ -37,6 +37,7 @@ "Please use dart/gui/glut/Win3D.hpp instead.") #include "dart/gui/glut/Win3D.hpp" +#include "dart/common/Deprecated.hpp" namespace dart { namespace gui { From 0090427c73cb72e9bffc2d2061d04ff0ff5b4978 Mon Sep 17 00:00:00 2001 From: "Michael X. Grey" Date: Fri, 27 Jul 2018 18:12:38 +0800 Subject: [PATCH 12/12] Rename glut/GlutWindow.* to glut/Window.* --- dart/gui/GlutWindow.hpp | 4 ++-- dart/gui/glut/GlutWindow.cpp | 4 ++-- dart/gui/glut/MotionBlurSimWindow.cpp | 2 +- dart/gui/glut/Win2D.hpp | 2 +- dart/gui/glut/Win3D.hpp | 2 +- dart/gui/glut/{GlutWindow.hpp => Window.hpp} | 6 +++--- 6 files changed, 10 insertions(+), 10 deletions(-) rename dart/gui/glut/{GlutWindow.hpp => Window.hpp} (96%) diff --git a/dart/gui/GlutWindow.hpp b/dart/gui/GlutWindow.hpp index ad9ab962e0f27..2717cd62bc545 100644 --- a/dart/gui/GlutWindow.hpp +++ b/dart/gui/GlutWindow.hpp @@ -34,9 +34,9 @@ #define DART_GUI_GLUTWINDOW_HPP_ #pragma message("This header is deprecated as of DART 6.6. "\ - "Please use dart/gui/glut/GlutWindow.hpp instead.") + "Please use dart/gui/glut/Window.hpp instead.") -#include "dart/gui/glut/GlutWindow.hpp" +#include "dart/gui/glut/Window.hpp" #include "dart/common/Deprecated.hpp" namespace dart { diff --git a/dart/gui/glut/GlutWindow.cpp b/dart/gui/glut/GlutWindow.cpp index 46045eb295e76..83a3275be3d02 100644 --- a/dart/gui/glut/GlutWindow.cpp +++ b/dart/gui/glut/GlutWindow.cpp @@ -30,7 +30,7 @@ * POSSIBILITY OF SUCH DAMAGE. */ -#include "dart/gui/glut/GlutWindow.hpp" +#include "dart/gui/glut/Window.hpp" #include "dart/external/lodepng/lodepng.h" @@ -182,7 +182,7 @@ bool Window::screenshot() { if (!S_ISDIR(buff.st_mode)) { - dtwarn << "[GlutWindow::screenshot] 'frames' is not a directory, " + dtwarn << "[Window::screenshot] 'frames' is not a directory, " << "cannot write a screenshot\n"; return false; } diff --git a/dart/gui/glut/MotionBlurSimWindow.cpp b/dart/gui/glut/MotionBlurSimWindow.cpp index 4d849110b94eb..719dc8466d972 100644 --- a/dart/gui/glut/MotionBlurSimWindow.cpp +++ b/dart/gui/glut/MotionBlurSimWindow.cpp @@ -9,7 +9,7 @@ ///////////////////////////////////////////////////////////////////////// // OpenGL Motion blur require the Accumulate function of OpenGL // To intergrate this class into the engine -// Change line 86 of dart/gui/GlutWindows.cpp +// Change line 86 of dart/gui/glut/Window.cpp // From glutInitDisplayMode(GLUT_DEPTH | GLUT_DOUBLE | GLUT_RGBA | GLUT_MULTISAMPLE); // to glutInitDisplayMode(GLUT_DEPTH | GLUT_DOUBLE | GLUT_RGBA | GLUT_MULTISAMPLE | GLUT_ACCUM); ///////////////////////////////////////////////////////////////////////// diff --git a/dart/gui/glut/Win2D.hpp b/dart/gui/glut/Win2D.hpp index 1a6cd392228f4..649641be976fb 100644 --- a/dart/gui/glut/Win2D.hpp +++ b/dart/gui/glut/Win2D.hpp @@ -33,7 +33,7 @@ #ifndef DART_GUI_GLUT_WIN2D_HPP_ #define DART_GUI_GLUT_WIN2D_HPP_ -#include "dart/gui/glut/GlutWindow.hpp" +#include "dart/gui/glut/Window.hpp" namespace dart { namespace gui { diff --git a/dart/gui/glut/Win3D.hpp b/dart/gui/glut/Win3D.hpp index 4fe753eba089f..50bc638f25a65 100644 --- a/dart/gui/glut/Win3D.hpp +++ b/dart/gui/glut/Win3D.hpp @@ -36,7 +36,7 @@ #include #include "dart/gui/Trackball.hpp" -#include "dart/gui/glut/GlutWindow.hpp" +#include "dart/gui/glut/Window.hpp" namespace dart { namespace gui { diff --git a/dart/gui/glut/GlutWindow.hpp b/dart/gui/glut/Window.hpp similarity index 96% rename from dart/gui/glut/GlutWindow.hpp rename to dart/gui/glut/Window.hpp index e1693a63563b3..549f40a08c339 100644 --- a/dart/gui/glut/GlutWindow.hpp +++ b/dart/gui/glut/Window.hpp @@ -30,8 +30,8 @@ * POSSIBILITY OF SUCH DAMAGE. */ -#ifndef DART_GUI_GLUT_GLUTWINDOW_HPP_ -#define DART_GUI_GLUT_GLUTWINDOW_HPP_ +#ifndef DART_GUI_GLUT_WINDOW_HPP_ +#define DART_GUI_GLUT_WINDOW_HPP_ #include @@ -98,4 +98,4 @@ class Window { } // namespace gui } // namespace dart -#endif // DART_GUI_GLUT_GLUTWINDOW_HPP_ +#endif // DART_GUI_GLUT_WINDOW_HPP_