Esempio n. 1
0
 public CharacterData(float startTime, float targetAnimationTime, int targetOrder, VertexPos vertPos)
 {
     progress           = 0.0f;
     startingTime       = startTime;
     totalAnimationTime = (startingTime + targetAnimationTime) - startTime;
     order     = targetOrder;
     vertexPos = vertPos;
     charType  = CharacterType.CHARACTER;
 }
        private static IExplicitModel BuildWallModel4(List <BuildingWallSegment> wallSegments)
        {
            var vertices = new VertexPos[wallSegments.Count * 2];

            for (int i = 0; i < wallSegments.Count; i++)
            {
                var segment      = wallSegments[i].Basement;
                var vertexOffset = i * 2;
                vertices[vertexOffset + 0] = new VertexPos(segment.Point1);
                vertices[vertexOffset + 1] = new VertexPos(segment.Point2);
            }
            return(ExplicitModel.FromVertices(vertices, null, ExplicitModelPrimitiveTopology.LineList));
        }
Esempio n. 3
0
        void AddChar(char _char, int characterPosition)
        {
            CharacterInfo ch;

            font.GetCharacterInfo(_char, out ch, internalFontSize);

            if (_char == '\n')
            {
                charData[characterPosition] = new CharacterData(delay * characterPosition, duration, characterPosition, new VertexPos(Vector3.zero, Vector3.zero, Vector3.zero, Vector3.zero))
                {
                    charType = CharacterData.CharacterType.NEWLINE
                };
                NewLine();
            }
            else
            {
                Vector3   pos1   = (caretPos + new Vector3(ch.minX, ch.maxY, 0)) * internalScale;
                Vector3   pos2   = (caretPos + new Vector3(ch.maxX, ch.maxY, 0)) * internalScale;
                Vector3   pos3   = (caretPos + new Vector3(ch.maxX, ch.minY, 0)) * internalScale;
                Vector3   pos4   = (caretPos + new Vector3(ch.minX, ch.minY, 0)) * internalScale;
                VertexPos vecPos = new VertexPos(pos1, pos2, pos3, pos4);
                charData[characterPosition] = new CharacterData(delay * characterPosition, duration, characterPosition, vecPos);
                int charPos = 4 * characterPosition;
                int triPos  = 6 * characterPosition;
                SetVertices(charData[characterPosition]);

                colors[charPos]                 =
                    colors[charPos + 1]         =
                        colors[charPos + 2]     =
                            colors[charPos + 3] = internalColor;

                uv[charPos]     = ch.uvTopLeft;
                uv[charPos + 1] = ch.uvTopRight;
                uv[charPos + 2] = ch.uvBottomRight;
                uv[charPos + 3] = ch.uvBottomLeft;

                triangles[triPos]     = charPos;
                triangles[triPos + 1] = charPos + 1;
                triangles[triPos + 2] = charPos + 2;

                triangles[triPos + 3] = charPos;
                triangles[triPos + 4] = charPos + 2;
                triangles[triPos + 5] = charPos + 3;
            }
            lineLengths[caretLine] += ch.advance;
            caretPos += (Vector3.right * ch.advance);
        }
 public VertexPos(int index) : base(dataSize, index)
 {
     inst = this;
 }