Page 3 of 8

Re: WebGL effort

Posted: Thu Jul 02, 2015 4:33 pm
by kanthoney
Is this any good?

Re: WebGL effort

Posted: Thu Jul 02, 2015 4:46 pm
by grondilu
kanthoney wrote:
Is this any good?
Not sure.

$ python pltojs.py /usr/local/src/oolite/Resources/Config/shipdata.plist shipdata.json
Traceback (most recent call last):
File "pltojs.py", line 22, in <module>
if __name__ == "__main__": main()
File "pltojs.py", line 11, in main
plistObject = plistlib.readPlist(sys.argv[1])
File "/usr/lib/python2.7/plistlib.py", line 78, in readPlist
rootObject = p.parse(pathOrFile)
File "/usr/lib/python2.7/plistlib.py", line 406, in parse
parser.ParseFile(fileobj)
xml.parsers.expat.ExpatError: not well-formed (invalid token): line 1, column 0


From what I can guess from the help file, the python library plistlib only reads the XML version.

Re: WebGL effort

Posted: Thu Jul 02, 2015 5:19 pm
by cim
There's a large number of nodejs modules to parse plists, most of which would probably work with in-browser JS with minimal modifications
https://www.npmjs.com/search?q=plist

(Probably quite a few of them only work with XML or Binary rather than OpenStep format plists, but you might get lucky)

Re: WebGL effort

Posted: Sat Jul 04, 2015 1:33 pm
by grondilu
There are now only two models but that's because I rewrote quite a few things (in preparation for multi-textures models notably) and now the data conversion process is a bit more involved.

Until I find out how to convert the plist into JSON automatically, I do it manually (it's not too hard, fortunately). I also need to insert the mesh into the "model" entry. I will focus on doing things on a very few number of ships.

I can now read data such as a the "custom view" quaternions. I created a drop-down menu to select them. Interestingly enough I don't quite get the expected view, which means there is a coordinate system mismatch somewhere.

Image

EDIT: Ok apparemment les quaternions dans les fichiers plist sont au format W X Y Z et non X Y Z W comme dans glMatrix.

Re: WebGL effort

Posted: Sun Jul 05, 2015 1:20 pm
by grondilu
Ok I now understand how to put several ships in the scene their own attitude/position parameters.

Image

I should soon be able to tackle displacements.

I made this part in a different html page:

http://grondilu.github.io/oolite/

Re: WebGL effort

Posted: Mon Jul 06, 2015 12:06 pm
by grondilu
I got a first prototype of the compass working.

Image

http://grondilu.github.io/oolite/test-compass.html

Re: WebGL effort

Posted: Mon Jul 06, 2015 5:25 pm
by grondilu
OK, first try at controlling speed:

http://grondilu.github.io/oolite/test-coriolis.html

Image

Setting the matrices in the correct order and stuff was quite a headache. As a matter of fact I proceeded a bit by trial-and-error at some point so to be honest I'm not entirely sure everything is fine, but it seems OK.

Docking is obviously quite difficult without the scanner, not to mention the lack of fine tuning in the controls. But even with just the compass it seems doable.

Re: WebGL effort

Posted: Mon Jul 06, 2015 6:09 pm
by Norby
grondilu wrote:
the lack of fine tuning in the controls
Nice minigame, I can "dock" without problems from any angles, just I feel myself in an Anaconda and missing the return to zero of pitch/roll when I release the keys.

Re: WebGL effort

Posted: Wed Jul 08, 2015 11:40 am
by grondilu

Re: WebGL effort

Posted: Thu Jul 09, 2015 8:37 am
by grondilu
First attempt at drawing stars:

Image

http://grondilu.github.io/oolite/test-coriolis.html

I used the Hipparcos catalog and drew the stars as points on a large (1Mm but I could use any value) sphere around the observer.

Re: WebGL effort

Posted: Thu Jul 09, 2015 9:10 am
by cim
Looking good.
grondilu wrote:
I used the Hipparcos catalog and drew the stars as points on a large (1Mm but I could use any value) sphere around the observer.
"Sphere of fixed stars" is about how Oolite does it. Ours is only at 75km - but is drawn first in the scene with depth-buffering disabled, so appears to be behind everything.

Re: WebGL effort

Posted: Thu Jul 09, 2015 9:51 am
by another_commander
grondilu wrote:
First attempt at drawing stars:

Image

http://grondilu.github.io/oolite/test-coriolis.html

I used the Hipparcos catalog and drew the stars as points on a large (1Mm but I could use any value) sphere around the observer.
Can I have a laser so I can pew-pew the station?

Jokes aside, I like a lot where this is going. And the flight model as it is right now is interesting, too. It kind of feels Newtonian, but I find it very challenging.

Looking forward to the full game. ;-)

Re: WebGL effort

Posted: Thu Jul 09, 2015 10:25 am
by grondilu
cim wrote:
Looking good.
grondilu wrote:
I used the Hipparcos catalog and drew the stars as points on a large (1Mm but I could use any value) sphere around the observer.
"Sphere of fixed stars" is about how Oolite does it. Ours is only at 75km - but is drawn first in the scene with depth-buffering disabled, so appears to be behind everything.
Interestingly enough, I wrote a projection matrix especially for stars, with the far plane at the infinite (that's actually possible, because mat4.perspective has a limit for f -> infinity), so I could put the actual stellar distances in real units, and it'd still work. That'd be unnecessary since no parallax would be visible, but still.


PS. Just checked by setting the radius at 1e15m. Still works. Oops, sorry, I was not looking at the local branch. 1e15m is too big for some reason. Not sure why yet.

Re: WebGL effort

Posted: Thu Jul 09, 2015 10:26 am
by grondilu
another_commander wrote:
Jokes aside, I like a lot where this is going. And the flight model as it is right now is interesting, too. It kind of feels Newtonian, but I find it very challenging.
I suspect it's because you were looking at the compass too much, and it may still have bugs. (I've just made a few fixes but it's not tested much).

Re: WebGL effort

Posted: Thu Jul 09, 2015 10:50 am
by grondilu
If I try very hard to put the stars on an astronomical distance (say 1e15m), first I get nothing if I try with Float32Array. If instead I try with a Float64Array, I get an interesting artifact :

Image

The stars seem to align on particular directions in the sky. I suspect it's because of the lack of precision in the trigonometric functions.