Compare commits

..

No commits in common. "3005cfc8aa85a40846c7ff1e734730d5b144131f" and "3408d9ff8ed09721256285bd1c2fddd91378b675" have entirely different histories.

44 changed files with 305 additions and 1231 deletions

View file

@ -1,209 +0,0 @@
using System.Collections.Generic;
using UnityEngine;
namespace ABI.CCK.Components
{
public class AnimatorDriver : StateMachineBehaviour
{
public List<AnimatorDriverTask> EnterTasks = new List<AnimatorDriverTask>();
public List<AnimatorDriverTask> ExitTasks = new List<AnimatorDriverTask>();
public override void OnStateEnter(Animator animator, AnimatorStateInfo stateInfo, int layerIndex)
{
foreach (var task in EnterTasks)
{
task.Execute(animator);
}
}
public override void OnStateExit(Animator animator, AnimatorStateInfo stateInfo, int layerIndex)
{
foreach (var task in ExitTasks)
{
task.Execute(animator);
}
}
}
[System.Serializable]
public class AnimatorDriverTask
{
public enum Operator
{
Set,
Addition,
Subtraction,
Multiplication,
Division,
Modulo,
Power,
Log,
Equal,
NotEqual,
LessThen,
LessEqual,
MoreThen,
MoreEqual
}
public enum SourceType
{
Static,
Parameter,
Random
}
public enum ParameterType
{
None,
Float,
Int,
Bool,
Trigger
}
public ParameterType targetType = ParameterType.None;
public string targetName = "";
public Operator op = Operator.Set;
public SourceType aType = SourceType.Static;
public float aValue = 0f;
public float aMax = 1f;
public ParameterType aParamType;
public string aName = "";
public SourceType bType = SourceType.Static;
public float bValue = 0f;
public float bMax = 1f;
public ParameterType bParamType;
public string bName = "";
public void Execute(Animator animator)
{
float valA = 0f;
float valB = 0f;
float res = 0f;
switch (aType)
{
case SourceType.Static:
valA = aValue;
break;
case SourceType.Random:
valA = Random.Range(aValue, aMax);
break;
case SourceType.Parameter:
switch (aParamType)
{
default:
valA = 0f;
break;
case ParameterType.Bool:
valA = animator.GetBool(aName) ? 1f : 0f;
break;
case ParameterType.Float:
valA = animator.GetFloat(aName);
break;
case ParameterType.Int:
valA = animator.GetInteger(aName);
break;
}
break;
}
if (op == Operator.Set)
{
res = valA;
}
else
{
switch (bType)
{
case SourceType.Static:
valB = bValue;
break;
case SourceType.Random:
valB = Random.Range(bValue, aMax);
break;
case SourceType.Parameter:
switch (aParamType)
{
default:
valB = 0f;
break;
case ParameterType.Bool:
valB = animator.GetBool(bName) ? 1f : 0f;
break;
case ParameterType.Float:
valB = animator.GetFloat(bName);
break;
case ParameterType.Int:
valB = animator.GetInteger(bName);
break;
}
break;
}
switch (op)
{
case Operator.Addition:
res = valA + valB;
break;
case Operator.Subtraction:
res = valA - valB;
break;
case Operator.Multiplication:
res = valA * valB;
break;
case Operator.Division:
res = valA / valB;
break;
case Operator.Modulo:
res = valA % valB;
break;
case Operator.Power:
res = Mathf.Pow(valA, valB);
break;
case Operator.Log:
res = Mathf.Log(valA, valB);
break;
case Operator.Equal:
res = valA == valB ? 1f : 0f;
break;
case Operator.NotEqual:
res = valA != valB ? 1f : 0f;
break;
case Operator.LessThen:
res = valA < valB ? 1f : 0f;
break;
case Operator.LessEqual:
res = valA <= valB ? 1f : 0f;
break;
case Operator.MoreThen:
res = valA > valB ? 1f : 0f;
break;
case Operator.MoreEqual:
res = valA >= valB ? 1f : 0f;
break;
}
}
switch (targetType)
{
case ParameterType.Bool:
animator.SetBool(targetName, res >= 0.5f);
break;
case ParameterType.Trigger:
if (res >= 0.5f) animator.SetTrigger(targetName);
break;
case ParameterType.Float:
animator.SetFloat(targetName, res);
break;
case ParameterType.Int:
animator.SetInteger(targetName, (int) res);
break;
}
}
}
}

View file

@ -1,11 +0,0 @@
fileFormatVersion: 2
guid: 6007a7c7844c4bcc994fd9111bf4d5a5
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {fileID: 2800000, guid: 8d4eaf52fbae23548874e96ac0d52276, type: 3}
userData:
assetBundleName:
assetBundleVariant:

View file

@ -17,8 +17,5 @@ namespace ABI.CCK.Components
public AssetType type;
public string objectId;
[HideInInspector]
public string randomNum;
}
}

View file

@ -1,5 +1,4 @@
using System.Collections.Generic;
using UnityEngine;
using UnityEngine;
using UnityEngine.Events;
namespace ABI.CCK.Components
@ -11,7 +10,6 @@ namespace ABI.CCK.Components
{
Bone = 1,
Tracker = 2,
SnappingPoint = 4,
}
public AttachmentType attachmentType;
@ -55,8 +53,6 @@ namespace ABI.CCK.Components
public TrackerType trackerType = 0;
public List<string> snappingPointTypes = new List<string>();
public bool useFixedPositionOffset = false;
public bool useFixedRotationOffset = false;

View file

@ -37,8 +37,6 @@ namespace ABI.CCK.Components
public CVRAvatarVisemeMode visemeMode = CVRAvatarVisemeMode.Visemes;
public int visemeSmoothing = 50;
public string[] visemeBlendshapes = new string[15];
[Space] [Header("Avatar customization")] [Space]
@ -84,8 +82,8 @@ namespace ABI.CCK.Components
FlashingLights = 16,
Violence = 32,
Gore = 64,
Suggestive = 128,
Nudity = 256,
//Suggestive = 128,
//Nudity = 256,
Horror = 512
}

View file

@ -123,11 +123,6 @@ namespace ABI.CCK.Components
Alpha7 = KeyCode.Alpha7,
Alpha8 = KeyCode.Alpha8,
Alpha9 = KeyCode.Alpha9,
LeftShift = KeyCode.LeftShift,
RightShift = KeyCode.RightShift,
LeftControl = KeyCode.LeftControl,
RightControl = KeyCode.RightControl,
Space = KeyCode.Space,
InputHorizontalNegative = 10000,
InputHorizontalPositive = 10001,
InputVerticalNegative = 10002,

View file

@ -29,7 +29,6 @@ namespace ABI.CCK.Components
DisplayWorldDetailPage = 13,
DisplayInstanceDetailPage = 14,
DisplayAvatarDetailPage = 15,
DisplaySpawnableDetailPage = 37,
SitAtPosition = 16,
MethodCall = 21,
SetSpawnableValue = 22,

View file

@ -24,15 +24,12 @@ namespace ABI.CCK.Components
[Header("Events")]
public UnityEvent playerDownEvent = new UnityEvent();
public UnityEvent playerHitEvent = new UnityEvent();
public UnityEvent playerRespawnEvent = new UnityEvent();
public UnityEvent playerRevitalizeEvent = new UnityEvent();
[Header("PVP Events")]
public UnityEvent playerDownedEvent = new UnityEvent();
public UnityEvent downedAnotherPlayerEvent = new UnityEvent();
public UnityEvent playerGotHitEvent = new UnityEvent();
public UnityEvent hitAnotherPlayerEvent = new UnityEvent();
private void Reset()
{

View file

@ -103,7 +103,5 @@ namespace ABI.CCK.Components
public UnityEvent teamLeaveEvent = new UnityEvent();
public UnityEvent teamWinRoundEvent = new UnityEvent();
public UnityEvent teamWinGameEvent = new UnityEvent();
public UnityEvent teamMemberReadyEvent = new UnityEvent();
public UnityEvent teamMemberUnReadyEvent = new UnityEvent();
}
}

View file

