private void onTap_DebuggingPoseImageDictionaryUpdate() { Debug.Log("Testing_TouchScreenManager: Tap received! Testing Pose Image Dictionary update!"); var poseImageDictionaryTestScript = GameObject.FindObjectOfType <Testing_PoseImageDictionary>(); PoseVoxel voxel = poseVoxelSet.ToPoseVoxel(new Pose(Camera.main)); Texture2D tex = Texture2D.whiteTexture; poseImageDictionaryTestScript.Add(voxel, tex); }
public bool Remove(PoseVoxel voxel) { if (Contains(voxel)) { poseVoxelSet_m.Remove(voxel); return(true); } return(false); }
public bool Add(PoseVoxel voxel) { if (!poseVoxelSet_m.Contains(voxel)) { poseVoxelSet_m.Add(voxel); return(true); } return(false); }
public bool AddFor(Pose pose) { // Determine if the pose is already accounted for if (this[pose] == null) { PoseVoxel voxel = ToPoseVoxel(pose); return(Add(voxel)); } return(false); }
private void DisplayVoxel(PoseVoxel voxel) { int oldIndentLevel = EditorGUI.indentLevel; // Display each voxel EditorGUI.indentLevel = 2; EditorGUILayout.LabelField("Voxel:"); EditorGUILayout.Vector3Field("Min Pos", voxel.Min.Position); EditorGUILayout.Vector3Field("Max Pos", voxel.Max.Position); EditorGUILayout.Vector3Field("Min Euler", voxel.Min.Rotation.eulerAngles); EditorGUILayout.Vector3Field("Max Euler", voxel.Max.Rotation.eulerAngles); EditorGUI.indentLevel = oldIndentLevel; }
public bool AddedIsSameAsStored(Pose pose) { // Get the current pose // Turn it into a Voxel // Return it if (poseVoxelSet.AddFor(pose)) { PoseVoxel voxel = poseVoxelSet.ToPoseVoxel(pose); PoseVoxel storedVoxel = poseVoxelSet[pose]; return(voxel.Equals(storedVoxel)); } return(false); }
public bool Remove(PoseVoxel key) { if (imageMap_m.ContainsKey(key)) { Texture2D tex = imageMap_m[key]; destroyTex(tex); // Update debugger ResetDebuggingTools(); return(true); } else { return(false); } }
public Texture2D this[PoseVoxel key] { get { if (imageMap_m.ContainsKey(key)) { Texture2D orig = imageMap_m[key]; Texture2D copy = new Texture2D(orig.width, orig.height, orig.format, false); Graphics.CopyTexture(orig, copy); return(copy); } else { return(null); } } }
/// <summary> /// Destroys the texture sent in, but creates a copy in the dictionary and returns the texture. /// </summary> /// <param name="key"></param> /// <param name="tex"></param> public Texture2D Add(PoseVoxel key, Texture2D tex) { if (!imageMap_m.ContainsKey(key)) { if (tex != null) { Texture2D copy = new Texture2D(tex.width, tex.height, tex.format, false); Graphics.CopyTexture(tex, copy); destroyTex(tex); // Add to dictionary imageMap_m.Add(key, copy); // Update debugger addToDebuggingTools(key.Min, key.Max, copy); return(copy); } } return(null); }
public PoseVoxel ToPoseVoxel(Pose pose) { // if the pose is not accounted for, calculate a pose voxel and add it in Vector3 pos = pose.Position; Vector3 eulers = pose.Rotation.eulerAngles; // Figure out the position ranges for the voxel Vector2 xMinMax = getMinMax(pos.x, MinMaxTypes.x); Vector2 yMinMax = getMinMax(pos.y, MinMaxTypes.y); Vector2 zMinMax = getMinMax(pos.z, MinMaxTypes.z); Vector3 minPos = new Vector3(xMinMax.x, yMinMax.x, zMinMax.x); Vector3 maxPos = new Vector3(xMinMax.y, yMinMax.y, zMinMax.y); // Figure out the rotation ranges for the voxel Vector2 xRotMinMax = getMinMax(eulers.x, MinMaxTypes.xRot); Vector2 yRotMinMax = getMinMax(eulers.y, MinMaxTypes.yRot); Vector2 zRotMinMax = getMinMax(eulers.z, MinMaxTypes.zRot); Vector3 minEulers = new Vector3(xRotMinMax.x, yRotMinMax.x, zRotMinMax.x); Vector3 maxEulers = new Vector3(xRotMinMax.y, yRotMinMax.y, zRotMinMax.y); PoseVoxel newVox = new PoseVoxel(minPos, maxPos, minEulers, maxEulers); return(newVox); }
public bool Contains(PoseVoxel key) { return(imageMap_m.ContainsKey(key)); }
public override bool Equals(object obj) { PoseVoxel target = (PoseVoxel)obj; return(target.Min.Equals(Min) && target.Max.Equals(Max)); }
public bool Contains(PoseVoxel voxel) { return(poseVoxelSet_m.Contains(voxel)); }
public void Add(PoseVoxel voxel, Texture2D tex) { poseImageDictionary.Add(voxel, tex); }