Beispiel #1
0
 public Vertex(Math.Vector2 position)
 {
     Position = new Vector4(position.X, position.Y, 0f, 1f);
     TexturePosition = default(Vector2);
     BezierCoordinates = default(Vector2);
     Mode = VertexMode.Default;
 }
        public override void InitOtherStuff()
        {
            OutputTexture = PrivateRendererContext.CreateTexture2D("Blur_Output_Texture_" + DateTime.Now.Ticks, PrivateRendererContext.ViewportSize.X,
                PrivateRendererContext.ViewportSize.Y, false, IntPtr.Zero, false, true);

            uShift = new FreezingArcher.Math.Vector2(1.0f / OutputTexture.Width, 1.0f / OutputTexture.Height);
        }
Beispiel #3
0
        public static Math.Float2x2 Construct(Math.Vector2 a, Math.Vector2 b)
        {
            var result = new Math.Float2x2();

            result.Column0 = a;
            result.Column1 = b;
            return(result);
        }
Beispiel #4
0
        internal void UpdateVertices(Vertex[] vertices)
        {
            Matrix2x3 inverseTransform = Transform.Invert();

            for (int i = 0; i < vertices.Length; i++)
            {
                SharpDX.Vector4 vertexPos  = vertices[i].Position;
                Math.Vector2    texturePos = GetTexturePosition(new Math.Vector2(vertexPos.X, vertexPos.Y), inverseTransform);
                vertices[i].TexturePosition = new SharpDX.Vector2(texturePos.X, texturePos.Y);
            }
        }
Beispiel #5
0
        /// <summary>
        /// private method for selection object that creates a box from the SelectionRectangle, stop variable is passed in
        /// </summary>
        /// <param name="first">Vector2</param>
        /// <param name="second">Vector2</param>
        private void PerformSelectionWithSelectionBox(Math.Vector2 first, Math.Vector2 second)
        {
            Log("MouseSelector: " + this._name + " performing selection.");

            float left = first.x, right = second.x, top = first.y, bottom = second.y;

            if (left > right)
            {
                Utility.Swap(ref left, ref right);
            }

            if (top > bottom)
            {
                Utility.Swap(ref top, ref bottom);
            }

            if ((right - left) * (bottom - top) < 0.0001)
            {
                return;
            }

            Ray topLeft     = this._Camera.GetCameraToViewportRay(left, top);
            Ray topRight    = this._Camera.GetCameraToViewportRay(right, top);
            Ray bottomLeft  = this._Camera.GetCameraToViewportRay(left, bottom);
            Ray bottomRight = this._Camera.GetCameraToViewportRay(right, bottom);

            var vol = new PlaneBoundedVolume();

            vol.planes.Add(new Math.Plane(topLeft.GetPoint(3), topRight.GetPoint(3), bottomRight.GetPoint(3)));
            // front plane
            vol.planes.Add(new Math.Plane(topLeft.Origin, topLeft.GetPoint(100), topRight.GetPoint(100))); // top plane
            vol.planes.Add(new Math.Plane(topLeft.Origin, bottomLeft.GetPoint(100), topLeft.GetPoint(100)));
            // left plane
            vol.planes.Add(new Math.Plane(bottomLeft.Origin, bottomRight.GetPoint(100), bottomLeft.GetPoint(100)));
            // bottom plane
            vol.planes.Add(new Math.Plane(topRight.Origin, topRight.GetPoint(100), bottomRight.GetPoint(100)));
            // right plane

            var volList = new PlaneBoundedVolumeList();

            volList.Add(vol);

            PlaneBoundedVolumeListSceneQuery volQuery;

            volQuery         = Root.Instance.SceneManager.CreatePlaneBoundedVolumeQuery(new PlaneBoundedVolumeList());
            volQuery.Volumes = volList;
            SceneQueryResult result = volQuery.Execute();

            foreach (MovableObject obj in result.objects)
            {
                SelectObject(obj);
            }
        }
Beispiel #6
0
        public void Draw(TextureResource texture, Math.Vector2 position)
        {
            Rect destination;

            destination.X = position.X;
            destination.Y = position.Y;

            destination.Width  = texture.Width;
            destination.Height = texture.Height;

            Draw(texture, destination, null, 0);
        }