@ -26,15 +26,6 @@ namespace ABI.CCK.Components
public float firingRate = 1f;
public float reloadTime = 1f;
public enum HitDetection
{
Particle = 0,
Raycast = 1,
}
public HitDetection hitDetection = HitDetection.Particle;
public LayerMask hitMask = (1 << 0) | (1 << 8);
public void Shoot()
{

View file

@ -11,16 +11,11 @@ namespace ABI.CCK.Components
{
Destroy = 0,
RespawnAfterTime = 1,
RespawnOnRoundStart = 2,
RespawnOnRoundEnd = 3,
RespawnOnGameStart = 4,
RespawnOnGameEnd = 5,
}
[Header("Down Behavior")]
public DownBehavior downBehavior = DownBehavior.Destroy;
public float respawnTime = 10f;
public Transform respawnPoint;
public GameInstanceController connectedGameInstance;
[Header("Events")]
public UnityEvent downEvent = new UnityEvent();

View file

@ -1,20 +0,0 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
namespace ABI.CCK.Components
{
public class PlayerMaterialParser : MonoBehaviour
{
public Material targetMaterial;
public string playerRootPositions = "_PlayerRootPositions";
public string playerHipPositions = "_PlayerHipPositions";
public string playerHeadPositions = "_PlayerHeadPositions";
public string playerLeftHandPositions = "_PlayerLeftHandPositions";
public string playerRightHandPositions = "_PlayerRightHandPositions";
public string playerChestPositions = "_PlayerChestPositions";
public string playerLeftFootPositions = "_PlayerLeftFootPositions";
public string playerRightFootPositions = "_PlayerRightFootPositions";
}
}

View file

@ -1,11 +0,0 @@
fileFormatVersion: 2
guid: 5256473d683a24743ab8a6b352997437
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {fileID: 2800000, guid: 8d4eaf52fbae23548874e96ac0d52276, type: 3}
userData:
assetBundleName:
assetBundleVariant:

View file

@ -1,27 +0,0 @@
using UnityEngine;
namespace ABI.CCK.Components
{
public class SpawnablePickupMarker : MonoBehaviour
{
public string spawnableGuid;
private void OnDrawGizmos()
{
Gizmos.color = Color.magenta;
Matrix4x4 rotationMatrix = Matrix4x4.TRS(transform.position, transform.rotation, transform.lossyScale);
Gizmos.matrix = rotationMatrix;
Gizmos.DrawWireCube(new Vector3(0, 0.75f, 0), new Vector3(1f, 1.5f, 0f));
Gizmos.DrawWireCube(new Vector3(0, 0.7f, 0), new Vector3(0.8f, 0.1f, 0f));
Gizmos.DrawWireCube(new Vector3(0, 0.615f, 0), new Vector3(0.6f, 0.07f, 0f));
Gizmos.DrawWireCube(new Vector3(0.24f, 0.28f, 0), new Vector3(0.32f, 0.42f, 0f));
Gizmos.DrawWireCube(new Vector3(-0.24f, 0.28f, 0), new Vector3(0.32f, 0.42f, 0f));
var scale = transform.lossyScale;
scale.Scale(new Vector3(1f, 1f, 0f));
rotationMatrix = Matrix4x4.TRS(transform.position, transform.rotation, scale);
Gizmos.matrix = rotationMatrix;
Gizmos.DrawWireSphere(new Vector3(0, 1.11f, 0), 0.31f);
}
}
}

View file

@ -1,11 +0,0 @@
fileFormatVersion: 2
guid: eff309c86b8103c45a87cf57553d787f
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {fileID: 2800000, guid: 8d4eaf52fbae23548874e96ac0d52276, type: 3}
userData:
assetBundleName:
assetBundleVariant:

View file

@ -17079,7 +17079,7 @@ MonoBehaviour:
m_HorizontalOverflow: 1
m_VerticalOverflow: 1
m_LineSpacing: 1
m_Text: ABI Platform Content Creation Kit v3.5 RELEASE (Build 98, Public)
m_Text: ABI Platform Content Creation Kit v3.4 RELEASE (Build 92, Public)
--- !u!1 &8389522060313083026
GameObject:
m_ObjectHideFlags: 0

Binary file not shown.

Binary file not shown.

View file

@ -1,176 +0,0 @@
using System;
using System.Net.Http;
using System.Text;
using System.Threading.Tasks;
using Abi.Newtonsoft.Json;
using Abi.Newtonsoft.Json.Linq;
using UnityEngine;
using Object = System.Object;
public static class APIConnection
{
public static string APIAddress = "https://api.abinteractive.net";
public static string APIVersion = "2";
private static string _apiUserAgent = "ChilloutVR API-Requests";
private static HttpClient _client = new HttpClient();
private static string _username;
private static string _accessKey;
private static bool _initialized = false;
public static bool Initialized
{
get => _initialized;
}
public static void Initialize(string username, string accessKey)
{
if (username == "" || accessKey == "") return;
_username = username;
_accessKey = accessKey;
_client.DefaultRequestHeaders.Clear();
_client.DefaultRequestHeaders.Add("Username", _username);
_client.DefaultRequestHeaders.Add("AccessKey", _accessKey);
_client.DefaultRequestHeaders.Add("User-Agent", _apiUserAgent);
_client.Timeout = TimeSpan.FromSeconds(30);
_initialized = true;
}
public static async Task<BaseResponse<T>> MakeRequest<T>(string url, Object data = null, string apiVersion = null, bool put = false)
{
if (!_initialized) return default(BaseResponse<T>);
JObject currentRequestData;
string currentRequestUrl = String.Empty;
int currentRequestType = 0;
if (apiVersion == null) apiVersion = APIVersion;
currentRequestUrl = $"{APIAddress}/{apiVersion}/{url}";
HttpResponseMessage response;
if (data != null) currentRequestType = 1;
if (put) currentRequestType = 2;
if (currentRequestType == 0)
{
response = await _client.GetAsync(currentRequestUrl);
}
else if (currentRequestType == 2)
{
response = await _client.PutAsync(currentRequestUrl, null);
}
else
{
response = await _client.PostAsync(currentRequestUrl, new StringContent(JsonConvert.SerializeObject(data), Encoding.UTF8, "application/json"));
}
if (response.IsSuccessStatusCode)
{
return JsonConvert.DeserializeObject<BaseResponse<T>>(await response.Content.ReadAsStringAsync());
}
else
{
Debug.LogError($"Result from API Request {currentRequestUrl} returned {response.StatusCode}");
}
try
{
BaseResponse<T> res = JsonConvert.DeserializeObject<BaseResponse<T>>(await response.Content.ReadAsStringAsync());
if (res != null)
return res;
}
catch (Exception e)
{
Debug.LogError($"Result from API Request {currentRequestUrl} could not be parsed");
}
return default(BaseResponse<T>);
}
//Responses
public class BaseResponse<T>
{
public string Message { get; set; }
public T Data { get; set; }
public BaseResponse(string message = null, T data = default)
{
Message = message;
Data = data;
}
public override string ToString()
{
return JsonConvert.SerializeObject(this);
}
}
public class UserinfoResponse
{
public bool IsAccountUnlocked { get; set; }
public string UserId { get; set; }
public string Name { get; set; }
public string UserRank { get; set; }
}
public enum ContentTypes
{
Avatar,
World,
Spawnable
}
public class GenerateResponse
{
public Guid Id { get; set; }
public ContentTypes Type { get; set; }
}
public class ContentInfoResponse
{
public string UploadLocation { get; set; }
public ContentDataIni ContentData { get; set; }
public class ContentDataIni : GenericINI
{
public ContentTypes Type { get; set; }
public UgcTagsData Tags { get; set; }
}
}
public class GenericINI
{
public string Id { get; set; }
public string Name { get; set; }
public string Description { get; set; }
public Uri Image { get; set; }
}
public struct UgcTagsData
{
public bool Gore;
public bool Horror;
public bool Jumpscare;
public bool Nudity;
public bool Suggestive;
public bool Violence;
public bool ContainsMusic;
public bool ExtremelyBright;
public bool ExtremelyHuge;
public bool ExtremelySmall;
public bool FlashingColors;
public bool FlashingLights;
public bool LoudAudio;
public bool ParticleSystems;
public bool ScreenEffects;
public bool SpawnAudio;
public bool LongRangeAudio;
}
}

View file

@ -1,3 +0,0 @@
fileFormatVersion: 2
guid: b6e98b6775f64bbdb3309a8b58773d81
timeCreated: 1678553770

View file

@ -179,7 +179,6 @@ namespace ABI.CCK.Scripts
public bool useAnimationClip;
public AnimationClip animationClip;
public AnimationClip offAnimationClip;
public List<CVRAdvancedSettingsTargetEntryGameObject> gameObjectTargets =
new List<CVRAdvancedSettingsTargetEntryGameObject>();
@ -257,15 +256,8 @@ namespace ABI.CCK.Scripts
if (useAnimationClip) {
onClip = animationClip;
if (offAnimationClip != null)
{
offClip = offAnimationClip;
}
else
{
AssetDatabase.CreateAsset(offClip, folderPath + "/Anim_" + machineName + "_Toggle_Off.anim");
}
}
else {
AssetDatabase.CreateAsset(offClip, folderPath + "/Anim_" + machineName + "_Toggle_Off.anim");
AssetDatabase.CreateAsset(onClip, folderPath + "/Anim_" + machineName + "_Toggle_On.anim");

View file

@ -1,353 +0,0 @@
using System;
using System.Collections.Generic;
using ABI.CCK.Components;
using UnityEditor;
using UnityEditorInternal;
using UnityEngine;
using AnimatorController = UnityEditor.Animations.AnimatorController;
using AnimatorControllerParameterType = UnityEngine.AnimatorControllerParameterType;
[CustomEditor(typeof(ABI.CCK.Components.AnimatorDriver))]
public class CCK_AnimatorDriverEditor : UnityEditor.Editor
{
private AnimatorDriver _animatorDriver;
private ReorderableList _onEnterList;
private ReorderableList _onExitList;
private List<string> animatorParamNames = new List<string>();
private List<string> animatorParamNamesDisplay = new List<string>();
private List<AnimatorDriverTask.ParameterType> animatorParamTypes = new List<AnimatorDriverTask.ParameterType>();
public override void OnInspectorGUI()
{
if (_animatorDriver == null) _animatorDriver = (AnimatorDriver) target;
animatorParamNames.Clear();
animatorParamNamesDisplay.Clear();
animatorParamTypes.Clear();
animatorParamNames.Add("- None -");
animatorParamNamesDisplay.Add("- None -");
animatorParamTypes.Add(AnimatorDriverTask.ParameterType.None);
var behaviorContext = AnimatorController.FindStateMachineBehaviourContext(_animatorDriver);
if (behaviorContext.Length > 0)
{
var controller = behaviorContext[0].animatorController;
foreach (var parameter in controller.parameters)
{
switch (parameter.type)
{
case AnimatorControllerParameterType.Bool:
animatorParamNames.Add($"{parameter.name}");
animatorParamNamesDisplay.Add($"{parameter.name} (Bool)");
animatorParamTypes.Add(AnimatorDriverTask.ParameterType.Bool);
break;
case AnimatorControllerParameterType.Float:
animatorParamNames.Add($"{parameter.name}");
animatorParamNamesDisplay.Add($"{parameter.name} (Float)");
animatorParamTypes.Add(AnimatorDriverTask.ParameterType.Float);
break;
case AnimatorControllerParameterType.Int:
animatorParamNames.Add($"{parameter.name}");
animatorParamNamesDisplay.Add($"{parameter.name} (Int)");
animatorParamTypes.Add(AnimatorDriverTask.ParameterType.Int);
break;
case AnimatorControllerParameterType.Trigger:
animatorParamNames.Add($"{parameter.name}");
animatorParamNamesDisplay.Add($"{parameter.name} (Trigger)");
animatorParamTypes.Add(AnimatorDriverTask.ParameterType.Trigger);
break;
}
}
}
if (_onEnterList == null)
{
_onEnterList = new ReorderableList(_animatorDriver.EnterTasks, typeof(AnimatorDriverTask),
true, true, true, true);
_onEnterList.drawHeaderCallback = OnDrawHeaderTaskEnter;
_onEnterList.drawElementCallback = OnDrawElementTaskEnter;
_onEnterList.elementHeightCallback = OnHeightElementTaskEnter;
}
_onEnterList.DoLayoutList();
if (_onExitList == null)
{
_onExitList = new ReorderableList(_animatorDriver.ExitTasks, typeof(AnimatorDriverTask),
true, true, true, true);
_onExitList.drawHeaderCallback = OnDrawHeaderTaskExit;
_onExitList.drawElementCallback = OnDrawElementTaskExit;
_onExitList.elementHeightCallback = OnHeightElementTaskExit;
}
_onExitList.DoLayoutList();
}
private void OnDrawHeaderTaskEnter(Rect rect)
{
Rect _rect = new Rect(rect.x, rect.y, rect.width, EditorGUIUtility.singleLineHeight);
GUI.Label(_rect, "On Enter State");
}
private void OnDrawElementTaskEnter(Rect rect, int index, bool isactive, bool isfocused)
{
if (index > _animatorDriver.EnterTasks.Count) return;
AnimatorDriverTask element = _animatorDriver.EnterTasks[index];
RenderTask(rect, element);
}
private float OnHeightElementTaskEnter(int index)
{
int length = 3;
if (index > _animatorDriver.EnterTasks.Count) return 1.25f * length * EditorGUIUtility.singleLineHeight;
AnimatorDriverTask task = _animatorDriver.EnterTasks[index];
return (length + TaskHeight(task)) * 1.25f * EditorGUIUtility.singleLineHeight;
}
private void OnDrawHeaderTaskExit(Rect rect)
{
Rect _rect = new Rect(rect.x, rect.y, rect.width, EditorGUIUtility.singleLineHeight);
GUI.Label(_rect, "On Exit State");
}
private void OnDrawElementTaskExit(Rect rect, int index, bool isactive, bool isfocused)
{
if (index > _animatorDriver.ExitTasks.Count) return;
AnimatorDriverTask element = _animatorDriver.ExitTasks[index];
RenderTask(rect, element);
}
private float OnHeightElementTaskExit(int index)
{
int length = 3;
if (index > _animatorDriver.ExitTasks.Count) return 1.25f * length * EditorGUIUtility.singleLineHeight;
AnimatorDriverTask task = _animatorDriver.ExitTasks[index];
return (length + TaskHeight(task)) * 1.25f * EditorGUIUtility.singleLineHeight;
}
private int TaskHeight(AnimatorDriverTask task)
{
int length = 0;
switch (task.aType)
{
case AnimatorDriverTask.SourceType.Static:
case AnimatorDriverTask.SourceType.Parameter:
length += 1;
break;
case AnimatorDriverTask.SourceType.Random:
length += 2;
break;
}
if (task.op != AnimatorDriverTask.Operator.Set)
{
length += 1;
switch (task.bType)
{
case AnimatorDriverTask.SourceType.Static:
case AnimatorDriverTask.SourceType.Parameter:
length += 1;
break;
case AnimatorDriverTask.SourceType.Random:
length += 2;
break;
}
}
length += 1;
return length;
}
private void RenderTask(Rect rect, AnimatorDriverTask task)
{
string formulaDisplay = "";
Rect _rect = new Rect(rect.x, rect.y, 100, EditorGUIUtility.singleLineHeight);
int parameterIndex = Math.Max(animatorParamNames.FindIndex(m => m == task.targetName), 0);
EditorGUI.LabelField(_rect, "Parameter");
_rect.x += 100;
_rect.width = rect.width - 100;
int selectedIndex = EditorGUI.Popup(_rect, parameterIndex, animatorParamNamesDisplay.ToArray());
task.targetType = animatorParamTypes[selectedIndex];
task.targetName = animatorParamNames[selectedIndex];
formulaDisplay = $"{task.targetName} = ";
rect.y += EditorGUIUtility.singleLineHeight * 1.25f;
_rect = new Rect(rect.x, rect.y, 100, EditorGUIUtility.singleLineHeight);
EditorGUI.LabelField(_rect, "Operation");
_rect.x += 100;
_rect.width = rect.width - 100;
task.op = (AnimatorDriverTask.Operator) EditorGUI.EnumPopup(_rect, task.op);
rect.y += EditorGUIUtility.singleLineHeight * 1.25f;
_rect = new Rect(rect.x, rect.y, 100, EditorGUIUtility.singleLineHeight);
EditorGUI.LabelField(_rect, "A Type");
_rect.x += 100;
_rect.width = rect.width - 100;
task.aType = (AnimatorDriverTask.SourceType) EditorGUI.EnumPopup(_rect, task.aType);
rect.y += EditorGUIUtility.singleLineHeight * 1.25f;
_rect = new Rect(rect.x, rect.y, 100, EditorGUIUtility.singleLineHeight);
switch (task.aType)
{
case AnimatorDriverTask.SourceType.Static:
EditorGUI.LabelField(_rect, "A Value");
_rect.x += 100;
_rect.width = rect.width - 100;
task.aValue = EditorGUI.FloatField(_rect, task.aValue);
formulaDisplay += $"{task.aValue} ";
break;
case AnimatorDriverTask.SourceType.Parameter:
parameterIndex = Math.Max(animatorParamNames.FindIndex(m => m == task.aName), 0);
EditorGUI.LabelField(_rect, "Parameter A");
_rect.x += 100;
_rect.width = rect.width - 100;
selectedIndex = EditorGUI.Popup(_rect, parameterIndex, animatorParamNamesDisplay.ToArray());
task.aParamType = animatorParamTypes[selectedIndex];
task.aName = animatorParamNames[selectedIndex];
formulaDisplay += $"{task.aName} ";
break;
case AnimatorDriverTask.SourceType.Random:
EditorGUI.LabelField(_rect, "A Min");
_rect.x += 100;
_rect.width = rect.width - 100;
task.aValue = EditorGUI.FloatField(_rect, task.aValue);
rect.y += EditorGUIUtility.singleLineHeight * 1.25f;
_rect = new Rect(rect.x, rect.y, 100, EditorGUIUtility.singleLineHeight);
EditorGUI.LabelField(_rect, "A Max");
_rect.x += 100;
_rect.width = rect.width - 100;
task.aMax = Convert.ToSingle(EditorGUI.TextField(_rect, task.aMax.ToString()));
formulaDisplay += $"Rand({task.aValue}, {task.aMax}) ";
break;
}
if (task.op != AnimatorDriverTask.Operator.Set)
{
rect.y += EditorGUIUtility.singleLineHeight * 1.25f;
_rect = new Rect(rect.x, rect.y, 100, EditorGUIUtility.singleLineHeight);
switch (task.op)
{
case AnimatorDriverTask.Operator.Addition:
formulaDisplay += "+ ";
break;
case AnimatorDriverTask.Operator.Subtraction:
formulaDisplay += "- ";
break;
case AnimatorDriverTask.Operator.Multiplication:
formulaDisplay += "* ";
break;
case AnimatorDriverTask.Operator.Division:
formulaDisplay += "/ ";
break;
case AnimatorDriverTask.Operator.Modulo:
formulaDisplay += "% ";
break;
case AnimatorDriverTask.Operator.Power:
formulaDisplay += "pow ";
break;
case AnimatorDriverTask.Operator.Log:
formulaDisplay += "log ";
break;
case AnimatorDriverTask.Operator.Equal:
formulaDisplay += "== ";
break;
case AnimatorDriverTask.Operator.LessThen:
formulaDisplay += "< ";
break;
case AnimatorDriverTask.Operator.LessEqual:
formulaDisplay += "<= ";
break;
case AnimatorDriverTask.Operator.MoreThen:
formulaDisplay += "> ";
break;
case AnimatorDriverTask.Operator.MoreEqual:
formulaDisplay += ">= ";
break;
case AnimatorDriverTask.Operator.NotEqual:
formulaDisplay += "!= ";
break;
}
EditorGUI.LabelField(_rect, "B Type");
_rect.x += 100;
_rect.width = rect.width - 100;
task.bType = (AnimatorDriverTask.SourceType) EditorGUI.EnumPopup(_rect, task.bType);
rect.y += EditorGUIUtility.singleLineHeight * 1.25f;
_rect = new Rect(rect.x, rect.y, 100, EditorGUIUtility.singleLineHeight);
switch (task.bType)
{
case AnimatorDriverTask.SourceType.Static:
EditorGUI.LabelField(_rect, "B Value");
_rect.x += 100;
_rect.width = rect.width - 100;
task.bValue = EditorGUI.FloatField(_rect, task.bValue);
formulaDisplay += $"{task.bValue} ";
break;
case AnimatorDriverTask.SourceType.Parameter:
parameterIndex = Math.Max(animatorParamNames.FindIndex(m => m == task.bName), 0);
EditorGUI.LabelField(_rect, "Parameter B");
_rect.x += 100;
_rect.width = rect.width - 100;
selectedIndex = EditorGUI.Popup(_rect, parameterIndex, animatorParamNamesDisplay.ToArray());
task.bParamType = animatorParamTypes[selectedIndex];
task.bName = animatorParamNames[selectedIndex];
formulaDisplay += $"{task.bName} ";
break;
case AnimatorDriverTask.SourceType.Random:
EditorGUI.LabelField(_rect, "B Min");
_rect.x += 100;
_rect.width = rect.width - 100;
task.bValue = EditorGUI.FloatField(_rect, task.bValue);
rect.y += EditorGUIUtility.singleLineHeight * 1.25f;
_rect = new Rect(rect.x, rect.y, 100, EditorGUIUtility.singleLineHeight);
EditorGUI.LabelField(_rect, "B Max");
_rect.x += 100;
_rect.width = rect.width - 100;
task.bMax = Convert.ToSingle(EditorGUI.TextField(_rect, task.bMax.ToString()));
formulaDisplay += $"Rand({task.bValue}, {task.bMax}) ";
break;
}
}
var boldtext = new GUIStyle (GUI.skin.label);
boldtext.fontStyle = FontStyle.Bold;
rect.y += EditorGUIUtility.singleLineHeight * 1.25f;
_rect = new Rect(rect.x, rect.y, rect.width, EditorGUIUtility.singleLineHeight);
EditorGUI.LabelField(_rect, task.targetName == "- None -"?"Parameter = A":formulaDisplay, boldtext);
}
}

View file

@ -1,3 +0,0 @@
fileFormatVersion: 2
guid: cf1a3cb4c93d41c9b01fcf9f128fbca2
timeCreated: 1685439016

View file

@ -23,9 +23,9 @@ namespace ABI.CCK.Scripts.Editor
[InitializeOnLoad]
public class CCK_BuildManagerWindow : EditorWindow
{
public static string Version = "3.5 RELEASE";
public static int BuildID = 98;
private const string CCKVersion = "3.5 RELEASE (Build 98)";
public static string Version = "3.4 RELEASE";
public static int BuildID = 90;
private const string CCKVersion = "3.4 RELEASE (Build 92)";
private string[] SupportedUnityVersions = new[]
{
@ -34,11 +34,7 @@ namespace ABI.CCK.Scripts.Editor
"2019.4.13f1", "2019.4.14f1", "2019.4.15f1", "2019.4.16f1", "2019.4.17f1", "2019.4.18f1",
"2019.4.19f1", "2019.4.20f1", "2019.4.21f1", "2019.4.22f1", "2019.4.23f1", "2019.4.24f1",
"2019.4.25f1", "2019.4.26f1", "2019.4.27f1", "2019.4.28f1", "2019.4.29f1", "2019.4.30f1",
"2019.4.31f1",
"2021.3.1f1", "2021.3.2f1", "2021.3.3f1", "2021.3.4f1", "2021.3.5f1", "2021.3.6f1", "2021.3.7f1",
"2021.3.8f1", "2021.3.9f1", "2021.3.10f1", "2021.3.11f1", "2021.3.12f1", "2021.3.13f1", "2021.3.14f1",
"2021.3.15f1", "2021.3.16f1", "2021.3.17f1", "2021.3.18f1", "2021.3.19f1", "2021.3.20f1", "2021.3.21f1",
"2021.3.22f1", "2021.3.23f1", "2021.3.24f1"
"2019.4.31f1"
};
string _username;
@ -112,41 +108,13 @@ namespace ABI.CCK.Scripts.Editor
{
EditorPrefs.SetBool("m_ABI_isBuilding", false);
EditorPrefs.SetString("m_ABI_TempVersion", Version);
string[] filePaths = Directory.GetFiles(Application.dataPath + "/ABI.CCK/Resources/Cache/", "*.prefab");
foreach (string filePath in filePaths)
{
File.Delete(filePath);
}
filePaths = Directory.GetFiles(Application.persistentDataPath + "/", "*.cvravatar");
foreach (string filePath in filePaths)
{
File.Delete(filePath);
}
filePaths = Directory.GetFiles(Application.persistentDataPath + "/", "*.cvravatar.manifest");
foreach (string filePath in filePaths)
{
File.Delete(filePath);
}
filePaths = Directory.GetFiles(Application.persistentDataPath + "/", "*.cvrprop");
foreach (string filePath in filePaths)
{
File.Delete(filePath);
}
filePaths = Directory.GetFiles(Application.persistentDataPath + "/", "*.cvrprop.manifest");
foreach (string filePath in filePaths)
{
File.Delete(filePath);
}
/*if (File.Exists(Application.persistentDataPath + "/bundle.cvravatar")) File.Delete(Application.persistentDataPath + "/bundle.cvravatar");
if (File.Exists(Application.dataPath + "/ABI.CCK/Resources/Cache/_CVRAvatar.prefab")) File.Delete(Application.dataPath + "/ABI.CCK/Resources/Cache/_CVRAvatar.prefab");
if (File.Exists(Application.dataPath + "/ABI.CCK/Resources/Cache/_CVRSpawnable.prefab")) File.Delete(Application.dataPath + "/ABI.CCK/Resources/Cache/_CVRSpawnable.prefab");
if (File.Exists(Application.dataPath + "/ABI.CCK/Resources/Cache/_CVRWorld.prefab")) File.Delete(Application.dataPath + "/ABI.CCK/Resources/Cache/_CVRWorld.prefab");
if (File.Exists(Application.persistentDataPath + "/bundle.cvravatar")) File.Delete(Application.persistentDataPath + "/bundle.cvravatar");
if (File.Exists(Application.persistentDataPath + "/bundle.cvravatar.manifest")) File.Delete(Application.persistentDataPath + "/bundle.cvravatar.manifest");
if (File.Exists(Application.persistentDataPath + "/bundle.cvrprop")) File.Delete(Application.persistentDataPath + "/bundle.cvrprop");
if (File.Exists(Application.persistentDataPath + "/bundle.cvrprop.manifest")) File.Delete(Application.persistentDataPath + "/bundle.cvrprop.manifest");*/
if (File.Exists(Application.persistentDataPath + "/bundle.cvrprop.manifest")) File.Delete(Application.persistentDataPath + "/bundle.cvrprop.manifest");
if (File.Exists(Application.persistentDataPath + "/bundle.cvrworld")) File.Delete(Application.persistentDataPath + "/bundle.cvrworld");
if (File.Exists(Application.persistentDataPath + "/bundle.cvrworld.manifest")) File.Delete(Application.persistentDataPath + "/bundle.cvrworld.manifest");
if (File.Exists(Application.persistentDataPath + "/bundle.png")) File.Delete(Application.persistentDataPath + "/bundle.png");
@ -160,15 +128,10 @@ namespace ABI.CCK.Scripts.Editor
if (state == PlayModeStateChange.EnteredPlayMode && EditorPrefs.GetBool("m_ABI_isBuilding"))
{
CCK_BuildUtility.upload_id = EditorPrefs.GetString("m_ABI_uploadId");
string randomNum = EditorPrefs.GetString("m_ABI_uploadRand");
var ui = Instantiate(AssetDatabase.LoadAssetAtPath<GameObject>("Assets/ABI.CCK/GUIAssets/CCK_UploaderHead.prefab"));
OnGuiUpdater up = ui.GetComponentInChildren<OnGuiUpdater>();
if (File.Exists(Application.dataPath + "/ABI.CCK/Resources/Cache/_CVRAvatar.prefab"))up.asset = Resources.Load<GameObject>("Cache/_CVRAvatar").GetComponent<CVRAssetInfo>();
if (File.Exists(Application.dataPath + $"/ABI.CCK/Resources/Cache/CVRAvatar_{CCK_BuildUtility.upload_id}_{randomNum}.prefab"))up.asset = Resources.Load<GameObject>($"Cache/CVRAvatar_{CCK_BuildUtility.upload_id}_{randomNum}").GetComponent<CVRAssetInfo>();
if (File.Exists(Application.dataPath + "/ABI.CCK/Resources/Cache/_CVRSpawnable.prefab"))up.asset = Resources.Load<GameObject>("Cache/_CVRSpawnable").GetComponent<CVRAssetInfo>();
if (File.Exists(Application.dataPath + $"/ABI.CCK/Resources/Cache/CVRSpawnable_{CCK_BuildUtility.upload_id}_{randomNum}.prefab"))up.asset = Resources.Load<GameObject>($"Cache/CVRSpawnable_{CCK_BuildUtility.upload_id}_{randomNum}").GetComponent<CVRAssetInfo>();
if (File.Exists(Application.dataPath + "/ABI.CCK/Resources/Cache/_CVRWorld.prefab"))up.asset = Resources.Load<GameObject>("Cache/_CVRWorld").GetComponent<CVRAssetInfo>();
}
}
@ -727,14 +690,25 @@ namespace ABI.CCK.Scripts.Editor
{
_attemptingToLogin = true;
APIConnection.Initialize(_username, _key);
APIConnection.BaseResponse<APIConnection.UserinfoResponse> response = await APIConnection.MakeRequest<APIConnection.UserinfoResponse>("cck/userinfo");
using (HttpClient httpclient = new HttpClient())
{
HttpResponseMessage response;
response = await httpclient.PostAsync(
"https://api.abinteractive.net/1/cck/validateKey",
new StringContent(JsonConvert.SerializeObject(new {Username = _username, AccessKey = _key}),
Encoding.UTF8, "application/json")
);
if (response != null)
if (response.IsSuccessStatusCode)
{
if (response.Data != null)
string result = await response.Content.ReadAsStringAsync();
BaseResponse<LoginResponse> usr = Abi.Newtonsoft.Json.JsonConvert.DeserializeObject<BaseResponse<LoginResponse>>(result);
if (usr == null || usr.Data == null) return;
if (usr.Data.isValidCredentials)
{
_apiUserRank = response.Data.UserRank;
_apiUserRank = usr.Data.userRank;
Debug.Log("[ABI:CCK] Successfully authenticated as " + _username + " using AlphaLink Public API.");
EditorPrefs.SetString("m_ABI_Username", _username);
EditorPrefs.SetString("m_ABI_Key", _key);
@ -743,14 +717,44 @@ namespace ABI.CCK.Scripts.Editor
}
else
{
Debug.Log("[ABI:CCK] Unable to authenticate using provided credentials. API responded with: " + response.Message + ".");
Debug.Log("[ABI:CCK] Unable to authenticate using provided credentials. API responded with: " + usr.Message + ".");
_loggedIn = false;
_hasAttemptedToLogin = true;
_username = _key = string.Empty;
}
}
else
{
Debug.LogError("[ABI:CCK] Web Request Error while trying to authenticate.");
}
}
_attemptingToLogin = false;
}
}
}
public class LoginResponse
{
public bool isValidCredentials { get; set; }
public bool isAccountUnlocked { get; set; }
public string userId { get; set; }
public string userRank { get; set; }
}
public class BaseResponse<T>
{
public string Message { get; set; }
public T Data { get; set; }
public BaseResponse(string message = null, T data = default)
{
Message = message;
Data = data;
}
public override string ToString()
{
return JsonConvert.SerializeObject(this);
}
}
}

