Esempio n. 1
0
    //callback method, removes TuioObject from the list of active tuioObjects
    public void RemoveTuioObject(TuioObject tobj)
    {
        removedTuioObjectsI.Add(tobj);

        if (markersOnGrid.Contains(tobj.getSymbolID()))
        {
            markersOnGrid.Remove(tobj.getSymbolID());
        }
    }
Esempio n. 2
0
    //callback method, adds TuioObject to the list of active tuioObjects
    public void AddTuioObject(TuioObject tobj)
    {
        addedTuioObjectsI.Add(tobj);

        if (!markersOnGrid.Contains(tobj.getSymbolID()))
        {
            markersOnGrid.Add(tobj.getSymbolID());
        }
    }
Esempio n. 3
0
    //callback method, adds TuioObject to the list of updated tuioObjects
    public void UpdateTuioObject(TuioObject tobj)
    {
        if (!markersOnGrid.Contains(tobj.getSymbolID()))
        {
            markersOnGrid.Add(tobj.getSymbolID());
            addedTuioObjectsI.Add(tobj);
        }

        updatedTuioObjectsI.Add(tobj);
    }
Esempio n. 4
0
    private void AddMarker(TuioObject tobj)
    {
        // TODO: This is not called if reacitvision is already running, and marker is on table
        int symbolID = tobj.getSymbolID();

        //if a marker ID is being recognized which is not being used be the program, cancel call and...
        //...prevents loopBar Markers to be added to lists
        if (markers.ContainsKey(symbolID) &&
            symbolID != m_settings.startLoopBarMarkerID && symbolID != m_settings.endLoopBarMarkerID)
        {
            GameObject currentMarker = markers[symbolID];
            currentMarker.GetComponent <FiducialController>().SetLastTimeAdded(Time.time);
            Debug.Log("Marker " + symbolID + " has been added to the grid.");

            //gets current color and adds marker to the according List
            ColorAccToPosition m_colorAccToPosition = currentMarker.GetComponent <ColorAccToPosition>();
            //updates sprite color - going too fast for loop in ColoAccToPosition script
            m_colorAccToPosition.CheckColor();
            Color m_color = currentMarker.GetComponent <SpriteRenderer>().color;

            if (m_color == red)
            {
                redMarkers.Add(currentMarker);
            }
            else if (m_color == green)
            {
                greenMarkers.Add(currentMarker);
            }
            else if (m_color == blue)
            {
                blueMarkers.Add(currentMarker);
            }
        }
    }
Esempio n. 5
0
    //when marker gets removed from table, remove from every coloured list and activeMarkersOnGrid array
    private void RemoveMarker(TuioObject tobj)
    {
        int symbolID = tobj.getSymbolID();

        if (markers.ContainsKey(symbolID) && symbolID != m_settings.startLoopBarMarkerID && symbolID != m_settings.endLoopBarMarkerID)
        {
            float?lastTimeAdded = markers[symbolID].GetComponent <FiducialController>().GetLastTimeAdded();
            //checks the last time the Marker has been added to the table and doesn't remove it if it's too low (marker has been removed too fast --> false positive from fiducial library)
            if (lastTimeAdded == null || lastTimeAdded > m_settings.lastTimeAddedThreshold)
            {
                GameObject   currentMarker = markers[symbolID];
                GameObject[] currentList   = activeMarkersOnGrid;

                Debug.Log("Marker " + symbolID + " has been removed from the grid.");

                //remove from colored lists
                if (redMarkers.Contains(currentMarker))
                {
                    redMarkers.Remove(currentMarker);
                    if (enableChords)
                    {
                        currentList = activeREDMarkersOnGrid;
                    }
                }
                else if (blueMarkers.Contains(currentMarker))
                {
                    blueMarkers.Remove(currentMarker);
                    if (enableChords)
                    {
                        currentList = activeBLUEMarkersOnGrid;
                    }
                }
                else if (greenMarkers.Contains(currentMarker))
                {
                    greenMarkers.Remove(currentMarker);
                    if (enableChords)
                    {
                        currentList = activeGREENMarkersOnGrid;
                    }
                }

                //remove from activeMarkersOnGrid array
                RemoveMarkerFromActiveMarkersOnGrid(currentMarker, currentList);
                //set isSnapped to false
                currentMarker.GetComponent <FiducialController>().SetIsSnapped(false);
            }
        }
    }
