Esempio n. 1
0
 void ToggleZ()
 {
     ConstrainZ         = !ConstrainZ;
     ToolTracker.net[2] = 2;
     ToolTracker.net[3] = 3;
     if (ConstrainZ)
     {
         ToolTracker.value[0] = "2";
     }
     else
     {
         ToolTracker.value[0] = "1";
     }
     ToolTracker.setEmpty(1);
     TrackerScript.AddAction();
     foreach (var s in Zlisteners)
     {
         if (ConstrainZ)
         {
             s.Enable();
         }
         else
         {
             s.Disable();
         }
     }
 }
Esempio n. 2
0
 void ScaleDown()
 {
     if (eraser.transform.parent.parent.localScale.x > 0.2f)
     {
         eraser.transform.parent.parent.localScale -= scaleVector;
         ToolTracker.net[3]   = 3;
         ToolTracker.value[0] = "f";
         ToolTracker.value[2] = "" + scaleVector.magnitude;
         ToolTracker.setEmpty(2);
         TrackerScript.AddAction();
     }
 }
Esempio n. 3
0
    public void ScaleShapeDown()
    {
        float newRadius = radius - 0.005f;

        if (newRadius >= 0.02f)
        {
            radius               = newRadius;
            ToolTracker.net[2]   = 1;
            ToolTracker.net[3]   = 3;
            ToolTracker.value[0] = "f";
            ToolTracker.value[1] = "" + newRadius;
            ToolTracker.setEmpty(2);
            TrackerScript.AddAction();
        }
    }
Esempio n. 4
0
    public void ScaleShapeUp()
    {
        float newRadius = radius + 0.005f;

        if (newRadius <= 0.20f)
        {
            radius               = newRadius;
            ToolTracker.net[2]   = 1;
            ToolTracker.net[3]   = 2;
            ToolTracker.value[0] = "f";
            ToolTracker.value[1] = "" + newRadius;
            ToolTracker.setEmpty(2);
            TrackerScript.AddAction();
        }
    }
Esempio n. 5
0
    public void ToggleLengthConstraint()
    {
        ConstrainLength = !ConstrainLength;
        photonView.RPC("UpdateLengthConstraint", PhotonTargets.AllBufferedViaServer, ConstrainLength, LengthConstraint);

        ToolTracker.net[2] = 5;
        ToolTracker.net[3] = 1;
        if (ConstrainLength)
        {
            ToolTracker.value[0] = "2";
            ToolTracker.value[1] = "f";
            ToolTracker.value[2] = "" + LengthConstraint;
            ToolTracker.setEmpty(2);
        }
        else
        {
            ToolTracker.value[0] = "1";
            ToolTracker.setEmpty(1);
        }

        TrackerScript.AddAction();
    }
