Port code to c++ without OpenFramework
geotyper opened this issue · 15 comments
Thanks for prompt answer, make procedural 3D assets, try to save orientation as in your example
Use BGFX for render, looks at orientation again.
And you dont use this parameters in XML file:
auto xmla_minheight = xmln_tile.attribute("min-height");--->0
auto xmla_maxheight = xmln_tile.attribute("max-height");----> max.z
And another question, about parent node
world_node.position=Vec3(1.f, 0.f, 0.f); this coord of parent node
tile_node.setParent(parent_node);
tile_node.position=Vec3(x*grid_size.x, y*grid_size.y, z*grid_size.z);
tile_node.rotateDegree=ofToInt(tile_cardinality[1])*90.0f;
when we rotate, it rotated around center of mesh or center plus coord parent node?
Thanks for prompt answer, make procedural 3D assets, try to save orientation as in your example
Use BGFX for render, looks at orientation again.
And you dont use this parameters in XML file:
auto xmla_minheight = xmln_tile.attribute("min-height");--->0
auto xmla_maxheight = xmln_tile.attribute("max-height");----> max.z
min-height and max-height properties are processed and used on the code. The basic example does not utilize those features. However, the advance example uses the properties.
And another question, about parent node
world_node.position=Vec3(1.f, 0.f, 0.f); this coord of parent nodetile_node.setParent(parent_node); tile_node.position=Vec3(x*grid_size.x, y*grid_size.y, z*grid_size.z); tile_node.rotateDegree=ofToInt(tile_cardinality[1])*90.0f;
when we rotate, it rotated around center of mesh or center plus coord parent node?
The line <tile_node.rotateDeg(ofToInt( tile_cardinality[1])*90.0f, axis_y );> : rotates the tile around the model's origin. Rotations applied to the parent node will take the parent node origin as transformation point. On render, you can compound the matrices of the nested nodes like a transformation tree.
On OF 2D screen space, the coordinate origin is top left and Y is oriented downwards to positive.
As 3D OFNode, the center of coordinates is 0,0 (center of screen) and the Y axis orientation is UP.
In both cases, Z goes positive towards the camera and negative forward.
But this does not matter. It all depends on the coorinate system and axis orientation you use on your render logic and the 3D models. Take the simetry as 2D reference and match the 3D models with that orientation.
if (tile_name == ground_name) ground_id = num_patterns;
if (tile_name == surround_name) surround_id = num_patterns;
When give some names to ground or surround algorithm return -1/ or nothing
How to close borders as in your screen short?
And If use cross need to add it item and neighbors to XLM? code have this simmetry
to XLM?
Yes, every tile has to be declared in the XML. It does needs a symmetry and neighbors that defined the rules for the WFC.
At the ofxWFC3D, I implemented a new kind of symmetry (called "+"). The symmetry has nothing to be with the shape of the 3D model but the relationship with the neighbors, rotations and the location possibilities.
if (tile_name == ground_name) ground_id = num_patterns;
if (tile_name == surround_name) surround_id = num_patterns;
When give some names to ground or surround algorithm return -1/ or nothing
How to close borders as in your screen short?
ground_name will use such tile as gorund and will then force the neihbord tiles to be related to that ground rules.
surround_name will place a tile surrounding the 4 walls of the grid and will force the WFC to calculate the result based on that rules.
Because the XML rules of the basic example are set to not connect an open pipe into a empty tile, by surrounding the grid with empty tiles, it will force the WFC to find alternatives where the borders of the pipes are closed and connected to each other.
If the WFC returns null or negative, does it mean has not found a solution. It may be due conflits on the XML rules or at the initialization parameters. If using a ground tile, make sure such tile rules match the setup and other tiles can be placed on top of such tile while not blocking other neighbors.
Imagine trying to solve a sudoku when there is already placed conflicting numbers that makes the sudoku being impossible to be solved.
Thanks again for detailed answers, think that in simple example all works
At the ofxWFC3D, I implemented a new kind of symmetry (called "+"). The symmetry has nothing to be with the shape of the 3D model but the relationship with the neighbors, rotations and the location possibilities.
But what about symmetry (called "+"). It can be related with shape or as you write only for neighbors?
and one, more:
float bound_width=10, bound_height=22, bound_length=10;
if bound height greater than width,length algorithm lose it possibility to find good result, try with different tile types and dimensions (5,10,5 for example)
But what about symmetry (called "+"). It can be related with shape or as you write only for neighbors?
Tiles symmetry:
https://www.dropbox.com/s/zeiat1w8zre9ro8/Knots%20breakdown.png?dl=0
The "+ symmetry" is an special case that actually only use rotations and no symmetry.
and one, more:
float bound_width=10, bound_height=22, bound_length=10;
if bound height greater than width,length algorithm lose it possibility to find good result, try with different tile types and dimensions (5,10,5 for example)
You are right, that was a bug.
It has been fixed on 2042eef