Beispiel #7
0
        public void Draw(TextureResource texture, Math.Vector2 destination, Rect?source, Color color, float layerDepth)
        {
            Sprite s;

            s.Texture            = texture;
            s.Source             = (source.HasValue ? source.Value : new Rect(0, 0, texture.Width, texture.Height));
            s.Destination.X      = destination.X;
            s.Destination.Y      = destination.Y;
            s.Destination.Width  = s.Source.Width;
            s.Destination.Height = s.Source.Height;
            s.Color = color;

            _sprites.Add(s);
        }
Beispiel #8
0
        public ActorPathfinder(string pathMapName, Math.Vector2 size, Math.Vector2 offset)
        {
            if (pathMapName == null)
            {
                throw new ArgumentNullException("pathMapName");
            }

            _scaledSize = size;
            _offset     = offset;

            if (pathMapName.EndsWith(".BMP", StringComparison.OrdinalIgnoreCase) == false)
            {
                pathMapName += ".BMP";
            }

            Graphics.BitmapSurface map;
            using (System.IO.Stream stream = FileSystem.Open(pathMapName))
            {
                // apparently the color doesn't matter, the weights are
                // stored as indices. So we don't want to convert!
                map = new Gk3Main.Graphics.BitmapSurface(stream, Graphics.BitmapSurface.SourceType.Unknown, false);
            }

            // temporary
            //Graphics.Utils.WriteTga("out.tga", map.Pixels, map.Width, map.Height);

            // read the pixels and convert them into weights
            _weightMap = new byte[map.Width * map.Height];
            _width     = map.Width;
            _height    = map.Height;

            for (int y = 0; y < map.Height; y++)
            {
                for (int x = 0; x < map.Width; x++)
                {
                    Graphics.Color color = map.ReadColorAt(x, y);

                    _weightMap[y * _width + x] = color.R;
                }
            }

            // create the working arrays
            _whichList = new int[_width * _height];
            _parents   = new int[_width * _height];
            _fCost     = new float[_width * _height];
            _gCost     = new float[_width * _height];
            _hCost     = new float[_width * _height];
        }
Beispiel #9
0
        private void DrawEllipse(DrawingContext drawingContext, CS2dEllipse element)
        {
            Pen stroke = element.Stroke == null ? null : new Pen(element.Stroke, element.Thickness);

            int    count = 200;
            double space = System.Math.PI * 2.0 / count;

            Coast.Math.Vector2 shiftVector = new Coast.Math.Vector2(element.CenterX, element.CenterY);
            Coast.Math.Vector2 v           = new Math.Vector2();

            PathGeometry pathGeometry = new PathGeometry();
            PathFigure   pathFeature  = new PathFigure();

            pathFeature.IsClosed = true;
            pathGeometry.Figures.Add(pathFeature);

            for (int i = 0; i < count; i++)
            {
                //参数方程
                //  x = a*cos(t)
                //  y = b*cos(t)
                v.X = System.Math.Cos(space * i) * element.RadiusA;
                v.Y = System.Math.Sin(space * i) * element.RadiusB;

                //旋转th
                v.Rotate(element.Rotation / 180 * System.Math.PI);

                //平移
                v.Add(shiftVector);

                Point p = new Point(v.X, v.Y);

                if (i == 0)
                {
                    pathFeature.StartPoint = TransformXY(p);
                }
                else
                {
                    LineSegment segment = new LineSegment()
                    {
                        Point = TransformXY(p)
                    };
                    pathFeature.Segments.Add(segment);
                }
            }

            drawingContext.DrawGeometry(null, stroke, pathGeometry);
        }
Beispiel #10
0
        private Graphics.Rect calculateBoxSize(string text, Graphics.Rect minSize)
        {
            Math.Vector2 textSize = Font.MeasureString(_font, text);
            float        area     = textSize.X * textSize.Y;

            const float goalRatio = 3.0f;
            float       newHeight = (float)System.Math.Sqrt(area / goalRatio);
            float       newWidth  = newHeight * goalRatio;

            splitStrings(text, System.Math.Max(newWidth, minSize.Width - _textOffsetX * 2));

            Graphics.Rect result = new Graphics.Rect();
            result.Width  = (float)System.Math.Ceiling(System.Math.Max(minSize.Width, newWidth + _textOffsetX * 2.0f));
            result.Height = (float)System.Math.Ceiling(System.Math.Max(minSize.Height, newHeight + _textOffsetY * 2.0f + _ok.Height + _buttonPadding * 2.0f));

            return(result);
        }
