update samples

This commit is contained in:
DCFApixels 2025-02-22 23:02:05 +08:00
parent 24ffa4f4a5
commit 0f91ae3ef8
31 changed files with 2441 additions and 5807 deletions

View File

@ -441,7 +441,7 @@ namespace DCFApixels
{
return _currentCamera == null ? Camera.current : _currentCamera;
}
private static RenderContextController _currenRenderContextControler;
private static RenderContextController _currenRenderContextControler = RenderContextController.GetController(new RenderContext(null));
public readonly partial struct DrawHandler
{
[IN(LINE)]

View File

@ -15,12 +15,12 @@ namespace DCFApixels
[IN(LINE)]
public DrawHandler LineFade(Vector3 start, Vector3 end)
{
const int StepsCount = 6;
const int StepsCount = 7;
const float Step = 1f / StepsCount;
Color color = Color;
Vector3 startPoint = start;
for (int i = 1; i <= StepsCount; i++)
for (int i = 1; i < StepsCount; i++)
{
Vector3 endPoint = Vector3.Lerp(start, end, i * Step);
color.a = 1f - Color.a * i * Step;

View File

@ -329,8 +329,8 @@ namespace DCFApixels
#region Quad
//[IN(LINE)] public DrawHandler Quad(Vector3 position, Vector3 normal, float size) => Mesh(Meshes.Quad, position, Quaternion.LookRotation(normal), new Vector3(size, size, size));
//[IN(LINE)] public DrawHandler Quad(Vector3 position, Vector3 normal, Vector2 size) => Mesh(Meshes.Quad, position, Quaternion.LookRotation(normal), size);
[IN(LINE)] public DrawHandler Quad(Vector3 position, Quaternion rotation, float size) => Mesh<QuadMesh, LitMat>(position, rotation, new Vector3(size, size, size));
[IN(LINE)] public DrawHandler Quad(Vector3 position, Quaternion rotation, Vector2 size) => Mesh<QuadMesh, LitMat>(position, rotation, size);
[IN(LINE)] public DrawHandler Quad(Vector3 position, Quaternion rotation, float size) => Mesh<CubeMesh, LitMat>(position, rotation, new Vector3(size, size, 0.0000000001f)); //TODO fix quad mesh
[IN(LINE)] public DrawHandler Quad(Vector3 position, Quaternion rotation, Vector2 size) => Mesh<CubeMesh, LitMat>(position, rotation, new Vector3(size.x, size.y, 0.0000000001f)); //TODO fix quad mesh
#endregion
#region WireQuad

View File

@ -53,7 +53,7 @@ namespace DCFApixels
private static Material _billboard;
private static Material _dot;
private static void Init()
private static void Init()//TODO переработать на подгрузку из ассетов
{
if (_lit != null) { return; }
_lit = CreateMaterial("DCFApixels/DebugX/Handles Lit");

View File

@ -32,7 +32,7 @@ Material:
m_LightmapFlags: 0
m_EnableInstancingVariants: 1
m_DoubleSidedGI: 0
m_CustomRenderQueue: -1
m_CustomRenderQueue: 2000
stringTagMap:
RenderType: Opaque
disabledShaderPasses:
@ -157,9 +157,9 @@ Material:
- _WorkflowMode: 1
- _ZWrite: 1
m_Colors:
- _BaseColor: {r: 0.29222006, g: 0.20719118, b: 0.4528302, a: 1}
- _BaseColor: {r: 0.29222003, g: 0.20719114, b: 0.45283014, a: 0.23529412}
- _CameraFadeParams: {r: 0, g: Infinity, b: 0, a: 0}
- _Color: {r: 0.29222003, g: 0.20719114, b: 0.45283014, a: 1}
- _Color: {r: 0.29222, g: 0.20719111, b: 0.45283008, a: 0.23529412}
- _EmissionColor: {r: 0, g: 0, b: 0, a: 1}
- _Flip: {r: 1, g: 1, b: 1, a: 1}
- _RendererColor: {r: 1, g: 1, b: 1, a: 1}

168
Samples/Other/Skybox.mat Normal file
View File

@ -0,0 +1,168 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!114 &-1886556038976168383
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:
version: 9
--- !u!21 &2100000
Material:
serializedVersion: 8
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_Name: Skybox
m_Shader: {fileID: 10755, guid: 0000000000000000f000000000000000, type: 0}
m_Parent: {fileID: 0}
m_ModifiedSerializedProperties: 0
m_ValidKeywords: []
m_InvalidKeywords:
- _EMISSION
- _RECEIVE_SHADOWS_OFF
- _SPECULARHIGHLIGHTS_OFF
m_LightmapFlags: 0
m_EnableInstancingVariants: 1
m_DoubleSidedGI: 0
m_CustomRenderQueue: -1
stringTagMap: {}
disabledShaderPasses:
- MOTIONVECTORS
m_LockedProperties:
m_SavedProperties:
serializedVersion: 3
m_TexEnvs:
- _AlphaTex:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _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:
- PixelSnap: 0
- _AddPrecomputedVelocity: 0
- _AlphaClip: 0
- _AlphaToMask: 0
- _Blend: 0
- _BlendModePreserveSpecular: 1
- _BlendOp: 0
- _BumpScale: 1
- _CameraFadingEnabled: 0
- _CameraFarFadeDistance: 2
- _CameraNearFadeDistance: 1
- _ClearCoatMask: 0
- _ClearCoatSmoothness: 0
- _Cull: 2
- _Cutoff: 0.5
- _DetailAlbedoMapScale: 1
- _DetailNormalMapScale: 1
- _DistortionBlend: 0.5
- _DistortionEnabled: 0
- _DistortionStrength: 1
- _DistortionStrengthScaled: 0
- _DstBlend: 0
- _DstBlendAlpha: 0
- _EmissionEnabled: 0
- _EnableExternalAlpha: 0
- _EnvironmentReflections: 1
- _FlipbookMode: 0
- _GlossMapScale: 1
- _Glossiness: 0
- _GlossinessSource: 0
- _GlossyReflections: 1
- _LightingEnabled: 1
- _Metallic: 0
- _Mode: 0
- _OcclusionStrength: 1
- _Parallax: 0.02
- _QueueOffset: 0
- _ReceiveShadows: 0
- _Shininess: 0
- _Smoothness: 0
- _SmoothnessSource: 0
- _SmoothnessTextureChannel: 0
- _SoftParticlesEnabled: 0
- _SoftParticlesFarFadeDistance: 1
- _SoftParticlesNearFadeDistance: 0
- _SpecSource: 0
- _SpecularHighlights: 0
- _SrcBlend: 1
- _SrcBlendAlpha: 1
- _Surface: 0
- _UVSec: 0
- _WorkflowMode: 1
- _ZWrite: 1
m_Colors:
- _BaseColor: {r: 0.29222006, g: 0.20719118, b: 0.4528302, a: 1}
- _CameraFadeParams: {r: 0, g: Infinity, b: 0, a: 0}
- _Color: {r: 0.124131784, g: 0.031772874, b: 0.13207549, a: 1}
- _EmissionColor: {r: 0, g: 0, b: 0, a: 1}
- _Flip: {r: 1, g: 1, b: 1, a: 1}
- _RendererColor: {r: 1, g: 1, b: 1, a: 1}
- _SoftParticleFadeParams: {r: 0, g: 0, b: 0, a: 0}
- _SpecColor: {r: 0.19999993, g: 0.19999993, b: 0.19999993, a: 0}
m_BuildTextureStacks: []
m_AllowLocking: 1

View File

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

169
Samples/Other/Wall.mat Normal file
View File

@ -0,0 +1,169 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!114 &-1886556038976168383
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:
version: 9
--- !u!21 &2100000
Material:
serializedVersion: 8
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_Name: Wall
m_Shader: {fileID: 4800000, guid: 933532a4fcc9baf4fa0491de14d08ed7, type: 3}
m_Parent: {fileID: 0}
m_ModifiedSerializedProperties: 0
m_ValidKeywords:
- _EMISSION
- _RECEIVE_SHADOWS_OFF
- _SPECULARHIGHLIGHTS_OFF
m_InvalidKeywords: []
m_LightmapFlags: 0
m_EnableInstancingVariants: 1
m_DoubleSidedGI: 0
m_CustomRenderQueue: 2000
stringTagMap:
RenderType: Opaque
disabledShaderPasses:
- MOTIONVECTORS
m_LockedProperties:
m_SavedProperties:
serializedVersion: 3
m_TexEnvs:
- _AlphaTex:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _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:
- PixelSnap: 0
- _AddPrecomputedVelocity: 0
- _AlphaClip: 0
- _AlphaToMask: 0
- _Blend: 0
- _BlendModePreserveSpecular: 1
- _BlendOp: 0
- _BumpScale: 1
- _CameraFadingEnabled: 0
- _CameraFarFadeDistance: 2
- _CameraNearFadeDistance: 1
- _ClearCoatMask: 0
- _ClearCoatSmoothness: 0
- _Cull: 2
- _Cutoff: 0.5
- _DetailAlbedoMapScale: 1
- _DetailNormalMapScale: 1
- _DistortionBlend: 0.5
- _DistortionEnabled: 0
- _DistortionStrength: 1
- _DistortionStrengthScaled: 0
- _DstBlend: 0
- _DstBlendAlpha: 0
- _EmissionEnabled: 0
- _EnableExternalAlpha: 0
- _EnvironmentReflections: 1
- _FlipbookMode: 0
- _GlossMapScale: 1
- _Glossiness: 0
- _GlossinessSource: 0
- _GlossyReflections: 1
- _LightingEnabled: 1
- _Metallic: 0
- _Mode: 0
- _OcclusionStrength: 1
- _Parallax: 0.02
- _QueueOffset: 0
- _ReceiveShadows: 0
- _Shininess: 0
- _Smoothness: 0
- _SmoothnessSource: 0
- _SmoothnessTextureChannel: 0
- _SoftParticlesEnabled: 0
- _SoftParticlesFarFadeDistance: 1
- _SoftParticlesNearFadeDistance: 0
- _SpecSource: 0
- _SpecularHighlights: 0
- _SrcBlend: 1
- _SrcBlendAlpha: 1
- _Surface: 0
- _UVSec: 0
- _WorkflowMode: 1
- _ZWrite: 1
m_Colors:
- _BaseColor: {r: 0.25627127, g: 0.148851, b: 0.333, a: 0.23529412}
- _CameraFadeParams: {r: 0, g: Infinity, b: 0, a: 0}
- _Color: {r: 0.25627124, g: 0.14885098, b: 0.33299997, a: 0.23529412}
- _EmissionColor: {r: 0, g: 0, b: 0, a: 1}
- _Flip: {r: 1, g: 1, b: 1, a: 1}
- _RendererColor: {r: 1, g: 1, b: 1, a: 1}
- _SoftParticleFadeParams: {r: 0, g: 0, b: 0, a: 0}
- _SpecColor: {r: 0.19999993, g: 0.19999993, b: 0.19999993, a: 0}
m_BuildTextureStacks: []
m_AllowLocking: 1

View File

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

File diff suppressed because it is too large Load Diff

View File

@ -1,5 +1,5 @@
fileFormatVersion: 2
guid: 01548ea02068c8742a87b8485724734f
guid: 6d950d418bc87a0469228db504f281af
folderAsset: yes
DefaultImporter:
externalObjects: {}

View File

@ -1,117 +0,0 @@
using UnityEngine;
namespace DCFApixels
{
public class DebugXLinesSample : MonoBehaviour
{
[Header("Base")]
public Transform[] startTransforms;
public Transform[] endTransforms;
public Gradient colors;
public int colorStepsCount = 7;
[Header("Draw")]
public Vector3 rotationEuler;
public Vector3 size = Vector3.one;
public float time = 0;
[Header("Animation")]
public bool isAnimated = false;
public float radius = 5f;
public float speed = 30f;
public float swithColorCooldown = 1f;
private float _angle = 0f;
private float _colorOffset = 0;
[Header("Stress Test")]
public int textCount = 1;
private void LateUpdate()
{
#if UNITY_EDITOR
if (FrameDebugger.enabled) { return; }
#endif
if (isAnimated)
{
_angle += speed * Time.deltaTime;
float radians = _angle * Mathf.Deg2Rad;
float x = Mathf.Cos(radians) * radius;
float z = Mathf.Sin(radians) * radius;
transform.localPosition = new Vector3(x, transform.localPosition.y, z);
_colorOffset += Time.deltaTime * swithColorCooldown;
}
else
{
transform.localPosition = default;
_colorOffset = 0;
}
Color GetColor(int i_)
{
return colors.Evaluate((_colorOffset + 1f * i_ / colorStepsCount) % 1f);
}
for (int h = 0; h < textCount; h++)
{
Quaternion rotation = Quaternion.Euler(rotationEuler);
int i = -1;
Vector3 start, end;
const float LineMultiplier = 0.18f;
i++;
start = startTransforms[i].position;
end = endTransforms[i].position;
DebugX.Draw(time, GetColor(i)).Line(start, end);
i++;
start = startTransforms[i].position;
end = endTransforms[i].position;
DebugX.Draw(time, GetColor(i)).WidthLine(start, end, size.x * LineMultiplier);
i++;
start = startTransforms[i].position;
end = endTransforms[i].position;
DebugX.Draw(time, GetColor(i)).WidthOutLine(start, end, size.x * LineMultiplier);
i++;
start = startTransforms[i].position;
end = endTransforms[i].position;
DebugX.Draw(time, GetColor(i)).ZigzagLine(start, end, size.x * LineMultiplier);
i++;
i++;
i++;
start = startTransforms[i].position;
end = endTransforms[i].position;
DebugX.Draw(time, GetColor(i)).Line(start, end, DebugXLine.Arrow);
i++;
start = startTransforms[i].position;
end = endTransforms[i].position;
DebugX.Draw(time, GetColor(i)).Line(start, end, DebugXLine.Fade);
i++;
start = startTransforms[i].position;
end = endTransforms[i].position;
DebugX.Draw(time, GetColor(i)).Line(start, end, DebugXLine.Arrow, DebugXLine.Arrow);
i++;
start = startTransforms[i].position;
end = endTransforms[i].position;
DebugX.Draw(time, GetColor(i)).Line(start, end, DebugXLine.Fade, DebugXLine.Fade);
i++;
start = startTransforms[i].position;
end = endTransforms[i].position;
DebugX.Draw(time, GetColor(i)).Line(start, end, DebugXLine.Arrow, DebugXLine.Fade);
}
}
}
}

View File

@ -1,2 +0,0 @@
fileFormatVersion: 2
guid: 81bde606c79381e43a9cb4d2ea09dafb

View File

@ -1,105 +0,0 @@
using DCFApixels.DebugXCore;
using UnityEngine;
namespace DCFApixels
{
public class DebugXPrimitivesSample : MonoBehaviour
{
[Header("Base")]
public Transform[] transforms;
public Gradient colors;
public int colorStepsCount = 7;
[Header("Draw")]
public Vector3 rotationEuler;
public Vector3 size = Vector3.one;
public float time = 0;
[Header("Animation")]
public bool isAnimated = false;
public float radius = 5f;
public float speed = 30f;
public float swithColorCooldown = 1f;
private float _angle = 0f;
private float _colorOffset = 0;
[Header("Stress Test")]
public int textCount = 1;
private void Update()
{
#if UNITY_EDITOR
if (FrameDebugger.enabled) { return; }
#endif
if (isAnimated)
{
_angle += speed * Time.deltaTime;
float radians = _angle * Mathf.Deg2Rad;
float x = Mathf.Cos(radians) * radius;
float z = Mathf.Sin(radians) * radius;
transform.localPosition = new Vector3(x, transform.localPosition.y, z);
_colorOffset += Time.deltaTime * swithColorCooldown;
}
else
{
transform.localPosition = default;
_colorOffset = 0;
}
Color GetColor(int i_)
{
return colors.Evaluate((_colorOffset + 1f * i_ / colorStepsCount) % 1f);
}
for (int h = 0; h < textCount; h++)
{
Quaternion rotation = Quaternion.Euler(rotationEuler);
int i = -1;
i++; DebugX.Draw(time, GetColor(i)).Sphere(transforms[i].position, size.x * 0.5f);
i++; DebugX.Draw(time, GetColor(i)).WireSphere(transforms[i].position, size.x * 0.5f);
i++; DebugX.Draw(time, GetColor(i)).Circle(transforms[i].position, rotation, size.x * 0.5f);
i++; DebugX.Draw(time, GetColor(i)).WireCircle(transforms[i].position, rotation, size.x * 0.5f);
i++; DebugX.Draw(time, GetColor(i)).BillboardCircle(transforms[i].position, size.x * 0.5f);
i++; DebugX.Draw(time, GetColor(i)).Cube(transforms[i].position, rotation, size);
i++; DebugX.Draw(time, GetColor(i)).WireCube(transforms[i].position, rotation, size);
i++; DebugX.Draw(time, GetColor(i)).Quad(transforms[i].position, rotation, size);
i++; DebugX.Draw(time, GetColor(i)).WireQuad(transforms[i].position, rotation, size);
i++; DebugX.Draw(time, GetColor(i)).Cross(transforms[i].position, size.x);
i++; DebugX.Draw(time, GetColor(i)).CubePoints(transforms[i].position, rotation, size);
i++; DebugX.Draw(time, GetColor(i)).CubeGrid(transforms[i].position, rotation, size, new Vector3Int(2, 3, 4));
i++; DebugX.Draw(time, GetColor(i)).QuadPoints(transforms[i].position, rotation, size);
i++; DebugX.Draw(time, GetColor(i)).QuadGrid(transforms[i].position, rotation, size, new Vector2Int(2, 3));
i++; DebugX.Draw(time, GetColor(i)).Mesh<SphereMesh, WireMat>(transforms[i].position, Quaternion.identity, new Vector3(size.x, size.x, size.x) * 0.5f);
i++; DebugX.Draw(time, GetColor(i)).Capsule(transforms[i].position, rotation, size.x / 2f, size.y);
i++; DebugX.Draw(time, GetColor(i)).WireCapsule(transforms[i].position, rotation, size.x / 2f, size.y);
i++; DebugX.Draw(time, GetColor(i)).FlatCapsule(transforms[i].position, rotation, size.x / 2f, size.y);
i++; DebugX.Draw(time, GetColor(i)).WireFlatCapsule(transforms[i].position, rotation, size.x / 2f, size.y);
i++; DebugX.Draw(time, GetColor(i)).Text(transforms[i].position, "Hello World");
i++; DebugX.Draw(time, GetColor(i)).Dot(transforms[i].position);
i++; DebugX.Draw(time, GetColor(i)).WireDot(transforms[i].position);
i++; DebugX.Draw(time, GetColor(i)).DotCross(transforms[i].position);
i++; DebugX.Draw(time, GetColor(i)).DotQuad(transforms[i].position);
i++; DebugX.Draw(time, GetColor(i)).DotDiamond(transforms[i].position);
}
}
}
}

View File

@ -1,2 +0,0 @@
fileFormatVersion: 2
guid: c953e4e7e1dd4f44f97452cb5ed6bdda

View File

@ -1,71 +0,0 @@
using UnityEngine;
namespace DCFApixels
{
public class DebugXRaycastsSample : MonoBehaviour
{
private const float Offaet = 30f;
private const int Count = 4;
private const float Radius = 6f;
public Vector3 rotation = new Vector3(0, 45, 0);
public Vector3 size = Vector3.one * 0.5f;
public float time = 0f;
private Transform[] _transforms;
[Header("Stress Test")]
public int textCount = 1;
private void Start()
{
float addAngle = +360f / Count * Mathf.Deg2Rad;
float angle = Offaet * Mathf.Deg2Rad;
_transforms = new Transform[Count];
for (int i = 0; i < Count; i++)
{
var transform = new GameObject().transform;
_transforms[i] = transform;
transform.SetParent(this.transform);
angle += addAngle;
transform.localPosition = new Vector3(Mathf.Cos(angle), 0, Mathf.Sin(angle)) * Radius;
transform.LookAt(this.transform.position);
}
}
private void LateUpdate()
{
#if UNITY_EDITOR
if (FrameDebugger.enabled) { return; }
#endif
Quaternion rotation = Quaternion.Euler(this.rotation);
Transform transform;
RaycastHit hit;
for (int j = 0; j < textCount; j++)
{
int i = -1;
transform = _transforms[++i];
Physics.Raycast(transform.position, transform.forward, out hit);
DebugX.Draw(time, Color.red).Raycast(transform.position, transform.forward, hit);
transform = _transforms[++i];
Physics.SphereCast(transform.position, size.x, transform.forward, out hit);
DebugX.Draw(time, Color.yellow).SphereCast(transform.position, transform.forward, size.x, hit);
transform = _transforms[++i];
Physics.BoxCast(transform.position, size, transform.forward, out hit, rotation);
DebugX.Draw(time, Color.green).BoxCast(transform.position, transform.forward, rotation, size, hit);
transform = _transforms[++i];
Vector3 point1, point2;
point1 = transform.position + rotation * Vector3.down / 2f;
point2 = transform.position + rotation * Vector3.up / 2f;
Physics.CapsuleCast(point1, point2, size.x, transform.forward, out hit);
DebugX.Draw(time, Color.blue).CapsuleCast(point1, point2, transform.forward, size.x, hit);
}
}
}
}

View File

@ -1,2 +0,0 @@
fileFormatVersion: 2
guid: 3fa530d3f78c4c447b90e1a4ada62f7b

View File

@ -1,36 +0,0 @@
using UnityEngine;
namespace DCFApixels
{
public class DebugXSampleAnimation : MonoBehaviour
{
[Header("Animation")]
public bool isAnimated = false;
public float radius = 5f;
public float moveSpeed = 30f;
public float rotateSpeed = 30f;
private float _angle = 0f;
private void Update()
{
if (isAnimated)
{
_angle += moveSpeed * Time.deltaTime;
float radians = _angle * Mathf.Deg2Rad;
float x = Mathf.Cos(radians) * radius;
float z = Mathf.Sin(radians) * radius;
transform.localPosition = new Vector3(x, transform.localPosition.y, z);
transform.Rotate(new Vector3(0, rotateSpeed * Time.deltaTime, 0));
}
else
{
transform.localPosition = default;
}
}
}
}

View File

@ -1,2 +0,0 @@
fileFormatVersion: 2
guid: 1232ed76958b8f748886775234321b34

View File

@ -0,0 +1,39 @@
using UnityEngine;
namespace DCFApixels
{
public class DebugXSample_Lines : MonoBehaviour
{
public Gradient Gradient;
public float GradientMultiplier = 5;
public Transform[] StartLines;
public Transform[] EndLines;
public float WidthMultiplier = 1f;
private void OnDrawGizmos()
{
int i = -1;
i++; DebugX.Draw(GetColor(StartLines[i], EndLines[i])).Line(StartLines[i].position, EndLines[i].position);
i++; DebugX.Draw(GetColor(StartLines[i], EndLines[i])).WidthLine(StartLines[i].position, EndLines[i].position, 0.2f * WidthMultiplier);
i++; DebugX.Draw(GetColor(StartLines[i], EndLines[i])).WidthOutLine(StartLines[i].position, EndLines[i].position, 0.2f * WidthMultiplier);
i++; DebugX.Draw(GetColor(StartLines[i], EndLines[i])).ZigzagLine(StartLines[i].position, EndLines[i].position, 0.2f * WidthMultiplier);
i++; DebugX.Draw(GetColor(StartLines[i], EndLines[i])).LineFade(StartLines[i].position, EndLines[i].position);
i++; DebugX.Draw(GetColor(StartLines[i], EndLines[i])).LineArrow(StartLines[i].position, EndLines[i].position);
i++; DebugX.Draw(GetColor(StartLines[i], EndLines[i])).Line(StartLines[i].position, EndLines[i].position, DebugXLine.Arrow, DebugXLine.Arrow);
i++; DebugX.Draw(GetColor(StartLines[i], EndLines[i])).Line(StartLines[i].position, EndLines[i].position, DebugXLine.Arrow, DebugXLine.Fade);
i++; DebugX.Draw(GetColor(StartLines[i], EndLines[i])).Line(StartLines[i].position, EndLines[i].position, DebugXLine.Fade, DebugXLine.Fade);
}
private Color GetColor(Transform pos1, Transform pos2)
{
Vector3 pos = (pos1.localPosition + pos2.localPosition) * 0.5f;
pos /= GradientMultiplier == 0 ? 1 : GradientMultiplier;
pos += Vector3.one * 0.5f;
float t = pos.x + pos.y + pos.z;
t /= 3f;
return Gradient.Evaluate(Mathf.Clamp01(t));
}
}
}

View File

@ -0,0 +1,2 @@
fileFormatVersion: 2
guid: 32c4a83bd096cde42b5f0fc752dc26bf

View File

@ -0,0 +1,38 @@
using DCFApixels.DebugXCore;
using UnityEngine;
namespace DCFApixels
{
public class DebugXSample_Other : MonoBehaviour
{
public Gradient Gradient;
public float GradientMultiplier = 5;
public Transform[] Points;
private void OnDrawGizmos()
{
int i = -1;
const float RADIUS_M = 0.5f;
i++; DebugX.Draw(GetColor(Points[i])).Cross(Points[i].position, Points[i].localScale.x);
i++; DebugX.Draw(GetColor(Points[i])).BillboardCircle(Points[i].position, Points[i].localScale.x * RADIUS_M);
i++; DebugX.Draw(GetColor(Points[i])).WireMesh<SphereMesh>(Points[i].position, Points[i].rotation, Points[i].localScale * RADIUS_M);
i++; DebugX.Draw(GetColor(Points[i])).Text(Points[i].position, Points[i].name);
i++; DebugX.Draw(GetColor(Points[i])).Dot(Points[i].position);
i++; DebugX.Draw(GetColor(Points[i])).WireDot(Points[i].position);
i++; DebugX.Draw(GetColor(Points[i])).DotQuad(Points[i].position);
i++; DebugX.Draw(GetColor(Points[i])).DotDiamond(Points[i].position);
i++; DebugX.Draw(GetColor(Points[i])).DotCross(Points[i].position);
}
private Color GetColor(Transform pos1)
{
Vector3 pos = pos1.localPosition;
pos /= GradientMultiplier == 0 ? 1 : GradientMultiplier;
pos += Vector3.one * 0.5f;
float t = pos.x + pos.y + pos.z;
t /= 3f;
return Gradient.Evaluate(Mathf.Clamp01(t));
}
}
}

View File

@ -0,0 +1,2 @@
fileFormatVersion: 2
guid: db7fca8969860e242b63ddf529b713df

View File

@ -0,0 +1,36 @@
using UnityEngine;
namespace DCFApixels
{
public class DebugXSample_Primitives2D : MonoBehaviour
{
public Gradient Gradient;
public float GradientMultiplier = 5;
public Transform[] Points;
private void OnDrawGizmos()
{
int i = -1;
const float RADIUS_M = 0.5f;
i++; DebugX.Draw(GetColor(Points[i])).Quad(Points[i].position, Points[i].rotation, Points[i].localScale);
i++; DebugX.Draw(GetColor(Points[i])).WireQuad(Points[i].position, Points[i].rotation, Points[i].localScale);
i++; DebugX.Draw(GetColor(Points[i])).QuadGrid(Points[i].position, Points[i].rotation, Points[i].localScale, Vector2Int.one * 3);
i++; DebugX.Draw(GetColor(Points[i])).QuadPoints(Points[i].position, Points[i].rotation, Points[i].localScale);
i++; DebugX.Draw(GetColor(Points[i])).Circle(Points[i].position, Points[i].rotation, Points[i].localScale.x * RADIUS_M);
i++; DebugX.Draw(GetColor(Points[i])).WireCircle(Points[i].position, Points[i].rotation, Points[i].localScale.x * RADIUS_M);
i++; DebugX.Draw(GetColor(Points[i])).FlatCapsule(Points[i].position, Points[i].rotation, Points[i].localScale.x * RADIUS_M, Points[i].localScale.y);
i++; DebugX.Draw(GetColor(Points[i])).WireFlatCapsule(Points[i].position, Points[i].rotation, Points[i].localScale.x * RADIUS_M, Points[i].localScale.y);
}
private Color GetColor(Transform pos1)
{
Vector3 pos = pos1.localPosition;
pos /= GradientMultiplier == 0 ? 1 : GradientMultiplier;
pos += Vector3.one * 0.5f;
float t = pos.x + pos.y + pos.z;
t /= 3f;
return Gradient.Evaluate(Mathf.Clamp01(t));
}
}
}

View File

@ -0,0 +1,2 @@
fileFormatVersion: 2
guid: 760609f8a4ed270498280da4bfe7ddb1

View File

@ -0,0 +1,36 @@
using UnityEngine;
namespace DCFApixels
{
public class DebugXSample_Primitives3D : MonoBehaviour
{
public Gradient Gradient;
public float GradientMultiplier = 5;
public Transform[] Points;
private void OnDrawGizmos()
{
int i = -1;
const float RADIUS_M = 0.5f;
i++; DebugX.Draw(GetColor(Points[i])).Cube(Points[i].position, Points[i].rotation, Points[i].localScale);
i++; DebugX.Draw(GetColor(Points[i])).WireCube(Points[i].position, Points[i].rotation, Points[i].localScale);
i++; DebugX.Draw(GetColor(Points[i])).CubeGrid(Points[i].position, Points[i].rotation, Points[i].localScale, Vector3Int.one * 3);
i++; DebugX.Draw(GetColor(Points[i])).CubePoints(Points[i].position, Points[i].rotation, Points[i].localScale);
i++; DebugX.Draw(GetColor(Points[i])).Sphere(Points[i].position, Points[i].localScale.x * RADIUS_M);
i++; DebugX.Draw(GetColor(Points[i])).WireSphere(Points[i].position, Points[i].localScale.x * RADIUS_M);
i++; DebugX.Draw(GetColor(Points[i])).Capsule(Points[i].position, Points[i].rotation, Points[i].localScale.x * RADIUS_M, Points[i].localScale.y);
i++; DebugX.Draw(GetColor(Points[i])).WireCapsule(Points[i].position, Points[i].rotation, Points[i].localScale.x * RADIUS_M, Points[i].localScale.y);
}
private Color GetColor(Transform pos1)
{
Vector3 pos = pos1.localPosition;
pos /= GradientMultiplier == 0 ? 1 : GradientMultiplier;
pos += Vector3.one * 0.5f;
float t = pos.x + pos.y + pos.z;
t /= 3f;
return Gradient.Evaluate(Mathf.Clamp01(t));
}
}
}

View File

@ -0,0 +1,2 @@
fileFormatVersion: 2
guid: dfee330120a0afd45a33031970e97612

View File

@ -0,0 +1,52 @@
using UnityEngine;
namespace DCFApixels
{
public class DebugXSample_Raycasts : MonoBehaviour
{
public Gradient Gradient;
public float GradientMultiplier = 5;
public Transform[] Points;
private void OnDrawGizmos()
{
int i = 0;
const float RADIUS_M = 0.5f;
Transform point;
Ray ray;
RaycastHit hit;
point = Points[i++];
ray = new Ray(point.position, point.forward);
Physics.Raycast(ray, out hit, float.PositiveInfinity, int.MaxValue, QueryTriggerInteraction.UseGlobal);
DebugX.Draw(GetColor(point)).Raycast(ray, hit);
point = Points[i++];
ray = new Ray(point.position, point.forward);
Physics.SphereCast(ray.origin, point.localScale.x * RADIUS_M, ray.direction, out hit, float.PositiveInfinity, int.MaxValue, QueryTriggerInteraction.UseGlobal);
DebugX.Draw(GetColor(point)).SphereCast(ray, point.localScale.x * RADIUS_M, hit);
point = Points[i++];
ray = new Ray(point.position, point.forward);
Physics.BoxCast(ray.origin, point.localScale * RADIUS_M, ray.direction, out hit, point.rotation, float.PositiveInfinity, int.MaxValue, QueryTriggerInteraction.UseGlobal);
DebugX.Draw(GetColor(point)).BoxCast(ray, point.rotation, point.localScale * RADIUS_M, hit);
point = Points[i++];
ray = new Ray(point.position, point.forward);
Vector3 point1 = ray.origin + point.up * point.localScale.y * RADIUS_M * 0.5f;
Vector3 point2 = ray.origin + point.up * point.localScale.y * RADIUS_M * -0.5f;
Physics.CapsuleCast(point1, point2, point.localScale.x * RADIUS_M, ray.direction, out hit, float.PositiveInfinity, int.MaxValue, QueryTriggerInteraction.UseGlobal);
DebugX.Draw(GetColor(point)).CapsuleCast(point1, point2, ray.direction, point.localScale.x * RADIUS_M, hit);
}
private Color GetColor(Transform pos1)
{
Vector3 pos = pos1.localPosition;
pos /= GradientMultiplier == 0 ? 1 : GradientMultiplier;
pos += Vector3.one * 0.5f;
float t = pos.x + pos.y + pos.z;
t /= 3f;
return Gradient.Evaluate(Mathf.Clamp01(t));
}
}
}

View File

@ -0,0 +1,2 @@
fileFormatVersion: 2
guid: bc9bc861dfe94664ba81c8550492378c