Exemplo n.º 1
0
        private void CreateAlgorithm()
        {
            double triangleLength = FromMeters(200000);
            double triangleDelta  = FromMeters(0.5);

            Vector3D[] positions = new Vector3D[]
            {
                new Vector3D(_xTranslation, triangleDelta + 0, 0),                  // Red triangle
                new Vector3D(_xTranslation, triangleDelta + triangleLength, 0),
                new Vector3D(_xTranslation, triangleDelta + 0, triangleLength),
                new Vector3D(_xTranslation, -triangleDelta - 0, 0),                 // Green triangle
                new Vector3D(_xTranslation, -triangleDelta - 0, triangleLength),
                new Vector3D(_xTranslation, -triangleDelta - triangleLength, 0),
                new Vector3D(_xTranslation, 0, 0),                                  // Blue point
            };

            byte[] colors = new byte[]
            {
                255, 0, 0,
                255, 0, 0,
                255, 0, 0,
                0, 255, 0,
                0, 255, 0,
                0, 255, 0,
                0, 0, 255
            };

            if (_algorithm != null)
            {
                ((IDisposable)_algorithm).Dispose();
                _algorithm = null;
            }

            switch (_jitterAlgorithm)
            {
            case JitterAlgorithm.RelativeToWorld:
                _algorithm = new RelativeToWorld(_window.Context, positions, colors);
                break;

            case JitterAlgorithm.RelativeToCenter:
                _algorithm = new RelativeToCenter(_window.Context, positions, colors);
                break;

            case JitterAlgorithm.CPURelativeToEye:
                _algorithm = new CPURelativeToEye(_window.Context, positions, colors);
                break;

            case JitterAlgorithm.GPURelativeToEye:
                _algorithm = new GPURelativeToEye(_window.Context, positions, colors);
                break;

            case JitterAlgorithm.GPURelativeToEyeDSFUN90:
                _algorithm = new GPURelativeToEyeDSFUN90(_window.Context, positions, colors);
                break;

            case JitterAlgorithm.GPURelativeToEyeLOD:
                _algorithm = new SceneGPURelativeToEyeLOD(_window.Context, positions, colors);
                break;
            }
        }
Exemplo n.º 2
0
        private void CreateAlgorithm()
        {
            double triangleLength = FromMeters(200000);
            double triangleDelta = FromMeters(0.5);

            Vector3D[] positions = new Vector3D[]
            {
                new Vector3D(_xTranslation, triangleDelta + 0, 0),                  // Red triangle
                new Vector3D(_xTranslation, triangleDelta + triangleLength, 0),
                new Vector3D(_xTranslation, triangleDelta + 0, triangleLength),
                new Vector3D(_xTranslation, -triangleDelta - 0, 0),                 // Green triangle
                new Vector3D(_xTranslation, -triangleDelta - 0, triangleLength),
                new Vector3D(_xTranslation, -triangleDelta - triangleLength, 0),
                new Vector3D(_xTranslation, 0, 0),                                  // Blue point
            };

            byte[] colors = new byte[]
            {
                255, 0, 0,
                255, 0, 0,
                255, 0, 0,
                0, 255, 0,
                0, 255, 0,
                0, 255, 0,
                0, 0, 255
            };

            if (_algorithm != null)
            {
                ((IDisposable)_algorithm).Dispose();
                _algorithm = null;
            }

            switch (_jitterAlgorithm)
            {
                case JitterAlgorithm.RelativeToWorld:
                    _algorithm = new RelativeToWorld(_window.Context, positions, colors);
                    break;
                case JitterAlgorithm.RelativeToCenter:
                    _algorithm = new RelativeToCenter(_window.Context, positions, colors);
                    break;
                case JitterAlgorithm.CPURelativeToEye:
                    _algorithm = new CPURelativeToEye(_window.Context, positions, colors);
                    break;
                case JitterAlgorithm.GPURelativeToEye:
                    _algorithm = new GPURelativeToEye(_window.Context, positions, colors);
                    break;
                case JitterAlgorithm.GPURelativeToEyeDSFUN90:
                    _algorithm = new GPURelativeToEyeDSFUN90(_window.Context, positions, colors);
                    break;
                case JitterAlgorithm.GPURelativeToEyeLOD:
                    _algorithm = new SceneGPURelativeToEyeLOD(_window.Context, positions, colors);
                    break;
            }
        }