/// <summary> /// Constructor for a new converter /// Note: one must call Convert to actually start the conversion /// </summary> /// <param name="filenames">List of files to be processed</param> /// <param name="outputpath">Path to output the .pcache/.pcaches to</param> /// <param name="mergefiles">whether to merge the read files into one .pcache or not</param> /// <param name="pskip">amount of points to skip in between readings (0 means every point will be read, 1 every seconds, etc..)</param> /// <param name="anchorToFirstPoint">whether to zero the first read point and anchor all the other ones to it</param> public LAS2PCacheConverter(string[] filenames, string outputpath, bool mergefiles, int pskip, bool anchorToFirstPoint) { _pskip = pskip; _outputpath = outputpath; _files = filenames; _merge = mergefiles; _cancel = false; _progresses = new Dictionary <Thread, float>(); _pointReader = new LASPointReader(_pskip, PointsCallback); _useFirstPointAsAnchor = anchorToFirstPoint; }
private void ReadPoints() { if (_pointReader != null) { _pointReader.Dispose(); } _pointReader = new LASPointReader(m_skip, PointsCallback); for (int i = 0; i < m_LASFilesInStreamingAssets.Count; i++) { _pointReader.ReadLASPointsAsync(Path.Combine(Application.streamingAssetsPath, m_LASFilesInStreamingAssets[i])); } }
public void OnGUI() { scrollpos = EditorGUILayout.BeginScrollView(scrollpos); EditorGUILayout.LabelField("EXPERIMENTAL Editor to easily instantiate VFX Graphs from .las into the scene"); EditorGUILayout.LabelField("\n"); EditorGUILayout.LabelField(".las files in StreamingAssets:"); EditorGUILayout.PropertyField(filenamesprop, true); if (GUILayout.Button("Add file")) { string path = EditorUtility.OpenFilePanel("select .las file", "Assets/StreamingAssets", "las"); string[] filepath = path.Split('/'); filenames.Add(filepath[filepath.Length - 1]); } EditorGUILayout.LabelField("\n"); EditorGUILayout.LabelField("VisualEffect to be used:"); EditorGUILayout.LabelField("Requires two exposed properties in the graph"); EditorGUILayout.LabelField("1. _PositionMapArray (Texture2DArray)"); EditorGUILayout.LabelField("2. _Depth (int)"); EditorGUILayout.PropertyField(vfxgraphprop, true); EditorGUILayout.LabelField("\n"); EditorGUILayout.LabelField("Whether to merge all to one LASBinder or create separate"); EditorGUILayout.LabelField("(try to disable if precision of the graph becomes a problem)"); EditorGUILayout.PropertyField(mergeFilesprop, true); EditorGUILayout.LabelField("\n"); EditorGUILayout.LabelField("Amount of points to skip in between readings:"); EditorGUILayout.PropertyField(pointskipprop, true); EditorGUILayout.LabelField("\n"); EditorGUILayout.LabelField("Whether to center the first point to zero and use it as origin:"); EditorGUILayout.PropertyField(anchortofirstpointprop, true); pointskipprop.intValue = Mathf.Clamp(pointskipprop.intValue, 0, 10000); if (GUILayout.Button("Add to selected gameobject")) { byte[] bytes = File.ReadAllBytes(Path.Combine(Application.streamingAssetsPath, filenames[0])); LASHeader_1_2 firstfileheader = LASHeaders.MarshalHeader(bytes, true); anchor = LASPointReader.GetFirstPoint(bytes, firstfileheader); if (Selection.transforms != null && Selection.transforms.Length > 0) { parent = Selection.transforms[0]; } if (!mergefiles) { generated = 0; EditorApplication.update += FrameByFrameNewGraph; } else { NewGraph(filenames, parent, anchor); } } EditorGUILayout.LabelField("\n"); EditorGUILayout.EndScrollView(); so.ApplyModifiedProperties(); so.Update(); }