Crystal Space
Welcome, Guest. Please login or register.
September 23, 2014, 05:30:39 am

Login with username, password and session length
Search:     Advanced search
9018 Posts in 2051 Topics by 8500 Members
Latest Member: Carrc21at13u11
* Home Help Search Login Register
+  Crystal Space
|-+  Crystal Space Project Development
| |-+  Feature Requests
| | |-+  Mesh-based SplitWithPlane support
« previous next »
Pages: [1] Print
Author Topic: Mesh-based SplitWithPlane support  (Read 3548 times)
eventhorizon5
Jr. Member
**
Posts: 53


View Profile WWW
« on: May 20, 2009, 06:51:05 pm »

Here's a tricky one - my project (Skyscraper, www.skyscrapersim.com) is currently stuck on Thing meshes (really just for walls and floors; objects are not affected and I'll eventually be migrating those to genmeshes) due to a Cut function I made that creates holes in polygons by simply chopping up each poly into 5 pieces, discarding the 5th (which results in 4 polygons, and a hole), and then remapping the texture across the resulting 4 polygons.  This is vital because, for example, if you create an elevator shaft in my app, first you'll have all of the floors/ceilings for each level already in place, and then the Cut function will automatically cut holes vertically in every polygon within the shaft's area, making room for the shaft.  This is by design, since buildings are written in a scripting language I designed, and I've tried to minimize the overall complexity (so for a square-shaped floor, you'd only have to specify a single polygon, instead of creating dozens of polygons to fit around all of the shaftwork, stairwells, etc, since all of that is done automatically).  This is also done with doors (including elevator doors), since a wall is created, and then later on when a door is placed, a hole is cut in the area for the door.

That stuff is fairly simple because the polygons are basic and non-triangulated.  But in order to move to genmeshes, I'd need to make (or have someone make) a mesh-based variant of the csPoly3D::SplitWithPlane functions, which is what my Cut function uses.  I was thinking over some of it recently, and the main problem is that I'm not good (yet) with working with triangulated objects.  Basically for a split, either the triangles at the edge of the plane would have to be modified and retriangulated, or the function would have to determine the edge vertices of the full-size triangulated polygon (or meshed polygon? don't really know what that would be called) and would cut and retriangulate the entire thing.  This isn't that urgent right now (since Thing meshes are working great, even though they've been dropped in the CS trunk), but I was wondering if anyone has thought about this or has tried doing anything like this yet.

Here's an old pic from July '07 when I first got my Cut function working, showing a vertical cut.


-eventhorizon
Logged
Vincent
Full Member
***
Posts: 191


View Profile WWW
« Reply #1 on: May 21, 2009, 11:35:40 pm »

Hello,

  that sounds like a "real world" need wink
Since 1.4, there are CS::Geometry::Triangulate3D functions, maybe those can help you.
I'll point Jorrit and/or Scott to this post when I see them on IRC, but it may be faster if you asked on CS mailing list about this.
Logged
Pages: [1] Print 
« previous next »
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.2 | SMF © 2006-2007, Simple Machines LLC Valid XHTML 1.0! Valid CSS!
Page created in 6.249 seconds with 17 queries.