Outerra forum

Please login or register.

Login with username, password and session length
Advanced search  

News:

Download Outerra Tech Demo. Unofficial Outerra Discord server, MicroProse Discord server for OWS.

Pages: [1] 2 3 ... 7

Author Topic: TrackIR  (Read 91280 times)

Deejayseesee

  • Newbie
  • Posts: 2
TrackIR
« on: April 13, 2011, 10:08:17 pm »

The implementation of TrackIR would be fantastic for an engine like Outerra. It has proven to work wonders in flight, racing and military situations and will immerse the gamer more into the experience.

http://www.naturalpoint.com/trackir/

[video][/video]

[video][/video]


Regards,
David Charnock
Logged

cameni

  • Brano Kemen
  • Outerra Administrator
  • Hero Member
  • *****
  • Posts: 6721
  • No sense of urgency.
    • outerra.com
TrackIR
« Reply #1 on: April 14, 2011, 05:38:35 am »

It should not be a problem to implement a support for it, and we expect we'll integrate it in near future. I don't entirely like the NDA NaturalPoint want us to sign before being able to get our hands on the SDK though.
TrackIR support may come from a third party as a plugin, removing potential restrictions from everyone else (if it's possible).
Logged

Alcook

  • Newbie
  • Posts: 1
  • newbie
Re: TrackIR
« Reply #2 on: March 07, 2012, 04:50:38 am »

Hi

+1 need Track IR support, it increases immersion.

@Outerra Team: I love you, I never seen a so realistic real time environnement.
Logged

[deleted]

  • Full Member
  • ***
  • Posts: 232
Re: TrackIR
« Reply #3 on: March 07, 2012, 09:38:47 am »

Very old thread :P
And I suggested a freetrack support too.
Logged

KelvinNZ

  • Hero Member
  • *****
  • Posts: 509
  • A clock that doesn't work still works twice a day!
Re: TrackIR
« Reply #4 on: March 08, 2012, 07:47:54 pm »

Ok, so for the time being why not use EZDok camera
Logged
If a man who cannot count finds a four-leaf clover, is he lucky?

Andrey

  • Jr. Member
  • *
  • Posts: 14
  • newbie
Re: TrackIR
« Reply #5 on: March 09, 2012, 05:19:51 am »

Track IR would be cool feature. I'm looking forward for joystick "change view" lever support first... Or maybe it's already included just need to update drivers ?...

PS Picture to explain

 - "change view"  leverlit
Logged

pico

  • Full Member
  • ***
  • Posts: 223
    • http://
Re: TrackIR
« Reply #6 on: March 09, 2012, 05:49:26 am »

Freetracksoftware allows you to control the Mouse. I use it sometimes in Outerra. ;)
Logged

Andrey

  • Jr. Member
  • *
  • Posts: 14
  • newbie
Re: TrackIR
« Reply #7 on: March 09, 2012, 05:58:00 am »

Freetracksoftware allows you to control the Mouse. I use it sometimes in Outerra. ;)

Mouse is working okay, that's true ) However is not very comfortable inside the cockpit.
Btw, not to create new topic - is any way to change camera focal length ?... Didn't find this feature..

I'm not great in Engligh so one more picture to explain


Logged

cameni

  • Brano Kemen
  • Outerra Administrator
  • Hero Member
  • *****
  • Posts: 6721
  • No sense of urgency.
    • outerra.com
Re: TrackIR
« Reply #8 on: March 09, 2012, 06:43:02 am »

FOV in graphics settings.
« Last Edit: March 09, 2012, 06:54:04 am by cameni »
Logged

[deleted]

  • Full Member
  • ***
  • Posts: 232
Re: TrackIR
« Reply #9 on: March 09, 2012, 10:29:23 am »

Freetracksoftware allows you to control the Mouse. I use it sometimes in Outerra. ;)

That function is a little buggy for me :>
Logged

Andrey

  • Jr. Member
  • *
  • Posts: 14
  • newbie
Re: TrackIR
« Reply #10 on: March 09, 2012, 10:44:35 am »

FOV in graphics settings.

