Merge branch 'refs/heads/feature/player-inventory' into dev

# Conflicts:
#	Assets/DefaultNetworkPrefabs.asset
This commit is contained in:
Chris
2025-10-01 14:34:02 -04:00
91 changed files with 24523 additions and 550 deletions

View File

@@ -25,22 +25,7 @@ MonoBehaviour:
SourceHashToOverride: 0
OverridingTargetPrefab: {fileID: 0}
- Override: 0
Prefab: {fileID: 2757828562731694833, guid: 7da6b9047372a5742ba2987b05058116, type: 3}
SourcePrefabToOverride: {fileID: 0}
SourceHashToOverride: 0
OverridingTargetPrefab: {fileID: 0}
- Override: 0
Prefab: {fileID: 2439326541263862202, guid: 95d2e4101fc718f44a20928f1d2905fe, type: 3}
SourcePrefabToOverride: {fileID: 0}
SourceHashToOverride: 0
OverridingTargetPrefab: {fileID: 0}
- Override: 0
Prefab: {fileID: 2757828562731694833, guid: da90c92b396d2db4796783b8ddc02b0c, type: 3}
SourcePrefabToOverride: {fileID: 0}
SourceHashToOverride: 0
OverridingTargetPrefab: {fileID: 0}
- Override: 0
Prefab: {fileID: 2439326541263862202, guid: 9972d2c78bee8f342b22a66d3dc76255, type: 3}
Prefab: {fileID: 164825482655611750, guid: 135c5b2038f9af24da4cb9260381bab7, type: 3}
SourcePrefabToOverride: {fileID: 0}
SourceHashToOverride: 0
OverridingTargetPrefab: {fileID: 0}

View File

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

View File

@@ -0,0 +1,141 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!21 &2100000
Material:
serializedVersion: 8
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_Name: GlassMat
m_Shader: {fileID: 4800000, guid: 933532a4fcc9baf4fa0491de14d08ed7, type: 3}
m_Parent: {fileID: 0}
m_ModifiedSerializedProperties: 0
m_ValidKeywords:
- _ALPHAPREMULTIPLY_ON
- _SURFACE_TYPE_TRANSPARENT
m_InvalidKeywords: []
m_LightmapFlags: 4
m_EnableInstancingVariants: 0
m_DoubleSidedGI: 0
m_CustomRenderQueue: 3000
stringTagMap:
RenderType: Transparent
disabledShaderPasses:
- MOTIONVECTORS
- DepthOnly
- SHADOWCASTER
m_LockedProperties:
m_SavedProperties:
serializedVersion: 3
m_TexEnvs:
- _BaseMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _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}
- _SpecGlossMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- unity_Lightmaps:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- unity_LightmapsInd:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- unity_ShadowMasks:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
m_Ints: []
m_Floats:
- _AddPrecomputedVelocity: 0
- _AlphaClip: 0
- _AlphaToMask: 0
- _Blend: 0
- _BlendModePreserveSpecular: 1
- _BumpScale: 1
- _ClearCoatMask: 0
- _ClearCoatSmoothness: 0
- _Cull: 2
- _Cutoff: 0.5
- _DetailAlbedoMapScale: 1
- _DetailNormalMapScale: 1
- _DstBlend: 10
- _DstBlendAlpha: 10
- _EnvironmentReflections: 1
- _GlossMapScale: 0
- _Glossiness: 0
- _GlossyReflections: 0
- _Metallic: 0
- _OcclusionStrength: 1
- _Parallax: 0.005
- _QueueOffset: 0
- _ReceiveShadows: 1
- _Smoothness: 0.5
- _SmoothnessTextureChannel: 0
- _SpecularHighlights: 1
- _SrcBlend: 1
- _SrcBlendAlpha: 1
- _Surface: 1
- _WorkflowMode: 1
- _XRMotionVectorsPass: 1
- _ZWrite: 0
m_Colors:
- _BaseColor: {r: 0.7688679, g: 0.9094787, b: 1, a: 0.42745098}
- _Color: {r: 0.76886797, g: 0.9094787, b: 1, a: 0.42745098}
- _EmissionColor: {r: 0, g: 0, b: 0, a: 1}
- _SpecColor: {r: 0.19999996, g: 0.19999996, b: 0.19999996, a: 1}
m_BuildTextureStacks: []
m_AllowLocking: 1
--- !u!114 &4493835573570288372
MonoBehaviour:
m_ObjectHideFlags: 11
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 0}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: d0353a89b1f911e48b9e16bdc9f2e058, type: 3}
m_Name:
m_EditorClassIdentifier: Unity.RenderPipelines.Universal.Editor::UnityEditor.Rendering.Universal.AssetVersion
version: 10

View File

@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 1dca118a1efeed74a833e96aa912810d
NativeFormatImporter:
externalObjects: {}
mainObjectFileID: 2100000
userData:
assetBundleName:
assetBundleVariant:

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: 135c5b2038f9af24da4cb9260381bab7
PrefabImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,15 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!134 &13400000
PhysicsMaterial:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_Name: ItemDropPhysics
serializedVersion: 2
m_DynamicFriction: 14.92
m_StaticFriction: 0.2
m_Bounciness: 1
m_FrictionCombine: 0
m_BounceCombine: 3

View File

@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 8ffa6cf73e7c18f4799941a5e9b779a3
NativeFormatImporter:
externalObjects: {}
mainObjectFileID: 13400000
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -31,7 +31,7 @@ Transform:
m_GameObject: {fileID: 2439326541263862202}
serializedVersion: 2
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 1, z: 0}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
m_Children:
@@ -85,8 +85,8 @@ Rigidbody:
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 2439326541263862202}
serializedVersion: 5
m_Mass: 1
m_LinearDamping: 0
m_Mass: 5.4
m_LinearDamping: 1.82
m_AngularDamping: 0.05
m_CenterOfMass: {x: 0, y: 0, z: 0}
m_InertiaTensor: {x: 1, y: 1, z: 1}
@@ -165,7 +165,7 @@ MonoBehaviour:
ShowTopMostFoldoutHeaderGroup: 1
NetworkRigidbodyBaseExpanded: 0
UseRigidBodyForMotion: 0
AutoUpdateKinematicState: 1
AutoUpdateKinematicState: 0
AutoSetKinematicOnDespawn: 0
--- !u!135 &-6903864654045134960
SphereCollider:
@@ -174,7 +174,7 @@ SphereCollider:
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 2439326541263862202}
m_Material: {fileID: 0}
m_Material: {fileID: 13400000, guid: 8ffa6cf73e7c18f4799941a5e9b779a3, type: 2}
m_IncludeLayers:
serializedVersion: 2
m_Bits: 0
@@ -186,7 +186,7 @@ SphereCollider:
m_ProvidesContacts: 0
m_Enabled: 1
serializedVersion: 3
m_Radius: 0.5
m_Radius: 0.32
m_Center: {x: 0, y: 0, z: 0}
--- !u!1 &9131744606799350632
GameObject:
@@ -216,7 +216,7 @@ Transform:
serializedVersion: 2
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_LocalScale: {x: 0.65529, y: 0.65529, z: 0.65529}
m_ConstrainProportionsScale: 0
m_Children: []
m_Father: {fileID: 8885804641608089777}

View File

@@ -12,6 +12,7 @@ MonoBehaviour:
m_Script: {fileID: 11500000, guid: b7f2c6caae048f64f91b54ae1442694c, type: 3}
m_Name: Test
m_EditorClassIdentifier: Core::Reset.Items.Weapon
itemName: Test Weapon
permanency: 0
essenceRequiredForPermanency: 0
weaponModel: {fileID: 0}

