first commit

This commit is contained in:
Chris
2025-03-12 14:22:16 -04:00
commit 0ad0c01249
1999 changed files with 189708 additions and 0 deletions

View File

@@ -0,0 +1,87 @@
{
"name": "ALINE",
"rootNamespace": "",
"references": [
"GUID:2bafac87e7f4b9b418d9448d219b01ab",
"GUID:2665a8d13d1b3f18800f46e256720795",
"GUID:d8b63aba1907145bea998dd612889d6b",
"GUID:e0cd26848372d4e5c891c569017e11f1",
"GUID:15fc0a57446b3144c949da3e2b9737a9",
"GUID:457756d89b35d2941b3e7b37b4ece6f1",
"GUID:df380645f10b7bc4b97d4f5eb6303d95"
],
"includePlatforms": [],
"excludePlatforms": [],
"allowUnsafeCode": true,
"overrideReferences": true,
"precompiledReferences": [],
"autoReferenced": true,
"defineConstraints": [
"MODULE_BURST",
"MODULE_MATHEMATICS",
"MODULE_COLLECTIONS"
],
"versionDefines": [
{
"name": "com.unity.burst",
"expression": "1.2.1-preview",
"define": "MODULE_BURST"
},
{
"name": "com.unity.mathematics",
"expression": "1.1.0",
"define": "MODULE_MATHEMATICS"
},
{
"name": "com.unity.collections",
"expression": "0.4.0-preview",
"define": "MODULE_COLLECTIONS"
},
{
"name": "com.unity.collections",
"expression": "0.6.0-preview",
"define": "MODULE_COLLECTIONS_0_6_0_OR_NEWER"
},
{
"name": "com.unity.collections",
"expression": "0.8.0-preview",
"define": "MODULE_COLLECTIONS_0_8_0_OR_NEWER"
},
{
"name": "com.unity.render-pipelines.universal",
"expression": "0.0.0",
"define": "MODULE_RENDER_PIPELINES_UNIVERSAL"
},
{
"name": "com.unity.render-pipelines.high-definition",
"expression": "0.0.0",
"define": "MODULE_RENDER_PIPELINES_HIGH_DEFINITION"
},
{
"name": "com.unity.render-pipelines.high-definition",
"expression": "9.0",
"define": "MODULE_RENDER_PIPELINES_HIGH_DEFINITION_9_0_0_OR_NEWER"
},
{
"name": "com.unity.render-pipelines.high-definition",
"expression": "16.0",
"define": "MODULE_RENDER_PIPELINES_HIGH_DEFINITION_16_0_0_OR_NEWER"
},
{
"name": "com.unity.collections",
"expression": "0.12.0-preview",
"define": "MODULE_COLLECTIONS_0_12_0_OR_NEWER"
},
{
"name": "com.unity.render-pipelines.universal",
"expression": "15.0.7",
"define": "MODULE_RENDER_PIPELINES_UNIVERSAL_15_0_7_OR_NEWER"
},
{
"name": "com.unity.render-pipelines.universal",
"expression": "17.0.0",
"define": "MODULE_RENDER_PIPELINES_UNIVERSAL_17_0_0_OR_NEWER"
}
],
"noEngineReferences": false
}

View File

@@ -0,0 +1,14 @@
fileFormatVersion: 2
guid: de4e6084e6d474788bb8c799d6b461ec
AssemblyDefinitionImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
AssetOrigin:
serializedVersion: 1
productId: 162772
packageName: ALINE
packageVersion: 1.7.6
assetPath: Packages/com.arongranberg.aline/ALINE.asmdef
uploadId: 700292

View File

@@ -0,0 +1,49 @@
#if MODULE_RENDER_PIPELINES_HIGH_DEFINITION
using UnityEngine;
using UnityEngine.Rendering.HighDefinition;
using UnityEngine.Rendering;
using UnityEngine.Experimental.Rendering;
namespace Drawing {
/// <summary>Custom High Definition Render Pipeline Render Pass for ALINE</summary>
class AlineHDRPCustomPass : CustomPass {
#if MODULE_RENDER_PIPELINES_HIGH_DEFINITION_9_0_0_OR_NEWER
bool disabledDepth = false;
protected override void Setup (ScriptableRenderContext renderContext, CommandBuffer cmd) {
this.targetColorBuffer = TargetBuffer.Camera;
this.targetDepthBuffer = TargetBuffer.Camera;
disabledDepth = false;
}
protected override void Execute (CustomPassContext context) {
UnityEngine.Profiling.Profiler.BeginSample("ALINE");
if (!disabledDepth && context.cameraColorBuffer.isMSAAEnabled != context.cameraDepthBuffer.isMSAAEnabled) {
Debug.LogWarning("ALINE: Cannot draw depth-tested gizmos due to limitations in Unity's high-definition render pipeline combined with MSAA. Typically this is caused by enabling Camera -> Frame Setting Overrides -> MSAA Within Forward.\n\nDepth-testing for gizmos will stay disabled until you disable this type of MSAA and recompile scripts.");
// At this point, we only get access to the MSAA depth buffer, not the resolved non-MSAA depth buffer.
// If we try to use the depth buffer, we will get an error message from Unity:
// "Color and Depth buffer MSAA flags doesn't match, no rendering will occur."
// Rendering seems to somewhat work even though that error is logged, but there are a lot of rendering artifacts.
// So we will just disable depth testing.
//
// In the HDRenderPipeline.RenderGraph.cs script, the resolved non-msaa depth buffer is accessible, and this is the one
// that Unity's own gizmos rendering code uses. However, Unity does not expose this buffer to custom render passes.
disabledDepth = true;
this.targetDepthBuffer = TargetBuffer.None;
}
DrawingManager.instance.SubmitFrame(context.hdCamera.camera, new DrawingData.CommandBufferWrapper { cmd = context.cmd }, true);
UnityEngine.Profiling.Profiler.EndSample();
}
#else
protected override void Execute (ScriptableRenderContext context, CommandBuffer cmd, HDCamera camera, CullingResults cullingResult) {
UnityEngine.Profiling.Profiler.BeginSample("ALINE");
DrawingManager.instance.SubmitFrame(camera.camera, new DrawingData.CommandBufferWrapper { cmd = cmd }, true);
UnityEngine.Profiling.Profiler.EndSample();
}
#endif
protected override void Cleanup () {
}
}
}
#endif

View File

@@ -0,0 +1,18 @@
fileFormatVersion: 2
guid: 87f13550b86e77241bf777114486cbd8
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
AssetOrigin:
serializedVersion: 1
productId: 162772
packageName: ALINE
packageVersion: 1.7.6
assetPath: Packages/com.arongranberg.aline/AlineHDRPCustomPass.cs
uploadId: 700292

View File

@@ -0,0 +1,88 @@
#if MODULE_RENDER_PIPELINES_UNIVERSAL
using UnityEngine;
using UnityEngine.Rendering;
#if MODULE_RENDER_PIPELINES_UNIVERSAL_17_0_0_OR_NEWER
using UnityEngine.Rendering.RenderGraphModule;
#endif
using UnityEngine.Rendering.Universal;
namespace Drawing {
/// <summary>Custom Universal Render Pipeline Render Pass for ALINE</summary>
public class AlineURPRenderPassFeature : ScriptableRendererFeature {
/// <summary>Custom Universal Render Pipeline Render Pass for ALINE</summary>
public class AlineURPRenderPass : ScriptableRenderPass {
/// <summary>This method is called before executing the render pass</summary>
#if MODULE_RENDER_PIPELINES_UNIVERSAL_17_0_0_OR_NEWER
[System.Obsolete]
#endif
public override void Configure (CommandBuffer cmd, RenderTextureDescriptor cameraTextureDescriptor) {
}
#if MODULE_RENDER_PIPELINES_UNIVERSAL_17_0_0_OR_NEWER
[System.Obsolete]
#endif
public override void Execute (ScriptableRenderContext context, ref RenderingData renderingData) {
DrawingManager.instance.ExecuteCustomRenderPass(context, renderingData.cameraData.camera);
}
public AlineURPRenderPass() : base() {
profilingSampler = new ProfilingSampler("ALINE");
}
#if MODULE_RENDER_PIPELINES_UNIVERSAL_17_0_0_OR_NEWER
private class PassData {
public Camera camera;
}
public override void RecordRenderGraph (RenderGraph renderGraph, ContextContainer frameData) {
var cameraData = frameData.Get<UniversalCameraData>();
var resourceData = frameData.Get<UniversalResourceData>();
using (IRasterRenderGraphBuilder builder = renderGraph.AddRasterRenderPass<PassData>("ALINE", out PassData passData, profilingSampler)) {
bool allowDisablingWireframe = false;
if (Application.isEditor && (cameraData.cameraType & (CameraType.SceneView | CameraType.Preview)) != 0) {
// We need this to be able to disable wireframe rendering in the scene view
builder.AllowGlobalStateModification(true);
allowDisablingWireframe = true;
}
builder.SetRenderAttachment(resourceData.activeColorTexture, 0);
builder.SetRenderAttachmentDepth(resourceData.activeDepthTexture);
passData.camera = cameraData.camera;
builder.SetRenderFunc<PassData>(
(PassData data, RasterGraphContext context) => {
DrawingManager.instance.ExecuteCustomRenderGraphPass(new DrawingData.CommandBufferWrapper { cmd2 = context.cmd, allowDisablingWireframe = allowDisablingWireframe }, data.camera);
}
);
}
}
#endif
public override void FrameCleanup (CommandBuffer cmd) {
}
}
AlineURPRenderPass m_ScriptablePass;
public override void Create () {
m_ScriptablePass = new AlineURPRenderPass();
// Configures where the render pass should be injected.
// URP's post processing actually happens in BeforeRenderingPostProcessing, not after BeforeRenderingPostProcessing as one would expect.
// Use BeforeRenderingPostProcessing-1 to ensure this pass gets executed before post processing effects.
m_ScriptablePass.renderPassEvent = RenderPassEvent.BeforeRenderingPostProcessing-1;
}
/// <summary>This method is called when setting up the renderer once per-camera</summary>
public override void AddRenderPasses (ScriptableRenderer renderer, ref RenderingData renderingData) {
AddRenderPasses(renderer);
}
public void AddRenderPasses (ScriptableRenderer renderer) {
renderer.EnqueuePass(m_ScriptablePass);
}
}
}
#endif

View File

@@ -0,0 +1,18 @@
fileFormatVersion: 2
guid: 241f64a005256f7e091422226bb805c6
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
AssetOrigin:
serializedVersion: 1
productId: 162772
packageName: ALINE
packageVersion: 1.7.6
assetPath: Packages/com.arongranberg.aline/AlineURPRenderPassFeature.cs
uploadId: 700292

View File