Esempio n. 6
0
 public void removeTuioObject(TuioObject tobj)
 {
     Console.WriteLine("del obj " + tobj.getSymbolID() + " " + tobj.getSessionID());
 }
Esempio n. 7
0
 public void updateTuioObject(TuioObject tobj)
 {
     Console.WriteLine("set obj " + tobj.getSymbolID() + " " + tobj.getSessionID() + " " + tobj.getX() + " " + tobj.getY() + " " + tobj.getAngle() + " " + tobj.getMotionSpeed() + " " + tobj.getRotationSpeed() + " " + tobj.getMotionAccel() + " " + tobj.getRotationAccel());
 }
Esempio n. 8
0
 public void addTuioObject(TuioObject tobj)
 {
     Console.WriteLine("add obj " + tobj.getSymbolID() + " " + tobj.getSessionID() + " " + tobj.getX() + " " + tobj.getY() + " " + tobj.getAngle());
 }
Esempio n. 9
0
    //keeps color allocation of markers up to date
    private void UpdateMarker(TuioObject tobj)
    {
        int symbolID = tobj.getSymbolID();

        //checks if fiducial library recognized marker which is not being used in this program and...
        //... prevents loopBar Markers to be added to lists
        if (markers.ContainsKey(symbolID) &&
            symbolID != m_settings.startLoopBarMarkerID && symbolID != m_settings.endLoopBarMarkerID)
        {
            GameObject currentMarker = markers[symbolID];

            //checks if marker if snapped, if so --> no further changements made (color change etc.)
            if (!currentMarker.GetComponent <FiducialController>().IsSnapped())
            {
                //gets current color, adds marker to the according List and removes from other lists (if containing)
                ColorAccToPosition m_colorAccToPosition = currentMarker.GetComponent <ColorAccToPosition>();
                //updates sprite color - going too fast for loop in ColoAccToPosition script
                m_colorAccToPosition.CheckColor();
                Color m_color = currentMarker.GetComponent <SpriteRenderer>().color;

                if (m_color == red && !redMarkers.Contains(currentMarker))
                {
                    redMarkers.Add(currentMarker);

                    if (blueMarkers.Contains(currentMarker))
                    {
                        blueMarkers.Remove(currentMarker);
                        Debug.Log("Marker " + symbolID + " switched colors from blue to red.");
                    }
                    else if (greenMarkers.Contains(currentMarker))
                    {
                        greenMarkers.Remove(currentMarker);
                        Debug.Log("Marker " + symbolID + " switched colors from green to red.");
                    }
                }
                else if (m_color == green && !greenMarkers.Contains(currentMarker))
                {
                    greenMarkers.Add(currentMarker);

                    if (blueMarkers.Contains(currentMarker))
                    {
                        blueMarkers.Remove(currentMarker);
                        Debug.Log("Marker " + symbolID + " switched colors blue to green.");
                    }
                    else if (redMarkers.Contains(currentMarker))
                    {
                        redMarkers.Remove(currentMarker);
                        Debug.Log("Marker " + symbolID + " switched colors red to green.");
                    }
                }
                else if (m_color == blue && !blueMarkers.Contains(currentMarker))
                {
                    blueMarkers.Add(currentMarker);

                    if (greenMarkers.Contains(currentMarker))
                    {
                        greenMarkers.Remove(currentMarker);
                        Debug.Log("Marker " + symbolID + " switched colors green to blue.");
                    }
                    else if (redMarkers.Contains(currentMarker))
                    {
                        redMarkers.Remove(currentMarker);
                        Debug.Log("Marker " + symbolID + " switched colors red to blue.");
                    }
                }
            }
        }
    }