Skip to content

Instantly share code, notes, and snippets.

View unitycoder's full-sized avatar
✅
‏‏‎

mika unitycoder

✅
‏‏‎
View GitHub Profile
@unitycoder
unitycoder / QT5-install-opensuse.md
Last active January 11, 2021 08:06
install openSUSE on windows pc
@unitycoder
unitycoder / Bresenham.js
Created January 8, 2021 17:05
Bresenham Lines
// old unityscript
function drawLine(x0:int, y0:int, x1:int, y1:int)
{
dx= Mathf.Abs(x1-x0);
dy= Mathf.Abs(y1-y0);
if (x0 < x1) {sx=1;}else{sx=-1;}
if (y0 < y1) {sy=1;}else{sy=-1;}
err=dx-dy;
loop=true;
@unitycoder
unitycoder / TCPImageClient.cs
Last active April 17, 2024 06:52
Receive Images From TCP
// http://answers.unity.com/answers/1741342/view.html
using UnityEngine;
using System.Threading;
using System.Net.Sockets;
using System.IO;
using System.Collections.Concurrent;
public class TCPImageStream : MonoBehaviour
{
@unitycoder
unitycoder / EnterPlayModeBindings.cs
Last active January 14, 2021 09:45
override editor shortcut keys (like ctrl+s) in game mode with custom shortcut profile and script
// https://forum.unity.com/threads/unwanted-editor-hotkeys-in-game-mode.182073/#post-6701407
[InitializeOnLoad]
public static class EnterPlayModeBindings
{
static EnterPlayModeBindings()
{
EditorApplication.playModeStateChanged += ModeChanged;
EditorApplication.quitting += Quitting;
}
@unitycoder
unitycoder / gLTF notes.md
Last active January 22, 2021 08:50
gLTF notes

vs OBJ

gltf

  • supports mesh compression
  • Compressed texture format
  • Binary buffers
  • single file export with embedded resources
@unitycoder
unitycoder / RecalculateVertexNormals.shader
Last active August 25, 2023 07:07
re-calculate vertex normals after vertex displacement
// https://forum.unity.com/threads/shader-question-how-to-recalculate-normals-after-vertices-displacement.903248/
// normal reconstruction after vertex displacement in real-time:
// Morph input shape (for example Sphere) to cube, with normal reconstruction and diffuse lighting
Shader "Other/RecalculateVertexNormals"
{
SubShader
{
Pass
{
@unitycoder
unitycoder / BakeStaticCubemap.cs
Created January 31, 2021 19:09
Source code for editor script to generate cubemaps for Unity
// https://developer.arm.com/documentation/100140/0100/advanced-techniques-in-unity/source-code-for-editor-script-to-generate-cubemaps-for-unity
/*
* This confidential and proprietary software may be used only as
* authorised by a licensing agreement from ARM Limited
* (C) COPYRIGHT 2014 ARM Limited
* ALL RIGHTS RESERVED
* The entire notice above must be reproduced on all authorised
* copies and copies may only be made to the extent permitted
* by a licensing agreement from ARM Limited.
@unitycoder
unitycoder / UVRotation.shader
Created February 2, 2021 12:32
UV rotation shader, UV transform shader
// https://forum.unity.com/threads/id-like-to-merge-the-two-shaders-below-how-to-script.1041223/
Shader "Custom/UV rotation"
{
Properties
{
_MainTex ("Texture", 2D) = "white" {}
_Angle ("Angle", Range(-5.0, 5.0)) = 0.0
}
SubShader
{