Esempio n. 6
0
    void calculateAnalytics()
    {
        //gonna need a better algorithm for more tools

        if (Valve.VR.OpenVR.IsHmdPresent())
        {
            Valve.VR.HmdQuad_t roomDims = new Valve.VR.HmdQuad_t();
            SteamVR_PlayArea.GetBounds(SteamVR_PlayArea.Size.Calibrated, ref roomDims);
            Vector3 roomScale = new Vector3(Mathf.Abs(roomDims.vCorners0.v0 - roomDims.vCorners2.v0), Mathf.Abs(roomDims.vCorners0.v2 - roomDims.vCorners2.v2), 1);
            roomWidth  = roomScale.x;
            roomHeight = roomScale.y;
        }

        int   mostToolNum   = 0;
        float mostToolTimed = 0;

        foreach (KeyValuePair <string, ToolData> pair in toolMap)
        {
            if (pair.Value.Count > mostToolNum)
            {
                mostToolGrab = pair.Value.Name;
                mostToolNum  = pair.Value.Count;
            }

            if (pair.Value.Time > mostToolTimed)
            {
                mostToolTime  = pair.Value.Name;
                mostToolTimed = pair.Value.Time;
            }
        }

        string mostCommonPairLetters = MostCommonSubstring();

        if (mostCommonPairLetters.Length == 2)
        {
            string firstTool  = toolMap[mostCommonPairLetters[0].ToString()].Name;
            string secondTool = toolMap[mostCommonPairLetters[1].ToString()].Name;
            mostCommonToolPairs = firstTool + " to " + secondTool;
        }

        timeCamera       = toolMap["A"].Time;
        numCamera        = toolMap["A"].Count;
        timeBoolean      = toolMap["B"].Time;
        numBoolean       = toolMap["B"].Count;
        timeClone        = toolMap["C"].Time;
        numClone         = toolMap["C"].Count;
        timeDrawFace     = toolMap["D"].Time;
        numDrawFace      = toolMap["D"].Count;
        timeExtrude      = toolMap["E"].Time;
        numExtrude       = toolMap["E"].Count;
        timeLoft         = toolMap["F"].Time;
        numLoft          = toolMap["F"].Count;
        timeGroup        = toolMap["G"].Time;
        numGroup         = toolMap["G"].Count;
        timePrimitive    = toolMap["I"].Time;
        numPrimitive     = toolMap["I"].Count;
        timeClipping     = toolMap["K"].Time;
        numClipping      = toolMap["K"].Count;
        timeLine         = toolMap["L"].Time;
        numLine          = toolMap["L"].Count;
        timeMirror       = toolMap["M"].Time;
        numMirror        = toolMap["M"].Count;
        timeSelection    = toolMap["N"].Time;
        numSelection     = toolMap["N"].Count;
        timePolygon      = toolMap["O"].Time;
        numPolygon       = toolMap["O"].Count;
        timePaint        = toolMap["P"].Time;
        numPaint         = toolMap["P"].Count;
        timeEraser       = toolMap["R"].Time;
        numEraser        = toolMap["R"].Count;
        timeSpline       = toolMap["S"].Time;
        numSpline        = toolMap["S"].Count;
        timeGravity      = toolMap["V"].Time;
        numGravity       = toolMap["V"].Count;
        timeExtrudeCurve = toolMap["X"].Time;
        numExtrudeCurve  = toolMap["X"].Count;
        timeMeasuring    = toolMap["Z"].Time;
        numMeasuring     = toolMap["Z"].Count;

        //here i get the most used shapes and sections
        // this can be done more efficiently
        List <int> shapeList   = new List <int>();
        List <int> sectionList = new List <int>();

        shapeList.Add(numTriangle);
        shapeList.Add(numSquare);
        shapeList.Add(numCircle);
        sectionList.Add(numIsec);
        sectionList.Add(numCsec);
        sectionList.Add(numLsec);
        sectionList.Add(numTsec);

        int shapeNum = shapeList[0];
        int shapeInd = 0;
        int secNum   = sectionList[0];
        int secInd   = 0;

        for (int k = 0; k < shapeList.Count; k++)
        {
            if (shapeList[k] > shapeNum)
            {
                shapeNum = shapeList[k];
                shapeInd = k;
            }
        }

        for (int l = 0; l < sectionList.Count; l++)
        {
            if (sectionList[l] > shapeNum)
            {
                secNum = sectionList[l];
                secInd = l;
            }
        }

        if (shapeNum > 0)
        {
            switch (shapeInd)
            {
            case 0:
                commonShape = "Triangle";
                break;

            case 1:
                commonShape = "Square";
                break;

            case 2:
                commonShape = "Circle";
                break;
            }
        }
        else
        {
            commonShape = "NONE";
        }

        if (secNum > 0)
        {
            switch (secInd)
            {
            case 0:
                commonSection = "I Section";
                break;

            case 1:
                commonSection = "C Section";
                break;

            case 2:
                commonSection = "L Section";
                break;

            case 3:
                commonSection = "T Section";
                break;
            }
        }
        else
        {
            commonSection = "NONE";
        }

        if (shapeNum > secNum)
        {
            shapeVsSection = "Shape";
        }
        else if (secNum > shapeNum)
        {
            shapeVsSection = "Section";
        }
        else if (secNum == shapeNum)
        {
            shapeVsSection = "Equal";
        }

        float saveSum = 0;

        numSaves = saveSizes.Count;
        if (numSaves > 0)
        {
            for (int i = 0; i < numSaves; i++)
            {
                saveSum += saveSizes[i];
            }
            avgSaveSize = saveSum / numSaves;
        }
        else
        {
            avgSaveSize = 0;
        }


        //for now, just get color average, not common colors - pretty innacurate
        float sumR = 0;
        float sumG = 0;
        float sumB = 0;

        for (int ci = 0; ci < colors.Count; ci++)
        {
            float r = colors[ci].r;
            float g = colors[ci].g;
            float b = colors[ci].b;

            sumR += r;
            sumG += g;
            sumB += b;
        }

        float avgR = sumR / colors.Count;
        float avgG = sumG / colors.Count;
        float avgB = sumB / colors.Count;

        avgR *= 255.0f;
        avgG *= 255.0f;
        avgB *= 255.0f;

        avgColor = "(" + avgR + "," + avgG + "," + avgB + ")";

        if (heights.Count > 0)
        {
            userHeight = heights[heights.Count * 3 / 4];
        }
        else
        {
            userHeight = 0;
        }

        userHeight *= 1.5f;

        maxPeople = maxActive + maxPassiveVR + maxPassiveController + maxTheatre;

        TrackerScript.AddAction("*");
    }