View file

@ -1,14 +1,11 @@
using System;
using System.Collections;
using System.Collections.Generic;
using System.Threading.Tasks;
using ABI.CCK.Components;
using UnityEditor;
using UnityEditor.SceneManagement;
using UnityEngine;
using UnityEngine.Events;
using UnityEngine.SceneManagement;
using Random = System.Random;
namespace ABI.CCK.Scripts.Editor
{
@ -17,9 +14,7 @@ namespace ABI.CCK.Scripts.Editor
public static PreAvatarBundleEvent PreAvatarBundleEvent = new PreAvatarBundleEvent();
public static PrePropBundleEvent PrePropBundleEvent = new PrePropBundleEvent();
public static string upload_id = "";
public static async Task BuildAndUploadAvatar(GameObject avatarObject)
public static void BuildAndUploadAvatar(GameObject avatarObject)
{
//GameObject avatarCopy = null;
var origInfo = avatarObject.GetComponent<CVRAssetInfo>();
@ -38,27 +33,8 @@ namespace ABI.CCK.Scripts.Editor
//CVRAssetInfo info = avatarCopy.GetComponent<CVRAssetInfo>();
if (string.IsNullOrEmpty(origInfo.objectId))
{
#if UNITY_EDITOR
APIConnection.Initialize(EditorPrefs.GetString("m_ABI_Username"), EditorPrefs.GetString("m_ABI_Key"));
#endif
APIConnection.BaseResponse<APIConnection.GenerateResponse> response = await APIConnection.MakeRequest<APIConnection.GenerateResponse>("cck/generate/avatar", put: true);
if (response != null && response.Data != null)
{
origInfo.objectId = response.Data.Id.ToString();
}
else
{
Debug.LogError($"[CCK:BuildUtility] New Guid could not be generated");
}
}
Random rnd = new Random();
origInfo.randomNum = rnd.Next(11111111, 99999999).ToString();
EditorUtility.SetDirty(origInfo);
origInfo.objectId = Guid.NewGuid().ToString();
//origInfo.guid = info.guid;
try
{
PrefabUtility.ApplyPrefabInstance(avatarObject, InteractionMode.UserAction);
@ -67,6 +43,7 @@ namespace ABI.CCK.Scripts.Editor
{
Debug.Log("[CCK:BuildUtility] Object is not a prefab. No need to Apply To Instance.");
}
}
PreAvatarBundleEvent.Invoke(avatarObject);
@ -74,10 +51,7 @@ namespace ABI.CCK.Scripts.Editor
EditorSceneManager.SaveScene(EditorSceneManager.GetActiveScene());
if (!Application.unityVersion.Contains("2021"))
PrefabUtility.SaveAsPrefabAsset(avatarObject, "Assets/ABI.CCK/Resources/Cache/_CVRAvatar.prefab");
else
PrefabUtility.SaveAsPrefabAsset(avatarObject, $"Assets/ABI.CCK/Resources/Cache/CVRAvatar_{origInfo.objectId}_{origInfo.randomNum}.prefab");
//GameObject.DestroyImmediate(avatarCopy);
EditorSceneManager.MarkSceneDirty(EditorSceneManager.GetActiveScene());
@ -85,19 +59,11 @@ namespace ABI.CCK.Scripts.Editor
EditorSceneManager.SaveScene(EditorSceneManager.GetActiveScene());
AssetBundleBuild assetBundleBuild = new AssetBundleBuild();
if (!Application.unityVersion.Contains("2021"))
assetBundleBuild.assetNames = new[] {"Assets/ABI.CCK/Resources/Cache/_CVRAvatar.prefab"};
else
assetBundleBuild.assetNames = new[] {$"Assets/ABI.CCK/Resources/Cache/CVRAvatar_{origInfo.objectId}_{origInfo.randomNum}.prefab"};
upload_id = origInfo.objectId;
EditorPrefs.SetString("m_ABI_uploadId", upload_id);
EditorPrefs.SetString("m_ABI_uploadRand", origInfo.randomNum);
assetBundleBuild.assetBundleName = $"cvravatar_{origInfo.objectId}_{origInfo.randomNum}.cvravatar";
assetBundleBuild.assetBundleName = "bundle.cvravatar";
BuildPipeline.BuildAssetBundles(Application.persistentDataPath, new[] {assetBundleBuild},
BuildAssetBundleOptions.ChunkBasedCompression, EditorUserBuildSettings.activeBuildTarget);
BuildAssetBundleOptions.None, EditorUserBuildSettings.activeBuildTarget);
AssetDatabase.Refresh();
@ -105,35 +71,13 @@ namespace ABI.CCK.Scripts.Editor
EditorApplication.isPlaying = true;
}
public static async Task BuildAndUploadSpawnable(GameObject s)
public static void BuildAndUploadSpawnable(GameObject s)
{
GameObject sCopy = null;
var origInfo = s.GetComponent<CVRAssetInfo>();
var spawnable = s.GetComponent<CVRSpawnable>();
spawnable.spawnableType = CVRSpawnable.SpawnableType.StandaloneSpawnable;
if (string.IsNullOrEmpty(origInfo.objectId))
{
#if UNITY_EDITOR
APIConnection.Initialize(EditorPrefs.GetString("m_ABI_Username"), EditorPrefs.GetString("m_ABI_Key"));
#endif
APIConnection.BaseResponse<APIConnection.GenerateResponse> response = await APIConnection.MakeRequest<APIConnection.GenerateResponse>("cck/generate/spawnable", put: true);
if (response != null && response.Data != null)
{
origInfo.objectId = response.Data.Id.ToString();
}
else
{
Debug.LogError($"[CCK:BuildUtility] New Guid could not be generated");
}
}
Random rnd = new Random();
origInfo.randomNum = rnd.Next(11111111, 99999999).ToString();
EditorUtility.SetDirty(origInfo);
PrePropBundleEvent.Invoke(s);
try
@ -148,7 +92,10 @@ namespace ABI.CCK.Scripts.Editor
}
CVRAssetInfo info = sCopy.GetComponent<CVRAssetInfo>();
if (string.IsNullOrEmpty(info.objectId))
{
info.objectId = Guid.NewGuid().ToString();
origInfo.objectId = info.objectId;
try
{
PrefabUtility.ApplyPrefabInstance(s, InteractionMode.UserAction);
@ -157,16 +104,13 @@ namespace ABI.CCK.Scripts.Editor
{
Debug.Log("[CCK:BuildUtility] Object is not a prefab. No need to Apply To Instance.");
}
}
EditorSceneManager.MarkSceneDirty(EditorSceneManager.GetActiveScene());
EditorSceneManager.SaveScene(EditorSceneManager.GetActiveScene());
if (!Application.unityVersion.Contains("2021"))
PrefabUtility.SaveAsPrefabAsset(sCopy, "Assets/ABI.CCK/Resources/Cache/_CVRSpawnable.prefab");
else
PrefabUtility.SaveAsPrefabAsset(sCopy, $"Assets/ABI.CCK/Resources/Cache/CVRSpawnable_{origInfo.objectId}_{origInfo.randomNum}.prefab");
GameObject.DestroyImmediate(sCopy);
EditorSceneManager.MarkSceneDirty(EditorSceneManager.GetActiveScene());
@ -174,20 +118,11 @@ namespace ABI.CCK.Scripts.Editor
EditorSceneManager.SaveScene(EditorSceneManager.GetActiveScene());
AssetBundleBuild assetBundleBuild = new AssetBundleBuild();
if (!Application.unityVersion.Contains("2021"))
assetBundleBuild.assetNames = new[] {"Assets/ABI.CCK/Resources/Cache/_CVRSpawnable.prefab"};
else
assetBundleBuild.assetNames = new[] {$"Assets/ABI.CCK/Resources/Cache/CVRSpawnable_{origInfo.objectId}_{origInfo.randomNum}.prefab"};
upload_id = origInfo.objectId;
EditorPrefs.SetString("m_ABI_uploadId", upload_id);
EditorPrefs.SetString("m_ABI_uploadRand", origInfo.randomNum);
assetBundleBuild.assetBundleName = $"cvrspawnable_{origInfo.objectId}_{origInfo.randomNum}.cvrprop";
assetBundleBuild.assetBundleName = "bundle.cvrprop";
BuildPipeline.BuildAssetBundles(Application.persistentDataPath, new[] {assetBundleBuild},
BuildAssetBundleOptions.ChunkBasedCompression, EditorUserBuildSettings.activeBuildTarget);
BuildAssetBundleOptions.None, EditorUserBuildSettings.activeBuildTarget);
AssetDatabase.Refresh();
@ -195,35 +130,17 @@ namespace ABI.CCK.Scripts.Editor
EditorApplication.isPlaying = true;
}
public static async Task BuildAndUploadMapAsset(Scene scene, GameObject descriptor)
public static void BuildAndUploadMapAsset(Scene scene, GameObject descriptor)
{
SetupNetworkUUIDs();
CVRAssetInfo info = descriptor.GetComponent<CVRAssetInfo>();
if (string.IsNullOrEmpty(info.objectId))
{
#if UNITY_EDITOR
APIConnection.Initialize(EditorPrefs.GetString("m_ABI_Username"), EditorPrefs.GetString("m_ABI_Key"));
#endif
APIConnection.BaseResponse<APIConnection.GenerateResponse> response = await APIConnection.MakeRequest<APIConnection.GenerateResponse>("cck/generate/world", put: true);
if (response != null && response.Data != null)
{
info.objectId = response.Data.Id.ToString();
EditorUtility.SetDirty(info);
}
else
{
Debug.LogError($"[CCK:BuildUtility] New Guid could not be generated");
}
}
EditorSceneManager.MarkSceneDirty(scene);
EditorSceneManager.SaveScene(EditorSceneManager.GetActiveScene());
CVRAssetInfo info = descriptor.GetComponent<CVRAssetInfo>();
if (string.IsNullOrEmpty(info.objectId)) info.objectId = Guid.NewGuid().ToString();
PrefabUtility.SaveAsPrefabAsset(descriptor, "Assets/ABI.CCK/Resources/Cache/_CVRWorld.prefab");
AssetBundleBuild assetBundleBuild = new AssetBundleBuild();
@ -231,7 +148,7 @@ namespace ABI.CCK.Scripts.Editor
assetBundleBuild.assetBundleName = "bundle.cvrworld";
BuildPipeline.BuildAssetBundles(Application.persistentDataPath, new[] {assetBundleBuild},
BuildAssetBundleOptions.ChunkBasedCompression, EditorUserBuildSettings.activeBuildTarget);
BuildAssetBundleOptions.None, EditorUserBuildSettings.activeBuildTarget);
AssetDatabase.Refresh();