@@ -0,0 +1,290 @@
## 1.7.6 (2024-10-14)
- Fixed a compatibility issue with the high definition render pipeline, accidentally introduced in 1.7.5.
- Fixed gizmos were not rendered when opening prefab assets in isolation mode and the high definition render pipeline was used.
## 1.7.5 (2024-10-07)
- Fixed a memory leak causing references to destroyed cameras to be kept around.
- Fixed \reflink{Draw.xy.SolidCircle(float3,float,float,float)} and \reflink{Draw.xz.SolidCircle(float3,float,float,float)} would render the circles in the wrong location.
- Reduced overhead when rendering gizmos.
- Each component type now shows up as a scope in the Unity Profiler when rendering their gizmos.
- Worked around a limitation in Unity's HDRP renderer caused errors to be logged constantly when forward rendering MSAA was enabled. Depth testing will now be disabled in this case, and a single warning will be logged.
Unfortunately there's nothing I can do to fix the underlying issue, since it's a limitation in Unity's HDRP renderer.
## 1.7.4 (2024-02-13)
- Fixed compatibility with HDRP render pipeline.
- Improved performance when there are many cameras rendered during the same frame.
## 1.7.3 (2024-02-07)
- Improved performance when there are lots of components inheriting from \reflink{MonoBehaviourGizmos}, but they do not actually override the DrawGizmos method.
- Fixed compatibility with Universal Render Pipeline package version 15 and 16 (regression in 1.7.2).
## 1.7.2 (2024-02-06)
- Improved performance of \reflink{Draw.WireCylinder} and \reflink{Draw.WireCapsule}.
- Fixed a memory leak that could happen if you used a lot of custom command builders.
- Added an option to the project settings to increase or decrease the resolution of circles.
- Improved compatibility with Universal Render Pipeline package version 17.
## 1.7.1 (2023-11-14)
- Removed "com.unity.jobs" as a dependency, since it has been replaced by the collections package.
- Added support for rendering gizmos while the scene view is in wireframe mode. This is supported in Unity 2023.1 and up.
- Added \reflink{CommandBuilder.DashedLine}.
\shadowimage{rendered/dashedline.png}
- Added \reflink{CommandBuilder.DashedPolyline}.
\shadowimage{rendered/dashedpolyline.png}
## 1.7.0 (2023-10-17)
- Added a much more ergonomic way to draw using 2D coordinates. Take a look at \ref 2d-drawing for more info.
\shadowimage{rendered/drawxy@8x.png}
- Deprecated several methods like \reflink{Draw.CircleXY} and \reflink{Draw.CircleXZ} to instead use the new 2D methods (Draw.xy.Circle and Draw.xz.Circle).
The old ones will continue to work for the time being, but they will be removed in a future update.
- Removed some shader code which was not supported on WebGL.
- Added \reflink{CommandBuilder2D.WirePill}
\shadowimage{rendered/wirepill.png}
- Added \reflink{CommandBuilder.SolidTriangle}
\shadowimage{rendered/solidtriangle.png}
- Added an overload of \reflink{Draw.Polyline} which takes an IReadOnlyList<T>.
- Added \reflink{CommandBuilder.PolylineWithSymbol}
\shadowimage{rendered/polylinewithsymbol.png}
- Added an overload of \reflink{CommandBuilder.WireMesh} that takes a NativeArray with vertices, and one with triangles.
- Improved look of \reflink{Draw.ArrowheadArc} when using a line width greater than 1.
- Improved performance when there are lots of objects in the scene inheriting from \reflink{MonoBehaviourGizmos}.
- Significantly reduced main-thread load when drawing in many situations by improving the Color to Color32 conversion performance.
Turns out Unity's built-in one is not the fastest.
In Burst I've cranked it up even more by using a SIMDed conversion function.
Common improvements are around 10% faster, but in tight loops it can be up to 50% faster.
- Improved performance of \reflink{Draw.WireBox}.
- Improved performance of drawing circles and arcs.
- Fixed name collision when both the A* Pathfinding Project and ALINE were installed in a project. This could cause the warning "There are 2 settings providers with the same name Project/ALINE." to be logged to the console.
- Fixed Draw.WireBox reserving the wrong amount of memory, which could lead to an exception being thrown.
- Fixed lines would be drawn slightly incorrectly at very shallow camera angles.
- Fixed a memory leak which could happen if the game was not running, and the scene view was not being re-rendered, and a script was queuing drawing commands from an editor script repeatedly.
Drawing commands will now get discarded after 10 seconds if no rendering happens to avoid leaking memory indefinitely.
- Fixed a memory leak which could happen if the game was not running in the editor, and no cameras were being rendered (e.g. on a server).
- Fixed shader compilation errors when deploying for PlayStation 5.
- Fixed circles with a normal of exactly (0,-1,0) would not be rendered.
- Changed \reflink{RedrawScope} to continue drawing items until it is disposed, instead of requiring one to call the scope.Draw method every frame.
- Allow a \reflink{RedrawScope} to be stored in unmanaged ECS components and systems.
- Fixed \reflink{Draw.Arrow} would draw a slightly narrower arrow head when the line was pointed in certain directions.
- Added an overload for 3x3 matrices: \reflink{Draw.WithMatrix(float3x3)}.
- Changed the behaviour for \reflink{RedrawScope}s. Previously they would continue drawing as long as you called RedrawScope.Draw every frame.
Now they will continue drawing until you dispose them. This makes them just nicer to use for most cases.
This is a breaking change, but since RedrawSopes have so far been a completely undocumented feature, I expect that no, or very few people, use them.
- Fixed compatibility with XBox.
- Fixed only the base camera in a camera stack would render gizmos.
## 1.6.4 (2022-09-17)
- \reflink{CommandBuilder.DisposeAfter} will now block on the given dependency before rendering the current frame by default.
This reduces the risk of flickering when using ECS systems as they may otherwise not have completed their work before the frame is rendered.
You can pass \reflink{AllowedDelay.Infinite} to disable this behavior for long-running jobs.
- Fixed recent regression causing drawing to fail in standalone builds.
## 1.6.3 (2022-09-15)
- Added \reflink{LabelAlignment.withPixelOffset}.
- Fixed \reflink{LabelAlignment} had top and bottom alignment swapped. So for example \reflink{LabelAlignment.TopLeft} was actually \reflink{LabelAlignment.BottomLeft}.
- Fixed shaders would sometimes cause compilation errors, especially if you changed render pipelines.
- Improved sharpness of \reflink{Draw.Label2D} and \reflink{Draw.Label3D} when using small font-sizes.\n
<table>
<tr><td>Before</td><td>After</td></tr>
<tr>
<td>
\shadowimage{changelog/text_blurry_small.png}
</td>
<td>
\shadowimage{changelog/text_sharp_small.png}
</td>
</table>
- Text now fades out slightly when behind or inside other objects. The fade out amount can be controlled in the project settings:
\shadowimage{changelog/text_opacity.png}
- Fixed \reflink{Draw.Label2D} and \reflink{Draw.Label3D} font sizes would be incorrect (half as large) when the camera was in orthographic mode.
- Fixed \reflink{Draw.WireCapsule} and \reflink{Draw.WireCylinder} would render incorrectly in certain orientations.
## 1.6.2 (2022-09-05)
- Fix typo causing prefabs to always be drawn in the scene view in Unity versions earlier than 2022.1, even if they were not even added to the scene.
## 1.6.1 (2022-08-31)
- Fix vertex buffers not getting resized correctly. This could cause exceptions to be logged sometimes. Regression in 1.6.
## 1.6 (2022-08-27)
- Fixed documentation and changelog URLs in the package manager.
- Fixed dragging a prefab into the scene view would instantiate it, but gizmos for scripts attached to it would not work.
- Fixed some edge cases in \reflink{Draw.WireCapsule} and \reflink{Draw.WireCapsule} which could cause NaNs and other subtle errors.
- Improved compatibility with WebGL as well as Intel GPUs on Mac.
- Added warning when using HDRP and custom passes are disabled.
- Improved performance of watching for destroyed objects.
- Reduced overhead when having lots of objects inheriting from \reflink{MonoBehaviourGizmos}.
- It's now possible to enable/disable gizmos for component types via the Unity Scene View Gizmos menu when using render pipelines in Unity 2022.1+.
In earlier versions of Unity, a limited API made this impossible.
- Made it possible to adjust the global opacity of gizmos in the Unity Project Settings.
\shadowimage{changelog/settings.png}
## 1.5.3 (2022-05-14)
- Breaking changes
- The minimum supported Unity version is now 2020.3.
- The URP 2D renderer now has support for all features required by ALINE. So the warning about it not being supported has been removed.
- Fixed windows newlines (\\n\\r) would show up as a newline and a question mark instead of just a newline.
- Fixed compilation errors when using the Unity.Collections package between version 0.8 and 0.11.
- Improved performance in some edge cases.
- Fixed \reflink{Draw.SolidMesh} with a non-white color could affect the color of unrelated rendered lines. Thanks Chris for finding and reporting the bug.
- Fixed an exception could be logged when drawing circles with a zero or negative line width.
- Fixed various compilation errors that could show up when using newer versions of the burst package.
## 1.5.2 (2021-11-09)
- Fix gizmos would not show up until you selected the camera if you had just switched to the universal render pipeline.
- Improved performance of drawing lines by more efficiently sending the data to the shader.
This has the downside that shader target 4.5 is now required. I don't think this should be a big deal nowadays, but let me know if things don't work on your platform.
This was originally introduced in 1.5.0, but reverted in 1.5.1 due to some compatibility issues causing rendering to fail for some project configurations. I think those issues should be resolved now.
## 1.5.1 (2021-10-28)
- Reverted "Improved performance of drawing lines by more efficiently sending the data to the shader." from 1.5.0.
It turns out this caused issues for some users and could result in gizmos not showing at all.
I'll try to figure out a solution and bring the performance improvements back.
## 1.5 (2021-10-27)
- Added support FixedStrings in \reflink{Draw.Label2D(float3,FixedString32Bytes,float)}, which means it can be used inside burst jobs (C# managed strings cannot be used in burst jobs).
- Fixed a 'NativeArray has not been disposed' error message that could show up if the whole project's assets were re-imported.
- Added \reflink{Draw.SolidCircle}.
\shadowimage{rendered/solidcircle.png}
- Added \reflink{Draw.SolidCircleXZ}.
\shadowimage{rendered/solidcirclexz.png}
- Added \reflink{Draw.SolidArc}.
\shadowimage{rendered/solidarc.png}
- Added \reflink{Draw.Label3D}
\shadowimage{rendered/label3d.png}
- Improved performance of \reflink{Draw.WirePlane} and \reflink{Draw.WireRectangle} by making them primitives instead of just calling \reflink{Draw.Line} 4 times.
- Improved performance in general by more efficiently re-using existing vertex buffers.
- Fixed some warnings related to ENABLE_UNITY_COLLECTIONS_CHECKS which burst would log when building a standalone player.
- Changed more functions in the \reflink{Draw} class to take a Unity.Mathematics.quaternion instead of a UnityEngine.Quaternion.
Implicit conversions exist in both directions, so there is no need to change your code.
## 1.4.3 (2021-09-04)
- Fixed some debug printout had been included by mistake. A "Disposing" message could sometimes show up in the console.
## 1.4.2 (2021-08-22)
- Reduced overhead in standalone builds if you have many objects in the scene.
- Fixed \reflink{Draw.WireCapsule(float3,float3,float)} could render incorrectly if the start and end parameters were identical.
- Fixed \reflink{Draw.WithDuration} scopes could survive until the next time the game started if no game or scene cameras were ever rendered while in edit mode.
- Added \reflink{Draw.SphereOutline(float3,float)}.
\shadowimage{rendered/sphereoutline.png}
- \reflink{Draw.WireSphere(float3,float)} has changed to always include an outline of the sphere. This makes it a lot nicer to look at.
\shadowimage{rendered/wiresphere.png}
## 1.4.1 (2021-02-28)
- Added \reflink{CommandBuilder.DisposeAfter} to dispose a command builder after a job has completed.
- Fixed gizmos would be rendered for other objects when the scene view was in prefab isolation mode. Now they will be hidden, which matches what Unity does.
- Fixed a deprecation warning when unity the HDRP package version 9.0 or higher.
- Improved docs for \reflink{RedrawScope}.
- Fixed documentation for scopes (e.g. \reflink{Draw.WithColor}) would show up as missing in the online documentation.
## 1.4 (2021-01-27)
- Breaking changes
- \reflink{Draw.WireCapsule(float3,float3,float)} with the bottom/top parameterization was incorrect and the behavior did not match the documentation for it.
This method has been changed so that it now matches the documentation as this was the intended behavior all along.
The documentation and parameter names have also been clarified.
- Added \reflink{Draw.SolidRectangle(Rect)}.
- Fixed \reflink{Draw.SolidBox(float3,quaternion,float3)} and \reflink{Draw.WireBox(float3,quaternion,float3)} rendered a box that was offset by 0.5 times the size of the box.
This bug only applied to the overload with a rotation, not for example to \reflink{Draw.SolidBox(float3,float3)}.
- Fixed Draw.SolidMesh would always be rendered at the world origin with a white color. Now it picks up matrices and colors properly.
- Fixed a bug which could cause a greyed out object called 'RetainedGizmos' to appear in the scene hierarchy.
- Fixed some overloads of WireCylinder, WireCapsule, WireBox and SolidBox throwing errors when you tried to use them in a Burst job.
- Improved compatibility with some older versions of the Universal Render Pipeline.
## 1.3.1 (2020-10-10)
- Improved performance in standalone builds by more aggressively compiling out drawing commands that would never render anything anyway.
- Reduced overhead in some cases, in particular when nothing is being rendered.
## 1.3 (2020-09-12)
- Added support for line widths.
See \reflink{Draw.WithLineWidth}.
\shadowimage{features/line_widths.png}
- Added warning message when using the Experimental URP 2D Renderer. The URP 2D renderer unfortunately does not have enough features yet
to be able to support ALINE. It doesn't have an extensible post processing system. The 2D renderer will be supported as soon as it is technically possible.
- Fixed \reflink{Draw.SolidPlane(float3,float3,float2)} and \reflink{Draw.WirePlane(float3,float3,float2)} not working for all normals.
- Fixed the culling bounding box for text and lines could be calculated incorrectly if text labels were used.
This could result in text and lines randomly disappearing when the camera was looking in particular directions.
- Renamed \reflink{Draw.PushPersist} and \reflink{Draw.PopPersist} to \reflink{Draw.PushDuration} and \reflink{Draw.PopDuration} for consistency with the \reflink{Draw.WithDuration} scope.
The previous names will still work, but they are marked as deprecated.
- Known bugs
- \reflink{Draw.SolidMesh(Mesh)} does not respect matrices and will always be drawn with the pivot at the world origin.
## 1.2.3 (2020-07-26)
- Fixed solid drawing not working when using VR rendering.
- Fixed nothing was visible when using the Universal Render Pipeline and post processing was enabled.
Note that ALINE will render before post processing effects when using the URP.
This is because as far as I can tell the Universal Render Pipeline does not expose any way to render objects
after post processing effects because it renders to hidden textures that custom passes cannot access.
- Fixed drawing sometimes not working when using the High Definition Render Pipeline.
In contrast to the URP, ALINE can actually render after post processing effects with the HDRP since it has a nicer API. So it does that.
- Known bugs
- \reflink{Draw.SolidMesh(Mesh)} does not respect matrices and will always be drawn with the pivot at the world origin.
## 1.2.2 (2020-07-11)
- Added \reflink{Draw.Arc(float3,float3,float3)}.
\shadowimage{rendered/arc.png}
- Fixed drawing sometimes not working when using the Universal Render Pipeline, in particular when either HDR or anti-aliasing was enabled.
- Fixed drawing not working when using VR rendering.
- Hopefully fixed the issue that could sometimes cause "The ALINE package installation seems to be corrupt. Try reinstalling the package." to be logged when first installing
the package (even though the package wasn't corrupt at all).
- Incremented required burst package version from 1.3.0-preview.7 to 1.3.0.
- Fixed the offline documentation showing the wrong page instead of the get started guide.
## 1.2.1 (2020-06-21)
- Breaking changes
- Changed the size parameter of Draw.WireRect to be a float2 instead of a float3.
It made no sense for it to be a float3 since a rectangle is two-dimensional. The y coordinate of the parameter was never used.
- Added <a href="ref:Draw.WirePlane(float3,float3,float2)">Draw.WirePlane</a>.
\shadowimage{rendered/wireplane.png}
- Added <a href="ref:Draw.SolidPlane(float3,float3,float2)">Draw.SolidPlane</a>.
\shadowimage{rendered/solidplane.png}
- Added <a href="ref:Draw.PlaneWithNormal(float3,float3,float2)">Draw.PlaneWithNormal</a>.
\shadowimage{rendered/planewithnormal.png}
- Fixed Drawing.DrawingUtilities class missed an access modifier. Now all methods are properly public and can be accessed without any issues.
- Fixed an error could be logged after using the WireMesh method and then exiting/entering play mode.
- Fixed Draw.Arrow not drawing the arrowhead properly when the arrow's direction was a multiple of (0,1,0).
## 1.2 (2020-05-22)
- Added page showing some advanced usages: \ref advanced.
- Added \link Drawing.Draw.WireMesh Draw.WireMesh\endlink.
\shadowimage{rendered/wiremesh.png}
- Added \link Drawing.CommandBuilder.cameraTargets CommandBuilder.cameraTargets\endlink.
- The WithDuration scope can now be used even outside of play mode. Outside of play mode it will use Time.realtimeSinceStartup to measure the duration.
- The WithDuration scope can now be used inside burst jobs and on different threads.
- Fixed WireCylinder and WireCapsule logging a warning if the normalized direction from the start to the end was exactly (1,1,1).normalized. Thanks Billy Attaway for reporting this.
- Fixed the documentation showing the wrong namespace for classes. It listed \a Pathfinding.Drawing but the correct namespace is just \a %Drawing.
## 1.1.1 (2020-05-04)
- Breaking changes
- The vertical alignment of Label2D has changed slightly. Previously the Top and Center alignments were a bit off from the actual top/center.
- Fixed conflicting assembly names when used in a project that also has the A* Pathfinding Project package installed.
- Fixed a crash when running on iOS.
- Improved alignment of \link Drawing.Draw.Label2D Draw.Label2D\endlink when using the Top or Center alignment.
## 1.1 (2020-04-20)
- Added \link Drawing.Draw.Label2D Draw.Label2D\endlink which allows you to easily render text from your code.
It uses a signed distance field font renderer which allows you to render crisp text even at high resolution.
At very small font sizes it falls back to a regular font texture.
\shadowimage{rendered/label2d.png}
- Improved performance of drawing lines by about 5%.
- Fixed a potential crash after calling the Draw.Line(Vector3,Vector3,Color) method.
## 1.0.2 (2020-04-09)
- Breaking changes
- A few breaking changes may be done as the package matures. I strive to keep these to as few as possible, while still not sacrificing good API design.
- Changed the behaviour of \link Drawing.Draw.Arrow(float3,float3,float3,float) Draw.Arrow\endlink to use an absolute size head.
This behaviour is probably the desired one more often when one wants to explicitly set the size.
The default Draw.Arrow(float3,float3) function which does not take a size parameter continues to use a relative head size of 20% of the length of the arrow.
\shadowimage{rendered/arrow_multiple.png}
- Added \link Drawing.Draw.ArrowRelativeSizeHead Draw.ArrowRelativeSizeHead\endlink which uses a relative size head.
\shadowimage{rendered/arrowrelativesizehead.png}
- Added \link Drawing.DrawingManager.GetBuilder DrawingManager.GetBuilder\endlink instead of the unnecessarily convoluted DrawingManager.instance.gizmos.GetBuilder.
- Added \link Drawing.Draw.CatmullRom(List<Vector3>) Draw.CatmullRom\endlink for drawing a smooth curve through a list of points.
\shadowimage{rendered/catmullrom.png}
- Made it easier to draw things that are visible in standalone games. You can now use for example Draw.ingame.WireBox(Vector3.zero, Vector3.one) instead of having to create a custom command builder.
See \ref ingame for more details.
## 1.0.1 (2020-04-06)
- Fix burst example scene not having using burst enabled (so it was much slower than it should have been).
- Fix text color in the SceneEditor example scene was so dark it was hard to read.
- Various minor documentation fixes.
## 1.0 (2020-04-05)
- Initial release

View File

@@ -0,0 +1,18 @@
fileFormatVersion: 2
guid: e1cf73b933cac2cfeb2af0f4d044b7b4
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
AssetOrigin:
serializedVersion: 1
productId: 162772
packageName: ALINE
packageVersion: 1.7.6
assetPath: Packages/com.arongranberg.aline/CHANGELOG.md
uploadId: 700292

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,18 @@
fileFormatVersion: 2
guid: 0c687e553ea664510a066332ee0f6583
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
AssetOrigin:
serializedVersion: 1
productId: 162772
packageName: ALINE
packageVersion: 1.7.6
assetPath: Packages/com.arongranberg.aline/CommandBuilder.cs
uploadId: 700292

View File

@@ -0,0 +1,420 @@
using System.Collections.Generic;
using Unity.Burst;
using Unity.Collections;
using Unity.Mathematics;
using UnityEngine;
using static Drawing.CommandBuilder;
namespace Drawing {
/// <summary>
/// 2D wrapper for a <see cref="CommandBuilder"/>.
///
/// <code>
/// var p1 = new Vector2(0, 1);
/// var p2 = new Vector2(5, 7);
///
/// // Draw it in the XY plane
/// Draw.xy.Line(p1, p2);
///
/// // Draw it in the XZ plane
/// Draw.xz.Line(p1, p2);
/// </code>
///
/// See: 2d-drawing (view in online documentation for working links)
/// See: <see cref="Draw.xy"/>
/// See: <see cref="Draw.xz"/>
/// </summary>
public partial struct CommandBuilder2D {
/// <summary>The wrapped command builder</summary>
private CommandBuilder draw;
/// <summary>True if drawing in the XY plane, false if drawing in the XZ plane</summary>
bool xy;
static readonly float3 XY_UP = new float3(0, 0, 1);
static readonly float3 XZ_UP = new float3(0, 1, 0);
static readonly quaternion XY_TO_XZ_ROTATION = quaternion.RotateX(-math.PI*0.5f);
static readonly quaternion XZ_TO_XZ_ROTATION = quaternion.identity;
static readonly float4x4 XZ_TO_XY_MATRIX = new float4x4(new float4(1, 0, 0, 0), new float4(0, 0, 1, 0), new float4(0, 1, 0, 0), new float4(0, 0, 0, 1));
public CommandBuilder2D(CommandBuilder draw, bool xy) {
this.draw = draw;
this.xy = xy;
}
/// <summary>
/// Draws a line between two points.
///
/// [Open online documentation to see images]
///
/// <code>
/// void Update () {
/// Draw.Line(Vector3.zero, Vector3.up);
/// }
/// </code>
/// </summary>
public void Line (float2 a, float2 b) {
draw.Reserve<LineData>();
// Add(Command.Line);
// Add(new LineData { a = a, b = b });
// The code below is equivalent to the commented out code above.
// But drawing lines is the most common operation so it needs to be really fast.
// Having this hardcoded improves line rendering performance by about 8%.
unsafe {
var buffer = draw.buffer;
var bufferSize = buffer->Length;
var newLen = bufferSize + 4 + 24;
#if ENABLE_UNITY_COLLECTIONS_CHECKS
UnityEngine.Assertions.Assert.IsTrue(newLen <= buffer->Capacity);
#endif
var ptr = (byte*)buffer->Ptr + bufferSize;
*(Command*)ptr = Command.Line;
var lineData = (LineData*)(ptr + 4);
if (xy) {
lineData->a = new float3(a, 0);
lineData->b = new float3(b, 0);
} else {
lineData->a = new float3(a.x, 0, a.y);
lineData->b = new float3(b.x, 0, b.y);
}
buffer->Length = newLen;
}
}
/// <summary>
/// Draws a line between two points.
///
/// [Open online documentation to see images]
///
/// <code>
/// void Update () {
/// Draw.Line(Vector3.zero, Vector3.up);
/// }
/// </code>
/// </summary>
public void Line (float2 a, float2 b, Color color) {
draw.Reserve<Color32, LineData>();
// Add(Command.Line);
// Add(new LineData { a = a, b = b });
// The code below is equivalent to the commented out code above.
// But drawing lines is the most common operation so it needs to be really fast.
// Having this hardcoded improves line rendering performance by about 8%.
unsafe {
var buffer = draw.buffer;
var bufferSize = buffer->Length;
var newLen = bufferSize + 4 + 24 + 4;
#if ENABLE_UNITY_COLLECTIONS_CHECKS
UnityEngine.Assertions.Assert.IsTrue(newLen <= buffer->Capacity);
#endif
var ptr = (byte*)buffer->Ptr + bufferSize;
*(Command*)ptr = Command.Line | Command.PushColorInline;
*(uint*)(ptr + 4) = CommandBuilder.ConvertColor(color);
var lineData = (LineData*)(ptr + 8);
if (xy) {
lineData->a = new float3(a, 0);
lineData->b = new float3(b, 0);
} else {
lineData->a = new float3(a.x, 0, a.y);
lineData->b = new float3(b.x, 0, b.y);
}
buffer->Length = newLen;
}
}
/// <summary>
/// Draws a line between two points.
///
/// [Open online documentation to see images]
///
/// <code>
/// void Update () {
/// Draw.Line(Vector3.zero, Vector3.up);
/// }
/// </code>
/// </summary>
public void Line (float3 a, float3 b) {
draw.Line(a, b);
}
/// <summary>
/// Draws a circle.
///
/// You can draw an arc by supplying the startAngle and endAngle parameters.
///
/// [Open online documentation to see images]
///
/// See: <see cref="Circle(float3,float,float,float)"/>
/// See: <see cref="Arc(float3,float3,float3)"/>
/// </summary>
/// <param name="center">Center of the circle or arc.</param>
/// <param name="radius">Radius of the circle or arc.</param>
/// <param name="startAngle">Starting angle in radians. 0 corrsponds to the positive X axis.</param>
/// <param name="endAngle">End angle in radians.</param>
public void Circle (float2 center, float radius, float startAngle = 0f, float endAngle = 2 * math.PI) {
Circle(xy ? new float3(center, 0) : new float3(center.x, 0, center.y), radius, startAngle, endAngle);
}
/// <summary>
/// Draws a circle.
///
/// You can draw an arc by supplying the startAngle and endAngle parameters.
///
/// [Open online documentation to see images]
///
/// See: <see cref="Circle(float3,float3,float)"/>
/// See: <see cref="Arc(float3,float3,float3)"/>
/// </summary>
/// <param name="center">Center of the circle or arc.</param>
/// <param name="radius">Radius of the circle or arc.</param>
/// <param name="startAngle">Starting angle in radians. 0 corrsponds to the positive X axis.</param>
/// <param name="endAngle">End angle in radians.</param>
public void Circle (float3 center, float radius, float startAngle = 0f, float endAngle = 2 * math.PI) {
if (xy) {
draw.PushMatrix(XZ_TO_XY_MATRIX);
draw.CircleXZInternal(new float3(center.x, center.z, center.y), radius, startAngle, endAngle);
draw.PopMatrix();
} else {
draw.CircleXZInternal(center, radius, startAngle, endAngle);
}
}
/// <summary>\copydocref{SolidCircle(float3,float,float,float)}</summary>
public void SolidCircle (float2 center, float radius, float startAngle = 0f, float endAngle = 2 * math.PI) {
SolidCircle(xy ? new float3(center, 0) : new float3(center.x, 0, center.y), radius, startAngle, endAngle);
}
/// <summary>
/// Draws a disc.
///
/// You can draw an arc by supplying the startAngle and endAngle parameters.
///
/// [Open online documentation to see images]
///
/// See: <see cref="Draw.SolidCircle(float3,float3,float)"/>
/// See: <see cref="SolidArc(float3,float3,float3)"/>
/// </summary>
/// <param name="center">Center of the disc or solid arc.</param>
/// <param name="radius">Radius of the disc or solid arc.</param>
/// <param name="startAngle">Starting angle in radians. 0 corrsponds to the positive X axis.</param>
/// <param name="endAngle">End angle in radians.</param>
public void SolidCircle (float3 center, float radius, float startAngle = 0f, float endAngle = 2 * math.PI) {
if (xy) draw.PushMatrix(XZ_TO_XY_MATRIX);
draw.SolidCircleXZInternal(xy ? new float3(center.x, center.z, center.y) : center, radius, startAngle, endAngle);
if (xy) draw.PopMatrix();
}
/// <summary>
/// Draws a wire pill in 2D.
///
/// <code>
/// Draw.xy.WirePill(new float2(-0.5f, -0.5f), new float2(0.5f, 0.5f), 0.5f, color);
/// </code>
///
/// [Open online documentation to see images]
///
/// See: <see cref="WirePill(float2,float2,float,float)"/>
/// </summary>
/// <param name="a">Center of the first circle of the capsule.</param>
/// <param name="b">Center of the second circle of the capsule.</param>
/// <param name="radius">Radius of the capsule.</param>
public void WirePill (float2 a, float2 b, float radius) {
WirePill(a, b - a, math.length(b - a), radius);
}
/// <summary>
/// Draws a wire pill in 2D.
///
/// <code>
/// Draw.xy.WirePill(new float2(-0.5f, -0.5f), new float2(1, 1), 1, 0.5f, color);
/// </code>
///
/// [Open online documentation to see images]
///
/// See: <see cref="WirePill(float2,float2,float)"/>
/// </summary>
/// <param name="position">Center of the first circle of the capsule.</param>
/// <param name="direction">The main axis of the capsule. Does not have to be normalized. If zero, a circle will be drawn.</param>
/// <param name="length">Length of the main axis of the capsule, from circle center to circle center. If zero, a circle will be drawn.</param>
/// <param name="radius">Radius of the capsule.</param>
public void WirePill (float2 position, float2 direction, float length, float radius) {
direction = math.normalizesafe(direction);
if (radius <= 0) {
Line(position, position + direction * length);
} else if (length <= 0 || math.all(direction == 0)) {
Circle(position, radius);
} else {
float4x4 m;
if (xy) {
m = new float4x4(
new float4(direction, 0, 0),
new float4(math.cross(new float3(direction, 0), XY_UP), 0),
new float4(0, 0, 1, 0),
new float4(position, 0, 1)
);
} else {
m = new float4x4(
new float4(direction.x, 0, direction.y, 0),
new float4(0, 1, 0, 0),
new float4(math.cross(new float3(direction.x, 0, direction.y), XZ_UP), 0),
new float4(position.x, 0, position.y, 1)
);
}
draw.PushMatrix(m);
Circle(new float2(0, 0), radius, 0.5f * math.PI, 1.5f * math.PI);
Line(new float2(0, -radius), new float2(length, -radius));
Circle(new float2(length, 0), radius, -0.5f * math.PI, 0.5f * math.PI);
Line(new float2(0, radius), new float2(length, radius));
draw.PopMatrix();
}
}
/// <summary>\copydocref{CommandBuilder.Polyline(List<Vector3>,bool)}</summary>
[BurstDiscard]
public void Polyline (List<Vector2> points, bool cycle = false) {
for (int i = 0; i < points.Count - 1; i++) {
Line(points[i], points[i+1]);
}
if (cycle && points.Count > 1) Line(points[points.Count - 1], points[0]);
}
/// <summary>\copydocref{CommandBuilder.Polyline(Vector3[],bool)}</summary>
[BurstDiscard]
public void Polyline (Vector2[] points, bool cycle = false) {
for (int i = 0; i < points.Length - 1; i++) {
Line(points[i], points[i+1]);
}
if (cycle && points.Length > 1) Line(points[points.Length - 1], points[0]);
}
/// <summary>\copydocref{CommandBuilder.Polyline(float3[],bool)}</summary>
[BurstDiscard]
public void Polyline (float2[] points, bool cycle = false) {
for (int i = 0; i < points.Length - 1; i++) {
Line(points[i], points[i+1]);
}
if (cycle && points.Length > 1) Line(points[points.Length - 1], points[0]);
}
/// <summary>\copydocref{CommandBuilder.Polyline(NativeArray<float3>,bool)}</summary>
public void Polyline (NativeArray<float2> points, bool cycle = false) {
for (int i = 0; i < points.Length - 1; i++) {
Line(points[i], points[i+1]);
}
if (cycle && points.Length > 1) Line(points[points.Length - 1], points[0]);
}
/// <summary>
/// Draws a 2D cross.
///
/// <code>
/// Draw.xz.Cross(float3.zero, color);
/// </code>
/// [Open online documentation to see images]
///
/// See: <see cref="Draw.Cross"/>
/// </summary>
public void Cross (float2 position, float size = 1) {
size *= 0.5f;
Line(position - new float2(size, 0), position + new float2(size, 0));
Line(position - new float2(0, size), position + new float2(0, size));
}
/// <summary>
/// Draws a rectangle outline.
/// The rectangle will be oriented along the rotation's X and Z axes.
///
/// <code>
/// Draw.xz.WireRectangle(new Vector3(0f, 0, 0), new Vector2(1, 1), Color.black);
/// </code>
/// [Open online documentation to see images]
///
/// This is identical to <see cref="Draw.WirePlane(float3,quaternion,float2)"/>, but this name is added for consistency.
///
/// See: <see cref="Draw.WirePolygon"/>
/// </summary>
public void WireRectangle (float3 center, float2 size) {
draw.WirePlane(center, xy ? XY_TO_XZ_ROTATION : XZ_TO_XZ_ROTATION, size);
}
/// <summary>
/// Draws a rectangle outline.
/// This is particularly useful when combined with <see cref="InScreenSpace"/>.
///
/// <code>
/// using (Draw.InScreenSpace(Camera.main)) {
/// Draw.xy.WireRectangle(new Rect(10, 10, 100, 100), Color.black);
/// }
/// </code>
/// [Open online documentation to see images]
///
/// See: <see cref="Draw.WireRectangle(float3,quaternion,float2)"/>
/// See: <see cref="Draw.WirePolygon"/>
/// </summary>
public void WireRectangle (Rect rect) {
float2 min = rect.min;
float2 max = rect.max;
Line(new float2(min.x, min.y), new float2(max.x, min.y));
Line(new float2(max.x, min.y), new float2(max.x, max.y));
Line(new float2(max.x, max.y), new float2(min.x, max.y));
Line(new float2(min.x, max.y), new float2(min.x, min.y));
}
/// <summary>
/// Draws a solid rectangle.
/// This is particularly useful when combined with <see cref="InScreenSpace"/>.
///
/// Behind the scenes this is implemented using <see cref="Draw.SolidPlane"/>.
///
/// <code>
/// using (Draw.InScreenSpace(Camera.main)) {
/// Draw.xy.SolidRectangle(new Rect(10, 10, 100, 100), Color.black);
/// }
/// </code>
/// [Open online documentation to see images]
///
/// See: <see cref="WireRectangle"/>
/// See: <see cref="Draw.WireRectangle(float3,quaternion,float2)"/>
/// See: <see cref="Draw.SolidBox"/>
/// </summary>
public void SolidRectangle (Rect rect) {
draw.SolidPlane(new float3(rect.center.x, rect.center.y, 0.0f), xy ? XY_TO_XZ_ROTATION : XZ_TO_XZ_ROTATION, new float2(rect.width, rect.height));
}
/// <summary>
/// Draws a grid of lines.
///
/// <code>
/// Draw.xz.WireGrid(Vector3.zero, new int2(3, 3), new float2(1, 1), color);
/// </code>
/// [Open online documentation to see images]
///
/// See: <see cref="Draw.WireGrid"/>
/// </summary>
/// <param name="center">Center of the grid</param>
/// <param name="cells">Number of cells of the grid. Should be greater than 0.</param>
/// <param name="totalSize">Total size of the grid along the X and Z axes.</param>
public void WireGrid (float2 center, int2 cells, float2 totalSize) {
draw.WireGrid(xy ? new float3(center, 0) : new float3(center.x, 0, center.y), xy ? XY_TO_XZ_ROTATION : XZ_TO_XZ_ROTATION, cells, totalSize);
}
/// <summary>
/// Draws a grid of lines.
///
/// <code>
/// Draw.xz.WireGrid(Vector3.zero, new int2(3, 3), new float2(1, 1), color);
/// </code>
/// [Open online documentation to see images]
///
/// See: <see cref="Draw.WireGrid"/>
/// </summary>
/// <param name="center">Center of the grid</param>
/// <param name="cells">Number of cells of the grid. Should be greater than 0.</param>
/// <param name="totalSize">Total size of the grid along the X and Z axes.</param>
public void WireGrid (float3 center, int2 cells, float2 totalSize) {
draw.WireGrid(center, xy ? XY_TO_XZ_ROTATION : XZ_TO_XZ_ROTATION, cells, totalSize);
}
}
}

View File

@@ -0,0 +1,18 @@
fileFormatVersion: 2
guid: 87689c56d7a309340b0da559853df2c8
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
AssetOrigin:
serializedVersion: 1
productId: 162772
packageName: ALINE
packageVersion: 1.7.6
assetPath: Packages/com.arongranberg.aline/CommandBuilder2D.cs
uploadId: 700292

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,18 @@
fileFormatVersion: 2
guid: 90565319c93ed2f49b157dfd0532a74c
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
AssetOrigin:
serializedVersion: 1
productId: 162772
packageName: ALINE
packageVersion: 1.7.6
assetPath: Packages/com.arongranberg.aline/CommandBuilder2DExtensions.cs
uploadId: 700292

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,18 @@
fileFormatVersion: 2
guid: 380787cc3a51649209786ec216737924
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
AssetOrigin:
serializedVersion: 1
productId: 162772
packageName: ALINE
packageVersion: 1.7.6
assetPath: Packages/com.arongranberg.aline/CommandBuilderExtensions.cs
uploadId: 700292

View File

@@ -0,0 +1,3 @@
// This file has been removed from the package. Since UnityPackages cannot
// delete files, only replace them, this message is left here to prevent old
// files from causing compiler errors.

View File

@@ -0,0 +1,18 @@
fileFormatVersion: 2
guid: d53eb32d15c4e58a68061d3125d1b226
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
AssetOrigin:
serializedVersion: 1
productId: 162772
packageName: ALINE
packageVersion: 1.7.6
assetPath: Packages/com.arongranberg.aline/Compatibility.cs
uploadId: 700292

View File

@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: d5c481b98877873438239fbbf48a07f0
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,14 @@
fileFormatVersion: 2
guid: b22e5f8074c5ce792861020e4d344a86
TextScriptImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
AssetOrigin:
serializedVersion: 1
productId: 162772
packageName: ALINE
packageVersion: 1.7.6
assetPath: Packages/com.arongranberg.aline/Documentation/documentation.html
uploadId: 700292

View File

@@ -0,0 +1,14 @@
fileFormatVersion: 2
guid: 15017efce836c1a3982fc6ad3b0bc909
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
AssetOrigin:
serializedVersion: 1
productId: 162772
packageName: ALINE
packageVersion: 1.7.6
assetPath: Packages/com.arongranberg.aline/Documentation/documentation.pdf
uploadId: 700292

View File

@@ -0,0 +1,7 @@
ALINE
=====
- Documentation: https://arongranberg.com/aline/docs
- Get started tutorial: https://arongranberg.com/aline/docs/getstarted.html
- Package website: https://arongranberg.com/aline
- Support forum: https://forum.arongranberg.com/

View File

@@ -0,0 +1,14 @@
fileFormatVersion: 2
guid: 8596356ad2e8716268fca045817224e3
TextScriptImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
AssetOrigin:
serializedVersion: 1
productId: 162772
packageName: ALINE
packageVersion: 1.7.6
assetPath: Packages/com.arongranberg.aline/Documentation/index.md
uploadId: 700292

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,19 @@
fileFormatVersion: 2
guid: 506739df886ce4ebb9b14b16d86b5e14
timeCreated: 1492346087
licenseType: Store
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
AssetOrigin:
serializedVersion: 1
productId: 162772
packageName: ALINE
packageVersion: 1.7.6
assetPath: Packages/com.arongranberg.aline/Draw.cs
uploadId: 700292

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,19 @@
fileFormatVersion: 2
guid: 7a3cd109c93704c7ba499b8653f402ad
timeCreated: 1472980867
licenseType: Store
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
AssetOrigin:
serializedVersion: 1
productId: 162772
packageName: ALINE
packageVersion: 1.7.6
assetPath: Packages/com.arongranberg.aline/DrawingData.cs
uploadId: 700292

View File

@@ -0,0 +1,823 @@
#pragma warning disable 649 // Field `Drawing.GizmoContext.activeTransform' is never assigned to, and will always have its default value `null'. Not used outside of the unity editor.
using UnityEngine;
using System.Collections;
using System;
#if UNITY_EDITOR
using UnityEditor;
using UnityEditor.SceneManagement;
#endif
using System.Collections.Generic;
using Unity.Jobs;
using Unity.Mathematics;
using UnityEngine.Rendering;
using Unity.Profiling;
#if MODULE_RENDER_PIPELINES_UNIVERSAL
using UnityEngine.Rendering.Universal;
using UnityEngine.Profiling;
#endif
#if MODULE_RENDER_PIPELINES_HIGH_DEFINITION
using UnityEngine.Rendering.HighDefinition;
#endif
namespace Drawing {
/// <summary>Info about the current selection in the editor</summary>
public static class GizmoContext {
#if UNITY_EDITOR
static Transform activeTransform;
#endif
static HashSet<Transform> selectedTransforms = new HashSet<Transform>();
static internal bool drawingGizmos;
static internal bool dirty;
private static int selectionSizeInternal;
/// <summary>Number of top-level transforms that are selected</summary>
public static int selectionSize {
get {
Refresh();
return selectionSizeInternal;
}
private set {
selectionSizeInternal = value;
}
}
internal static void SetDirty () {
dirty = true;
}
private static void Refresh () {
#if UNITY_EDITOR
if (!drawingGizmos) throw new System.Exception("Can only be used inside the ALINE library's gizmo drawing functions.");
if (dirty) {
dirty = false;
DrawingManager.MarkerRefreshSelectionCache.Begin();
activeTransform = Selection.activeTransform;
selectedTransforms.Clear();
var topLevel = Selection.transforms;
for (int i = 0; i < topLevel.Length; i++) selectedTransforms.Add(topLevel[i]);
selectionSize = topLevel.Length;
DrawingManager.MarkerRefreshSelectionCache.End();
}
#endif
}
/// <summary>
/// True if the component is selected.
/// This is a deep selection: even children of selected transforms are considered to be selected.
/// </summary>
public static bool InSelection (Component c) {
return InSelection(c.transform);
}
/// <summary>
/// True if the transform is selected.
/// This is a deep selection: even children of selected transforms are considered to be selected.
/// </summary>
public static bool InSelection (Transform tr) {
Refresh();
var leaf = tr;
while (tr != null) {
if (selectedTransforms.Contains(tr)) {
selectedTransforms.Add(leaf);
return true;
}
tr = tr.parent;
}
return false;
}
/// <summary>
/// True if the component is shown in the inspector.
/// The active selection is the GameObject that is currently visible in the inspector.
/// </summary>
public static bool InActiveSelection (Component c) {
return InActiveSelection(c.transform);
}
/// <summary>
/// True if the transform is shown in the inspector.
/// The active selection is the GameObject that is currently visible in the inspector.
/// </summary>
public static bool InActiveSelection (Transform tr) {
#if UNITY_EDITOR
Refresh();
return tr.transform == activeTransform;
#else
return false;
#endif
}
}
/// <summary>
/// Every object that wants to draw gizmos should implement this interface.
/// See: <see cref="Drawing.MonoBehaviourGizmos"/>
/// </summary>
public interface IDrawGizmos {
void DrawGizmos();
}
public enum DetectedRenderPipeline {
BuiltInOrCustom,
HDRP,
URP
}
/// <summary>
/// Global script which draws debug items and gizmos.
/// If a Draw.* method has been used or if any script inheriting from the <see cref="Drawing.MonoBehaviourGizmos"/> class is in the scene then an instance of this script
/// will be created and put on a hidden GameObject.
///
/// It will inject drawing logic into any cameras that are rendered.
///
/// Usually you never have to interact with this class.
/// </summary>
[ExecuteAlways]
[AddComponentMenu("")]
[HelpURL("http://arongranberg.com/aline/documentation/stable/drawingmanager.html")]
public class DrawingManager : MonoBehaviour {
public DrawingData gizmos;
static List<GizmoDrawerGroup> gizmoDrawers = new List<GizmoDrawerGroup>();
static Dictionary<System.Type, int> gizmoDrawerIndices = new Dictionary<System.Type, int>();
static DrawingManager _instance;
bool framePassed;
int lastFrameCount = int.MinValue;
float lastFrameTime = -float.NegativeInfinity;
int lastFilterFrame;
#if UNITY_EDITOR
bool builtGizmos;
#endif
struct GizmoDrawerGroup {
public System.Type type;
public ProfilerMarker profilerMarker;
public List<IDrawGizmos> drawers;
public bool enabled;
}
/// <summary>True if OnEnable has been called on this instance and OnDisable has not</summary>
[SerializeField]
bool actuallyEnabled;
RedrawScope previousFrameRedrawScope;
/// <summary>
/// Allow rendering to cameras that render to RenderTextures.
/// By default cameras which render to render textures are never rendered to.
/// You may enable this if you wish.
///
/// See: <see cref="Drawing.CommandBuilder.cameraTargets"/>
/// See: advanced (view in online documentation for working links)
/// </summary>
public static bool allowRenderToRenderTextures = false;
public static bool drawToAllCameras = false;
/// <summary>
/// Multiply all line widths by this value.
/// This can be used to make lines thicker or thinner.
///
/// This is primarily useful when generating screenshots, and you want to render at a higher resolution before scaling down the image.
///
/// It is only read when a camera is being rendered. So it cannot be used to change line thickness on a per-item basis.
/// Use <see cref="Draw.WithLineWidth"/> for that.
/// </summary>
public static float lineWidthMultiplier = 1.0f;
CommandBuffer commandBuffer;
[System.NonSerialized]
DetectedRenderPipeline detectedRenderPipeline = DetectedRenderPipeline.BuiltInOrCustom;
#if MODULE_RENDER_PIPELINES_HIGH_DEFINITION_16_0_0_OR_NEWER
CustomPass hdrpGlobalPass;
#endif
#if MODULE_RENDER_PIPELINES_UNIVERSAL
HashSet<ScriptableRenderer> scriptableRenderersWithPass = new HashSet<ScriptableRenderer>();
AlineURPRenderPassFeature renderPassFeature;
#endif
private static readonly ProfilerMarker MarkerALINE = new ProfilerMarker("ALINE");
private static readonly ProfilerMarker MarkerCommandBuffer = new ProfilerMarker("Executing command buffer");
private static readonly ProfilerMarker MarkerFrameTick = new ProfilerMarker("Frame Tick");
private static readonly ProfilerMarker MarkerFilterDestroyedObjects = new ProfilerMarker("Filter destroyed objects");
internal static readonly ProfilerMarker MarkerRefreshSelectionCache = new ProfilerMarker("Refresh Selection Cache");
private static readonly ProfilerMarker MarkerGizmosAllowed = new ProfilerMarker("GizmosAllowed");
private static readonly ProfilerMarker MarkerDrawGizmos = new ProfilerMarker("DrawGizmos");
private static readonly ProfilerMarker MarkerSubmitGizmos = new ProfilerMarker("Submit Gizmos");
public static DrawingManager instance {
get {
if (_instance == null) Init();
return _instance;
}
}
#if UNITY_EDITOR
[InitializeOnLoadMethod]
#endif
public static void Init () {
#if ENABLE_UNITY_COLLECTIONS_CHECKS
if (Unity.Jobs.LowLevel.Unsafe.JobsUtility.IsExecutingJob) throw new System.Exception("Draw.* methods cannot be called from inside a job. See the documentation for info about how to use drawing functions from the Unity Job System.");
#endif
if (_instance != null) return;
// Here one might try to look for existing instances of the class that haven't yet been enabled.
// However, this turns out to be tricky.
// Resources.FindObjectsOfTypeAll<T>() is the only call that includes HideInInspector GameObjects.
// But it is hard to distinguish between objects that are internal ones which will never be enabled and objects that will be enabled.
// Checking .gameObject.scene.isLoaded doesn't work reliably (object may be enabled and working even if isLoaded is false)
// Checking .gameObject.scene.isValid doesn't work reliably (object may be enabled and working even if isValid is false)
// So instead we just always create a new instance. This is not a particularly heavy operation and it only happens once per game, so why not.
// The OnEnable call will clean up duplicate managers if there are any.
var go = new GameObject("RetainedGizmos") {
hideFlags = HideFlags.DontSave | HideFlags.NotEditable | HideFlags.HideInInspector | HideFlags.HideInHierarchy
};
_instance = go.AddComponent<DrawingManager>();
if (Application.isPlaying) DontDestroyOnLoad(go);
}
/// <summary>Detects which render pipeline is being used and configures them for rendering</summary>
void RefreshRenderPipelineMode () {
var pipelineType = RenderPipelineManager.currentPipeline != null? RenderPipelineManager.currentPipeline.GetType() : null;
#if MODULE_RENDER_PIPELINES_HIGH_DEFINITION
if (pipelineType == typeof(HDRenderPipeline)) {
if (detectedRenderPipeline != DetectedRenderPipeline.HDRP) {
detectedRenderPipeline = DetectedRenderPipeline.HDRP;
#if MODULE_RENDER_PIPELINES_HIGH_DEFINITION_16_0_0_OR_NEWER
UnityEngine.Assertions.Assert.IsNull(hdrpGlobalPass);
hdrpGlobalPass = new AlineHDRPCustomPass();
CustomPassVolume.RegisterGlobalCustomPass(CustomPassInjectionPoint.AfterPostProcess, hdrpGlobalPass);
#else
if (!_instance.gameObject.TryGetComponent<CustomPassVolume>(out CustomPassVolume volume)) {
volume = _instance.gameObject.AddComponent<CustomPassVolume>();
volume.isGlobal = true;
volume.injectionPoint = CustomPassInjectionPoint.AfterPostProcess;
volume.customPasses.Add(new AlineHDRPCustomPass());
}
#endif
var asset = GraphicsSettings.defaultRenderPipeline as HDRenderPipelineAsset;
if (asset != null) {
if (!asset.currentPlatformRenderPipelineSettings.supportCustomPass) {
Debug.LogWarning("ALINE: The current render pipeline has custom pass support disabled. ALINE will not be able to render anything. Please enable custom pass support on your HDRenderPipelineAsset.", asset);
}
}
}
#if UNITY_ASSERTIONS && MODULE_RENDER_PIPELINES_HIGH_DEFINITION_16_0_0_OR_NEWER
var globalPasses = CustomPassVolume.GetGlobalCustomPasses(CustomPassInjectionPoint.AfterPostProcess);
bool found = false;
for (int i = 0; i < globalPasses.Count; i++) found |= globalPasses[i].instance == hdrpGlobalPass;
UnityEngine.Assertions.Assert.IsTrue(found, "Custom pass for gizmos is not registered. Have the custom passes been forcefully removed by another script?");
#endif
return;
}
#if MODULE_RENDER_PIPELINES_HIGH_DEFINITION_16_0_0_OR_NEWER
if (hdrpGlobalPass != null) {
CustomPassVolume.UnregisterGlobalCustomPass(CustomPassInjectionPoint.AfterPostProcess, hdrpGlobalPass);
hdrpGlobalPass = null;
}
#endif
#endif
#if MODULE_RENDER_PIPELINES_UNIVERSAL
if (pipelineType == typeof(UniversalRenderPipeline)) {
detectedRenderPipeline = DetectedRenderPipeline.URP;
return;
}
#endif
detectedRenderPipeline = DetectedRenderPipeline.BuiltInOrCustom;
}
#if UNITY_EDITOR
void DelayedDestroy () {
EditorApplication.update -= DelayedDestroy;
// Check if the object still exists (it might have been destroyed in some other way already).
if (gameObject) GameObject.DestroyImmediate(gameObject);
}
void OnPlayModeStateChanged (PlayModeStateChange change) {
if (change == PlayModeStateChange.ExitingEditMode || change == PlayModeStateChange.ExitingPlayMode) {
gizmos.OnChangingPlayMode();
}
}
#endif
void OnEnable () {
if (_instance == null) _instance = this;
// Ensure we don't have duplicate managers
if (_instance != this) {
// We cannot destroy the object while it is being enabled, so we need to delay it a bit
#if UNITY_EDITOR
// This is only important in the editor to avoid a build-up of old managers.
// In an actual game at most 1 (though in practice zero) old managers will be laying around.
// It would be nice to use a coroutine for this instead, but unfortunately they do not work for objects marked with HideAndDontSave.
EditorApplication.update += DelayedDestroy;
#endif
return;
}
actuallyEnabled = true;
if (gizmos == null) gizmos = new DrawingData();
gizmos.frameRedrawScope = new RedrawScope(gizmos);
Draw.builder = gizmos.GetBuiltInBuilder(false);
Draw.ingame_builder = gizmos.GetBuiltInBuilder(true);
commandBuffer = new CommandBuffer();
commandBuffer.name = "ALINE Gizmos";
detectedRenderPipeline = DetectedRenderPipeline.BuiltInOrCustom;
// Callback when rendering with the built-in render pipeline
Camera.onPostRender += PostRender;
// Callback when rendering with a scriptable render pipeline
#if UNITY_2021_1_OR_NEWER
UnityEngine.Rendering.RenderPipelineManager.beginContextRendering += BeginContextRendering;
#else
UnityEngine.Rendering.RenderPipelineManager.beginFrameRendering += BeginFrameRendering;
#endif
UnityEngine.Rendering.RenderPipelineManager.beginCameraRendering += BeginCameraRendering;
UnityEngine.Rendering.RenderPipelineManager.endCameraRendering += EndCameraRendering;
#if UNITY_EDITOR
EditorApplication.update += OnEditorUpdate;
EditorApplication.playModeStateChanged += OnPlayModeStateChanged;
#endif
}
void BeginContextRendering (ScriptableRenderContext context, List<Camera> cameras) {
RefreshRenderPipelineMode();
}
void BeginFrameRendering (ScriptableRenderContext context, Camera[] cameras) {
RefreshRenderPipelineMode();
}
void BeginCameraRendering (ScriptableRenderContext context, Camera camera) {
#if MODULE_RENDER_PIPELINES_UNIVERSAL
if (detectedRenderPipeline == DetectedRenderPipeline.URP) {
var data = camera.GetUniversalAdditionalCameraData();
if (data != null) {
var renderer = data.scriptableRenderer;
if (renderPassFeature == null) {
renderPassFeature = ScriptableObject.CreateInstance<AlineURPRenderPassFeature>();
}
renderPassFeature.AddRenderPasses(renderer);
}
}
#endif
}
void OnDisable () {
if (!actuallyEnabled) return;
actuallyEnabled = false;
commandBuffer.Dispose();
commandBuffer = null;
Camera.onPostRender -= PostRender;
#if UNITY_2021_1_OR_NEWER
UnityEngine.Rendering.RenderPipelineManager.beginContextRendering -= BeginContextRendering;
#else
UnityEngine.Rendering.RenderPipelineManager.beginFrameRendering -= BeginFrameRendering;
#endif
UnityEngine.Rendering.RenderPipelineManager.beginCameraRendering -= BeginCameraRendering;
UnityEngine.Rendering.RenderPipelineManager.endCameraRendering -= EndCameraRendering;
#if UNITY_EDITOR
EditorApplication.update -= OnEditorUpdate;
EditorApplication.playModeStateChanged -= OnPlayModeStateChanged;
#endif
// Gizmos can be null here if this GameObject was duplicated by a user in the hierarchy.
if (gizmos != null) {
Draw.builder.DiscardAndDisposeInternal();
Draw.ingame_builder.DiscardAndDisposeInternal();
gizmos.ClearData();
}
#if MODULE_RENDER_PIPELINES_UNIVERSAL
if (renderPassFeature != null) {
ScriptableObject.DestroyImmediate(renderPassFeature);
renderPassFeature = null;
}
#endif
#if MODULE_RENDER_PIPELINES_HIGH_DEFINITION_16_0_0_OR_NEWER
if (hdrpGlobalPass != null) {
CustomPassVolume.UnregisterGlobalCustomPass(CustomPassInjectionPoint.AfterPostProcess, hdrpGlobalPass);
hdrpGlobalPass = null;
}
#endif
}
// When enter play mode = reload scene & reload domain
// editor => play mode: OnDisable -> OnEnable (same object)
// play mode => editor: OnApplicationQuit (note: no OnDisable/OnEnable)
// When enter play mode = reload scene & !reload domain
// editor => play mode: Nothing
// play mode => editor: OnApplicationQuit
// When enter play mode = !reload scene & !reload domain
// editor => play mode: Nothing
// play mode => editor: OnApplicationQuit
// OnDestroy is never really called for this object (unless Unity or the game quits I quess)
// TODO: Should run in OnDestroy. OnApplicationQuit runs BEFORE OnDestroy (which we do not want)
// private void OnApplicationQuit () {
// Debug.Log("OnApplicationQuit");
// Draw.builder.DiscardAndDisposeInternal();
// Draw.ingame_builder.DiscardAndDisposeInternal();
// gizmos.ClearData();
// Draw.builder = gizmos.GetBuiltInBuilder(false);
// Draw.ingame_builder = gizmos.GetBuiltInBuilder(true);
// }
const float NO_DRAWING_TIMEOUT_SECS = 10;
void OnEditorUpdate () {
framePassed = true;
CleanupIfNoCameraRendered();
}
void Update () {
if (actuallyEnabled) CleanupIfNoCameraRendered();
}
void CleanupIfNoCameraRendered () {
if (Time.frameCount > lastFrameCount + 1) {
// More than one frame old
// It is possible no camera is being rendered at all.
// Ensure we don't get any memory leaks from drawing items being queued every frame.
CheckFrameTicking();
gizmos.PostRenderCleanup();
// Note: We do not always want to call the above method here
// because it is nicer to call it right after the cameras have been rendered.
// Otherwise drawing items queued before Update/OnEditorUpdate or after Update/OnEditorUpdate may end up
// in different frames (for the purposes of rendering gizmos)
}
if (Time.realtimeSinceStartup - lastFrameTime > NO_DRAWING_TIMEOUT_SECS) {
// More than NO_DRAWING_TIMEOUT_SECS seconds since we drew the last frame.
// In the editor some script could be queuing drawing commands in e.g. EditorWindow.Update without the scene
// view or any game view being re-rendered. We discard these commands if nothing has been rendered for a long time.
Draw.builder.DiscardAndDisposeInternal();
Draw.ingame_builder.DiscardAndDisposeInternal();
Draw.builder = gizmos.GetBuiltInBuilder(false);
Draw.ingame_builder = gizmos.GetBuiltInBuilder(true);
lastFrameTime = Time.realtimeSinceStartup;
RemoveDestroyedGizmoDrawers();
}
// Avoid potential memory leak if gizmos are not being drawn
if (lastFilterFrame - Time.frameCount > 5) {
lastFilterFrame = Time.frameCount;
RemoveDestroyedGizmoDrawers();
}
}
internal void ExecuteCustomRenderPass (ScriptableRenderContext context, Camera camera) {
MarkerALINE.Begin();
commandBuffer.Clear();
SubmitFrame(camera, new DrawingData.CommandBufferWrapper { cmd = commandBuffer }, true);
context.ExecuteCommandBuffer(commandBuffer);
MarkerALINE.End();
}
#if MODULE_RENDER_PIPELINES_UNIVERSAL
internal void ExecuteCustomRenderGraphPass (DrawingData.CommandBufferWrapper cmd, Camera camera) {
MarkerALINE.Begin();
SubmitFrame(camera, cmd, true);
MarkerALINE.End();
}
#endif
private void EndCameraRendering (ScriptableRenderContext context, Camera camera) {
if (detectedRenderPipeline == DetectedRenderPipeline.BuiltInOrCustom) {
// Execute the custom render pass after the camera has finished rendering.
// For the HDRP and URP the render pass will already have been executed.
// However for a custom render pipline we execute the rendering code here.
// This is only best effort. It's impossible to be compatible with all custom render pipelines.
// However it should work for most simple ones.
// For Unity's built-in render pipeline the EndCameraRendering method will never be called.
ExecuteCustomRenderPass(context, camera);
}
}
void PostRender (Camera camera) {
// This method is only called when using Unity's built-in render pipeline
commandBuffer.Clear();
SubmitFrame(camera, new DrawingData.CommandBufferWrapper { cmd = commandBuffer }, false);
MarkerCommandBuffer.Begin();
Graphics.ExecuteCommandBuffer(commandBuffer);
MarkerCommandBuffer.End();
}
void CheckFrameTicking () {
MarkerFrameTick.Begin();
if (Time.frameCount != lastFrameCount) {
framePassed = true;
lastFrameCount = Time.frameCount;
lastFrameTime = Time.realtimeSinceStartup;
previousFrameRedrawScope = gizmos.frameRedrawScope;
gizmos.frameRedrawScope = new RedrawScope(gizmos);
Draw.builder.DisposeInternal();
Draw.ingame_builder.DisposeInternal();
Draw.builder = gizmos.GetBuiltInBuilder(false);
Draw.ingame_builder = gizmos.GetBuiltInBuilder(true);
} else if (framePassed && Application.isPlaying) {
// Rendered frame passed without a game frame passing!
// This might mean the game is paused.
// Redraw gizmos while the game is paused.
// It might also just mean that we are rendering with multiple cameras.
previousFrameRedrawScope.Draw();
}
if (framePassed) {
gizmos.TickFramePreRender();
#if UNITY_EDITOR
builtGizmos = false;
#endif
framePassed = false;
}
MarkerFrameTick.End();
}
internal void SubmitFrame (Camera camera, DrawingData.CommandBufferWrapper cmd, bool usingRenderPipeline) {
#if UNITY_EDITOR
bool isSceneViewCamera = SceneView.currentDrawingSceneView != null && SceneView.currentDrawingSceneView.camera == camera;
#else
bool isSceneViewCamera = false;
#endif
// Do not include when rendering to a texture unless this is a scene view camera
bool allowCameraDefault = allowRenderToRenderTextures || drawToAllCameras || camera.targetTexture == null || isSceneViewCamera;
CheckFrameTicking();
Submit(camera, cmd, usingRenderPipeline, allowCameraDefault);
gizmos.PostRenderCleanup();
}
#if UNITY_EDITOR
static readonly System.Reflection.MethodInfo IsGizmosAllowedForObject = typeof(UnityEditor.EditorGUIUtility).GetMethod("IsGizmosAllowedForObject", System.Reflection.BindingFlags.Static | System.Reflection.BindingFlags.Public | System.Reflection.BindingFlags.NonPublic);
readonly System.Object[] cachedObjectParameterArray = new System.Object[1];
#endif
bool ShouldDrawGizmos (UnityEngine.Object obj) {
#if UNITY_EDITOR
// Use reflection to call EditorGUIUtility.IsGizmosAllowedForObject which is an internal method.
// It is exactly the information we want though.
// In case Unity has changed its API or something so that the method can no longer be found then just return true
cachedObjectParameterArray[0] = obj;
return IsGizmosAllowedForObject == null || (bool)IsGizmosAllowedForObject.Invoke(null, cachedObjectParameterArray);
#else
return true;
#endif
}
static void RemoveDestroyedGizmoDrawers () {
MarkerFilterDestroyedObjects.Begin();
for (int i = 0; i < gizmoDrawers.Count; i++) {
var group = gizmoDrawers[i];
int j = 0;
for (int k = 0; k < group.drawers.Count; k++) {
var v = group.drawers[k];
if (v as MonoBehaviour) {
group.drawers[j] = v;
j++;
}
}
group.drawers.RemoveRange(j, group.drawers.Count - j);
}
MarkerFilterDestroyedObjects.End();
}
#if UNITY_EDITOR
void DrawGizmos (bool usingRenderPipeline) {
GizmoContext.SetDirty();
MarkerGizmosAllowed.Begin();
// Figure out which component types should be rendered
for (int i = 0; i < gizmoDrawers.Count; i++) {
var group = gizmoDrawers[i];
#if UNITY_2022_1_OR_NEWER
// In Unity 2022.1 we can use a new utility class which is more robust.
if (GizmoUtility.TryGetGizmoInfo(group.type, out var gizmoInfo)) {
group.enabled = gizmoInfo.gizmoEnabled;
} else {
group.enabled = true;
}
#else
// We take advantage of the fact that IsGizmosAllowedForObject only depends on the type of the object and if it is active and enabled
// and not the specific object instance.
// When using a render pipeline the ShouldDrawGizmos method cannot be used because it seems to occasionally crash Unity :(
// So we need these two separate cases.
if (!usingRenderPipeline) {
group.enabled = false;
for (int j = group.drawers.Count - 1; j >= 0; j--) {
// Find the first active and enabled drawer
if ((group.drawers[j] as MonoBehaviour).isActiveAndEnabled) {
group.enabled = ShouldDrawGizmos((UnityEngine.Object)group.drawers[j]);
break;
}
}
} else {
group.enabled = true;
}
#endif
gizmoDrawers[i] = group;
}
MarkerGizmosAllowed.End();
// Set the current frame's redraw scope to an empty scope.
// This is because gizmos are rendered every frame anyway so we never want to redraw them.
// The frame redraw scope is otherwise used when the game has been paused.
var frameRedrawScope = gizmos.frameRedrawScope;
gizmos.frameRedrawScope = default(RedrawScope);
#if UNITY_EDITOR && UNITY_2020_1_OR_NEWER
var currentStage = StageUtility.GetCurrentStage();
var isInNonMainStage = currentStage != StageUtility.GetMainStage();
var currentStageHandle = currentStage.stageHandle;
#endif
// This would look nicer as a 'using' block, but built-in command builders
// cannot be disposed normally to prevent user error.
// The try-finally is equivalent to a 'using' block.
var gizmoBuilder = gizmos.GetBuiltInBuilder();
// Replace Draw.builder with a custom one just for gizmos
var debugBuilder = Draw.builder;
MarkerDrawGizmos.Begin();
GizmoContext.drawingGizmos = true;
try {
Draw.builder = gizmoBuilder;
for (int i = gizmoDrawers.Count - 1; i >= 0; i--) {
var group = gizmoDrawers[i];
if (group.enabled && group.drawers.Count > 0) {
group.profilerMarker.Begin();
for (int j = group.drawers.Count - 1; j >= 0; j--) {
var mono = group.drawers[j] as MonoBehaviour;
if (!mono.isActiveAndEnabled || (mono.hideFlags & HideFlags.HideInHierarchy) != 0) continue;
#if UNITY_EDITOR && UNITY_2020_1_OR_NEWER
// True if the scene is in isolation mode (e.g. focusing on a single prefab) and this object is not part of that sub-stage
var disabledDueToIsolationMode = isInNonMainStage && !currentStageHandle.Contains(mono.gameObject);
if (disabledDueToIsolationMode) continue;
#endif
try {
group.drawers[j].DrawGizmos();
} catch (System.Exception e) {
Debug.LogException(e, mono);
}
}
group.profilerMarker.End();
}
}
} finally {
GizmoContext.drawingGizmos = false;
MarkerDrawGizmos.End();
// Revert to the original builder
Draw.builder = debugBuilder;
gizmoBuilder.DisposeInternal();
}
gizmos.frameRedrawScope = frameRedrawScope;
// Schedule jobs that may have been scheduled while drawing gizmos
JobHandle.ScheduleBatchedJobs();
}
#endif
/// <summary>Submit a camera for rendering.</summary>
/// <param name="allowCameraDefault">Indicates if built-in command builders and custom ones without a custom CommandBuilder.cameraTargets should render to this camera.</param>
void Submit (Camera camera, DrawingData.CommandBufferWrapper cmd, bool usingRenderPipeline, bool allowCameraDefault) {
#if UNITY_EDITOR
bool drawGizmos = Handles.ShouldRenderGizmos() || drawToAllCameras;
// Only build gizmos if a camera actually needs them.
// This is only done for the first camera that needs them each frame.
if (drawGizmos && !builtGizmos && allowCameraDefault) {
RemoveDestroyedGizmoDrawers();
lastFilterFrame = Time.frameCount;
builtGizmos = true;
DrawGizmos(usingRenderPipeline);
}
#else
bool drawGizmos = false;
#endif
MarkerSubmitGizmos.Begin();
Draw.builder.DisposeInternal();
Draw.ingame_builder.DisposeInternal();
gizmos.Render(camera, drawGizmos, cmd, allowCameraDefault);
Draw.builder = gizmos.GetBuiltInBuilder(false);
Draw.ingame_builder = gizmos.GetBuiltInBuilder(true);
MarkerSubmitGizmos.End();
}
/// <summary>
/// Registers an object for gizmo drawing.
/// The DrawGizmos method on the object will be called every frame until it is destroyed (assuming there are cameras with gizmos enabled).
/// </summary>
public static void Register (IDrawGizmos item) {
var tp = item.GetType();
int index;
if (gizmoDrawerIndices.TryGetValue(tp, out index)) {
} else {
// Use reflection to figure out if the DrawGizmos method has not been overriden from the MonoBehaviourGizmos class.
// If it hasn't, then we know that this type will never draw gizmos and we can skip it.
// This improves performance by not having to keep track of objects and check if they are active and enabled every frame.
var flags = System.Reflection.BindingFlags.Instance | System.Reflection.BindingFlags.Public | System.Reflection.BindingFlags.NonPublic;
// Check for a public method first, and then an explicit interface implementation.
var m = tp.GetMethod("DrawGizmos", flags) ?? tp.GetMethod("Pathfinding.Drawing.IDrawGizmos.DrawGizmos", flags) ?? tp.GetMethod("Drawing.IDrawGizmos.DrawGizmos", flags);
if (m == null) {
throw new System.Exception("Could not find the DrawGizmos method in type " + tp.Name);
}
var mayDrawGizmos = m.DeclaringType != typeof(MonoBehaviourGizmos);
if (mayDrawGizmos) {
index = gizmoDrawerIndices[tp] = gizmoDrawers.Count;
gizmoDrawers.Add(new GizmoDrawerGroup {
type = tp,
enabled = true,
drawers = new List<IDrawGizmos>(),
profilerMarker = new ProfilerMarker(ProfilerCategory.Render, "Gizmos for " + tp.Name),
});
} else {
index = gizmoDrawerIndices[tp] = -1;
}
}
if (index == -1) return;
gizmoDrawers[index].drawers.Add(item);
}
/// <summary>
/// Get an empty builder for queuing drawing commands.
///
/// <code>
/// // Create a new CommandBuilder
/// using (var draw = DrawingManager.GetBuilder()) {
/// // Use the exact same API as the global Draw class
/// draw.WireBox(Vector3.zero, Vector3.one);
/// }
/// </code>
/// See: <see cref="Drawing.CommandBuilder"/>
/// </summary>
/// <param name="renderInGame">If true, this builder will be rendered in standalone games and in the editor even if gizmos are disabled.
/// If false, it will only be rendered in the editor when gizmos are enabled.</param>
public static CommandBuilder GetBuilder(bool renderInGame = false) => instance.gizmos.GetBuilder(renderInGame);
/// <summary>
/// Get an empty builder for queuing drawing commands.
///
/// See: <see cref="Drawing.CommandBuilder"/>
/// </summary>
/// <param name="redrawScope">Scope for this command builder. See #GetRedrawScope.</param>
/// <param name="renderInGame">If true, this builder will be rendered in standalone games and in the editor even if gizmos are disabled.
/// If false, it will only be rendered in the editor when gizmos are enabled.</param>
public static CommandBuilder GetBuilder(RedrawScope redrawScope, bool renderInGame = false) => instance.gizmos.GetBuilder(redrawScope, renderInGame);
/// <summary>
/// Get an empty builder for queuing drawing commands.
/// TODO: Example usage.
///
/// See: <see cref="Drawing.CommandBuilder"/>
/// </summary>
/// <param name="hasher">Hash of whatever inputs you used to generate the drawing data.</param>
/// <param name="redrawScope">Scope for this command builder. See #GetRedrawScope.</param>
/// <param name="renderInGame">If true, this builder will be rendered in standalone games and in the editor even if gizmos are disabled.</param>
public static CommandBuilder GetBuilder(DrawingData.Hasher hasher, RedrawScope redrawScope = default, bool renderInGame = false) => instance.gizmos.GetBuilder(hasher, redrawScope, renderInGame);
/// <summary>
/// A scope which can be used to draw things over multiple frames.
///
/// You can use <see cref="GetBuilder(RedrawScope,bool)"/> to get a builder with a given redraw scope.
/// Everything drawn using the redraw scope will be drawn every frame until the redraw scope is disposed.
///
/// <code>
/// private RedrawScope redrawScope;
///
/// void Start () {
/// redrawScope = DrawingManager.GetRedrawScope();
/// using (var builder = DrawingManager.GetBuilder(redrawScope)) {
/// builder.WireSphere(Vector3.zero, 1.0f, Color.red);
/// }
/// }
///
/// void OnDestroy () {
/// redrawScope.Dispose();
/// }
/// </code>
/// </summary>
/// <param name="associatedGameObject">If not null, the scope will only be drawn if gizmos for the associated GameObject are drawn.
/// This is useful in the unity editor when e.g. opening a prefab in isolation mode, to disable redraw scopes for objects outside the prefab. Has no effect in standalone builds.</param>
public static RedrawScope GetRedrawScope (GameObject associatedGameObject = null) {
var scope = new RedrawScope(instance.gizmos);
scope.DrawUntilDispose(associatedGameObject);
return scope;
}
}
}

View File

@@ -0,0 +1,18 @@
fileFormatVersion: 2
guid: 9d8985ed50b5b4de0b58ae195b816e07
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 10000
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
AssetOrigin:
serializedVersion: 1
productId: 162772
packageName: ALINE
packageVersion: 1.7.6
assetPath: Packages/com.arongranberg.aline/DrawingManager.cs
uploadId: 700292

View File

@@ -0,0 +1,74 @@
#pragma warning disable CS0169, CS0414 // The field 'DrawingSettings.version' is never used
using UnityEditor;
using UnityEngine;
namespace Drawing {
/// <summary>Stores ALINE project settings</summary>
public class DrawingSettings : ScriptableObject {
public const string SettingsPathCompatibility = "Assets/Settings/ALINE.asset";
public const string SettingsName = "ALINE";
public const string SettingsPath = "Assets/Settings/Resources/" + SettingsName + ".asset";
/// <summary>Stores ALINE project settings</summary>
[System.Serializable]
public class Settings {
/// <summary>Opacity of lines when in front of objects</summary>
public float lineOpacity = 1.0f;
/// <summary>Opacity of solid objects when in front of other objects</summary>
public float solidOpacity = 0.55f;
/// <summary>Opacity of text when in front of other objects</summary>
public float textOpacity = 1.0f;
/// <summary>Additional opacity multiplier of lines when behind or inside objects</summary>
public float lineOpacityBehindObjects = 0.12f;
/// <summary>Additional opacity multiplier of solid objects when behind or inside other objects</summary>
public float solidOpacityBehindObjects = 0.45f;
/// <summary>Additional opacity multiplier of text when behind or inside other objects</summary>
public float textOpacityBehindObjects = 0.9f;
/// <summary>
/// Resolution of curves, as a fraction of the default.
///
/// The resolution of curves is dynamic based on the distance to the camera.
/// This setting will make the curves higher or lower resolution by a factor from the default.
/// </summary>
public float curveResolution = 1.0f;
}
[SerializeField]
private int version;
public Settings settings;
public static Settings DefaultSettings => new Settings();
public static DrawingSettings GetSettingsAsset () {
#if UNITY_EDITOR
System.IO.Directory.CreateDirectory(Application.dataPath + "/../" + System.IO.Path.GetDirectoryName(SettingsPath));
var settings = AssetDatabase.LoadAssetAtPath<DrawingSettings>(SettingsPath);
if (settings == null && AssetDatabase.LoadAssetAtPath<DrawingSettings>(SettingsPathCompatibility) != null) {
AssetDatabase.MoveAsset(SettingsPathCompatibility, SettingsPath);
settings = AssetDatabase.LoadAssetAtPath<DrawingSettings>(SettingsPath);
}
if (settings == null) {
settings = ScriptableObject.CreateInstance<DrawingSettings>();
settings.settings = DefaultSettings;
settings.version = 0;
AssetDatabase.CreateAsset(settings, SettingsPath);
AssetDatabase.SaveAssets();
}
#else
var settings = Resources.Load<DrawingSettings>(SettingsName);
#endif
return settings;
}
}
}

View File

@@ -0,0 +1,18 @@
fileFormatVersion: 2
guid: 98e3089fbc7bff2b78412546c703c555
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
AssetOrigin:
serializedVersion: 1
productId: 162772
packageName: ALINE
packageVersion: 1.7.6
assetPath: Packages/com.arongranberg.aline/DrawingSettings.cs
uploadId: 700292

View File

@@ -0,0 +1,122 @@
using UnityEngine;
using Unity.Mathematics;
using Unity.Collections;
using System.Collections.Generic;
namespace Drawing {
/// <summary>Various high-level utilities that are useful when drawing things</summary>
public static class DrawingUtilities {
private static List<Component> componentBuffer = new List<Component>();
/// <summary>
/// Bounding box of a GameObject.
/// Sometimes you want to quickly draw the bounding box of an object. This is not always trivial as the object may have any number of children with colliders and renderers.
/// You can use this method to calculate the bounding box easily.
///
/// The bounding box is calculated based on the colliders and renderers on this object and all its children.
///
/// [Open online documentation to see images]
/// <code>
/// Draw.WireBox(DrawingUtilities.BoundsFrom(transform), Color.black);
/// </code>
///
/// See: <see cref="BoundsFrom(Transform)"/>
/// </summary>
public static Bounds BoundsFrom (GameObject gameObject) {
return BoundsFrom(gameObject.transform);
}
/// <summary>
/// Bounding box of a Transform.
/// Sometimes you want to quickly draw the bounding box of an object. This is not always trivial as the object may have any number of children with colliders and renderers.
/// You can use this method to calculate the bounding box easily.
///
/// The bounding box is calculated based on the colliders and renderers on this object and all its children.
///
/// [Open online documentation to see images]
/// <code>
/// Draw.WireBox(DrawingUtilities.BoundsFrom(transform), Color.black);
/// </code>
///
/// See: <see cref="BoundsFrom(GameObject)"/>
/// </summary>
public static Bounds BoundsFrom (Transform transform) {
transform.gameObject.GetComponents(componentBuffer);
Bounds bounds = new Bounds(transform.position, Vector3.zero);
for (int i = 0; i < componentBuffer.Count; i++) {
var component = componentBuffer[i];
if (component is Collider coll) bounds.Encapsulate(coll.bounds);
else if (component is Collider2D coll2D) bounds.Encapsulate(coll2D.bounds);
else if (component is MeshRenderer rend) bounds.Encapsulate(rend.bounds);
else if (component is SpriteRenderer rendSprite) bounds.Encapsulate(rendSprite.bounds);
}
componentBuffer.Clear();
var children = transform.childCount;
for (int i = 0; i < children; i++) bounds.Encapsulate(BoundsFrom(transform.GetChild(i)));
return bounds;
}
/// <summary>
/// Bounding box which contains all points in the list.
/// <code>
/// List<Vector3> points = new List<Vector3> { new Vector3(0, 0, 0), new Vector3(1, 0, 0), new Vector3(0, 1, 1) };
/// Draw.WireBox(DrawingUtilities.BoundsFrom(points), Color.black);
/// </code>
///
/// See: <see cref="BoundsFrom(Vector3"/>[])
/// See: <see cref="BoundsFrom(NativeArray<float3>)"/>
/// </summary>
public static Bounds BoundsFrom (List<Vector3> points) {
if (points.Count == 0) throw new System.ArgumentException("At least 1 point is required");
Vector3 mn = points[0];
Vector3 mx = points[0];
for (int i = 0; i < points.Count; i++) {
mn = Vector3.Min(mn, points[i]);
mx = Vector3.Max(mx, points[i]);
}
return new Bounds((mx + mn) * 0.5f, (mx - mn) * 0.5f);
}
/// <summary>
/// Bounding box which contains all points in the array.
/// <code>
/// List<Vector3> points = new List<Vector3> { new Vector3(0, 0, 0), new Vector3(1, 0, 0), new Vector3(0, 1, 1) };
/// Draw.WireBox(DrawingUtilities.BoundsFrom(points), Color.black);
/// </code>
///
/// See: <see cref="BoundsFrom(List<Vector3>)"/>
/// See: <see cref="BoundsFrom(NativeArray<float3>)"/>
/// </summary>
public static Bounds BoundsFrom (Vector3[] points) {
if (points.Length == 0) throw new System.ArgumentException("At least 1 point is required");
Vector3 mn = points[0];
Vector3 mx = points[0];
for (int i = 0; i < points.Length; i++) {
mn = Vector3.Min(mn, points[i]);
mx = Vector3.Max(mx, points[i]);
}
return new Bounds((mx + mn) * 0.5f, (mx - mn) * 0.5f);
}
/// <summary>
/// Bounding box which contains all points in the array.
/// <code>
/// List<Vector3> points = new List<Vector3> { new Vector3(0, 0, 0), new Vector3(1, 0, 0), new Vector3(0, 1, 1) };
/// Draw.WireBox(DrawingUtilities.BoundsFrom(points), Color.black);
/// </code>
///
/// See: <see cref="BoundsFrom(List<Vector3>)"/>
/// See: <see cref="BoundsFrom(Vector3"/>[])
/// </summary>
public static Bounds BoundsFrom (NativeArray<float3> points) {
if (points.Length == 0) throw new System.ArgumentException("At least 1 point is required");
float3 mn = points[0];
float3 mx = points[0];
for (int i = 0; i < points.Length; i++) {
mn = math.min(mn, points[i]);
mx = math.max(mx, points[i]);
}
return new Bounds((mx + mn) * 0.5f, (mx - mn) * 0.5f);
}
}
}

View File

@@ -0,0 +1,18 @@
fileFormatVersion: 2
guid: 8a836e4970215f18d8cb80d14ea06344
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
AssetOrigin:
serializedVersion: 1
productId: 162772
packageName: ALINE
packageVersion: 1.7.6
assetPath: Packages/com.arongranberg.aline/DrawingUtilities.cs
uploadId: 700292

View File

@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 101b6a55216144cd69830185b92ea409
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,40 @@
{
"name": "ALINEEditor",
"rootNamespace": "",
"references": [
"GUID:de4e6084e6d474788bb8c799d6b461ec",
"GUID:774e21169c4ac4ec8a01db9cdb98d33b",
"GUID:f4059aaf6c60a4a58a177a2609feb769"
],
"includePlatforms": [
"Editor"
],
"excludePlatforms": [],
"allowUnsafeCode": false,
"overrideReferences": true,
"precompiledReferences": [],
"autoReferenced": true,
"defineConstraints": [
"MODULE_BURST",
"MODULE_MATHEMATICS",
"MODULE_COLLECTIONS"
],
"versionDefines": [
{
"name": "com.unity.burst",
"expression": "1.2.1-preview",
"define": "MODULE_BURST"
},
{
"name": "com.unity.mathematics",
"expression": "1.1.0",
"define": "MODULE_MATHEMATICS"
},
{
"name": "com.unity.collections",
"expression": "0.4.0-preview",
"define": "MODULE_COLLECTIONS"
}
],
"noEngineReferences": false
}

View File

@@ -0,0 +1,14 @@
fileFormatVersion: 2
guid: cc297fb7ca30549a8b58bbc1a40d808b
AssemblyDefinitionImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
AssetOrigin:
serializedVersion: 1
productId: 162772
packageName: ALINE
packageVersion: 1.7.6
assetPath: Packages/com.arongranberg.aline/Editor/DrawingEditor.asmdef
uploadId: 700292

View File

@@ -0,0 +1,19 @@
using UnityEngine;
using System.Collections;
using UnityEditor;
namespace Drawing {
[CustomEditor(typeof(DrawingManager))]
public class DrawingManagerEditor : Editor {
// Use this for initialization
void Start () {
}
// Update is called once per frame
void Update () {
}
void OnSceneGUI () {
}
}
}

View File

@@ -0,0 +1,18 @@
fileFormatVersion: 2
guid: 981b658cf08ad4167af47647e3861f3d
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
AssetOrigin:
serializedVersion: 1
productId: 162772
packageName: ALINE
packageVersion: 1.7.6
assetPath: Packages/com.arongranberg.aline/Editor/DrawingManagerEditor.cs
uploadId: 700292

View File

@@ -0,0 +1,60 @@
using System.Collections.Generic;
using UnityEditor;
using UnityEngine;
namespace Drawing {
/// <summary>Helper for adding project settings</summary>
static class ALINESettingsRegister {
const string PROVIDER_PATH = "Project/ALINE";
const string SETTINGS_LABEL = "ALINE";
[SettingsProvider]
public static SettingsProvider CreateMyCustomSettingsProvider () {
// First parameter is the path in the Settings window.
// Second parameter is the scope of this setting: it only appears in the Project Settings window.
var provider = new SettingsProvider(PROVIDER_PATH, SettingsScope.Project) {
// By default the last token of the path is used as display name if no label is provided.
label = SETTINGS_LABEL,
guiHandler = (searchContext) =>
{
var settings = new SerializedObject(DrawingSettings.GetSettingsAsset());
EditorGUILayout.HelpBox("Opacity of lines, solid objects and text drawn using ALINE. When drawing behind other objects, an additional opacity multiplier is applied.", MessageType.None);
EditorGUILayout.Separator();
EditorGUILayout.LabelField("Lines", EditorStyles.boldLabel);
EditorGUILayout.Slider(settings.FindProperty("settings.lineOpacity"), 0, 1, new GUIContent("Opacity", "Opacity of lines when in front of objects"));
EditorGUILayout.Slider(settings.FindProperty("settings.lineOpacityBehindObjects"), 0, 1, new GUIContent("Opacity (occluded)", "Additional opacity multiplier of lines when behind or inside objects"));
EditorGUILayout.Separator();
EditorGUILayout.LabelField("Solids", EditorStyles.boldLabel);
EditorGUILayout.Slider(settings.FindProperty("settings.solidOpacity"), 0, 1, new GUIContent("Opacity", "Opacity of solid objects when in front of other objects"));
EditorGUILayout.Slider(settings.FindProperty("settings.solidOpacityBehindObjects"), 0, 1, new GUIContent("Opacity (occluded)", "Additional opacity multiplier of solid objects when behind or inside other objects"));
EditorGUILayout.Separator();
EditorGUILayout.LabelField("Text", EditorStyles.boldLabel);
EditorGUILayout.Slider(settings.FindProperty("settings.textOpacity"), 0, 1, new GUIContent("Opacity", "Opacity of text when in front of other objects"));
EditorGUILayout.Slider(settings.FindProperty("settings.textOpacityBehindObjects"), 0, 1, new GUIContent("Opacity (occluded)", "Additional opacity multiplier of text when behind or inside other objects"));
EditorGUILayout.Separator();
EditorGUILayout.Slider(settings.FindProperty("settings.curveResolution"), 0.1f, 3f, new GUIContent("Curve resolution", "Higher values will make curves smoother, but also a bit slower to draw."));
settings.ApplyModifiedProperties();
if (GUILayout.Button("Reset to default")) {
var def = DrawingSettings.DefaultSettings;
var current = DrawingSettings.GetSettingsAsset();
current.settings.lineOpacity = def.lineOpacity;
current.settings.lineOpacityBehindObjects = def.lineOpacityBehindObjects;
current.settings.solidOpacity = def.solidOpacity;
current.settings.solidOpacityBehindObjects = def.solidOpacityBehindObjects;
current.settings.textOpacity = def.textOpacity;
current.settings.textOpacityBehindObjects = def.textOpacityBehindObjects;
current.settings.curveResolution = def.curveResolution;
EditorUtility.SetDirty(current);
}
},
// Populate the search keywords to enable smart search filtering and label highlighting:
keywords = new HashSet<string>(new[] { "Drawing", "Wire", "aline", "opacity" })
};
return provider;
}
}
}

View File

@@ -0,0 +1,18 @@
fileFormatVersion: 2
guid: 82a30ddb6b38ed2f68348d601bc43a2b
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
AssetOrigin:
serializedVersion: 1
productId: 162772
packageName: ALINE
packageVersion: 1.7.6
assetPath: Packages/com.arongranberg.aline/Editor/DrawingSettingsEditor.cs
uploadId: 700292

View File

@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: d8c7301afc4acdc858517ae4b27caed6
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,68 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using Drawing;
namespace Drawing.Examples {
[HelpURL("http://arongranberg.com/aline/documentation/stable/gizmocharacterexample.html")]
public class GizmoCharacterExample : MonoBehaviourGizmos {
public Color gizmoColor = new Color(1.0f, 88/255f, 85/255f);
public Color gizmoColor2 = new Color(79/255f, 204/255f, 237/255f);
public float movementNoiseScale = 0.2f;
public float startPointAttractionStrength = 0.05f;
public int futurePathPlotSteps = 100;
public int plotStartStep = 10;
public int plotEveryNSteps = 10;
float seed;
Vector3 startPosition;
void Start () {
seed = Random.value * 1000;
startPosition = transform.position;
}
Vector3 GetSmoothRandomVelocity (float time, Vector3 position) {
// Use perlin noise to get a smoothly varying vector
float t = time * movementNoiseScale + seed;
var dx = 2*Mathf.PerlinNoise(t, t + 5341.23145f) - 1;
var dy = 2*Mathf.PerlinNoise(t + 92.9842f, -t + 231.85145f) - 1;
var velocity = new Vector3(dx, 0, dy);
// Make a weak attractor to the start position of the agent. To make sure the agent doesn't move too far out of view
velocity += (startPosition - position) * startPointAttractionStrength;
velocity.y = 0;
return velocity;
}
void PlotFuturePath (float time, Vector3 position) {
float dt = 0.05f;
for (int i = 0; i < futurePathPlotSteps; i++) {
var v = GetSmoothRandomVelocity(time + i*dt, position);
var idx = i - plotStartStep;
if (idx >= 0 && idx % plotEveryNSteps == 0) {
Draw.Arrowhead(position, v, 0.1f, gizmoColor);
}
position += v.normalized * dt;
}
}
// Update is called once per frame
void Update () {
PlotFuturePath(Time.time, transform.position);
Vector3 velocity = GetSmoothRandomVelocity(Time.time, transform.position);
transform.rotation = Quaternion.LookRotation(velocity);
transform.position += transform.forward * Time.deltaTime;
}
public override void DrawGizmos () {
using (Draw.InLocalSpace(transform)) {
Draw.WireCylinder(Vector3.zero, Vector3.up, 2, 0.5f, gizmoColor);
Draw.ArrowheadArc(Vector3.zero, Vector3.forward, 0.55f, gizmoColor);
Draw.Label2D(Vector3.zero, gameObject.name, 14, LabelAlignment.TopCenter.withPixelOffset(0, -20), gizmoColor2);
}
}
}
}

View File

@@ -0,0 +1,18 @@
fileFormatVersion: 2
guid: 86a04982b51a0147baaffa53499dffe4
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
AssetOrigin:
serializedVersion: 1
productId: 162772
packageName: ALINE
packageVersion: 1.7.6
assetPath: Packages/com.arongranberg.aline/ExampleScenes~/Example1_Gizmos/GizmoCharacterExample.cs
uploadId: 700292

View File

@@ -0,0 +1,60 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using Drawing;
using System.Linq;
namespace Drawing.Examples {
[HelpURL("http://arongranberg.com/aline/documentation/stable/gizmosphereexample.html")]
public class GizmoSphereExample : MonoBehaviourGizmos {
public Color gizmoColor = new Color(1.0f, 88/255f, 85/255f);
public Color gizmoColor2 = new Color(79/255f, 204/255f, 237/255f);
public override void DrawGizmos () {
using (Draw.InLocalSpace(transform)) {
Draw.WireSphere(Vector3.zero, 0.5f, gizmoColor);
foreach (var contact in contactForces.Values) {
Draw.Circle(contact.lastPoint, contact.lastNormal, 0.1f * contact.impulse, gizmoColor2);
Draw.SolidCircle(contact.lastPoint, contact.lastNormal, 0.1f * contact.impulse, gizmoColor2);
}
}
}
void FixedUpdate () {
foreach (var collider in contactForces.Keys.ToList()) {
var c = contactForces[collider];
if (c.impulse > 0.1f) {
c.impulse = Mathf.Lerp(c.impulse, 0, 10 * Time.fixedDeltaTime);
c.smoothImpulse = Mathf.Lerp(c.impulse, c.smoothImpulse, 20 * Time.fixedDeltaTime);
contactForces[collider] = c;
} else {
contactForces.Remove(collider);
}
}
}
struct Contact {
public float impulse;
public float smoothImpulse;
public Vector3 lastPoint;
public Vector3 lastNormal;
}
Dictionary<Collider, Contact> contactForces = new Dictionary<Collider, Contact>();
void OnCollisionStay (Collision collision) {
foreach (ContactPoint contact in collision.contacts) {
if (!contactForces.ContainsKey(collision.collider)) {
contactForces.Add(collision.collider, new Contact { impulse = 2f });
}
var c = contactForces[collision.collider];
c.impulse = Mathf.Max(c.impulse, 1);
c.lastPoint = transform.InverseTransformPoint(contact.point);
c.lastNormal = transform.InverseTransformVector(contact.normal);
contactForces[collision.collider] = c;
break;
}
}
}
}

View File

@@ -0,0 +1,18 @@
fileFormatVersion: 2
guid: 84c113b72590d07009ea8faf533e132d
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
AssetOrigin:
serializedVersion: 1
productId: 162772
packageName: ALINE
packageVersion: 1.7.6
assetPath: Packages/com.arongranberg.aline/ExampleScenes~/Example1_Gizmos/GizmoSphereExample.cs
uploadId: 700292

View File

@@ -0,0 +1,992 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!29 &1
OcclusionCullingSettings:
m_ObjectHideFlags: 0
serializedVersion: 2
m_OcclusionBakeSettings:
smallestOccluder: 5
smallestHole: 0.25
backfaceThreshold: 100
m_SceneGUID: 00000000000000000000000000000000
m_OcclusionCullingData: {fileID: 0}
--- !u!104 &2
RenderSettings:
m_ObjectHideFlags: 0
serializedVersion: 9
m_Fog: 0
m_FogColor: {r: 0.5, g: 0.5, b: 0.5, a: 1}
m_FogMode: 3
m_FogDensity: 0.01
m_LinearFogStart: 0
m_LinearFogEnd: 300
m_AmbientSkyColor: {r: 0.212, g: 0.227, b: 0.259, a: 1}
m_AmbientEquatorColor: {r: 0.114, g: 0.125, b: 0.133, a: 1}
m_AmbientGroundColor: {r: 0.047, g: 0.043, b: 0.035, a: 1}
m_AmbientIntensity: 1
m_AmbientMode: 0
m_SubtractiveShadowColor: {r: 0.42, g: 0.478, b: 0.627, a: 1}
m_SkyboxMaterial: {fileID: 0}
m_HaloStrength: 0.5
m_FlareStrength: 1
m_FlareFadeSpeed: 3
m_HaloTexture: {fileID: 0}
m_SpotCookie: {fileID: 10001, guid: 0000000000000000e000000000000000, type: 0}
m_DefaultReflectionMode: 0
m_DefaultReflectionResolution: 128
m_ReflectionBounces: 1
m_ReflectionIntensity: 1
m_CustomReflection: {fileID: 0}
m_Sun: {fileID: 0}
m_IndirectSpecularColor: {r: 262.33698, g: 325.04984, b: 430.21927, a: 1}
m_UseRadianceAmbientProbe: 0
--- !u!157 &3
LightmapSettings:
m_ObjectHideFlags: 0
serializedVersion: 12
m_GIWorkflowMode: 1
m_GISettings:
serializedVersion: 2
m_BounceScale: 1
m_IndirectOutputScale: 1
m_AlbedoBoost: 1
m_EnvironmentLightingMode: 0
m_EnableBakedLightmaps: 1
m_EnableRealtimeLightmaps: 0
m_LightmapEditorSettings:
serializedVersion: 12
m_Resolution: 2
m_BakeResolution: 40
m_AtlasSize: 1024
m_AO: 0
m_AOMaxDistance: 1
m_CompAOExponent: 1
m_CompAOExponentDirect: 0
m_ExtractAmbientOcclusion: 0
m_Padding: 2
m_LightmapParameters: {fileID: 0}
m_LightmapsBakeMode: 1
m_TextureCompression: 1
m_FinalGather: 0
m_FinalGatherFiltering: 1
m_FinalGatherRayCount: 256
m_ReflectionCompression: 2
m_MixedBakeMode: 2
m_BakeBackend: 1
m_PVRSampling: 1
m_PVRDirectSampleCount: 32
m_PVRSampleCount: 512
m_PVRBounces: 2
m_PVREnvironmentSampleCount: 256
m_PVREnvironmentReferencePointCount: 2048
m_PVRFilteringMode: 1
m_PVRDenoiserTypeDirect: 1
m_PVRDenoiserTypeIndirect: 1
m_PVRDenoiserTypeAO: 1
m_PVRFilterTypeDirect: 0
m_PVRFilterTypeIndirect: 0
m_PVRFilterTypeAO: 0
m_PVREnvironmentMIS: 1
m_PVRCulling: 1
m_PVRFilteringGaussRadiusDirect: 1
m_PVRFilteringGaussRadiusIndirect: 5
m_PVRFilteringGaussRadiusAO: 2
m_PVRFilteringAtrousPositionSigmaDirect: 0.5
m_PVRFilteringAtrousPositionSigmaIndirect: 2
m_PVRFilteringAtrousPositionSigmaAO: 1
m_ExportTrainingData: 0
m_TrainingDataDestination: TrainingData
m_LightProbeSampleCountMultiplier: 4
m_LightingDataAsset: {fileID: 0}
m_LightingSettings: {fileID: 0}
--- !u!196 &4
NavMeshSettings:
serializedVersion: 2
m_ObjectHideFlags: 0
m_BuildSettings:
serializedVersion: 3
agentTypeID: 0
agentRadius: 0.5
agentHeight: 2
agentSlope: 45
agentClimb: 0.4
ledgeDropHeight: 0
maxJumpAcrossDistance: 0
minRegionArea: 2
manualCellSize: 0
cellSize: 0.16666667
manualTileSize: 0
tileSize: 256
buildHeightMesh: 0
maxJobWorkers: 0
preserveTilesOutsideBounds: 0
debug:
m_Flags: 0
m_NavMeshData: {fileID: 0}
--- !u!1 &192188401
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 192188403}
- component: {fileID: 192188402}
m_Layer: 0
m_Name: SphereSpawner
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!114 &192188402
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 192188401}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 83da592052d782924874743bd8b220b8, type: 3}
m_Name:
m_EditorClassIdentifier:
interval: 2
lifeTime: 9
prefab: {fileID: 5946953173117734405, guid: 65c56cea83058d8b0aa9b0c202895c0f, type: 3}
--- !u!4 &192188403
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 192188401}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0.63, y: 4.08, z: 3.79}
m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
m_Children: []
m_Father: {fileID: 0}
m_RootOrder: 7
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!1 &230295530
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 230295532}
- component: {fileID: 230295531}
m_Layer: 0
m_Name: Directional Light
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!108 &230295531
Light:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 230295530}
m_Enabled: 1
serializedVersion: 10
m_Type: 1
m_Shape: 0
m_Color: {r: 1, g: 0.95686275, b: 0.8392157, a: 1}
m_Intensity: 1
m_Range: 10
m_SpotAngle: 30
m_InnerSpotAngle: 21.80208
m_CookieSize: 10
m_Shadows:
m_Type: 2
m_Resolution: -1
m_CustomResolution: -1
m_Strength: 1
m_Bias: 0.05
m_NormalBias: 0.4
m_NearPlane: 0.2
m_CullingMatrixOverride:
e00: 1
e01: 0
e02: 0
e03: 0
e10: 0
e11: 1
e12: 0
e13: 0
e20: 0
e21: 0
e22: 1
e23: 0
e30: 0
e31: 0
e32: 0
e33: 1
m_UseCullingMatrixOverride: 0
m_Cookie: {fileID: 0}
m_DrawHalo: 0
m_Flare: {fileID: 0}
m_RenderMode: 0
m_CullingMask:
serializedVersion: 2
m_Bits: 4294967295
m_RenderingLayerMask: 1
m_Lightmapping: 4
m_LightShadowCasterMode: 0
m_AreaSize: {x: 1, y: 1}
m_BounceIntensity: 1
m_ColorTemperature: 6570
m_UseColorTemperature: 0
m_BoundingSphereOverride: {x: 0, y: 0, z: 0, w: 0}
m_UseBoundingSphereOverride: 0
m_UseViewFrustumForShadowCasterCull: 1
m_ShadowRadius: 0
m_ShadowAngle: 0
--- !u!4 &230295532
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 230295530}
m_LocalRotation: {x: 0.40821788, y: -0.23456968, z: 0.10938163, w: 0.8754261}
m_LocalPosition: {x: 0, y: 3, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
m_Children: []
m_Father: {fileID: 0}
m_RootOrder: 1
m_LocalEulerAnglesHint: {x: 50, y: -30, z: 0}
--- !u!1 &583847001
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 583847002}
- component: {fileID: 583847005}
- component: {fileID: 583847004}
- component: {fileID: 583847003}
m_Layer: 0
m_Name: Cylinder
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!4 &583847002
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 583847001}
m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
m_LocalPosition: {x: 0, y: 1, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
m_Children: []
m_Father: {fileID: 2002389224}
m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!136 &583847003
CapsuleCollider:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 583847001}
m_Material: {fileID: 0}
m_IncludeLayers:
serializedVersion: 2
m_Bits: 0
m_ExcludeLayers:
serializedVersion: 2
m_Bits: 0
m_LayerOverridePriority: 0
m_IsTrigger: 0
m_ProvidesContacts: 0
m_Enabled: 1
serializedVersion: 2
m_Radius: 0.5000001
m_Height: 2
m_Direction: 1
m_Center: {x: 0.000000059604645, y: 0, z: -0.00000008940697}
--- !u!23 &583847004
MeshRenderer:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 583847001}
m_Enabled: 1
m_CastShadows: 1
m_ReceiveShadows: 1
m_DynamicOccludee: 1
m_StaticShadowCaster: 0
m_MotionVectors: 1
m_LightProbeUsage: 1
m_ReflectionProbeUsage: 1
m_RayTracingMode: 2
m_RayTraceProcedural: 0
m_RenderingLayerMask: 1
m_RendererPriority: 0
m_Materials:
- {fileID: 10303, guid: 0000000000000000f000000000000000, type: 0}
m_StaticBatchInfo:
firstSubMesh: 0
subMeshCount: 0
m_StaticBatchRoot: {fileID: 0}
m_ProbeAnchor: {fileID: 0}
m_LightProbeVolumeOverride: {fileID: 0}
m_ScaleInLightmap: 1
m_ReceiveGI: 1
m_PreserveUVs: 0
m_IgnoreNormalsForChartDetection: 0
m_ImportantGI: 0
m_StitchLightmapSeams: 1
m_SelectedEditorRenderState: 3
m_MinimumChartSize: 4
m_AutoUVMaxDistance: 0.5
m_AutoUVMaxAngle: 89
m_LightmapParameters: {fileID: 0}
m_SortingLayerID: 0
m_SortingLayer: 0
m_SortingOrder: 0
m_AdditionalVertexStreams: {fileID: 0}
--- !u!33 &583847005
MeshFilter:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 583847001}
m_Mesh: {fileID: 10206, guid: 0000000000000000e000000000000000, type: 0}
--- !u!1 &705113141
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 705113145}
- component: {fileID: 705113144}
- component: {fileID: 705113143}
- component: {fileID: 705113142}
m_Layer: 0
m_Name: Plane
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!64 &705113142
MeshCollider:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 705113141}
m_Material: {fileID: 0}
m_IncludeLayers:
serializedVersion: 2
m_Bits: 0
m_ExcludeLayers:
serializedVersion: 2
m_Bits: 0
m_LayerOverridePriority: 0
m_IsTrigger: 0
m_ProvidesContacts: 0
m_Enabled: 1
serializedVersion: 5
m_Convex: 0
m_CookingOptions: 30
m_Mesh: {fileID: 10209, guid: 0000000000000000e000000000000000, type: 0}
--- !u!23 &705113143
MeshRenderer:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 705113141}
m_Enabled: 1
m_CastShadows: 1
m_ReceiveShadows: 1
m_DynamicOccludee: 1
m_StaticShadowCaster: 0
m_MotionVectors: 1
m_LightProbeUsage: 1
m_ReflectionProbeUsage: 1
m_RayTracingMode: 2
m_RayTraceProcedural: 0
m_RenderingLayerMask: 1
m_RendererPriority: 0
m_Materials:
- {fileID: 2100000, guid: 08a6f092a8c8ebed7a8fbab012924ca1, type: 2}
m_StaticBatchInfo:
firstSubMesh: 0
subMeshCount: 0
m_StaticBatchRoot: {fileID: 0}
m_ProbeAnchor: {fileID: 0}
m_LightProbeVolumeOverride: {fileID: 0}
m_ScaleInLightmap: 1
m_ReceiveGI: 1
m_PreserveUVs: 0
m_IgnoreNormalsForChartDetection: 0
m_ImportantGI: 0
m_StitchLightmapSeams: 1
m_SelectedEditorRenderState: 3
m_MinimumChartSize: 4
m_AutoUVMaxDistance: 0.5
m_AutoUVMaxAngle: 89
m_LightmapParameters: {fileID: 0}
m_SortingLayerID: 0
m_SortingLayer: 0
m_SortingOrder: 0
m_AdditionalVertexStreams: {fileID: 0}
--- !u!33 &705113144
MeshFilter:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 705113141}
m_Mesh: {fileID: 10209, guid: 0000000000000000e000000000000000, type: 0}
--- !u!4 &705113145
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 705113141}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 10, y: 10, z: 10}
m_ConstrainProportionsScale: 0
m_Children: []
m_Father: {fileID: 0}
m_RootOrder: 2
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!1 &1002646307
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 1002646311}
- component: {fileID: 1002646310}
- component: {fileID: 1002646309}
- component: {fileID: 1002646308}
m_Layer: 0
m_Name: Cube
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!65 &1002646308
BoxCollider:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1002646307}
m_Material: {fileID: 0}
m_IncludeLayers:
serializedVersion: 2
m_Bits: 0
m_ExcludeLayers:
serializedVersion: 2
m_Bits: 0
m_LayerOverridePriority: 0
m_IsTrigger: 0
m_ProvidesContacts: 0
m_Enabled: 1
serializedVersion: 3
m_Size: {x: 1, y: 1, z: 1}
m_Center: {x: 0, y: 0, z: 0}
--- !u!23 &1002646309
MeshRenderer:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1002646307}
m_Enabled: 1
m_CastShadows: 1
m_ReceiveShadows: 1
m_DynamicOccludee: 1
m_StaticShadowCaster: 0
m_MotionVectors: 1
m_LightProbeUsage: 1
m_ReflectionProbeUsage: 1
m_RayTracingMode: 2
m_RayTraceProcedural: 0
m_RenderingLayerMask: 1
m_RendererPriority: 0
m_Materials:
- {fileID: 2100000, guid: 08a6f092a8c8ebed7a8fbab012924ca1, type: 2}
m_StaticBatchInfo:
firstSubMesh: 0
subMeshCount: 0
m_StaticBatchRoot: {fileID: 0}
m_ProbeAnchor: {fileID: 0}
m_LightProbeVolumeOverride: {fileID: 0}
m_ScaleInLightmap: 1
m_ReceiveGI: 1
m_PreserveUVs: 0
m_IgnoreNormalsForChartDetection: 0
m_ImportantGI: 0
m_StitchLightmapSeams: 1
m_SelectedEditorRenderState: 3
m_MinimumChartSize: 4
m_AutoUVMaxDistance: 0.5
m_AutoUVMaxAngle: 89
m_LightmapParameters: {fileID: 0}
m_SortingLayerID: 0
m_SortingLayer: 0
m_SortingOrder: 0
m_AdditionalVertexStreams: {fileID: 0}
--- !u!33 &1002646310
MeshFilter:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1002646307}
m_Mesh: {fileID: 10202, guid: 0000000000000000e000000000000000, type: 0}
--- !u!4 &1002646311
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1002646307}
m_LocalRotation: {x: 0, y: 0, z: -0.08715578, w: 0.9961947}
m_LocalPosition: {x: -1.48, y: 0.16, z: 4.050228}
m_LocalScale: {x: 4, y: 0.1, z: 4}
m_ConstrainProportionsScale: 0
m_Children: []
m_Father: {fileID: 0}
m_RootOrder: 5
m_LocalEulerAnglesHint: {x: 0, y: 0, z: -10}
--- !u!1 &1474191398
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 1474191400}
- component: {fileID: 1474191399}
m_Layer: 0
m_Name: Character 2
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!114 &1474191399
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1474191398}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 86a04982b51a0147baaffa53499dffe4, type: 3}
m_Name:
m_EditorClassIdentifier:
gizmoColor: {r: 1, g: 0.34509805, b: 0.33333334, a: 1}
gizmoColor2: {r: 0.30980393, g: 0.8, b: 0.92941177, a: 1}
movementNoiseScale: 0.1
startPointAttractionStrength: 0.05
futurePathPlotSteps: 200
plotStartStep: 24
plotEveryNSteps: 10
--- !u!4 &1474191400
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1474191398}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: -5.71, y: 0.09, z: -0.52}
m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
m_Children:
- {fileID: 1637290022}
m_Father: {fileID: 0}
m_RootOrder: 4
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!1 &1512620476
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 1512620480}
- component: {fileID: 1512620479}
- component: {fileID: 1512620478}
- component: {fileID: 1512620477}
m_Layer: 0
m_Name: Cube (1)
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!65 &1512620477
BoxCollider:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1512620476}
m_Material: {fileID: 0}
m_IncludeLayers:
serializedVersion: 2
m_Bits: 0
m_ExcludeLayers:
serializedVersion: 2
m_Bits: 0
m_LayerOverridePriority: 0
m_IsTrigger: 0
m_ProvidesContacts: 0
m_Enabled: 1
serializedVersion: 3
m_Size: {x: 1, y: 1, z: 1}
m_Center: {x: 0, y: 0, z: 0}
--- !u!23 &1512620478
MeshRenderer:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1512620476}
m_Enabled: 1
m_CastShadows: 1
m_ReceiveShadows: 1
m_DynamicOccludee: 1
m_StaticShadowCaster: 0
m_MotionVectors: 1
m_LightProbeUsage: 1
m_ReflectionProbeUsage: 1
m_RayTracingMode: 2
m_RayTraceProcedural: 0
m_RenderingLayerMask: 1
m_RendererPriority: 0
m_Materials:
- {fileID: 2100000, guid: 08a6f092a8c8ebed7a8fbab012924ca1, type: 2}
m_StaticBatchInfo:
firstSubMesh: 0
subMeshCount: 0
m_StaticBatchRoot: {fileID: 0}
m_ProbeAnchor: {fileID: 0}
m_LightProbeVolumeOverride: {fileID: 0}
m_ScaleInLightmap: 1
m_ReceiveGI: 1
m_PreserveUVs: 0
m_IgnoreNormalsForChartDetection: 0
m_ImportantGI: 0
m_StitchLightmapSeams: 1
m_SelectedEditorRenderState: 3
m_MinimumChartSize: 4
m_AutoUVMaxDistance: 0.5
m_AutoUVMaxAngle: 89
m_LightmapParameters: {fileID: 0}
m_SortingLayerID: 0
m_SortingLayer: 0
m_SortingOrder: 0
m_AdditionalVertexStreams: {fileID: 0}
--- !u!33 &1512620479
MeshFilter:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1512620476}
m_Mesh: {fileID: 10202, guid: 0000000000000000e000000000000000, type: 0}
--- !u!4 &1512620480
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1512620476}
m_LocalRotation: {x: -0.08715578, y: 0.9961947, z: -0, w: 0}
m_LocalPosition: {x: 2.89, y: 0.16, z: 4.050228}
m_LocalScale: {x: 4, y: 0.1, z: 4}
m_ConstrainProportionsScale: 0
m_Children: []
m_Father: {fileID: 0}
m_RootOrder: 6
m_LocalEulerAnglesHint: {x: 0, y: 180, z: -10}
--- !u!1 &1637290021
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 1637290022}
- component: {fileID: 1637290025}
- component: {fileID: 1637290024}
- component: {fileID: 1637290023}
m_Layer: 0
m_Name: Cylinder
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!4 &1637290022
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1637290021}
m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
m_LocalPosition: {x: 0, y: 1, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
m_Children: []
m_Father: {fileID: 1474191400}
m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!136 &1637290023
CapsuleCollider:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1637290021}
m_Material: {fileID: 0}
m_IncludeLayers:
serializedVersion: 2
m_Bits: 0
m_ExcludeLayers:
serializedVersion: 2
m_Bits: 0
m_LayerOverridePriority: 0
m_IsTrigger: 0
m_ProvidesContacts: 0
m_Enabled: 1
serializedVersion: 2
m_Radius: 0.5000001
m_Height: 2
m_Direction: 1
m_Center: {x: 0.000000059604645, y: 0, z: -0.00000008940697}
--- !u!23 &1637290024
MeshRenderer:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1637290021}
m_Enabled: 1
m_CastShadows: 1
m_ReceiveShadows: 1
m_DynamicOccludee: 1
m_StaticShadowCaster: 0
m_MotionVectors: 1
m_LightProbeUsage: 1
m_ReflectionProbeUsage: 1
m_RayTracingMode: 2
m_RayTraceProcedural: 0
m_RenderingLayerMask: 1
m_RendererPriority: 0
m_Materials:
- {fileID: 10303, guid: 0000000000000000f000000000000000, type: 0}
m_StaticBatchInfo:
firstSubMesh: 0
subMeshCount: 0
m_StaticBatchRoot: {fileID: 0}
m_ProbeAnchor: {fileID: 0}
m_LightProbeVolumeOverride: {fileID: 0}
m_ScaleInLightmap: 1
m_ReceiveGI: 1
m_PreserveUVs: 0
m_IgnoreNormalsForChartDetection: 0
m_ImportantGI: 0
m_StitchLightmapSeams: 1
m_SelectedEditorRenderState: 3
m_MinimumChartSize: 4
m_AutoUVMaxDistance: 0.5
m_AutoUVMaxAngle: 89
m_LightmapParameters: {fileID: 0}
m_SortingLayerID: 0
m_SortingLayer: 0
m_SortingOrder: 0
m_AdditionalVertexStreams: {fileID: 0}
--- !u!33 &1637290025
MeshFilter:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1637290021}
m_Mesh: {fileID: 10206, guid: 0000000000000000e000000000000000, type: 0}
--- !u!1 &1748995631
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 1748995634}
- component: {fileID: 1748995633}
- component: {fileID: 1748995632}
m_Layer: 0
m_Name: Main Camera
m_TagString: MainCamera
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!81 &1748995632
AudioListener:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1748995631}
m_Enabled: 1
--- !u!20 &1748995633
Camera:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1748995631}
m_Enabled: 1
serializedVersion: 2
m_ClearFlags: 1
m_BackGroundColor: {r: 0.19215687, g: 0.3019608, b: 0.4745098, a: 0}
m_projectionMatrixMode: 1
m_GateFitMode: 2
m_FOVAxisMode: 0
m_Iso: 200
m_ShutterSpeed: 0.005
m_Aperture: 16
m_FocusDistance: 10
m_FocalLength: 50
m_BladeCount: 5
m_Curvature: {x: 2, y: 11}
m_BarrelClipping: 0.25
m_Anamorphism: 0
m_SensorSize: {x: 36, y: 24}
m_LensShift: {x: 0, y: 0}
m_NormalizedViewPortRect:
serializedVersion: 2
x: 0
y: 0
width: 1
height: 1
near clip plane: 0.3
far clip plane: 1000
field of view: 60
orthographic: 0
orthographic size: 5
m_Depth: -1
m_CullingMask:
serializedVersion: 2
m_Bits: 4294967295
m_RenderingPath: -1
m_TargetTexture: {fileID: 0}
m_TargetDisplay: 0
m_TargetEye: 3
m_HDR: 1
m_AllowMSAA: 1
m_AllowDynamicResolution: 0
m_ForceIntoRT: 0
m_OcclusionCulling: 1
m_StereoConvergence: 10
m_StereoSeparation: 0.022
--- !u!4 &1748995634
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1748995631}
m_LocalRotation: {x: 0.3743726, y: -0, z: -0, w: 0.9272784}
m_LocalPosition: {x: 0, y: 11.27, z: -10.38}
m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
m_Children: []
m_Father: {fileID: 0}
m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 43.971, y: 0, z: 0}
--- !u!1 &2002389222
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 2002389224}
- component: {fileID: 2002389223}
m_Layer: 0
m_Name: Character 1
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!114 &2002389223
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 2002389222}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 86a04982b51a0147baaffa53499dffe4, type: 3}
m_Name:
m_EditorClassIdentifier:
gizmoColor: {r: 1, g: 0.34509805, b: 0.33333334, a: 1}
gizmoColor2: {r: 0.30980393, g: 0.8, b: 0.92941177, a: 1}
movementNoiseScale: 0.1
startPointAttractionStrength: 0.05
futurePathPlotSteps: 200
plotStartStep: 24
plotEveryNSteps: 10
--- !u!4 &2002389224
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 2002389222}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 4.61, y: 0.09, z: -0.61}
m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
m_Children:
- {fileID: 583847002}
m_Father: {fileID: 0}
m_RootOrder: 3
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}

