Skip to content

Instantly share code, notes, and snippets.

組み込み関数 (DirectX HLSL)
https://msdn.microsoft.com/ja-jp/library/bb509611(v=vs.85).aspx
GLSLについてのメモ
http://qiita.com/edo_m18/items/71f6064f3355be7e4f45
// Unity built-in shader source. Copyright (c) 2016 Unity Technologies. MIT license (see license.txt)
Shader "Custom/Wireframe" {
Properties
{
_WireThickness ("Wire Thickness", RANGE(0, 800)) = 100
_Color("Color", Color) = (1,1,1,1)
}
SubShader
{
public static Vector3 SetLatLonPosition(float r, float lat, float lon)
{
float phi = (90-lat)*Mathf.Deg2Rad;
float theta = (lon)*Mathf.Deg2Rad;
float x = r * Mathf.Sin(phi) * Mathf.Cos(theta);
float z = r * Mathf.Sin(phi) * Mathf.Sin(theta);
float y = r * Mathf.Cos(phi);
Vector3 pos = new Vector3(x,y,z);
@inoook
inoook / TransCh.cs
Created September 26, 2018 03:07
既存のAudioチャンネルを別チャンネルへ転送
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
// 既存のチャンネルを別チャンネルへ転送
public class TransCh : MonoBehaviour {
[System.Serializable]
public class TransChannel
{
EventHandler handler = null;
handler = (sender, e) => {
button1.Click -= handler;
MessageBox.Show("click");
};
button1.Click += handler;
@inoook
inoook / ViveTrackerManagement.cs
Created December 28, 2021 09:11
ViveTrackerManagement
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using Valve.VR;
public class ViveTrackerManagement : MonoBehaviour {
// Use this for initialization
void Start () {
using System.Collections;
using System.Collections.Generic;
using System.Threading.Tasks;
using System.Runtime.CompilerServices;
using UnityEngine;
public class FadeTransition
{
[SerializeField] CanvasGroup canvasGroup = null;
@inoook
inoook / CommandLineArgsUtils.cs
Last active April 26, 2023 12:02
CommandLineArgsUtils
using System;
using System.Linq;
using System.Reflection;
using UnityEngine;
public static class CommandLineArgsUtils
{
// https://github.com/baba-s/Kogane.CommandLineParser/tree/master/Editor
/**
using UnityEngine;
using System.Collections.Generic;
public class MainThreadDispatcher : MonoBehaviour
{
private static MainThreadDispatcher instance;
private static readonly object lockObject = new object();
private Queue<System.Action> actions = new Queue<System.Action>();
@inoook
inoook / MeshTextureColorPicker.cs
Created November 10, 2023 12:24
UnityでMeshの色取得。subMesh対応
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
[ExecuteInEditMode]
public class MeshTextureColorPicker : MonoBehaviour
{
/// <summary>
/// Meshをstaticにしているとbatchで結合されsubmeshIndexが異なり正常に取得できなくなる。
/// 対応方法 (対象となるMeshをBatchingの対応外にする)