Beispiel #11
0
        public void UpdatePosition(ushort id, Math.Vector2 position)
        {
            if (!_playerData.ContainsKey(id))
            {
                // Logger.Get().Warn(this, $"Tried to update position for ID {id} while player data did not exists");
                return;
            }

            var playerContainer = _playerData[id].PlayerContainer;

            if (playerContainer != null)
            {
                var unityPosition = new Vector3(position.X, position.Y);

                playerContainer.GetComponent <PositionInterpolation>().SetNewPosition(unityPosition);
            }
        }
Beispiel #12
0
        private void splitStrings(string text, float width)
        {
            _lines.Clear();

            string currentString = text;

            string[] words = text.Split(' ');

            float  currentLineWidth = 0;
            string currentLine      = string.Empty;
            float  maxFontHeight    = float.MinValue;
            float  spaceWidth       = Font.MeasureString(_font, " ").X;
            bool   needSpace        = false;

            foreach (string word in words)
            {
                Math.Vector2 size = Font.MeasureString(_font, word);
                if (currentLineWidth + size.X > width)
                {
                    _lines.Add(currentLine);
                    currentLine      = word;
                    currentLineWidth = size.X + spaceWidth;
                }
                else
                {
                    if (needSpace)
                    {
                        currentLine += ' ';
                    }
                    currentLine      += word;
                    currentLineWidth += size.X + spaceWidth;
                    needSpace         = true;
                }

                if (size.Y > maxFontHeight)
                {
                    maxFontHeight = size.Y;
                }
            }

            // add the final line
            _lines.Add(currentLine);
            _fontHeight = maxFontHeight;
        }
Beispiel #13
0
        public void Draw(TextureResource texture, Math.Vector2 position, Rect?source)
        {
            Rect destination;

            destination.X = position.X;
            destination.Y = position.Y;

            if (source.HasValue)
            {
                destination.Width  = source.Value.Width;
                destination.Height = source.Value.Height;
            }
            else
            {
                destination.Width  = texture.Width;
                destination.Height = texture.Height;
            }

            Draw(texture, destination, source, 0);
        }
Beispiel #14
0
        public static Plane2D CreateFromEdge(Vector2 p1, Vector2 p2)
        {
            Plane2D result;

            // calc the distance
            Math.Vector2 line = (p1 - p2);
            Math.Vector2 w    = Math.Vector2.Zero - p2;
            float        c1   = w.Dot(line);
            float        c2   = line.Dot(line);
            float        b    = c1 / c2;

            Math.Vector2 pb = p2 + line * b;
            result.Distance = pb.Length;

            // calc the normal
            result.Normal = line.Normalize();
            float t = result.Normal.X;

            result.Normal.X = result.Normal.Y;
            result.Normal.Y = -t;

            return(result);
        }
