Skip to content

Instantly share code, notes, and snippets.

View xCyborg's full-sized avatar
🐢
Focusing

Sami Benx xCyborg

🐢
Focusing
  • Arcadia. 00.
View GitHub Profile
@xCyborg
xCyborg / 0_reuse_code.js
Created December 24, 2016 09:40
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
[RequireComponent(typeof(Camera))]
public class CameraManouver : MonoBehaviour
{
Transform _transform; // cache transform component of the camera
[Header("Keyboard Translation")]
public float horizontalFactor = 10f;
@xCyborg
xCyborg / LuminateRP.cs
Created February 7, 2019 23:36
Custom Render Pipeline "Luminate" starter template.
using UnityEngine;
using UnityEngine.Rendering;
using UnityEngine.Experimental.Rendering;
using Conditional = System.Diagnostics.ConditionalAttribute;
[CreateAssetMenu(menuName = "Rendering/LuminatePipeline")]
public class LuminateRP : RenderPipelineAsset
{
protected override IRenderPipeline InternalCreatePipeline()
{
@xCyborg
xCyborg / CgFunctions.cs
Last active December 24, 2019 16:14
Some Math Functions
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
/// <summary>
/// Cg shading language functions written in C#
/// </summary>
public static class CgFunctions : MonoBehaviour
{
// Start is called before the first frame update
@xCyborg
xCyborg / Patterns.cs
Created October 22, 2020 16:02
Patterns like _enum_class_ and _singletons_
public class Planet // enum class
{
public static readonly Planet MERCURY = new Planet(1, "Mercury");
public static readonly Planet VENUS = new Planet(2, "Venus");
public static readonly Planet EARTH = new Planet(3, "Earth");
public static readonly Planet MARS = new Planet(4, "Mars");
public static readonly Planet JUPITER = new Planet(5, "Jupiter");
public static readonly Planet SATURN = new Planet(6, "Saturn");
public static readonly Planet URANNUS = new Planet(7, "Uranus");
public static readonly Planet NEPTUNE = new Planet(8, "Naptune");
@xCyborg
xCyborg / CustomLighting.hlsl
Last active March 16, 2023 07:57
Unity URP Custom Lit ShaderGraph - BlinnPhong (Wire in the inputs, then add Diffuse + Specular)
#ifndef CUSTOM_LIGHTING_INCLUDED
#define CUSTOM_LIGHTING_INCLUDED
/* IN(5): SpecColor(4), Smoothness(1), WPos(3), WNormal(3), WView(3) */
/* OUT(2): Diffuse(3), Specular(3) NdotL(1) for toon ramp: point fltr +clamp mode */
void CalculateLights_half(half4 SpecColor, half Smoothness, half3 WPos, half3 WNormal, half3 WView,
out half3 Diffuse, out half3 Specular, out half NdotL)
{
@xCyborg
xCyborg / main.c
Created June 17, 2023 20:15
Simplest OpenGL Xcode Project
/*
* As a first example of using OpenGL in C,
* https://math.hws.edu/graphicsbook/source/glut/first-triangle.c
*/
#include <GLUT/glut.h> // freeglut.h might be a better alternative, if available.....
#include <stdio.h>
#include <stdlib.h>
void display(void) { // Display function will draw the image.