Skip to content

Instantly share code, notes, and snippets.

@jesliwang
jesliwang / pbr.glsl
Created June 12, 2017 09:10 — forked from galek/pbr.glsl
PBR GLSL SHADER
in vec2 v_texcoord; // texture coords
in vec3 v_normal; // normal
in vec3 v_binormal; // binormal (for TBN basis calc)
in vec3 v_pos; // pixel view space position
out vec4 color;
layout(std140) uniform Transforms
{
mat4x4 world_matrix; // object's world position
@jesliwang
jesliwang / .py
Created December 30, 2017 15:43
批量修改图片尺寸
#!/Users/Jesli/anaconda2/bin/python
# -*- coding: utf-8 -*-
# pip install pillow
from PIL import Image
image_size = [36, 48, 72, 96, 144, 192]
@jesliwang
jesliwang / Qsqrt.c
Created August 4, 2018 05:39
Qsqrt
float Q_rsqrt( float number ) {
long i; float x2, y; const float threehalfs = 1.5F;
x2 = number * 0.5F;
y = number;
i = * ( long * ) &y; // evil floating point bit level hacking
i = 0x5f3759df - ( i >> 1 ); // what the fuck?
y = * ( float * ) &i;
y = y * ( threehalfs - ( x2 * y * y ) ); // 1st iteration
// y = y * ( threehalfs - ( x2 * y * y ) ); // 2nd iteration, this can be removed
#ifndef Q3_VM #
@jesliwang
jesliwang / RMGmail.md
Last active October 13, 2018 05:02
自动删除gmail的邮件
function Intialize() {
  return;
}

function Install() {
  ScriptApp.newTrigger("purgeGmail")
           .timeBased().everyMinutes(10).create();

}
@jesliwang
jesliwang / GitReadMe.md
Created October 13, 2018 03:09
使用git的时候,遇到的问题
  1. merge操作会更新改动的文件的标记,所以不能用discard来忽略改动 如果discard了,可以用checkout指定分支的文件来解决 > git checkout --
@jesliwang
jesliwang / CaptureScreen.cs
Last active January 29, 2019 06:59
截图
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using System;
using System.IO;
[RequireComponent(typeof(Camera))]
public class CaptureScreen : MonoBehaviour {
void OnGUI() {
if(GUI.Button(new Rect(Vector2.zero, 100 * Vector2.one), "截屏"))
{
@jesliwang
jesliwang / UnpackUnityAssets.py
Last active April 7, 2024 02:34
Unpack Assets For Unity Games From Apks or assetbundles
#!/Users/Jesli/opt/anaconda3/bin/python
# -*- coding: UTF-8 -*-
import io, os
import UnityPy
import sys, getopt
import traceback
import json
class UnPackUnityAsset: