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
#ifndef __QUATERNION_INCLUDED__ | |
#define __QUATERNION_INCLUDED__ | |
#define QUATERNION_IDENTITY float4(0, 0, 0, 1) | |
#ifndef PI | |
#define PI 3.14159265359f | |
#endif | |
// Quaternion multiplication |
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; | |
using System.Linq; | |
using System.Collections; | |
using System.Collections.Generic; | |
using System.Reflection; | |
using UnityEngine; | |
namespace Utils | |
{ |
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
use std::collections::HashMap; | |
use nalgebra::RealField; | |
/// Returns the binomial coefficient of `n` and `k`. | |
#[allow(unused)] | |
pub fn binomial(n: usize, k: usize) -> f64 { | |
if k == 0 || k == n { | |
return 1.; | |
} else if n == 0 || k > n { |
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
#ifndef __MATRIX_INCLUDED__ | |
#define __MATRIX_INCLUDED__ | |
#define IDENTITY_MATRIX float4x4(1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1) | |
float4x4 inverse(float4x4 m) { | |
float n11 = m[0][0], n12 = m[1][0], n13 = m[2][0], n14 = m[3][0]; | |
float n21 = m[0][1], n22 = m[1][1], n23 = m[2][1], n24 = m[3][1]; | |
float n31 = m[0][2], n32 = m[1][2], n33 = m[2][2], n34 = m[3][2]; | |
float n41 = m[0][3], n42 = m[1][3], n43 = m[2][3], n44 = m[3][3]; |
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 "Mattatz/TextureAnimation" | |
{ | |
Properties | |
{ | |
_MainTex ("Texture", 2D) = "white" {} | |
_Color ("Color", Color) = (1, 1, 1, 1) | |
_Cols ("Cols Count", Int) = 5 | |
_Rows ("Rows Count", Int) = 3 | |
_Frame ("Per Frame Length", Float) = 0.5 |
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 UnityEngine; | |
using UnityEngine.Networking; | |
[System.Serializable] | |
public class SlackAttachment | |
{ | |
public string title; | |
public string text; |
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
use nalgebra::Point3; | |
use std::f64::consts::PI; | |
/// Reference: http://sshmathgeom.private.coocan.jp/geometryonsphere.pdf | |
pub struct SphericalCoordinate { | |
pub theta: f64, // latitude: -half pi <= theta <= half pi | |
pub phi: f64, // longitude: -2pi <= phi <= 2pi | |
} |
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 "Mattatz/SobelFilter" { | |
Properties { | |
_MainTex ("Base (RGB)", 2D) = "white" {} | |
_DeltaX ("Delta X", Float) = 0.01 | |
_DeltaY ("Delta Y", Float) = 0.01 | |
} | |
SubShader { | |
Tags { "RenderType"="Opaque" } |
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 UnityEngine; | |
using System.Collections; | |
using System; | |
using System.Runtime.InteropServices; | |
namespace Utils { | |
// ここからコードを拝借させてもらいました! | |
// http://answers.unity3d.com/questions/13523/is-there-a-way-to-set-the-position-of-a-standalone.html |
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
// BitwiseOperations.glsl | |
const int BIT_COUNT = 8; | |
int modi(int x, int y) { | |
return x - y * (x / y); | |
} | |
int or(int a, int b) { | |
int result = 0; |
NewerOlder