Skip to content

Commit

Permalink
2020.6.8 backup
Browse files Browse the repository at this point in the history
  • Loading branch information
paulpork committed Jun 7, 2022
1 parent 6cf9a37 commit 6c35fd1
Show file tree
Hide file tree
Showing 570 changed files with 98,821 additions and 487 deletions.
2,415 changes: 2,415 additions & 0 deletions Assets/Canvas.prefab

Large diffs are not rendered by default.

7 changes: 7 additions & 0 deletions Assets/Canvas.prefab.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

53 changes: 53 additions & 0 deletions Assets/ClickDetector.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;

// used in visualization

public class ClickDetector : MonoBehaviour
{
public float DetectRange = 1000.0f;
public float RingRadius = 90.0f;
public int[] HeadbandState = new int[16];
public GameObject[] Motors;
private RawImage[] MotorImages = new RawImage[16];
private Color maxColor = Color.red;

private void Start()
{
for (int i = 0; i < 16; i++)
{
HeadbandState[i] = 0;
MotorImages[i] = Motors[i].GetComponent<RawImage>();
Motors[i].GetComponent<RectTransform>().localPosition
= new Vector2(RingRadius * Mathf.Cos(Mathf.PI / 2 - i * Mathf.PI / 8), RingRadius * Mathf.Sin(Mathf.PI / 2 - i * Mathf.PI / 8));
}
}
void Update()
{
if (Input.GetMouseButtonDown(0))
{
RaycastHit hit;
Ray ray = Camera.main.ScreenPointToRay(Input.mousePosition);

if(Physics.Raycast(ray, out hit, DetectRange))
{
if(hit.transform != null)
{
Debug.Log(hit.transform.gameObject.GetComponent<ParameterHolder>()._timeStamp);
HeadbandState = hit.transform.gameObject.GetComponent<ParameterHolder>()._SumIntensity;
UpdateRingColor();
}
}
}
}

private void UpdateRingColor()
{
for (int i = 0; i < 16; i++)
{
MotorImages[i].color = Color.Lerp(Color.white, maxColor, (HeadbandState[i] / 100.0f));
}
}
}
11 changes: 11 additions & 0 deletions Assets/ClickDetector.cs.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

53 changes: 12 additions & 41 deletions Assets/VirtualLayer.cs → Assets/Encoder.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
using UnityEngine;
using AirDriVR;

public class VirtualLayer : MonoBehaviour
public class Encoder : MonoBehaviour
{
private float PowerSource = 9.0f;
private float ForcePerVoltage = 1.6f;
Expand All @@ -16,40 +16,27 @@ public class VirtualLayer : MonoBehaviour
public bool isRandom;
public int UserID = 0;

// From 0~100 intensity
public int[] VibratorIntensities = new int[16];

// From 0~100 intensity
public int[] VibratorMotionIntensities = new int[16];

// From 0~100 intensity
public int[] VibratorAdditionalIntensities = new int[16];
public bool additionalIntensityEnable;

[SerializeField]
protected int[] VibratorIntensityWeight = new int[16];

// For tactile motion
public float[] VibratorLifeSpans = new float[16];

// For Rumbling
public float[] VibratorAddiLifeSpans = new float[16];

// get from calibration
protected int maxIntensity;
protected int cueMaxIntensity;
protected int motionnMaxIntensity;
private int SystemInputMaxValue;
public int minValue = 8;
public int maxValue;
public bool isMotion;
public int globalMultiplier = 100;

// public float updateInterval = 0.05f;
public int FramesPerUpdate = 2;

protected VirtualHeadband virtualHeadband;
protected ShowVibration showVibration;

// Start is called before the first frame update
protected virtual void Start()
{
isMotion = false;
showVibration = GetComponent<ShowVibration>();
virtualHeadband = GetComponent<VirtualHeadband>();
Iniitialize();
//StartCoroutine(sendHeadbandStateToArduino());
}
Expand All @@ -61,32 +48,16 @@ void Iniitialize()
for (int i = 0; i < 16; i++)
{
VibratorIntensityWeight[i] = int.Parse(reader.ReadLine());
VibratorIntensities[i] = 0;
VibratorMotionIntensities[i] = 0;
VibratorAdditionalIntensities[i] = 0;
VibratorLifeSpans[i] = 0.0f;
VibratorAddiLifeSpans[i] = 0.0f;
}
SystemInputMaxValue = Mathf.FloorToInt(((MaximumForce / ForcePerVoltage) / PowerSource) * 256);
maxValue = SystemInputMaxValue; // Mathf.Min(int.Parse(reader.ReadLine()), SystemInputMaxValue); // Get from calibration
// maxValue = Mathf.Min(int.Parse(reader.ReadLine()), SystemInputMaxValue); // Get from calibration
globalMultiplier = int.Parse(reader.ReadLine()); // Get from calibration
maxValue = SystemInputMaxValue;
reader.Close();
Debug.Log("Initialization finished.");
}