View File

@@ -0,0 +1,14 @@
fileFormatVersion: 2
guid: ccca6a74dedafcc409916f9abc480424
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
AssetOrigin:
serializedVersion: 1
productId: 162772
packageName: ALINE
packageVersion: 1.7.6
assetPath: Packages/com.arongranberg.aline/ExampleScenes~/Example1_Gizmos/Gizmos.unity
uploadId: 700292

View File

@@ -0,0 +1,128 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!1 &5946953173117734405
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 5946953173117734424}
- component: {fileID: 5946953173117734425}
- component: {fileID: 5946953173117734406}
- component: {fileID: 5946953173117734407}
- component: {fileID: 5946953173117734404}
- component: {fileID: 467500634026136600}
m_Layer: 0
m_Name: Sphere
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!4 &5946953173117734424
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 5946953173117734405}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0.61605144, y: 2.43, z: 2.4785638}
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: []
m_Father: {fileID: 0}
m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!33 &5946953173117734425
MeshFilter:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 5946953173117734405}
m_Mesh: {fileID: 10207, guid: 0000000000000000e000000000000000, type: 0}
--- !u!23 &5946953173117734406
MeshRenderer:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 5946953173117734405}
m_Enabled: 1
m_CastShadows: 1
m_ReceiveShadows: 1
m_DynamicOccludee: 1
m_MotionVectors: 1
m_LightProbeUsage: 1
m_ReflectionProbeUsage: 1
m_RayTracingMode: 2
m_RenderingLayerMask: 1
m_RendererPriority: 0
m_Materials:
- {fileID: 2100000, guid: 19670a3e053b3d08abfa9302a32e93d9, type: 2}
m_StaticBatchInfo:
firstSubMesh: 0
subMeshCount: 0
m_StaticBatchRoot: {fileID: 0}
m_ProbeAnchor: {fileID: 0}
m_LightProbeVolumeOverride: {fileID: 0}
m_ScaleInLightmap: 1
m_ReceiveGI: 1
m_PreserveUVs: 0
m_IgnoreNormalsForChartDetection: 0
m_ImportantGI: 0
m_StitchLightmapSeams: 1
m_SelectedEditorRenderState: 3
m_MinimumChartSize: 4
m_AutoUVMaxDistance: 0.5
m_AutoUVMaxAngle: 89
m_LightmapParameters: {fileID: 0}
m_SortingLayerID: 0
m_SortingLayer: 0
m_SortingOrder: 0
m_AdditionalVertexStreams: {fileID: 0}
--- !u!135 &5946953173117734407
SphereCollider:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 5946953173117734405}
m_Material: {fileID: 0}
m_IsTrigger: 0
m_Enabled: 1
serializedVersion: 2
m_Radius: 0.5
m_Center: {x: 0, y: 0, z: 0}
--- !u!114 &5946953173117734404
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 5946953173117734405}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 84c113b72590d07009ea8faf533e132d, type: 3}
m_Name:
m_EditorClassIdentifier:
gizmoColor: {r: 1, g: 0.34509805, b: 0.33333334, a: 1}
gizmoColor2: {r: 0.30980393, g: 0.8, b: 0.92941177, a: 1}
--- !u!54 &467500634026136600
Rigidbody:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 5946953173117734405}
serializedVersion: 2
m_Mass: 1
m_Drag: 0
m_AngularDrag: 0.05
m_UseGravity: 1
m_IsKinematic: 0
m_Interpolate: 0
m_Constraints: 0
m_CollisionDetection: 0

