Skip to content
Snippets Groups Projects
Commit 322ce668 authored by Knuiman, Bart's avatar Knuiman, Bart
Browse files

Fixes

parent 1aa8b9f0
No related branches found
No related tags found
No related merge requests found
......@@ -119,12 +119,6 @@ namespace Wander
return finished;
}
static bool IsTriangleCCW( Vector2 vertex1, Vector2 vertex2, Vector2 vertex3 )
{
float signedArea = (vertex2.x - vertex1.x) * (vertex3.y - vertex1.y) - (vertex3.x - vertex1.x) * (vertex2.y - vertex1.y);
return signedArea > 0;
}
// Number of failed polys to triangulate are returned.
public int Triangulate()
{
......@@ -172,15 +166,6 @@ namespace Wander
double y = vertices[indices[k]*2+1];
poly.vertices.Add( new Vector2( (float)x, (float)y ) );
}
//for ( int k = 0; k < indices.Count; k += 3)
//{
// if ( !IsTriangleCCW( poly.vertices[k], poly.vertices[k+1], poly.vertices[k+2] ))
// {
// var t = poly.vertices[k];
// poly.vertices[k] = poly.vertices[k+2];
// poly.vertices[k+2] = t;
// }
//}
polygons[polygons.Count-1] = poly;
UnityEngine.Debug.Assert( poly.vertices.Count % 3 == 0 );
}
......@@ -319,12 +304,12 @@ namespace Wander
layersIdentified = true;
}
// Calls callback(x, y, channel) for each raster position (256 channels) where each value represents a single channel.
// If no polygon was hit, 255 is called.
// If polygon was hit, but no feature was matched, 254 is called.
// Generates a raster for each position (pixel) (256 channels) where each value represents a single channel.
// If no polygon was hit, 255 is encoded.
// If polygon was hit, but no feature was matched, 254 is encoded.
// Returns a list of failed to match pixels. This can be due to geometry not exactly matching or a layer not being found.
// Also out puts a remap of layer indices. For instance for a specific tile, only layerIdx 1, 6 and 3 are used.
// Then this a remapping of 1->0, 6->1, 3->2. So that in the shader only 3 textures are needed starting from 0, 1.. etc.
// Also outputs a remap of layer indices. For instance for a specific tile, only layerIdx 1, 6 and 3 are used.
// Then it applies a remapping of 1->0, 6->1, 3->2. So that in the shader only 3 textures are needed starting from 0, 1.. etc.
public byte[] RenderToTextureSingle(
int resolution,
out Dictionary<byte, byte> remappedLayerIndices,
......@@ -377,7 +362,7 @@ namespace Wander
{
for( int t = 0; t < node.triangles.Count; t++ )
{
int ti = (cachedTriIdx + t) % node.triangles.Count;
int ti = (cachedTriIdx + t) % node.triangles.Count; // Continue searching where we left off
int l = node.triangles[ti].Item1;
int f = node.triangles[ti].Item2;
int t2 = node.triangles[ti].Item3;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment