void ILeafVisitorOf <IPlaneShape> .Visit(IPlaneShape planeShape)
        {
            IModel model;

            if (!_allocatedModels.TryGetValue(planeShape, out model))
            {
                model = _allocatedModels[planeShape] = Models.PlaneXZ.Scaled(10, 1, 6);
            }

            Matrix4x4 rotationZ           = Matrices.RotateZ((float)Math.Atan2(planeShape.Normal.X, planeShape.Normal.Y));
            Matrix4x4 rotationX           = Matrices.RotateX(-(float)Math.Atan2(planeShape.Normal.Z, planeShape.Normal.Y));
            Matrix4x4 finalRotation       = GMath.mul(rotationZ, rotationX);
            Matrix4x4 translation         = Matrices.Translate(planeShape.DistanceFromOrigin * planeShape.Normal);
            Matrix4x4 finalTransformation = GMath.mul(finalRotation, translation);

            PushPose(finalTransformation);

            DrawShape(planeShape, model);

            _posesStack.Pop();
        }
示例#2
0
 public void CopyStateTo(IPlaneShape element)
 {
     element.Descriptor = Descriptor;
 }
示例#3
0
 public void CopyStateTo(IPlaneShape element)
 {
     element.Descriptor = Descriptor;
 }