Widget request: Extract model data - Page 3

Widget request: Extract model data

Discuss Lua based Spring scripts (LuaUI widgets, mission scripts, gaia scripts, mod-rules scripts, scripted keybindings, etc...)

Moderator: Moderators

Kloot
Spring Developer
Posts: 1867
Joined: 08 Oct 2006, 16:58

Re: Widget request: Extract model data

Post by Kloot »

Argh wrote: Kloot, do you have any source you'd be willing to share?
Yes and no, respectively (I don't do prefab requests for lazy people). But regarding...
I'm stuck at step 1 of the process: how do we convert the header and the rest of the hex back into a format we can use?
... I'll point you to the bottom section of http://springrts.com/wiki/Lua_VFS.

PS. this is XTA 9.58's core_commander.s3o Lua-converted to .obj:
core_commander.txt
(485.88 KiB) Downloaded 17 times
User avatar
Argh
Posts: 10920
Joined: 21 Feb 2005, 03:38

Re: Widget request: Extract model data

Post by Argh »

OK, so we'd want to use VFS.Unpack, which is essentially doing what struct does?

Okie doke. Do I have to provide the offset or count?
User avatar
lurker
Posts: 3842
Joined: 08 Jan 2007, 06:13

Re: Widget request: Extract model data

Post by lurker »

There's a lua .obj reader in tools/
User avatar
AF
AI Developer
Posts: 20687
Joined: 14 Sep 2004, 11:32

Re: Widget request: Extract model data

Post by AF »

Im sure somebodies implemented a lua s3o loader of some kind already, if someone can link? I didn't know there was an obj loader in tools though
User avatar
FLOZi
MC: Legacy & Spring 1944 Developer
Posts: 6242
Joined: 29 Apr 2005, 01:14

Re: Widget request: Extract model data

Post by FLOZi »

Someone (trepan & pressureline) implemented a lua obj loader (including textures) but never a straightforward s3o loader.
User avatar
Argh
Posts: 10920
Joined: 21 Feb 2005, 03:38

Re: Widget request: Extract model data

Post by Argh »

Meh. I'll look at the one in /tools, see if I can get it to work. And so far as I know, no, there is no straightforward S3O loader, other than whatever Kloot has. Which sucks, because I'd rather keep all of it using the same geometry format, instead of building some of the things I want to try out and then having it be incomprehensibly difficult because it involves thinking about mixed formats, etc.
User avatar
Pressure Line
Posts: 2283
Joined: 21 May 2007, 02:09

Re: Widget request: Extract model data

Post by Pressure Line »

FLOZi wrote:Someone (trepan & pressureline) implemented a lua obj loader (including textures) but never a straightforward s3o loader.
trepan wrote the loader and the .obj->.lua converter, i implimented a use for it

iirc there's draw s3ounitshape... so all you need to do is make a nonsense .fbi for the model you want to use, and then use that. if i knew how to read from a config file (in a similar format to the lups one perhaps?) i could easily finish off the texture-per-object project that i started 2 years ago. kinda like knowing how to build a house, but then realising you dont know how to use a hammer.
User avatar
Tribulex
A.N.T.S. Developer
Posts: 1894
Joined: 26 Sep 2009, 21:26

Re: Widget request: Extract model data

Post by Tribulex »

Pressure Line wrote:
FLOZi wrote:Someone (trepan & pressureline) implemented a lua obj loader (including textures) but never a straightforward s3o loader.
trepan wrote the loader and the .obj->.lua converter, i implimented a use for it

iirc there's draw s3ounitshape... so all you need to do is make a nonsense .fbi for the model you want to use, and then use that. if i knew how to read from a config file (in a similar format to the lups one perhaps?) i could easily finish off the texture-per-object project that i started 2 years ago. kinda like knowing how to build a house, but then realising you dont know how to use a hammer.
Thanks but i do not need to DRAW the data using openGL.
User avatar
Argh
Posts: 10920
Joined: 21 Feb 2005, 03:38

Re: Widget request: Extract model data

Post by Argh »

if i knew how to read from a config file (in a similar format to the lups one perhaps?)
That, I can help with.

include("Configs/yourConfig.lua") where the config is valid Lua. Usually, this means reading a table, or a series of tables.
Post Reply

Return to “Lua Scripts”