This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System.Collections; | |
using System.Collections.Generic; | |
/// <summary> | |
/// イベントデリゲートタイプ | |
/// </summary> | |
/// <param name="args">引数</param> | |
public delegate void EventListener<T>(T args); | |
/// <summary> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System.Collections; | |
using System.Collections.Generic; | |
using UnityEngine; | |
public class MouseCameraController : MonoBehaviour | |
{ | |
[SerializeField] | |
private float _speed = 0.1f; | |
[SerializeField] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System.Collections; | |
using System.Collections.Generic; | |
using UnityEngine; | |
public class Test : MonoBehaviour | |
{ | |
[SerializeField] | |
private float _radius = 1f; | |
private Vector3 _center = Vector3.zero; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private void OnRenderImage(RenderTexture src, RenderTexture dest) | |
{ | |
_fadeMaterial.SetPass(0); | |
GL.PushMatrix(); | |
GL.LoadOrtho(); | |
GL.Color(_fadeMaterial.color); // Update内などでこのcolorを変更する想定 | |
GL.Begin(GL.QUADS); | |
GL.Vertex3(-1f, -1f, 1f); | |
GL.Vertex3(-1f, 1f, 1f); | |
GL.Vertex3( 1f, 1f, 1f); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private void Convert(Color[] colors, int width, int height) | |
{ | |
int halfWidth = width / 2; | |
int halfHeight = height / 2; | |
Texture2D tex = new Texture2D(width, height); | |
Color[] newColors = new Color[colors.Length]; | |
GameObject quad = GameObject.CreatePrimitive(PrimitiveType.Quad); | |
quad.name = "PolarCoord"; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
float temperature = 30.5f; | |
float cold = Cold(temperature); | |
float warm = Warm(temperature); | |
float hot = Hot(temperature); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ---------------------------------------------------------------------------- | |
// TransformPoint | |
// 意味: 通常のモデル行列を掛けたポイントを得る | |
Vector3 point = Vector3.one; | |
Vector3 newPoint1 = transform.TransformPoint(point); | |
Vector4 v = new Vector4(point.x, point.y, point.z, 1f); | |
Vector3 newPoint2 = transform.localToWorldMatrix * v; | |
// ---------------------------------------------------------------------------- |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Shader "Custom/DepthNormal" { | |
SubShader { | |
Tags { "RenderType"="Transparent" "Queue"="Transparent+10" } | |
LOD 200 | |
Pass | |
{ | |
CGPROGRAM | |
#include "UnityCG.cginc" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
float[] LUDecomposition(float[,] aMatrix, float[] b) | |
{ | |
// 行列数(Vector3データの解析なので3x3行列) | |
int N = aMatrix.GetLength(0); | |
// L行列(零行列に初期化) | |
float[,] lMatrix = new float[N, N]; | |
for (int i = 0; i < N; i++) | |
{ | |
for (int j = 0; j < N; j++) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
\begin{bmatrix} | |
l_{00} & 0 & 0 \\ | |
l_{10} & l_{11} & 0 \\ | |
l_{20} & l_{21} & l_{22} | |
\end{bmatrix} |