Skip to content

Instantly share code, notes, and snippets.

@unitycoder
unitycoder / UNITY_MATRIX_IT_MV.shader
Last active September 11, 2024 05:46
UNITY_MATRIX_IT_MV[] Vectors in Shader
UNITY_MATRIX_IT_MV[0].xyz = ???
UNITY_MATRIX_IT_MV[1].xyz = Camera Up
UNITY_MATRIX_IT_MV[2].xyz = Camera Forward
float3 forward = -normalize(UNITY_MATRIX_V._m20_m21_m22);
cameraFwd = -unity_MatrixInvV._m02_m12_m22;
float3 up = normalize(UNITY_MATRIX_V._m10_m11_m12);
float3 right = normalize(UNITY_MATRIX_V._m00_m01_m02);
float3 cameraUp = unity_CameraInvProjection[1].xyz;
@luxuia
luxuia / obb_md5_computer.cs
Created November 1, 2018 08:45
unity 会记录打出来的obb的hash在/assets/bin/Data/settings.xml 。修改obb或者想复用obb就需要修改apk内的hash字段。 用obb的最后65558个字节计算的hash
public static string CalculateObbDigest(string file)
{
byte[] arrayOfByte = null;
using (var localMessageDigest = MD5.Create())
using (var localFileInputStream = File.OpenRead(file))
{
long l1 = localFileInputStream.Length;
localFileInputStream.Seek(l1 - Math.Min(l1, 65558L), SeekOrigin.Current);
arrayOfByte = localMessageDigest.ComputeHash(localFileInputStream);
@luxuia
luxuia / obb_md5_computer.py
Created November 1, 2018 09:15
计算obb hash的python方法
#!/usr/bin/python
#coding: utf8
import os
import sys
print(str(sys.argv))
obb =sys.argv[1]
def md5(file):