File diff suppressed because one or more lines are too long

View File

@@ -3,4 +3,5 @@ using UnityEngine;
public interface IInteractable{
public void Interact();
public void CancelInteract();
public void OnObserverDetected(EnvironmentObserver observer);
}

View File

@@ -3,5 +3,8 @@ using UnityEngine;
namespace Reset.Items{
public class Ability : Item, IEquipable{
public NodeCanvas.Framework.Graph behaviourGraph;
public override void DrawItemInfo(Vector3 position){
throw new System.NotImplementedException();
}
}
}

View File

@@ -4,7 +4,7 @@ using UnityEngine;
namespace Reset.Items{
public abstract class Item : ScriptableObject{
public string itemName{ get; set; }
public string itemName;
public float permanency;
public float essenceRequiredForPermanency;
@@ -20,5 +20,7 @@ namespace Reset.Items{
newItemDrop.item = this;
return newItemDrop;
}
public abstract void DrawItemInfo(Vector3 position);
}
}

View File

@@ -0,0 +1,100 @@
using System;
using System.Collections;
using Reset.Core.Tools;
using Sirenix.OdinInspector;
using Unity.Netcode;
using UnityEngine;
using Random = UnityEngine.Random;
namespace Reset.Items{
public class ItemContainer : NetworkBehaviour, IInteractable{
private bool available = true;
public GameObject itemDrop;
public int minItemsToSpawn;
public int maxItemsToSpawn;
public float cooldown;
public GameObject spawnPoint;
public Vector3 spawnRotationAngle;
public float spawnForce;
// Start is called once before the first execution of Update after the MonoBehaviour is created
void Start(){
}
// Update is called once per frame
void Update(){
}
[Button]
public void Interact(){
if (available){
StartCoroutine(SpawnItems());
}
available = false;
if (NetworkManager.Singleton.IsHost || NetworkManager.Singleton.IsConnectedClient) {
SetAvailabilityRpc(false);
}
}
IEnumerator SpawnItems(){
for (int i = 0; i < Random.Range(minItemsToSpawn, maxItemsToSpawn); i++) {
GameObject newDrop = Instantiate(itemDrop);
newDrop.transform.position = spawnPoint.transform.position;
newDrop.AddComponent<ItemDrop>();
Vector3 randomSpawnDirection = new Vector3(
Random.Range(-spawnRotationAngle.x, spawnRotationAngle.x),
Random.Range(-spawnRotationAngle.y, spawnRotationAngle.y),
Random.Range(-spawnRotationAngle.z, spawnRotationAngle.z)
);
Vector3 outputSpawnDirection = Quaternion.Euler(randomSpawnDirection) * spawnPoint.transform.forward;
// outputSpawnDirection = transform.TransformDirection(outputSpawnDirection);
DebugOverlayDrawer.ChangeValue("ItemContainer", "Last Random Spawn Direction", randomSpawnDirection);
DebugOverlayDrawer.ChangeValue("ItemContainer", "Output Spawn Direction", outputSpawnDirection);
newDrop.GetComponent<Rigidbody>().AddForce(outputSpawnDirection * spawnForce, ForceMode.VelocityChange);
yield return new WaitForSeconds(.2f);
}
StartCoroutine(WaitForCooldown());
}
IEnumerator WaitForCooldown(){
yield return new WaitForSeconds(cooldown);
if (NetworkManager.Singleton.IsHost || NetworkManager.Singleton.IsConnectedClient) {
SetAvailabilityRpc(true);
}
available = true;
}
public void CancelInteract(){
throw new NotImplementedException();
}
[Rpc(SendTo.Everyone)]
void SetAvailabilityRpc(bool isAvailable){
Debug.Log($"I made this {isAvailable}!");
available = isAvailable;
}
public void OnObserverDetected(EnvironmentObserver observer){
return;
}
}
}

View File

@@ -0,0 +1,2 @@
fileFormatVersion: 2
guid: 4ef1a4907f7107d4db5a3f19fc18a94b

View File

@@ -1,4 +1,5 @@
using System;
using Drawing;
using Unity.Netcode;
using UnityEngine;
@@ -8,7 +9,9 @@ namespace Reset.Items{
// Start is called once before the first execution of Update after the MonoBehaviour is created
void Start(){
if (NetworkManager.Singleton.IsHost || NetworkManager.Singleton.IsConnectedClient) {
GetComponent<NetworkObject>().Spawn();
}
}
// Update is called once per frame
@@ -34,5 +37,11 @@ namespace Reset.Items{
public void DestroyOnOwnerRpc(){
Destroy(gameObject);
}
public void OnObserverDetected(EnvironmentObserver observer){
Draw.ingame.Label2D(transform.position + Vector3.up * 2f, item.itemName, 24);
item.DrawItemInfo(transform.position);
}
}
}

View File

@@ -0,0 +1,5 @@
namespace Reset.Items{
public static class ItemUtilities{
}
}

View File

@@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: 1b888169dac844aea6cccec5726cebde
timeCreated: 1757367627

View File

@@ -1,4 +1,5 @@
using System;
using Drawing;
using NodeCanvas.StateMachines;
using UnityEngine;
@@ -11,5 +12,11 @@ namespace Reset.Items{
void Awake(){
}
public override void DrawItemInfo(Vector3 position){
Debug.Log("hiuh");
Draw.ingame.Label2D(position + Vector3.up * 1.6f, "Damage goes here");
Draw.ingame.Label2D(position + Vector3.up * 1.35f, "Speed goes here");
}
}
}

View File

@@ -127,6 +127,9 @@ public class EnvironmentObserver{
}
if (hit.transform != null) {
if (hit.transform.GetComponent<IInteractable>() != null) {
hit.transform.GetComponent<IInteractable>().OnObserverDetected(this);
}
return true;
}
}

File diff suppressed because one or more lines are too long

8
Assets/_Recovery.meta Normal file
View File

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

7253
Assets/_Recovery/0.unity Normal file

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: 2f63ef417a19ed541ade93496467efc1
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -9,6 +9,6 @@ AssetOrigin:
serializedVersion: 1
productId: 162772
packageName: ALINE
packageVersion: 1.7.6
packageVersion: 1.7.8
assetPath: Packages/com.arongranberg.aline/ALINE.asmdef
uploadId: 700292
uploadId: 754628

View File

@@ -13,6 +13,6 @@ AssetOrigin:
serializedVersion: 1
productId: 162772
packageName: ALINE
packageVersion: 1.7.6
packageVersion: 1.7.8
assetPath: Packages/com.arongranberg.aline/AlineHDRPCustomPass.cs
uploadId: 700292
uploadId: 754628

View File

