Skip to content

Mesh Factory refactoring #23

@brnkhy

Description

@brnkhy

I'll try to note everything and explain a little;

-Cutting holes in buildings
This is an important one. Current system doesn't handle that, actually even constructs holes as if they are building segments as well (not easily noticable as they are inside another mesh). That was because we're passing each geometry to stacks for visualization. I'm working on this at this branch. Main change is I'm passing features to stacks now along with the feature data (properties) and have polygon modifier to cut holes since it has all geometries (including holes) and feature properties now.

-Remove terrain snapping from vector layer visualization
I don't think that's the correct place to do that. My initial idea was to make a modifier out of it and run it first at each stack but then, I can't think of a use case that wouldn't require that either. I mean two reasonable use cases are; (1) create terrain and snap everything to it (2) use flat ground, no need to run snapping code. I think I can make it a modifier but it runs by default without a need to add it to stack. And it wouldn't run if terrain data doesn't exists anyway.

-Using filters for stack selection
Currently we're using a key(property value) and a classification key (property name) to choose stacks. i.e. if classification key is "type" and key of the stack is "major"; features with type==major will be passed into that particular stack. That's quite weak and hard to use and only reason we have it is the inspector/usage problems. I'm planning to use filters for this. Filters have a basic test function that takes feature and returns true/false so they are pretty much created for this job. This will also allow users to create stacks for complex cases as well, like "a stack for commercial buildings higher than 10". I'm still learning inspector stuff so that part might be a little tedious.

-Edge subdivision
Again this is done in vector layer visualizer by default at the moment but I think it might be better if it's a modifier as well. Or maybe it might be a default mod just like snapping above. This simply cuts long edges into smaller pieces so that they won't look horrible on bumpy terrain. Imagine a long straight road (with just two end points) on a bumpy terrain. This cuts that road segment into much smaller pieces so that each vertex can be snapped individually.

~~-Height Modifier
Height modifier supposed to create building volume by pushing to base polygon to a certain height and constructing the side walls. Currently there are some problems with min_height & height calculations for example. I was thinking about breaking it into smaller modifiers for pushing polygon up, building side walls etc but now I think that might be an overkill for now. ~~

-Merging features got cut at tile edges
This is all theoretical but I'm hoping to take a shot at this. I though of something like this last week;

  • use tile coordinates for this as integers are easier to work with and that is the highest precision we can achieve anyway.
  • Group objects by their cut/edge state, like InMiddle, LeftEdge, TopEdge, TopLeftCorner (touching two edges) etc. build seperate game objects (merged mesh) for each those groups.
  • For each feature in a tile, if it's on LeftEdge, check right tile's RightEdge pool and try to match points. Normally they should be exactly same but we're cutting buffer geometry as well so there might be slight rounding issues there. There can be other options like line segment (on edge) comparison here as well.
  • Merge that LeftEdge and RightEdge groups destroy their game object and recreate it with merged data. Merging geometry data might not be travial in some cases. Another option is to union both polygons.
  • This should work perfectly well for a pokemon go like game but performance hit will probably be noticable if you load whole SF in one frame.

Might have missed some stuff but I'll add them here if I remember something.

cc @isiyu @david-rhodes @MateoV

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions