Commit 7bad8df5 by Kai Westerkamp

openvr

parent dc14bdd3
Pipeline #241 passed with stage
in 19 seconds
...@@ -10,3 +10,6 @@ ...@@ -10,3 +10,6 @@
[submodule "3d-tiles-samples"] [submodule "3d-tiles-samples"]
path = 3d-tiles-samples path = 3d-tiles-samples
url = https://github.com/AnalyticalGraphicsInc/3d-tiles-samples.git url = https://github.com/AnalyticalGraphicsInc/3d-tiles-samples.git
[submodule "openvr"]
path = openvr
url = https://github.com/ValveSoftware/openvr.git
...@@ -54,15 +54,20 @@ ...@@ -54,15 +54,20 @@
<WarningLevel>Level3</WarningLevel> <WarningLevel>Level3</WarningLevel>
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat> <DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
<Optimization>Disabled</Optimization> <Optimization>Disabled</Optimization>
<AdditionalIncludeDirectories>glew-2.0.0-win32\glew-2.0.0\include;freeglut-MSVC-3.0.0-2.mp\freeglut\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> <AdditionalIncludeDirectories>..\openvr\headers;glew-2.0.0-win32\glew-2.0.0\include;freeglut-MSVC-3.0.0-2.mp\freeglut\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
</ClCompile> </ClCompile>
<Link> <Link>
<TargetMachine>MachineX86</TargetMachine> <TargetMachine>MachineX86</TargetMachine>
<GenerateDebugInformation>true</GenerateDebugInformation> <GenerateDebugInformation>true</GenerateDebugInformation>
<SubSystem>Windows</SubSystem> <SubSystem>Windows</SubSystem>
<EntryPointSymbol>mainCRTStartup</EntryPointSymbol> <EntryPointSymbol>mainCRTStartup</EntryPointSymbol>
<AdditionalLibraryDirectories>freeglut-MSVC-3.0.0-2.mp\freeglut\bin;glew-2.0.0-win32\glew-2.0.0\bin\Release\Win32;glew-2.0.0-win32\glew-2.0.0\lib\Release\Win32;freeglut-MSVC-3.0.0-2.mp\freeglut\lib;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories> <AdditionalLibraryDirectories>..\openvr\bin\win32;..\openvr\lib\win32;freeglut-MSVC-3.0.0-2.mp\freeglut\bin;glew-2.0.0-win32\glew-2.0.0\bin\Release\Win32;glew-2.0.0-win32\glew-2.0.0\lib\Release\Win32;freeglut-MSVC-3.0.0-2.mp\freeglut\lib;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
<AdditionalDependencies>openvr_api.lib;%(AdditionalDependencies)</AdditionalDependencies>
</Link> </Link>
<PostBuildEvent>
<Command>
</Command>
</PostBuildEvent>
</ItemDefinitionGroup> </ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<ClCompile> <ClCompile>
...@@ -84,6 +89,7 @@ ...@@ -84,6 +89,7 @@
<ItemGroup> <ItemGroup>
<ClCompile Include="glut.cpp" /> <ClCompile Include="glut.cpp" />
<ClCompile Include="main.cpp" /> <ClCompile Include="main.cpp" />
<ClCompile Include="SteamVrTrackingServer.cpp" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<ClInclude Include="glut.h" /> <ClInclude Include="glut.h" />
......
...@@ -21,6 +21,9 @@ ...@@ -21,6 +21,9 @@
<ClCompile Include="main.cpp"> <ClCompile Include="main.cpp">
<Filter>Source Files</Filter> <Filter>Source Files</Filter>
</ClCompile> </ClCompile>
<ClCompile Include="SteamVrTrackingServer.cpp">
<Filter>Source Files</Filter>
</ClCompile>
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<ClInclude Include="glut.h"> <ClInclude Include="glut.h">
......
...@@ -3,10 +3,7 @@ ...@@ -3,10 +3,7 @@
#include <iostream> #include <iostream>
#include <thread> #include <thread>
#include <sstream> #include <sstream>
#include <boost/program_options.hpp>
#include <openvr.h> #include <openvr.h>
#include <SimpleAmqpClient/SimpleAmqpClient.h>
struct Config struct Config
...@@ -21,7 +18,6 @@ struct Config ...@@ -21,7 +18,6 @@ struct Config
bool running_ = true; bool running_ = true;
AmqpClient::Channel::ptr_t connection_ = nullptr;
vr::IVRSystem *vr_system_ = nullptr; vr::IVRSystem *vr_system_ = nullptr;
vr::TrackedDevicePose_t tracked_device_poses_[vr::k_unMaxTrackedDeviceCount]; vr::TrackedDevicePose_t tracked_device_poses_[vr::k_unMaxTrackedDeviceCount];
...@@ -32,29 +28,7 @@ void signalHandler(int signum) ...@@ -32,29 +28,7 @@ void signalHandler(int signum)
bool init() bool init()
{ {
// Connect to Amqp server
try
{
std::cout << "Connecting to host " << config_.hostname << std::endl;
connection_ = AmqpClient::Channel::Create(config_.hostname);
std::cout << "Declaring exchange " << config_.exchange << std::endl;
connection_->DeclareExchange(config_.exchange, AmqpClient::Channel::EXCHANGE_TYPE_FANOUT);
}
catch (const AmqpClient::ChannelErrorException &ex)
{
std::cerr << "ChannelErrorException: " << ex.reply_code() << " - " << ex.reply_text() << std::endl;
}
catch (const std::exception &ex)
{
std::cerr << "Could not connect to AMQP server: " << ex.what() << std::endl;
std::cout << "Tracking without publishing AMQP messages..." << std::endl;
}
if (connection_)
{
std::cout << "Connected to AMQP server. Publishing about " << config_.messages_per_second << " messages per second." << std::endl;
}
// Loading the SteamVR Runtime // Loading the SteamVR Runtime
vr::EVRInitError eError = vr::VRInitError_None; vr::EVRInitError eError = vr::VRInitError_None;
vr_system_ = vr::VR_Init(&eError, vr::VRApplication_Overlay); vr_system_ = vr::VR_Init(&eError, vr::VRApplication_Overlay);
...@@ -68,7 +42,6 @@ bool init() ...@@ -68,7 +42,6 @@ bool init()
return false; return false;
} }
//m_pRenderModels = (vr::IVRRenderModels *)vr::VR_GetGenericInterface(vr::IVRRenderModels_Version, &eError); //m_pRenderModels = (vr::IVRRenderModels *)vr::VR_GetGenericInterface(vr::IVRRenderModels_Version, &eError);
//if (!m_pRenderModels) //if (!m_pRenderModels)
//{ //{
...@@ -161,49 +134,15 @@ void printMatrix(const vr::HmdMatrix34_t &htm) ...@@ -161,49 +134,15 @@ void printMatrix(const vr::HmdMatrix34_t &htm)
} }
} }
int main(int argc, char *argv[]) int main2(int argc, char *argv[])
{ {
boost::program_options::options_description desc("Allowed options");
desc.add_options()
("help,h", "Show this help message")
("list,l", "Show connected VR devices")
("host", boost::program_options::value<std::string>(&config_.hostname)->default_value("127.0.0.1"), "AMQP server")
("port,p", boost::program_options::value<int>(&config_.port)->default_value(5672), "AMQP port")
("exchange,e", boost::program_options::value<std::string>(&config_.exchange), "Exchange on the AMQP server")
("messages_per_second,m", boost::program_options::value<int>(&config_.messages_per_second)->default_value(60), "Maximum number of messages published to AMQP server (<= 0 means unlimited)")
("verbose,v", boost::program_options::bool_switch(&config_.debug)->default_value(false), "Show verbose debug output")
;
boost::program_options::variables_map vm;
try
{
boost::program_options::store(boost::program_options::parse_command_line(argc, argv, desc), vm);
boost::program_options::notify(vm);
}
catch (boost::program_options::error &e)
{
std::cerr << "Error parsing command line arguments: " << e.what() << std::endl;
return 1;
}
if (vm.count("help"))
{
std::cout << desc << std::endl;
return 0;
}
if (config_.debug)
{
std::cout << "Debug output enabled" << std::endl;
}
if (!init()) if (!init())
{ {
shutdown(); shutdown();
return 1; return 1;
} }
if (vm.count("list")) if (false)
{ {
std::cout << "List of available VR devices:" << std::endl; std::cout << "List of available VR devices:" << std::endl;
for (int nDevice = 0; nDevice < vr::k_unMaxTrackedDeviceCount; ++nDevice) for (int nDevice = 0; nDevice < vr::k_unMaxTrackedDeviceCount; ++nDevice)
...@@ -342,12 +281,6 @@ int main(int argc, char *argv[]) ...@@ -342,12 +281,6 @@ int main(int argc, char *argv[])
{ {
std::cout << message.str() << std::endl; std::cout << message.str() << std::endl;
} }
if (connection_)
{
AmqpClient::BasicMessage::ptr_t test = AmqpClient::BasicMessage::Create(message.str());
connection_->BasicPublish(config_.exchange, "", test);
}
} }
if (config_.messages_per_second > 0) if (config_.messages_per_second > 0)
......
...@@ -47,7 +47,7 @@ bool initKinect() { ...@@ -47,7 +47,7 @@ bool initKinect() {
sensor->OpenMultiSourceFrameReader( sensor->OpenMultiSourceFrameReader(
FrameSourceTypes::FrameSourceTypes_Depth | FrameSourceTypes::FrameSourceTypes_Color, FrameSourceTypes::FrameSourceTypes_Depth | FrameSourceTypes::FrameSourceTypes_Color,
&reader); &reader);
return reader; return reader?true:false;
} else { } else {
return false; return false;
} }
......
Subproject commit bcac1bfbe2be3c1ff37e4f62b8e412fcdf29248e
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