Skip to content

Instantly share code, notes, and snippets.

View Kolyasisan's full-sized avatar
🗿

Nikolai Ponomarev Kolyasisan

🗿
  • Ice-Pick Lodge
View GitHub Profile
@netshade
netshade / frame_decoder.c
Created February 2, 2022 19:04
Godot GDNative FFMPEG Streaming
#include <gdnative_api_struct.gen.h>
#include <libavcodec/avcodec.h>
#include <libavutil/avutil.h>
#include <libavformat/avformat.h>
#include <libavutil/imgutils.h>
#include <pthread.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
@bgolus
bgolus / WorldNormalFromDepthTexture.shader
Last active May 20, 2024 08:18
Different methods for getting World Normal from Depth Texture, without any external script dependencies.
Shader "WorldNormalFromDepthTexture"
{
Properties {
[KeywordEnum(3 Tap, 4 Tap, Improved, Accurate)] _ReconstructionMethod ("Normal Reconstruction Method", Float) = 0
}
SubShader
{
Tags { "RenderType"="Transparent" "Queue"="Transparent" }
LOD 100
@Fewes
Fewes / Tricubic.cginc
Last active May 7, 2024 07:16
Tricubic texture sampling using 8 trilinear samples
#ifndef TRICUBIC_INCLUDED
#define TRICUBIC_INCLUDED
float4 Cubic(float v)
{
float4 n = float4(1.0, 2.0, 3.0, 4.0) - v;
float4 s = n * n * n;
float x = s.x;
float y = s.y - 4.0 * s.x;
float z = s.z - 4.0 * s.y + 6.0 * s.x;
@kilfu0701
kilfu0701 / convert.cpp
Created October 24, 2019 02:48
C++ UTF8 to Shift-jis (with ICU)
//
// @reference https://faithandbrave.hateblo.jp/entry/20100318/1268896477
// @memo
// on CentOS:
// yum install libicu libicu-devel
// g++ -std=c++14 -o cvt convert.cpp `pkg-config --libs --cflags icu-uc icu-io`
//
#include <iostream>
#include <vector>
@bitinn
bitinn / MainLightDataNode.cs
Last active August 11, 2023 08:15 — forked from ciro-unity/MainLightNode.cs
A custom node for Unity's ShaderGraph to capture lighting and use it into the shader. Works as of Dec 2018, but the APIs might change!
using UnityEngine;
using UnityEditor.ShaderGraph;
using System.Reflection;
// IMPORTANT:
// - tested with LWRP and Shader Graph 4.6.0-preview ONLY
// - likely to break in SG 5.x and beyond
// - for HDRP, add your own keyword to detect environment
[Title("Custom", "Main Light Data")]
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class BoxMover : MonoBehaviour
{
public enum Slide
{
None,
Perpendicular,
@chrisengelsma
chrisengelsma / PolynomialRegression.h
Last active February 28, 2024 14:07
Polynomial Regression (Quadratic Fit) in C++
#ifndef _POLYNOMIAL_REGRESSION_H
#define _POLYNOMIAL_REGRESSION_H __POLYNOMIAL_REGRESSION_H
/**
* PURPOSE:
*
* Polynomial Regression aims to fit a non-linear relationship to a set of
* points. It approximates this by solving a series of linear equations using
* a least-squares approach.
*
* We can model the expected value y as an nth degree polynomial, yielding
@derofim
derofim / codestyle.md
Last active May 14, 2024 05:21
C++ code style sample