Thanks! Working! ) It would be cool to change it with ctrl+mouse wheel or something like this...
« Last Edit: March 09, 2012, 10:54:15 am by Andrey »
Logged

foobie42

  • Member
  • **
  • Posts: 63
  • newbie
Re: TrackIR
« Reply #11 on: January 24, 2013, 05:07:00 pm »

I can write you code and release it under public domain that implements TIR API. No NDA/SDK needed, no blobs either.

Best to send mail but I'll try to check the forum.
Logged

cameni

  • Brano Kemen
  • Outerra Administrator
  • Hero Member
  • *****
  • Posts: 6721
  • No sense of urgency.
    • outerra.com
Re: TrackIR
« Reply #12 on: January 25, 2013, 04:19:47 am »

That would be perfect. We are going to create an API for custom input devices, this could be one of the things supported this way.
Logged

foobie42

  • Member
  • **
  • Posts: 63
  • newbie
Re: TrackIR
« Reply #13 on: January 25, 2013, 06:12:30 am »

Disclaimer: I never owned NP software or hardware. Never signed any EULA, NDA or whatnot. This code might work but it's best if you test it on a TIR device. Tell me of bugs! I will self-flagellate in contempt...

Also I know no disassembly! And don't know where to find NPClient{64,}.dll!

Code: [Select]
/* This is free and unencumbered software released into the public domain.

 * Anyone is free to copy, modify, publish, use, compile, sell, or
 * distribute this software, either in source code form or as a compiled
 * binary, for any purpose, commercial or non-commercial, and by any
 * means.
 *
 * In jurisdictions that recognize copyright laws, the author or authors
 * of this software dedicate any and all copyright interest in the
 * software to the public domain. We make this dedication for the benefit
 * of the public at large and to the detriment of our heirs and
 * successors. We intend this dedication to be an overt act of
 * relinquishment in perpetuity of all present and future rights to this
 * software under copyright law.
 *
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
 * IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR
 * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
 * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
 * OTHER DEALINGS IN THE SOFTWARE.
*/

#include <stdlib.h>
#include <stdio.h>
/* this is unfortunately necessary as the API is Windows-only */
#include <windows.h>

#ifdef __cplusplus
#  define MY_EXTERN extern "C"
#else
#  define MY_EXTERN
#define MY_EXPORT(ret) MY_EXTERN ret __declspec(dllexport) __cdecl
#endif

#pragma pack(push, 1)
typedef struct {
  __int16 status; /* zero means success, it's easy to forget! */
  __int16 frame; /* if idempotent, device paused */
  __int32 padding;
  float roll, pitch, yaw; /* divide by 8191 when received, in radians */
  float x, y, z; /* between -16383 and 16383 */
  float padding2[9];
} tir_headpose_t;
#pragma pack(pop)

typedef struct {
HMODULE hlibrary;
__int32 (__stdcall* tir_reghwnd)(HWND hwnd);
__int32 (__stdcall* tir_regprogid)(__int16 progid);
__int32 (__stdcall* tir_queryver)(__int16* version);
__int32 (__stdcall* tir_reqdata)(__int16 bitmask);
__int32 (__stdcall* tir_stopcurs)(void);
__int32 (__stdcall* tir_startxmit)(void);
__int32 (__stdcall* tir_getdata)(tir_headpose_t* pose);
/* there are more functions, especially for cleaning up
* but the library is typically called on startup
* and unloaded on exit. if you really must add them,
* you can either extract them from NPClient.dll or
* google for it. for instance I once found symbols
* and some constants in Doxygen format...
* if you REALLY need them I can finish the damn thing
* but it's so much boilerplate :(
*/
} tir_state_t;