View File

@@ -0,0 +1,14 @@
fileFormatVersion: 2
guid: 65c56cea83058d8b0aa9b0c202895c0f
PrefabImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
AssetOrigin:
serializedVersion: 1
productId: 162772
packageName: ALINE
packageVersion: 1.7.6
assetPath: Packages/com.arongranberg.aline/ExampleScenes~/Example1_Gizmos/Sphere.prefab
uploadId: 700292

View File

@@ -0,0 +1,26 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
namespace Drawing.Examples {
[HelpURL("http://arongranberg.com/aline/documentation/stable/timedspawner.html")]
public class TimedSpawner : MonoBehaviour {
public float interval = 1;
public float lifeTime = 5;
public GameObject prefab;
// Start is called before the first frame update
IEnumerator Start () {
while (true) {
var go = GameObject.Instantiate(prefab, transform.position + Random.insideUnitSphere * 0.01f, Random.rotation);
StartCoroutine(DestroyAfter(go, lifeTime));
yield return new WaitForSeconds(interval);
}
}
IEnumerator DestroyAfter (GameObject go, float delay) {
yield return new WaitForSeconds(delay);
GameObject.Destroy(go);
}
}
}

View File

@@ -0,0 +1,18 @@
fileFormatVersion: 2
guid: 83da592052d782924874743bd8b220b8
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
AssetOrigin:
serializedVersion: 1
productId: 162772
packageName: ALINE
packageVersion: 1.7.6
assetPath: Packages/com.arongranberg.aline/ExampleScenes~/Example1_Gizmos/TimedSpawner.cs
uploadId: 700292

