/// <summary> Creates instance of <see cref="MeshData"/>. </summary> public MeshData(IMeshIndex meshIndex, int size) { Index = meshIndex; var fullVertCount = size * 2; Vertices = new Vector3[fullVertCount]; Triangles = new int[fullVertCount]; Colors = new Color[fullVertCount]; UVs = new Vector2[fullVertCount]; _size = size; }
void OnMouseDown() { if (_meshIndex == null) _meshIndex = gameObject.GetComponent<MeshIndexBehaviour>().Index; Ray ray = Camera.main.ScreenPointToRay(Input.mousePosition); RaycastHit hit; if (Physics.Raycast(ray, out hit)) { var point = hit.point; var center = new MapPoint(point.x, point.z, point.y); Modify(center); } }
void Start() { _meshIndex = gameObject.GetComponent <MeshIndexBehaviour>().Index; }
/// <summary> Adds mesh index. </summary> public CompositeMeshIndex AddMeshIndex(IMeshIndex index) { _indices[_nextIndex++] = index; return(this); }