devNotes 12-04-2016 Section 3 – Scale PointCloud

Rendering of CenterSphere – After – UNO SHADER – Turn Z_WRITE OFF

Connection Headset

Scaler switch fix

Scaling properly on TransformPointCloud()

Compute shader selection

Attractor/Emiter/CenterSphere handler – display

 


    public void transformPointCloud()
    {
        if (particles != null)
        {
            particles.GetData(pOutputBuffer);
            Vector3 lastPos;
            Quaternion lastRota;

            centerSphere.GetComponent<CenterSphere_Interactions>().getLast_Spawn(out lastPos, out lastRota);
            Transform tSource_Current = centerSphere.transform;

            Quaternion qDelta = tSource_Current.rotation * Quaternion.Inverse(lastRota);

            //P' = RPR'
            //P' = H(H(R, P), R')

            Vector3     pT0;
            Quaternion  qT0;
            Quaternion  qT1;
            Vector3     pT1;

            for (int i = 0; i < pOutputBuffer.Length; i++)
            {
                pT0 = pOutputBuffer[i].position - lastPos;
                qT0.x = pT0.x;
                qT0.y = pT0.y;
                qT0.z = pT0.z;
                qT0.w = 0;
                qT1 = (qDelta * qT0) * Quaternion.Inverse(qDelta);
                pT1.x = qT1.x;
                pT1.y = qT1.y;
                pT1.z = qT1.z;
                pOutputBuffer[i].position = pT1 + centerSphere.transform.position;
            }
            particles.Dispose();
            particles = new ComputeBuffer(pOutputBuffer.Length, particleSizeOf, ComputeBufferType.Default);
            particles.SetData(pOutputBuffer);

            activeCompute.SetBuffer(kernel, "particles", particles);

        }
    }

 

30014720