MY_EXPORT(tir_state_t*) mytir_init(void)
{
HKEY hkey = NULL;
tir_state_t* ret;
int i;
DWORD sz = 1900;
/* Windows paths are limited to 260 characters */
char buf[2048];

ret = malloc(sizeof(tir_state_t));
if (ret == NULL)
return NULL;
memset(ret, 0, sizeof(tir_state_t));
RegOpenKeyExA(HKEY_CURRENT_USER, "Software\\NaturalPoint\\NATURALPOINT\\NPClient Location", 0, KEY_QUERY_VALUE, &hkey);
if (!hkey)
goto error;
buf[0] = '\0';
if (RegQueryValueExA(hkey, "Path", NULL, NULL, buf, &sz) != ERROR_SUCCESS)
goto error;
(void) RegCloseKey(hkey);
hkey = NULL;
buf[2047] = '\0';
for (i = 0; buf[i]; i++)
if (buf[i] == '/')
buf[i] = '\\';
/* in the registry path there's normally a trailing slash already */
#ifdef MY_BUILD_AMD64
strcat(buf, "NPClient64.dll");
#else
strcat(buf, "NPClient.dll");
#endif
ret->hlibrary = LoadLibraryA(buf);
if (ret->hlibrary == NULL)
goto error;
if ((ret->tir_reghwnd = GetProcAddress(ret->hlibrary, "NP_RegisterWindowHandle")) == NULL)
goto error;
if ((ret->tir_regprogid = GetProcAddress(ret->hlibrary, "NP_RegisterProgramProfileID")) == NULL)
goto error;
if ((ret->tir_queryver = GetProcAddress(ret->hlibrary, "NP_QueryVersion")) == NULL)
goto error;
if ((ret->tir_reqdata = GetProcAddress(ret->hlibrary, "NP_RequestData")) == NULL)
goto error;
if ((ret->tir_stopcurs = GetProcAddress(ret->hlibrary, "NP_StopCursor")) == NULL)
goto error;
if ((ret->tir_startxmit = GetProcAddress(ret->hlibrary, "NP_StartDataTransmission")) == NULL)
goto error;
if ((ret->tir_getdata = GetProcAddress(ret->hlibrary, "NP_GetData")) == NULL)
goto error;
return ret;
error:
if (hkey)
  (void) RegCloseKey(hkey);
free(ret);
/* sorry but I don't know anything about unloading DLLs. unless you do, there's a handle leak */
/* if you unload it, no need to touch function pointers, they just become invalid */
return NULL;
}

MY_EXPORT(void) mytir_start(tir_state_t* state, HWND window_handle)
{
__int16 tmp;
/* while you have to call it, can pass anything valid, like desktop handle I suppose? */
(void) state->tir_reghwnd(window_handle);
(void) state->tir_regprogid(1901); /* Falcon 4, an old flight simulation. Need to pass valid Id */
(void) state->tir_queryver(&tmp); /* better to call it, even if we don't care about it! */
(void) state->tir_reqdata(119); /* specifies which elements of the pose structure to return */
(void) state->tir_stopcurs(); /* better to call it */
(void) state->tir_startxmit(); /* idem */
}

MY_EXPORT(void) mytir_get_pose(tir_state_t* state, tir_headpose_t* ret)
{
memset(ret, 0, sizeof(tir_headpose_t));
ret->status = 1; /* if the call fails for some reason, at least we shouldn't think we have a valid pose when we don't */
(void) state->tir_getdata(ret);
}

#ifdef MY_DEMO
int main(void)
{
tir_state_t* state;
int i;
tir_headpose_t ret;

state = mytir_init();
if (!state)
return 1;
mytir_start(state, GetDesktopWindow());
for (i = 0; i < 3600; i++)
{
mytir_get_pose(state, &ret);
if (ret.status)
return 1;
printf("%f %f %f ~ %f %f %f\n", ret.yaw * 180 / 3.14 / 8191, ret.pitch * 180 / 3.14 / 8191, ret.roll * 180 / 3.14 / 8191, ret.x, ret.y, ret.z);
Sleep(35);
}
return 0;
}
#endif
« Last Edit: January 25, 2013, 06:25:46 am by foobie42 »
Logged

foobie42

  • Member
  • **
  • Posts: 63
  • newbie
Re: TrackIR
« Reply #14 on: January 26, 2013, 05:07:32 am »

Can someone try the damn thing on a TIR device and tell me if it works?
Logged
Pages: [1] 2 3 ... 7