Beispiel #15
0
        public void SpawnPlayer(
            ushort id,
            string name,
            Math.Vector2 position,
            bool scale,
            Team team,
            byte skinId
            )
        {
            if (_playerData.ContainsKey(id))
            {
                Logger.Get().Warn(this, $"We already have created a player object for ID {id}");
                return;
            }

            // Create a player container
            var playerContainer = new GameObject($"Player Container {id}");

            playerContainer.transform.position = new Vector3(position.X, position.Y);

            playerContainer.AddComponent <PositionInterpolation>();

            // Instantiate the player object from the prefab in the player container
            var playerObject = Object.Instantiate(
                _playerPrefab,
                playerContainer.transform
                );

            Object.DontDestroyOnLoad(playerObject);

            SetPlayerObjectBoolScale(playerObject, scale);

            // Set object and children to active
            playerObject.SetActive(true);
            playerObject.SetActiveChildren(true);

            // Now we need to copy over a lot of variables from the local player object
            var localPlayerObject = HeroController.instance.gameObject;

            // Obtain colliders from both objects
            var collider      = playerObject.GetComponent <BoxCollider2D>();
            var localCollider = localPlayerObject.GetComponent <BoxCollider2D>();

            // Copy collider offset and size
            collider.isTrigger = true;
            collider.offset    = localCollider.offset;
            collider.size      = localCollider.size;
            collider.enabled   = true;

            // Copy collider bounds
            var bounds      = collider.bounds;
            var localBounds = localCollider.bounds;

            bounds.min = localBounds.min;
            bounds.max = localBounds.max;

            // Disable DamageHero component unless pvp is enabled
            if (_gameSettings.IsPvpEnabled && _gameSettings.IsBodyDamageEnabled)
            {
                playerObject.layer = 11;
                playerObject.GetComponent <DamageHero>().enabled = true;
            }
            else
            {
                playerObject.layer = 9;
                playerObject.GetComponent <DamageHero>().enabled = false;
            }

            // Copy over mesh filter variables
            var meshFilter = playerObject.GetComponent <MeshFilter>();
            var mesh       = meshFilter.mesh;
            var localMesh  = localPlayerObject.GetComponent <MeshFilter>().sharedMesh;

            mesh.vertices  = localMesh.vertices;
            mesh.normals   = localMesh.normals;
            mesh.uv        = localMesh.uv;
            mesh.triangles = localMesh.triangles;
            mesh.tangents  = localMesh.tangents;

            // Copy mesh renderer material
            var meshRenderer = playerObject.GetComponent <MeshRenderer>();

            meshRenderer.material = new Material(localPlayerObject.GetComponent <MeshRenderer>().material);

            // Disable non bouncer component
            var nonBouncer = playerObject.GetComponent <NonBouncer>();

            nonBouncer.active = false;

            // Copy over animation library
            var spriteAnimator = playerObject.GetComponent <tk2dSpriteAnimator>();

            // Make a smart copy of the sprite animator library so we can
            // modify the animator without having to worry about other player objects
            spriteAnimator.Library = CopyUtil.SmartCopySpriteAnimation(
                localPlayerObject.GetComponent <tk2dSpriteAnimator>().Library,
                playerObject
                );

            AddNameToPlayer(playerContainer, name, team);

            // Let the SkinManager update the skin
            _skinManager.UpdatePlayerSkin(playerObject, skinId);

            // Store the player data in the mapping
            _playerData[id] = new ClientPlayerData(
                playerContainer,
                playerObject,
                team
                );

            // Set whether this player should have body damage
            // Only if:
            // PvP is enabled and body damage is enabled AND
            // (the teams are not equal or if either doesn't have a team)
            ToggleBodyDamage(
                _playerData[id],
                _gameSettings.IsPvpEnabled && _gameSettings.IsBodyDamageEnabled &&
                (team != LocalPlayerTeam ||
                 team.Equals(Team.None) ||
                 LocalPlayerTeam.Equals(Team.None))
                );
        }
Beispiel #16
0
 protected virtual Math.Vector2 GetTexturePosition(Math.Vector2 vertex, Matrix2x3 inverseTransform)
 {
     return(Math.Vector2.Zero);
 }
