Ejemplo n.º 1
0
        private void RecreateFlatMirror()
        {
            if (_carWrapper == null)
            {
                return;
            }

            var replaceMode = _carWrapper.ElementAtOrDefault(0) is FlatMirror;

            if (replaceMode)
            {
                _carWrapper[0].Dispose();
                _carWrapper.RemoveAt(0);
            }

            var mirrorPlane = new Plane(Vector3.Zero, Vector3.UnitY);

            _mirror = FlatMirror && CarNode != null ? new FlatMirror(CarNode, mirrorPlane) :
                      new FlatMirror(mirrorPlane, OpaqueGround);
            if (FlatMirror && ShowWireframe)
            {
                _mirror.SetInvertedRasterizerState(DeviceContextHolder.States.WireframeInvertedState);
            }

            _carWrapper.Insert(0, _mirror);

            if (replaceMode)
            {
                _carWrapper.UpdateBoundingBox();
            }
        }