コード例 #1
0
        public void DrawLine(Engine_Point position, Engine_Point vector, Color color, Node Parent)
        {
            var linechild = Parent.CreateChild("Line");
            var cusLine   = linechild.CreateComponent <CustomGeometry>();

            cusLine.BeginGeometry(0, PrimitiveType.LineList);
            var mat = Material_Ext.noLitFromColor(color, true);

            // mat.FillMode = FillMode.FillWireframe;

            cusLine.SetMaterial(mat);
            cusLine.DefineVertex(vector.ToVec3());
            cusLine.DefineColor(color);
            cusLine.Commit();
            linechild.Position = position.ToVec3();
        }
コード例 #2
0
        void Reload()
        {
            if (geom != null && !geom.IsZoneDirty())
            {
                geom.Remove();
            }

            if (Node == null || Node.IsDirty())
            {
                return;
            }

            geom = Node.CreateComponent <CustomGeometry>();

            geom.BeginGeometry(0, PrimitiveType.LineList);

            geom.SetMaterial(Material_Ext.noLitFromColor(color, true));

            var halfSize = Size / 2;

            for (int i = -halfSize; i <= halfSize; i++)
            {
                if (i % 5 == 0)
                {
                    continue;
                }

                //x
                geom.DefineVertex(new Vector3(i, 0, -halfSize) * Scale);
                geom.DefineColor(Color);
                geom.DefineVertex(new Vector3(i, 0, halfSize) * Scale);
                geom.DefineColor(Color);

                //z
                geom.DefineVertex(new Vector3(-halfSize, 0, i) * Scale);
                geom.DefineColor(Color);
                geom.DefineVertex(new Vector3(halfSize, 0, i) * Scale);
                geom.DefineColor(Color);
            }

            geom.Commit();

            geom = Node.CreateComponent <CustomGeometry>();
            geom.BeginGeometry(0, PrimitiveType.LineList);

            geom.SetMaterial(0, Material_Ext.noLitFromColor(Color.White, true));

            for (int i = -halfSize; i <= halfSize; i++)
            {
                if (i % 5 != 0)
                {
                    continue;
                }

                //x
                geom.DefineVertex(new Vector3(i, 0, -halfSize) * Scale);
                geom.DefineColor(Color);
                geom.DefineVertex(new Vector3(i, 0, halfSize) * Scale);
                geom.DefineColor(Color);

                //z
                geom.DefineVertex(new Vector3(-halfSize, 0, i) * Scale);
                geom.DefineColor(Color);
                geom.DefineVertex(new Vector3(halfSize, 0, i) * Scale);
                geom.DefineColor(Color);
            }

            geom.Commit();
        }