Beispiel #17
0
        /// <summary>
        /// loads a quake3 level from a stream
        /// </summary>
        /// <param name="stream">stream to load from</param>
        /// <returns>level as a mesh</returns>
        public Mesh Load(Stream stream)
        {
            Mesh mesh = new Mesh();

            this.stream = stream;

            // get header and check if it is ok
            QuakeHeader header = (QuakeHeader)RawSerializer.Deserialize(stream, typeof(QuakeHeader));

            if (header.ID != 1347633737 || header.Version != 0x2e)
            {
                return(null);
            }

            // get locations of lumps
            locations = RawSerializer.DeserializeArray(stream, typeof(LumpLocation), (int)QuakeLumps.LumpNumber);

            // get lumps
            IList quakeVertices  = LoadLump(QuakeLumps.Vertices, typeof(QuakeVertex));
            IList quakeFaces     = LoadLump(QuakeLumps.Faces, typeof(QuakeFace));
            IList quakeTextures  = LoadLump(QuakeLumps.Textures, typeof(QuakeTexture));
            IList quakeLightMaps = LoadLump(QuakeLumps.Lightmaps, typeof(QuakeLightMap));


            // Load all texture images and put into array
            IList textures = LoadTextures(quakeTextures);
            // Load lightMaps, create texture and put into array
            IList lightMaps = LoadLightMaps(quakeLightMaps);

            // create list from vertices
            VertexUnit     vertexUnit = new VertexUnit(VertexFormat.PositionTexture2, quakeVertices.Count);
            PositionStream pos        = (PositionStream)vertexUnit[typeof(PositionStream)];
            TextureStream  texStream  = (TextureStream)vertexUnit[typeof(TextureStream)];
            TextureStream  light      = (TextureStream)vertexUnit[typeof(TextureStream), 1];

            int i = 0;

            foreach (QuakeVertex v in quakeVertices)
            {
                pos[i]       = new Math.Vector3(v.Position[0], v.Position[2], -v.Position[1]);
                texStream[i] = new Math.Vector2(v.TextureCoord[0], v.TextureCoord[1]);
                light[i]     = new Math.Vector2(v.LightmapCoord[0], v.LightmapCoord[1]);
                i++;
            }

            // presort faces
            Array.Sort(((Array)quakeFaces));

            // create mesh
            int       oldLightMap = ((QuakeFace)quakeFaces[0]).LightmapID;
            int       oldTexture  = ((QuakeFace)quakeFaces[0]).TextureID;
            ArrayList indices     = new ArrayList();

            for (i = 0; i < quakeFaces.Count; ++i)
            {
                QuakeFace qf = (QuakeFace)quakeFaces[i];
                if (qf.Type == 1)
                {
                    if (qf.TextureID != oldTexture || qf.LightmapID != oldLightMap)
                    {
                        mesh.SubSets.Add(new SubSet(vertexUnit, IndexStream.Create(indices, vertexUnit.Size)));
                        Textures texs = new Textures("color", (ITexture)textures[oldTexture]);
                        if (oldLightMap == -1)
                        {
                            texs["lightMap"] = null;
                        }
                        else
                        {
                            texs["lightMap"] = (ITexture)lightMaps[oldLightMap];
                        }
                        mesh.Textures.Add(texs);
                        indices.Clear();
                    }

                    // add indices => convert from fan to list
                    for (int j = 2; j < qf.NumOfVerts; j++)
                    {
                        indices.Add(qf.VertexIndex);
                        indices.Add(qf.VertexIndex + j - 1);
                        indices.Add(qf.VertexIndex + j);
                    }

                    oldTexture  = qf.TextureID;
                    oldLightMap = qf.LightmapID;
                }
            }
            return(mesh);
        }
Beispiel #18
0
        public Math.Vector2[] CalculatePath(Math.Vector2 start, Math.Vector2 end)
        {
            /*// convert the coordinates into local map coordinates
             * int goalx = (int)((start.X - _offset.X) / _scaledSize.X * _width);
             * int goaly = (int)((start.Y - _offset.Y) / _scaledSize.Y * _height);
             */

            int goalx = (int)start.X;
            int goaly = (int)start.Y;

            if (goalx < 0 || goaly < 0 ||
                goalx >= _width || goaly >= _height)
            {
                return(null);
            }

            /*
             * int startx = (int)((end.X - _offset.X) / _scaledSize.X * _width);
             * int starty = (int)((end.Y - _offset.Y) / _scaledSize.Y * _height);
             */
            int startx = (int)end.X;
            int starty = (int)end.Y;

            if (startx < 0 || starty < 0 ||
                startx >= _width || starty >= _height)
            {
                return(null);
            }

            _whichListCounter += 2;

            PriorityQueue <MapNode> open = new PriorityQueue <MapNode>();

            addToOpen(new MapNode(this, startx, starty), open);
            _parents[starty * _width + startx] = 0;

            while (true)
            {
                MapNode lowest = removeFirstFromOpen(open);
                addToClosed(lowest);

                if (lowest.X == goalx && lowest.Y == goaly)
                {
                    // we just found the path!
                    return(generatePath(goalx, goaly));
                }

                // check north
                check(lowest.X, lowest.Y, lowest.X, lowest.Y - 1, goalx, goaly, open);

                // check south
                check(lowest.X, lowest.Y, lowest.X, lowest.Y + 1, goalx, goaly, open);

                // check east
                check(lowest.X, lowest.Y, lowest.X + 1, lowest.Y, goalx, goaly, open);

                // check west
                check(lowest.X, lowest.Y, lowest.X - 1, lowest.Y, goalx, goaly, open);

                if (open.Count == 0)
                {
                    // we failed to find a path!
                    return(null);
                }
            }
        }