public void setAllToZero()
{
for (int i = 0; i < 16; i++)
{
VibratorIntensities[i] = 0;
VibratorMotionIntensities[i] = 0;
VibratorAdditionalIntensities[i] = 0;
VibratorLifeSpans[i] = 0.0f;
VibratorAddiLifeSpans[i] = 0.0f;
}
}

public virtual void SendDataToArduino(byte[] data)
{

// currently unused
}
}
File renamed without changes.
77 changes: 77 additions & 0 deletions Assets/New Material.mat
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!21 &2100000
Material:
serializedVersion: 6
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_Name: New Material
m_Shader: {fileID: 46, guid: 0000000000000000f000000000000000, type: 0}
m_ShaderKeywords:
m_LightmapFlags: 4
m_EnableInstancingVariants: 0
m_DoubleSidedGI: 0
m_CustomRenderQueue: -1
stringTagMap: {}
disabledShaderPasses: []
m_SavedProperties:
serializedVersion: 3
m_TexEnvs:
- _BumpMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _DetailAlbedoMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _DetailMask:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _DetailNormalMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _EmissionMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _MainTex:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _MetallicGlossMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _OcclusionMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _ParallaxMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
m_Floats:
- _BumpScale: 1
- _Cutoff: 0.5
- _DetailNormalMapScale: 1
- _DstBlend: 0
- _GlossMapScale: 1
- _Glossiness: 0.5
- _GlossyReflections: 1
- _Metallic: 1
- _Mode: 0
- _OcclusionStrength: 1
- _Parallax: 0.02
- _SmoothnessTextureChannel: 0
- _SpecularHighlights: 1
- _SrcBlend: 1
- _UVSec: 0
- _ZWrite: 1
m_Colors:
- _Color: {r: 0, g: 0, b: 0, a: 1}
- _EmissionColor: {r: 0, g: 0, b: 0, a: 1}
8 changes: 8 additions & 0 deletions Assets/New Material.mat.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

15 changes: 15 additions & 0 deletions Assets/NuGet.config
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<packageSources>
<clear/>
<add key="NuGet" value="http://www.nuget.org/api/v2/" />
</packageSources>
<disabledPackageSources />
<activePackageSource>
<add key="All" value="(Aggregate source)" />
</activePackageSource>
<config>
<add key="repositoryPath" value="./Packages" />
<add key="DefaultPushSource" value="http://www.nuget.org/api/v2/" />
</config>
</configuration>
32 changes: 32 additions & 0 deletions Assets/NuGet.config.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 9 additions & 0 deletions Assets/NuGet.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 9 additions & 0 deletions Assets/NuGet/Editor.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions Assets/NuGet/Editor/NugetForUnity.dll
Git LFS file not shown
33 changes: 33 additions & 0 deletions Assets/NuGet/Editor/NugetForUnity.dll.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

21 changes: 21 additions & 0 deletions Assets/NuGet/LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2018 Patrick McCarthy

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.
8 changes: 8 additions & 0 deletions Assets/NuGet/LICENSE.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Binary file added Assets/NuGet/README.pdf
Binary file not shown.
Loading

0 comments on commit 6c35fd1

Please sign in to comment.