[DotNet-OSGeo] RE: 3D display
troelsgaard53c at live.dk
Wed Jun 1 15:19:28 EDT 2011
DirectX supports very simple points and lines as colored vertices pretty easily, but you will have to convert the double precision coordinates into single precision floats. You can support more symbolic points and lines by textured vertices and GDI drawing to create a bitmap that you convert into a texture. You can vertices organized as two triangles that form a square for points or an elongated rectangle for lines. You can have transparent textures, so it's ok if your vertices are bigger than your shape. Remember that traditional Z-ordering by drawing sequence is not really going to be used in 3D since you will be working with 3D constructs. In order to fill polygons properly by using triangles you have to do tessellation. Alternately, you can draw them as a texture on a pair of triangles like with points and lines. My experience is that DirectX did not support tessellation directly, but OpenGL does. You can use Tao open GL in order to get that to work in C#. So basically you could start with the mapwindow or DotSpatial tools for reading the shapefiles themselves, pick a reference scale in order to transform the geographic coordinates into floats, and then use Tao OpenGL to get the tessellated polygons. I am not aware of any existing tools that do that sort of thing other than what we created, but there may be something out there now.
Thank you Harold
Not that it matters, but wouldn't a point .. presumably painted as a small square .. always face toward the screen, where two triangles representing a square has 'proper' facing and culling.
I think that I've come across a couple of references to tesselation or triangulation work, but I'm not sure weather it's been open libraries. Everyone that makes 3D appears to face the same need of triangulation stuff.
I'll finish my 3D window up with an 'openfiledialog' to pick terrain-tifs, and throw the code at you. It's not very long but does take a reference to Xna.Framework (wouldn't it be enugh to download the Xna-runtime?). It's not properly geo-coded .. the terrain raises from a flat square, so it probably won't work well with other data.
About the textures .. it would be so tempting to drape a scene with an air-photo, but I'll let google about that for now.
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the DotNet