Outerra forum

Please login or register.

Login with username, password and session length
Advanced search  

News:

Outerra Tech Demo download. Help with graphics driver issues

Pages: [1] 2 3 ... 15

Author Topic: Integrating with another sim  (Read 110066 times)

planetsim

  • Jr. Member
  • *
  • Posts: 38
  • newbie
Integrating with another sim
« on: May 28, 2014, 02:17:55 pm »

Hi,

I am currently building a D3D11 based rendering engine for a space flight simulator called Orbiter. http://orbit.medphys.ucl.ac.uk/
It supports the simulation of the Solar System. I would love to try and integrate it with Outerra rendering. From what I understand so far, other planets are planned in the future once the engine is fully tested out with Earth.

I was wondering if its currently possible to set the camera position in Outerra through C++ or any other language. If I want to render spacecraft meshes on the top of what Outerra has rendered, is that possible ? What if I want to render a celestial sphere/stars and then make Outerra start its planet rendering ?

I want to try this only for Earth now of course.

« Last Edit: May 28, 2014, 02:19:44 pm by planetsim »
Logged

John514

  • Hero Member
  • *****
  • Posts: 543
  • Certified TARDIS driver.
Re: Integrating with another sim
« Reply #1 on: May 28, 2014, 02:22:43 pm »

Could be possible. Lets see what Cameni (one of the devs) thinks about that!
-------------------------------Off topic(kinda)---------------------------------
(BTW since you seem to interested, the launch for the ISS is about an hour from now.
http://www.ustream.tv/nasahdtv)
Logged
You mustn't be afraid to dream a little bigger, darling

Note: I do not claim to know everything.
I just like to help people around the forum.

PytonPago

  • Hero Member
  • *****
  • Posts: 2284
  • It´s way too complex, dont let me try to explain !
Re: Integrating with another sim
« Reply #2 on: May 28, 2014, 04:09:19 pm »

Could be possible. Lets see what Cameni (one of the devs) thinks about that!
-------------------------------Off topic(kinda)---------------------------------
(BTW since you seem to interested, the launch for the ISS is about an hour from now.
http://www.ustream.tv/nasahdtv)

 ... wow ... just oppened it for lift-off. That was some timing ! .....
Logged
We are still undeveloped as long as we don´t realize, that all our science is still descriptive, and than beyond that description lies a whole new world we just haven´t even started to fully understand.

cameni

  • Brano Kemen
  • Outerra Administrator
  • Hero Member
  • *****
  • Posts: 6721
  • No sense of urgency.
    • outerra.com
Re: Integrating with another sim
« Reply #3 on: June 01, 2014, 06:21:19 am »

I was wondering if its currently possible to set the camera position in Outerra through C++ or any other language. If I want to render spacecraft meshes on the top of what Outerra has rendered, is that possible ? What if I want to render a celestial sphere/stars and then make Outerra start its planet rendering ?
It's possible to use the IGC API to control the camera externally, but that's mainly for cases when the cockpit is external (not rendered) as well. We could perhaps extend it to include the ability to control also the position & orientation of an imported model the same way.
Logged

planetsim

  • Jr. Member
  • *
  • Posts: 38
  • newbie
Re: Integrating with another sim
« Reply #4 on: June 02, 2014, 03:00:54 am »

Thank you for your reply, Cameni. Yeah so there are 3 things here:
1. Controlling the free camera, which is the mode that Outerra is in when started.
2. Controlling the transformation of imported models.
3. Controlling the camera when 'inside' a cockpit.

It seems that the IGC API already supports 1 so I can start using that.

For 2, one way to do it is to provide a base class called Vessel (or something similar) that implements the basic API for importing meshes and transforming/drawing them in the world frame. Each object of Vessel could have a world transformation matrix that will contain its position and orientation. If an user wants to add extra functionality to a vessel then he can derive from Vessel. During rendering this world matrix * view matrix * perspective projection matrix = final co-ordinates on screen.

For 3, its important to know that we are in 'cockpit mode' and which vessel/vehicle/model inside whose cockpit we are presently located. Once these are known then the mouse can be used to control a cockpit camera which I guess will use a different projection with a different field of view perhaps. It will probably have bounds on the amount it can translate in each direction. If the IGC API can provide functions to activate a cockpit camera and choose the vessel inside which to focus then this can be done pretty easily.

In Orbiter, the rendering engine keeps track of a few things things to ease the process of getting in to cockpit mode and out into the external world again. There is always a 'focus object' and the camera is generally focussed on it when the object is chosen. But it can be moved as far away from this object as we want. If the focussed object is a vessel(as opposed to a planet) and this vessel provides a mesh of the cockpit and a cockpit camera position, then pressing a key will activate the cockpit camera mode and the user will be 'inside'. Pressing another key brings him back out again to the external world with a free roving camera. The cockpit mode is simply the cockpit mesh as it looks like from inside, drawn after the scenery has finished drawing.


« Last Edit: June 02, 2014, 03:05:56 am by planetsim »
Logged

cameni

  • Brano Kemen
  • Outerra Administrator
  • Hero Member
  • *****
  • Posts: 6721
  • No sense of urgency.
    • outerra.com
Re: Integrating with another sim
« Reply #5 on: June 02, 2014, 06:01:05 am »

2) is normally done using the normal import process in OT, see the importer board and various vehicle scripts that animate parts of the model. One thing is that you'll have a problem communicating from the dll to vehicle's script. However, vehicle scripts can actually run in dll plugins as well, the Javascript API is generated from C++ API. We just need to define means of defining that given vehicle does not use a script but a dll.

3) is handled inside the script as well.
Logged

