コード例 #1
0
        public Matrix4 GetModelMatrix(float x, float y, float z, float ang)
        {
            SizeF _imageNormalizedSize = new SizeF(
                _customImage.Width >= _customImage.Height ? 1.0f : (float)_customImage.Width / _customImage.Height,
                _customImage.Width <= _customImage.Height ? 1.0f : (float)_customImage.Height / _customImage.Width);

            Vector3 pos = new Vector3(x, y, z);

            float size = _iconSize / 200;

            return(Matrix4.CreateScale(size * _imageNormalizedSize.Width, size * _imageNormalizedSize.Height, 1)
                   * Matrix4.CreateRotationZ(0)
                   * Matrix4.CreateScale(1.0f / Config.Map3DGraphics.NormalizedWidth, 1.0f / Config.Map3DGraphics.NormalizedHeight, 1)
                   * Matrix4.CreateTranslation(MapUtilities.GetPositionOnViewFromCoordinate(pos)));
        }
コード例 #2
0
        public Matrix4 GetModelMatrix(float x, float y, float z, float ang, bool rotates, Image image)
        {
            SizeF _imageNormalizedSize = new SizeF(
                image.Width >= image.Height ? 1.0f : (float)image.Width / image.Height,
                image.Width <= image.Height ? 1.0f : (float)image.Height / image.Width);

            float   angle = (CustomRotates ?? rotates) ? (float)MoreMath.AngleUnitsToRadians(ang - MapConfig.Map3DCameraYaw + 32768) : 0;
            Vector3 pos   = new Vector3(x, y, z);

            float size = Size / 200;

            return(Matrix4.CreateScale(size * _imageNormalizedSize.Width, size * _imageNormalizedSize.Height, 1)
                   * Matrix4.CreateRotationZ(angle)
                   * Matrix4.CreateScale(1.0f / Config.Map3DGraphics.NormalizedWidth, 1.0f / Config.Map3DGraphics.NormalizedHeight, 1)
                   * Matrix4.CreateTranslation(MapUtilities.GetPositionOnViewFromCoordinate(pos)));
        }
コード例 #3
0
        public override Matrix4 GetModelMatrix()
        {
            SizeF _imageNormalizedSize = new SizeF(
                Image.Width >= Image.Height ? 1.0f : (float)Image.Width / Image.Height,
                Image.Width <= Image.Height ? 1.0f : (float)Image.Height / Image.Width);

            PositionAngle posAngle = GetPositionAngle();
            float         angle    = Rotates ? (float)MoreMath.AngleUnitsToRadians(posAngle.Angle - SpecialConfig.Map3DCameraYaw + 32768) : 0;
            Vector3       pos      = new Vector3((float)posAngle.X, (float)posAngle.Y, (float)posAngle.Z);

            float size = Size / 200;

            return(Matrix4.CreateScale(size * _imageNormalizedSize.Width, size * _imageNormalizedSize.Height, 1)
                   * Matrix4.CreateRotationZ(angle)
                   * Matrix4.CreateScale(1.0f / Config.Map3DGraphics.NormalizedWidth, 1.0f / Config.Map3DGraphics.NormalizedHeight, 1)
                   * Matrix4.CreateTranslation(MapUtilities.GetPositionOnViewFromCoordinate(pos)));
        }