View file

@ -109,22 +109,8 @@ namespace ABI.CCK.Scripts.Editor
if (_driver.animators[index] != null && _driver.animators[index].runtimeAnimatorController != null)
{
var runtimeController = _driver.animators[index].runtimeAnimatorController;
UnityEngine.AnimatorControllerParameter[] parameters = null;
if (runtimeController is AnimatorController animatorController)
{
parameters = animatorController.parameters;
}
else if (runtimeController is AnimatorOverrideController overrideController &&
overrideController.runtimeAnimatorController is AnimatorController baseController)
{
parameters = baseController.parameters;
}
if (parameters != null)
{
foreach (var parameter in parameters)
var controller = (AnimatorController) _driver.animators[index].runtimeAnimatorController;
foreach (var parameter in controller.parameters)
{
animatorParamNameList.Add(parameter.name);
animatorParamTypeList.Add(parameter.type);
@ -137,7 +123,6 @@ namespace ABI.CCK.Scripts.Editor
i++;
}
}
}
EditorGUI.BeginChangeCheck();

View file

@ -105,9 +105,6 @@ namespace ABI.CCK.Scripts.Editor
_avatar.visemeMode = (CVRAvatar.CVRAvatarVisemeMode) EditorGUILayout.EnumPopup("Lip Sync Mode", _avatar.visemeMode);
if (_avatar.visemeMode == CVRAvatar.CVRAvatarVisemeMode.Visemes)
_avatar.visemeSmoothing = EditorGUILayout.IntSlider("Viseme Smoothing", _avatar.visemeSmoothing, 0, 100);
if (_avatar.visemeBlendshapes == null || _avatar.visemeBlendshapes.Length != _visemeNames.Length)
_avatar.visemeBlendshapes = new string[_visemeNames.Length];
@ -156,7 +153,7 @@ namespace ABI.CCK.Scripts.Editor
if (_avatar.enableAdvancedTagging)
{
EditorGUILayout.HelpBox("If you are using the Advanced Tagging System, you do not need to Tag your Avatar appropriately if you mark all affected GameObjects here.", MessageType.Info);
EditorGUILayout.HelpBox("Attention! If you are using the Advanced Tagging System, you still need to Tag your Avatar appropriately and Set all affected GameObjects here.", MessageType.Warning);
if (taggingList == null) InitializeTaggingList();
taggingList.DoLayoutList();
@ -432,7 +429,7 @@ namespace ABI.CCK.Scripts.Editor
float height = 10.50f;
if (gameObjectToggle.useAnimationClip)
{
//height -= 1.25f;
height -= 1.25f;
}
else
{
@ -784,15 +781,6 @@ namespace ABI.CCK.Scripts.Editor
_rect.x += 100;
_rect.width = rect.width - 100;
gameObjectToggle.animationClip = (AnimationClip)EditorGUI.ObjectField(_rect, gameObjectToggle.animationClip, typeof(AnimationClip), true);
rect.y += EditorGUIUtility.singleLineHeight * 1.25f;
_rect = new Rect(rect.x, rect.y, 100, EditorGUIUtility.singleLineHeight);
// Animation Clip Slot
EditorGUI.LabelField(_rect, "Off Clip");
_rect.x += 100;
_rect.width = rect.width - 100;
gameObjectToggle.offAnimationClip = (AnimationClip)EditorGUI.ObjectField(_rect, gameObjectToggle.offAnimationClip, typeof(AnimationClip), true);
}
else
{

View file

@ -455,12 +455,6 @@ namespace ABI.CCK.Scripts.Editor
break;
case CVRInteractableActionOperation.ActionType.DisplaySpawnableDetailPage:
trigger.operations[j].stringVal = EditorGUILayout.TextField("Spawnable GUID:", trigger.operations[j].stringVal);
break;
case CVRInteractableActionOperation.ActionType.SitAtPosition:
trigger.operations[j].gameObjectVal = (GameObject)EditorGUILayout.ObjectField(

View file

@ -133,7 +133,7 @@ public class CCK_CVR_VideoPlayerEditor : Editor
{
#region General settings
_showGeneral = EditorGUILayout.Foldout(_showGeneral, "General");
_showGeneral = EditorGUILayout.BeginFoldoutHeaderGroup(_showGeneral, "General");
if (_showGeneral)
{
_player.syncEnabled = EditorGUILayout.Toggle("Network Sync", _player.syncEnabled);
@ -170,11 +170,14 @@ public class CCK_CVR_VideoPlayerEditor : Editor
EditorGUILayout.Space();
}
EditorGUILayout.EndFoldoutHeaderGroup();
#endregion
#region Audio settings
_showAudio = EditorGUILayout.Foldout(_showAudio, "Audio");
_showAudio = EditorGUILayout.BeginFoldoutHeaderGroup(_showAudio, "Audio");
if (_showAudio)
{
_player.playbackVolume = EditorGUILayout.Slider("Playback Volume", _player.playbackVolume, 0.0f, 1.0f);
@ -188,11 +191,14 @@ public class CCK_CVR_VideoPlayerEditor : Editor
EditorGUILayout.Space();
}
EditorGUILayout.EndFoldoutHeaderGroup();
#endregion
#region Playlists
_showPlaylists = EditorGUILayout.Foldout(_showPlaylists, "Playlists");
_showPlaylists = EditorGUILayout.BeginFoldoutHeaderGroup(_showPlaylists, "Playlists");
if (_showPlaylists)
{
EditorGUILayout.LabelField(new GUIContent("Play On Awake Object", "Default video to play on start/awake"), new GUIContent(_player.playOnAwakeObject?.videoTitle));
@ -205,11 +211,14 @@ public class CCK_CVR_VideoPlayerEditor : Editor
EditorGUILayout.Space();
}
EditorGUILayout.EndFoldoutHeaderGroup();
#endregion
#region Events
_showEvents = EditorGUILayout.BeginFoldoutHeaderGroup(_showEvents, "Events");
if (_showEvents)
{
serializedObject.Update();
@ -230,6 +239,8 @@ public class CCK_CVR_VideoPlayerEditor : Editor
EditorGUILayout.Space();
}
EditorGUILayout.EndFoldoutHeaderGroup();
#endregion
}
}

View file

@ -1,9 +1,7 @@
using System;
using System.Collections;
using System.Collections;
using System.Collections.Generic;
using UnityEditor;
using UnityEngine;
using UnityEngine.XR;
#pragma warning disable
@ -15,25 +13,13 @@ public class CCK_Init
void SetTag(SerializedProperty tags, string name, int index)
{
SerializedProperty sp = null;
try
{
sp = tags.GetArrayElementAtIndex(index);
}
catch{}
SerializedProperty sp = tags.GetArrayElementAtIndex(index);
if (sp != null) sp.stringValue = name;
}
void SetLayer(SerializedProperty layers, string name, int index)
{
SerializedProperty sp = null;
try
{
sp = layers.GetArrayElementAtIndex(index);
}
catch{}
SerializedProperty sp = layers.GetArrayElementAtIndex(index);
if (sp != null) sp.stringValue = name;
}
@ -87,33 +73,17 @@ public class CCK_Init
tagManager.ApplyModifiedProperties();
}
#if UNITY_2021_1_OR_NEWER
if (true)
#else
if (!PlayerSettings.virtualRealitySupported)
#endif
{
Debug.Log("[CCK:Init] XR and render settings have to be changed. Now changing.");
#if PLATFORM_ANDROID
if (EditorUserBuildSettings.activeBuildTarget != BuildTarget.Android)
EditorUserBuildSettings.SwitchActiveBuildTarget(BuildTargetGroup.Standalone, BuildTarget.Android);
#else
if (EditorUserBuildSettings.activeBuildTarget != BuildTarget.StandaloneWindows64)
EditorUserBuildSettings.SwitchActiveBuildTarget(BuildTargetGroup.Standalone, BuildTarget.StandaloneWindows64);
#endif
PlayerSettings.colorSpace = UnityEngine.ColorSpace.Linear;
PlayerSettings.apiCompatibilityLevel = ApiCompatibilityLevel.NET_4_6;
#if UNITY_2021_1_OR_NEWER
PlayerSettings.virtualRealitySupported = true;
PlayerSettings.stereoRenderingPath = StereoRenderingPath.Instancing;
XRSettings.enabled = false;
#else
PlayerSettings.virtualRealitySupported = true;
PlayerSettings.SetVirtualRealitySDKs(BuildTargetGroup.Standalone, new string[] { "None", "Oculus", "OpenVR", "MockHMD" });
PlayerSettings.stereoRenderingPath = StereoRenderingPath.SinglePass;
#endif
}
if (LayerMask.LayerToName(10) == "PlayerNetwork" && LayerMask.LayerToName(17) == "CVRPickup" && LayerMask.LayerToName(15) == "CVRReserved4" && PlayerSettings.virtualRealitySupported )

View file

@ -33,17 +33,17 @@ namespace ABI.CCK.Scripts.Runtime
var overwritePic = string.Empty;
if (!File.Exists($"{Application.persistentDataPath}/bundle.png")) gameObject.GetComponent<CCK_TexImageCreation>().SaveTexture(updater.camObj.GetComponent<Camera>(), updater.tex);
StartCoroutine(UploadAssetAndSendInformation(updater.asset.objectId, type.ToString(), sfwLevel, updater.assetName.text, updater.assetDesc.text, updater.dontOverridePicture.isOn, updater.asset.randomNum));
StartCoroutine(UploadAssetAndSendInformation(updater.asset.GetComponent<CVRAssetInfo>().objectId, type.ToString(), sfwLevel, updater.assetName.text, updater.assetDesc.text, updater.dontOverridePicture.isOn));
}
private IEnumerator UploadAssetAndSendInformation(string contentId, string type, string sfwLevel, string assetName, string assetDesc, bool overwritePic, string randomNum)
private IEnumerator UploadAssetAndSendInformation(string contentId, string type, string sfwLevel, string assetName, string assetDesc, bool overwritePic)
{
string[] path = null;
if (type == "Avatar")
{
path = new string[3];
path[0] = $"file://{Application.persistentDataPath}/cvravatar_{contentId}_{randomNum}.cvravatar";
path[1] = $"file://{Application.persistentDataPath}/cvravatar_{contentId}_{randomNum}.cvravatar.manifest";
path[0] = $"file://{Application.persistentDataPath}/bundle.cvravatar";
path[1] = $"file://{Application.persistentDataPath}/bundle.cvravatar.manifest";
path[2] = $"file://{Application.persistentDataPath}/bundle.png";
}
if (type == "World")
@ -58,8 +58,8 @@ namespace ABI.CCK.Scripts.Runtime
if (type == "Spawnable")
{
path = new string[3];
path[0] = $"file://{Application.persistentDataPath}/cvrspawnable_{contentId}_{randomNum}.cvrprop";
path[1] = $"file://{Application.persistentDataPath}/cvrspawnable_{contentId}_{randomNum}.cvrprop.manifest";
path[0] = $"file://{Application.persistentDataPath}/bundle.cvrprop";
path[1] = $"file://{Application.persistentDataPath}/bundle.cvrprop.manifest";
path[2] = $"file://{Application.persistentDataPath}/bundle.png";
}
@ -77,13 +77,6 @@ namespace ABI.CCK.Scripts.Runtime
form.AddField("ContentDescription", assetDesc);
form.AddField("ContentChangelog", updater.assetChangelog.text);
#if PLATFORM_ANDROID
form.AddField("Platform", "android_standalone");
#else
form.AddField("Platform", "pc_standalone");
#endif
form.AddField("CompatibilityVersion", Application.unityVersion.Contains("2021") ? 2 : 1);
if (updater.LoudAudio.isOn) form.AddField("Tag_LoudAudio", 1);
if (updater.LongRangeAudio.isOn) form.AddField("Tag_LongRangeAudio", 1);
if (updater.ContainsMusic.isOn) form.AddField("Tag_ContainsMusic", 1);

View file

@ -2,7 +2,6 @@ using System;
using System.Collections;
using System.Net.Http;
using System.Text;
using System.Threading.Tasks;
using Abi.Newtonsoft.Json;
using UnityEditor;
using UnityEngine;
@ -20,77 +19,164 @@ namespace ABI.CCK.Scripts.Runtime
{
OnGuiUpdater updater = gameObject.GetComponent<OnGuiUpdater>();
string type = updater.asset.type.ToString();
string uploadRegion = "0";
using (HttpClient httpclient = new HttpClient())
{
HttpResponseMessage response;
response = httpclient.PostAsync(
"https://api.abinteractive.net/1/cck/parameterStream",
new StringContent(JsonConvert.SerializeObject(new
{
ContentType = type, ContentId = updater.asset.objectId,
#if UNITY_EDITOR
APIConnection.Initialize(EditorPrefs.GetString("m_ABI_Username"), EditorPrefs.GetString("m_ABI_Key"));
EditorPrefs.GetInt("ABI_PREF_UPLOAD_REGION").ToString();
Username = EditorPrefs.GetString("m_ABI_Username"),
AccessKey = EditorPrefs.GetString("m_ABI_Key"),
UploadRegion = EditorPrefs.GetInt("ABI_PREF_UPLOAD_REGION").ToString()
#endif
}),
Encoding.UTF8, "application/json")
).GetAwaiter().GetResult();
Task<APIConnection.BaseResponse<APIConnection.ContentInfoResponse>> task = Task.Run(() => APIConnection.MakeRequest<APIConnection.ContentInfoResponse>(
$"cck/contentInfo/{type}/{updater.asset.objectId}?platform=pc_standalone&region={uploadRegion}"));
while (!task.IsCompleted) yield return null;
APIConnection.BaseResponse<APIConnection.ContentInfoResponse> response = task.Result;
if (response != null)
if (response.IsSuccessStatusCode)
{
if (response.Data != null)
{
updater.UploadLocation = response.Data.UploadLocation;
string result = response.Content.ReadAsStringAsync().GetAwaiter().GetResult();
BaseResponse<VariableStreamResponse> streamResponse = Abi.Newtonsoft.Json.JsonConvert .DeserializeObject<BaseResponse<VariableStreamResponse>>(result);
Debug.Log($"Upload Location: {updater.UploadLocation}");
updater.assetName.text = response.Data.ContentData.Name;
updater.assetDesc.text = response.Data.ContentData.Description;
updater.LoudAudio.isOn = response.Data.ContentData.Tags.LoudAudio;
updater.LongRangeAudio.isOn = response.Data.ContentData.Tags.LongRangeAudio;
updater.SpawnAudio.isOn = response.Data.ContentData.Tags.SpawnAudio;
updater.ContainsMusic.isOn = response.Data.ContentData.Tags.ContainsMusic;
updater.ScreenEffects.isOn = response.Data.ContentData.Tags.ScreenEffects;
updater.FlashingColors.isOn = response.Data.ContentData.Tags.FlashingColors;
updater.FlashingLights.isOn = response.Data.ContentData.Tags.FlashingLights;
updater.ExtremelyBright.isOn = response.Data.ContentData.Tags.ExtremelyBright;
updater.ParticleSystems.isOn = response.Data.ContentData.Tags.ParticleSystems;
updater.Violence.isOn = response.Data.ContentData.Tags.Violence;
updater.Gore.isOn = response.Data.ContentData.Tags.Gore;
updater.Horror.isOn = response.Data.ContentData.Tags.Horror;
updater.Jumpscare.isOn = response.Data.ContentData.Tags.Jumpscare;
updater.ExcessivelySmall.isOn = response.Data.ContentData.Tags.ExtremelySmall;
updater.ExcessivelyHuge.isOn = response.Data.ContentData.Tags.ExtremelyHuge;
updater.Suggestive.isOn = response.Data.ContentData.Tags.Suggestive;
updater.Nudity.isOn = response.Data.ContentData.Tags.Nudity;
}
else
if (streamResponse == null || streamResponse.Data == null)
{
#if UNITY_EDITOR
EditorUtility.ClearProgressBar();
if (UnityEditor.EditorUtility.DisplayDialog("Alpha Blend Interactive CCK",
response.Message, "Okay"))
"Request failed. Unable to connect to the Gateway. The Gateway might be unavailable. Check https://status.abinteractive.net for more info.",
"Okay"))
{
EditorApplication.isPlaying = false;
}
#endif
yield break;
}
}
else
if (!streamResponse.Data.HasPermission)
{
#if UNITY_EDITOR
EditorUtility.ClearProgressBar();
if (UnityEditor.EditorUtility.DisplayDialog("Alpha Blend Interactive CCK",
"An Error occured while uploading. Please try again later.", "Okay"))
"Request failed. The provided content ID does not belong to your account.", "Okay"))
{
EditorApplication.isPlaying = false;
}
#endif
yield break;
}
if (streamResponse.Data.IsAtUploadLimit)
{
#if UNITY_EDITOR
EditorUtility.ClearProgressBar();
if (UnityEditor.EditorUtility.DisplayDialog("Alpha Blend Interactive CCK",
"Request failed. Your account has reached the upload limit. Please consider buying the Unlocked account.",
"Okay"))
{
EditorApplication.isPlaying = false;
}
#endif
}
if (streamResponse.Data.IsBannedFromUploading)
{
#if UNITY_EDITOR
EditorUtility.ClearProgressBar();
if (UnityEditor.EditorUtility.DisplayDialog("Alpha Blend Interactive CCK",
"Request failed. Your upload permissions are suspended. For more information, consult your moderation profile in the ABI community hub.",
"Okay"))
{
EditorApplication.isPlaying = false;
}
#endif
}
updater.UploadLocation = streamResponse.Data.UploadLocation;
updater.assetName.text = streamResponse.Data.ObjectName;
updater.assetDesc.text = streamResponse.Data.ObjectDescription;
updater.LoudAudio.isOn = streamResponse.Data.LoudAudio;
updater.LongRangeAudio.isOn = streamResponse.Data.LongRangeAudio;
updater.SpawnAudio.isOn = streamResponse.Data.SpawnAudio;
updater.ContainsMusic.isOn = streamResponse.Data.ContainsMusic;
updater.ScreenEffects.isOn = streamResponse.Data.ScreenFx;
updater.FlashingColors.isOn = streamResponse.Data.FlashingColors;
updater.FlashingLights.isOn = streamResponse.Data.FlashingLights;
updater.ExtremelyBright.isOn = streamResponse.Data.ExtremelyBright;
updater.ParticleSystems.isOn = streamResponse.Data.ParticleSystems;
updater.Violence.isOn = streamResponse.Data.Violence;
updater.Gore.isOn = streamResponse.Data.Gore;
updater.Horror.isOn = streamResponse.Data.Horror;
updater.Jumpscare.isOn = streamResponse.Data.Jumpscare;
updater.ExcessivelySmall.isOn = streamResponse.Data.ExtremelySmall;
updater.ExcessivelyHuge.isOn = streamResponse.Data.ExtremelyHuge;
updater.Suggestive.isOn = streamResponse.Data.Suggestive;
updater.Nudity.isOn = streamResponse.Data.Nudity;
}
}
}
}
[Serializable]
public class VariableStreamResponse
{
public bool HasPermission { get; set; }
public bool IsAtUploadLimit { get; set; }
public bool IsBannedFromUploading { get; set; }
public string UploadLocation { get; set; }
public string ObjectName { get; set; }
public string ObjectDescription { get; set; }
public bool LoudAudio { get; set; }
public bool LongRangeAudio { get; set; }
public bool SpawnAudio { get; set; }
public bool ContainsMusic { get; set; }
public bool ScreenFx { get; set; }
public bool FlashingColors { get; set; }
public bool FlashingLights { get; set; }
public bool ExtremelyBright { get; set; }
public bool ParticleSystems { get; set; }
public bool Violence { get; set; }
public bool Gore { get; set; }
public bool Horror { get; set; }
public bool Jumpscare { get; set; }
public bool ExtremelySmall { get; set; }
public bool ExtremelyHuge { get; set; }
public bool Suggestive { get; set; }
public bool Nudity { get; set; }
}
public class BaseResponse<T>
{
public string Message { get; set; }
public T Data { get; set; }
public BaseResponse(string message = null, T data = default)
{
Message = message;
Data = data;
}
public override string ToString()
{
return JsonConvert.SerializeObject(this);
}
}
}

