找回密码
 立即注册
查看: 4589|回复: 83

[脚本] 空间画线工具 Vectrosity

[复制链接]
发表于 2013-1-25 02:11 | 显示全部楼层 |阅读模式
资源信息 Asset Information
资源名称: 空间画线工具 Vectrosity (发帖教程)
版本: 2.0 (版本)
资源等级: 1
资源格式: .unitypackage (链接失效请点击帖子右下方举报通知管理员)
资源大小: 3MB (默认:MB)
下载地址: 站内下载 (购买积分)
点击查看原图
美丽分割线

Vectrosity Release Notes
------------------------

Vectrosity 2.0

Changes:
    ?A big one: the Vector class is no more! Instead, it's merged with VectorLine. This allows for a better architecture, generally greater ease of use, some minor performance improvements, and it doesn't conflict with the Vector class in Flash. The downside is that it breaks pretty much all previous code that uses Vectrosity. So that's not exactly trivial. (And that's why this is version 2.0.) The upside is that converting code to the new system is pretty straightforward; see the Vectrosity Upgrade Guide. For example, Vector.DrawLine(myLine) just becomes myLine.Draw(). It took less than 10 minutes to convert all the demo scripts.
    ?DrawPoints is also gone, but don't panic: instead, Draw and Draw3D will draw both VectorPoints and VectorLine.
    ?Draw3DAuto also now works with both VectorPoints and VectorLine.
    ?VectorManager.ObjectSetup can use lines made with VectorPoints as well as VectorLine too.
    ?When using Joins.Fill, you no longer need to take into consideration whether the first and last points in the points array match, since that's handled automatically now. The first and last points can be made the same or different at any time, and it will always be drawn correctly.
    ?ZeroPoints (formerly ZeroPointsInLine) can use an end index in addition to a start index, so you can erase a range instead of always to the end of the points array.
    ?The LineMaker utility now has a button for loading previously-saved line files.
    ?The LineMaker utility will list the indices of any selected line segments, so you can use this info for things like setting certain colors for specific line segments in a vector object.