Esempio n. 7
0
    public void EndDrawing()
    {
        // set the collider and the mesh
        if (go != null)
        {
            if (objectType == ObjectType.Shape)
            {
                go.GetComponent <ShapeSplineTrail>().CancelTracking();

                // end reflection
                if (ms.gameObject.activeSelf)
                {
                    ms.reflection.GetComponent <ShapeSplineTrail>().CancelTracking();
                }
                GameObject.Find("Tracker").GetComponent <TrackerScript>().numMesh++;
                ObjectManager.instance.AddObject(go);
                go.GetComponent <MeshEditor>().StartGroupGeneration();
            }
            else if (objectType == ObjectType.Section)
            {
                go.GetComponent <SectionSplineTrail>().CancelTracking();

                // end reflection
                if (ms.gameObject.activeSelf)
                {
                    ms.reflection.GetComponent <SectionSplineTrail>().CancelTracking();
                }
                GameObject.Find("Tracker").GetComponent <TrackerScript>().numMesh++;
                ObjectManager.instance.AddObject(go);
                go.GetComponent <MeshEditor>().StartGroupGeneration();
            }
            else if (objectType == ObjectType.Hair)
            {
                go.GetComponent <HairSplineTrail>().CancelTracking();

                // end reflection
                if (ms.gameObject.activeSelf)
                {
                    ms.reflection.GetComponent <HairSplineTrail>().CancelTracking();
                }
                GameObject.Find("Tracker").GetComponent <TrackerScript>().numMesh++;

                var        refTrail = go.GetComponent <HairSplineTrail>();
                GameObject trail    = Instantiate(Resources.Load("NURBSTrail"), new Vector3(0, 0, 0), Quaternion.identity) as GameObject;
                trail.GetComponent <NURBSTrail>().InitNURBS(refTrail.spline, refTrail.trackLength, new Vector3(0.005f, 0, 0));
                trail.GetComponent <MeshRenderer>().material.color = go.GetComponent <MeshRenderer>().material.color;
                Destroy(go);
                refTrail.Init(hairObject);
                ObjectManager.instance.AddObject(trail);
            }

            shapeObject.GetComponent <ProcShape>().Init();
            sectionObject.GetComponent <ProcSection>().Init();
            hairObject.GetComponent <ProcHair>().Init();

            ToolTracker.setEmpty(4);
            TrackerScript.AddAction();
        }

        // add reflection
        if (ms.gameObject.activeSelf)
        {
            ObjectManager.instance.AddObject(ms.reflection);
        }

        go = null;
    }