View file

@ -114,7 +114,7 @@ namespace ABI.CCK.Scripts.Runtime
camObj.name = "ShotCam for CVR CCK";
camObj.transform.rotation = new Quaternion(0,180,0,0);
CVRAvatar avatar = asset.GetComponent<CVRAvatar>();
if (avatar != null && asset.type == CVRAssetInfo.AssetType.Avatar) camObj.transform.position = new Vector3(avatar.viewPosition.x, avatar.viewPosition.y, avatar.viewPosition.z *= 5f);
if (asset.type == CVRAssetInfo.AssetType.Avatar) camObj.transform.position = new Vector3(avatar.viewPosition.x, avatar.viewPosition.y, avatar.viewPosition.z *= 5f);
var cam = camObj.AddComponent<Camera>();
cam.aspect = 1f;
cam.nearClipPlane = 0.01f;
@ -126,22 +126,20 @@ namespace ABI.CCK.Scripts.Runtime
#endif
string content_id = asset.objectId;
if (type == CVRAssetInfo.AssetType.Avatar)
{
assetFileSizeText.text = ToFileSizeString(new FileInfo(Application.persistentDataPath + $"/cvravatar_{content_id}_{asset.randomNum}.cvravatar").Length);
assetFileSizeText.text = ToFileSizeString(new FileInfo(Application.persistentDataPath + "/bundle.cvravatar").Length);
assetImageFileSizeText.text = "N/A";
assetFileManifestSizeText.text = ToFileSizeString(new FileInfo(Application.persistentDataPath + $"/cvravatar_{content_id}_{asset.randomNum}.cvravatar.manifest").Length);
assetFileManifestSizeText.text = ToFileSizeString(new FileInfo(Application.persistentDataPath + "/bundle.cvravatar.manifest").Length);
assetFilePano1SizeText.text = "N/A";
assetFilePano4SizeText.text = "N/A";
}
if (type == CVRAssetInfo.AssetType.Spawnable)
{
assetFileSizeText.text = ToFileSizeString(new FileInfo(Application.persistentDataPath + $"/cvrspawnable_{content_id}_{asset.randomNum}.cvrprop").Length);
assetFileSizeText.text = ToFileSizeString(new FileInfo(Application.persistentDataPath + "/bundle.cvrprop").Length);
assetImageFileSizeText.text = "";
assetFileManifestSizeText.text = ToFileSizeString(new FileInfo(Application.persistentDataPath + $"/cvrspawnable_{content_id}_{asset.randomNum}.cvrprop.manifest").Length);
assetFileManifestSizeText.text = ToFileSizeString(new FileInfo(Application.persistentDataPath + "/bundle.cvrprop.manifest").Length);
assetFilePano1SizeText.text = "N/A";
assetFilePano4SizeText.text = "N/A";
}