View File

@@ -0,0 +1,78 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!21 &2100000
Material:
serializedVersion: 6
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_Name: aline_dark_blue
m_Shader: {fileID: 46, guid: 0000000000000000f000000000000000, type: 0}
m_ShaderKeywords:
m_LightmapFlags: 4
m_EnableInstancingVariants: 0
m_DoubleSidedGI: 0
m_CustomRenderQueue: -1
stringTagMap: {}
disabledShaderPasses: []
m_SavedProperties:
serializedVersion: 3
m_TexEnvs:
- _BumpMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _DetailAlbedoMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _DetailMask:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _DetailNormalMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _EmissionMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _MainTex:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _MetallicGlossMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _OcclusionMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _ParallaxMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
m_Floats:
- _BumpScale: 1
- _Cutoff: 0.5
- _DetailNormalMapScale: 1
- _DstBlend: 0
- _GlossMapScale: 1
- _Glossiness: 0.428
- _GlossyReflections: 1
- _Metallic: 0
- _Mode: 0
- _OcclusionStrength: 1
- _Parallax: 0.02
- _SmoothnessTextureChannel: 0
- _SpecularHighlights: 1
- _SrcBlend: 1
- _UVSec: 0
- _ZWrite: 1
m_Colors:
- _Color: {r: 0.105882354, g: 0.13333334, b: 0.26666668, a: 1}
- _EmissionColor: {r: 0, g: 0, b: 0, a: 1}
m_BuildTextureStacks: []

