Ejemplo n.º 1
0
    // Use this for initialization
    void Start()
    {
        nextUpdateTime = Time.time + interval;

        // init stuff
        YRes    = ZigInput.Depth.yres;
        XRes    = ZigInput.Depth.xres;
        factorX = (int)(XRes / DesiredResolution.x);
        factorY = (int)(YRes / DesiredResolution.y);
        // depthmap data
        rawDepthMap = new short[(int)(XRes * YRes)];

        // the actual mesh we'll use

        curMesh = new Mesh();

        meshFilter      = (MeshFilter)GetComponent(typeof(MeshFilter));
        meshFilter.mesh = curMesh;

        int YScaled = YRes / factorY;
        int XScaled = XRes / factorX;

        verts = new Vector3[XScaled * YScaled];
        uvs   = new Vector2[verts.Length];
        tris  = new int[(XScaled - 1) * (YScaled - 1) * 2 * 3];
        pts   = new Point3D[XScaled * YScaled];
        CalculateTriangleIndices(YScaled, XScaled);
        CalculateUVs(YScaled, XScaled);

        // Gaussian blur
        meshBlur          = new MeshBlur();
        meshBlur.myFilter = new int[, ] {
            { 1, 2, 1 }, { 2, 4, 2 }, { 1, 2, 1 }
        };

        // Mesh lerp
        meshLerp = new MeshLerp(XScaled, YScaled);
    }
Ejemplo n.º 2
0
    // Use this for initialization
    void Start()
    {
        nextUpdateTime = Time.time + interval;

        // init stuff
        YRes = ZigInput.Depth.yres;
        XRes = ZigInput.Depth.xres;
        factorX = (int)(XRes / DesiredResolution.x);
        factorY = (int)(YRes / DesiredResolution.y);
        // depthmap data
        rawDepthMap = new short[(int)(XRes * YRes)];

        // the actual mesh we'll use

        curMesh = new Mesh();

        meshFilter = (MeshFilter)GetComponent(typeof(MeshFilter));
        meshFilter.mesh = curMesh;

        int YScaled = YRes / factorY;
        int XScaled = XRes / factorX;

        verts = new Vector3[XScaled * YScaled];
        uvs = new Vector2[verts.Length];
        tris = new int[(XScaled - 1) * (YScaled - 1) * 2 * 3];
        pts = new Point3D[XScaled * YScaled];
        CalculateTriangleIndices(YScaled, XScaled);
        CalculateUVs(YScaled, XScaled);

        // Gaussian blur
        meshBlur = new MeshBlur();
        meshBlur.myFilter = new int[,] {{1, 2, 1}, {2, 4, 2}, {1, 2, 1}};

        // Mesh lerp
        meshLerp = new MeshLerp(XScaled, YScaled);
    }