planetsim

  • Jr. Member
  • *
  • Posts: 38
  • newbie
Re: Integrating with another sim
« Reply #6 on: June 02, 2014, 06:54:48 am »

ok, I ll check it out. So there is a script in written in Javascript and a C++ dll plugin ?

I guess if I choose to do so, then I can implement everything entirely in C++ also ?
Logged

cameni

  • Brano Kemen
  • Outerra Administrator
  • Hero Member
  • *****
  • Posts: 6721
  • No sense of urgency.
    • outerra.com
Re: Integrating with another sim
« Reply #7 on: June 02, 2014, 07:16:18 am »

IGC API is both C++ and JS, though it probably doesn't make much sense to use via JS.
Common vehicle scripts are written in JS, but they can be also written in C++, though that part isn't accessible yet in the demo.
Logged

planetsim

  • Jr. Member
  • *
  • Posts: 38
  • newbie
Re: Integrating with another sim
« Reply #8 on: June 02, 2014, 07:45:09 am »

Thanks for the reply.

Is it possible to render anything myself in OpenGL in C++ before the OT planet rendering begins ? Say I want to draw stars or a celestial reference grid(when the camera is in space) before planet rendering begins. Is it possible to register a callback to get a 'call' before OT rendering ?
Logged

cameni

  • Brano Kemen
  • Outerra Administrator
  • Hero Member
  • *****
  • Posts: 6721
  • No sense of urgency.
    • outerra.com
Re: Integrating with another sim
« Reply #9 on: June 02, 2014, 07:53:50 am »

No. Renderer thread is separate from the application thread, so it's not possible (without some special support). There will be a 2D/3D drawing API for these things.
Logged

planetsim

  • Jr. Member
  • *
  • Posts: 38
  • newbie
Re: Integrating with another sim
« Reply #10 on: June 02, 2014, 07:57:37 am »

Ah ok and this API will record the 2D/3D drawing calls from the application thread and queue them for drawing on the rendering thread I guess :)
Logged

planetsim

  • Jr. Member
  • *
  • Posts: 38
  • newbie
Re: Integrating with another sim
« Reply #11 on: June 02, 2014, 12:05:26 pm »

Running into an error while compiling the plugin project. Upgraded to Visual Studio 13 when opening :

http://s28.postimg.org/tjy85rmul/error.png
Logged

cameni

  • Brano Kemen
  • Outerra Administrator
  • Hero Member
  • *****
  • Posts: 6721
  • No sense of urgency.
    • outerra.com
Re: Integrating with another sim
« Reply #12 on: June 02, 2014, 02:04:51 pm »

Please remove the comm_static project from the solution, and add one from include\comm\_build\msvc\2013\ there instead.
Logged

planetsim

  • Jr. Member
  • *
  • Posts: 38
  • newbie
Re: Integrating with another sim
« Reply #13 on: June 02, 2014, 10:59:48 pm »

Ok, did that. Getting some linking errors now :

Error   2   error LNK2019: unresolved external symbol "protected: struct coid::thread __thiscall coid::thread_manager::thread_start(struct coid::thread_manager::info *)" (?thread_start@thread_manager@coid@@IAE?AUthread@2@PAUinfo@12@@Z) referenced in function "public: struct coid::thread __thiscall coid::thread_manager::thread_create(void *,void * (__cdecl*)(void *),void *,struct coid::token const &)" (?thread_create@thread_manager@coid@@QAE?AUthread@2@PAXP6APAX0@Z0ABUtoken@2@@Z)   F:\Code\Orbiter\Outerra\ot-api\ot-api\example\igc_plugin\comm_staticd.lib(pthreadx.obj)   igc_plugin

Error   3   error LNK1120: 2 unresolved externals   F:\Code\Orbiter\Outerra\ot-api\ot-api\example\igc_plugin\Debug\igc_plugin.dll   1   1   igc_plugin

Error   1   error LNK2019: unresolved external symbol "public: static void * __cdecl coid::interface_register::get_interface_creator(struct coid::token const &)" (?get_interface_creator@interface_register@coid@@SAPAXABUtoken@2@@Z) referenced in function "public: static class iref<class igc_plugin> __cdecl ot::igc::get<class igc_plugin>(class igc_plugin *)" (??$get@Vigc_plugin@@@igc@ot@@SA?AV?$iref@Vigc_plugin@@@@PAVigc_plugin@@@Z)   F:\Code\Orbiter\Outerra\ot-api\ot-api\example\igc_plugin\igc_plugin.obj   igc_plugin
Logged

cameni

  • Brano Kemen
  • Outerra Administrator
  • Hero Member
  • *****
  • Posts: 6721
  • No sense of urgency.
    • outerra.com
Re: Integrating with another sim
« Reply #14 on: June 03, 2014, 02:27:32 am »

I've updated the example to build with VS2013.
Logged
Pages: [1] 2 3 ... 15