View File

@@ -0,0 +1,15 @@
fileFormatVersion: 2
guid: 08a6f092a8c8ebed7a8fbab012924ca1
NativeFormatImporter:
externalObjects: {}
mainObjectFileID: 0
userData:
assetBundleName:
assetBundleVariant:
AssetOrigin:
serializedVersion: 1
productId: 162772
packageName: ALINE
packageVersion: 1.7.6
assetPath: Packages/com.arongranberg.aline/ExampleScenes~/Example1_Gizmos/aline_dark_blue.mat
uploadId: 700292

View File

@@ -0,0 +1,79 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!21 &2100000
Material:
serializedVersion: 6
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_Name: aline_transparent_sphere
m_Shader: {fileID: 46, guid: 0000000000000000f000000000000000, type: 0}
m_ShaderKeywords: _ALPHAPREMULTIPLY_ON
m_LightmapFlags: 4
m_EnableInstancingVariants: 0
m_DoubleSidedGI: 0
m_CustomRenderQueue: 3000
stringTagMap:
RenderType: Transparent
disabledShaderPasses: []
m_SavedProperties:
serializedVersion: 3
m_TexEnvs:
- _BumpMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _DetailAlbedoMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _DetailMask:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _DetailNormalMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _EmissionMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _MainTex:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _MetallicGlossMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _OcclusionMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _ParallaxMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
m_Floats:
- _BumpScale: 1
- _Cutoff: 0.5
- _DetailNormalMapScale: 1
- _DstBlend: 10
- _GlossMapScale: 1
- _Glossiness: 0.053
- _GlossyReflections: 1
- _Metallic: 0
- _Mode: 3
- _OcclusionStrength: 1
- _Parallax: 0.02
- _SmoothnessTextureChannel: 0
- _SpecularHighlights: 1
- _SrcBlend: 1
- _UVSec: 0
- _ZWrite: 0
m_Colors:
- _Color: {r: 1, g: 0, b: 0, a: 0.09803922}
- _EmissionColor: {r: 0, g: 0, b: 0, a: 1}
m_BuildTextureStacks: []

View File

@@ -0,0 +1,15 @@
fileFormatVersion: 2
guid: 19670a3e053b3d08abfa9302a32e93d9
NativeFormatImporter:
externalObjects: {}
mainObjectFileID: 0
userData:
assetBundleName:
assetBundleVariant:
AssetOrigin:
serializedVersion: 1
productId: 162772
packageName: ALINE
packageVersion: 1.7.6
assetPath: Packages/com.arongranberg.aline/ExampleScenes~/Example1_Gizmos/aline_transparent_sphere.mat
uploadId: 700292

View File

@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 323ed4400bacc4e69b323e0bccd96d0a
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,65 @@
using System.Collections.Generic;
using UnityEngine;
using Drawing;
namespace Drawing.Examples {
/// <summary>Simple bezier curve editor</summary>
[HelpURL("http://arongranberg.com/aline/documentation/stable/curveeditor.html")]
public class CurveEditor : MonoBehaviour {
List<CurvePoint> curves = new List<CurvePoint>();
Camera cam;
public Color curveColor;
class CurvePoint {
public Vector2 position, controlPoint0, controlPoint1;
}
void Awake () {
cam = Camera.main;
}
void Update () {
// Add a new control point when clicking
if (Input.GetKeyDown(KeyCode.Mouse0)) {
curves.Add(new CurvePoint {
position = (Vector2)Input.mousePosition,
controlPoint0 = Vector2.zero,
controlPoint1 = Vector2.zero,
});
}
// Keep adjusting the position of the control point while the mouse is pressed
if (curves.Count > 0 && Input.GetKey(KeyCode.Mouse0) && ((Vector2)Input.mousePosition - curves[curves.Count - 1].position).magnitude > 2*2) {
var point = curves[curves.Count - 1];
point.controlPoint1 = (Vector2)Input.mousePosition - point.position;
point.controlPoint0 = -point.controlPoint1;
}
Render();
}
void Render () {
// Use a custom builder which renders even in standalone games
// and in the editor even if gizmos are disabled.
// Usually you would use the static Draw class instead.
using (var draw = DrawingManager.GetBuilder(true)) {
// Draw the curves in 2D using pixel coordinates
using (draw.InScreenSpace(cam)) {
// Draw a circle at each curve control point
for (int i = 0; i < curves.Count; i++) {
draw.xy.Circle((Vector3)curves[i].position, 2, Color.blue);
}
// Draw each bezier curve segment
for (int i = 0; i < curves.Count - 1; i++) {
var p0 = curves[i].position;
var p1 = p0 + curves[i].controlPoint1;
var p3 = curves[i+1].position;
var p2 = p3 + curves[i+1].controlPoint0;
draw.Bezier((Vector3)p0, (Vector3)p1, (Vector3)p2, (Vector3)p3, curveColor);
}
}
}
}
}
}

View File

@@ -0,0 +1,18 @@
fileFormatVersion: 2
guid: 9811e544f4eb2430c8cc08ac4c5b25b3
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
AssetOrigin:
serializedVersion: 1
productId: 162772
packageName: ALINE
packageVersion: 1.7.6
assetPath: Packages/com.arongranberg.aline/ExampleScenes~/Example2_CurveEditor/CurveEditor.cs
uploadId: 700292

View File

@@ -0,0 +1,570 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!29 &1
OcclusionCullingSettings:
m_ObjectHideFlags: 0
serializedVersion: 2
m_OcclusionBakeSettings:
smallestOccluder: 5
smallestHole: 0.25
backfaceThreshold: 100
m_SceneGUID: 00000000000000000000000000000000
m_OcclusionCullingData: {fileID: 0}
--- !u!104 &2
RenderSettings:
m_ObjectHideFlags: 0
serializedVersion: 9
m_Fog: 0
m_FogColor: {r: 0.5, g: 0.5, b: 0.5, a: 1}
m_FogMode: 3
m_FogDensity: 0.01
m_LinearFogStart: 0
m_LinearFogEnd: 300
m_AmbientSkyColor: {r: 0.212, g: 0.227, b: 0.259, a: 1}
m_AmbientEquatorColor: {r: 0.114, g: 0.125, b: 0.133, a: 1}
m_AmbientGroundColor: {r: 0.047, g: 0.043, b: 0.035, a: 1}
m_AmbientIntensity: 1
m_AmbientMode: 0
m_SubtractiveShadowColor: {r: 0.42, g: 0.478, b: 0.627, a: 1}
m_SkyboxMaterial: {fileID: 10304, guid: 0000000000000000f000000000000000, type: 0}
m_HaloStrength: 0.5
m_FlareStrength: 1
m_FlareFadeSpeed: 3
m_HaloTexture: {fileID: 0}
m_SpotCookie: {fileID: 10001, guid: 0000000000000000e000000000000000, type: 0}
m_DefaultReflectionMode: 0
m_DefaultReflectionResolution: 128
m_ReflectionBounces: 1
m_ReflectionIntensity: 1
m_CustomReflection: {fileID: 0}
m_Sun: {fileID: 0}
m_IndirectSpecularColor: {r: 0, g: 0, b: 0, a: 1}
m_UseRadianceAmbientProbe: 0
--- !u!157 &3
LightmapSettings:
m_ObjectHideFlags: 0
serializedVersion: 11
m_GIWorkflowMode: 1
m_GISettings:
serializedVersion: 2
m_BounceScale: 1
m_IndirectOutputScale: 1
m_AlbedoBoost: 1
m_EnvironmentLightingMode: 0
m_EnableBakedLightmaps: 1
m_EnableRealtimeLightmaps: 0
m_LightmapEditorSettings:
serializedVersion: 12
m_Resolution: 2
m_BakeResolution: 40
m_AtlasSize: 1024
m_AO: 0
m_AOMaxDistance: 1
m_CompAOExponent: 1
m_CompAOExponentDirect: 0
m_ExtractAmbientOcclusion: 0
m_Padding: 2
m_LightmapParameters: {fileID: 0}
m_LightmapsBakeMode: 1
m_TextureCompression: 1
m_FinalGather: 0
m_FinalGatherFiltering: 1
m_FinalGatherRayCount: 256
m_ReflectionCompression: 2
m_MixedBakeMode: 2
m_BakeBackend: 1
m_PVRSampling: 1
m_PVRDirectSampleCount: 32
m_PVRSampleCount: 512
m_PVRBounces: 2
m_PVREnvironmentSampleCount: 256
m_PVREnvironmentReferencePointCount: 2048
m_PVRFilteringMode: 1
m_PVRDenoiserTypeDirect: 1
m_PVRDenoiserTypeIndirect: 1
m_PVRDenoiserTypeAO: 1
m_PVRFilterTypeDirect: 0
m_PVRFilterTypeIndirect: 0
m_PVRFilterTypeAO: 0
m_PVREnvironmentMIS: 1
m_PVRCulling: 1
m_PVRFilteringGaussRadiusDirect: 1
m_PVRFilteringGaussRadiusIndirect: 5
m_PVRFilteringGaussRadiusAO: 2
m_PVRFilteringAtrousPositionSigmaDirect: 0.5
m_PVRFilteringAtrousPositionSigmaIndirect: 2
m_PVRFilteringAtrousPositionSigmaAO: 1
m_ExportTrainingData: 0
m_TrainingDataDestination: TrainingData
m_LightProbeSampleCountMultiplier: 4
m_LightingDataAsset: {fileID: 0}
m_UseShadowmask: 1
--- !u!196 &4
NavMeshSettings:
serializedVersion: 2
m_ObjectHideFlags: 0
m_BuildSettings:
serializedVersion: 2
agentTypeID: 0
agentRadius: 0.5
agentHeight: 2
agentSlope: 45
agentClimb: 0.4
ledgeDropHeight: 0
maxJumpAcrossDistance: 0
minRegionArea: 2
manualCellSize: 0
cellSize: 0.16666667
manualTileSize: 0
tileSize: 256
accuratePlacement: 0
debug:
m_Flags: 0
m_NavMeshData: {fileID: 0}
--- !u!1 &197547788
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 197547791}
- component: {fileID: 197547790}
- component: {fileID: 197547789}
- component: {fileID: 197547792}
m_Layer: 0
m_Name: Main Camera
m_TagString: MainCamera
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!81 &197547789
AudioListener:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 197547788}
m_Enabled: 1
--- !u!20 &197547790
Camera:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 197547788}
m_Enabled: 1
serializedVersion: 2
m_ClearFlags: 2
m_BackGroundColor: {r: 0.105882354, g: 0.13333334, b: 0.26666668, a: 0}
m_projectionMatrixMode: 1
m_GateFitMode: 2
m_FOVAxisMode: 0
m_SensorSize: {x: 36, y: 24}
m_LensShift: {x: 0, y: 0}
m_FocalLength: 50
m_NormalizedViewPortRect:
serializedVersion: 2
x: 0
y: 0
width: 1
height: 1
near clip plane: 0.3
far clip plane: 1000
field of view: 60
orthographic: 0
orthographic size: 5
m_Depth: -1
m_CullingMask:
serializedVersion: 2
m_Bits: 4294967295
m_RenderingPath: -1
m_TargetTexture: {fileID: 0}
m_TargetDisplay: 0
m_TargetEye: 3
m_HDR: 1
m_AllowMSAA: 1
m_AllowDynamicResolution: 0
m_ForceIntoRT: 0
m_OcclusionCulling: 1
m_StereoConvergence: 10
m_StereoSeparation: 0.022
--- !u!4 &197547791
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 197547788}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 1, z: -10}
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: []
m_Father: {fileID: 0}
m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!114 &197547792
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 197547788}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 9811e544f4eb2430c8cc08ac4c5b25b3, type: 3}
m_Name:
m_EditorClassIdentifier:
curveColor: {r: 0.30980393, g: 0.8, b: 0.92941177, a: 1}
--- !u!1 &772673492
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 772673493}
- component: {fileID: 772673496}
- component: {fileID: 772673495}
- component: {fileID: 772673494}
m_Layer: 5
m_Name: Text
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!224 &772673493
RectTransform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 772673492}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: []
m_Father: {fileID: 2036918323}
m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0.5, y: 1}
m_AnchorMax: {x: 0.5, y: 1}
m_AnchoredPosition: {x: 0, y: -10}
m_SizeDelta: {x: 300, y: 30}
m_Pivot: {x: 0.5, y: 1}
--- !u!114 &772673494
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 772673492}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: cfabb0440166ab443bba8876756fdfa9, type: 3}
m_Name:
m_EditorClassIdentifier:
m_EffectColor: {r: 0, g: 0, b: 0, a: 0.5}
m_EffectDistance: {x: 1, y: -1}
m_UseGraphicAlpha: 1
--- !u!114 &772673495
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 772673492}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 5f7201a12d95ffc409449d95f23cf332, type: 3}
m_Name:
m_EditorClassIdentifier:
m_Material: {fileID: 0}
m_Color: {r: 1, g: 1, b: 1, a: 1}
m_RaycastTarget: 1
m_OnCullStateChanged:
m_PersistentCalls:
m_Calls: []
m_FontData:
m_Font: {fileID: 10102, guid: 0000000000000000e000000000000000, type: 0}
m_FontSize: 14
m_FontStyle: 0
m_BestFit: 0
m_MinSize: 10
m_MaxSize: 40
m_Alignment: 1
m_AlignByGeometry: 0
m_RichText: 1
m_HorizontalOverflow: 0
m_VerticalOverflow: 0
m_LineSpacing: 1
m_Text: Click and drag to add new points to the curve
--- !u!222 &772673496
CanvasRenderer:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 772673492}
m_CullTransparentMesh: 0
--- !u!1 &988914451
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 988914453}
- component: {fileID: 988914452}
m_Layer: 0
m_Name: Directional Light
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!108 &988914452
Light:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 988914451}
m_Enabled: 1
serializedVersion: 10
m_Type: 1
m_Shape: 0
m_Color: {r: 1, g: 0.95686275, b: 0.8392157, a: 1}
m_Intensity: 1
m_Range: 10
m_SpotAngle: 30
m_InnerSpotAngle: 21.80208
m_CookieSize: 10
m_Shadows:
m_Type: 2
m_Resolution: -1
m_CustomResolution: -1
m_Strength: 1
m_Bias: 0.05
m_NormalBias: 0.4
m_NearPlane: 0.2
m_CullingMatrixOverride:
e00: 1
e01: 0
e02: 0
e03: 0
e10: 0
e11: 1
e12: 0
e13: 0
e20: 0
e21: 0
e22: 1
e23: 0
e30: 0
e31: 0
e32: 0
e33: 1
m_UseCullingMatrixOverride: 0
m_Cookie: {fileID: 0}
m_DrawHalo: 0
m_Flare: {fileID: 0}
m_RenderMode: 0
m_CullingMask:
serializedVersion: 2
m_Bits: 4294967295
m_RenderingLayerMask: 1
m_Lightmapping: 4
m_LightShadowCasterMode: 0
m_AreaSize: {x: 1, y: 1}
m_BounceIntensity: 1
m_ColorTemperature: 6570
m_UseColorTemperature: 0
m_BoundingSphereOverride: {x: 0, y: 0, z: 0, w: 0}
m_UseBoundingSphereOverride: 0
m_ShadowRadius: 0
m_ShadowAngle: 0
--- !u!4 &988914453
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 988914451}
m_LocalRotation: {x: 0.40821788, y: -0.23456968, z: 0.10938163, w: 0.8754261}
m_LocalPosition: {x: 0, y: 3, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: []
m_Father: {fileID: 0}
m_RootOrder: 1
m_LocalEulerAnglesHint: {x: 50, y: -30, z: 0}
--- !u!1 &1449863473
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 1449863476}
- component: {fileID: 1449863475}
- component: {fileID: 1449863474}
m_Layer: 0
m_Name: EventSystem
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!114 &1449863474
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1449863473}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 4f231c4fb786f3946a6b90b886c48677, type: 3}
m_Name:
m_EditorClassIdentifier:
m_HorizontalAxis: Horizontal
m_VerticalAxis: Vertical
m_SubmitButton: Submit
m_CancelButton: Cancel
m_InputActionsPerSecond: 10
m_RepeatDelay: 0.5
m_ForceModuleActive: 0
--- !u!114 &1449863475
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1449863473}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 76c392e42b5098c458856cdf6ecaaaa1, type: 3}
m_Name:
m_EditorClassIdentifier:
m_FirstSelected: {fileID: 0}
m_sendNavigationEvents: 1
m_DragThreshold: 10
--- !u!4 &1449863476
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1449863473}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: []
m_Father: {fileID: 0}
m_RootOrder: 3
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!1 &2036918319
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 2036918323}
- component: {fileID: 2036918322}
- component: {fileID: 2036918321}
- component: {fileID: 2036918320}
m_Layer: 5
m_Name: Canvas
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!114 &2036918320
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 2036918319}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: dc42784cf147c0c48a680349fa168899, type: 3}
m_Name:
m_EditorClassIdentifier:
m_IgnoreReversedGraphics: 1
m_BlockingObjects: 0
m_BlockingMask:
serializedVersion: 2
m_Bits: 4294967295
--- !u!114 &2036918321
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 2036918319}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 0cd44c1031e13a943bb63640046fad76, type: 3}
m_Name:
m_EditorClassIdentifier:
m_UiScaleMode: 0
m_ReferencePixelsPerUnit: 100
m_ScaleFactor: 1
m_ReferenceResolution: {x: 800, y: 600}
m_ScreenMatchMode: 0
m_MatchWidthOrHeight: 0
m_PhysicalUnit: 3
m_FallbackScreenDPI: 96
m_DefaultSpriteDPI: 96
m_DynamicPixelsPerUnit: 1
--- !u!223 &2036918322
Canvas:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 2036918319}
m_Enabled: 1
serializedVersion: 3
m_RenderMode: 0
m_Camera: {fileID: 0}
m_PlaneDistance: 100
m_PixelPerfect: 0
m_ReceivesEvents: 1
m_OverrideSorting: 0
m_OverridePixelPerfect: 0
m_SortingBucketNormalizedSize: 0
m_AdditionalShaderChannelsFlag: 0
m_SortingLayerID: 0
m_SortingOrder: 0
m_TargetDisplay: 0
--- !u!224 &2036918323
RectTransform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 2036918319}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 0, y: 0, z: 0}
m_Children:
- {fileID: 772673493}
m_Father: {fileID: 0}
m_RootOrder: 2
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 0}
m_AnchorMax: {x: 0, y: 0}
m_AnchoredPosition: {x: 0, y: 0}
m_SizeDelta: {x: 0, y: 0}
m_Pivot: {x: 0, y: 0}

View File

@@ -0,0 +1,14 @@
fileFormatVersion: 2
guid: 40402edc990964059a9ce3dfed6e64f5
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
AssetOrigin:
serializedVersion: 1
productId: 162772
packageName: ALINE
packageVersion: 1.7.6
assetPath: Packages/com.arongranberg.aline/ExampleScenes~/Example2_CurveEditor/CurveEditor.unity
uploadId: 700292

View File

