Widget request: Extract model data
Moderator: Moderators
Widget request: Extract model data
Can someone right me some code to extract all the vertex and edge data, or just give me the coordinates of all the polys. Basically, i need the coordinates so that I can draw a wireframe.
Cookies, Cake, and Win,
The Management
Cookies, Cake, and Win,
The Management
-
- Moderator
- Posts: 2464
- Joined: 12 Oct 2007, 09:24
Re: Widget request: Extract model data
Look at how Ghost Radar did it.
Re: Widget request: Extract model data
This is not what i need. Reread the post. I dont want to draw it, i want to get the coordinates of the vertices, edges, and/or faces. I want to use this data to produce a 3d line drawing, but im not asking HOW to draw it. Im asking HOW to get the data.
Edit: Sorry, if i misunderstand something, please explain further. Thanks.
Edit: Sorry, if i misunderstand something, please explain further. Thanks.
Re: Widget request: Extract model data
ghost radar draws transparent units iirc.
and other widgets can draw the units in certain ways, for example the outline widget, the xray widget, the highlight unit thing.
so maybe its possible to modify this shaders to make a wireframe drawing?
and other widgets can draw the units in certain ways, for example the outline widget, the xray widget, the highlight unit thing.
so maybe its possible to modify this shaders to make a wireframe drawing?
Re: Widget request: Extract model data
hmmmm, how to clarify.....
[quote="d_b"]im not asking HOW to draw it. Im asking HOW to get the data.[/quote][/color]
[quote="d_b"]im not asking HOW to draw it. Im asking HOW to get the data.[/quote][/color]
Re: Widget request: Extract model data
AND STILL YOU DO NOT NEED THE DATA FOR DRAWING A WIREFRAME
Re: Widget request: Extract model data
You don't need the model data to draw a wireframe, you leave a shader under your pillow and the arghfairy comes in the night.
Re: Widget request: Extract model data
Code: Select all
gl.PolygonMode(GL.FRONT_AND_BACK,GL.LINE);
gl.Unit(unitId, true);
gl.PolygonMode(GL.FRONT_AND_BACK,GL.FILL);
Re: Widget request: Extract model data
Also, you can use a shader pass when running the gl.Unit() and do further manipulation of the data. So you can give that wireframe depth via color or color-cycle it or whatever you want really easily.
Spring won't currently just give us a vert list for a given Piece, so far as I know, but you can certainly do post-processing on the geometry, including vertex manipulation in GLSL.
That said, I don't think it's currently satisfactory. It should be possible to just request the raw Piece display list by Piece name, so that we can write specific shaders that don't require re-rendering the entire Unit, amongst other issues.
Spring won't currently just give us a vert list for a given Piece, so far as I know, but you can certainly do post-processing on the geometry, including vertex manipulation in GLSL.
That said, I don't think it's currently satisfactory. It should be possible to just request the raw Piece display list by Piece name, so that we can write specific shaders that don't require re-rendering the entire Unit, amongst other issues.
Re: Widget request: Extract model data
you could also answer his question instead of thinking ahead of what he really needs
Re: Widget request: Extract model data
Well the answer is simple. He can't. The only exposed interfaces I can see return piece transforms, not vertices. This probably belongs in feature requests. Given the feedback here you'd probably want to provide better justification for needing them since as others have pointed out you can do wireframes more efficiently using the existing drawing interfaces.
On the other hand if it's that important to you, you could read the vertex data out of the s3o file via VFS and do your own transforms.
On the other hand if it's that important to you, you could read the vertex data out of the s3o file via VFS and do your own transforms.
Re: Widget request: Extract model data
THANK YOU SATIRIK FOR NOT BEING SO INCREDIBLY DENSESatirik wrote:you could also answer his question instead of thinking ahead of what he really needs
K thx spliff ill just parse the s3o
-
- Moderator
- Posts: 2464
- Joined: 12 Oct 2007, 09:24
Re: Widget request: Extract model data
Did you look at how ghost radar did it? For all I know it extracts the vertexes then draws them.Look at how Ghost Radar did it.
Re: Widget request: Extract model data
Google_Frog wrote:Did you look at how ghost radar did it? For all I know it extracts the vertexes then draws them.Look at how Ghost Radar did it.
Code: Select all
function DrawGhosts()
glColor(1.0, 1.0, 1.0, 0.35 )
glDepthTest(true)
for unitID, dot in pairs( dots ) do
local x, y, z = spGetUnitPosition(unitID)
local udef = udefTab[ dot["unitDefId"] ]
local radius = max( udef["xsize"], udef["zsize"] ) * 0.5
if ( dot["radar"] == true ) and ( dot["los"] == false ) and ( dot["unitDefId"] ~= nil ) and ( x ~= nil ) then
-- printDebug("DRAW udef: " .. dot["unitDefId"] .. " x: " .. x .. " y: " .. y .. " z:" .. z )
if ( spIsSphereInView( x, y, z, radius ) ) then
glPushMatrix()
glTranslate( x, y + 5 , z)
glUnitShape( dot["unitDefId"], dot["teamId"] )
glPopMatrix()
end
end
end
glDepthTest(false)
-- glBlending(GL.SRC_ALPHA, GL.ONE_MINUS_SRC_ALPHA);
-- glBlending(false)
glColor(1, 1, 1, 1)
end
Re: Widget request: Extract model data
Way to insult the people who are trying to help you.d_b wrote:THANK YOU SATIRIK FOR NOT BEING SO INCREDIBLY DENSESatirik wrote:you could also answer his question instead of thinking ahead of what he really needs
K thx spliff ill just parse the s3o
Re: Widget request: Extract model data
You don't. gl.UnitShape is just sending you a display list, IIRC, just like gl.Unit does.So, where/how do i get this data from this code?
Anyhow, please let me know if you write a S3O parser that works, that would be wonderful- I've been wanting to load single meshes and stick them in display lists for some time now, but the code doesn't exist and I suck at writing such things.
Re: Widget request: Extract model data
d_b wrote:So, where/how do i get this data from this code?
Code: Select all
glUnitShape( dot["unitDefId"], dot["teamId"] )
Hint: It doesn't do what you ask for, but what you've been told to.
Re: Widget request: Extract model data
Please understand that his question had two parts:
1. "How do I draw a wireframe?" That's easy, jK's example provides instructions, and it works.
2. "I want the raw data of the triangle strips, can I get that from Spring?" The answer, so far as I know, is "no, you can't", and while that's a Feature Request, it may be faster to just write a S3O parser that will provide that data from any given S3O and allow us to store that data for future use in a display list. I, for one, really want that, and would use it extensively.
At any rate, that's how I am reading what he's saying. So, maybe a bit less flaming, and a little bit clearer communication might be helpful here. Perhaps I'm wrong, and he just wants a bloody wireframe and that's all, but that's not what I am seeing, and a S3O parser would be *very* useful.
1. "How do I draw a wireframe?" That's easy, jK's example provides instructions, and it works.
2. "I want the raw data of the triangle strips, can I get that from Spring?" The answer, so far as I know, is "no, you can't", and while that's a Feature Request, it may be faster to just write a S3O parser that will provide that data from any given S3O and allow us to store that data for future use in a display list. I, for one, really want that, and would use it extensively.
At any rate, that's how I am reading what he's saying. So, maybe a bit less flaming, and a little bit clearer communication might be helpful here. Perhaps I'm wrong, and he just wants a bloody wireframe and that's all, but that's not what I am seeing, and a S3O parser would be *very* useful.
Re: Widget request: Extract model data
And the original post show us what relationship connects 1 to 2 in the mind of the original poster:
Hencefoth, the incredibly dense answere were actually hitting home.d_b wrote:Basically, i need the coordinates so that I can draw a wireframe.
Last edited by zwzsg on 29 Oct 2009, 21:28, edited 1 time in total.
Re: Widget request: Extract model data
OK... but what if he wants to convert it to quads, instead of triangles, so that it looks professional?