Additions:
    ?VectorLine.drawStart and VectorLine.drawEnd for drawing sections of a line. This is different than minDrawIndex and maxDrawIndex, which are optimizations for updating only part of a line when the rest of it stays the same. In comparison, using drawStart and drawEnd actually draws the specified range and erases the rest of the line, so it can be used for things like animating part of a line (see the PartialLine example scene).
    ?A VectorLine's joins can be changed at any time by using VectorLine.joins. i.e., myLine.joins = Joins.Fill. (Keeping in mind the limitations for joins...e.g., trying to set a discrete line to Joins.Fill won't do anything.)
    ?VectorLine.maxWeldDistance for preventing artifacts when using Joins.Weld. If line segments are nearly parallel, the intersection point for welds can extend too far, so maxWeldDistance prevents this by canceling the weld if that happens (for that line segment only). By default, maxWeldDistance is twice the thickness of the line as specified when the line is created.
    ?VectorLine.material for changing the material of a VectorLine at any time, instead of just when the line is created. i.e., myLine.material = newMaterial;
    ?VectorLine.AddNormals, which adds normals to the line mesh, in case you use a material that has a shader which needs normals. i.e., myLine.AddNormals();
    ?VectorLine.GetCamera, which returns the vector camera made with SetCamera. (SetCamera also returns this camera, but you can use GetCamera at any time.)
    ?The Vectrosity core scripts are provided as a .dll as well as source code. This can be more convenient to work with in some cases. To use it, copy Vectrosity.dll into your Unity project instead of importing the VectrosityCore package. (Note that the LineMaker utility is not part of the .dll, so you will still need to import the VectrosityCore package if you want to use that. If you're using the .dll, you can deselect everything except the LineMaker.js script when importing the VectrosityCore package.)

Fixes:
    ?minDrawIndex works correctly with continuous lines made with Vector3 points.
    ?Fixed MissingReferenceException error when stopping play mode in the editor when using ObjectSetup.
    ?Fixed case where Joins.Weld sometimes didn't weld first and last points in a loop if they were supposedly the same.

-----------

Vectrosity 1.5

Additions:
    ?Vector.MakeWireframeInLine, for making automatic wireframes from a mesh. Essentially the same as if you used the LineMaker utility on an object and clicked "Connect all points", except you can use it at runtime on arbitrary meshes. (Note: not animated meshes, sorry; that's impossible because the state of animated meshes can't be read in Unity.)
    ?Vector.DrawLineViewport, for drawing 2D lines with normalized viewport coordinates. This works like the coordinates for GUIText and GUITexture, where (0.0, 0.0) is the lower-left corner, and (1.0, 1.0) is the upper-right corner. This means lines drawn with DrawLineViewport will be in the same relative position regardless of screen resolution. e.g, using [Vector2(.5, .5), Vector2(1.0, .5)] will always result in a line that starts in the middle of the screen and ends at the right edge.
    ?Vector.GetLinePoint and Vector.GetLinePoint3D, for getting a position on a 2D or 3D line based on length. Can be used for things like making an object travel along a spline at a constant speed.
    ?Vector.GetLinePoint01 and Vector.GetLinePoint3D01: as above, but you can use a 0..1 percentage length instead of unit length. e.g., using 0.5 returns a point halfway along the line.
    ?Vector.GetLineLength, which returns the total length of a given line.
    ?Vector.SetLineDistances: use this if you've changed the position of any points in a VectorLine after using GetLineLength, GetLinePoint, etc. and want to use those functions again. For performance reasons this isn't done automatically.
    ?In addition to being used for GameObject and mesh names, the "name" property is now directly available for VectorLines. e.g., Debug.Log(myLine.name);. Changing the VectorLine name property will change the GameObject and mesh names appropriately.

Changes:
    ?Requires Unity 3.4.
    ?Vector.Active replaced with VectorLine.active, so it's more consistent with the way Unity works. e.g., myLine.active = false.
    ?Vector.SetColorsSmooth can now be used even if the line wasn't created with colors originally.
    ?Vector.SetWidths can use an int array now for the line widths (instead of only a float array).
    ?VectorLine.continuousLine is now VectorLine.continuous, since "continuousLine" was kind of redundant in context.

Fixes:
    ?Vector.DestroyLine works with VectorPoints again.
    ?Rotation and scale for objects used with the LineMaker utility is properly respected when generating lines.

-----------

Vectrosity 1.4.2

Changes:
    ?The default material that's used when passing in null for a line material works with transparency better.
    ?Vector.MakeTextInLine can use a Vector3 for the start position (for lines using Vector3 points).

Fixes:
    ?Joins.Weld works with DrawLine3D properly.
    ?MakeTextInLine works if it's used with an array that has the exact number number of points necessary for the text (which would happen if MakeTextInLine was called twice on the same VectorLine with the same text, for example).

-----------

Vectrosity 1.4

Additions:
    ?Joins.Weld, for welding vertices between line segments. This makes for better quality thick lines when used with textures, since Joins.Fill only looks good with solid-colored lines. Also, unlike Joins.Fill, discrete lines can use Joins.Weld--any line segments where the end point of one is equal to the start point of the next will be welded. Joins.Fill is faster, however.
    ?minDrawIndex and maxDrawIndex properties for VectorLines, so you can easily just update part of a line. This applies to Vector.SetColors as well as the various DrawLine and DrawPoints functions.
    ?Vector.DrawLine3DAuto, for making 3D lines automatically always be updated correctly regardless of camera movement. This way you don't need to always update lines with Vector.DrawLine3D yourself anymore...you can just call DrawLine3DAuto once and forget about it.
    ?Vector.StopDrawingLine3DAuto, in case you want the auto-update for DrawLine3DAuto to stop.
    ?Vector.MakeSplineInLine for making Catmull-Rom splines, so you can set up an arbitrary number of points, and the resultant curve will pass through those points.
    ?Vector.Active, so you can disable and re-enable lines without destroying and recreating them.
    ?Vector.DrawPoints3D, like DrawLine3D but for points.
    ?Vector.SetRay and Vector.SetRay3D for an equivalent of Debug.DrawRay that works in builds. e.g., "Vector.SetRay(Color.green, transform.position, transform.forward*5.0);" Naturally, SetRay draws a standard overlay line and SetRay3D draws a line in the scene.
    ?Vector.GetSegmentNumber tells you how many line segments are possible in a given VectorLine. (Just a small convenience function; saves you from having to remember points-1 for continuous lines and points/2 for discrete lines.)
    ?Some more example scripts and scenes in the VectrosityDemos package.

Changes:
    ?Vector.MakeCircleInLine and Vector.MakeEllipseInLine can optionally take an up vector now, so that circles/ellipses in 3D space can be oriented on any plane, instead of just the X/Y plane.
    ?Lowercase letters are included for use with Vector.MakeTextInLine, so you don't have to make your own.
    ?The segment cap length and line depth parameters have been removed when declaring VectorLines. In practice, these were usually left at the default, so including them in the declaration made things more complicated than necessary. If you need to specify these, you can set the line.capLength and line.depth properties instead, after the line is declared. If you're upgrading from an older version, this will probably cause some code breakage, but it's easy to fix, and makes declaring VectorLines nicer from now on.
    ?Vector.SetLayer has been removed. Use VectorLine.layer now if you need to set the layer, e.g. "myLine.layer = 16;".
    ?Vector.SetDepth only works for standard transforms now, not VectorLines. To set the depth of a line, use VectorLine.depth instead. e.g., "myLine.depth = 10;".
    ?Vector.DestroyLine and Vector.DestroyObject require "ref" to be used with VectorLines when used with C# now. e.g., "Vector.DestroyLine(ref myLine);"
    ?The BoundsMaker editor script is no more. The invisible bounds meshes it made are now created automatically as necessary. If you've made any bounds meshes, you can delete them since they're not used anymore. If you want a GameObject to use a standard mesh and not have it be replaced with a bounds mesh, add "false" to the end of the parameters when using ObjectSetup.
    ?It's no longer necessary to attach the VectorManager script to an object in the scene in order to use VectorManager functions. If you're upgrading from an older version and you have VectorManager attached to an object, you should remove it.
    ?Joins.Open is removed; use Joins.None instead...it was kind of silly having two enum values that did the same thing. Along the same lines, Visibility.NotControlled is removed (use Visibility.None) along with Brightness.Normal (use Brightness.None).
    ?Vector.SetColor and Vector.SetColors can now be used even if the line wasn't created with colors originally.
    ?VectorPoints can be made with Vector3 arrays now.
    ?MakeCircleInLine etc. work properly with points.
    ?DrawLine3D makes vectorLines use Vector.vectorLayer3D by default (and vectorLayer3D is 0 by default). This means mixing DrawLine with DrawLine3D will normally just work, and you don't need to mess with setting layers of lines manually. If you want VectorLines used with DrawLine3D to use another default layer besides 0, then do "Vector.vectorLayer3D = x", where x is the layer you want. You can still use VectorLine.layer to make any line render in any given layer.
    ?Vector.SetTextureScale can have a transform passed in now, so that it will work properly with lines that are drawn with a transform passed in.
    ?Vector.SetCamera returns the vector camera now, so if you're doing funky things with the vector camera, you can just do "var vectorCam = Vector.SetCamera();" instead of using GameObject.Find and so on.
    ?If a line has multiple widths, setting VectorLine.lineWidth causes all widths to have that value.
    ?SetLine and SetLine3D can optionally take a time value now, so they are drawn for the specified number of seconds and then destroyed. e.g., "Vector.SetLine(Color.red, 5.0, Vector3.zero, Vector3(5, 5, 5));" (Also works with DrawRay and DrawRay3D.)
    ?For the shorter forms of MakeCircleInLine, MakeEllipseInLine, MakeCurveInLine, and MakeSplineInLine, you can further leave off the number of segments, and it will use the entire existing points array in the line as appropriate.
    ?VectorManager.ObjectSetup can be used to add/remove the visibility and brightness scripts. e.g., "VectorManager.ObjectSetup (gameObject, line, Visibility.Dynamic, Brightness.None);" removes Brightness.Fog if it had been set previously.
    ?Removed VectorManager.DestroyObject since it's not needed anymore.

Fixes:
    ?Using Joins.Fill with DrawLine3D works correctly now (also Joins.Fill is more efficient in general).
    ?When using Vector.SetTextureScale with a 3D line, if SetCamera3D hasn't been set up yet, it will automatically be called instead of generating an error.
    ?Setting VectorLine.lineWidth works again (broken in Vectrosity 1.3).
    ?Fixed multiple line segment widths being drawn incorrectly in certain circumstances.
    ?Using SetTextureScale with lines that have multiple widths works correctly now.

-----------

Vectrosity 1.3

Additions:
    ?VectorLine.Resize for changing the number of segments that make up a line, instead of having to destroy and recreate it.
    ?Vector.MakeCharsInLine for making vector text.
    ?Vector.SetWidths for setting the pixel width of each line segment in a VectorLine. Pass in an array of floats, one entry for each line segment.
    ?VectorLine.smoothWidth for whether or not line segment widths should be interpolated between segments.

Changes:
    ?Vector.SetTextureScale and Vector.ResetTextureScale work for 3D lines as well as 2D lines.
    ?Some miscellaneous minor speedups; line drawing is 2-5% faster depending on the function.
    ?VectorLine.vertexColors changed to VectorLine.lineColors, to make it consistent with lineVertices and lineUVs.
    ?Improved documentation.
    ?Simpler handling for 3D vector objects using VectorManager functions, thanks to OnDestroy in Unity 3.2.

Fixes:
    ?VisibilityControlStatic accounts for rotated objects now.

-----------

Vectrosity 1.2

Additions:
    ?Vector.SetColorsSmooth for making line segment colors be interpolated between segments.
    ?Vector.SetLine and Vector.SetLine3D for making basic lines as simply as possible.
    ?A VectorPoints class, for using Vector.DrawPoints without the hacks that were required previously.
    ?A new example script in the VectrosityDemos package: DrawLinesTouch, for touchscreen line-drawing.

Changes:
    ?Passing in "null" for the line material will use a default material, which works properly with vertex colors and the line depth parameter. Useful if you just need a standard line material without any textures.
    ?Vector.SetCamera is optional now. It will be called for you when necessary, as long as your camera is tagged "Main Camera".  (If not, you can still call it manually.)
    ?Vector.MakeCurveInLine, Vector.MakeRectInLine, and Vector.MakeCircleInLine/MakeEllipseInLine work for 3D lines as well as 2D lines.
    ?Vector.SetCamera has an additional parameter, useOrtho (default is false), which makes the vector camera be orthographic. This can make lines render slightly more accurately, but may cause anomalies with 3D lines in certain cases.
    ?Dynamic typing removed from DrawCurve.js in the VectrosityDemos package, so it will build on mobile devices.

-----------

Vectrosity 1.1

Additions:
    ?Vector.MakeCircleInLine and Vector.MakeEllipseInLine.
    ?Vector.MakeCurveinLine for bezier curves.
    ?Vector.SetTextureScale for setting a uniform texture scale, useful for dotted/dashed/etc. lines.
    ?Vector.ResetTextureScale in case you want to reset the line UVs back to normal after using SetTextureScale.
    ?Vector.DrawLine3D for drawing 3D vector lines in 3D space, where they can be occluded by 3D objects.
    ?Vector.SetCamera3D for setting up the camera exclusively for 3D lines. In this case the standard vector camera is not used.
    ?Vector.SetLayer for setting the layer of 3D lines, in case you're using SetCamera instead of SetCamera3D because you want to mix normal lines with 3D lines.
    ?Vector.SetVectorCamDepth for setting the depth of the vector camera (surprise!).  Rather than setting Vector.cam.depth, since Vector.cam is now private.
    ?VectorManager.useDrawLine3D variable for telling VectorManager whether it should use DrawLine3D or not.
    ?VectorManager.DestroyObject for destroying 3D vectorline objects.
    ?Some new example scripts in the VectrosityDemos package.

Changes:
    ?Removed LineType parameter from MakeRectInLine. Instead, the line type is picked up automatically from the line that's passed in; there doesn't seem to be a reason to specify it manually.
    ?LineMaker now forces strings to use periods for decimals, which fixes problems some European users were having. If this behavior isn't desired for some reason, remove the first line of the Initialize function in the LineMaker script (the line that has the CurrentCulture stuff in it).
    ?Additional overloads for defining 2D VectorLines: the default end cap width is 0.0, so if you're not using it, you can do things like "VectorLine("Name", linePoints, material, width)" without having to put 0.0 for the end cap in there.
    ?This is more of an internal thing, but in case anyone was using these: VectorLine.use2Dlines is gone (check whether points2 is not null instead), and VectorLine.points is now VectorLine.points3 (just because it's a less confusing name, since it's a Vector3 array, and points2 is a Vector2 array).

-----------

Vectrosity 1.0

Initial release.

本帖子中包含更多资源

您需要 登录 才可以下载或查看,没有账号?立即注册

×
发表于 2013-1-25 09:17 | 显示全部楼层
怎么下不来啊?{:5_404:}
发表于 2013-1-25 17:10 | 显示全部楼层
沙发 谢谢分享  好东东啊 啊  {:5_424:}{:5_424:}{:5_427:}{:5_427:}
发表于 2013-1-27 11:37 | 显示全部楼层
这个必须定哦 好东西
发表于 2013-1-29 17:12 | 显示全部楼层
{:5_427:} 好东西要大家分享
发表于 2013-1-30 00:18 | 显示全部楼层
多谢楼主分享,好东西一定要顶一下!
发表于 2013-3-3 03:21 | 显示全部楼层
看看好用不
发表于 2013-3-3 03:22 | 显示全部楼层

这个帖子不错,大家快来顶起来!
发表于 2013-3-24 14:52 | 显示全部楼层
哈哈 终于找到新版的啦 谢谢
发表于 2013-3-24 14:53 | 显示全部楼层
感谢感谢 新版的很好用
懒得打字嘛,点击右侧快捷回复 【右侧内容,后台自定义】
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

小黑屋|手机版|Unity开发者联盟 ( 粤ICP备20003399号 )

GMT+8, 2024-12-22 14:53 , Processed in 0.106721 second(s), 32 queries .

Powered by Discuz! X3.5 Licensed

© 2001-2024 Discuz! Team.

快速回复 返回顶部 返回列表