@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: d7655016397564212bdd6bf462f9983e
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,311 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!29 &1
OcclusionCullingSettings:
m_ObjectHideFlags: 0
serializedVersion: 2
m_OcclusionBakeSettings:
smallestOccluder: 5
smallestHole: 0.25
backfaceThreshold: 100
m_SceneGUID: 00000000000000000000000000000000
m_OcclusionCullingData: {fileID: 0}
--- !u!104 &2
RenderSettings:
m_ObjectHideFlags: 0
serializedVersion: 9
m_Fog: 0
m_FogColor: {r: 0.5, g: 0.5, b: 0.5, a: 1}
m_FogMode: 3
m_FogDensity: 0.01
m_LinearFogStart: 0
m_LinearFogEnd: 300
m_AmbientSkyColor: {r: 0.212, g: 0.227, b: 0.259, a: 1}
m_AmbientEquatorColor: {r: 0.114, g: 0.125, b: 0.133, a: 1}
m_AmbientGroundColor: {r: 0.047, g: 0.043, b: 0.035, a: 1}
m_AmbientIntensity: 1
m_AmbientMode: 0
m_SubtractiveShadowColor: {r: 0.42, g: 0.478, b: 0.627, a: 1}
m_SkyboxMaterial: {fileID: 10304, guid: 0000000000000000f000000000000000, type: 0}
m_HaloStrength: 0.5
m_FlareStrength: 1
m_FlareFadeSpeed: 3
m_HaloTexture: {fileID: 0}
m_SpotCookie: {fileID: 10001, guid: 0000000000000000e000000000000000, type: 0}
m_DefaultReflectionMode: 0
m_DefaultReflectionResolution: 128
m_ReflectionBounces: 1
m_ReflectionIntensity: 1
m_CustomReflection: {fileID: 0}
m_Sun: {fileID: 0}
m_IndirectSpecularColor: {r: 0, g: 0, b: 0, a: 1}
m_UseRadianceAmbientProbe: 0
--- !u!157 &3
LightmapSettings:
m_ObjectHideFlags: 0
serializedVersion: 12
m_GIWorkflowMode: 1
m_GISettings:
serializedVersion: 2
m_BounceScale: 1
m_IndirectOutputScale: 1
m_AlbedoBoost: 1
m_EnvironmentLightingMode: 0
m_EnableBakedLightmaps: 1
m_EnableRealtimeLightmaps: 0
m_LightmapEditorSettings:
serializedVersion: 12
m_Resolution: 2
m_BakeResolution: 40
m_AtlasSize: 1024
m_AO: 0
m_AOMaxDistance: 1
m_CompAOExponent: 1
m_CompAOExponentDirect: 0
m_ExtractAmbientOcclusion: 0
m_Padding: 2
m_LightmapParameters: {fileID: 0}
m_LightmapsBakeMode: 1
m_TextureCompression: 1
m_FinalGather: 0
m_FinalGatherFiltering: 1
m_FinalGatherRayCount: 256
m_ReflectionCompression: 2
m_MixedBakeMode: 2
m_BakeBackend: 1
m_PVRSampling: 1
m_PVRDirectSampleCount: 32
m_PVRSampleCount: 512
m_PVRBounces: 2
m_PVREnvironmentSampleCount: 256
m_PVREnvironmentReferencePointCount: 2048
m_PVRFilteringMode: 1
m_PVRDenoiserTypeDirect: 1
m_PVRDenoiserTypeIndirect: 1
m_PVRDenoiserTypeAO: 1
m_PVRFilterTypeDirect: 0
m_PVRFilterTypeIndirect: 0
m_PVRFilterTypeAO: 0
m_PVREnvironmentMIS: 1
m_PVRCulling: 1
m_PVRFilteringGaussRadiusDirect: 1
m_PVRFilteringGaussRadiusIndirect: 5
m_PVRFilteringGaussRadiusAO: 2
m_PVRFilteringAtrousPositionSigmaDirect: 0.5
m_PVRFilteringAtrousPositionSigmaIndirect: 2
m_PVRFilteringAtrousPositionSigmaAO: 1
m_ExportTrainingData: 0
m_TrainingDataDestination: TrainingData
m_LightProbeSampleCountMultiplier: 4
m_LightingDataAsset: {fileID: 0}
m_LightingSettings: {fileID: 0}
--- !u!196 &4
NavMeshSettings:
serializedVersion: 2
m_ObjectHideFlags: 0
m_BuildSettings:
serializedVersion: 2
agentTypeID: 0
agentRadius: 0.5
agentHeight: 2
agentSlope: 45
agentClimb: 0.4
ledgeDropHeight: 0
maxJumpAcrossDistance: 0
minRegionArea: 2
manualCellSize: 0
cellSize: 0.16666667
manualTileSize: 0
tileSize: 256
accuratePlacement: 0
debug:
m_Flags: 0
m_NavMeshData: {fileID: 0}
--- !u!1 &1677799084
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 1677799088}
- component: {fileID: 1677799087}
- component: {fileID: 1677799086}
- component: {fileID: 1677799085}
m_Layer: 0
m_Name: Main Camera
m_TagString: MainCamera
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!114 &1677799085
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1677799084}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: d6f1f3c698b0e44f8ba8e2f4be423ecb, type: 3}
m_Name:
m_EditorClassIdentifier:
--- !u!81 &1677799086
AudioListener:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1677799084}
m_Enabled: 1
--- !u!20 &1677799087
Camera:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1677799084}
m_Enabled: 1
serializedVersion: 2
m_ClearFlags: 2
m_BackGroundColor: {r: 0.07450981, g: 0.105882354, b: 0.23529412, a: 1}
m_projectionMatrixMode: 1
m_GateFitMode: 2
m_FOVAxisMode: 0
m_SensorSize: {x: 36, y: 24}
m_LensShift: {x: 0, y: 0}
m_FocalLength: 50
m_NormalizedViewPortRect:
serializedVersion: 2
x: 0
y: 0
width: 1
height: 1
near clip plane: 0.3
far clip plane: 1000
field of view: 60
orthographic: 0
orthographic size: 5
m_Depth: -1
m_CullingMask:
serializedVersion: 2
m_Bits: 4294967295
m_RenderingPath: -1
m_TargetTexture: {fileID: 0}
m_TargetDisplay: 0
m_TargetEye: 3
m_HDR: 1
m_AllowMSAA: 1
m_AllowDynamicResolution: 0
m_ForceIntoRT: 0
m_OcclusionCulling: 1
m_StereoConvergence: 10
m_StereoSeparation: 0.022
--- !u!4 &1677799088
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1677799084}
m_LocalRotation: {x: 0.2986964, y: 0.29857793, z: -0.098981485, w: 0.9010185}
m_LocalPosition: {x: 18.1, y: 13.6, z: 14.3}
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: []
m_Father: {fileID: 0}
m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 36.682003, y: 36.668003, z: 0}
--- !u!1 &1988239962
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 1988239964}
- component: {fileID: 1988239963}
m_Layer: 0
m_Name: Directional Light
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!108 &1988239963
Light:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1988239962}
m_Enabled: 1
serializedVersion: 10
m_Type: 1
m_Shape: 0
m_Color: {r: 1, g: 0.95686275, b: 0.8392157, a: 1}
m_Intensity: 1
m_Range: 10
m_SpotAngle: 30
m_InnerSpotAngle: 21.80208
m_CookieSize: 10
m_Shadows:
m_Type: 2
m_Resolution: -1
m_CustomResolution: -1
m_Strength: 1
m_Bias: 0.05
m_NormalBias: 0.4
m_NearPlane: 0.2
m_CullingMatrixOverride:
e00: 1
e01: 0
e02: 0
e03: 0
e10: 0
e11: 1
e12: 0
e13: 0
e20: 0
e21: 0
e22: 1
e23: 0
e30: 0
e31: 0
e32: 0
e33: 1
m_UseCullingMatrixOverride: 0
m_Cookie: {fileID: 0}
m_DrawHalo: 0
m_Flare: {fileID: 0}
m_RenderMode: 0
m_CullingMask:
serializedVersion: 2
m_Bits: 4294967295
m_RenderingLayerMask: 1
m_Lightmapping: 4
m_LightShadowCasterMode: 0
m_AreaSize: {x: 1, y: 1}
m_BounceIntensity: 1
m_ColorTemperature: 6570
m_UseColorTemperature: 0
m_BoundingSphereOverride: {x: 0, y: 0, z: 0, w: 0}
m_UseBoundingSphereOverride: 0
m_ShadowRadius: 0
m_ShadowAngle: 0
--- !u!4 &1988239964
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1988239962}
m_LocalRotation: {x: 0.40821788, y: -0.23456968, z: 0.10938163, w: 0.8754261}
m_LocalPosition: {x: 0, y: 3, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: []
m_Father: {fileID: 0}
m_RootOrder: 1
m_LocalEulerAnglesHint: {x: 50, y: -30, z: 0}

View File

@@ -0,0 +1,14 @@
fileFormatVersion: 2
guid: 9632fd653dcf34fbb969a725345e43a9
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
AssetOrigin:
serializedVersion: 1
productId: 162772
packageName: ALINE
packageVersion: 1.7.6
assetPath: Packages/com.arongranberg.aline/ExampleScenes~/Example3_Burst/Burst.unity
uploadId: 700292

View File

@@ -0,0 +1,60 @@
using Drawing;
using Unity.Jobs;
using Unity.Burst;
using UnityEngine;
using Unity.Mathematics;
namespace Drawing.Examples {
[HelpURL("http://arongranberg.com/aline/documentation/stable/burstexample.html")]
public class BurstExample : MonoBehaviour {
// Use [BurstCompile] to allow Unity to compile the job using the Burst compiler
[BurstCompile]
struct DrawingJob : IJob {
public float2 offset;
// The job takes a command builder which we can use to draw things with
public CommandBuilder builder;
Color Colormap (float x) {
// Simple color map that goes from black through red to yellow
float r = math.clamp(8.0f / 3.0f * x, 0.0f, 1.0f);
float g = math.clamp(8.0f / 3.0f * x - 1.0f, 0.0f, 1.0f);
float b = math.clamp(4.0f * x - 3.0f, 0.0f, 1.0f);
return new Color(r, g, b, 1.0f);
}
public void Execute (int index) {
int x = index / 100;
int z = index % 100;
// Draw a solid box and a wire box
// Use Perlin noise to generate a procedural heightmap
var noise = Mathf.PerlinNoise(x * 0.05f + offset.x, z * 0.05f + offset.y);
Bounds bounds = new Bounds(new float3(x, 0, z), new float3(1, 14 * noise, 1));
//builder.WireBox(bounds, new Color(0, 0, 0, 0.2f));
builder.SolidBox(bounds, Colormap(noise));
}
public void Execute () {
for (int index = 0; index < 100 * 100; index++) {
Execute(index);
}
}
}
public void Update () {
var builder = DrawingManager.GetBuilder(true);
// Create a new job struct and schedule it using the Unity Job System
var job = new DrawingJob {
builder = builder,
offset = new float2(Time.time * 0.2f, Time.time * 0.2f),
}.Schedule();
// Dispose the builder after the job is complete
builder.DisposeAfter(job);
job.Complete();
}
}
}

View File

@@ -0,0 +1,18 @@
fileFormatVersion: 2
guid: d6f1f3c698b0e44f8ba8e2f4be423ecb
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
AssetOrigin:
serializedVersion: 1
productId: 162772
packageName: ALINE
packageVersion: 1.7.6
assetPath: Packages/com.arongranberg.aline/ExampleScenes~/Example3_Burst/BurstExample.cs
uploadId: 700292

View File

@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 46be1904d38ee227dbed4664116a7ca7
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,41 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using Drawing;
using Unity.Mathematics;
namespace Drawing.Examples {
/// <summary>Example that shows line widths, colors and line joins</summary>
[HelpURL("http://arongranberg.com/aline/documentation/stable/alinestyling.html")]
public class AlineStyling : MonoBehaviour {
public Color gizmoColor = new Color(1.0f, 88/255f, 85/255f);
public Color gizmoColor2 = new Color(79/255f, 204/255f, 237/255f);
// Update is called once per frame
void Update () {
// Draw in-game.
// This will draw the things even in standalone games
var draw = Draw.ingame;
using (draw.InScreenSpace(Camera.main)) {
// Use a matrix to be able to draw in normalized space. I.e. (0,0) is the center of the screen, (0.5, 0.0) is the right side of the screen etc.
using (draw.WithMatrix(Matrix4x4.TRS(new Vector3(Screen.width/2.0f, Screen.height/2.0f, 0), Quaternion.identity, new Vector3(Screen.width, Screen.width, 1)))) {
for (int i = 0; i < 4; i++) {
// Draw with a few different line widths
using (draw.WithLineWidth(i*i+1)) {
float angle = Mathf.PI * 0.25f * (i+1) + Time.time * i;
Vector3 offset = new Vector3(-0.3f + i * 0.2f, 0, 0);
float radius = 0.075f;
// Draw a rotating line
draw.Line(offset + new Vector3(math.cos(angle)*radius, math.sin(angle)*radius, 0), offset, gizmoColor);
// Draw a fixed line
draw.Line(offset, offset + new Vector3(radius, 0, 0), gizmoColor);
// Draw a circle
draw.xy.Circle(offset, radius, gizmoColor2);
}
}
}
}
}
}
}

View File

@@ -0,0 +1,18 @@
fileFormatVersion: 2
guid: 21d9bc83d3ff57277b0c8f8a1bdba02b
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
AssetOrigin:
serializedVersion: 1
productId: 162772
packageName: ALINE
packageVersion: 1.7.6
assetPath: Packages/com.arongranberg.aline/ExampleScenes~/Example4_Styling/AlineStyling.cs
uploadId: 700292

View File

@@ -0,0 +1,316 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!29 &1
OcclusionCullingSettings:
m_ObjectHideFlags: 0
serializedVersion: 2
m_OcclusionBakeSettings:
smallestOccluder: 5
smallestHole: 0.25
backfaceThreshold: 100
m_SceneGUID: 00000000000000000000000000000000
m_OcclusionCullingData: {fileID: 0}
--- !u!104 &2
RenderSettings:
m_ObjectHideFlags: 0
serializedVersion: 9
m_Fog: 0
m_FogColor: {r: 0.5, g: 0.5, b: 0.5, a: 1}
m_FogMode: 3
m_FogDensity: 0.01
m_LinearFogStart: 0
m_LinearFogEnd: 300
m_AmbientSkyColor: {r: 0.212, g: 0.227, b: 0.259, a: 1}
m_AmbientEquatorColor: {r: 0.114, g: 0.125, b: 0.133, a: 1}
m_AmbientGroundColor: {r: 0.047, g: 0.043, b: 0.035, a: 1}
m_AmbientIntensity: 1
m_AmbientMode: 0
m_SubtractiveShadowColor: {r: 0.42, g: 0.478, b: 0.627, a: 1}
m_SkyboxMaterial: {fileID: 10304, guid: 0000000000000000f000000000000000, type: 0}
m_HaloStrength: 0.5
m_FlareStrength: 1
m_FlareFadeSpeed: 3
m_HaloTexture: {fileID: 0}
m_SpotCookie: {fileID: 10001, guid: 0000000000000000e000000000000000, type: 0}
m_DefaultReflectionMode: 0
m_DefaultReflectionResolution: 128
m_ReflectionBounces: 1
m_ReflectionIntensity: 1
m_CustomReflection: {fileID: 0}
m_Sun: {fileID: 0}
m_IndirectSpecularColor: {r: 0, g: 0, b: 0, a: 1}
m_UseRadianceAmbientProbe: 0
--- !u!157 &3
LightmapSettings:
m_ObjectHideFlags: 0
serializedVersion: 12
m_GIWorkflowMode: 1
m_GISettings:
serializedVersion: 2
m_BounceScale: 1
m_IndirectOutputScale: 1
m_AlbedoBoost: 1
m_EnvironmentLightingMode: 0
m_EnableBakedLightmaps: 1
m_EnableRealtimeLightmaps: 0
m_LightmapEditorSettings:
serializedVersion: 12
m_Resolution: 2
m_BakeResolution: 40
m_AtlasSize: 1024
m_AO: 0
m_AOMaxDistance: 1
m_CompAOExponent: 1
m_CompAOExponentDirect: 0
m_ExtractAmbientOcclusion: 0
m_Padding: 2
m_LightmapParameters: {fileID: 0}
m_LightmapsBakeMode: 1
m_TextureCompression: 1
m_FinalGather: 0
m_FinalGatherFiltering: 1
m_FinalGatherRayCount: 256
m_ReflectionCompression: 2
m_MixedBakeMode: 2
m_BakeBackend: 1
m_PVRSampling: 1
m_PVRDirectSampleCount: 32
m_PVRSampleCount: 512
m_PVRBounces: 2
m_PVREnvironmentSampleCount: 256
m_PVREnvironmentReferencePointCount: 2048
m_PVRFilteringMode: 1
m_PVRDenoiserTypeDirect: 1
m_PVRDenoiserTypeIndirect: 1
m_PVRDenoiserTypeAO: 1
m_PVRFilterTypeDirect: 0
m_PVRFilterTypeIndirect: 0
m_PVRFilterTypeAO: 0
m_PVREnvironmentMIS: 1
m_PVRCulling: 1
m_PVRFilteringGaussRadiusDirect: 1
m_PVRFilteringGaussRadiusIndirect: 5
m_PVRFilteringGaussRadiusAO: 2
m_PVRFilteringAtrousPositionSigmaDirect: 0.5
m_PVRFilteringAtrousPositionSigmaIndirect: 2
m_PVRFilteringAtrousPositionSigmaAO: 1
m_ExportTrainingData: 0
m_TrainingDataDestination: TrainingData
m_LightProbeSampleCountMultiplier: 4
m_LightingDataAsset: {fileID: 0}
m_LightingSettings: {fileID: 0}
--- !u!196 &4
NavMeshSettings:
serializedVersion: 2
m_ObjectHideFlags: 0
m_BuildSettings:
serializedVersion: 2
agentTypeID: 0
agentRadius: 0.5
agentHeight: 2
agentSlope: 45
agentClimb: 0.4
ledgeDropHeight: 0
maxJumpAcrossDistance: 0
minRegionArea: 2
manualCellSize: 0
cellSize: 0.16666667
manualTileSize: 0
tileSize: 256
accuratePlacement: 0
maxJobWorkers: 0
preserveTilesOutsideBounds: 0
debug:
m_Flags: 0
m_NavMeshData: {fileID: 0}
--- !u!1 &888263137
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 888263139}
- component: {fileID: 888263138}
m_Layer: 0
m_Name: Directional Light
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!108 &888263138
Light:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 888263137}
m_Enabled: 1
serializedVersion: 10
m_Type: 1
m_Shape: 0
m_Color: {r: 1, g: 0.95686275, b: 0.8392157, a: 1}
m_Intensity: 1
m_Range: 10
m_SpotAngle: 30
m_InnerSpotAngle: 21.80208
m_CookieSize: 10
m_Shadows:
m_Type: 2
m_Resolution: -1
m_CustomResolution: -1
m_Strength: 1
m_Bias: 0.05
m_NormalBias: 0.4
m_NearPlane: 0.2
m_CullingMatrixOverride:
e00: 1
e01: 0
e02: 0
e03: 0
e10: 0
e11: 1
e12: 0
e13: 0
e20: 0
e21: 0
e22: 1
e23: 0
e30: 0
e31: 0
e32: 0
e33: 1
m_UseCullingMatrixOverride: 0
m_Cookie: {fileID: 0}
m_DrawHalo: 0
m_Flare: {fileID: 0}
m_RenderMode: 0
m_CullingMask:
serializedVersion: 2
m_Bits: 4294967295
m_RenderingLayerMask: 1
m_Lightmapping: 4
m_LightShadowCasterMode: 0
m_AreaSize: {x: 1, y: 1}
m_BounceIntensity: 1
m_ColorTemperature: 6570
m_UseColorTemperature: 0
m_BoundingSphereOverride: {x: 0, y: 0, z: 0, w: 0}
m_UseBoundingSphereOverride: 0
m_UseViewFrustumForShadowCasterCull: 1
m_ShadowRadius: 0
m_ShadowAngle: 0
--- !u!4 &888263139
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 888263137}
m_LocalRotation: {x: 0.40821788, y: -0.23456968, z: 0.10938163, w: 0.8754261}
m_LocalPosition: {x: 0, y: 3, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: []
m_Father: {fileID: 0}
m_RootOrder: 1
m_LocalEulerAnglesHint: {x: 50, y: -30, z: 0}
--- !u!1 &1657122575
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 1657122578}
- component: {fileID: 1657122577}
- component: {fileID: 1657122576}
- component: {fileID: 1657122579}
m_Layer: 0
m_Name: Main Camera
m_TagString: MainCamera
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!81 &1657122576
AudioListener:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1657122575}
m_Enabled: 1
--- !u!20 &1657122577
Camera:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1657122575}
m_Enabled: 1
serializedVersion: 2
m_ClearFlags: 2
m_BackGroundColor: {r: 0.105882354, g: 0.13333334, b: 0.26666668, a: 0}
m_projectionMatrixMode: 1
m_GateFitMode: 2
m_FOVAxisMode: 0
m_SensorSize: {x: 36, y: 24}
m_LensShift: {x: 0, y: 0}
m_FocalLength: 50
m_NormalizedViewPortRect:
serializedVersion: 2
x: 0
y: 0
width: 1
height: 1
near clip plane: 0.3
far clip plane: 1000
field of view: 60
orthographic: 0
orthographic size: 5
m_Depth: -1
m_CullingMask:
serializedVersion: 2
m_Bits: 4294967295
m_RenderingPath: -1
m_TargetTexture: {fileID: 0}
m_TargetDisplay: 0
m_TargetEye: 3
m_HDR: 1
m_AllowMSAA: 1
m_AllowDynamicResolution: 0
m_ForceIntoRT: 0
m_OcclusionCulling: 1
m_StereoConvergence: 10
m_StereoSeparation: 0.022
--- !u!4 &1657122578
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1657122575}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 1, z: -10}
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: []
m_Father: {fileID: 0}
m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!114 &1657122579
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1657122575}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 21d9bc83d3ff57277b0c8f8a1bdba02b, type: 3}
m_Name:
m_EditorClassIdentifier:
gizmoColor: {r: 1, g: 0.34509805, b: 0.33333334, a: 1}
gizmoColor2: {r: 0.30980393, g: 0.8, b: 0.92941177, a: 1}

View File

@@ -0,0 +1,14 @@
fileFormatVersion: 2
guid: cb8d06342008cc182986e13e9f36cee5
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
AssetOrigin:
serializedVersion: 1
productId: 162772
packageName: ALINE
packageVersion: 1.7.6
assetPath: Packages/com.arongranberg.aline/ExampleScenes~/Example4_Styling/Styling.unity
uploadId: 700292

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,18 @@
fileFormatVersion: 2
guid: f573c8457824d9c789371f94ffed6f72
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
AssetOrigin:
serializedVersion: 1
productId: 162772
packageName: ALINE
packageVersion: 1.7.6
assetPath: Packages/com.arongranberg.aline/GeometryBuilder.cs
uploadId: 700292

View File

@@ -0,0 +1,40 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
namespace Drawing {
/// <summary>
/// Inherit from this class to draw gizmos.
/// See: getstarted (view in online documentation for working links)
/// </summary>
public abstract class MonoBehaviourGizmos : MonoBehaviour, IDrawGizmos {
public MonoBehaviourGizmos() {
#if UNITY_EDITOR
DrawingManager.Register(this);
#endif
}
/// <summary>
/// An empty OnDrawGizmosSelected method.
/// Why an empty OnDrawGizmosSelected method?
/// This is because only objects with an OnDrawGizmos/OnDrawGizmosSelected method will show up in Unity's menu for enabling/disabling
/// the gizmos per object type (upper right corner of the scene view). So we need it here even though we don't use normal gizmos.
///
/// By using OnDrawGizmosSelected instead of OnDrawGizmos we minimize the overhead of Unity calling this empty method.
/// </summary>
void OnDrawGizmosSelected () {
}
/// <summary>
/// Draw gizmos for this object.
///
/// The gizmos will be visible in the scene view, and the game view, if gizmos have been enabled.
///
/// This method will only be called in the Unity Editor.
///
/// See: <see cref="Draw"/>
/// </summary>
public virtual void DrawGizmos () {
}
}
}

View File

@@ -0,0 +1,18 @@
fileFormatVersion: 2
guid: b51868c405ddc4a6eb7220be5fcad251
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
AssetOrigin:
serializedVersion: 1
productId: 162772
packageName: ALINE
packageVersion: 1.7.6
assetPath: Packages/com.arongranberg.aline/MonoBehaviourGizmos.cs
uploadId: 700292

View File

@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 91729f9b2c19b9864abd2d85945af6ee
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: f2bbed206b35f45109a573da43d01ea0
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,47 @@
// Disable the warning: "Field 'DependencyCheck.Dependency.name' is never assigned to, and will always have its default value null"
#pragma warning disable 649
using UnityEditor;
using System.Linq;
namespace Drawing.Util {
[InitializeOnLoad]
static class DependencyCheck {
struct Dependency {
public string name;
public string version;
}
static DependencyCheck() {
var missingDependencies = new Dependency[] {
#if !MODULE_BURST
new Dependency {
name = "com.unity.burst",
version = "1.2.1-preview",
},
#endif
#if !MODULE_MATHEMATICS
new Dependency {
name = "com.unity.mathematics",
version = "1.1.0",
},
#endif
#if !MODULE_COLLECTIONS
new Dependency {
name = "com.unity.collections",
version = "0.4.0-preview",
},
#endif
};
if (missingDependencies.Length > 0) {
string missing = string.Join(", ", missingDependencies.Select(p => p.name + " (" + p.version + ")"));
bool res = EditorUtility.DisplayDialog("Missing dependencies", "The packages " + missing + " are required by ALINE but they are not installed, or the installed versions are too old. Do you want to install the latest versions of the packages?", "Ok", "Cancel");
if (res) {
foreach (var dep in missingDependencies) {
UnityEditor.PackageManager.Client.Add(dep.name);
}
}
}
}
}
}

View File

@@ -0,0 +1,18 @@
fileFormatVersion: 2
guid: ee520e93d6bcd7966baa1c0a2c932cab
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
AssetOrigin:
serializedVersion: 1
productId: 162772
packageName: ALINE
packageVersion: 1.7.6
assetPath: Packages/com.arongranberg.aline/PackageTools/Editor/DependencyCheck.cs
uploadId: 700292

View File

@@ -0,0 +1,34 @@
{
"name": "ALINEPackageToolsEditor",
"rootNamespace": "",
"references": [
"GUID:f4059aaf6c60a4a58a177a2609feb769"
],
"includePlatforms": [
"Editor"
],
"excludePlatforms": [],
"allowUnsafeCode": false,
"overrideReferences": true,
"precompiledReferences": [],
"autoReferenced": true,
"defineConstraints": [],
"versionDefines": [
{
"name": "com.unity.burst",
"expression": "1.2.1-preview",
"define": "MODULE_BURST"
},
{
"name": "com.unity.mathematics",
"expression": "1.1.0",
"define": "MODULE_MATHEMATICS"
},
{
"name": "com.unity.collections",
"expression": "0.4.0-preview",
"define": "MODULE_COLLECTIONS"
}
],
"noEngineReferences": false
}

View File

@@ -0,0 +1,14 @@
fileFormatVersion: 2
guid: 7b1b525c1a052ef77996abb20f96d108
AssemblyDefinitionImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
AssetOrigin:
serializedVersion: 1
productId: 162772
packageName: ALINE
packageVersion: 1.7.6
assetPath: Packages/com.arongranberg.aline/PackageTools/Editor/PackageToolsEditor.asmdef
uploadId: 700292

View File

@@ -0,0 +1,124 @@
using UnityEngine;
namespace Drawing {
/// <summary>
/// Collections of colors.
///
/// The easiest way to use this class is to import it with a "using" statement:
///
/// <code>
/// using Palette = Pathfinding.Drawing.Palette.Colorbrewer.Set1;
///
/// class PaletteTest : MonoBehaviour {
/// public void Update () {
/// Draw.Line(new Vector3(0, 0, 0), new Vector3(1, 1, 1), Palette.Orange);
/// }
/// }
/// </code>
///
/// Note: This class has relatively few color collections at the moment. More will be added in the future.
/// </summary>
public static class Palette {
/// <summary>Pure colors</summary>
public static class Pure {
public static readonly Color Yellow = new Color(1, 1, 0, 1);
public static readonly Color Clear = new Color(0, 0, 0, 0);
public static readonly Color Grey = new Color(0.5f, 0.5f, 0.5f, 1);
public static readonly Color Magenta = new Color(1, 0, 1, 1);
public static readonly Color Cyan = new Color(0, 1, 1, 1);
public static readonly Color Red = new Color(1, 0, 0, 1);
public static readonly Color Black = new Color(0, 0, 0, 1);
public static readonly Color White = new Color(1, 1, 1, 1);
public static readonly Color Blue = new Color(0, 0, 1, 1);
public static readonly Color Green = new Color(0, 1, 0, 1);
}
/// <summary>
/// Colorbrewer colors.
/// See: http://colorbrewer2.org/
/// </summary>
public static class Colorbrewer {
/// <summary>Set 1 - Qualitative</summary>
public static class Set1 {
public static readonly Color Red = new Color(228/255f, 26/255f, 28/255f, 1);
public static readonly Color Blue = new Color(55/255f, 126/255f, 184/255f, 1);
public static readonly Color Green = new Color(77/255f, 175/255f, 74/255f, 1);
public static readonly Color Purple = new Color(152/255f, 78/255f, 163/255f, 1);
public static readonly Color Orange = new Color(255/255f, 127/255f, 0/255f, 1);
public static readonly Color Yellow = new Color(255/255f, 255/255f, 51/255f, 1);
public static readonly Color Brown = new Color(166/255f, 86/255f, 40/255f, 1);
public static readonly Color Pink = new Color(247/255f, 129/255f, 191/255f, 1);
public static readonly Color Grey = new Color(153/255f, 153/255f, 153/255f, 1);
}
/// <summary>Blues - Sequential</summary>
public static class Blues {
static readonly Color[] Colors = new Color[] {
new Color(43/255f, 140/255f, 190/255f),
new Color(166/255f, 189/255f, 219/255f),
new Color(43/255f, 140/255f, 190/255f),
new Color(236/255f, 231/255f, 242/255f),
new Color(166/255f, 189/255f, 219/255f),
new Color(43/255f, 140/255f, 190/255f),
new Color(241/255f, 238/255f, 246/255f),
new Color(189/255f, 201/255f, 225/255f),
new Color(116/255f, 169/255f, 207/255f),
new Color(5/255f, 112/255f, 176/255f),
new Color(241/255f, 238/255f, 246/255f),
new Color(189/255f, 201/255f, 225/255f),
new Color(116/255f, 169/255f, 207/255f),
new Color(43/255f, 140/255f, 190/255f),
new Color(4/255f, 90/255f, 141/255f),
new Color(241/255f, 238/255f, 246/255f),
new Color(208/255f, 209/255f, 230/255f),
new Color(166/255f, 189/255f, 219/255f),
new Color(116/255f, 169/255f, 207/255f),
new Color(43/255f, 140/255f, 190/255f),
new Color(4/255f, 90/255f, 141/255f),
new Color(241/255f, 238/255f, 246/255f),
new Color(208/255f, 209/255f, 230/255f),
new Color(166/255f, 189/255f, 219/255f),
new Color(116/255f, 169/255f, 207/255f),
new Color(54/255f, 144/255f, 192/255f),
new Color(5/255f, 112/255f, 176/255f),
new Color(3/255f, 78/255f, 123/255f),
new Color(255/255f, 247/255f, 251/255f),
new Color(236/255f, 231/255f, 242/255f),
new Color(208/255f, 209/255f, 230/255f),
new Color(166/255f, 189/255f, 219/255f),
new Color(116/255f, 169/255f, 207/255f),
new Color(54/255f, 144/255f, 192/255f),
new Color(5/255f, 112/255f, 176/255f),
new Color(3/255f, 78/255f, 123/255f),
new Color(255/255f, 247/255f, 251/255f),
new Color(236/255f, 231/255f, 242/255f),
new Color(208/255f, 209/255f, 230/255f),
new Color(166/255f, 189/255f, 219/255f),
new Color(116/255f, 169/255f, 207/255f),
new Color(54/255f, 144/255f, 192/255f),
new Color(5/255f, 112/255f, 176/255f),
new Color(4/255f, 90/255f, 141/255f),
new Color(2/255f, 56/255f, 88/255f),
};
/// <summary>Returns a color for the specified class.</summary>
/// <param name="classes">Number of classes. Must be between 1 and 9.</param>
/// <param name="index">Index of the color class. Must be between 0 and classes-1.</param>
public static Color GetColor (int classes, int index) {
if (index < 0 || index >= classes) throw new System.ArgumentOutOfRangeException("index", "Index must be less than classes and at least 0");
if (classes <= 0 || classes > 9) throw new System.ArgumentOutOfRangeException("classes", "Only up to 9 classes are supported");
return Colors[(classes - 1)*classes/2 + index];
}
}
}
}
}

View File

@@ -0,0 +1,18 @@
fileFormatVersion: 2
guid: d6bc950098e69c91298e2e39d68b5c8d
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
AssetOrigin:
serializedVersion: 1
productId: 162772
packageName: ALINE
packageVersion: 1.7.6
assetPath: Packages/com.arongranberg.aline/Palette.cs
uploadId: 700292

View File

@@ -0,0 +1,123 @@
using Unity.Collections.LowLevel.Unsafe;
using Unity.Mathematics;
using UnityEngine;
using Unity.Burst;
using Unity.Collections;
using Unity.Jobs;
namespace Drawing {
using static CommandBuilder;
[BurstCompile]
internal struct PersistentFilterJob : IJob {
[NativeDisableUnsafePtrRestriction]
public unsafe UnsafeAppendBuffer* buffer;
public float time;
public void Execute () {
var stackPersist = new NativeArray<bool>(GeometryBuilderJob.MaxStackSize, Allocator.Temp, NativeArrayOptions.ClearMemory);
var stackScope = new NativeArray<int>(GeometryBuilderJob.MaxStackSize, Allocator.Temp, NativeArrayOptions.ClearMemory);
unsafe {
// Store in local variables for performance (makes it possible to use registers for a lot of fields)
var bufferPersist = *buffer;
long writeOffset = 0;
long readOffset = 0;
bool shouldWrite = false;
int stackSize = 0;
long lastNonMetaWrite = -1;
while (readOffset < bufferPersist.Length) {
#if ENABLE_UNITY_COLLECTIONS_CHECKS
UnityEngine.Assertions.Assert.IsTrue(readOffset + UnsafeUtility.SizeOf<Command>() <= bufferPersist.Length);
#endif
var cmd = *(Command*)((byte*)bufferPersist.Ptr + readOffset);
var cmdBit = 1 << ((int)cmd & 0xFF);
bool isMeta = (cmdBit & StreamSplitter.MetaCommands) != 0;
int size = StreamSplitter.CommandSizes[(int)cmd & 0xFF] + ((cmd & Command.PushColorInline) != 0 ? UnsafeUtility.SizeOf<Color32>() : 0);
if ((cmd & (Command)0xFF) == Command.Text) {
// Very pretty way of reading the TextData struct right after the command label and optional Color32
var data = *((TextData*)((byte*)bufferPersist.Ptr + readOffset + size) - 1);
// Add the size of the embedded string in the buffer
size += data.numCharacters * UnsafeUtility.SizeOf<System.UInt16>();
} else if ((cmd & (Command)0xFF) == Command.Text3D) {
// Very pretty way of reading the TextData struct right after the command label and optional Color32
var data = *((TextData3D*)((byte*)bufferPersist.Ptr + readOffset + size) - 1);
// Add the size of the embedded string in the buffer
size += data.numCharacters * UnsafeUtility.SizeOf<System.UInt16>();
}
#if ENABLE_UNITY_COLLECTIONS_CHECKS
UnityEngine.Assertions.Assert.IsTrue(readOffset + size <= bufferPersist.Length);
UnityEngine.Assertions.Assert.IsTrue(writeOffset + size <= bufferPersist.Length);
#endif
if (shouldWrite || isMeta) {
if (!isMeta) lastNonMetaWrite = writeOffset;
if (writeOffset != readOffset) {
// We need to use memmove instead of memcpy because the source and destination regions may overlap
UnsafeUtility.MemMove((byte*)bufferPersist.Ptr + writeOffset, (byte*)bufferPersist.Ptr + readOffset, size);
}
writeOffset += size;
}
if ((cmdBit & StreamSplitter.PushCommands) != 0) {
if ((cmd & (Command)0xFF) == Command.PushPersist) {
// Very pretty way of reading the PersistData struct right after the command label and optional Color32
// (even though a PushColorInline command is not usually combined with PushPersist)
var data = *((PersistData*)((byte*)bufferPersist.Ptr + readOffset + size) - 1);
// Scopes only survive if this condition is true
shouldWrite = time <= data.endTime;
}
stackScope[stackSize] = (int)(writeOffset - size);
stackPersist[stackSize] = shouldWrite;
stackSize++;
#if ENABLE_UNITY_COLLECTIONS_CHECKS
if (stackSize >= GeometryBuilderJob.MaxStackSize) throw new System.Exception("Push commands are too deeply nested. This can happen if you have deeply nested WithMatrix or WithColor scopes.");
#else
if (stackSize >= GeometryBuilderJob.MaxStackSize) {
buffer->Length = 0;
return;
}
#endif
} else if ((cmdBit & StreamSplitter.PopCommands) != 0) {
stackSize--;
#if ENABLE_UNITY_COLLECTIONS_CHECKS
if (stackSize < 0) throw new System.Exception("Trying to issue a pop command but there is no corresponding push command");
#else
if (stackSize < 0) {
buffer->Length = 0;
return;
}
#endif
// If a scope was pushed and later popped, but no actual draw commands were written to the buffers
// inside that scope then we erase the whole scope.
if ((int)lastNonMetaWrite < stackScope[stackSize]) {
writeOffset = (long)stackScope[stackSize];
}
shouldWrite = stackPersist[stackSize];
}
readOffset += size;
}
bufferPersist.Length = (int)writeOffset;
#if ENABLE_UNITY_COLLECTIONS_CHECKS
if (stackSize != 0) throw new System.Exception("Inconsistent push/pop commands. Are your push and pop commands properly matched?");
#else
if (stackSize != 0) {
buffer->Length = 0;
return;
}
#endif
*buffer = bufferPersist;
}
}
}
}

View File

@@ -0,0 +1,18 @@
fileFormatVersion: 2
guid: 352622dd645d47531b288c1991fab7ec
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
AssetOrigin:
serializedVersion: 1
productId: 162772
packageName: ALINE
packageVersion: 1.7.6
assetPath: Packages/com.arongranberg.aline/PersistentFilter.cs
uploadId: 700292

View File

@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 63cd37b8d1e6fcae7955d6b90543349f
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,76 @@
#ifdef UNITY_HDRP
#include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Common.hlsl"
#include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Color.hlsl"
#include "Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/ShaderVariables.hlsl"
#include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Color.hlsl"
// Unity does not define the UNITY_DECLARE_TEX2D macro when using HDRP, at least at the time of writing this.
// But luckily HDRP is only supported on platforms where separate sampler states are supported, so we can define it like this.
#if !defined(UNITY_DECLARE_TEX2D)
// This is copied from com.unity.shadergraph@14.0.6/Editor/Generation/Targets/BuiltIn/ShaderLibrary/Shim/HLSLSupportShim.hlsl
#define UNITY_DECLARE_TEX2D(tex) TEXTURE2D(tex); SAMPLER(sampler##tex)
#endif
#if !defined(UNITY_SAMPLE_TEX2D)
#define UNITY_SAMPLE_TEX2D(tex,coord) SAMPLE_TEXTURE2D(tex, sampler##tex, coord)
#endif
// This is not defined in HDRP either, but we do know that HDRP only supports these platforms (at least I think so...)
#define UNITY_SEPARATE_TEXTURE_SAMPLER
#else
#include "UnityCG.cginc"
// These exist in the render pipelines, but not in UnityCG
float4 TransformObjectToHClip(float3 x) {
return UnityObjectToClipPos(float4(x, 1.0));
}
half3 FastSRGBToLinear(half3 sRGB) {
return GammaToLinearSpace(sRGB);
}
#endif
// Tranforms a direction from object to homogenous space
inline float4 UnityObjectToClipDirection(in float3 pos) {
// More efficient than computing M*VP matrix product
return mul(UNITY_MATRIX_VP, mul(UNITY_MATRIX_M, float4(pos, 0)));
}
float lengthsq(float3 v) {
return dot(v,v);
}
float4 ComputeScreenPos (float4 pos, float projectionSign)
{
float4 o = pos * 0.5f;
o.xy = float2(o.x, o.y * projectionSign) + o.w;
o.zw = pos.zw;
return o;
}
// Converts to linear space from sRGB if linear is the current color space
inline float3 ConvertSRGBToDestinationColorSpace(float3 sRGB) {
#ifdef UNITY_COLORSPACE_GAMMA
return sRGB;
#else
return FastSRGBToLinear(sRGB);
#endif
}
struct appdata_color {
float4 vertex : POSITION;
half4 color : COLOR;
float3 normal : NORMAL;
float2 uv : TEXCOORD0;
UNITY_VERTEX_INPUT_INSTANCE_ID
};
// Unity sadly does not include a bias macro for texture sampling.
#if defined(UNITY_SEPARATE_TEXTURE_SAMPLER)
#define UNITY_SAMPLE_TEX2D_BIAS(tex, uv, bias) tex.SampleBias(sampler##tex, uv, bias)
#else
#define UNITY_SAMPLE_TEX2D_BIAS(tex, uv, bias) tex2Dbias(float4(uv, 0, bias))
#endif

View File

@@ -0,0 +1,16 @@
fileFormatVersion: 2
guid: 1b135520270114849b121a628fe61ba9
timeCreated: 1472987846
licenseType: Store
ShaderImporter:
defaultTextures: []
userData:
assetBundleName:
assetBundleVariant:
AssetOrigin:
serializedVersion: 1
productId: 162772
packageName: ALINE
packageVersion: 1.7.6
assetPath: Packages/com.arongranberg.aline/Resources/aline_common.cginc
uploadId: 700292

View File

@@ -0,0 +1,107 @@
#include "aline_common.cginc"
struct LineData {
float3 start;
uint joinHintInstanceIndex;
float3 end;
float width;
float4 color;
};
static float2 vertexToSide[6] = {
float2(-1, -1),
float2(1, -1),
float2(1, 1),
float2(-1, -1),
float2(1, 1),
float2(-1, 1),
};
struct line_v2f {
half4 col : COLOR;
noperspective float lineWidth: TEXCOORD3;
noperspective float uv : TEXCOORD4;
UNITY_VERTEX_OUTPUT_STEREO
};
// d = normalized distance to line
float lineAA(float d) {
d = max(min(d, 1.0), 0) * 1.116;
float v = 0.93124*d*d*d - 1.42215*d*d - 0.42715*d + 0.95316;
v /= 0.95316;
return max(v, 0);
}
float calculateLineAlpha(line_v2f i, float pixelWidth, float falloffTextureScreenPixels) {
float dist = abs((i.uv - 0.5)*2);
float falloffFractionOfWidth = falloffTextureScreenPixels/(pixelWidth*0.5);
float a = lineAA((abs(dist) - (1 - falloffFractionOfWidth))/falloffFractionOfWidth);
return a;
}
line_v2f line_vert (appdata_color v, float pixelWidth, float lengthPadding, out float4 outpos : SV_POSITION) {
UNITY_SETUP_INSTANCE_ID(v);
line_v2f o;
UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(o);
float4 Mv = TransformObjectToHClip(v.vertex.xyz);
// float4 Mv = UnityObjectToClipPos(v.vertex);
float3 n = normalize(v.normal);
float4 Mn = UnityObjectToClipDirection(n);
// delta is the limit value of doing the calculation
// x1 = M*v
// x2 = M*(v + e*n)
// lim e->0 (x2/x2.w - x1/x1.w)/e
// Where M = UNITY_MATRIX_MVP, v = v.vertex, n = v.normal, e = a very small value
// We can calculate this limit as follows
// lim e->0 (M*(v + e*n))/(M*(v + e*n)).w - M*v/(M*v).w / e
// lim e->0 ((M*v).w*M*(v + e*n))/((M*v).w * (M*(v + e*n)).w) - M*v*(M*(v + e*n)).w/((M*(v + e*n)).w * (M*v).w) / e
// lim e->0 ((M*v).w*M*(v + e*n) - M*v*(M*(v + e*n)).w)/((M*v).w * (M*(v + e*n)).w) / e
// lim e->0 ((M*v).w*M*(v + e*n) - M*v*(M*(v + e*n)).w)/((M*v).w * (M*v).w) / e
// lim e->0 ((M*v).w*M*v + (M*v).w*e*n - M*v*(M*(v + e*n)).w)/((M*v).w * (M*v).w) / e
// lim e->0 ((M*v).w*M*v + (M*v).w*e*n - M*v*(M*v).w - M*v*(M*e*n).w)/((M*v).w * (M*v).w) / e
// lim e->0 ((M*v).w*M*e*n - M*v*(M*e*n).w)/((M*v).w * (M*v).w) / e
// lim e->0 ((M*v).w*M*n - M*v*(M*n).w)/((M*v).w * (M*v).w)
// lim e->0 M*n/(M*v).w - (M*v*(M*n).w)/((M*v).w * (M*v).w)
// Previously the above calculation was done with just e = 0.001, however this could yield graphical artifacts
// at large coordinate values as the floating point coordinates would start to run out of precision.
// Essentially we calculate the normal of the line in screen space.
float4 delta = (Mn - Mv*Mn.w/Mv.w) / Mv.w;
// The delta (direction of the line in screen space) needs to be normalized in pixel space.
// Otherwise it would look weird when stretched to a non-square viewport
delta.xy *= _ScreenParams.xy;
delta.xy = normalize(delta.xy);
// Handle DirectX properly. See https://docs.unity3d.com/Manual/SL-PlatformDifferences.html
float2 normalizedScreenSpaceNormal = float2(-delta.y, delta.x) * _ProjectionParams.x;
float2 screenSpaceNormal = normalizedScreenSpaceNormal / _ScreenParams.xy;
float4 sn = float4(screenSpaceNormal.x, screenSpaceNormal.y, 0, 0);
// Left (-1) or Right (1) of the line
float side = (v.uv.x - 0.5)*2;
// Make the line wide
outpos = (Mv / Mv.w) + side*sn*pixelWidth*0.5;
// -1 or +1 if this vertex is at the start or end of the line respectively.
float forwards = (v.uv.y - 0.5)*2;
// Add some additional length to the line (usually on the order of 0.5 px)
// to avoid occational 1 pixel holes in sequences of contiguous lines.
outpos.xy += forwards*(delta.xy / _ScreenParams.xy)*0.5*lengthPadding;
// Multiply by w because homogeneous coordinates (it still needs to be clipped)
outpos *= Mv.w;
o.lineWidth = pixelWidth;
o.uv = v.uv.x;
return o;
}
line_v2f line_vert_raw (appdata_color v, float4 tint, float pixelWidth, float lengthPadding, out float4 outpos) {
pixelWidth *= length(v.normal);
line_v2f o = line_vert(v, pixelWidth, lengthPadding, outpos);
o.col = v.color * tint;
o.col.rgb = ConvertSRGBToDestinationColorSpace(o.col.rgb);
return o;
}

View File

@@ -0,0 +1,17 @@
fileFormatVersion: 2
guid: 605d8a659194d1a2695d7c0ecd7f1c37
ShaderImporter:
externalObjects: {}
defaultTextures: []
nonModifiableTextures: []
preprocessorOverride: 0
userData:
assetBundleName:
assetBundleVariant:
AssetOrigin:
serializedVersion: 1
productId: 162772
packageName: ALINE
packageVersion: 1.7.6
assetPath: Packages/com.arongranberg.aline/Resources/aline_common_line.cginc
uploadId: 700292

View File

@@ -0,0 +1,21 @@
#include "aline_common.cginc"
struct v2f {
float4 pos : SV_POSITION;
float4 col : COLOR;
float2 uv : TEXCOORD0;
UNITY_VERTEX_OUTPUT_STEREO
};
v2f vert_base (appdata_color v, float4 tint, float scale) {
UNITY_SETUP_INSTANCE_ID(v);
v2f o;
UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(o);
o.pos = TransformObjectToHClip(v.vertex.xyz);
float4 worldSpace = mul(UNITY_MATRIX_M, v.vertex);
o.uv = float2 (worldSpace.x*scale,worldSpace.z*scale);
o.col = v.color * tint;
o.col.rgb = ConvertSRGBToDestinationColorSpace(o.col.rgb);
return o;
}

View File

@@ -0,0 +1,17 @@
fileFormatVersion: 2
guid: 74e11d375a4c443bebed3fd6b0bb0e11
ShaderImporter:
externalObjects: {}
defaultTextures: []
nonModifiableTextures: []
preprocessorOverride: 0
userData:
assetBundleName:
assetBundleVariant:
AssetOrigin:
serializedVersion: 1
productId: 162772
packageName: ALINE
packageVersion: 1.7.6
assetPath: Packages/com.arongranberg.aline/Resources/aline_common_surface.cginc
uploadId: 700292

View File

@@ -0,0 +1,107 @@
#include "aline_common.cginc"
float4 _Color;
float4 _FadeColor;
UNITY_DECLARE_TEX2D(_MainTex);
UNITY_DECLARE_TEX2D(_FallbackTex);
float _FallbackAmount;
float _TransitionPoint;
float _MipBias;
float _GammaCorrection;
struct vertex {
float4 pos : POSITION;
float4 color : COLOR;
float2 uv : TEXCOORD0;
UNITY_VERTEX_INPUT_INSTANCE_ID
};
struct v2f {
float4 col : COLOR;
float2 uv: TEXCOORD0;
UNITY_VERTEX_OUTPUT_STEREO
};
v2f vert_base (vertex v, float4 tint, out float4 outpos : SV_POSITION) {
UNITY_SETUP_INSTANCE_ID(v);
v2f o;
UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(o);
o.uv = v.uv;
o.col = v.color * tint;
o.col.rgb = ConvertSRGBToDestinationColorSpace(o.col.rgb);
outpos = TransformObjectToHClip(v.pos.xyz);
return o;
}
// float getAlpha2(float2 uv) {
// const float textureWidth = 1024;
// float pixelSize = 0.5 * length(float2(ddx(uv.x), ddy(uv.x))) * textureWidth;
// // Depends on texture generation settings
// const float falloffPixels = 5;
// float sample = UNITY_SAMPLE_TEX2D(_MainTex, uv).a;
// // float scale = 1.0 / fwidth(sample);
// float signedDistance1 = (0.5 - sample) * falloffPixels;
// float signedDistance2 = signedDistance1 / pixelSize;
// return lineAA(signedDistance2 + 0.5);
// // float signedDistance = (sample - 0.5) * scale;
// // return fwidth(sample) * 10;
// // Use two different distance thresholds to get dynamically stroked text
// // float color = clamp(signedDistance + 0.5, 0.0, 1.0);
// // return color;
// }
float getAlpha(float2 uv) {
float rawSignedDistance = UNITY_SAMPLE_TEX2D(_MainTex, uv).a;
float scale = 1.0 / fwidth(rawSignedDistance);
float thresholdedDistance = (rawSignedDistance - 0.5) * scale;
float color = clamp(thresholdedDistance + 0.5, 0.0, 1.0);
return color;
}
// Shader modified from https://evanw.github.io/font-texture-generator/example-webgl/
float4 frag (v2f i, float4 screenPos : VPOS) : SV_Target {
// float halfpixelSize = 0.5 * 0.5 * length(float2(ddx(i.uv.x), ddy(i.uv.x)));
// float fcolor0 = UNITY_SAMPLE_TEX2D(_FallbackTex, i.uv).a;
// float fcolor1 = UNITY_SAMPLE_TEX2D(_FallbackTex, i.uv + float2(halfpixelSize * 0.6, halfpixelSize * 0.3)).a;
// float fcolor2 = UNITY_SAMPLE_TEX2D(_FallbackTex, i.uv + float2(-halfpixelSize * 0.3, halfpixelSize * 0.6)).a;
// float fcolor3 = UNITY_SAMPLE_TEX2D(_FallbackTex, i.uv + float2(-halfpixelSize * 0.6, -halfpixelSize * 0.3)).a;
// float fcolor4 = UNITY_SAMPLE_TEX2D(_FallbackTex, i.uv + float2(halfpixelSize * 0.3, -halfpixelSize * 0.6)).a;
// float fallbackAlpha = (fcolor0 + fcolor1 + fcolor2 + fcolor3 + fcolor4) * 0.2;
// Bias the texture sampling to use a lower mipmap level. This makes the text much sharper and clearer.
float fallbackAlpha = UNITY_SAMPLE_TEX2D_BIAS(_FallbackTex, i.uv, _MipBias).a;
// The fallback is used for small font sizes.
// Boost the alpha to make it more legible
fallbackAlpha *= 1.2;
// Approximate size of one screen pixel in UV-space
float pixelSize = length(float2(ddx(i.uv.x), ddy(i.uv.x)));
// float pixelSize2 = length(float2(ddx(i.uv.y), ddy(i.uv.y)));
// float color0 = getAlpha(i.uv);
// float color1 = getAlpha(i.uv + float2(halfpixelSize * 0.6, halfpixelSize * 0.3));
// float color2 = getAlpha(i.uv + float2(-halfpixelSize * 0.3, halfpixelSize * 0.6));
// float color3 = getAlpha(i.uv + float2(-halfpixelSize * 0.6, -halfpixelSize * 0.3));
// float color4 = getAlpha(i.uv + float2(halfpixelSize * 0.3, -halfpixelSize * 0.6));
// float color = (color0 + color1 + color2 + color3 + color4) * 0.2;
float sdfAlpha = getAlpha(i.uv);
// Transition from the SDF font to the fallback when the font's size on the screen
// starts getting smaller than the size in the texture.
float sdfTextureWidth = 1024;
// How sharp the transition from sdf to fallback is.
// A smaller value will make the transition cover a larger range of font sizes
float transitionSharpness = 10;
float blend = clamp(transitionSharpness*(_TransitionPoint*pixelSize*sdfTextureWidth - 1.0), 0, 1);
float alpha = lerp(sdfAlpha, fallbackAlpha, blend * _FallbackAmount);
float4 blendcolor = float4(1,1,1,1);
// blendcolor = lerp(float4(0, 1, 0, 1), float4(1, 0, 0, 1), blend);
return blendcolor * i.col * float4(1, 1, 1, alpha);
}

View File

@@ -0,0 +1,14 @@
fileFormatVersion: 2
guid: a4bc56dd8cf7ec1bebb90e3a60d73473
ShaderIncludeImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
AssetOrigin:
serializedVersion: 1
productId: 162772
packageName: ALINE
packageVersion: 1.7.6
assetPath: Packages/com.arongranberg.aline/Resources/aline_common_text.cginc
uploadId: 700292

Binary file not shown.

After

Width:  |  Height:  |  Size: 30 KiB

View File

@@ -0,0 +1,141 @@
fileFormatVersion: 2
guid: a41cbdfe1465ffd70b661de460173297
TextureImporter:
internalIDToNameTable: []
externalObjects: {}
serializedVersion: 11
mipmaps:
mipMapMode: 0
enableMipMap: 1
sRGBTexture: 0
linearTexture: 0
fadeOut: 0
borderMipMap: 0
mipMapsPreserveCoverage: 0
alphaTestReferenceValue: 0.5
mipMapFadeDistanceStart: 5
mipMapFadeDistanceEnd: 8
bumpmap:
convertToNormalMap: 0
externalNormalMap: 0
heightScale: 0.25
normalMapFilter: 0
flipGreenChannel: 0
isReadable: 0
streamingMipmaps: 0
streamingMipmapsPriority: 0
vTOnly: 0
ignoreMasterTextureLimit: 0
grayScaleToAlpha: 0
generateCubemap: 6
cubemapConvolution: 0
seamlessCubemap: 0
textureFormat: 1
maxTextureSize: 2048
textureSettings:
serializedVersion: 2
filterMode: 2
aniso: 8
mipBias: 0
wrapU: 1
wrapV: 1
wrapW: 1
nPOTScale: 1
lightmap: 0
compressionQuality: 50
spriteMode: 0
spriteExtrude: 1
spriteMeshType: 1
alignment: 0
spritePivot: {x: 0.5, y: 0.5}
spritePixelsToUnits: 100
spriteBorder: {x: 0, y: 0, z: 0, w: 0}
spriteGenerateFallbackPhysicsShape: 1
alphaUsage: 2
alphaIsTransparency: 0
spriteTessellationDetail: -1
textureType: 0
textureShape: 1
singleChannelComponent: 0
flipbookRows: 1
flipbookColumns: 1
maxTextureSizeSet: 0
compressionQualitySet: 0
textureFormatSet: 0
ignorePngGamma: 0
applyGammaDecoding: 1
swizzle: 50462976
platformSettings:
- serializedVersion: 3
buildTarget: DefaultTexturePlatform
maxTextureSize: 1024
resizeAlgorithm: 0
textureFormat: 1
textureCompression: 0
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
- serializedVersion: 3
buildTarget: Standalone
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: 1
textureCompression: 0
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
- serializedVersion: 3
buildTarget: Server
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: 1
textureCompression: 0
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
- serializedVersion: 3
buildTarget: WebGL
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: 1
textureCompression: 0
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
spriteSheet:
serializedVersion: 2
sprites: []
outline: []
physicsShape: []
bones: []
spriteID:
internalID: 0
vertices: []
indices:
edges: []
weights: []
secondaryTextures: []
nameFileIdTable: {}
pSDRemoveMatte: 0
userData:
assetBundleName:
assetBundleVariant:
AssetOrigin:
serializedVersion: 1
productId: 162772
packageName: ALINE
packageVersion: 1.7.6
assetPath: Packages/com.arongranberg.aline/Resources/aline_fallback_font.png
uploadId: 700292

Binary file not shown.

After

Width:  |  Height:  |  Size: 36 KiB

View File

@@ -0,0 +1,113 @@
fileFormatVersion: 2
guid: cecd6d13eb22ad90fb21ac4b8b925743
TextureImporter:
internalIDToNameTable: []
externalObjects: {}
serializedVersion: 11
mipmaps:
mipMapMode: 0
enableMipMap: 1
sRGBTexture: 0
linearTexture: 0
fadeOut: 0
borderMipMap: 0
mipMapsPreserveCoverage: 0
alphaTestReferenceValue: 0.5
mipMapFadeDistanceStart: 1
mipMapFadeDistanceEnd: 3
bumpmap:
convertToNormalMap: 0
externalNormalMap: 0
heightScale: 0.25
normalMapFilter: 0
isReadable: 0
streamingMipmaps: 0
streamingMipmapsPriority: 0
vTOnly: 0
grayScaleToAlpha: 0
generateCubemap: 6
cubemapConvolution: 0
seamlessCubemap: 0
textureFormat: 1
maxTextureSize: 2048
textureSettings:
serializedVersion: 2
filterMode: 1
aniso: 10
mipBias: -100
wrapU: 1
wrapV: 1
wrapW: 1
nPOTScale: 1
lightmap: 0
compressionQuality: 50
spriteMode: 0
spriteExtrude: 1
spriteMeshType: 1
alignment: 0
spritePivot: {x: 0.5, y: 0.5}
spritePixelsToUnits: 100
spriteBorder: {x: 0, y: 0, z: 0, w: 0}
spriteGenerateFallbackPhysicsShape: 1
alphaUsage: 2
alphaIsTransparency: 0
spriteTessellationDetail: -1
textureType: 0
textureShape: 1
singleChannelComponent: 0
maxTextureSizeSet: 0
compressionQualitySet: 0
textureFormatSet: 0
ignorePngGamma: 0
applyGammaDecoding: 1
platformSettings:
- serializedVersion: 3
buildTarget: DefaultTexturePlatform
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: 1
textureCompression: 3
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
- serializedVersion: 3
buildTarget: Standalone
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: 1
textureCompression: 3
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
spriteSheet:
serializedVersion: 2
sprites: []
outline: []
physicsShape: []
bones: []
spriteID:
internalID: 0
vertices: []
indices:
edges: []
weights: []
secondaryTextures: []
spritePackingTag:
pSDRemoveMatte: 0
pSDShowRemoveMatteOption: 0
userData:
assetBundleName:
assetBundleVariant:
AssetOrigin:
serializedVersion: 1
productId: 162772
packageName: ALINE
packageVersion: 1.7.6
assetPath: Packages/com.arongranberg.aline/Resources/aline_font.png
uploadId: 700292

Some files were not shown because too many files have changed in this diff Show More