eideallab / shploader Goto Github PK
View Code? Open in Web Editor NEWShp file loader for unity
Shp file loader for unity
Hey, can anyone help me with the functionality and how will I use this? I am new to GIS/Digital Map.
I'm really trying to figure out how to take the Z value out of the shape files....
Actually this two return 0:
ZRange.Load(ref br);
MRange.Load(ref br);
Hello
When trying to import Shp files other than Polygone, File Code, Length, Version values become 0 and Shape Type values are not imported. Is there a solution to this?
Thank you!
RecordContents.cs的第169、170两行顺序是不是写反了?导致TotalXYRange读取的最大、最小值有误。
修改 Util.cs 下的 CreateMesh 函数:
`
public static Mesh CreateMesh(Vector2[] points)
{
List<List> ptLists = splitArray(points);
List<Vector3> vers = new List<Vector3>();
List<int> inds = new List<int>();
List<Vector3> nors = new List<Vector3>();
for (int i = 0; i < ptLists.Count; i++)
{
MeshData meshData = getMeshData(ptLists[i]);
vers.AddRange(new List<Vector3>(meshData.vertices));
inds.AddRange(new List<int>(meshData.indices));
nors.AddRange(new List<Vector3>(meshData.normals));
}
Mesh mesh = new Mesh();
mesh.vertices = vers.ToArray();
mesh.triangles = inds.ToArray();
mesh.normals = nors.ToArray();
mesh.RecalculateNormals();
mesh.RecalculateBounds();
return mesh;
}
static List<List<Vector2>> splitArray(Vector2[] points)
{
List<List<Vector2>> splits = new List<List<Vector2>>();
int index = 0;
Vector2 tempV2 = points[index];
for (int i = 1; i < points.Length; i++)
{
if (points[i]==tempV2)
{
List<Vector2> list = new List<Vector2>();
for (int j = index; j < i; j++)
{
list.Add(points[j]);
}
splits.Add(list);
if ((i + 1) < points.Length)
{
index = i + 1;
tempV2 = points[index];
}
}
}
return splits;
}
static MeshData getMeshData(List<Vector2> ptList)
{
MeshData meshData = new MeshData();
Triangulator tr = new Triangulator(ptList);
int[] indices = tr.Triangulate();
// Create the Vector3 vertices
Vector3[] vertices = new Vector3[ptList.Count];
for (int i = 0; i < vertices.Length; i++)
{
vertices[i] = new Vector3(ptList[i].x, 0, ptList[i].y);
}
Vector3[] normals = new Vector3[vertices.Length];
for (int i = 0; i < normals.Length; i++)
{
normals[i] = Vector3.up;
}
meshData.vertices = vertices;
meshData.indices = indices;
meshData.normals = normals;
return meshData;
}
class MeshData
{
public Vector3[] vertices;
public int[] indices;
public Vector3[] normals;
}
`
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.