@@ -32,19 +32,26 @@ namespace Drawing {
#if MODULE_RENDER_PIPELINES_UNIVERSAL_17_0_0_OR_NEWER
private class PassData {
public Camera camera;
public bool allowDisablingWireframe;
}
public override void RecordRenderGraph (RenderGraph renderGraph, ContextContainer frameData) {
var cameraData = frameData.Get<UniversalCameraData>();
var resourceData = frameData.Get<UniversalResourceData>();
// This could happen if the camera does not have a color target or depth target set.
// In that case we are probably rendering some kind of special effect. Skip ALINE rendering in that case.
if (!resourceData.activeColorTexture.IsValid() || !resourceData.activeDepthTexture.IsValid()) {
return;
}
using (IRasterRenderGraphBuilder builder = renderGraph.AddRasterRenderPass<PassData>("ALINE", out PassData passData, profilingSampler)) {
bool allowDisablingWireframe = false;
passData.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;
passData.allowDisablingWireframe = true;
}
builder.SetRenderAttachment(resourceData.activeColorTexture, 0);
@@ -53,7 +60,7 @@ namespace Drawing {
builder.SetRenderFunc<PassData>(
(PassData data, RasterGraphContext context) => {
DrawingManager.instance.ExecuteCustomRenderGraphPass(new DrawingData.CommandBufferWrapper { cmd2 = context.cmd, allowDisablingWireframe = allowDisablingWireframe }, data.camera);
DrawingManager.instance.ExecuteCustomRenderGraphPass(new DrawingData.CommandBufferWrapper { cmd2 = context.cmd, allowDisablingWireframe = data.allowDisablingWireframe }, data.camera);
}
);
}

View File

@@ -13,6 +13,6 @@ AssetOrigin:
serializedVersion: 1
productId: 162772
packageName: ALINE
packageVersion: 1.7.6
packageVersion: 1.7.8
assetPath: Packages/com.arongranberg.aline/AlineURPRenderPassFeature.cs
uploadId: 700292
uploadId: 754628

View File

@@ -1,8 +1,22 @@
## 1.7.8 (2025-05-06)
- Fixed a minor GC allocation happening every frame when using URP.
- Improved performance in standalone builds when nothing is being rendered.
- Fixed a significant memory leak when starting unity in batch mode.
## 1.7.7 (2025-03-20)
- Added a new tutorial on using caching to improve performance: \ref caching.
- Fixed \reflink{Draw.xz.SolidRectangle} would render the rectangle in the XY plane, instead of the XZ plane.
- Fixed an exception could be thrown when cameras were rendered without a color target.
- Added \reflink{PolylineWithSymbol.up}, to allow you to configure the orientation of the symbols. Previously it was hardcoded to Vector3.up.
- Added an offset parameter to \reflink{PolylineWithSymbol}, to allow shifting all symbols along the polyline. This is useful for animations.
- Fixed various minor glitches that could happen when using \reflink{PolylineWithSymbol}.
## 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)
## 1.7.5 (2024-08-06)
- 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.

View File

@@ -13,6 +13,6 @@ AssetOrigin:
serializedVersion: 1
productId: 162772
packageName: ALINE
packageVersion: 1.7.6
packageVersion: 1.7.8
assetPath: Packages/com.arongranberg.aline/CHANGELOG.md
uploadId: 700292
uploadId: 754628

View File

@@ -769,8 +769,12 @@ namespace Drawing {
}
/// <summary>
/// Multiply all coordinates until the next PopMatrix with the given matrix.
/// This differs from <see cref="PushSetMatrix"/> in that this stacks with all previously pushed matrices while <see cref="PushSetMatrix"/> does not.
/// Multiply all coordinates until the next <see cref="PopMatrix"/> with the given matrix.
///
/// PushMatrix and PushSetMatrix are slightly different:
///
/// - PushMatrix stacks with all previously pushed matrices. The active matrix becomes the product of the given matrix and the previously active one.
/// - PushSetMatrix sets the current matrix directly. The active matrix becomes the last pushed matrix.
/// </summary>
public void PushMatrix (Matrix4x4 matrix) {
Reserve<float4x4>();
@@ -779,8 +783,12 @@ namespace Drawing {
}
/// <summary>
/// Multiply all coordinates until the next PopMatrix with the given matrix.
/// This differs from <see cref="PushSetMatrix"/> in that this stacks with all previously pushed matrices while <see cref="PushSetMatrix"/> does not.
/// Multiply all coordinates until the next <see cref="PopMatrix"/> with the given matrix.
///
/// PushMatrix and PushSetMatrix are slightly different:
///
/// - PushMatrix stacks with all previously pushed matrices. The active matrix becomes the product of the given matrix and the previously active one.
/// - PushSetMatrix sets the current matrix directly. The active matrix becomes the last pushed matrix.
/// </summary>
public void PushMatrix (float4x4 matrix) {
Reserve<float4x4>();
@@ -789,8 +797,12 @@ namespace Drawing {
}
/// <summary>
/// Multiply all coordinates until the next PopMatrix with the given matrix.
/// This differs from <see cref="PushMatrix"/> in that this sets the current matrix directly while <see cref="PushMatrix"/> stacks with all previously pushed matrices.
/// Multiply all coordinates until the next <see cref="PopMatrix"/> with the given matrix.
///
/// PushMatrix and PushSetMatrix are slightly different:
///
/// - PushMatrix stacks with all previously pushed matrices. The active matrix becomes the product of the given matrix and the previously active one.
/// - PushSetMatrix sets the current matrix directly. The active matrix becomes the last pushed matrix.
/// </summary>
public void PushSetMatrix (Matrix4x4 matrix) {
Reserve<float4x4>();
@@ -800,7 +812,11 @@ namespace Drawing {
/// <summary>
/// Multiply all coordinates until the next PopMatrix with the given matrix.
/// This differs from <see cref="PushMatrix"/> in that this sets the current matrix directly while <see cref="PushMatrix"/> stacks with all previously pushed matrices.
///
/// PushMatrix and PushSetMatrix are slightly different:
///
/// - PushMatrix stacks with all previously pushed matrices. The active matrix becomes the product of the given matrix and the previously active one.
/// - PushSetMatrix sets the current matrix directly. The active matrix becomes the last pushed matrix.
/// </summary>
public void PushSetMatrix (float4x4 matrix) {
Reserve<float4x4>();
@@ -808,7 +824,12 @@ namespace Drawing {
Add(matrix);
}
/// <summary>Pops a matrix from the stack</summary>
/// <summary>
/// Pops a matrix from the stack.
///
/// See: <see cref="PushMatrix"/>
/// See: <see cref="PushSetMatrix"/>
/// </summary>
public void PopMatrix () {
Reserve(4);
Add(Command.PopMatrix);
@@ -1053,7 +1074,7 @@ namespace Drawing {
///
/// [Open online documentation to see images]
///
/// See: <see cref="Circle(float3,float3,float)"/>
/// See: <see cref="CommandBuilder.Circle(float3,float3,float)"/>
/// See: <see cref="CircleXY(float3,float,float,float)"/>
/// See: <see cref="Arc(float3,float3,float3)"/>
/// </summary>
@@ -1089,7 +1110,7 @@ namespace Drawing {
///
/// [Open online documentation to see images]
///
/// See: <see cref="Circle(float3,float3,float)"/>
/// See: <see cref="CommandBuilder.Circle(float3,float3,float)"/>
/// See: <see cref="Arc(float3,float3,float3)"/>
/// </summary>
/// <param name="center">Center of the circle or arc.</param>
@@ -1499,7 +1520,7 @@ namespace Drawing {
}
/// <summary>Determines the symbol to use for <see cref="PolylineWithSymbol"/></summary>
public enum SymbolDecoration {
public enum SymbolDecoration : byte {
/// <summary>
/// No symbol.
///
@@ -1611,20 +1632,43 @@ namespace Drawing {
float3 prev;
float offset;
readonly float symbolSize;
readonly float symbolSpacing;
readonly float connectingSegmentLength;
readonly float symbolPadding;
readonly float symbolOffset;
readonly SymbolDecoration symbol;
readonly bool reverseSymbols;
bool odd;
/// <summary>Create a new polyline with symbol generator.</summary>
/// <summary>
/// The up direction of the symbols.
///
/// This is used to determine the orientation of the symbols.
/// By default this is set to (0,1,0).
/// </summary>
public float3 up;
readonly SymbolDecoration symbol;
State state;
readonly bool reverseSymbols;
enum State : byte {
NotStarted,
ConnectingSegment,
PreSymbolPadding,
Symbol,
PostSymbolPadding,
}
/// <summary>
/// Create a new polyline with symbol generator.
///
/// Note: If symbolSize + 2*symbolPadding > symbolSpacing, the symbolSpacing parameter will be increased to accommodate the symbol and its padding.
/// There will be no connecting lines between the symbols in this case, as there's no space for them.
/// </summary>
/// <param name="symbol">The symbol to use</param>
/// <param name="symbolSize">The size of the symbol. In case of a circle, this is the diameter.</param>
/// <param name="symbolPadding">The padding on both sides of the symbol between the symbol and the line.</param>
/// <param name="symbolSpacing">The spacing between symbols. This is the distance between the centers of the symbols.</param>
/// <param name="reverseSymbols">If true, the symbols will be reversed. For cicles this has no effect, but arrowhead symbols will be reversed.</param>
public PolylineWithSymbol(SymbolDecoration symbol, float symbolSize, float symbolPadding, float symbolSpacing, bool reverseSymbols = false) {
/// <param name="offset">Distance to shift all symbols forward along the line. Useful for animations. If offset=0, the first symbol's center is at symbolSpacing/2.</param>
public PolylineWithSymbol(SymbolDecoration symbol, float symbolSize, float symbolPadding, float symbolSpacing, bool reverseSymbols = false, float offset = 0) {
if (symbolSpacing <= math.FLT_MIN_NORMAL) throw new System.ArgumentOutOfRangeException(nameof(symbolSpacing), "Symbol spacing must be greater than zero");
if (symbolSize <= math.FLT_MIN_NORMAL) throw new System.ArgumentOutOfRangeException(nameof(symbolSize), "Symbol size must be greater than zero");
if (symbolPadding < 0) throw new System.ArgumentOutOfRangeException(nameof(symbolPadding), "Symbol padding must non-negative");
@@ -1633,15 +1677,20 @@ namespace Drawing {
this.symbol = symbol;
this.symbolSize = symbolSize;
this.symbolPadding = symbolPadding;
this.symbolSpacing = math.max(0, symbolSpacing - symbolPadding * 2f - symbolSize);
this.connectingSegmentLength = math.max(0, symbolSpacing - symbolPadding * 2f - symbolSize);
// Calculate actual value, after clamping to a valid range
symbolSpacing = symbolPadding * 2 + symbolSize + connectingSegmentLength;
this.reverseSymbols = reverseSymbols;
this.up = new float3(0, 1, 0);
symbolOffset = symbol == SymbolDecoration.ArrowHead ? -0.25f * symbolSize : 0;
if (reverseSymbols) {
symbolOffset = -symbolOffset;
}
symbolOffset += 0.5f * symbolSize;
offset = -1;
odd = false;
this.offset = (this.connectingSegmentLength * 0.5f + offset) % symbolSpacing;
// Ensure the initial offset is always negative. This makes the state machine start in the correct state when the offset turns positive.
if (this.offset > 0) this.offset -= symbolSpacing;
this.state = State.NotStarted;
}
/// <summary>
@@ -1652,34 +1701,52 @@ namespace Drawing {
/// <param name="draw">The command builder to draw to. You can use a built-in builder like \reflink{Draw.editor} or \reflink{Draw.ingame}, or use a custom one.</param>
/// <param name="next">The next point in the polyline to move to.</param>
public void MoveTo (ref CommandBuilder draw, float3 next) {
if (offset == -1) {
offset = this.symbolSpacing * 0.5f;
if (state == State.NotStarted) {
prev = next;
state = State.ConnectingSegment;
return;
}
var len = math.length(next - prev);
var invLen = math.rcp(len);
var dir = next - prev;
float3 up = default;
if (symbol != SymbolDecoration.None) {
up = math.normalizesafe(math.cross(dir, math.cross(dir, new float3(0, 1, 0))));
up = math.normalizesafe(math.cross(dir, math.cross(dir, this.up)));
if (math.all(up == 0f)) {
up = new float3(0, 0, 1);
}
}
if (reverseSymbols) dir = -dir;
if (offset > 0 && !odd) {
draw.Line(prev, math.lerp(prev, next, math.min(offset * invLen, 1)));
}
while (offset < len) {
if (odd) {
var pLast = math.lerp(prev, next, offset * invLen);
offset += symbolSpacing;
var currentPositionOnSegment = 0f;
while (true) {
if (state == State.ConnectingSegment) {
if (offset >= 0 && offset != currentPositionOnSegment) {
currentPositionOnSegment = math.max(0, currentPositionOnSegment);
var pLast = math.lerp(prev, next, currentPositionOnSegment * invLen);
var p = math.lerp(prev, next, math.min(offset * invLen, 1));
draw.Line(pLast, p);
}
if (offset < len) {
state = State.PreSymbolPadding;
currentPositionOnSegment = offset;
offset += symbolPadding;
} else {
var p = math.lerp(prev, next, (offset + symbolOffset) * invLen);
break;
}
} else if (state == State.PreSymbolPadding) {
if (offset >= len) break;
state = State.Symbol;
currentPositionOnSegment = offset;
offset += symbolOffset;
} else if (state == State.Symbol) {
if (offset >= len) break;
if (offset >= 0) {
var p = math.lerp(prev, next, offset * invLen);
switch (symbol) {
case SymbolDecoration.None:
break;
@@ -1691,9 +1758,20 @@ namespace Drawing {
draw.Circle(p, up, symbolSize * 0.5f);
break;
}
offset += symbolSize + symbolPadding;
}
odd = !odd;
state = State.PostSymbolPadding;
currentPositionOnSegment = offset;
offset += -symbolOffset + symbolSize + symbolPadding;
} else if (state == State.PostSymbolPadding) {
if (offset >= len) break;
state = State.ConnectingSegment;
currentPositionOnSegment = offset;
offset += connectingSegmentLength;
} else {
throw new System.Exception("Invalid state");
}
}
offset -= len;
prev = next;

View File

@@ -13,6 +13,6 @@ AssetOrigin:
serializedVersion: 1
productId: 162772
packageName: ALINE
packageVersion: 1.7.6
packageVersion: 1.7.8
assetPath: Packages/com.arongranberg.aline/CommandBuilder.cs
uploadId: 700292
uploadId: 754628

View File

@@ -162,7 +162,7 @@ namespace Drawing {
///
/// [Open online documentation to see images]
///
/// See: <see cref="Circle(float3,float3,float)"/>
/// See: <see cref="CommandBuilder.Circle(float3,float3,float)"/>
/// See: <see cref="Arc(float3,float3,float3)"/>
/// </summary>
/// <param name="center">Center of the circle or arc.</param>
@@ -380,7 +380,7 @@ namespace Drawing {
/// 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));
draw.SolidPlane(xy ? new float3(rect.center.x, rect.center.y, 0.0f) : new float3(rect.center.x, 0, rect.center.y), xy ? XY_TO_XZ_ROTATION : XZ_TO_XZ_ROTATION, new float2(rect.width, rect.height));
}
/// <summary>

View File

@@ -13,6 +13,6 @@ AssetOrigin:
serializedVersion: 1
productId: 162772
packageName: ALINE
packageVersion: 1.7.6
packageVersion: 1.7.8
assetPath: Packages/com.arongranberg.aline/CommandBuilder2D.cs
uploadId: 700292
uploadId: 754628

View File

@@ -13,6 +13,6 @@ AssetOrigin:
serializedVersion: 1
productId: 162772
packageName: ALINE
packageVersion: 1.7.6
packageVersion: 1.7.8
assetPath: Packages/com.arongranberg.aline/CommandBuilder2DExtensions.cs
uploadId: 700292
uploadId: 754628

View File

@@ -13,6 +13,6 @@ AssetOrigin:
serializedVersion: 1
productId: 162772
packageName: ALINE
packageVersion: 1.7.6
packageVersion: 1.7.8
assetPath: Packages/com.arongranberg.aline/CommandBuilderExtensions.cs
uploadId: 700292
uploadId: 754628

View File

@@ -13,6 +13,6 @@ AssetOrigin:
serializedVersion: 1
productId: 162772
packageName: ALINE
packageVersion: 1.7.6
packageVersion: 1.7.8
assetPath: Packages/com.arongranberg.aline/Compatibility.cs
uploadId: 700292
uploadId: 754628

File diff suppressed because one or more lines are too long

View File

@@ -1,5 +1,5 @@
fileFormatVersion: 2
guid: b22e5f8074c5ce792861020e4d344a86
guid: 76243a61ee71cb534816a0138b268178
TextScriptImporter:
externalObjects: {}
userData:
@@ -9,6 +9,6 @@ AssetOrigin:
serializedVersion: 1
productId: 162772
packageName: ALINE
packageVersion: 1.7.6
packageVersion: 1.7.8
assetPath: Packages/com.arongranberg.aline/Documentation/documentation.html
uploadId: 700292
uploadId: 754628

View File

@@ -1,5 +1,5 @@
fileFormatVersion: 2
guid: 15017efce836c1a3982fc6ad3b0bc909
guid: 648b4ab8bbdc27e50b3841c386b2d587
DefaultImporter:
externalObjects: {}
userData:
@@ -9,6 +9,6 @@ AssetOrigin:
serializedVersion: 1
productId: 162772
packageName: ALINE
packageVersion: 1.7.6
packageVersion: 1.7.8
assetPath: Packages/com.arongranberg.aline/Documentation/documentation.pdf
uploadId: 700292
uploadId: 754628

View File

@@ -9,6 +9,6 @@ AssetOrigin:
serializedVersion: 1
productId: 162772
packageName: ALINE
packageVersion: 1.7.6
packageVersion: 1.7.8
assetPath: Packages/com.arongranberg.aline/Documentation/index.md
uploadId: 700292
uploadId: 754628

View File

@@ -14,6 +14,6 @@ AssetOrigin:
serializedVersion: 1
productId: 162772
packageName: ALINE
packageVersion: 1.7.6
packageVersion: 1.7.8
assetPath: Packages/com.arongranberg.aline/Draw.cs
uploadId: 700292
uploadId: 754628

View File

@@ -108,7 +108,7 @@ namespace Drawing {
///
/// You must do this when you are done with the scope, even if it was never used to actually render anything.
/// The items will stop rendering immediately: the next camera to render will not render the items unless kept alive in some other way.
/// For example items are always rendered at least once.
/// However, items are always rendered at least once.
/// </summary>
public void Dispose () {
if (gizmos.IsAllocated) {
@@ -119,41 +119,7 @@ namespace Drawing {
}
};
/// <summary>
/// Helper for drawing Gizmos in a performant way.
/// This is a replacement for the Unity Gizmos class as that is not very performant
/// when drawing very large amounts of geometry (for example a large grid graph).
/// These gizmos can be persistent, so if the data does not change, the gizmos
/// do not need to be updated.
///
/// How to use
/// - Create a Hasher object and hash whatever data you will be using to draw the gizmos
/// Could be for example the positions of the vertices or something. Just as long as
/// if the gizmos should change, then the hash changes as well.
/// - Check if a cached mesh exists for that hash
/// - If not, then create a Builder object and call the drawing methods until you are done
/// and then call Finalize with a reference to a gizmos class and the hash you calculated before.
/// - Call gizmos.Draw with the hash.
/// - When you are done with drawing gizmos for this frame, call gizmos.FinalizeDraw
///
/// <code>
/// var a = Vector3.zero;
/// var b = Vector3.one;
/// var color = Color.red;
/// var hasher = DrawingData.Hasher.Create(this);
///
/// hasher.Add(a);
/// hasher.Add(b);
/// hasher.Add(color);
/// var gizmos = DrawingManager.instance.gizmos;
/// if (!gizmos.Draw(hasher)) {
/// using (var builder = gizmos.GetBuilder(hasher)) {
/// // Ideally something very complex, not just a single line
/// builder.Line(a, b, color);
/// }
/// }
/// </code>
/// </summary>
/// <summary>Helper for drawing Gizmos in a performant way</summary>
public class DrawingData {
/// <summary>Combines hashes into a single hash value</summary>
public struct Hasher : IEquatable<Hasher> {
@@ -161,6 +127,7 @@ namespace Drawing {
public static Hasher NotSupplied => new Hasher { hash = ulong.MaxValue };
[System.Obsolete("Use the constructor instead")]
public static Hasher Create<T>(T init) {
var h = new Hasher();
@@ -168,17 +135,17 @@ namespace Drawing {
return h;
}
/// <summary>
/// Includes the given data in the final hash.
/// You can call this as many times as you want.
/// </summary>
public void Add<T>(T hash) {
// Just a regular hash function. The + 12289 is to make sure that hashing zeros doesn't just produce a zero (and generally that hashing one X doesn't produce a hash of X)
// (with a struct we can't provide default initialization)
this.hash = (1572869UL * this.hash) ^ (ulong)hash.GetHashCode() + 12289;
}
public ulong Hash {
get {
return hash;
}
}
public readonly ulong Hash => hash;
public override int GetHashCode () {
return (int)hash;
@@ -208,7 +175,11 @@ namespace Drawing {
JobHandle buildJob, splitterJob;
public List<MeshWithType> meshes;
public bool isValid => type != Type.Invalid;
public bool isValid {
get {
return type != Type.Invalid;
}
}
public struct CapturedState {
public Matrix4x4 matrix;
@@ -615,6 +586,18 @@ namespace Drawing {
public void Submit (DrawingData gizmos) {
if (state != State.Initialized) throw new System.InvalidOperationException();
#if !UNITY_EDITOR
if (meta.isGizmos) {
// Gizmos are never drawn in standalone builds.
// Draw.Line, and similar draw commands, will already have been removed in standalone builds,
// but if users use e.g. Draw.editor directly, then the commands will be added to the command buffer.
// For performance we can just discard the whole buffer here.
Release();
return;
}
#endif
unsafe {
// There are about 128 buffers we need to check and it's faster to do that using Burst
if (meshes.Count == 0 && !AnyBuffersWrittenToInvoke((UnsafeAppendBuffer*)commandBuffers.GetUnsafeReadOnlyPtr(), commandBuffers.Length)) {
@@ -825,6 +808,8 @@ namespace Drawing {
Stack<int> freeSlots;
Stack<List<int> > freeLists;
public bool isEmpty => data == null || freeSlots.Count == data.Length;
public int memoryUsage {
get {
int sum = 0;
@@ -1346,7 +1331,7 @@ namespace Drawing {
/// </summary>
public bool Draw (Hasher hasher, RedrawScope scope) {
if (hasher.Equals(Hasher.NotSupplied)) throw new System.ArgumentException("Invalid hash value");
processedData.SetCustomScope(hasher, scope);
if (scope.isValid) processedData.SetCustomScope(hasher, scope);
return processedData.SetVersion(hasher, version);
}
@@ -1549,6 +1534,9 @@ namespace Drawing {
/// <summary>Call after all <see cref="Draw"/> commands for the frame have been done to draw everything.</summary>
/// <param name="allowCameraDefault">Indicates if built-in command builders and custom ones without a custom CommandBuilder.cameraTargets should render to this camera.</param>
public void Render (Camera cam, bool allowGizmos, CommandBufferWrapper commandBuffer, bool allowCameraDefault) {
// Early out when there's nothing to render
if (processedData.isEmpty) return;
LoadMaterials();
// Warn if the materials could not be found
@@ -1559,9 +1547,6 @@ namespace Drawing {
return;
}
var planes = frustrumPlanes;
GeometryUtility.CalculateFrustumPlanes(cam, planes);
if (!cameraVersions.TryGetValue(cam, out Range cameraRenderingRange)) {
cameraRenderingRange = new Range { start = int.MinValue, end = int.MinValue };
}
@@ -1616,12 +1601,18 @@ namespace Drawing {
processedData.CollectMeshes(cameraRenderingRange.start, meshes, cam, allowGizmos, allowCameraDefault);
processedData.PoolDynamicMeshes(this);
MarkerCollectMeshes.End();
// Early out if nothing is being rendered
if (meshes.Count > 0) {
MarkerSortMeshes.Begin();
// Note that a stable sort is required as some meshes may have the same sorting index
// but those meshes will have a consistent ordering between them in the list
meshes.Sort(meshSorter);
MarkerSortMeshes.End();
var planes = frustrumPlanes;
GeometryUtility.CalculateFrustumPlanes(cam, planes);
int colorID = Shader.PropertyToID("_Color");
int colorFadeID = Shader.PropertyToID("_FadeColor");
var solidBaseColor = new Color(1, 1, 1, settings.solidOpacity);
@@ -1682,6 +1673,7 @@ namespace Drawing {
meshes.Clear();
}
}
cameraVersions[cam] = cameraRenderingRange;
}

View File

@@ -14,6 +14,6 @@ AssetOrigin:
serializedVersion: 1
productId: 162772
packageName: ALINE
packageVersion: 1.7.6
packageVersion: 1.7.8
assetPath: Packages/com.arongranberg.aline/DrawingData.cs
uploadId: 700292
uploadId: 754628

View File

@@ -1,19 +1,16 @@
// TODO: Check HDRP custom pass support, and log a warning if it is disabled
#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;
@@ -140,6 +137,7 @@ namespace Drawing {
public DrawingData gizmos;
static List<GizmoDrawerGroup> gizmoDrawers = new List<GizmoDrawerGroup>();
static Dictionary<System.Type, int> gizmoDrawerIndices = new Dictionary<System.Type, int>();
static bool ignoreAllDrawing;
static DrawingManager _instance;
bool framePassed;
int lastFrameCount = int.MinValue;
@@ -238,6 +236,14 @@ namespace Drawing {
};
_instance = go.AddComponent<DrawingManager>();
if (Application.isPlaying) DontDestroyOnLoad(go);
if (Application.isBatchMode) {
// In batch mode, we never want to draw anything.
// See https://forum.arongranberg.com/t/drawingmanager-holds-on-to-memory-in-batch-mode/17765
ignoreAllDrawing = true;
gizmoDrawers.Clear();
gizmoDrawerIndices.Clear();
}
}
/// <summary>Detects which render pipeline is being used and configures them for rendering</summary>
@@ -594,6 +600,10 @@ namespace Drawing {
#if UNITY_EDITOR
void DrawGizmos (bool usingRenderPipeline) {
GizmoContext.SetDirty();
// Reduce overhead if there's nothing to render
if (gizmoDrawers.Count == 0) return;
MarkerGizmosAllowed.Begin();
// Figure out which component types should be rendered
@@ -721,6 +731,8 @@ namespace 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) {
if (ignoreAllDrawing) return;
var tp = item.GetType();
int index;
@@ -782,9 +794,41 @@ namespace Drawing {
/// <summary>
/// Get an empty builder for queuing drawing commands.
/// TODO: Example usage.
///
/// <code>
/// // Just a nice looking curve (which uses a lot of complex math)
/// // See https://en.wikipedia.org/wiki/Butterfly_curve_(transcendental)
/// static float2 ButterflyCurve (float t) {
/// t *= 12 * math.PI;
/// var k = math.exp(math.cos(t)) - 2*math.cos(4*t) - math.pow(math.sin(t/12f), 5);
/// return new float2(k * math.sin(t), k * math.cos(t));
/// }
///
/// // Make the butterfly "flap its wings" two times per second
/// var scale = Time.time % 0.5f < 0.25f ? new float2(1, 1) : new float2(0.7f, 1);
///
/// // Hash all inputs that you use for drawing something complex
/// var hasher = new DrawingData.Hasher();
/// // The only thing making the drawing change, in this case, is the scale
/// hasher.Add(scale);
///
/// // Try to draw a previously cached mesh with this hash
/// if (!DrawingManager.TryDrawHasher(hasher)) {
/// // If there's no cached mesh, then draw it from scratch
/// using (var builder = DrawingManager.GetBuilder(hasher)) {
/// // Draw a complex curve using 10000 lines
/// var prev = ButterflyCurve(0);
/// for (float t = 0; t < 1; t += 0.0001f) {
/// var next = ButterflyCurve(t);
/// builder.xy.Line(prev*scale, next*scale, Color.white);
/// prev = next;
/// }
/// }
/// }
/// </code>
///
/// See: <see cref="Drawing.CommandBuilder"/>
/// See: caching (view in online documentation for working links)
/// </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>
@@ -792,7 +836,50 @@ namespace Drawing {
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.
/// Tries to draw a builder that was rendered during the last frame using the same hash.
///
/// Returns: True if the builder was found and scheduled for rendering. If false, you should draw everything again and submit a new command builder.
///
/// <code>
/// // Just a nice looking curve (which uses a lot of complex math)
/// // See https://en.wikipedia.org/wiki/Butterfly_curve_(transcendental)
/// static float2 ButterflyCurve (float t) {
/// t *= 12 * math.PI;
/// var k = math.exp(math.cos(t)) - 2*math.cos(4*t) - math.pow(math.sin(t/12f), 5);
/// return new float2(k * math.sin(t), k * math.cos(t));
/// }
///
/// // Make the butterfly "flap its wings" two times per second
/// var scale = Time.time % 0.5f < 0.25f ? new float2(1, 1) : new float2(0.7f, 1);
///
/// // Hash all inputs that you use for drawing something complex
/// var hasher = new DrawingData.Hasher();
/// // The only thing making the drawing change, in this case, is the scale
/// hasher.Add(scale);
///
/// // Try to draw a previously cached mesh with this hash
/// if (!DrawingManager.TryDrawHasher(hasher)) {
/// // If there's no cached mesh, then draw it from scratch
/// using (var builder = DrawingManager.GetBuilder(hasher)) {
/// // Draw a complex curve using 10000 lines
/// var prev = ButterflyCurve(0);
/// for (float t = 0; t < 1; t += 0.0001f) {
/// var next = ButterflyCurve(t);
/// builder.xy.Line(prev*scale, next*scale, Color.white);
/// prev = next;
/// }
/// }
/// }
/// </code>
///
/// See: caching (view in online documentation for working links)
/// </summary>
/// <param name="hasher">Hash of whatever inputs you used to generate the drawing data.</param>
/// <param name="redrawScope">Optional redraw scope for this command builder. See #GetRedrawScope.</param>
public static bool TryDrawHasher(DrawingData.Hasher hasher, RedrawScope redrawScope = default) => instance.gizmos.Draw(hasher, redrawScope);
/// <summary>
/// A scope which will persist rendered items over multiple frames until it is disposed.
///
/// 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.
@@ -811,6 +898,8 @@ namespace Drawing {
/// redrawScope.Dispose();
/// }
/// </code>
///
/// See: caching (view in online documentation for working links)
/// </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>

View File

@@ -13,6 +13,6 @@ AssetOrigin:
serializedVersion: 1
productId: 162772
packageName: ALINE
packageVersion: 1.7.6
packageVersion: 1.7.8
assetPath: Packages/com.arongranberg.aline/DrawingManager.cs
uploadId: 700292
uploadId: 754628

View File

@@ -13,6 +13,6 @@ AssetOrigin:
serializedVersion: 1
productId: 162772
packageName: ALINE
packageVersion: 1.7.6
packageVersion: 1.7.8
assetPath: Packages/com.arongranberg.aline/DrawingSettings.cs
uploadId: 700292
uploadId: 754628

View File

@@ -13,6 +13,6 @@ AssetOrigin:
serializedVersion: 1
productId: 162772
packageName: ALINE
packageVersion: 1.7.6
packageVersion: 1.7.8
assetPath: Packages/com.arongranberg.aline/DrawingUtilities.cs
uploadId: 700292
uploadId: 754628

View File

@@ -9,6 +9,6 @@ AssetOrigin:
serializedVersion: 1
productId: 162772
packageName: ALINE
packageVersion: 1.7.6
packageVersion: 1.7.8
assetPath: Packages/com.arongranberg.aline/Editor/DrawingEditor.asmdef
uploadId: 700292
uploadId: 754628

View File

@@ -13,6 +13,6 @@ AssetOrigin:
serializedVersion: 1
productId: 162772
packageName: ALINE
packageVersion: 1.7.6
packageVersion: 1.7.8
assetPath: Packages/com.arongranberg.aline/Editor/DrawingManagerEditor.cs
uploadId: 700292
uploadId: 754628

View File

@@ -13,6 +13,6 @@ AssetOrigin:
serializedVersion: 1
productId: 162772
packageName: ALINE
packageVersion: 1.7.6
packageVersion: 1.7.8
assetPath: Packages/com.arongranberg.aline/Editor/DrawingSettingsEditor.cs
uploadId: 700292
uploadId: 754628

View File

@@ -13,6 +13,6 @@ AssetOrigin:
serializedVersion: 1
productId: 162772
packageName: ALINE
packageVersion: 1.7.6
packageVersion: 1.7.8
assetPath: Packages/com.arongranberg.aline/ExampleScenes~/Example1_Gizmos/GizmoCharacterExample.cs
uploadId: 700292
uploadId: 754628

View File

@@ -13,6 +13,6 @@ AssetOrigin:
serializedVersion: 1
productId: 162772
packageName: ALINE
packageVersion: 1.7.6
packageVersion: 1.7.8
assetPath: Packages/com.arongranberg.aline/ExampleScenes~/Example1_Gizmos/GizmoSphereExample.cs
uploadId: 700292
uploadId: 754628

View File

@@ -9,6 +9,6 @@ AssetOrigin:
serializedVersion: 1
productId: 162772
packageName: ALINE
packageVersion: 1.7.6
packageVersion: 1.7.8
assetPath: Packages/com.arongranberg.aline/ExampleScenes~/Example1_Gizmos/Gizmos.unity
uploadId: 700292
uploadId: 754628

View File

@@ -9,6 +9,6 @@ AssetOrigin:
serializedVersion: 1
productId: 162772
packageName: ALINE
packageVersion: 1.7.6
packageVersion: 1.7.8
assetPath: Packages/com.arongranberg.aline/ExampleScenes~/Example1_Gizmos/Sphere.prefab
uploadId: 700292
uploadId: 754628

View File

@@ -13,6 +13,6 @@ AssetOrigin:
serializedVersion: 1
productId: 162772
packageName: ALINE
packageVersion: 1.7.6
packageVersion: 1.7.8
assetPath: Packages/com.arongranberg.aline/ExampleScenes~/Example1_Gizmos/TimedSpawner.cs
uploadId: 700292
uploadId: 754628

View File

@@ -10,6 +10,6 @@ AssetOrigin:
serializedVersion: 1
productId: 162772
packageName: ALINE
packageVersion: 1.7.6
packageVersion: 1.7.8
assetPath: Packages/com.arongranberg.aline/ExampleScenes~/Example1_Gizmos/aline_dark_blue.mat
uploadId: 700292
uploadId: 754628

View File

@@ -10,6 +10,6 @@ AssetOrigin:
serializedVersion: 1
productId: 162772
packageName: ALINE
packageVersion: 1.7.6
packageVersion: 1.7.8
assetPath: Packages/com.arongranberg.aline/ExampleScenes~/Example1_Gizmos/aline_transparent_sphere.mat
uploadId: 700292
uploadId: 754628

View File

@@ -13,6 +13,6 @@ AssetOrigin:
serializedVersion: 1
productId: 162772
packageName: ALINE
packageVersion: 1.7.6
packageVersion: 1.7.8
assetPath: Packages/com.arongranberg.aline/ExampleScenes~/Example2_CurveEditor/CurveEditor.cs
uploadId: 700292
uploadId: 754628

View File

@@ -9,6 +9,6 @@ AssetOrigin:
serializedVersion: 1
productId: 162772
packageName: ALINE
packageVersion: 1.7.6
packageVersion: 1.7.8
assetPath: Packages/com.arongranberg.aline/ExampleScenes~/Example2_CurveEditor/CurveEditor.unity
uploadId: 700292
uploadId: 754628

View File

@@ -9,6 +9,6 @@ AssetOrigin:
serializedVersion: 1
productId: 162772
packageName: ALINE
packageVersion: 1.7.6
packageVersion: 1.7.8
assetPath: Packages/com.arongranberg.aline/ExampleScenes~/Example3_Burst/Burst.unity
uploadId: 700292
uploadId: 754628

View File

@@ -13,6 +13,6 @@ AssetOrigin:
serializedVersion: 1
productId: 162772
packageName: ALINE
packageVersion: 1.7.6
packageVersion: 1.7.8
assetPath: Packages/com.arongranberg.aline/ExampleScenes~/Example3_Burst/BurstExample.cs
uploadId: 700292
uploadId: 754628

View File

@@ -13,6 +13,6 @@ AssetOrigin:
serializedVersion: 1
productId: 162772
packageName: ALINE
packageVersion: 1.7.6
packageVersion: 1.7.8
assetPath: Packages/com.arongranberg.aline/ExampleScenes~/Example4_Styling/AlineStyling.cs
uploadId: 700292
uploadId: 754628

View File

@@ -9,6 +9,6 @@ AssetOrigin:
serializedVersion: 1
productId: 162772
packageName: ALINE
packageVersion: 1.7.6
packageVersion: 1.7.8
assetPath: Packages/com.arongranberg.aline/ExampleScenes~/Example4_Styling/Styling.unity
uploadId: 700292
uploadId: 754628

View File

@@ -13,6 +13,6 @@ AssetOrigin:
serializedVersion: 1
productId: 162772
packageName: ALINE
packageVersion: 1.7.6
packageVersion: 1.7.8
assetPath: Packages/com.arongranberg.aline/GeometryBuilder.cs
uploadId: 700292
uploadId: 754628

View File

@@ -13,6 +13,6 @@ AssetOrigin:
serializedVersion: 1
productId: 162772
packageName: ALINE
packageVersion: 1.7.6
packageVersion: 1.7.8
assetPath: Packages/com.arongranberg.aline/MonoBehaviourGizmos.cs
uploadId: 700292
uploadId: 754628

View File

@@ -13,6 +13,6 @@ AssetOrigin:
serializedVersion: 1
productId: 162772
packageName: ALINE
packageVersion: 1.7.6
packageVersion: 1.7.8
assetPath: Packages/com.arongranberg.aline/PackageTools/Editor/DependencyCheck.cs
uploadId: 700292
uploadId: 754628

View File

@@ -9,6 +9,6 @@ AssetOrigin:
serializedVersion: 1
productId: 162772
packageName: ALINE
packageVersion: 1.7.6
packageVersion: 1.7.8
assetPath: Packages/com.arongranberg.aline/PackageTools/Editor/PackageToolsEditor.asmdef
uploadId: 700292
uploadId: 754628

View File

@@ -13,6 +13,6 @@ AssetOrigin:
serializedVersion: 1
productId: 162772
packageName: ALINE
packageVersion: 1.7.6
packageVersion: 1.7.8
assetPath: Packages/com.arongranberg.aline/Palette.cs
uploadId: 700292
uploadId: 754628

View File

@@ -13,6 +13,6 @@ AssetOrigin:
serializedVersion: 1
productId: 162772
packageName: ALINE
packageVersion: 1.7.6
packageVersion: 1.7.8
assetPath: Packages/com.arongranberg.aline/PersistentFilter.cs
uploadId: 700292
uploadId: 754628

View File

@@ -11,6 +11,6 @@ AssetOrigin:
serializedVersion: 1
productId: 162772
packageName: ALINE
packageVersion: 1.7.6
packageVersion: 1.7.8
assetPath: Packages/com.arongranberg.aline/Resources/aline_common.cginc
uploadId: 700292
uploadId: 754628

View File

@@ -12,6 +12,6 @@ AssetOrigin:
serializedVersion: 1
productId: 162772
packageName: ALINE
packageVersion: 1.7.6
packageVersion: 1.7.8
assetPath: Packages/com.arongranberg.aline/Resources/aline_common_line.cginc
uploadId: 700292
uploadId: 754628

View File

@@ -12,6 +12,6 @@ AssetOrigin:
serializedVersion: 1
productId: 162772
packageName: ALINE
packageVersion: 1.7.6
packageVersion: 1.7.8
assetPath: Packages/com.arongranberg.aline/Resources/aline_common_surface.cginc
uploadId: 700292
uploadId: 754628

View File

@@ -9,6 +9,6 @@ AssetOrigin:
serializedVersion: 1
productId: 162772
packageName: ALINE
packageVersion: 1.7.6
packageVersion: 1.7.8
assetPath: Packages/com.arongranberg.aline/Resources/aline_common_text.cginc
uploadId: 700292
uploadId: 754628

View File

@@ -136,6 +136,6 @@ AssetOrigin:
serializedVersion: 1
productId: 162772
packageName: ALINE
packageVersion: 1.7.6
packageVersion: 1.7.8
assetPath: Packages/com.arongranberg.aline/Resources/aline_fallback_font.png
uploadId: 700292
uploadId: 754628

View File

@@ -108,6 +108,6 @@ AssetOrigin:
serializedVersion: 1
productId: 162772
packageName: ALINE
packageVersion: 1.7.6
packageVersion: 1.7.8
assetPath: Packages/com.arongranberg.aline/Resources/aline_font.png
uploadId: 700292
uploadId: 754628

View File

@@ -25,6 +25,6 @@ AssetOrigin:
serializedVersion: 1
productId: 162772
packageName: ALINE
packageVersion: 1.7.6
packageVersion: 1.7.8
assetPath: Packages/com.arongranberg.aline/Resources/aline_font.ttf
uploadId: 700292
uploadId: 754628

View File

@@ -10,6 +10,6 @@ AssetOrigin:
serializedVersion: 1
productId: 162772
packageName: ALINE
packageVersion: 1.7.6
packageVersion: 1.7.8
assetPath: Packages/com.arongranberg.aline/Resources/aline_outline_mat.mat
uploadId: 700292
uploadId: 754628

View File

@@ -11,6 +11,6 @@ AssetOrigin:
serializedVersion: 1
productId: 162772
packageName: ALINE
packageVersion: 1.7.6
packageVersion: 1.7.8
assetPath: Packages/com.arongranberg.aline/Resources/aline_outline_mat.shader
uploadId: 700292
uploadId: 754628

View File

@@ -4,6 +4,6 @@ AssetOrigin:
serializedVersion: 1
productId: 162772
packageName: ALINE
packageVersion: 1.7.6
packageVersion: 1.7.8
assetPath: Packages/com.arongranberg.aline/Resources/aline_surface_mat.mat
uploadId: 700292
uploadId: 754628

View File

@@ -4,6 +4,6 @@ AssetOrigin:
serializedVersion: 1
productId: 162772
packageName: ALINE
packageVersion: 1.7.6
packageVersion: 1.7.8
assetPath: Packages/com.arongranberg.aline/Resources/aline_surface_mat.shader
uploadId: 700292
uploadId: 754628

View File

@@ -11,6 +11,6 @@ AssetOrigin:
serializedVersion: 1
productId: 162772
packageName: ALINE
packageVersion: 1.7.6
packageVersion: 1.7.8
assetPath: Packages/com.arongranberg.aline/Resources/aline_text.shader
uploadId: 700292
uploadId: 754628

View File

@@ -10,6 +10,6 @@ AssetOrigin:
serializedVersion: 1
productId: 162772
packageName: ALINE
packageVersion: 1.7.6
packageVersion: 1.7.8
assetPath: Packages/com.arongranberg.aline/Resources/aline_text_mat.mat
uploadId: 700292
uploadId: 754628

View File

@@ -13,6 +13,6 @@ AssetOrigin:
serializedVersion: 1
productId: 162772
packageName: ALINE
packageVersion: 1.7.6
packageVersion: 1.7.8
assetPath: Packages/com.arongranberg.aline/SDFFont.cs
uploadId: 700292
uploadId: 754628

View File

@@ -13,6 +13,6 @@ AssetOrigin:
serializedVersion: 1
productId: 162772
packageName: ALINE
packageVersion: 1.7.6
packageVersion: 1.7.8
assetPath: Packages/com.arongranberg.aline/StreamSplitter.cs
uploadId: 700292
uploadId: 754628

View File

@@ -38,5 +38,5 @@
],
"unity": "2020.3",
"unityRelease": "48f1",
"version": "1.7.6"
"version": "1.7.8"
}

View File

@@ -9,6 +9,6 @@ AssetOrigin:
serializedVersion: 1
productId: 162772
packageName: ALINE
packageVersion: 1.7.6
packageVersion: 1.7.8
assetPath: Packages/com.arongranberg.aline/package.json
uploadId: 700292
uploadId: 754628

View File

@@ -11,6 +11,9 @@ EditorBuildSettings:
- enabled: 1
path: Assets/Scenes/NetworkTest.unity
guid: 7f8c36f656558f24ab6aa5c9f9da5abc
- enabled: 1
path: Assets/Scenes/ItemTest.unity
guid: 520e0dc411c2684479fba0c4f32b733c
m_configObjects:
com.unity.input.settings: {fileID: 11400000, guid: e4ca318d34698fe41ba99a765e54e4c2, type: 2}
com.unity.input.settings.actions: {fileID: -944628639613478452, guid: 94c7611bb3f64b248940847af54844cf, type: 3}

View File

@@ -12,7 +12,7 @@ TagManager:
- Environment
- Water
- UI
-
- ItemDrop
-
-
-