Commit e96c69f8 authored by Olivier Lantsoght's avatar Olivier Lantsoght
Browse files

[Web3D] Added MBSysC websocket module (cherry-pick from 3dd9d235 to f8e1ad2c)

parent 9fe2cb47
......@@ -6,12 +6,14 @@
* In order to use C++ features, you just need to change the extension of this file (.c) to .cc (or .cpp).
*/
#ifdef SDL
#include "realtime.h"
#include "events_sdl.h"
#include "user_realtime.h"
#if defined(REAL_TIME)
/*! \brief handle inputs comming from the keyboard
*
* \param[in,out] mbs_data Robotran main structure
......@@ -41,7 +43,7 @@
* wait_key(realtime, cur_t_usec, 0.1);
* }
*/
void user_keyboard(MbsData* mbs_data, Simu_realtime *realtime, int cur_t_usec, const Uint8 *keystates)
void user_keyboard(MbsData* mbs_data, Simu_realtime *realtime, int cur_t_usec, const uint8_t *keystates)
{
}
......
......@@ -84,7 +84,7 @@
*/
void user_realtime_options(MbsData* mbs_data, Realtime_option *options)
{
options->project_path = (char*) PROJECT_SOURCE_DIR"/../";
}
#endif
......@@ -193,7 +193,7 @@ int main(int argc, char const *argv[])
mbs_dirdyn->options->dt0 = 1e-3;
mbs_dirdyn->options->tf = 10.0;
mbs_dirdyn->options->save2file = 1;
//mbs_dirdyn->options->realtime = 1;
mbs_dirdyn->options->realtime = 1;
mbs_run_dirdyn(mbs_dirdyn, mbs_data);
......
......@@ -6,12 +6,14 @@
* In order to use C++ features, you just need to change the extension of this file (.c) to .cc (or .cpp).
*/
#ifdef SDL
#include "realtime.h"
#include "events_sdl.h"
#include "user_realtime.h"
#if defined(REAL_TIME)
/*! \brief handle inputs comming from the keyboard
*
* \param[in,out] mbs_data Robotran main structure
......@@ -41,7 +43,7 @@
* wait_key(realtime, cur_t_usec, 0.1);
* }
*/
void user_keyboard(MbsData* mbs_data, Simu_realtime *realtime, int cur_t_usec, const Uint8 *keystates)
void user_keyboard(MbsData* mbs_data, Simu_realtime *realtime, int cur_t_usec, const uint8_t *keystates)
{
}
......
......@@ -6,12 +6,14 @@
* In order to use C++ features, you just need to change the extension of this file (.c) to .cc (or .cpp).
*/
#ifdef SDL
#include "realtime.h"
#include "events_sdl.h"
#include "user_realtime.h"
#if defined(REAL_TIME)
/*! \brief handle inputs comming from the keyboard
*
* \param[in,out] mbs_data Robotran main structure
......@@ -41,7 +43,7 @@
* wait_key(realtime, cur_t_usec, 0.1);
* }
*/
void user_keyboard(MbsData* mbs_data, Simu_realtime *realtime, int cur_t_usec, const Uint8 *keystates)
void user_keyboard(MbsData* mbs_data, Simu_realtime *realtime, int cur_t_usec, const uint8_t *keystates)
{
}
......
......@@ -6,12 +6,14 @@
* In order to use C++ features, you just need to change the extension of this file (.c) to .cc (or .cpp).
*/
#ifdef SDL
#include "realtime.h"
#include "events_sdl.h"
#include "user_realtime.h"
#if defined(REAL_TIME)
/*! \brief handle inputs comming from the keyboard
*
* \param[in,out] mbs_data Robotran main structure
......@@ -41,7 +43,7 @@
* wait_key(realtime, cur_t_usec, 0.1);
* }
*/
void user_keyboard(MbsData* mbs_data, Simu_realtime *realtime, int cur_t_usec, const Uint8 *keystates)
void user_keyboard(MbsData* mbs_data, Simu_realtime *realtime, int cur_t_usec, const uint8_t *keystates)
{
}
......
......@@ -6,12 +6,14 @@
* In order to use C++ features, you just need to change the extension of this file (.c) to .cc (or .cpp).
*/
#ifdef SDL
#include "realtime.h"
#include "events_sdl.h"
#include "user_realtime.h"
#if defined(REAL_TIME)
/*! \brief handle inputs comming from the keyboard
*
* \param[in,out] mbs_data Robotran main structure
......@@ -41,7 +43,7 @@
* wait_key(realtime, cur_t_usec, 0.1);
* }
*/
void user_keyboard(MbsData* mbs_data, Simu_realtime *realtime, int cur_t_usec, const Uint8 *keystates)
void user_keyboard(MbsData* mbs_data, Simu_realtime *realtime, int cur_t_usec, const uint8_t *keystates)
{
}
......
......@@ -6,12 +6,14 @@
* In order to use C++ features, you just need to change the extension of this file (.c) to .cc (or .cpp).
*/
#ifdef SDL
#include "realtime.h"
#include "events_sdl.h"
#include "user_realtime.h"
#if defined(REAL_TIME)
/*! \brief handle inputs comming from the keyboard
*
* \param[in,out] mbs_data Robotran main structure
......@@ -41,7 +43,7 @@
* wait_key(realtime, cur_t_usec, 0.1);
* }
*/
void user_keyboard(MbsData* mbs_data, Simu_realtime *realtime, int cur_t_usec, const Uint8 *keystates)
void user_keyboard(MbsData* mbs_data, Simu_realtime *realtime, int cur_t_usec, const uint8_t *keystates)
{
}
......
......@@ -6,14 +6,14 @@
* In order to use C++ features, you just need to change the extension of this file (.c) to .cc (or .cpp).
*/
#ifdef SDL
#define HAVE_M_PI // avoid redefinition of M_PI when including SDL
#include "realtime.h"
#include "events_sdl.h"
#include "user_realtime.h"
#if defined(REAL_TIME)
/*! \brief handle inputs comming from the keyboard
*
* \param[in,out] mbs_data Robotran main structure
......@@ -43,7 +43,7 @@
* wait_key(realtime, cur_t_usec, 0.1);
* }
*/
void user_keyboard(MbsData* mbs_data, Simu_realtime *realtime, int cur_t_usec, const Uint8 *keystates)
void user_keyboard(MbsData* mbs_data, Simu_realtime *realtime, int cur_t_usec, const uint8_t *keystates)
{
}
......
......@@ -6,12 +6,14 @@
* In order to use C++ features, you just need to change the extension of this file (.c) to .cc (or .cpp).
*/
#ifdef SDL
#include "realtime.h"
#include "events_sdl.h"
#include "user_realtime.h"
#if defined(REAL_TIME)
/*! \brief handle inputs comming from the keyboard
*
* \param[in,out] mbs_data Robotran main structure
......@@ -41,7 +43,7 @@
* wait_key(realtime, cur_t_usec, 0.1);
* }
*/
void user_keyboard(MbsData* mbs_data, Simu_realtime *realtime, int cur_t_usec, const Uint8 *keystates)
void user_keyboard(MbsData* mbs_data, Simu_realtime *realtime, int cur_t_usec, const uint8_t *keystates)
{
}
......
......@@ -6,12 +6,14 @@
* In order to use C++ features, you just need to change the extension of this file (.c) to .cc (or .cpp).
*/
#ifdef SDL
#include "realtime.h"
#include "events_sdl.h"
#include "user_realtime.h"
#if defined(REAL_TIME)
/*! \brief handle inputs comming from the keyboard
*
* \param[in,out] mbs_data Robotran main structure
......@@ -41,7 +43,7 @@
* wait_key(realtime, cur_t_usec, 0.1);
* }
*/
void user_keyboard(MbsData* mbs_data, Simu_realtime *realtime, int cur_t_usec, const Uint8 *keystates)
void user_keyboard(MbsData* mbs_data, Simu_realtime *realtime, int cur_t_usec, const uint8_t *keystates)
{
}
......
......@@ -6,12 +6,14 @@
* In order to use C++ features, you just need to change the extension of this file (.c) to .cc (or .cpp).
*/
#ifdef SDL
#include "realtime.h"
#include "events_sdl.h"
#include "user_realtime.h"
#if defined(REAL_TIME)
/*! \brief handle inputs comming from the keyboard
*
* \param[in,out] mbs_data Robotran main structure
......@@ -41,7 +43,7 @@
* wait_key(realtime, cur_t_usec, 0.1);
* }
*/
void user_keyboard(MbsData* mbs_data, Simu_realtime *realtime, int cur_t_usec, const Uint8 *keystates)
void user_keyboard(MbsData* mbs_data, Simu_realtime *realtime, int cur_t_usec, const uint8_t *keystates)
{
}
......
......@@ -6,12 +6,14 @@
* In order to use C++ features, you just need to change the extension of this file (.c) to .cc (or .cpp).
*/
#ifdef SDL
#include "realtime.h"
#include "events_sdl.h"
#include "user_realtime.h"
#if defined(REAL_TIME)
/*! \brief handle inputs comming from the keyboard
*
* \param[in,out] mbs_data Robotran main structure
......@@ -41,7 +43,7 @@
* wait_key(realtime, cur_t_usec, 0.1);
* }
*/
void user_keyboard(MbsData* mbs_data, Simu_realtime *realtime, int cur_t_usec, const Uint8 *keystates)
void user_keyboard(MbsData* mbs_data, Simu_realtime *realtime, int cur_t_usec, const uint8_t *keystates)
{
}
......
......@@ -6,12 +6,14 @@
* In order to use C++ features, you just need to change the extension of this file (.c) to .cc (or .cpp).
*/
#ifdef SDL
#include "realtime.h"
#include "events_sdl.h"
#include "user_realtime.h"
#if defined(REAL_TIME)
/*! \brief handle inputs comming from the keyboard
*
* \param[in,out] mbs_data Robotran main structure
......@@ -41,7 +43,7 @@
* wait_key(realtime, cur_t_usec, 0.1);
* }
*/
void user_keyboard(MbsData* mbs_data, Simu_realtime *realtime, int cur_t_usec, const Uint8 *keystates)
void user_keyboard(MbsData* mbs_data, Simu_realtime *realtime, int cur_t_usec, const uint8_t *keystates)
{
}
......
......@@ -6,12 +6,14 @@
* In order to use C++ features, you just need to change the extension of this file (.c) to .cc (or .cpp).
*/
#ifdef SDL
#include "realtime.h"
#include "events_sdl.h"
#include "user_realtime.h"
#if defined(REAL_TIME)
/*! \brief handle inputs comming from the keyboard
*
* \param[in,out] mbs_data Robotran main structure
......@@ -41,7 +43,7 @@
* wait_key(realtime, cur_t_usec, 0.1);
* }
*/
void user_keyboard(MbsData* mbs_data, Simu_realtime *realtime, int cur_t_usec, const Uint8 *keystates)
void user_keyboard(MbsData* mbs_data, Simu_realtime *realtime, int cur_t_usec, const uint8_t *keystates)
{
}
......
......@@ -6,12 +6,14 @@
* In order to use C++ features, you just need to change the extension of this file (.c) to .cc (or .cpp).
*/
#ifdef SDL
#include "realtime.h"
#include "events_sdl.h"
#include "user_realtime.h"
#if defined(REAL_TIME)
/*! \brief handle inputs comming from the keyboard
*
* \param[in,out] mbs_data Robotran main structure
......@@ -41,7 +43,7 @@
* wait_key(realtime, cur_t_usec, 0.1);
* }
*/
void user_keyboard(MbsData* mbs_data, Simu_realtime *realtime, int cur_t_usec, const Uint8 *keystates)
void user_keyboard(MbsData* mbs_data, Simu_realtime *realtime, int cur_t_usec, const uint8_t *keystates)
{
}
......
......@@ -6,12 +6,14 @@
* In order to use C++ features, you just need to change the extension of this file (.c) to .cc (or .cpp).
*/
#ifdef SDL
#include "realtime.h"
#include "events_sdl.h"
#include "user_realtime.h"
#if defined(REAL_TIME)
/*! \brief handle inputs comming from the keyboard
*
* \param[in,out] mbs_data Robotran main structure
......@@ -41,7 +43,7 @@
* wait_key(realtime, cur_t_usec, 0.1);
* }
*/
void user_keyboard(MbsData* mbs_data, Simu_realtime *realtime, int cur_t_usec, const Uint8 *keystates)
void user_keyboard(MbsData* mbs_data, Simu_realtime *realtime, int cur_t_usec, const uint8_t *keystates)
{
}
......
......@@ -6,12 +6,14 @@
* In order to use C++ features, you just need to change the extension of this file (.c) to .cc (or .cpp).
*/
#ifdef SDL
#include "realtime.h"
#include "events_sdl.h"
#include "user_realtime.h"
#if defined(REAL_TIME)
/*! \brief handle inputs comming from the keyboard
*
* \param[in,out] mbs_data Robotran main structure
......@@ -41,7 +43,7 @@
* wait_key(realtime, cur_t_usec, 0.1);
* }
*/
void user_keyboard(MbsData* mbs_data, Simu_realtime *realtime, int cur_t_usec, const Uint8 *keystates)
void user_keyboard(MbsData* mbs_data, Simu_realtime *realtime, int cur_t_usec, const uint8_t *keystates)
{
}
......
......@@ -6,12 +6,14 @@
* In order to use C++ features, you just need to change the extension of this file (.c) to .cc (or .cpp).
*/
#ifdef SDL
#include "realtime.h"
#include "events_sdl.h"
#include "user_realtime.h"
#if defined(REAL_TIME)
/*! \brief handle inputs comming from the keyboard
*
* \param[in,out] mbs_data Robotran main structure
......@@ -41,7 +43,7 @@
* wait_key(realtime, cur_t_usec, 0.1);
* }
*/
void user_keyboard(MbsData* mbs_data, Simu_realtime *realtime, int cur_t_usec, const Uint8 *keystates)
void user_keyboard(MbsData* mbs_data, Simu_realtime *realtime, int cur_t_usec, const uint8_t *keystates)
{
}
......
......@@ -75,6 +75,9 @@ function(mbsysc_specific_flags) # flag for lib_mbsysC only (not set by project)
# enable frame capture to record screenshot of the simulation
cmake_dependent_option(FLAG_FRAME_CAPTURE "Enable frame capture (need OpenGL)" OFF "FLAG_OPEN_GL" OFF)
# use the websocket to display in real-time the animation
cmake_dependent_option(FLAG_WEBSOCKET "Enable web 3D visualization" ON "FLAG_VISU" OFF)
endfunction()
## -- Static, dynamic libraries -- ##
......@@ -106,12 +109,14 @@ function(flags_check)
set( FLAG_VISU OFF )
set( FLAG_JAVA OFF )
set( FLAG_OPEN_GL OFF )
set( FLAG_WEBSOCKET OFF )
endif( )
# 3D visu
if (NOT FLAG_VISU)
set( FLAG_JAVA OFF )
set( FLAG_OPEN_GL OFF )
set( FLAG_WEBSOCKET OFF )
endif( )
# OpenGL only if no Java
......@@ -119,6 +124,7 @@ function(flags_check)
set( FLAG_OPEN_GL OFF )
endif( )
# separate build
if (NOT FLAG_SEPARATE_BUILD)
set( FLAG_SEPARATE_SYMBOLIC OFF )
......@@ -165,6 +171,7 @@ function(flags_check)
set( FLAG_VISU ${FLAG_VISU} PARENT_SCOPE )
set( FLAG_JAVA ${FLAG_JAVA} PARENT_SCOPE )
set( FLAG_OPEN_GL ${FLAG_OPEN_GL} PARENT_SCOPE )
set( FLAG_WEBSOCKET ${FLAG_WEBSOCKET} PARENT_SCOPE )
set( FLAG_SHARED_LIB ${FLAG_SHARED_LIB} PARENT_SCOPE )
set( FLAG_SEPARATE_BUILD ${FLAG_SEPARATE_BUILD} PARENT_SCOPE )
set( FLAG_SEPARATE_SYMBOLIC ${FLAG_SEPARATE_SYMBOLIC} PARENT_SCOPE )
......@@ -195,6 +202,7 @@ function(flags_clean)
unset(FLAG_VISU CACHE)
unset(FLAG_JAVA CACHE)
unset(FLAG_OPEN_GL CACHE)
unset(FLAG_WEBSOCKET CACHE)
unset(JNI_INCLUDE_JNI CACHE)
unset(JNI_INCLUDE_JNI_MD CACHE)
unset(SDL2_LIBRARIES_SDL2 CACHE)
......@@ -267,5 +275,9 @@ function(definitions)
set(LIB_MBSYSC_DEFINITIONS ${LIB_MBSYSC_DEFINITIONS} -DFRAME_CAPTURE)
endif( )
if(FLAG_WEBSOCKET)
add_definitions( -DWEBSOCKET )
endif( )
set(LIB_MBSYSC_DEFINITIONS ${LIB_MBSYSC_DEFINITIONS} PARENT_SCOPE)
endfunction()
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment