Skip to content

Instantly share code, notes, and snippets.

View stilllisisi's full-sized avatar
🎯
Focusing

stilllisisi

🎯
Focusing
View GitHub Profile
@stilllisisi
stilllisisi / three.js.shader.html
Created March 10, 2020 03:15 — forked from kylemcdonald/three.js.shader.html
Minimal three.js shader example.
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, user-scalable=no, minimum-scale=1.0, maximum-scale=1.0">
<style>
body {
margin: 0px;
overflow: hidden;
}
Shader "Name" {
Properties {
_Name ("display name", Range (min, max)) = number
_Name ("display name", Float) = number
_Name ("display name", Int) = number
_Name ("display name", Color) = (number,number,number,number)
_Name ("display name", Vector) = (number,number,number,number)
@stilllisisi
stilllisisi / pbr.glsl
Created March 10, 2020 03:11 — 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
@stilllisisi
stilllisisi / VkComputeSample
Created March 10, 2020 03:10 — forked from sheredom/VkComputeSample
A simple Vulkan compute sample
// This is free and unencumbered software released into the public domain.
//
// Anyone is free to copy, modify, publish, use, compile, sell, or
// distribute this software, either in source code form or as a compiled
// binary, for any purpose, commercial or non-commercial, and by any
// means.
//
// In jurisdictions that recognize copyright laws, the author or authors
// of this software dedicate any and all copyright interest in the
// software to the public domain. We make this dedication for the benefit
// c# companion script
// SpriteUVToShader.cs -------------------------------------------------------------------------------------------------------------------------------- //
// Save you your project, add to your SpriteRenderer gameObject
using UnityEngine;
using System.Collections;
using System.Collections.Generic;
[ExecuteInEditMode]
@stilllisisi
stilllisisi / UnityShaderFFS.md
Created March 10, 2020 03:08 — forked from smkplus/UnityShaderCheatSheet.md
Controlling fixed function states from materials/scripts in Unity

16999105_467532653370479_4085466863356780898_n

Shader "MaterialPropertyDrawer"
{
Properties
{
_MainTex("Texture", 2D) = "white" {}
 
[HideInInspector] _MainTex2("Hide Texture", 2D) = "white" {}
@stilllisisi
stilllisisi / OceanDemo.cg
Last active March 10, 2020 03:42
【游戏-渲染】SIGGRAPH中海洋的研究学习
//先做Gerstner Wave
//波形采用分层随机叠加的方式,通过参数进行调节。以下代码让波长逐渐增加,同时生成了相位和角度。角度是用来控制波的方向。
public void GenerateWaveData(int componentsPerOctave, ref float[] wavelengths, ref float[] anglesDeg, ref float[] phases)
{
int totalComponents = NUM_OCTAVES * componentsPerOctave;
if (wavelengths == null || wavelengths.Length != totalComponents) wavelengths = new float[totalComponents];
if (anglesDeg == null || anglesDeg.Length != totalComponents) anglesDeg = new float[totalComponents];
if (phases == null || phases.Length != totalComponents) phases = new float[totalComponents];
float minWavelength = Mathf.Pow(2f, SMALLEST_WL_POW_2);
float invComponentsPerOctave = 1f / componentsPerOctave;
@stilllisisi
stilllisisi / AdincubeEditor.cc
Created March 10, 2020 02:33
【C++-文件】打包导出包体文件夹后,自动修改包体内文件文本数据
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEditor;
using UnityEditor.Callbacks;
using System.IO;
using System.Text.RegularExpressions;
public class AdincubeEditor : Editor
//打包完成后调用该方法
@stilllisisi
stilllisisi / compile_just_in_my_test_env.sh
Created March 10, 2020 02:29
【C++-数据库】本项目是一个ORM测试,扩展了protobuf,增加了mysql的generator,生成sql文件,并使用protobuf的反射与descriptor生成相应的sql来达到ORM的演示。
protoc --cpp_out=. pb_orm_test.proto
protoc --mysql_out=. pb_orm_test.proto
g++ -g storage.cc main.cc pb_orm_test.pb.cc -lmysqlclient -lprotobuf -L/home/taohan/open_src/protobuf/protobuf-2.6.1/src/.libs -L/usr/local/mysql/lib
@stilllisisi
stilllisisi / spriteGlitch.shader
Created March 10, 2020 02:14 — forked from KeyMaster-/spriteGlitch.shader
A glitch effect shader for Sprites in Unity3D
//Copyright (c) 2014 Tilman Schmidt (@KeyMaster_)
//Permission is hereby granted, free of charge, to any person obtaining a copy
//of this software and associated documentation files (the "Software"), to deal
//in the Software without restriction, including without limitation the rights
//to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
//copies of the Software, and to permit persons to whom the Software is
//furnished to do so, subject to the following conditions:
//The above copyright notice and this permission notice shall be included in