From cb280bdf00b4dfcd13b51c8213483b83ec53a3d8 Mon Sep 17 00:00:00 2001
From: NotAKidoS <37721153+NotAKidOnSteam@users.noreply.github.com>
Date: Wed, 14 Sep 2022 08:26:02 -0500
Subject: [PATCH 1/9] Initial commit
---
.gitattributes | 2 +
.gitignore | 398 +++++++++++++++++++++++++++++++++++++++++++++++++
LICENSE | 21 +++
README.md | 2 +
4 files changed, 423 insertions(+)
create mode 100644 .gitattributes
create mode 100644 .gitignore
create mode 100644 LICENSE
create mode 100644 README.md
diff --git a/.gitattributes b/.gitattributes
new file mode 100644
index 0000000..dfe0770
--- /dev/null
+++ b/.gitattributes
@@ -0,0 +1,2 @@
+# Auto detect text files and perform LF normalization
+* text=auto
diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000..426d76d
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1,398 @@
+## Ignore Visual Studio temporary files, build results, and
+## files generated by popular Visual Studio add-ons.
+##
+## Get latest from https://github.com/github/gitignore/blob/main/VisualStudio.gitignore
+
+# User-specific files
+*.rsuser
+*.suo
+*.user
+*.userosscache
+*.sln.docstates
+
+# User-specific files (MonoDevelop/Xamarin Studio)
+*.userprefs
+
+# Mono auto generated files
+mono_crash.*
+
+# Build results
+[Dd]ebug/
+[Dd]ebugPublic/
+[Rr]elease/
+[Rr]eleases/
+x64/
+x86/
+[Ww][Ii][Nn]32/
+[Aa][Rr][Mm]/
+[Aa][Rr][Mm]64/
+bld/
+[Bb]in/
+[Oo]bj/
+[Ll]og/
+[Ll]ogs/
+
+# Visual Studio 2015/2017 cache/options directory
+.vs/
+# Uncomment if you have tasks that create the project's static files in wwwroot
+#wwwroot/
+
+# Visual Studio 2017 auto generated files
+Generated\ Files/
+
+# MSTest test Results
+[Tt]est[Rr]esult*/
+[Bb]uild[Ll]og.*
+
+# NUnit
+*.VisualState.xml
+TestResult.xml
+nunit-*.xml
+
+# Build Results of an ATL Project
+[Dd]ebugPS/
+[Rr]eleasePS/
+dlldata.c
+
+# Benchmark Results
+BenchmarkDotNet.Artifacts/
+
+# .NET Core
+project.lock.json
+project.fragment.lock.json
+artifacts/
+
+# ASP.NET Scaffolding
+ScaffoldingReadMe.txt
+
+# StyleCop
+StyleCopReport.xml
+
+# Files built by Visual Studio
+*_i.c
+*_p.c
+*_h.h
+*.ilk
+*.meta
+*.obj
+*.iobj
+*.pch
+*.pdb
+*.ipdb
+*.pgc
+*.pgd
+*.rsp
+*.sbr
+*.tlb
+*.tli
+*.tlh
+*.tmp
+*.tmp_proj
+*_wpftmp.csproj
+*.log
+*.tlog
+*.vspscc
+*.vssscc
+.builds
+*.pidb
+*.svclog
+*.scc
+
+# Chutzpah Test files
+_Chutzpah*
+
+# Visual C++ cache files
+ipch/
+*.aps
+*.ncb
+*.opendb
+*.opensdf
+*.sdf
+*.cachefile
+*.VC.db
+*.VC.VC.opendb
+
+# Visual Studio profiler
+*.psess
+*.vsp
+*.vspx
+*.sap
+
+# Visual Studio Trace Files
+*.e2e
+
+# TFS 2012 Local Workspace
+$tf/
+
+# Guidance Automation Toolkit
+*.gpState
+
+# ReSharper is a .NET coding add-in
+_ReSharper*/
+*.[Rr]e[Ss]harper
+*.DotSettings.user
+
+# TeamCity is a build add-in
+_TeamCity*
+
+# DotCover is a Code Coverage Tool
+*.dotCover
+
+# AxoCover is a Code Coverage Tool
+.axoCover/*
+!.axoCover/settings.json
+
+# Coverlet is a free, cross platform Code Coverage Tool
+coverage*.json
+coverage*.xml
+coverage*.info
+
+# Visual Studio code coverage results
+*.coverage
+*.coveragexml
+
+# NCrunch
+_NCrunch_*
+.*crunch*.local.xml
+nCrunchTemp_*
+
+# MightyMoose
+*.mm.*
+AutoTest.Net/
+
+# Web workbench (sass)
+.sass-cache/
+
+# Installshield output folder
+[Ee]xpress/
+
+# DocProject is a documentation generator add-in
+DocProject/buildhelp/
+DocProject/Help/*.HxT
+DocProject/Help/*.HxC
+DocProject/Help/*.hhc
+DocProject/Help/*.hhk
+DocProject/Help/*.hhp
+DocProject/Help/Html2
+DocProject/Help/html
+
+# Click-Once directory
+publish/
+
+# Publish Web Output
+*.[Pp]ublish.xml
+*.azurePubxml
+# Note: Comment the next line if you want to checkin your web deploy settings,
+# but database connection strings (with potential passwords) will be unencrypted
+*.pubxml
+*.publishproj
+
+# Microsoft Azure Web App publish settings. Comment the next line if you want to
+# checkin your Azure Web App publish settings, but sensitive information contained
+# in these scripts will be unencrypted
+PublishScripts/
+
+# NuGet Packages
+*.nupkg
+# NuGet Symbol Packages
+*.snupkg
+# The packages folder can be ignored because of Package Restore
+**/[Pp]ackages/*
+# except build/, which is used as an MSBuild target.
+!**/[Pp]ackages/build/
+# Uncomment if necessary however generally it will be regenerated when needed
+#!**/[Pp]ackages/repositories.config
+# NuGet v3's project.json files produces more ignorable files
+*.nuget.props
+*.nuget.targets
+
+# Microsoft Azure Build Output
+csx/
+*.build.csdef
+
+# Microsoft Azure Emulator
+ecf/
+rcf/
+
+# Windows Store app package directories and files
+AppPackages/
+BundleArtifacts/
+Package.StoreAssociation.xml
+_pkginfo.txt
+*.appx
+*.appxbundle
+*.appxupload
+
+# Visual Studio cache files
+# files ending in .cache can be ignored
+*.[Cc]ache
+# but keep track of directories ending in .cache
+!?*.[Cc]ache/
+
+# Others
+ClientBin/
+~$*
+*~
+*.dbmdl
+*.dbproj.schemaview
+*.jfm
+*.pfx
+*.publishsettings
+orleans.codegen.cs
+
+# Including strong name files can present a security risk
+# (https://github.com/github/gitignore/pull/2483#issue-259490424)
+#*.snk
+
+# Since there are multiple workflows, uncomment next line to ignore bower_components
+# (https://github.com/github/gitignore/pull/1529#issuecomment-104372622)
+#bower_components/
+
+# RIA/Silverlight projects
+Generated_Code/
+
+# Backup & report files from converting an old project file
+# to a newer Visual Studio version. Backup files are not needed,
+# because we have git ;-)
+_UpgradeReport_Files/
+Backup*/
+UpgradeLog*.XML
+UpgradeLog*.htm
+ServiceFabricBackup/
+*.rptproj.bak
+
+# SQL Server files
+*.mdf
+*.ldf
+*.ndf
+
+# Business Intelligence projects
+*.rdl.data
+*.bim.layout
+*.bim_*.settings
+*.rptproj.rsuser
+*- [Bb]ackup.rdl
+*- [Bb]ackup ([0-9]).rdl
+*- [Bb]ackup ([0-9][0-9]).rdl
+
+# Microsoft Fakes
+FakesAssemblies/
+
+# GhostDoc plugin setting file
+*.GhostDoc.xml
+
+# Node.js Tools for Visual Studio
+.ntvs_analysis.dat
+node_modules/
+
+# Visual Studio 6 build log
+*.plg
+
+# Visual Studio 6 workspace options file
+*.opt
+
+# Visual Studio 6 auto-generated workspace file (contains which files were open etc.)
+*.vbw
+
+# Visual Studio 6 auto-generated project file (contains which files were open etc.)
+*.vbp
+
+# Visual Studio 6 workspace and project file (working project files containing files to include in project)
+*.dsw
+*.dsp
+
+# Visual Studio 6 technical files
+*.ncb
+*.aps
+
+# Visual Studio LightSwitch build output
+**/*.HTMLClient/GeneratedArtifacts
+**/*.DesktopClient/GeneratedArtifacts
+**/*.DesktopClient/ModelManifest.xml
+**/*.Server/GeneratedArtifacts
+**/*.Server/ModelManifest.xml
+_Pvt_Extensions
+
+# Paket dependency manager
+.paket/paket.exe
+paket-files/
+
+# FAKE - F# Make
+.fake/
+
+# CodeRush personal settings
+.cr/personal
+
+# Python Tools for Visual Studio (PTVS)
+__pycache__/
+*.pyc
+
+# Cake - Uncomment if you are using it
+# tools/**
+# !tools/packages.config
+
+# Tabs Studio
+*.tss
+
+# Telerik's JustMock configuration file
+*.jmconfig
+
+# BizTalk build output
+*.btp.cs
+*.btm.cs
+*.odx.cs
+*.xsd.cs
+
+# OpenCover UI analysis results
+OpenCover/
+
+# Azure Stream Analytics local run output
+ASALocalRun/
+
+# MSBuild Binary and Structured Log
+*.binlog
+
+# NVidia Nsight GPU debugger configuration file
+*.nvuser
+
+# MFractors (Xamarin productivity tool) working folder
+.mfractor/
+
+# Local History for Visual Studio
+.localhistory/
+
+# Visual Studio History (VSHistory) files
+.vshistory/
+
+# BeatPulse healthcheck temp database
+healthchecksdb
+
+# Backup folder for Package Reference Convert tool in Visual Studio 2017
+MigrationBackup/
+
+# Ionide (cross platform F# VS Code tools) working folder
+.ionide/
+
+# Fody - auto-generated XML schema
+FodyWeavers.xsd
+
+# VS Code files for those working on multiple tools
+.vscode/*
+!.vscode/settings.json
+!.vscode/tasks.json
+!.vscode/launch.json
+!.vscode/extensions.json
+*.code-workspace
+
+# Local History for Visual Studio Code
+.history/
+
+# Windows Installer files from build outputs
+*.cab
+*.msi
+*.msix
+*.msm
+*.msp
+
+# JetBrains Rider
+*.sln.iml
diff --git a/LICENSE b/LICENSE
new file mode 100644
index 0000000..262b1ec
--- /dev/null
+++ b/LICENSE
@@ -0,0 +1,21 @@
+MIT License
+
+Copyright (c) 2022 NotAKidoS
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in all
+copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+SOFTWARE.
diff --git a/README.md b/README.md
new file mode 100644
index 0000000..c2ee8b5
--- /dev/null
+++ b/README.md
@@ -0,0 +1,2 @@
+# CVRGizmos
+ Adds in-game gizmos to CCK components.
From 29060f71c107b2b4083737f2b1f75a067ebbb872 Mon Sep 17 00:00:00 2001
From: NotAKidoS <37721153+NotAKidOnSteam@users.noreply.github.com>
Date: Wed, 14 Sep 2022 08:27:23 -0500
Subject: [PATCH 2/9] Initial Upload
it working and not nuking fps... wow
---
CVRGizmos/CVRGizmoManager.cs | 52 ++
CVRGizmos/CVRGizmos.csproj | 43 ++
CVRGizmos/CVRGizmos.sln | 25 +
CVRGizmos/Gizmo/Constants.cs | 8 +
CVRGizmos/Gizmo/Drawer.cs | 70 +++
CVRGizmos/Gizmo/Drawers/CubeDrawer.cs | 96 ++++
CVRGizmos/Gizmo/Drawers/LineDrawer.cs | 19 +
CVRGizmos/Gizmo/Drawers/PolygonDrawer.cs | 40 ++
CVRGizmos/Gizmo/Drawers/SquareDrawer.cs | 72 +++
CVRGizmos/Gizmo/Element.cs | 12 +
CVRGizmos/Gizmo/Gizmos.cs | 394 ++++++++++++++++
CVRGizmos/Gizmo/GizmosInstance.cs | 445 ++++++++++++++++++
.../CVRAdvancedAvatarSettingsPointer.cs | 49 ++
.../CVRAdvancedAvatarSettingsTrigger.cs | 113 +++++
CVRGizmos/GizmoTypes/CVRDistanceLod.cs | 62 +++
CVRGizmos/GizmoTypes/CVRGizmoBase.cs | 37 ++
CVRGizmos/GizmoTypes/CVRHapticAreaChest.cs | 53 +++
CVRGizmos/GizmoTypes/CVRHapticZone.cs | 45 ++
CVRGizmos/GizmoTypes/CVRPointer.cs | 44 ++
CVRGizmos/GizmoTypes/CVRSpawnableTrigger.cs | 127 +++++
CVRGizmos/Main.cs | 46 ++
CVRGizmos/Properties/AssemblyInfo.cs | 30 ++
CVRGizmos/format.json | 23 +
23 files changed, 1905 insertions(+)
create mode 100644 CVRGizmos/CVRGizmoManager.cs
create mode 100644 CVRGizmos/CVRGizmos.csproj
create mode 100644 CVRGizmos/CVRGizmos.sln
create mode 100644 CVRGizmos/Gizmo/Constants.cs
create mode 100644 CVRGizmos/Gizmo/Drawer.cs
create mode 100644 CVRGizmos/Gizmo/Drawers/CubeDrawer.cs
create mode 100644 CVRGizmos/Gizmo/Drawers/LineDrawer.cs
create mode 100644 CVRGizmos/Gizmo/Drawers/PolygonDrawer.cs
create mode 100644 CVRGizmos/Gizmo/Drawers/SquareDrawer.cs
create mode 100644 CVRGizmos/Gizmo/Element.cs
create mode 100644 CVRGizmos/Gizmo/Gizmos.cs
create mode 100644 CVRGizmos/Gizmo/GizmosInstance.cs
create mode 100644 CVRGizmos/GizmoTypes/CVRAdvancedAvatarSettingsPointer.cs
create mode 100644 CVRGizmos/GizmoTypes/CVRAdvancedAvatarSettingsTrigger.cs
create mode 100644 CVRGizmos/GizmoTypes/CVRDistanceLod.cs
create mode 100644 CVRGizmos/GizmoTypes/CVRGizmoBase.cs
create mode 100644 CVRGizmos/GizmoTypes/CVRHapticAreaChest.cs
create mode 100644 CVRGizmos/GizmoTypes/CVRHapticZone.cs
create mode 100644 CVRGizmos/GizmoTypes/CVRPointer.cs
create mode 100644 CVRGizmos/GizmoTypes/CVRSpawnableTrigger.cs
create mode 100644 CVRGizmos/Main.cs
create mode 100644 CVRGizmos/Properties/AssemblyInfo.cs
create mode 100644 CVRGizmos/format.json
diff --git a/CVRGizmos/CVRGizmoManager.cs b/CVRGizmos/CVRGizmoManager.cs
new file mode 100644
index 0000000..f29cb97
--- /dev/null
+++ b/CVRGizmos/CVRGizmoManager.cs
@@ -0,0 +1,52 @@
+using CVRGizmos.GismoTypes;
+using UnityEngine;
+
+namespace CVRGizmos
+{
+ public class CVRGizmoManager : MonoBehaviour
+ {
+ public static CVRGizmoManager Instance;
+
+ public bool g_enabled = false;
+ public bool g_localOnly = false;
+
+ public MonoBehaviour[] managed;
+
+ public System.Type[] GizmoTypes = {
+ typeof(CVRGizmos_Pointer),
+ typeof(CVRGizmos_AdvancedAvatarSettingsTrigger),
+ typeof(CVRGizmos_SpawnableTrigger),
+ typeof(CVRGizmos_AdvancedAvatarSettingsPointer),
+ typeof(CVRGizmos_DistanceLod),
+ typeof(CVRGizmos_HapticZone),
+ typeof(CVRGizmos_HapticAreaChest),
+ };
+
+ void Start()
+ {
+ CVRGizmoManager.Instance = this;
+ managed = new MonoBehaviour[GizmoTypes.Count()];
+ for (int i = 0; i < GizmoTypes.Count(); i++)
+ {
+ managed[i] = gameObject.AddComponent(GizmoTypes[i]) as MonoBehaviour;
+ }
+ }
+
+ public void EnableGizmos(bool able)
+ {
+ for (int i = 0; i < GizmoTypes.Count(); i++)
+ {
+ managed[i].enabled = able;
+ }
+ RefreshGizmos();
+ }
+
+ public void RefreshGizmos()
+ {
+ for (int i = 0; i < GizmoTypes.Count(); i++)
+ {
+ managed[i].Invoke("CacheGizmos", 1f);
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/CVRGizmos/CVRGizmos.csproj b/CVRGizmos/CVRGizmos.csproj
new file mode 100644
index 0000000..7c80c7d
--- /dev/null
+++ b/CVRGizmos/CVRGizmos.csproj
@@ -0,0 +1,43 @@
+
+
+
+
+ net472
+ enable
+ latest
+ false
+
+
+
+
+ C:\Program Files (x86)\Steam\steamapps\common\ChilloutVR\MelonLoader\0Harmony.dll
+
+
+ C:\Program Files (x86)\Steam\steamapps\common\ChilloutVR\ChilloutVR_Data\Managed\Assembly-CSharp.dll
+
+
+ ..\..\..\..\..\..\..\Program Files (x86)\Steam\steamapps\common\ChilloutVR\ChilloutVR_Data\Managed\Cohtml.Runtime.dll
+
+
+ C:\Program Files (x86)\Steam\steamapps\common\ChilloutVR\MelonLoader\MelonLoader.dll
+
+
+ C:\Program Files (x86)\Steam\steamapps\common\ChilloutVR\ChilloutVR_Data\Managed\SteamVR.dll
+
+
+ C:\Program Files (x86)\Steam\steamapps\common\ChilloutVR\ChilloutVR_Data\Managed\UnityEngine.CoreModule.dll
+
+
+ C:\Program Files (x86)\Steam\steamapps\common\ChilloutVR\ChilloutVR_Data\Managed\UnityEngine.InputLegacyModule.dll
+
+
+ ..\..\..\..\..\..\..\Program Files (x86)\Steam\steamapps\common\ChilloutVR\ChilloutVR_Data\Managed\UnityEngine.PhysicsModule.dll
+
+
+
+
+
+
+
+
+
diff --git a/CVRGizmos/CVRGizmos.sln b/CVRGizmos/CVRGizmos.sln
new file mode 100644
index 0000000..45a6871
--- /dev/null
+++ b/CVRGizmos/CVRGizmos.sln
@@ -0,0 +1,25 @@
+
+Microsoft Visual Studio Solution File, Format Version 12.00
+# Visual Studio Version 17
+VisualStudioVersion = 17.2.32630.192
+MinimumVisualStudioVersion = 10.0.40219.1
+Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "CVRGizmos", "CVRGizmos.csproj", "{5465736B-DE27-4413-A374-1834FDE7DB0D}"
+EndProject
+Global
+ GlobalSection(SolutionConfigurationPlatforms) = preSolution
+ Debug|Any CPU = Debug|Any CPU
+ Release|Any CPU = Release|Any CPU
+ EndGlobalSection
+ GlobalSection(ProjectConfigurationPlatforms) = postSolution
+ {5465736B-DE27-4413-A374-1834FDE7DB0D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {5465736B-DE27-4413-A374-1834FDE7DB0D}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {5465736B-DE27-4413-A374-1834FDE7DB0D}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {5465736B-DE27-4413-A374-1834FDE7DB0D}.Release|Any CPU.Build.0 = Release|Any CPU
+ EndGlobalSection
+ GlobalSection(SolutionProperties) = preSolution
+ HideSolutionNode = FALSE
+ EndGlobalSection
+ GlobalSection(ExtensibilityGlobals) = postSolution
+ SolutionGuid = {C0002BEC-CB43-4733-9961-C9CDDB3AC4EA}
+ EndGlobalSection
+EndGlobal
diff --git a/CVRGizmos/Gizmo/Constants.cs b/CVRGizmos/Gizmo/Constants.cs
new file mode 100644
index 0000000..e5884c9
--- /dev/null
+++ b/CVRGizmos/Gizmo/Constants.cs
@@ -0,0 +1,8 @@
+namespace Popcron
+{
+ public class Constants
+ {
+ public const string UniqueIdentifier = "Popcron.Gizmos";
+ public const string EnabledKey = UniqueIdentifier + ".Enabled";
+ }
+}
\ No newline at end of file
diff --git a/CVRGizmos/Gizmo/Drawer.cs b/CVRGizmos/Gizmo/Drawer.cs
new file mode 100644
index 0000000..7e769b5
--- /dev/null
+++ b/CVRGizmos/Gizmo/Drawer.cs
@@ -0,0 +1,70 @@
+using System;
+using System.Collections.Generic;
+using System.Reflection;
+using UnityEngine;
+
+namespace Popcron
+{
+ public abstract class Drawer
+ {
+ private static Dictionary typeToDrawer = null;
+
+ public abstract int Draw(ref Vector3[] buffer, params object[] args);
+
+ public Drawer()
+ {
+
+ }
+
+ public static Drawer Get() where T : class
+ {
+ //find all drawers
+ if (typeToDrawer == null)
+ {
+ typeToDrawer = new Dictionary();
+
+ //add defaults
+ typeToDrawer.Add(typeof(CubeDrawer), new CubeDrawer());
+ typeToDrawer.Add(typeof(LineDrawer), new LineDrawer());
+ typeToDrawer.Add(typeof(PolygonDrawer), new PolygonDrawer());
+ typeToDrawer.Add(typeof(SquareDrawer), new SquareDrawer());
+
+ //find extras
+ Assembly[] assemblies = AppDomain.CurrentDomain.GetAssemblies();
+ foreach (Assembly assembly in assemblies)
+ {
+ Type[] types = assembly.GetTypes();
+ foreach (Type type in types)
+ {
+ if (type.IsAbstract)
+ {
+ continue;
+ }
+
+ if (type.IsSubclassOf(typeof(Drawer)) && !typeToDrawer.ContainsKey(type))
+ {
+ try
+ {
+ Drawer value = (Drawer)Activator.CreateInstance(type);
+ typeToDrawer[type] = value;
+ }
+ catch (Exception e)
+ {
+ Debug.LogError($"couldnt register drawer of type {type} because {e.Message}");
+ }
+ }
+ }
+ }
+ }
+
+ if (typeToDrawer.TryGetValue(typeof(T), out Drawer drawer))
+ {
+ return drawer;
+ }
+ else
+ {
+ return null;
+ }
+ }
+ }
+}
diff --git a/CVRGizmos/Gizmo/Drawers/CubeDrawer.cs b/CVRGizmos/Gizmo/Drawers/CubeDrawer.cs
new file mode 100644
index 0000000..478a0b6
--- /dev/null
+++ b/CVRGizmos/Gizmo/Drawers/CubeDrawer.cs
@@ -0,0 +1,96 @@
+using UnityEngine;
+
+namespace Popcron
+{
+ public class CubeDrawer : Drawer
+ {
+ public CubeDrawer()
+ {
+
+ }
+
+ public override int Draw(ref Vector3[] buffer, params object[] values)
+ {
+ Vector3 position = (Vector3)values[0];
+ Quaternion rotation = (Quaternion)values[1];
+ Vector3 size = (Vector3)values[2];
+
+ size *= 0.5f;
+
+ Vector3 point1 = new Vector3(position.x - size.x, position.y - size.y, position.z - size.z);
+ Vector3 point2 = new Vector3(position.x + size.x, position.y - size.y, position.z - size.z);
+ Vector3 point3 = new Vector3(position.x + size.x, position.y + size.y, position.z - size.z);
+ Vector3 point4 = new Vector3(position.x - size.x, position.y + size.y, position.z - size.z);
+
+ Vector3 point5 = new Vector3(position.x - size.x, position.y - size.y, position.z + size.z);
+ Vector3 point6 = new Vector3(position.x + size.x, position.y - size.y, position.z + size.z);
+ Vector3 point7 = new Vector3(position.x + size.x, position.y + size.y, position.z + size.z);
+ Vector3 point8 = new Vector3(position.x - size.x, position.y + size.y, position.z + size.z);
+
+ point1 = rotation * (point1 - position);
+ point1 += position;
+
+ point2 = rotation * (point2 - position);
+ point2 += position;
+
+ point3 = rotation * (point3 - position);
+ point3 += position;
+
+ point4 = rotation * (point4 - position);
+ point4 += position;
+
+ point5 = rotation * (point5 - position);
+ point5 += position;
+
+ point6 = rotation * (point6 - position);
+ point6 += position;
+
+ point7 = rotation * (point7 - position);
+ point7 += position;
+
+ point8 = rotation * (point8 - position);
+ point8 += position;
+
+ //square
+ buffer[0] = point1;
+ buffer[1] = point2;
+
+ buffer[2] = point2;
+ buffer[3] = point3;
+
+ buffer[4] = point3;
+ buffer[5] = point4;
+
+ buffer[6] = point4;
+ buffer[7] = point1;
+
+ //other square
+ buffer[8] = point5;
+ buffer[9] = point6;
+
+ buffer[10] = point6;
+ buffer[11] = point7;
+
+ buffer[12] = point7;
+ buffer[13] = point8;
+
+ buffer[14] = point8;
+ buffer[15] = point5;
+
+ //connectors
+ buffer[16] = point1;
+ buffer[17] = point5;
+
+ buffer[18] = point2;
+ buffer[19] = point6;
+
+ buffer[20] = point3;
+ buffer[21] = point7;
+
+ buffer[22] = point4;
+ buffer[23] = point8;
+
+ return 24;
+ }
+ }
+}
diff --git a/CVRGizmos/Gizmo/Drawers/LineDrawer.cs b/CVRGizmos/Gizmo/Drawers/LineDrawer.cs
new file mode 100644
index 0000000..f9193cf
--- /dev/null
+++ b/CVRGizmos/Gizmo/Drawers/LineDrawer.cs
@@ -0,0 +1,19 @@
+using UnityEngine;
+
+namespace Popcron
+{
+ public class LineDrawer : Drawer
+ {
+ public LineDrawer()
+ {
+
+ }
+
+ public override int Draw(ref Vector3[] buffer, params object[] args)
+ {
+ buffer[0] = (Vector3)args[0];
+ buffer[1] = (Vector3)args[1];
+ return 2;
+ }
+ }
+}
diff --git a/CVRGizmos/Gizmo/Drawers/PolygonDrawer.cs b/CVRGizmos/Gizmo/Drawers/PolygonDrawer.cs
new file mode 100644
index 0000000..ad3b1b2
--- /dev/null
+++ b/CVRGizmos/Gizmo/Drawers/PolygonDrawer.cs
@@ -0,0 +1,40 @@
+using UnityEngine;
+
+namespace Popcron
+{
+ public class PolygonDrawer : Drawer
+ {
+ public PolygonDrawer()
+ {
+
+ }
+
+ public override int Draw(ref Vector3[] buffer, params object[] values)
+ {
+ Vector3 position = (Vector3)values[0];
+ int points = (int)values[1];
+ float radius = (float)values[2];
+ float offset = (float)values[3];
+ Quaternion rotation = (Quaternion)values[4];
+
+ float step = 360f / points;
+ offset *= Mathf.Deg2Rad;
+
+ for (int i = 0; i < points; i++)
+ {
+ float cx = Mathf.Cos(Mathf.Deg2Rad * step * i + offset) * radius;
+ float cy = Mathf.Sin(Mathf.Deg2Rad * step * i + offset) * radius;
+ Vector3 current = new Vector3(cx, cy);
+
+ float nx = Mathf.Cos(Mathf.Deg2Rad * step * (i + 1) + offset) * radius;
+ float ny = Mathf.Sin(Mathf.Deg2Rad * step * (i + 1) + offset) * radius;
+ Vector3 next = new Vector3(nx, ny);
+
+ buffer[i * 2] = position + (rotation * current);
+ buffer[(i * 2) + 1] = position + (rotation * next);
+ }
+
+ return points * 2;
+ }
+ }
+}
diff --git a/CVRGizmos/Gizmo/Drawers/SquareDrawer.cs b/CVRGizmos/Gizmo/Drawers/SquareDrawer.cs
new file mode 100644
index 0000000..c46160a
--- /dev/null
+++ b/CVRGizmos/Gizmo/Drawers/SquareDrawer.cs
@@ -0,0 +1,72 @@
+using UnityEngine;
+
+namespace Popcron
+{
+ public class SquareDrawer : Drawer
+ {
+ public SquareDrawer()
+ {
+
+ }
+
+ public override int Draw(ref Vector3[] buffer, params object[] values)
+ {
+ Vector2 position = default;
+ if (values[0] is Vector2 p2)
+ {
+ position = p2;
+ }
+ else if (values[0] is Vector3 p3)
+ {
+ position = p3;
+ }
+
+ Quaternion rotation = (Quaternion)values[1];
+
+ Vector2 size = default;
+ if (values[2] is Vector2 s2)
+ {
+ size = s2;
+ }
+ else if (values[2] is Vector3 s3)
+ {
+ size = s3;
+ }
+
+ size *= 0.5f;
+
+ Vector2 point1 = new Vector3(position.x - size.x, position.y - size.y);
+ Vector2 point2 = new Vector3(position.x + size.x, position.y - size.y);
+ Vector2 point3 = new Vector3(position.x + size.x, position.y + size.y);
+ Vector2 point4 = new Vector3(position.x - size.x, position.y + size.y);
+
+ point1 = rotation * (point1 - position);
+ point1 += position;
+
+ point2 = rotation * (point2 - position);
+ point2 += position;
+
+ point3 = rotation * (point3 - position);
+ point3 += position;
+
+ point4 = rotation * (point4 - position);
+ point4 += position;
+
+ //square
+ buffer[0] = point1;
+ buffer[1] = point2;
+
+ buffer[2] = point2;
+ buffer[3] = point3;
+
+ buffer[4] = point3;
+ buffer[5] = point4;
+
+ //loop back to start
+ buffer[6] = point4;
+ buffer[7] = point1;
+
+ return 8;
+ }
+ }
+}
diff --git a/CVRGizmos/Gizmo/Element.cs b/CVRGizmos/Gizmo/Element.cs
new file mode 100644
index 0000000..361fd59
--- /dev/null
+++ b/CVRGizmos/Gizmo/Element.cs
@@ -0,0 +1,12 @@
+using UnityEngine;
+
+namespace Popcron
+{
+ internal class Element
+ {
+ public Vector3[] points = { };
+ public Color color = Color.white;
+ public bool dashed = false;
+ public Matrix4x4 matrix = Matrix4x4.identity;
+ }
+}
\ No newline at end of file
diff --git a/CVRGizmos/Gizmo/Gizmos.cs b/CVRGizmos/Gizmo/Gizmos.cs
new file mode 100644
index 0000000..ad79726
--- /dev/null
+++ b/CVRGizmos/Gizmo/Gizmos.cs
@@ -0,0 +1,394 @@
+using System;
+using UnityEngine;
+
+namespace Popcron
+{
+ public class Gizmos
+ {
+ private static string _prefsKey = null;
+ private static int? _bufferSize = null;
+ private static bool? _enabled = null;
+ private static float? _dashGap = null;
+ private static bool? _cull = null;
+ private static int? _pass = null;
+ private static Vector3? _offset = null;
+
+ private static Vector3[] buffer = new Vector3[BufferSize];
+
+ ///
+ /// By default, it will always render to scene view camera and the main camera.
+ /// Subscribing to this allows you to whitelist your custom cameras.
+ ///
+ public static Func CameraFilter = cam => false;
+
+ private static string PrefsKey
+ {
+ get
+ {
+ if (string.IsNullOrEmpty(_prefsKey))
+ {
+ _prefsKey = $"{SystemInfo.deviceUniqueIdentifier}.{Application.companyName}.{Application.productName}.{Constants.UniqueIdentifier}";
+ }
+
+ return _prefsKey;
+ }
+ }
+
+ ///
+ /// The matrix to use.
+ ///
+ public static Matrix4x4 Matrix
+ {
+ get => GizmosInstance.Matrix;
+ set => GizmosInstance.Matrix = value;
+ }
+
+ ///
+ /// The matrix to use.
+ ///
+ public static Color Color
+ {
+ get => GizmosInstance.Color;
+ set => GizmosInstance.Color = value;
+ }
+
+ ///
+ /// The size of the total gizmos buffer.
+ /// Default is 4096.
+ ///
+ public static int BufferSize
+ {
+ get
+ {
+ if (_bufferSize == null)
+ {
+ _bufferSize = PlayerPrefs.GetInt($"{PrefsKey}.BufferSize", 4096);
+ }
+
+ return _bufferSize.Value;
+ }
+ set
+ {
+ value = Mathf.Clamp(value, 0, int.MaxValue);
+ if (_bufferSize != value)
+ {
+ _bufferSize = value;
+ PlayerPrefs.SetInt($"{PrefsKey}.BufferSize", value);
+
+ //buffer size changed, so recreate the buffer array too
+ buffer = new Vector3[value];
+ }
+ }
+ }
+
+ ///
+ /// Toggles wether the gizmos could be drawn or not.
+ ///
+ public static bool Enabled
+ {
+ get
+ {
+ if (_enabled == null)
+ {
+ _enabled = PlayerPrefs.GetInt($"{PrefsKey}.Enabled", 1) == 1;
+ }
+
+ return _enabled.Value;
+ }
+ set
+ {
+ if (_enabled != value)
+ {
+ _enabled = value;
+ PlayerPrefs.SetInt($"{PrefsKey}.Enabled", value ? 1 : 0);
+ }
+ }
+ }
+
+ ///
+ /// The size of the gap when drawing dashed elements.
+ /// Default gap size is 0.1
+ ///
+ public static float DashGap
+ {
+ get
+ {
+ if (_dashGap == null)
+ {
+ _dashGap = PlayerPrefs.GetFloat($"{PrefsKey}.DashGap", 0.1f);
+ }
+
+ return _dashGap.Value;
+ }
+ set
+ {
+ if (_dashGap != value)
+ {
+ _dashGap = value;
+ PlayerPrefs.SetFloat($"{PrefsKey}.DashGap", value);
+ }
+ }
+ }
+
+ [Obsolete("This property is obsolete. Use FrustumCulling instead.", false)]
+ public static bool Cull
+ {
+ get
+ {
+ return FrustumCulling;
+ }
+ set
+ {
+ FrustumCulling = value;
+ }
+ }
+
+ [Obsolete("This property is obsolete. Subscribe to CameraFilter predicate instead and return true for your custom camera.", false)]
+ public static Camera Camera
+ {
+ get => null;
+ set
+ {
+
+ }
+ }
+
+ ///
+ /// Should the camera not draw elements that are not visible?
+ ///
+ public static bool FrustumCulling
+ {
+ get
+ {
+ if (_cull == null)
+ {
+ _cull = PlayerPrefs.GetInt($"{PrefsKey}.FrustumCulling", 1) == 1;
+ }
+
+ return _cull.Value;
+ }
+ set
+ {
+ if (_cull != value)
+ {
+ _cull = value;
+ PlayerPrefs.SetInt($"{PrefsKey}.FrustumCulling", value ? 1 : 0);
+ }
+ }
+ }
+
+ ///
+ /// The material being used to render.
+ ///
+ public static Material Material
+ {
+ get => GizmosInstance.Material;
+ set => GizmosInstance.Material = value;
+ }
+
+ ///
+ /// Rendering pass to activate.
+ ///
+ public static int Pass
+ {
+ get
+ {
+ if (_pass == null)
+ {
+ _pass = PlayerPrefs.GetInt($"{PrefsKey}.Pass", 0);
+ }
+
+ return _pass.Value;
+ }
+ set
+ {
+ if (_pass != value)
+ {
+ _pass = value;
+ PlayerPrefs.SetInt($"{PrefsKey}.Pass", value);
+ }
+ }
+ }
+
+ ///
+ /// Global offset for all points. Default is (0, 0, 0).
+ ///
+ public static Vector3 Offset
+ {
+ get
+ {
+ const string Delim = ",";
+ if (_offset == null)
+ {
+ string data = PlayerPrefs.GetString($"{PrefsKey}.Offset", 0 + Delim + 0 + Delim + 0);
+ int indexOf = data.IndexOf(Delim);
+ int lastIndexOf = data.LastIndexOf(Delim);
+ if (indexOf + lastIndexOf > 0)
+ {
+ string[] arr = data.Split(Delim[0]);
+ _offset = new Vector3(float.Parse(arr[0]), float.Parse(arr[1]), float.Parse(arr[2]));
+ }
+ else
+ {
+ return Vector3.zero;
+ }
+ }
+
+ return _offset.Value;
+ }
+ set
+ {
+ const string Delim = ",";
+ if (_offset != value)
+ {
+ _offset = value;
+ PlayerPrefs.SetString($"{PrefsKey}.Offset", value.x + Delim + value.y + Delim + value.y);
+ }
+ }
+ }
+
+ ///
+ /// Draws an element onto the screen.
+ ///
+ public static void Draw(Color? color, bool dashed, params object[] args) where T : Drawer
+ {
+ if (!Enabled)
+ {
+ return;
+ }
+
+ Drawer drawer = Drawer.Get();
+ if (drawer != null)
+ {
+ int points = drawer.Draw(ref buffer, args);
+
+ //copy from buffer and add to the queue
+ Vector3[] array = new Vector3[points];
+ Array.Copy(buffer, array, points);
+ GizmosInstance.Submit(array, color, dashed);
+ }
+ }
+
+ ///
+ /// Draws an array of lines. Useful for things like paths.
+ ///
+ public static void Lines(Vector3[] lines, Color? color = null, bool dashed = false)
+ {
+ if (!Enabled)
+ {
+ return;
+ }
+
+ GizmosInstance.Submit(lines, color, dashed);
+ }
+
+ ///
+ /// Draw line in world space.
+ ///
+ public static void Line(Vector3 a, Vector3 b, Color? color = null, bool dashed = false)
+ {
+ Draw(color, dashed, a, b);
+ }
+
+ ///
+ /// Draw square in world space.
+ ///
+ public static void Square(Vector2 position, Vector2 size, Color? color = null, bool dashed = false)
+ {
+ Square(position, Quaternion.identity, size, color, dashed);
+ }
+
+ ///
+ /// Draw square in world space with float diameter parameter.
+ ///
+ public static void Square(Vector2 position, float diameter, Color? color = null, bool dashed = false)
+ {
+ Square(position, Quaternion.identity, Vector2.one * diameter, color, dashed);
+ }
+
+ ///
+ /// Draw square in world space with a rotation parameter.
+ ///
+ public static void Square(Vector2 position, Quaternion rotation, Vector2 size, Color? color = null, bool dashed = false)
+ {
+ Draw(color, dashed, position, rotation, size);
+ }
+
+ ///
+ /// Draws a cube in world space.
+ ///
+ public static void Cube(Vector3 position, Quaternion rotation, Vector3 size, Color? color = null, bool dashed = false)
+ {
+ Draw(color, dashed, position, rotation, size);
+ }
+
+ ///
+ /// Draws a rectangle in screen space.
+ ///
+ public static void Rect(Rect rect, Camera camera, Color? color = null, bool dashed = false)
+ {
+ rect.y = Screen.height - rect.y;
+ Vector2 corner = camera.ScreenToWorldPoint(new Vector2(rect.x, rect.y - rect.height));
+ Draw(color, dashed, corner + rect.size * 0.5f, Quaternion.identity, rect.size);
+ }
+
+ ///
+ /// Draws a representation of a bounding box.
+ ///
+ public static void Bounds(Bounds bounds, Color? color = null, bool dashed = false)
+ {
+ Draw(color, dashed, bounds.center, Quaternion.identity, bounds.size);
+ }
+
+ ///
+ /// Draws a cone similar to the one that spot lights draw.
+ ///
+ public static void Cone(Vector3 position, Quaternion rotation, float length, float angle, Color? color = null, bool dashed = false, int pointsCount = 16)
+ {
+ //draw the end of the cone
+ float endAngle = Mathf.Tan(angle * 0.5f * Mathf.Deg2Rad) * length;
+ Vector3 forward = rotation * Vector3.forward;
+ Vector3 endPosition = position + forward * length;
+ float offset = 0f;
+ Draw(color, dashed, endPosition, pointsCount, endAngle, offset, rotation);
+
+ //draw the 4 lines
+ for (int i = 0; i < 4; i++)
+ {
+ float a = i * 90f * Mathf.Deg2Rad;
+ Vector3 point = rotation * new Vector3(Mathf.Cos(a), Mathf.Sin(a)) * endAngle;
+ Line(position, position + point + forward * length, color, dashed);
+ }
+ }
+
+ ///
+ /// Draws a sphere at position with specified radius.
+ ///
+ public static void Sphere(Vector3 position, float radius, Color? color = null, bool dashed = false, int pointsCount = 16)
+ {
+ float offset = 0f;
+ Draw(color, dashed, position, pointsCount, radius, offset, Quaternion.Euler(0f, 0f, 0f));
+ Draw(color, dashed, position, pointsCount, radius, offset, Quaternion.Euler(90f, 0f, 0f));
+ Draw(color, dashed, position, pointsCount, radius, offset, Quaternion.Euler(0f, 90f, 90f));
+ }
+
+ ///
+ /// Draws a circle in world space and billboards towards the camera.
+ ///
+ public static void Circle(Vector3 position, float radius, Camera camera, Color? color = null, bool dashed = false, int pointsCount = 16)
+ {
+ float offset = 0f;
+ Quaternion rotation = Quaternion.LookRotation(position - camera.transform.position);
+ Draw(color, dashed, position, pointsCount, radius, offset, rotation);
+ }
+
+ ///
+ /// Draws a circle in world space with a specified rotation.
+ ///
+ public static void Circle(Vector3 position, float radius, Quaternion rotation, Color? color = null, bool dashed = false, int pointsCount = 16)
+ {
+ float offset = 0f;
+ Draw(color, dashed, position, pointsCount, radius, offset, rotation);
+ }
+ }
+}
diff --git a/CVRGizmos/Gizmo/GizmosInstance.cs b/CVRGizmos/Gizmo/GizmosInstance.cs
new file mode 100644
index 0000000..e2db39c
--- /dev/null
+++ b/CVRGizmos/Gizmo/GizmosInstance.cs
@@ -0,0 +1,445 @@
+using System;
+using System.Collections.Generic;
+using UnityEngine;
+using UnityEngine.Rendering;
+
+#if UNITY_EDITOR
+using UnityEditor;
+using UnityEditor.SceneManagement;
+#endif
+
+#if !UNITY_2019_1_OR_NEWER
+
+public struct ScriptableRenderContext { }
+
+public static class RenderPipelineManager
+{
+ public static event Action endCameraRendering;
+}
+
+#endif
+
+namespace Popcron
+{
+ [ExecuteInEditMode]
+ [AddComponentMenu("")]
+ public class GizmosInstance : MonoBehaviour
+ {
+ private const int DefaultQueueSize = 4096;
+
+ private static GizmosInstance instance;
+ private static bool hotReloaded = true;
+ private static Material defaultMaterial;
+ private static Plane[] cameraPlanes = new Plane[6];
+
+ private Color color = Color.white;
+ private Matrix4x4 matrix;
+ private Material overrideMaterial;
+ private int queueIndex = 0;
+ private int lastFrame;
+ private Element[] queue = new Element[DefaultQueueSize];
+
+ ///
+ /// The material being used to render
+ ///
+ public static Material Material
+ {
+ get
+ {
+ GizmosInstance inst = GetOrCreate();
+ if (inst.overrideMaterial)
+ {
+ return inst.overrideMaterial;
+ }
+
+ return DefaultMaterial;
+ }
+ set
+ {
+ GizmosInstance inst = GetOrCreate();
+ inst.overrideMaterial = value;
+ }
+ }
+
+ ///
+ /// The matrix to use
+ ///
+ public static Matrix4x4 Matrix
+ {
+ get
+ {
+ GizmosInstance inst = GetOrCreate();
+ if (!inst.matrix.isIdentity)
+ {
+ return inst.matrix;
+ }
+
+ return Matrix4x4.identity;
+ }
+ set
+ {
+ GizmosInstance inst = GetOrCreate();
+ inst.matrix = value;
+ }
+ }
+
+ ///
+ /// The matrix to use
+ ///
+ public static Color Color
+ {
+ get
+ {
+ GizmosInstance inst = GetOrCreate();
+ return inst.color;
+ }
+ set
+ {
+ GizmosInstance inst = GetOrCreate();
+ inst.color = value;
+ }
+ }
+
+ ///
+ /// The default line renderer material
+ ///
+ public static Material DefaultMaterial
+ {
+ get
+ {
+ if (!defaultMaterial)
+ {
+ // Unity has a built-in shader that is useful for drawing
+ // simple colored things.
+ Shader shader = Shader.Find("Hidden/Internal-Colored");
+ defaultMaterial = new Material(shader)
+ {
+ hideFlags = HideFlags.HideAndDontSave
+ };
+
+ // Turn on alpha blending
+ defaultMaterial.SetInt("_SrcBlend", (int)BlendMode.SrcAlpha);
+ defaultMaterial.SetInt("_DstBlend", (int)BlendMode.OneMinusSrcAlpha);
+ defaultMaterial.SetInt("_Cull", (int)CullMode.Off);
+ defaultMaterial.SetInt("_ZWrite", 0);
+ }
+
+ return defaultMaterial;
+ }
+ }
+
+ internal static GizmosInstance GetOrCreate()
+ {
+ if (hotReloaded || !instance)
+ {
+ bool markDirty = false;
+ GizmosInstance[] gizmosInstances = FindObjectsOfType();
+ for (int i = 0; i < gizmosInstances.Length; i++)
+ {
+ instance = gizmosInstances[i];
+
+ //destroy any extra gizmo instances
+ if (i > 0)
+ {
+ if (Application.isPlaying)
+ {
+ Destroy(gizmosInstances[i]);
+ }
+ else
+ {
+ DestroyImmediate(gizmosInstances[i]);
+ markDirty = true;
+ }
+ }
+ }
+
+ //none were found, create a new one
+ if (!instance)
+ {
+ instance = new GameObject(typeof(GizmosInstance).FullName).AddComponent();
+ instance.gameObject.hideFlags = HideFlags.HideInHierarchy | HideFlags.HideInInspector;
+
+ markDirty = true;
+ }
+
+#if UNITY_EDITOR
+ //mark scene as dirty
+ if (markDirty && !Application.isPlaying)
+ {
+ Scene scene = SceneManager.GetActiveScene();
+ EditorSceneManager.MarkSceneDirty(scene);
+ }
+#endif
+
+ hotReloaded = false;
+ }
+
+ return instance;
+ }
+
+ private float CurrentTime
+ {
+ get
+ {
+ float time = 0f;
+ if (Application.isPlaying)
+ {
+ time = Time.time;
+ }
+ else
+ {
+#if UNITY_EDITOR
+ time = (float)EditorApplication.timeSinceStartup;
+#endif
+ }
+
+ return time;
+ }
+ }
+
+ ///
+ /// Submits an array of points to draw into the queue.
+ ///
+ internal static void Submit(Vector3[] points, Color? color2, bool dashed)
+ {
+ GizmosInstance inst = GetOrCreate();
+
+ //if new frame, reset index
+ if (inst.lastFrame != Time.frameCount)
+ {
+ inst.lastFrame = Time.frameCount;
+ inst.queueIndex = 0;
+ }
+
+ //multiply points by matrix
+ for (int i = 0; i < points.Length; i++)
+ {
+ points[i] = inst.matrix.MultiplyPoint3x4(points[i]);
+ }
+
+ //excedeed the length, so make it even bigger
+ if (inst.queueIndex >= inst.queue.Length)
+ {
+ Element[] bigger = new Element[inst.queue.Length + DefaultQueueSize];
+ for (int i = inst.queue.Length; i < bigger.Length; i++)
+ {
+ bigger[i] = new Element();
+ }
+
+ Array.Copy(inst.queue, 0, bigger, 0, inst.queue.Length);
+ inst.queue = bigger;
+ }
+
+ inst.queue[inst.queueIndex].color = inst.color;
+ inst.queue[inst.queueIndex].points = points;
+ inst.queue[inst.queueIndex].dashed = dashed;
+ inst.queue[inst.queueIndex].matrix = inst.matrix;
+
+ inst.queueIndex++;
+ }
+
+ private void OnEnable()
+ {
+ //populate queue with empty elements
+ queue = new Element[DefaultQueueSize];
+ for (int i = 0; i < DefaultQueueSize; i++)
+ {
+ queue[i] = new Element();
+ }
+
+ if (GraphicsSettings.renderPipelineAsset == null)
+ {
+ Camera.onPostRender += OnRendered;
+ }
+ else
+ {
+ RenderPipelineManager.endCameraRendering += OnRendered;
+ }
+ }
+
+ private void OnDisable()
+ {
+ if (GraphicsSettings.renderPipelineAsset == null)
+ {
+ Camera.onPostRender -= OnRendered;
+ }
+ else
+ {
+ RenderPipelineManager.endCameraRendering -= OnRendered;
+ }
+ }
+
+ private void OnRendered(ScriptableRenderContext context, Camera camera) => OnRendered(camera);
+
+ private bool ShouldRenderCamera(Camera camera)
+ {
+ if (!camera)
+ {
+ return false;
+ }
+
+ //allow the scene and main camera always
+ bool isSceneCamera = false;
+#if UNITY_EDITOR
+ SceneView sceneView = SceneView.currentDrawingSceneView;
+ if (sceneView == null)
+ {
+ sceneView = SceneView.lastActiveSceneView;
+ }
+
+ if (sceneView != null && sceneView.camera == camera)
+ {
+ isSceneCamera = true;
+ }
+#endif
+ if (isSceneCamera || camera.CompareTag("MainCamera"))
+ {
+ return true;
+ }
+
+ if (camera.name.StartsWith("Mirror "))
+ {
+ return true;
+ }
+
+ //it passed through the filter
+ if (Gizmos.CameraFilter?.Invoke(camera) == true)
+ {
+ return true;
+ }
+
+ return false;
+ }
+
+ private bool IsVisibleByCamera(Element points, Camera camera)
+ {
+ if (!camera)
+ {
+ return false;
+ }
+
+ //essentially check if at least 1 point is visible by the camera
+ for (int i = 0; i < points.points.Length; i++)
+ {
+ Vector3 vp = camera.WorldToViewportPoint(points.points[i], camera.stereoActiveEye);
+ if (vp.x >= 0 && vp.x <= 1 && vp.y >= 0 && vp.y <= 1)
+ {
+ return true;
+ }
+ }
+
+ return false;
+ }
+
+ private void Update()
+ {
+ //always render something
+ Gizmos.Line(default, default);
+ }
+
+ private void OnRendered(Camera camera)
+ {
+ Material.SetPass(Gizmos.Pass);
+
+ //shouldnt be rendering
+ if (!Gizmos.Enabled)
+ {
+ queueIndex = 0;
+ }
+
+ //check if this camera is ok to render with
+ if (!ShouldRenderCamera(camera))
+ {
+ GL.PushMatrix();
+ GL.Begin(GL.LINES);
+
+ //bla bla bla
+
+ GL.End();
+ GL.PopMatrix();
+ return;
+ }
+
+ Vector3 offset = Gizmos.Offset;
+
+ GL.PushMatrix();
+ GL.MultMatrix(Matrix4x4.identity);
+ GL.Begin(GL.LINES);
+
+ bool alt = CurrentTime % 1 > 0.5f;
+ float dashGap = Mathf.Clamp(Gizmos.DashGap, 0.01f, 32f);
+ bool frustumCull = Gizmos.FrustumCulling;
+ List points = new List();
+
+ //draw le elements
+ for (int e = 0; e < queueIndex; e++)
+ {
+ //just in case
+ if (queue.Length <= e)
+ {
+ break;
+ }
+
+ Element element = queue[e];
+
+ //dont render this thingy if its not inside the frustum
+ if (frustumCull)
+ {
+ if (!IsVisibleByCamera(element, camera))
+ {
+ continue;
+ }
+ }
+
+ points.Clear();
+ if (element.dashed)
+ {
+ //subdivide
+ for (int i = 0; i < element.points.Length - 1; i++)
+ {
+ Vector3 pointA = element.points[i];
+ Vector3 pointB = element.points[i + 1];
+ Vector3 direction = pointB - pointA;
+ if (direction.sqrMagnitude > dashGap * dashGap * 2f)
+ {
+ float magnitude = direction.magnitude;
+ int amount = Mathf.RoundToInt(magnitude / dashGap);
+ direction /= magnitude;
+
+ for (int p = 0; p < amount - 1; p++)
+ {
+ if (p % 2 == (alt ? 1 : 0))
+ {
+ float startLerp = p / (amount - 1f);
+ float endLerp = (p + 1) / (amount - 1f);
+ Vector3 start = Vector3.Lerp(pointA, pointB, startLerp);
+ Vector3 end = Vector3.Lerp(pointA, pointB, endLerp);
+ points.Add(start);
+ points.Add(end);
+ }
+ }
+ }
+ else
+ {
+ points.Add(pointA);
+ points.Add(pointB);
+ }
+ }
+ }
+ else
+ {
+ points.AddRange(element.points);
+ }
+
+ GL.Color(element.color);
+ for (int i = 0; i < points.Count; i++)
+ {
+ GL.Vertex(points[i] + offset);
+ }
+ }
+
+ GL.End();
+ GL.PopMatrix();
+ }
+ }
+}
diff --git a/CVRGizmos/GizmoTypes/CVRAdvancedAvatarSettingsPointer.cs b/CVRGizmos/GizmoTypes/CVRAdvancedAvatarSettingsPointer.cs
new file mode 100644
index 0000000..0f7d326
--- /dev/null
+++ b/CVRGizmos/GizmoTypes/CVRAdvancedAvatarSettingsPointer.cs
@@ -0,0 +1,49 @@
+using ABI.CCK.Components;
+using UnityEngine;
+using Gizmos = Popcron.Gizmos;
+
+/**
+
+CVRAdvancedAvatarSettingsPointer shouldn't really be used at this point. Only including because it still exists in the CCK/Game.
+
+**/
+
+namespace CVRGizmos.GismoTypes
+{
+ public class CVRGizmos_AdvancedAvatarSettingsPointer : CVRGizmoBase
+ {
+ public static CVRAdvancedAvatarSettingsPointer[] references;
+
+ public override void CacheGizmos()
+ {
+ var found = Resources.FindObjectsOfTypeAll(typeof(CVRAdvancedAvatarSettingsPointer)) as CVRAdvancedAvatarSettingsPointer[];
+
+ if (CVRGizmoManager.Instance.g_localOnly)
+ {
+ references = Array.ConvertAll(GetLocalOnly(found), item => (CVRAdvancedAvatarSettingsPointer)item);
+ }
+ else
+ {
+ references = found;
+ }
+ }
+
+ public override void DrawGizmos()
+ {
+ for (int i = 0; i < references.Count(); i++)
+ {
+ if (references[i] == null)
+ {
+ CacheGizmos();
+ break;
+ }
+ if (references[i].isActiveAndEnabled)
+ {
+ Gizmos.Color = Color.cyan;
+ Gizmos.Matrix = Matrix4x4.TRS(references[i].transform.position, references[i].transform.rotation, references[i].transform.lossyScale);
+ Gizmos.Sphere(Vector3.zero, 0.015f);
+ }
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/CVRGizmos/GizmoTypes/CVRAdvancedAvatarSettingsTrigger.cs b/CVRGizmos/GizmoTypes/CVRAdvancedAvatarSettingsTrigger.cs
new file mode 100644
index 0000000..b2758b5
--- /dev/null
+++ b/CVRGizmos/GizmoTypes/CVRAdvancedAvatarSettingsTrigger.cs
@@ -0,0 +1,113 @@
+using ABI.CCK.Components;
+using ABI_RC.Core.Player;
+using UnityEngine;
+using Gizmos = Popcron.Gizmos;
+
+namespace CVRGizmos.GismoTypes
+{
+ public class CVRGizmos_AdvancedAvatarSettingsTrigger : CVRGizmoBase
+ {
+ public static CVRAdvancedAvatarSettingsTrigger[] references;
+
+ public override void CacheGizmos()
+ {
+ var found = Resources.FindObjectsOfTypeAll(typeof(CVRAdvancedAvatarSettingsTrigger)) as CVRAdvancedAvatarSettingsTrigger[];
+
+ if (CVRGizmoManager.Instance.g_localOnly)
+ {
+ references = Array.ConvertAll(GetLocalOnly(found), item => (CVRAdvancedAvatarSettingsTrigger)item);
+ }
+ else
+ {
+ references = found;
+ }
+ }
+
+ public override void DrawGizmos()
+ {
+ for (int i = 0; i < references.Count(); i++)
+ {
+ if (references[i] == null)
+ {
+ CacheGizmos();
+ break;
+ }
+ if (references[i].isActiveAndEnabled)
+ {
+ Gizmos.Color = Color.cyan;
+ Gizmos.Matrix = Matrix4x4.TRS(references[i].transform.position, references[i].transform.rotation, references[i].transform.lossyScale);
+ Gizmos.Cube(references[i].areaOffset, Quaternion.identity, references[i].areaSize);
+ if (references[i].stayTasks.Count > 0)
+ {
+ for (int ii = 0; ii < references[i].stayTasks.Count(); ii++)
+ {
+ var stayTask = references[i].stayTasks[ii];
+ float num = PlayerSetup.Instance.GetAnimatorParam(stayTask.settingName);
+ switch (stayTask.updateMethod)
+ {
+ case CVRAdvancedAvatarSettingsTriggerTaskStay.UpdateMethod.SetFromPosition:
+ {
+ num = Mathf.InverseLerp(stayTask.minValue, stayTask.maxValue, num);
+ Gizmos.Color = new Color(2.0f * num, 2.0f * (1 - num), 0);
+ break;
+ }
+ case CVRAdvancedAvatarSettingsTriggerTaskStay.UpdateMethod.Add:
+ num = num + stayTask.minValue / 60f;
+ Gizmos.Color = new Color(2.0f * num, 2.0f * (1 - num), 0);
+ break;
+ case CVRAdvancedAvatarSettingsTriggerTaskStay.UpdateMethod.Subtract:
+ num = num - stayTask.minValue / 60f;
+ Gizmos.Color = new Color(2.0f * num, 2.0f * (1 - num), 0);
+ break;
+ default:
+ return;
+ }
+ }
+ Vector3 vector = new Vector3(references[i].areaSize.x * 0.5f, references[i].areaSize.y * 0.5f, references[i].areaSize.z * 0.5f);
+ switch (references[i].sampleDirection)
+ {
+ case CVRAdvancedAvatarSettingsTrigger.SampleDirection.XPositive:
+ Gizmos.Line(new Vector3(-vector.x, vector.y, vector.z) + references[i].areaOffset, new Vector3(vector.x, 0f, vector.z) + references[i].areaOffset);
+ Gizmos.Line(new Vector3(-vector.x, -vector.y, vector.z) + references[i].areaOffset, new Vector3(vector.x, 0f, vector.z) + references[i].areaOffset);
+ Gizmos.Line(new Vector3(-vector.x, vector.y, vector.z) + references[i].areaOffset, new Vector3(vector.x, vector.y, 0f) + references[i].areaOffset);
+ Gizmos.Line(new Vector3(-vector.x, vector.y, -vector.z) + references[i].areaOffset, new Vector3(vector.x, vector.y, 0f) + references[i].areaOffset);
+ break;
+ case CVRAdvancedAvatarSettingsTrigger.SampleDirection.XNegative:
+ Gizmos.Line(new Vector3(vector.x, vector.y, vector.z) + references[i].areaOffset, new Vector3(-vector.x, 0f, vector.z) + references[i].areaOffset);
+ Gizmos.Line(new Vector3(vector.x, -vector.y, vector.z) + references[i].areaOffset, new Vector3(-vector.x, 0f, vector.z) + references[i].areaOffset);
+ Gizmos.Line(new Vector3(vector.x, vector.y, vector.z) + references[i].areaOffset, new Vector3(-vector.x, vector.y, 0f) + references[i].areaOffset);
+ Gizmos.Line(new Vector3(vector.x, vector.y, -vector.z) + references[i].areaOffset, new Vector3(-vector.x, vector.y, 0f) + references[i].areaOffset);
+ break;
+ case CVRAdvancedAvatarSettingsTrigger.SampleDirection.YPositive:
+ Gizmos.Line(new Vector3(-vector.x, -vector.y, vector.z) + references[i].areaOffset, new Vector3(0f, vector.y, vector.z) + references[i].areaOffset);
+ Gizmos.Line(new Vector3(vector.x, -vector.y, vector.z) + references[i].areaOffset, new Vector3(0f, vector.y, vector.z) + references[i].areaOffset);
+ Gizmos.Line(new Vector3(-vector.x, -vector.y, -vector.z) + references[i].areaOffset, new Vector3(-vector.x, vector.y, 0f) + references[i].areaOffset);
+ Gizmos.Line(new Vector3(-vector.x, -vector.y, vector.z) + references[i].areaOffset, new Vector3(-vector.x, vector.y, 0f) + references[i].areaOffset);
+ break;
+ case CVRAdvancedAvatarSettingsTrigger.SampleDirection.YNegative:
+ Gizmos.Line(new Vector3(-vector.x, vector.y, vector.z) + references[i].areaOffset, new Vector3(0f, -vector.y, vector.z) + references[i].areaOffset);
+ Gizmos.Line(new Vector3(vector.x, vector.y, vector.z) + references[i].areaOffset, new Vector3(0f, -vector.y, vector.z) + references[i].areaOffset);
+ Gizmos.Line(new Vector3(-vector.x, vector.y, -vector.z) + references[i].areaOffset, new Vector3(-vector.x, -vector.y, 0f) + references[i].areaOffset);
+ Gizmos.Line(new Vector3(-vector.x, vector.y, vector.z) + references[i].areaOffset, new Vector3(-vector.x, -vector.y, 0f) + references[i].areaOffset);
+ break;
+ case CVRAdvancedAvatarSettingsTrigger.SampleDirection.ZPositive:
+ Gizmos.Line(new Vector3(-vector.x, vector.y, -vector.z) + references[i].areaOffset, new Vector3(0f, vector.y, vector.z) + references[i].areaOffset);
+ Gizmos.Line(new Vector3(vector.x, vector.y, -vector.z) + references[i].areaOffset, new Vector3(0f, vector.y, vector.z) + references[i].areaOffset);
+ Gizmos.Line(new Vector3(-vector.x, vector.y, -vector.z) + references[i].areaOffset, new Vector3(-vector.x, 0f, vector.z) + references[i].areaOffset);
+ Gizmos.Line(new Vector3(-vector.x, -vector.y, -vector.z) + references[i].areaOffset, new Vector3(-vector.x, 0f, vector.z) + references[i].areaOffset);
+ break;
+ case CVRAdvancedAvatarSettingsTrigger.SampleDirection.ZNegative:
+ Gizmos.Line(new Vector3(-vector.x, vector.y, vector.z) + references[i].areaOffset, new Vector3(0f, vector.y, -vector.z) + references[i].areaOffset);
+ Gizmos.Line(new Vector3(vector.x, vector.y, vector.z) + references[i].areaOffset, new Vector3(0f, vector.y, -vector.z) + references[i].areaOffset);
+ Gizmos.Line(new Vector3(-vector.x, vector.y, vector.z) + references[i].areaOffset, new Vector3(-vector.x, 0f, -vector.z) + references[i].areaOffset);
+ Gizmos.Line(new Vector3(-vector.x, -vector.y, vector.z) + references[i].areaOffset, new Vector3(-vector.x, 0f, -vector.z) + references[i].areaOffset);
+ break;
+ default:
+ break;
+ }
+ }
+ }
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/CVRGizmos/GizmoTypes/CVRDistanceLod.cs b/CVRGizmos/GizmoTypes/CVRDistanceLod.cs
new file mode 100644
index 0000000..2580394
--- /dev/null
+++ b/CVRGizmos/GizmoTypes/CVRDistanceLod.cs
@@ -0,0 +1,62 @@
+using ABI.CCK.Components;
+using UnityEngine;
+using Gizmos = Popcron.Gizmos;
+
+namespace CVRGizmos.GismoTypes
+{
+ public class CVRGizmos_DistanceLod : CVRGizmoBase
+ {
+ public static CVRDistanceLod[] references;
+
+ private static Color[] _gizmoColors = new Color[]
+ {
+ Color.green,
+ Color.yellow,
+ Color.red,
+ Color.white
+ };
+
+ public override void CacheGizmos()
+ {
+ var found = Resources.FindObjectsOfTypeAll(typeof(CVRDistanceLod)) as CVRDistanceLod[];
+
+ if (CVRGizmoManager.Instance.g_localOnly)
+ {
+ references = Array.ConvertAll(GetLocalOnly(found), item => (CVRDistanceLod)item);
+ }
+ else
+ {
+ references = found;
+ }
+ }
+
+ public override void DrawGizmos()
+ {
+ for (int i = 0; i < references.Count(); i++)
+ {
+ if (references[i] == null)
+ {
+ CacheGizmos();
+ break;
+ }
+ if (!references[i].distance3D)
+ {
+ Gizmos.Matrix = Matrix4x4.TRS(references[i].transform.position, Quaternion.identity, new Vector3(1f, 0f, 1f));
+ }
+ else
+ {
+ Gizmos.Matrix = Matrix4x4.TRS(references[i].transform.position, Quaternion.identity, Vector3.one);
+ }
+ float num = 0;
+ foreach (CVRDistanceLodGroup cvrdistanceLodGroup in references[i].Groups)
+ {
+ //Gizmos.Color = _gizmoColors[Math.Min(num, 3)];
+ num = Mathf.InverseLerp(0, references[i].Groups.Count, num);
+ Gizmos.Color = new Color(2.0f * num, 2.0f * (1 - num), 0);
+ Gizmos.Sphere(Vector3.zero, cvrdistanceLodGroup.MaxDistance);
+ num++;
+ }
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/CVRGizmos/GizmoTypes/CVRGizmoBase.cs b/CVRGizmos/GizmoTypes/CVRGizmoBase.cs
new file mode 100644
index 0000000..20b1f6f
--- /dev/null
+++ b/CVRGizmos/GizmoTypes/CVRGizmoBase.cs
@@ -0,0 +1,37 @@
+using UnityEngine;
+
+namespace CVRGizmos.GismoTypes
+{
+ public class CVRGizmoBase : MonoBehaviour
+ {
+ public MonoBehaviour[] GetLocalOnly(MonoBehaviour[] input)
+ {
+ return input.Where(c => c.gameObject.scene.name == "DontDestroyOnLoad").ToArray();
+ }
+
+ public virtual void OnEnable()
+ {
+ CacheGizmos();
+ // register the callback when enabling object
+ Camera.onPreRender += RenderGizmos;
+ }
+ public virtual void OnDisable()
+ {
+ // remove the callback when disabling object
+ Camera.onPreRender -= RenderGizmos;
+ }
+
+ public virtual void RenderGizmos(Camera cam)
+ {
+ DrawGizmos();
+ }
+
+ public virtual void CacheGizmos()
+ {
+ }
+
+ public virtual void DrawGizmos()
+ {
+ }
+ }
+}
\ No newline at end of file
diff --git a/CVRGizmos/GizmoTypes/CVRHapticAreaChest.cs b/CVRGizmos/GizmoTypes/CVRHapticAreaChest.cs
new file mode 100644
index 0000000..0efeb77
--- /dev/null
+++ b/CVRGizmos/GizmoTypes/CVRHapticAreaChest.cs
@@ -0,0 +1,53 @@
+using ABI.CCK.Components;
+using HarmonyLib;
+using UnityEngine;
+using Gizmos = Popcron.Gizmos;
+
+namespace CVRGizmos.GismoTypes
+{
+ public class CVRGizmos_HapticAreaChest : CVRGizmoBase
+ {
+ public static CVRHapticAreaChest[] references;
+
+ public override void CacheGizmos()
+ {
+ var found = Resources.FindObjectsOfTypeAll(typeof(CVRHapticAreaChest)) as CVRHapticAreaChest[];
+
+ if (CVRGizmoManager.Instance.g_localOnly)
+ {
+ references = Array.ConvertAll(GetLocalOnly(found), item => (CVRHapticAreaChest)item);
+ }
+ else
+ {
+ references = found;
+ }
+ }
+
+ public override void DrawGizmos()
+ {
+ for (int i = 0; i < references.Count(); i++)
+ {
+ if (references[i] == null)
+ {
+ CacheGizmos();
+ break;
+ }
+ if (references[i].isActiveAndEnabled)
+ {
+ Gizmos.Color = Color.yellow;
+ Gizmos.Matrix = Matrix4x4.TRS(references[i].transform.position, references[i].transform.rotation, references[i].transform.lossyScale);
+ Gizmos.Cube(Vector3.zero, Quaternion.identity, references[i].chestAreaSize);
+ int num = 0;
+ foreach (Vector3 center in references[i].HapticPoints40)
+ {
+ float[] pointValues = Traverse.Create(references[i]).Field("pointValues").GetValue() as float[];
+ center.Scale(references[i].chestAreaSize * 0.5f);
+ Gizmos.Color = new Color(1f - pointValues[num], pointValues[num], 0f);
+ Gizmos.Cube(center, Quaternion.identity, new Vector3(0.01f, 0.01f, 0.01f));
+ num++;
+ }
+ }
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/CVRGizmos/GizmoTypes/CVRHapticZone.cs b/CVRGizmos/GizmoTypes/CVRHapticZone.cs
new file mode 100644
index 0000000..f466a91
--- /dev/null
+++ b/CVRGizmos/GizmoTypes/CVRHapticZone.cs
@@ -0,0 +1,45 @@
+using ABI.CCK.Components;
+using UnityEngine;
+using Gizmos = Popcron.Gizmos;
+
+namespace CVRGizmos.GismoTypes
+{
+ public class CVRGizmos_HapticZone : CVRGizmoBase
+ {
+ public static CVRHapticZone[] references;
+
+ public override void CacheGizmos()
+ {
+ var found = Resources.FindObjectsOfTypeAll(typeof(CVRHapticZone)) as CVRHapticZone[];
+
+ if (CVRGizmoManager.Instance.g_localOnly)
+ {
+ references = Array.ConvertAll(GetLocalOnly(found), item => (CVRHapticZone)item);
+ }
+ else
+ {
+ references = found;
+ }
+ }
+
+ public override void DrawGizmos()
+ {
+ for (int i = 0; i < references.Count(); i++)
+ {
+ if (references[i] == null)
+ {
+ CacheGizmos();
+ break;
+ }
+ Gizmos.Color = Color.yellow;
+ Gizmos.Matrix = Matrix4x4.TRS(references[i].transform.position, references[i].transform.rotation, references[i].transform.lossyScale);
+ if (references[i].triggerForm == CVRHapticZone.TriggerForm.Box)
+ {
+ Gizmos.Cube(references[i].center, Quaternion.identity, references[i].bounds);
+ return;
+ }
+ Gizmos.Sphere(references[i].center, references[i].bounds.x);
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/CVRGizmos/GizmoTypes/CVRPointer.cs b/CVRGizmos/GizmoTypes/CVRPointer.cs
new file mode 100644
index 0000000..93c010a
--- /dev/null
+++ b/CVRGizmos/GizmoTypes/CVRPointer.cs
@@ -0,0 +1,44 @@
+using ABI.CCK.Components;
+using UnityEngine;
+using Gizmos = Popcron.Gizmos;
+
+namespace CVRGizmos.GismoTypes
+{
+ public class CVRGizmos_Pointer : CVRGizmoBase
+ {
+ public static CVRPointer[] references;
+
+ public override void CacheGizmos()
+ {
+ var found = Resources.FindObjectsOfTypeAll(typeof(CVRPointer)) as CVRPointer[];
+
+ if (CVRGizmoManager.Instance.g_localOnly)
+ {
+ references = Array.ConvertAll(GetLocalOnly(found), item => (CVRPointer)item);
+ }
+ else
+ {
+ references = found;
+ }
+ }
+
+ public override void DrawGizmos()
+ {
+ for (int i = 0; i < references.Count(); i++)
+ {
+ if (references[i] == null)
+ {
+ CacheGizmos();
+ break;
+ }
+ if (references[i].isActiveAndEnabled)
+ {
+ Gizmos.Color = Color.blue;
+ Vector3 lossyScale = references[i].transform.lossyScale;
+ Gizmos.Matrix = Matrix4x4.TRS(references[i].transform.position, references[i].transform.rotation, lossyScale);
+ Gizmos.Sphere(Vector3.zero, 0.00125f / Mathf.Max(Mathf.Max(lossyScale.x, lossyScale.y), lossyScale.z));
+ }
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/CVRGizmos/GizmoTypes/CVRSpawnableTrigger.cs b/CVRGizmos/GizmoTypes/CVRSpawnableTrigger.cs
new file mode 100644
index 0000000..236d9e0
--- /dev/null
+++ b/CVRGizmos/GizmoTypes/CVRSpawnableTrigger.cs
@@ -0,0 +1,127 @@
+using ABI.CCK.Components;
+using UnityEngine;
+using Gizmos = Popcron.Gizmos;
+
+/**
+
+CVRSpawnableTrigger **can** be local using CVROfflinePreview or similar mods.
+
+**/
+
+namespace CVRGizmos.GismoTypes
+{
+ public class CVRGizmos_SpawnableTrigger : CVRGizmoBase
+ {
+ public static CVRSpawnableTrigger[] references;
+
+ public override void CacheGizmos()
+ {
+ var found = Resources.FindObjectsOfTypeAll(typeof(CVRSpawnableTrigger)) as CVRSpawnableTrigger[];
+
+ if (CVRGizmoManager.Instance.g_localOnly)
+ {
+ references = Array.ConvertAll(GetLocalOnly(found), item => (CVRSpawnableTrigger)item);
+ }
+ else
+ {
+ references = found;
+ }
+ }
+
+ public override void DrawGizmos()
+ {
+ for (int i = 0; i < references.Count(); i++)
+ {
+ if (references[i] == null)
+ {
+ CacheGizmos();
+ break;
+ }
+ if (references[i].isActiveAndEnabled)
+ {
+
+ Gizmos.Color = Color.blue;
+ Gizmos.Matrix = Matrix4x4.TRS(references[i].transform.position, references[i].transform.rotation, references[i].transform.lossyScale);
+
+ Gizmos.Cube(references[i].areaOffset, Quaternion.identity, references[i].areaSize);
+
+ //stayTask colors
+ if (references[i].stayTasks.Count > 0)
+ {
+ for (int ii = 0; ii < references[i].stayTasks.Count(); ii++)
+ {
+ var stayTask = references[i].stayTasks[ii];
+ if (stayTask.spawnable != null)
+ {
+ float num = stayTask.spawnable.GetValue(stayTask.settingIndex);
+ switch (stayTask.updateMethod)
+ {
+ case CVRSpawnableTriggerTaskStay.UpdateMethod.SetFromPosition:
+ {
+ num = Mathf.InverseLerp(stayTask.minValue, stayTask.maxValue, num);
+ Gizmos.Color = new Color(2.0f * num, 2.0f * (1 - num), 0);
+ break;
+ }
+ case CVRSpawnableTriggerTaskStay.UpdateMethod.Add:
+ num = num + stayTask.minValue / 60f;
+ Gizmos.Color = new Color(2.0f * num, 2.0f * (1 - num), 0);
+ break;
+ case CVRSpawnableTriggerTaskStay.UpdateMethod.Subtract:
+ num = num - stayTask.minValue / 60f;
+ Gizmos.Color = new Color(2.0f * num, 2.0f * (1 - num), 0);
+ break;
+ default:
+ return;
+ }
+ }
+ }
+
+ Vector3 vector = new Vector3(references[i].areaSize.x * 0.5f, references[i].areaSize.y * 0.5f, references[i].areaSize.z * 0.5f);
+ switch (references[i].sampleDirection)
+ {
+ case CVRSpawnableTrigger.SampleDirection.XPositive:
+ Gizmos.Line(new Vector3(-vector.x, vector.y, vector.z) + references[i].areaOffset, new Vector3(vector.x, 0f, vector.z) + references[i].areaOffset);
+ Gizmos.Line(new Vector3(-vector.x, -vector.y, vector.z) + references[i].areaOffset, new Vector3(vector.x, 0f, vector.z) + references[i].areaOffset);
+ Gizmos.Line(new Vector3(-vector.x, vector.y, vector.z) + references[i].areaOffset, new Vector3(vector.x, vector.y, 0f) + references[i].areaOffset);
+ Gizmos.Line(new Vector3(-vector.x, vector.y, -vector.z) + references[i].areaOffset, new Vector3(vector.x, vector.y, 0f) + references[i].areaOffset);
+ break;
+ case CVRSpawnableTrigger.SampleDirection.XNegative:
+ Gizmos.Line(new Vector3(vector.x, vector.y, vector.z) + references[i].areaOffset, new Vector3(-vector.x, 0f, vector.z) + references[i].areaOffset);
+ Gizmos.Line(new Vector3(vector.x, -vector.y, vector.z) + references[i].areaOffset, new Vector3(-vector.x, 0f, vector.z) + references[i].areaOffset);
+ Gizmos.Line(new Vector3(vector.x, vector.y, vector.z) + references[i].areaOffset, new Vector3(-vector.x, vector.y, 0f) + references[i].areaOffset);
+ Gizmos.Line(new Vector3(vector.x, vector.y, -vector.z) + references[i].areaOffset, new Vector3(-vector.x, vector.y, 0f) + references[i].areaOffset);
+ break;
+ case CVRSpawnableTrigger.SampleDirection.YPositive:
+ Gizmos.Line(new Vector3(-vector.x, -vector.y, vector.z) + references[i].areaOffset, new Vector3(0f, vector.y, vector.z) + references[i].areaOffset);
+ Gizmos.Line(new Vector3(vector.x, -vector.y, vector.z) + references[i].areaOffset, new Vector3(0f, vector.y, vector.z) + references[i].areaOffset);
+ Gizmos.Line(new Vector3(-vector.x, -vector.y, -vector.z) + references[i].areaOffset, new Vector3(-vector.x, vector.y, 0f) + references[i].areaOffset);
+ Gizmos.Line(new Vector3(-vector.x, -vector.y, vector.z) + references[i].areaOffset, new Vector3(-vector.x, vector.y, 0f) + references[i].areaOffset);
+ break;
+ case CVRSpawnableTrigger.SampleDirection.YNegative:
+ Gizmos.Line(new Vector3(-vector.x, vector.y, vector.z) + references[i].areaOffset, new Vector3(0f, -vector.y, vector.z) + references[i].areaOffset);
+ Gizmos.Line(new Vector3(vector.x, vector.y, vector.z) + references[i].areaOffset, new Vector3(0f, -vector.y, vector.z) + references[i].areaOffset);
+ Gizmos.Line(new Vector3(-vector.x, vector.y, -vector.z) + references[i].areaOffset, new Vector3(-vector.x, -vector.y, 0f) + references[i].areaOffset);
+ Gizmos.Line(new Vector3(-vector.x, vector.y, vector.z) + references[i].areaOffset, new Vector3(-vector.x, -vector.y, 0f) + references[i].areaOffset);
+ break;
+ case CVRSpawnableTrigger.SampleDirection.ZPositive:
+ Gizmos.Line(new Vector3(-vector.x, vector.y, -vector.z) + references[i].areaOffset, new Vector3(0f, vector.y, vector.z) + references[i].areaOffset);
+ Gizmos.Line(new Vector3(vector.x, vector.y, -vector.z) + references[i].areaOffset, new Vector3(0f, vector.y, vector.z) + references[i].areaOffset);
+ Gizmos.Line(new Vector3(-vector.x, vector.y, -vector.z) + references[i].areaOffset, new Vector3(-vector.x, 0f, vector.z) + references[i].areaOffset);
+ Gizmos.Line(new Vector3(-vector.x, -vector.y, -vector.z) + references[i].areaOffset, new Vector3(-vector.x, 0f, vector.z) + references[i].areaOffset);
+ break;
+ case CVRSpawnableTrigger.SampleDirection.ZNegative:
+ Gizmos.Line(new Vector3(-vector.x, vector.y, vector.z) + references[i].areaOffset, new Vector3(0f, vector.y, -vector.z) + references[i].areaOffset);
+ Gizmos.Line(new Vector3(vector.x, vector.y, vector.z) + references[i].areaOffset, new Vector3(0f, vector.y, -vector.z) + references[i].areaOffset);
+ Gizmos.Line(new Vector3(-vector.x, vector.y, vector.z) + references[i].areaOffset, new Vector3(-vector.x, 0f, -vector.z) + references[i].areaOffset);
+ Gizmos.Line(new Vector3(-vector.x, -vector.y, vector.z) + references[i].areaOffset, new Vector3(-vector.x, 0f, -vector.z) + references[i].areaOffset);
+ break;
+ default:
+ break;
+
+ }
+ }
+ }
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/CVRGizmos/Main.cs b/CVRGizmos/Main.cs
new file mode 100644
index 0000000..376fdce
--- /dev/null
+++ b/CVRGizmos/Main.cs
@@ -0,0 +1,46 @@
+using ABI_RC.Core.Player;
+using MelonLoader;
+using System.Collections;
+
+namespace CVRGizmos;
+
+public class CVRGizmos : MelonMod
+{
+
+ private static MelonPreferences_Category m_categoryCVRGizmos;
+ private static MelonPreferences_Entry m_entryCVRGizmosEnabled;
+ private static MelonPreferences_Entry m_entryCVRGizmosLocalOnly;
+
+ public override void OnApplicationStart()
+ {
+ m_categoryCVRGizmos = MelonPreferences.CreateCategory(nameof(CVRGizmos));
+ m_entryCVRGizmosEnabled = m_categoryCVRGizmos.CreateEntry("Enabled", false);
+ m_entryCVRGizmosLocalOnly = m_categoryCVRGizmos.CreateEntry("Local Only", false);
+ m_entryCVRGizmosEnabled.Value = false;
+
+ m_categoryCVRGizmos.SaveToFile(false);
+ m_entryCVRGizmosEnabled.OnValueChangedUntyped += CVRGizmosEnabled;
+ m_entryCVRGizmosLocalOnly.OnValueChangedUntyped += CVRGizmosLocalOnly;
+
+ MelonLoader.MelonCoroutines.Start(WaitForLocalPlayer());
+ }
+
+ IEnumerator WaitForLocalPlayer()
+ {
+ while (PlayerSetup.Instance == null)
+ yield return null;
+
+ PlayerSetup.Instance.gameObject.AddComponent();
+ }
+
+ public void CVRGizmosEnabled()
+ {
+ CVRGizmoManager.Instance.EnableGizmos(m_entryCVRGizmosEnabled.Value);
+ }
+
+ public void CVRGizmosLocalOnly()
+ {
+ CVRGizmoManager.Instance.g_localOnly = m_entryCVRGizmosLocalOnly.Value;
+ CVRGizmoManager.Instance.RefreshGizmos();
+ }
+}
\ No newline at end of file
diff --git a/CVRGizmos/Properties/AssemblyInfo.cs b/CVRGizmos/Properties/AssemblyInfo.cs
new file mode 100644
index 0000000..d2b3a01
--- /dev/null
+++ b/CVRGizmos/Properties/AssemblyInfo.cs
@@ -0,0 +1,30 @@
+using CVRGizmos.Properties;
+using MelonLoader;
+using System.Reflection;
+
+
+[assembly: AssemblyVersion(AssemblyInfoParams.Version)]
+[assembly: AssemblyFileVersion(AssemblyInfoParams.Version)]
+[assembly: AssemblyInformationalVersion(AssemblyInfoParams.Version)]
+[assembly: AssemblyTitle(nameof(CVRGizmos))]
+[assembly: AssemblyCompany(AssemblyInfoParams.Author)]
+[assembly: AssemblyProduct(nameof(CVRGizmos))]
+
+[assembly: MelonInfo(
+ typeof(CVRGizmos.CVRGizmos),
+ nameof(CVRGizmos),
+ AssemblyInfoParams.Version,
+ AssemblyInfoParams.Author,
+ downloadLink: "https://github.com/NotAKidOnSteam/CVRGizmos"
+)]
+
+[assembly: MelonGame("Alpha Blend Interactive", "ChilloutVR")]
+[assembly: MelonPlatform(MelonPlatformAttribute.CompatiblePlatforms.WINDOWS_X64)]
+[assembly: MelonPlatformDomain(MelonPlatformDomainAttribute.CompatibleDomains.MONO)]
+
+namespace CVRGizmos.Properties;
+internal static class AssemblyInfoParams
+{
+ public const string Version = "1.0.0";
+ public const string Author = "NotAKidoS";
+}
\ No newline at end of file
diff --git a/CVRGizmos/format.json b/CVRGizmos/format.json
new file mode 100644
index 0000000..3a4a254
--- /dev/null
+++ b/CVRGizmos/format.json
@@ -0,0 +1,23 @@
+{
+ "_id": 95,
+ "name": "CVRGizmos",
+ "modversion": "1.1.0",
+ "gameversion": "2022r168",
+ "loaderversion": "0.5.4",
+ "modtype": "Mod",
+ "author": "NotAKidoS",
+ "description": "Corrects MM and QM position when avatar is scaled.\nAdditional option to scale player collision.",
+ "searchtags": [
+ "menu",
+ "scale",
+ "avatarscale",
+ "slider"
+ ],
+ "requirements": [
+ "None"
+ ],
+ "downloadlink": "https://github.com/NotAKidOnSteam/CVRGizmos/releases/download/r2/CVRGizmos.dll",
+ "sourcelink": "https://github.com/NotAKidOnSteam/CVRGizmos/",
+ "changelog": "Added option to scale player collision. Fixed some VR specific issues.",
+ "embedcolor": "804221"
+}
\ No newline at end of file
From c46c15bf34ef6b2993a01fc7028746434b11565c Mon Sep 17 00:00:00 2001
From: NotAKidoS <37721153+NotAKidOnSteam@users.noreply.github.com>
Date: Wed, 14 Sep 2022 08:33:51 -0500
Subject: [PATCH 3/9] Update README.md
---
README.md | 31 +++++++++++++++++++++++++++++++
1 file changed, 31 insertions(+)
diff --git a/README.md b/README.md
index c2ee8b5..9d092b2 100644
--- a/README.md
+++ b/README.md
@@ -1,2 +1,33 @@
# CVRGizmos
Adds in-game gizmos to CCK components.
+
+Current implementation may be a bit ugly, but at least it doesn't tank FPS.
+
+Uses modified version of Popcron.Gizmos:
+
+https://github.com/popcron/gizmos
+
+---
+
+Here is the block of text where I tell you this mod is not affiliated or endorsed by ABI.
+https://documentation.abinteractive.net/official/legal/tos/#7-modding-our-games
+
+> I am not affiliated with ABI in any official capacity, these mods are not endorsed or outright permitted by ABI and are subject to scrutiny.
+
+> Neither I nor these mods are in any way affiliated with Alpha Blend Interactive and/or ChilloutVR. Using these modifications might cause issues with the performance, security or stability of the game. Use at your own risk.
+
+> Any modifications that are not approved can get your ABI account terminated and such this modification is following the "modding guidelines" at the best it could be.
+> They reserve the right to punish users using my mod.
+> If you are scared of using modifications in your game do not install mods.
+
+> I do not affiliate ABI and the mod is not supported by ABI.
+
+> Me and this modification are in no affiliation with ABI and not supported by ABI.
+
+> This mod is not affiliated with Alpha Blend Interactive. The mod comes with no warranty. Use at your own risk, as I am not responsible for any misuse.
+
+> I'm not affiliated with Alpha Blend Interactive and this mod is not officially supported by the game.
+
+> When releasing mods to the public, it is required to state, that the mod authors and modification are in no affiliation with ABI and not supported by ABI. :trollface:
+
+> i ran out of places to steal disclaimers from
From 7aaec9c5124913f1c5fafebdd286089a5b76f18d Mon Sep 17 00:00:00 2001
From: NotAKidoS <37721153+NotAKidOnSteam@users.noreply.github.com>
Date: Wed, 14 Sep 2022 08:34:44 -0500
Subject: [PATCH 4/9] Add Popcron.Gizmos license.
Made sure to add the MIT license to their folder.
---
.../{Gizmo => Popcron.Gizmos}/Constants.cs | 0
CVRGizmos/{Gizmo => Popcron.Gizmos}/Drawer.cs | 0
.../Drawers/CubeDrawer.cs | 0
.../Drawers/LineDrawer.cs | 0
.../Drawers/PolygonDrawer.cs | 0
.../Drawers/SquareDrawer.cs | 0
.../{Gizmo => Popcron.Gizmos}/Element.cs | 0
CVRGizmos/{Gizmo => Popcron.Gizmos}/Gizmos.cs | 0
.../GizmosInstance.cs | 0
CVRGizmos/Popcron.Gizmos/LICENSE.md | 21 +++++++++++++++++++
10 files changed, 21 insertions(+)
rename CVRGizmos/{Gizmo => Popcron.Gizmos}/Constants.cs (100%)
rename CVRGizmos/{Gizmo => Popcron.Gizmos}/Drawer.cs (100%)
rename CVRGizmos/{Gizmo => Popcron.Gizmos}/Drawers/CubeDrawer.cs (100%)
rename CVRGizmos/{Gizmo => Popcron.Gizmos}/Drawers/LineDrawer.cs (100%)
rename CVRGizmos/{Gizmo => Popcron.Gizmos}/Drawers/PolygonDrawer.cs (100%)
rename CVRGizmos/{Gizmo => Popcron.Gizmos}/Drawers/SquareDrawer.cs (100%)
rename CVRGizmos/{Gizmo => Popcron.Gizmos}/Element.cs (100%)
rename CVRGizmos/{Gizmo => Popcron.Gizmos}/Gizmos.cs (100%)
rename CVRGizmos/{Gizmo => Popcron.Gizmos}/GizmosInstance.cs (100%)
create mode 100644 CVRGizmos/Popcron.Gizmos/LICENSE.md
diff --git a/CVRGizmos/Gizmo/Constants.cs b/CVRGizmos/Popcron.Gizmos/Constants.cs
similarity index 100%
rename from CVRGizmos/Gizmo/Constants.cs
rename to CVRGizmos/Popcron.Gizmos/Constants.cs
diff --git a/CVRGizmos/Gizmo/Drawer.cs b/CVRGizmos/Popcron.Gizmos/Drawer.cs
similarity index 100%
rename from CVRGizmos/Gizmo/Drawer.cs
rename to CVRGizmos/Popcron.Gizmos/Drawer.cs
diff --git a/CVRGizmos/Gizmo/Drawers/CubeDrawer.cs b/CVRGizmos/Popcron.Gizmos/Drawers/CubeDrawer.cs
similarity index 100%
rename from CVRGizmos/Gizmo/Drawers/CubeDrawer.cs
rename to CVRGizmos/Popcron.Gizmos/Drawers/CubeDrawer.cs
diff --git a/CVRGizmos/Gizmo/Drawers/LineDrawer.cs b/CVRGizmos/Popcron.Gizmos/Drawers/LineDrawer.cs
similarity index 100%
rename from CVRGizmos/Gizmo/Drawers/LineDrawer.cs
rename to CVRGizmos/Popcron.Gizmos/Drawers/LineDrawer.cs
diff --git a/CVRGizmos/Gizmo/Drawers/PolygonDrawer.cs b/CVRGizmos/Popcron.Gizmos/Drawers/PolygonDrawer.cs
similarity index 100%
rename from CVRGizmos/Gizmo/Drawers/PolygonDrawer.cs
rename to CVRGizmos/Popcron.Gizmos/Drawers/PolygonDrawer.cs
diff --git a/CVRGizmos/Gizmo/Drawers/SquareDrawer.cs b/CVRGizmos/Popcron.Gizmos/Drawers/SquareDrawer.cs
similarity index 100%
rename from CVRGizmos/Gizmo/Drawers/SquareDrawer.cs
rename to CVRGizmos/Popcron.Gizmos/Drawers/SquareDrawer.cs
diff --git a/CVRGizmos/Gizmo/Element.cs b/CVRGizmos/Popcron.Gizmos/Element.cs
similarity index 100%
rename from CVRGizmos/Gizmo/Element.cs
rename to CVRGizmos/Popcron.Gizmos/Element.cs
diff --git a/CVRGizmos/Gizmo/Gizmos.cs b/CVRGizmos/Popcron.Gizmos/Gizmos.cs
similarity index 100%
rename from CVRGizmos/Gizmo/Gizmos.cs
rename to CVRGizmos/Popcron.Gizmos/Gizmos.cs
diff --git a/CVRGizmos/Gizmo/GizmosInstance.cs b/CVRGizmos/Popcron.Gizmos/GizmosInstance.cs
similarity index 100%
rename from CVRGizmos/Gizmo/GizmosInstance.cs
rename to CVRGizmos/Popcron.Gizmos/GizmosInstance.cs
diff --git a/CVRGizmos/Popcron.Gizmos/LICENSE.md b/CVRGizmos/Popcron.Gizmos/LICENSE.md
new file mode 100644
index 0000000..e895714
--- /dev/null
+++ b/CVRGizmos/Popcron.Gizmos/LICENSE.md
@@ -0,0 +1,21 @@
+MIT License
+
+Copyright (c) 2019 Phillip DaSilva-Damaskin
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in all
+copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+SOFTWARE.
\ No newline at end of file
From db02463fdd052043fb2b80099f6a8501f6342eca Mon Sep 17 00:00:00 2001
From: NotAKidoS <37721153+NotAKidOnSteam@users.noreply.github.com>
Date: Wed, 14 Sep 2022 08:44:36 -0500
Subject: [PATCH 5/9] Removed unneeded references.
---
CVRGizmos/CVRGizmos.csproj | 12 ------------
CVRGizmos/Popcron.Gizmos/Drawer.cs | 2 --
CVRGizmos/Popcron.Gizmos/Gizmos.cs | 1 -
CVRGizmos/Popcron.Gizmos/GizmosInstance.cs | 2 --
4 files changed, 17 deletions(-)
diff --git a/CVRGizmos/CVRGizmos.csproj b/CVRGizmos/CVRGizmos.csproj
index 7c80c7d..5ced6e5 100644
--- a/CVRGizmos/CVRGizmos.csproj
+++ b/CVRGizmos/CVRGizmos.csproj
@@ -15,24 +15,12 @@
C:\Program Files (x86)\Steam\steamapps\common\ChilloutVR\ChilloutVR_Data\Managed\Assembly-CSharp.dll
-
- ..\..\..\..\..\..\..\Program Files (x86)\Steam\steamapps\common\ChilloutVR\ChilloutVR_Data\Managed\Cohtml.Runtime.dll
-
C:\Program Files (x86)\Steam\steamapps\common\ChilloutVR\MelonLoader\MelonLoader.dll
-
- C:\Program Files (x86)\Steam\steamapps\common\ChilloutVR\ChilloutVR_Data\Managed\SteamVR.dll
-
C:\Program Files (x86)\Steam\steamapps\common\ChilloutVR\ChilloutVR_Data\Managed\UnityEngine.CoreModule.dll
-
- C:\Program Files (x86)\Steam\steamapps\common\ChilloutVR\ChilloutVR_Data\Managed\UnityEngine.InputLegacyModule.dll
-
-
- ..\..\..\..\..\..\..\Program Files (x86)\Steam\steamapps\common\ChilloutVR\ChilloutVR_Data\Managed\UnityEngine.PhysicsModule.dll
-
diff --git a/CVRGizmos/Popcron.Gizmos/Drawer.cs b/CVRGizmos/Popcron.Gizmos/Drawer.cs
index 7e769b5..8e42ae8 100644
--- a/CVRGizmos/Popcron.Gizmos/Drawer.cs
+++ b/CVRGizmos/Popcron.Gizmos/Drawer.cs
@@ -1,5 +1,3 @@
-using System;
-using System.Collections.Generic;
using System.Reflection;
using UnityEngine;
diff --git a/CVRGizmos/Popcron.Gizmos/Gizmos.cs b/CVRGizmos/Popcron.Gizmos/Gizmos.cs
index ad79726..a897991 100644
--- a/CVRGizmos/Popcron.Gizmos/Gizmos.cs
+++ b/CVRGizmos/Popcron.Gizmos/Gizmos.cs
@@ -1,4 +1,3 @@
-using System;
using UnityEngine;
namespace Popcron
diff --git a/CVRGizmos/Popcron.Gizmos/GizmosInstance.cs b/CVRGizmos/Popcron.Gizmos/GizmosInstance.cs
index e2db39c..4743ed4 100644
--- a/CVRGizmos/Popcron.Gizmos/GizmosInstance.cs
+++ b/CVRGizmos/Popcron.Gizmos/GizmosInstance.cs
@@ -1,5 +1,3 @@
-using System;
-using System.Collections.Generic;
using UnityEngine;
using UnityEngine.Rendering;
From 7ca182ad6242741b581f28777ed7c84fe17f6185 Mon Sep 17 00:00:00 2001
From: NotAKidoS <37721153+NotAKidOnSteam@users.noreply.github.com>
Date: Wed, 14 Sep 2022 08:55:56 -0500
Subject: [PATCH 6/9] add shit readme image
---
README.md | 3 +++
1 file changed, 3 insertions(+)
diff --git a/README.md b/README.md
index 9d092b2..a7d0e05 100644
--- a/README.md
+++ b/README.md
@@ -7,6 +7,9 @@ Uses modified version of Popcron.Gizmos:
https://github.com/popcron/gizmos
+
+
+
---
Here is the block of text where I tell you this mod is not affiliated or endorsed by ABI.
From 65b57db66545424fa05f150606a129f97c7e76cf Mon Sep 17 00:00:00 2001
From: NotAKidoS <37721153+NotAKidOnSteam@users.noreply.github.com>
Date: Wed, 14 Sep 2022 18:29:14 -0500
Subject: [PATCH 7/9] Added new GizmoTypes
typeof(CVRGizmos_ToggleStateTrigger),
typeof(CVRGizmos_Avatar),
typeof(CVRGizmos_AvatarPickupMarker),
//may be broken
typeof(CVRGizmos_DistanceConstrain),
---
CVRGizmos/CVRGizmoManager.cs | 4 +
CVRGizmos/GizmoTypes/CVRAvatar.cs | 46 +++++++++++
CVRGizmos/GizmoTypes/CVRAvatarPickupMarker.cs | 51 ++++++++++++
CVRGizmos/GizmoTypes/CVRDistanceConstrain.cs | 79 +++++++++++++++++++
CVRGizmos/GizmoTypes/CVRToggleStateTrigger.cs | 49 ++++++++++++
CVRGizmos/Main.cs | 3 +
6 files changed, 232 insertions(+)
create mode 100644 CVRGizmos/GizmoTypes/CVRAvatar.cs
create mode 100644 CVRGizmos/GizmoTypes/CVRAvatarPickupMarker.cs
create mode 100644 CVRGizmos/GizmoTypes/CVRDistanceConstrain.cs
create mode 100644 CVRGizmos/GizmoTypes/CVRToggleStateTrigger.cs
diff --git a/CVRGizmos/CVRGizmoManager.cs b/CVRGizmos/CVRGizmoManager.cs
index f29cb97..948783c 100644
--- a/CVRGizmos/CVRGizmoManager.cs
+++ b/CVRGizmos/CVRGizmoManager.cs
@@ -20,6 +20,10 @@ namespace CVRGizmos
typeof(CVRGizmos_DistanceLod),
typeof(CVRGizmos_HapticZone),
typeof(CVRGizmos_HapticAreaChest),
+ typeof(CVRGizmos_ToggleStateTrigger),
+ typeof(CVRGizmos_Avatar),
+ typeof(CVRGizmos_AvatarPickupMarker),
+ typeof(CVRGizmos_DistanceConstrain),
};
void Start()
diff --git a/CVRGizmos/GizmoTypes/CVRAvatar.cs b/CVRGizmos/GizmoTypes/CVRAvatar.cs
new file mode 100644
index 0000000..3686fc0
--- /dev/null
+++ b/CVRGizmos/GizmoTypes/CVRAvatar.cs
@@ -0,0 +1,46 @@
+using ABI.CCK.Components;
+using UnityEngine;
+using Gizmos = Popcron.Gizmos;
+
+namespace CVRGizmos.GismoTypes
+{
+ public class CVRGizmos_Avatar : CVRGizmoBase
+ {
+ public static CVRAvatar[] references;
+
+ public override void CacheGizmos()
+ {
+ var found = Resources.FindObjectsOfTypeAll(typeof(CVRAvatar)) as CVRAvatar[];
+
+ if (CVRGizmoManager.Instance.g_localOnly)
+ {
+ references = Array.ConvertAll(GetLocalOnly(found), item => (CVRAvatar)item);
+ }
+ else
+ {
+ references = found;
+ }
+ }
+
+ public override void DrawGizmos()
+ {
+ for (int i = 0; i < references.Count(); i++)
+ {
+ if (references[i] == null)
+ {
+ CacheGizmos();
+ break;
+ }
+ if (references[i].isActiveAndEnabled)
+ {
+ //viewPosition & voicePosition seem to be rounded... not good, may be why viewpoint drift is bad on scale
+ Gizmos.Color = Color.green;
+ Gizmos.Matrix = Matrix4x4.TRS(references[i].transform.position, references[i].transform.rotation, references[i].transform.localScale);
+ Gizmos.Sphere(references[i].viewPosition, 0.01f);
+ Gizmos.Color = Color.red;
+ Gizmos.Sphere(references[i].voicePosition, 0.01f);
+ }
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/CVRGizmos/GizmoTypes/CVRAvatarPickupMarker.cs b/CVRGizmos/GizmoTypes/CVRAvatarPickupMarker.cs
new file mode 100644
index 0000000..186de96
--- /dev/null
+++ b/CVRGizmos/GizmoTypes/CVRAvatarPickupMarker.cs
@@ -0,0 +1,51 @@
+using ABI.CCK.Components;
+using UnityEngine;
+using Gizmos = Popcron.Gizmos;
+
+namespace CVRGizmos.GismoTypes
+{
+ public class CVRGizmos_AvatarPickupMarker : CVRGizmoBase
+ {
+ public static CVRAvatarPickupMarker[] references;
+
+ public override void CacheGizmos()
+ {
+ var found = Resources.FindObjectsOfTypeAll(typeof(CVRAvatarPickupMarker)) as CVRAvatarPickupMarker[];
+
+ if (CVRGizmoManager.Instance.g_localOnly)
+ {
+ references = Array.ConvertAll(GetLocalOnly(found), item => (CVRAvatarPickupMarker)item);
+ }
+ else
+ {
+ references = found;
+ }
+ }
+
+ public override void DrawGizmos()
+ {
+ for (int i = 0; i < references.Count(); i++)
+ {
+ if (references[i] == null)
+ {
+ CacheGizmos();
+ break;
+ }
+ if (references[i].isActiveAndEnabled)
+ {
+ Gizmos.Color = Color.magenta;
+ Gizmos.Matrix = Matrix4x4.TRS(references[i].transform.position, references[i].transform.rotation, references[i].transform.lossyScale);
+ Gizmos.Cube(new Vector3(0f, 0.75f, 0f), Quaternion.identity, new Vector3(1f, 1.5f, 0f));
+ Gizmos.Cube(new Vector3(0f, 0.7f, 0f), Quaternion.identity, new Vector3(0.8f, 0.1f, 0f));
+ Gizmos.Cube(new Vector3(0f, 0.615f, 0f), Quaternion.identity, new Vector3(0.6f, 0.07f, 0f));
+ Gizmos.Cube(new Vector3(0.24f, 0.28f, 0f), Quaternion.identity, new Vector3(0.32f, 0.42f, 0f));
+ Gizmos.Cube(new Vector3(-0.24f, 0.28f, 0f), Quaternion.identity, new Vector3(0.32f, 0.42f, 0f));
+ Vector3 lossyScale = references[i].transform.lossyScale;
+ lossyScale.Scale(new Vector3(1f, 1f, 0f));
+ Gizmos.Matrix = Matrix4x4.TRS(references[i].transform.position, references[i].transform.rotation, lossyScale);
+ Gizmos.Sphere(new Vector3(0f, 1.11f, 0f), 0.31f);
+ }
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/CVRGizmos/GizmoTypes/CVRDistanceConstrain.cs b/CVRGizmos/GizmoTypes/CVRDistanceConstrain.cs
new file mode 100644
index 0000000..09fd75c
--- /dev/null
+++ b/CVRGizmos/GizmoTypes/CVRDistanceConstrain.cs
@@ -0,0 +1,79 @@
+using ABI.CCK.Components;
+using UnityEngine;
+using Gizmos = Popcron.Gizmos;
+
+namespace CVRGizmos.GismoTypes
+{
+ public class CVRGizmos_DistanceConstrain : CVRGizmoBase
+ {
+ public static CVRDistanceConstrain[] references;
+
+ public override void CacheGizmos()
+ {
+ var found = Resources.FindObjectsOfTypeAll(typeof(CVRDistanceConstrain)) as CVRDistanceConstrain[];
+
+ if (CVRGizmoManager.Instance.g_localOnly)
+ {
+ references = Array.ConvertAll(GetLocalOnly(found), item => (CVRDistanceConstrain)item);
+ }
+ else
+ {
+ references = found;
+ }
+ }
+
+ public override void DrawGizmos()
+ {
+ for (int i = 0; i < references.Count(); i++)
+ {
+ if (references[i] == null)
+ {
+ CacheGizmos();
+ break;
+ }
+ if (references[i].target == null)
+ {
+ break;
+ }
+ if (references[i].maxDistance < references[i].minDistance && references[i].maxDistance != 0f)
+ {
+ break;
+ }
+ Vector3 normalized = (references[i].transform.position - references[i].target.position).normalized;
+
+ //BUG: Matrix addition isn't reset, other gizmo types Matrix will persist.
+ //This gizmo type could be a bit fucked, but I don't have the time to test.
+ Gizmos.Matrix = Matrix4x4.identity;
+
+ if (references[i].minDistance == 0f)
+ {
+ if (references[i].maxDistance == 0f)
+ {
+ Gizmos.Color = Color.green;
+ Gizmos.Line(references[i].target.position, normalized * 9999f);
+ break;
+ }
+ Gizmos.Color = Color.green;
+ Gizmos.Line(references[i].target.position, references[i].target.position + normalized * references[i].maxDistance);
+ break;
+ }
+ else
+ {
+ if (references[i].maxDistance == 0f)
+ {
+ Gizmos.Color = Color.red;
+ Gizmos.Line(references[i].target.position, references[i].target.position + normalized * references[i].minDistance);
+ Gizmos.Color = Color.green;
+ Gizmos.Line(references[i].target.position + normalized * references[i].minDistance, normalized * 9999f);
+ break;
+ }
+ Gizmos.Color = Color.red;
+ Gizmos.Line(references[i].target.position, references[i].target.position + normalized * references[i].minDistance);
+ Gizmos.Color = Color.green;
+ Gizmos.Line(references[i].target.position + normalized * references[i].minDistance, references[i].target.position + normalized * references[i].maxDistance);
+ break;
+ }
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/CVRGizmos/GizmoTypes/CVRToggleStateTrigger.cs b/CVRGizmos/GizmoTypes/CVRToggleStateTrigger.cs
new file mode 100644
index 0000000..6f9e940
--- /dev/null
+++ b/CVRGizmos/GizmoTypes/CVRToggleStateTrigger.cs
@@ -0,0 +1,49 @@
+using ABI.CCK.Components;
+using UnityEngine;
+using Gizmos = Popcron.Gizmos;
+
+/**
+
+CVRToggleStateTrigger **can** be local using CVROfflinePreview or similar mods.
+
+**/
+
+namespace CVRGizmos.GismoTypes
+{
+ public class CVRGizmos_ToggleStateTrigger : CVRGizmoBase
+ {
+ public static CVRToggleStateTrigger[] references;
+
+ public override void CacheGizmos()
+ {
+ var found = Resources.FindObjectsOfTypeAll(typeof(CVRToggleStateTrigger)) as CVRToggleStateTrigger[];
+
+ if (CVRGizmoManager.Instance.g_localOnly)
+ {
+ references = Array.ConvertAll(GetLocalOnly(found), item => (CVRToggleStateTrigger)item);
+ }
+ else
+ {
+ references = found;
+ }
+ }
+
+ public override void DrawGizmos()
+ {
+ for (int i = 0; i < references.Count(); i++)
+ {
+ if (references[i] == null)
+ {
+ CacheGizmos();
+ break;
+ }
+ if (references[i].isActiveAndEnabled)
+ {
+ Gizmos.Color = Color.green;
+ Gizmos.Matrix = Matrix4x4.TRS(references[i].transform.position, references[i].transform.rotation, references[i].transform.lossyScale);
+ Gizmos.Cube(references[i].areaOffset, Quaternion.identity, references[i].areaSize);
+ }
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/CVRGizmos/Main.cs b/CVRGizmos/Main.cs
index 376fdce..966b1f8 100644
--- a/CVRGizmos/Main.cs
+++ b/CVRGizmos/Main.cs
@@ -1,5 +1,6 @@
using ABI_RC.Core.Player;
using MelonLoader;
+using UnityEngine;
using System.Collections;
namespace CVRGizmos;
@@ -35,11 +36,13 @@ public class CVRGizmos : MelonMod
public void CVRGizmosEnabled()
{
+ if (!CVRGizmoManager.Instance) return;
CVRGizmoManager.Instance.EnableGizmos(m_entryCVRGizmosEnabled.Value);
}
public void CVRGizmosLocalOnly()
{
+ if (!CVRGizmoManager.Instance) return;
CVRGizmoManager.Instance.g_localOnly = m_entryCVRGizmosLocalOnly.Value;
CVRGizmoManager.Instance.RefreshGizmos();
}
From 821b1efcd85dc6757ca855419ad1958dc81b16cd Mon Sep 17 00:00:00 2001
From: NotAKidoS <37721153+NotAKidOnSteam@users.noreply.github.com>
Date: Thu, 15 Sep 2022 13:12:37 -0500
Subject: [PATCH 8/9] Tweaked Invoke time, properly disable Gizmos, added debug
lines to CVRAvatar.
Invoke time is now 0f, so toggling and refreshing Gizmos are now instant... oops.
GizmosInstance is now properly disabled when not in use. Also removed the default gizmos line drawing at 0,0,0 that was purely there to clear gizmos queue.
CVRAvatar debugging now has useful lines coming from the viewpoint and mouth positions. Later on might actually parent these gizmos to the head : shrug :
---
CVRGizmos/CVRGizmoManager.cs | 4 +++-
CVRGizmos/GizmoTypes/CVRAvatar.cs | 4 ++++
CVRGizmos/Popcron.Gizmos/GizmosInstance.cs | 10 +++++-----
3 files changed, 12 insertions(+), 6 deletions(-)
diff --git a/CVRGizmos/CVRGizmoManager.cs b/CVRGizmos/CVRGizmoManager.cs
index 948783c..4d398b5 100644
--- a/CVRGizmos/CVRGizmoManager.cs
+++ b/CVRGizmos/CVRGizmoManager.cs
@@ -1,4 +1,5 @@
using CVRGizmos.GismoTypes;
+using Gizmos = Popcron.Gizmos;
using UnityEngine;
namespace CVRGizmos
@@ -41,6 +42,7 @@ namespace CVRGizmos
for (int i = 0; i < GizmoTypes.Count(); i++)
{
managed[i].enabled = able;
+ Gizmos.Enabled = able;
}
RefreshGizmos();
}
@@ -49,7 +51,7 @@ namespace CVRGizmos
{
for (int i = 0; i < GizmoTypes.Count(); i++)
{
- managed[i].Invoke("CacheGizmos", 1f);
+ managed[i].Invoke("CacheGizmos", 0f);
}
}
}
diff --git a/CVRGizmos/GizmoTypes/CVRAvatar.cs b/CVRGizmos/GizmoTypes/CVRAvatar.cs
index 3686fc0..a7c3be5 100644
--- a/CVRGizmos/GizmoTypes/CVRAvatar.cs
+++ b/CVRGizmos/GizmoTypes/CVRAvatar.cs
@@ -37,8 +37,12 @@ namespace CVRGizmos.GismoTypes
Gizmos.Color = Color.green;
Gizmos.Matrix = Matrix4x4.TRS(references[i].transform.position, references[i].transform.rotation, references[i].transform.localScale);
Gizmos.Sphere(references[i].viewPosition, 0.01f);
+ Gizmos.Line(references[i].viewPosition, references[i].viewPosition + Vector3.forward * 0.05f);
+ Gizmos.Line(references[i].viewPosition, references[i].viewPosition + Vector3.right * 0.05f);
Gizmos.Color = Color.red;
Gizmos.Sphere(references[i].voicePosition, 0.01f);
+ Gizmos.Line(references[i].voicePosition, references[i].voicePosition + Vector3.forward * 0.05f);
+ Gizmos.Line(references[i].voicePosition, references[i].voicePosition + Vector3.right * 0.05f);
}
}
}
diff --git a/CVRGizmos/Popcron.Gizmos/GizmosInstance.cs b/CVRGizmos/Popcron.Gizmos/GizmosInstance.cs
index 4743ed4..b68eb78 100644
--- a/CVRGizmos/Popcron.Gizmos/GizmosInstance.cs
+++ b/CVRGizmos/Popcron.Gizmos/GizmosInstance.cs
@@ -329,11 +329,11 @@ namespace Popcron
return false;
}
- private void Update()
- {
- //always render something
- Gizmos.Line(default, default);
- }
+ //private void Update()
+ //{
+ // //always render something
+ // Gizmos.Line(default, default);
+ //}
private void OnRendered(Camera camera)
{
From 71c77493c8e41a1ec811128929886aed0c339118 Mon Sep 17 00:00:00 2001
From: NotAKidoS <37721153+NotAKidOnSteam@users.noreply.github.com>
Date: Thu, 9 Feb 2023 23:02:08 -0600
Subject: [PATCH 9/9] Update README.md
---
README.md | 21 +++------------------
1 file changed, 3 insertions(+), 18 deletions(-)
diff --git a/README.md b/README.md
index a7d0e05..c067a52 100644
--- a/README.md
+++ b/README.md
@@ -9,28 +9,13 @@ https://github.com/popcron/gizmos

-
---
Here is the block of text where I tell you this mod is not affiliated or endorsed by ABI.
https://documentation.abinteractive.net/official/legal/tos/#7-modding-our-games
-> I am not affiliated with ABI in any official capacity, these mods are not endorsed or outright permitted by ABI and are subject to scrutiny.
+> This mod is an independent creation and is not affiliated with, supported by or approved by Alpha Blend Interactive.
-> Neither I nor these mods are in any way affiliated with Alpha Blend Interactive and/or ChilloutVR. Using these modifications might cause issues with the performance, security or stability of the game. Use at your own risk.
+> Use of this mod is done so at the user's own risk and the creator cannot be held responsible for any issues arising from its use.
-> Any modifications that are not approved can get your ABI account terminated and such this modification is following the "modding guidelines" at the best it could be.
-> They reserve the right to punish users using my mod.
-> If you are scared of using modifications in your game do not install mods.
-
-> I do not affiliate ABI and the mod is not supported by ABI.
-
-> Me and this modification are in no affiliation with ABI and not supported by ABI.
-
-> This mod is not affiliated with Alpha Blend Interactive. The mod comes with no warranty. Use at your own risk, as I am not responsible for any misuse.
-
-> I'm not affiliated with Alpha Blend Interactive and this mod is not officially supported by the game.
-
-> When releasing mods to the public, it is required to state, that the mod authors and modification are in no affiliation with ABI and not supported by ABI. :trollface:
-
-> i ran out of places to steal disclaimers from
+> To the best of my knowledge, I have adhered to the Modding Guidelines established by Alpha Blend Interactive.