Editor
I am currently developing an editor in C#, and have a couple of questions.
Firstly, when you modify something (I have a property grid with axis co-ords etc), how would you get the object to save the position? Can I just write it to a .txt or .ini, and when my demo loads it reads it to set the co-ords? I'm completely new to this, so please tell me if I've got it totally wrong.
Also, in my main viewport I'm trying to draw a grid. I originally thought that I could create a for loop, and draw 3d lines using Truevision3D to make the grid. This was until a friend of mine said it would be better to use a quad with a transparent targa texture applied to it. Would that be more suitable do you think?
ANY suggestions would be appreciated.
One potential problem with using a texture is that it will scale with size of the display. For example, if a grid line is 1 pixel wide in a 256 x 256 texture it will be 4 pixels wide on a 1024x1024 display. On the other hand, that might be good.
I originally would have done it your way, but since someone recommends a different way, I would also give the other way a try.
I originally would have done it your way, but since someone recommends a different way, I would also give the other way a try.
Quote:Original post by JohnBolton
One potential problem with using a texture is that it will scale with size of the display. For example, if a grid line is 1 pixel wide in a 256 x 256 texture it will be 4 pixels wide on a 1024x1024 display. On the other hand, that might be good.
I originally would have done it your way, but since someone recommends a different way, I would also give the other way a try.
JohnBolton,
Thanks for the reply. When I had a chat with my friend, he mentioned that in DirectX a gridline is converted into two polygons when it's rendered, so with a grid of 16 3D lines it would start to affect performance. Would this be the case?
hi,
i think you should draw the lines via a vertexbuffer,
and one drawprimitve call, that's not too much cost.
i made a grid with dx too, and it affected the performance near zero...
Bye,
Marc
i think you should draw the lines via a vertexbuffer,
and one drawprimitve call, that's not too much cost.
i made a grid with dx too, and it affected the performance near zero...
Bye,
Marc
Thanks for the grid suggestions, I will give them a go. I still need some help with this though:
(from first post)
Firstly, when you modify something (I have a property grid with axis co-ords etc), how would you get the object to save the position? Can I just write it to a .txt or .ini, and when my demo loads it reads it to set the co-ords? I'm completely new to this, so please tell me if I've got it totally wrong.
I've since thought a little more about it, and I had a suggestion from a friend who said maybe I could save the edited 'map' as a .3ds file. Or maybe an XML? Would any of those be suitable?
(from first post)
Firstly, when you modify something (I have a property grid with axis co-ords etc), how would you get the object to save the position? Can I just write it to a .txt or .ini, and when my demo loads it reads it to set the co-ords? I'm completely new to this, so please tell me if I've got it totally wrong.
I've since thought a little more about it, and I had a suggestion from a friend who said maybe I could save the edited 'map' as a .3ds file. Or maybe an XML? Would any of those be suitable?
Bump again, simply because this is a GAME development website, and nobody is prepared to answer how an editor saves the position of the objects?
Come on, somebody must be willing to share their knowledge.
Come on, somebody must be willing to share their knowledge.
If you've got an editor that allows you to change the position and other properties of an object in memory, then the hard part is done. Your question is analogous to, "What's the best model format?" And the answer is the same. If you already have technology in your demo/engine/whatever to load a specific model/world format, you might want to use that. Otherwise, you might want to devise your own object format. In any case, loading and saving objects and their properties is as simple as being able to parse objects into the requisite data and writing that out to a file or other storage, then being able to perform the inverse operation (reading a chunk of memory and parsing it into objects). So, from that viewpoint, you'll probably find a few references online about how to stream objects, but beyond that, it's up to you to decide just what information is important to save. It's open-ended, and it will change as the data needs of your application change. HTH.
Regards,
ZE
Regards,
ZE
Well when you modify somethings position you'll just want to alter some of the variables that make up that something (e.g. say you were moving a rectangle, you'd alter it's position variable). Then you can save all the data to a file in a certain format which can then be read by the application the editor is for.
16 * 2 = 32. 32 polys is absolutely nothing to a modern 3D card, so no 16 3D grid lines will not affect performance one little bit. One thing you do need to be careful of is batching, if you drew say 1000 lines that'd be 2000 polygons and again that's a small amount (especially of untextured unlit polygons), however if each line has it's own draw call you have 1000 draw calls which could be significant. I don't know how Truevision3D handles drawing 2D stuff, if you've got a DrawLine or similar function it might do a seperate draw call every time you call it, or it may fill up a vertex buffers with lines and then draw them in one batch. It could be worth finding out.
As for whether you should use a texture instead I don't see any reason to. Drawing the lines yourself gives you far more flexibility in the appearance of the grid
Quote:
Thanks for the reply. When I had a chat with my friend, he mentioned that in DirectX a gridline is converted into two polygons when it's rendered, so with a grid of 16 3D lines it would start to affect performance. Would this be the case?
16 * 2 = 32. 32 polys is absolutely nothing to a modern 3D card, so no 16 3D grid lines will not affect performance one little bit. One thing you do need to be careful of is batching, if you drew say 1000 lines that'd be 2000 polygons and again that's a small amount (especially of untextured unlit polygons), however if each line has it's own draw call you have 1000 draw calls which could be significant. I don't know how Truevision3D handles drawing 2D stuff, if you've got a DrawLine or similar function it might do a seperate draw call every time you call it, or it may fill up a vertex buffers with lines and then draw them in one batch. It could be worth finding out.
As for whether you should use a texture instead I don't see any reason to. Drawing the lines yourself gives you far more flexibility in the appearance of the grid
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement