public OctreeStruct(double3 center, float octantSize, int index, int4x2 children) { this.center = center; this.octantSize = octantSize; this.index = index; var bc = (children >= 0); this.hasChildren = math.any(bc.c0) || math.any(bc.c1); this.children = children; }
private static void CustomVisit(ref int4x2 i) { LogVisit(i); GUILayout.Label(name); EditorGUI.indentLevel++; var field0 = EditorGUILayout.Vector4Field("", ConvertToVector4(i[0])); var field1 = EditorGUILayout.Vector4Field("", ConvertToVector4(i[1])); i[0] = ConvertVector4ToInt4(field0); i[1] = ConvertVector4ToInt4(field1); EditorGUI.indentLevel--; }
public NativeArray <OctreeStruct> ToNativeArray(int numResults) { int4x2 childrenInt4x2; OctreeNode current; var result = new NativeArray <OctreeStruct>(numResults, Allocator.TempJob); var s = new Stack <OctreeNode>(); s.Push(this); while (s.Count > 0) { current = s.Pop(); if (hasChildren()) { foreach (var child in current.children) { if (child != null) { s.Push(child); } } childrenInt4x2 = new int4x2( (current.children[0] != null ? current.children[0].index : -1), (current.children[1] != null ? current.children[1].index : -1), (current.children[2] != null ? current.children[2].index : -1), (current.children[3] != null ? current.children[3].index : -1), (current.children[4] != null ? current.children[4].index : -1), (current.children[5] != null ? current.children[5].index : -1), (current.children[6] != null ? current.children[6].index : -1), (current.children[7] != null ? current.children[7].index : -1) ); } else { childrenInt4x2 = -1; } // Position in result must match position in nativeObjects result[current.index] = (new OctreeStruct(current.center, current.octantSize, current.index, childrenInt4x2)); } return(result); }
public static void AreEqual(int4x2 a, int4x2 b) { AreEqual(a.c0, b.c0); AreEqual(a.c1, b.c1); }
public static void AreEqual(int4x2 expected, int4x2 actual) { AreEqual(expected.c0, actual.c0); AreEqual(expected.c1, actual.c1); }
public fp4x2(int4x2 v) { this.c0 = (fp4)v.c0; this.c1 = (fp4)v.c1; }
public static fp4x2 fp4x2(int4x2 v) { return(new fp4x2(v)); }