Beispiel #19
0
 [CompositeConstruct] public Float2x2(Math.Vector2 a, Math.Vector2 b)
 {
     this.Column0 = a; this.Column1 = b;
 }
Beispiel #20
0
 /// <summary>
 /// Converts a Vector into DxVector.
 /// </summary>
 /// <param name="vector">The Vector.</param>
 /// <returns>DxVector</returns>
 public static Vector2 ConvertVector(Math.Vector2 vector)
 {
     return(new Vector2(vector.X, vector.Y));
 }
Beispiel #21
0
 public static SharpDX.Vector2 ToSharpDXVector(this Math.Vector2 vector)
 {
     return(new SharpDX.Vector2(vector.X, vector.Y));
 }
Beispiel #22
0
        public static void Load()
        {
            Resource.TextResource faces = new Resource.TextResource("faces.txt", FileSystem.Open("faces.txt"));

            string[] lines = faces.Text.Split('\n');

            FaceDefinition currentDefinition = null;

            for (int i = 0; i < lines.Length; i++)
            {
                if (lines[i].StartsWith("["))
                {
                    // read the header
                    int    ending = lines[i].IndexOf(']');
                    string name   = lines[i].Substring(1, ending - 1);

                    if (name.Equals("DEFAULT", StringComparison.OrdinalIgnoreCase))
                    {
                        currentDefinition      = new FaceDefinition();
                        currentDefinition.Name = name;
                        _default = currentDefinition;
                    }
                    else if (name.Equals("EYES", StringComparison.OrdinalIgnoreCase))
                    {
                        // skip the eyes section for now
                        while (true)
                        {
                            i++;
                            if (lines[i].StartsWith("["))
                            {
                                i--;
                                break;
                            }
                        }
                    }
                    else
                    {
                        currentDefinition          = (FaceDefinition)_default.Clone();
                        currentDefinition.Name     = name;
                        currentDefinition.FaceName = name + "_face";
                        _faces.Add(currentDefinition.Name, currentDefinition);
                    }
                }
                else if (lines[i].StartsWith("//") == false)
                {
                    int equals = lines[i].IndexOf('=');
                    if (equals < 0)
                    {
                        continue;
                    }

                    string attributeName = lines[i].Substring(0, equals).Trim();
                    string data          = lines[i].Substring(equals + 1);

                    // remove any trailing comments from data
                    int indexOfComment = data.IndexOf("//");
                    if (indexOfComment >= 0)
                    {
                        data = data.Substring(0, indexOfComment);
                    }

                    data = data.Trim();

                    float        fValue  = 0;
                    Math.Vector3 v3Value = Math.Vector3.Zero;
                    Math.Vector2 v2Value = Math.Vector2.Zero;

                    // parse as float
                    float.TryParse(data, out fValue);

                    // parse as vector
                    int firstComma      = data.IndexOf(',');
                    int secondComma     = data.IndexOf(',', firstComma + 1);
                    int firstX          = data.IndexOf('x');
                    int trailingComment = data.IndexOf('/');

                    // ignore anything after the //
                    if (trailingComment >= 0)
                    {
                        if (trailingComment < firstComma)
                        {
                            firstComma = -1;
                        }
                        if (trailingComment < secondComma)
                        {
                            secondComma = -1;
                        }
                        if (trailingComment < firstX)
                        {
                            firstX = -1;
                        }
                    }

                    if (firstComma >= 0 && (firstX < 0 || firstComma < firstX))
                    {
                        Utils.TryParseFloat(data, 0, firstComma, out v3Value.X);

                        if (secondComma >= 0)
                        {
                            Utils.TryParseFloat(data, firstComma + 1, secondComma - firstComma - 1, out v3Value.Y);

                            if (trailingComment >= 0)
                            {
                                Utils.TryParseFloat(data, secondComma + 1, trailingComment - secondComma - 1, out v3Value.Z);
                            }
                            else
                            {
                                Utils.TryParseFloat(data, secondComma + 1, out v3Value.Z);
                            }
                        }
                        else
                        {
                            if (trailingComment >= 0)
                            {
                                Utils.TryParseFloat(data, firstComma + 1, trailingComment - firstComma - 1, out v3Value.Y);
                            }
                            else
                            {
                                Utils.TryParseFloat(data, firstComma + 1, out v3Value.Y);
                            }
                        }
                    }
                    else if (firstX >= 0)
                    {
                        // some fields look like "NUMBERxNUMBER"
                        Utils.TryParseFloat(data, 0, firstX, out v3Value.X);

                        if (trailingComment >= 0)
                        {
                            Utils.TryParseFloat(data, firstX + 1, trailingComment - firstX - 1, out v3Value.Y);
                        }
                        else
                        {
                            Utils.TryParseFloat(data, firstX + 1, out v3Value.Y);
                        }
                    }
                    v2Value.X = v3Value.X;
                    v2Value.Y = v3Value.Y;


                    if (attributeName.Equals("Face Name", StringComparison.OrdinalIgnoreCase))
                    {
                        currentDefinition.FaceName = data;
                    }
                    // eye stuff
                    else if (attributeName.Equals("Left Eye Name", StringComparison.OrdinalIgnoreCase))
                    {
                        currentDefinition.LeftEyeName = data;
                    }
                    else if (attributeName.Equals("Right Eye Name", StringComparison.OrdinalIgnoreCase))
                    {
                        currentDefinition.RightEyeName = data;
                    }
                    else if (attributeName.Equals("Left Eye Offset", StringComparison.OrdinalIgnoreCase))
                    {
                        currentDefinition.LeftEyeOffset = v2Value;
                    }
                    else if (attributeName.Equals("Right Eye Offset", StringComparison.OrdinalIgnoreCase))
                    {
                        currentDefinition.RightEyeOffset = v2Value;
                    }
                    else if (attributeName.Equals("Left Eye Bias", StringComparison.OrdinalIgnoreCase))
                    {
                        currentDefinition.LeftEyeBias = v2Value;
                    }
                    else if (attributeName.Equals("Right Eye Bias", StringComparison.OrdinalIgnoreCase))
                    {
                        currentDefinition.RightEyeBias = v2Value;
                    }
                    else if (attributeName.Equals("Max Look Distance", StringComparison.OrdinalIgnoreCase))
                    {
                        currentDefinition.MaxLookDistance = v2Value;
                    }
                    else if (attributeName.Equals("Jitter Frequency", StringComparison.OrdinalIgnoreCase))
                    {
                        currentDefinition.JitterFrequency = v2Value;
                    }
                    else if (attributeName.Equals("Max Jitter Distance", StringComparison.OrdinalIgnoreCase))
                    {
                        currentDefinition.MaxJitterDistance = v2Value;
                    }

                    // 3D eye stuff
                    else if (attributeName.Equals("Eye Field Of View", StringComparison.OrdinalIgnoreCase))
                    {
                        currentDefinition.EyeFieldOfView = v2Value;
                    }
                    else if (attributeName.Equals("Eye Short Field Of View", StringComparison.OrdinalIgnoreCase))
                    {
                        currentDefinition.EyeShortFieldOfView = v2Value;
                    }
                    else if (attributeName.Equals("Eye Separation", StringComparison.OrdinalIgnoreCase))
                    {
                        currentDefinition.EyeSeparation = fValue;
                    }
                    else if (attributeName.Equals("Head Radius", StringComparison.OrdinalIgnoreCase))
                    {
                        currentDefinition.HeadRadius = fValue;
                    }
                    else if (attributeName.Equals("Head Center Offset", StringComparison.OrdinalIgnoreCase))
                    {
                        currentDefinition.HeadCenterOffset = v3Value;
                    }
                    else if (attributeName.Equals("Blink Frequency", StringComparison.OrdinalIgnoreCase))
                    {
                        currentDefinition.BlinkFrequency = v2Value;
                    }

                    // mouth stuff
                    else if (attributeName.Equals("Mouth Offset", StringComparison.OrdinalIgnoreCase))
                    {
                        currentDefinition.MouthOffset = v2Value;
                    }
                    else if (attributeName.Equals("Mouth Size", StringComparison.OrdinalIgnoreCase))
                    {
                        currentDefinition.MouthSize = v2Value;
                    }
                }
            }
        }