Sign in to follow this  

Editor

This topic is 4353 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

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.

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
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?

Share this post


Link to post
Share on other sites
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?

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
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

Share this post


Link to post
Share on other sites
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.

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

Share this post


Link to post
Share on other sites

This topic is 4353 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this