コード例 #1
0
    public VertexContext vertex()
    {
        VertexContext _localctx = new VertexContext(Context, State);

        EnterRule(_localctx, 8, RULE_vertex);
        try {
            EnterOuterAlt(_localctx, 1);
            {
                State = 48;
                Match(T__7);
                State = 49;
                Match(FLOAT);
                State = 50;
                Match(FLOAT);
                State = 51;
                Match(FLOAT);
            }
        }
        catch (RecognitionException re) {
            _localctx.exception = re;
            ErrorHandler.ReportError(this, re);
            ErrorHandler.Recover(this, re);
        }
        finally {
            ExitRule();
        }
        return(_localctx);
    }
コード例 #2
0
        Vector3[] GetVertices()
        {
            int numWallVertices = totalVertsPerCorner * outlines.Sum(outline => outline.Length);
            var vertices        = new Vector3[numWallVertices];
            var context         = new VertexContext(floorHeightMap, ceilingHeightMap, totalVertsPerCorner);

            int vertexIndex = 0;

            foreach (Vector3[] outline in outlines)
            {
                for (int i = 0; i < outline.Length; i++)
                {
                    Vector3 vertex             = outline[i];
                    Vector3 normal             = ComputeNormal(outline, i);
                    float   x                  = vertex.x;
                    float   z                  = vertex.z;
                    float   floorHeight        = floorHeightMap.GetHeight(x, z);
                    float   ceilingHeight      = ceilingHeightMap.GetHeight(x, z);
                    float   interpolationScale = 1 / (totalVertsPerCorner - 1f);

                    for (int j = 0; j < totalVertsPerCorner; j++)
                    {
                        float interpolation = j * interpolationScale;
                        vertex.y = Mathf.Lerp(ceilingHeight, floorHeight, interpolation);
                        vertex.y = interpolation * floorHeight + (1 - interpolation) * ceilingHeight;
                        context.Update(vertex, normal, j);
                        vertices[vertexIndex++] = wallModule.GetAdjustedCorner(context);
                    }
                }
            }
            return(vertices);
        }
コード例 #3
0
ファイル: Statistics.cs プロジェクト: omidm/naiad
            public Reporting(
                VertexContext <T> c, Stream <string, T> inlineStats,
                Stream <Pair <string, ReportingRecord <Int64> >, T> aggInt, Stream <Pair <string, ReportingRecord <double> >, T> aggDouble)
            {
                context = c;

                if (c.parent.parent.manager.Reporting.HasDomain)
                {
                    rootVertex = c.parent.parent.manager.Reporting.RootDomainVertex(c.Vertex.VertexId);
                }
                else
                {
                    rootVertex = null;
                }

                if (inlineStats == null)
                {
                    inlineStatistics = null;
                }
                else
                {
                    inlineStatistics = new VertexOutputBuffer <string, T>(c.Vertex);
                    inlineStats.StageOutput.Register(inlineStatistics);
                }

                if (aggInt == null)
                {
                    aggregateInt    = null;
                    aggregateDouble = null;
                }
                else
                {
                    aggregateInt = new VertexOutputBuffer <Pair <string, ReportingRecord <long> >, T>(c.Vertex);
                    aggInt.StageOutput.Register(aggregateInt);
                    aggregateDouble = new VertexOutputBuffer <Pair <string, ReportingRecord <double> >, T>(c.Vertex);
                    aggDouble.StageOutput.Register(aggregateDouble);
                }
            }