예제 #1
0
        public ObjRenderData IntersectionGetRenderData1()
        {
            var obj = new ObjRenderData();

            obj.AddLine(_uv1);
            return(obj);
        }
예제 #2
0
        protected ObjRenderData GetControlGrid(List <List <Vector3> > verts)
        {
            var data = new ObjRenderData();

            data.Vertices = verts.SelectMany(x => x).ToList();

            var count = 0;

            for (int h = 0; h < verts.Count; h++)
            {
                var row = verts[h];
                for (int w = 0; w < row.Count - 1; w++)
                {
                    var idx = count + w;
                    data.Edges.Add(new Edge(idx, idx + 1));
                }
                count += row.Count;
            }

            count = 0;
            for (int h = 0; h < verts.Count - 1; h++)
            {
                var row = verts[h];
                for (int w = 0; w < row.Count; w++)
                {
                    var idx = count + w;
                    data.Edges.Add(new Edge(idx, idx + row.Count));
                }
                count += row.Count;
            }

            return(data);
        }
예제 #3
0
        public ObjRenderData GetRenderData()
        {
            var obj = new ObjRenderData();

            obj.AddLine(Verts);
            return(obj);
        }
예제 #4
0
        private ObjRenderData GetGridForPatch(List <List <Vector3> > verts, int pIdxH, int pIdxW)
        {
            var data = new ObjRenderData();

            var dh = DrawHeightCount;
            var pw = WidthPatchCount;

            for (int h = 0; h < dh; h++)
            {
                var tu = 1f * h / (dh - 1);

                for (int w = 0; w < pw; w++)
                {
                    data.AddLine(GetWidthSegmentPrimitive(verts, pIdxH * 3, pIdxW * 3, tu));
                }
            }

            var dw = DrawWidthCount;
            var ph = HeightPatchCount;

            for (int w = 0; w < dw; w++)
            {
                var tv = 1f * w / (dw - 1);

                for (int h = 0; h < ph; h++)
                {
                    data.AddLine(GetHeightSegmentPrimitive(verts, pIdxW * 3, pIdxH * 3, tv));
                }
            }

            return(data);
        }
예제 #5
0
 public void Add(ObjRenderData data)
 {
     if (data != null)
     {
         Add(data.Vertices, data.Edges);
     }
 }
예제 #6
0
        public ObjRenderData GetRenderData()
        {
            var verts = GetVerts();
            var data  = new ObjRenderData();

            //polygon
            if (ShowPolygon && verts.Count > 1)
            {
                data.Vertices.AddRange(verts);
                data.Edges.AddRange(Enumerable.Range(0, verts.Count - 1).Select(x => new Edge(x, x + 1)).ToList());
            }

            //curve
            int i;

            for (i = 0; i + 3 < verts.Count; i += 3)
            {
                data.Vertices.AddRange(GetSegment(verts, i, 4));
            }

            var left = verts.Count - i;

            data.Vertices.AddRange(GetSegment(verts, i, left));

            return(data);
        }
예제 #7
0
        public ObjRenderData GetRenderData()
        {
            var renderData = new ObjRenderData();

            renderData.Vertices = GetVertices();
            renderData.Edges    = GetEdges();

            return(renderData);
        }
예제 #8
0
        private void RenderIntersect(ObjRenderData data, int num)
        {
            foreach (var edge in data.Edges)
            {
                var vertA = data.Vertices[edge.IdxA].ToVector4();
                var vertB = data.Vertices[edge.IdxB].ToVector4();

                DrawIntersectionLine(vertA, vertB, num);
            }
        }
예제 #9
0
        public ObjRenderData GetRenderData()
        {
            if (_dataChanged)
            {
                _renderData          = new ObjRenderData();
                _renderData.Vertices = GetVertices();
                _renderData.Edges    = GetEdges();
            }

            return(_renderData);
        }
예제 #10
0
        public ObjRenderData GetRenderData()
        {
            var verts = GetVerts();

            var data = new ObjRenderData();

            if (ShowControlGrid)
            {
                data.Add(GetControlGrid(verts));
            }
            if (ShowGrid)
            {
                data.Add(GetGrid(verts));
            }

            return(data);
        }
예제 #11
0
        protected ObjRenderData GetGrid(List <List <Vector3> > verts)
        {
            var data = new ObjRenderData();

            var H = HeightPatchCount;
            var W = WidthPatchCount;

            for (int h = 0; h < H; h++)
            {
                for (int w = 0; w < W; w++)
                {
                    data.Add(GetGridForPatch(verts, h, w));
                }
            }

            return(data);
        }
예제 #12
0
        protected ObjRenderData GetGrid(List <List <Vector3> > verts)
        {
            var data = new ObjRenderData();

            var dh = DrawHeightCount * HeightPatchCount;

            for (int h = 0; h < dh; h++)
            {
                var tu = 1f * h / (dh - 1);
                FillTmpW(verts, tu);
                data.AddLine(GetLine(_tmpW, _knotsW));
            }

            var dw = DrawWidthCount * WidthPatchCount;

            for (int w = 0; w < dw; w++)
            {
                var tv = 1f * w / (dw - 1);
                FillTmpH(verts, tv);
                data.AddLine(GetLine(_tmpH, _knotsH));
            }

            return(data);
        }