View file

@ -16,9 +16,6 @@ public class ShaderCompatibilityPreprocessor : IPreprocessShaders
public void OnProcessShader(Shader shader, ShaderSnippetData snippet, IList<ShaderCompilerData> data)
{
#if UNITY_2021_1_OR_NEWER
//Do nothing here
#else
if(EditorUserBuildSettings.activeBuildTarget == BuildTarget.StandaloneWindows64)
{
List<ShaderCompilerData> reworkedData = new List<ShaderCompilerData>();
@ -50,7 +47,6 @@ public class ShaderCompatibilityPreprocessor : IPreprocessShaders
data.Add(entry);
}
}
#endif
}
}
#endif

View file

@ -26,7 +26,7 @@
// #define USE_WORLD_SPACE
#define DYNAMIC_QUALITY
#define USE_REFLECTIONS
// #define CONSTRAIN_TO_MESH
#define CONSTRAIN_TO_MESH
#define MAX_REFLECTIONS 1
#include "RayMarchLib.cginc"
@ -58,12 +58,11 @@
o = sdfAdd(p, o, sdfSphere(p, 6 + bias*3, mRed), 5);
// o = sdfInter(p, o, sdfSphere(p, 50, mat(0.04, 0.005, 0.035)), 1.1);
o = sdfInter(p, o, sdfBox(p, 20, mRed));
// sdfData gyroid = o;
// o = sdfAdd(p,
// sdfInter(p, gyroid, sdfBox(p, 30, mRed)),
// sdfSub(p, gyroid, sdfBox(p, 30, mRed))
// );
sdfData gyroid = o;
o = sdfAdd(p,
sdfInter(p, gyroid, sdfBox(p, 30, mRed)),
sdfSub(p, gyroid, sdfBox(p, 30, mRed))
);
// o = p, o, sdfBox(p, 20, mRed));
//sdfData bobby = sdfSphere(p, 51, col(0.5, 0.25, 0.001));
//bobby = sdfAdd(p, bobby, sdfSphere(p, 50.5, col(.5,.01,.01)));
@ -82,18 +81,17 @@
if (ray.bMissed)
{
// discard;
// return fogCol;
return 0;
return fogCol;
}
fixed4 col = 0;
col += ray.mat.col * lightSun(ray.vNorm, vSunDir, col(5, 2, 0.1));
col += ray.mat.col * lightSky(ray.vNorm, 1);
// col *= lightAO(ray.vHit, ray.vNorm, 0.05);
col *= lightAO(ray.vHit, ray.vNorm, 0.05);
// col = pow(col, 0.7);
// col = lightFog(col, fogCol, ray.dist, 0.5, 16);
col = pow(col, 0.7);
col = lightFog(col, fogCol, ray.dist, 0.5, 16);
return col;
}
ENDCG