Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
V
vectortile
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
WANDER
vectortile
Commits
322ce668
Commit
322ce668
authored
1 year ago
by
Knuiman, Bart
Browse files
Options
Downloads
Patches
Plain Diff
Fixes
parent
1aa8b9f0
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
Runtime/VectorTile.cs
+6
-21
6 additions, 21 deletions
Runtime/VectorTile.cs
with
6 additions
and
21 deletions
Runtime/VectorTile.cs
+
6
−
21
View file @
322ce668
...
...
@@ -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
call
ed.
// If polygon was hit, but no feature was matched, 254 is
call
ed.
//
Generates a raster
for each position
(pixel)
(256 channels) where each value represents a single channel.
// If no polygon was hit, 255 is
encod
ed.
// If polygon was hit, but no feature was matched, 254 is
encod
ed.
// 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
thi
s 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 applie
s 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
;
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment