Skip to content

Instantly share code, notes, and snippets.

View PieroCastillo's full-sized avatar
🎯
Focusing

Piero Castillo PieroCastillo

🎯
Focusing
  • Lima, Perú
View GitHub Profile
@patriciogonzalezvivo
patriciogonzalezvivo / GLSL-Noise.md
Last active July 24, 2024 14:58
GLSL Noise Algorithms

Please consider using http://lygia.xyz instead of copy/pasting this functions. It expand suport for voronoi, voronoise, fbm, noise, worley, noise, derivatives and much more, through simple file dependencies. Take a look to https://github.com/patriciogonzalezvivo/lygia/tree/main/generative

Generic 1,2,3 Noise

float rand(float n){return fract(sin(n) * 43758.5453123);}

float noise(float p){
	float fl = floor(p);
  float fc = fract(p);
@JokerMartini
JokerMartini / Solid Fragment Shader | .gs
Last active May 14, 2021 23:30
GLSL Shader: A simple solid color shader
void main()
{
gl_FragColor = vec4(1.0,0.5,0.5,.5);
}
@sheredom
sheredom / VkComputeSample
Created May 29, 2016 19:14
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
@loretoparisi
loretoparisi / ffmpeg_frames.sh
Last active April 19, 2024 05:17
Extract all frames from a movie using ffmpeg
# Output a single frame from the video into an image file:
ffmpeg -i input.mov -ss 00:00:14.435 -vframes 1 out.png
# Output one image every second, named out1.png, out2.png, out3.png, etc.
# The %01d dictates that the ordinal number of each output image will be formatted using 1 digits.
ffmpeg -i input.mov -vf fps=1 out%d.png
# Output one image every minute, named out001.jpg, out002.jpg, out003.jpg, etc.
# The %02d dictates that the ordinal number of each output image will be formatted using 2 digits.
ffmpeg -i input.mov -vf fps=1/60 out%02d.jpg
@SaschaWillems
SaschaWillems / vk.cpp
Last active November 23, 2023 10:02
Multiple Vulkan buffer binding points
Shader
layout (location = 0) in vec3 inPos;
layout (location = 1) in vec3 inColor;
layout (location = 2) in vec3 inPosB;
layout (location = 3) in vec3 inColorB;
...
Application
@zihotki
zihotki / Lighter or Darker a Color.cs
Created December 17, 2017 00:17
.net C# make a color lighter or darker
/// <summary>
/// Creates color with corrected brightness.
/// </summary>
/// <param name="color">Color to correct.</param>
/// <param name="correctionFactor">The brightness correction factor. Must be between -1 and 1.
/// Negative values produce darker colors.</param>
/// <returns>
/// Corrected <see cref="Color"/> structure.
/// </returns>
public static Color ChangeColorBrightness(Color color, float correctionFactor)
@AlexanderBaggett
AlexanderBaggett / gist:d1504da93727a1778e8b5b3453946fc1
Last active March 11, 2024 23:25
Full win32 window from C# with Pinvoke
In this post, .net platform has this pinvoke mechanism where it is allowed that you call into the Native windows .
this is extremely useful when you have some 3rd party libraries or if you try to program against with the low-level windows APIS.
One of the typic application htat utilize the Lowe-level windows apis are those Native win32 applications. Where you creat a message pump with the necessary WNDCLASSEX to represent/register the window message pump and message handler process. What you will deal with the win32 applications include the following.
RegisterClassEx, CreateWindowEx, GetMessage(), TranslateMesage(), and DispatchMessage(...).
to be able to use the Window API, you have to declare tons of Structure and PInvoke Method, while you can find help from the Pinvoke.Net.
First, we will introduce some of the win32/user32 functions and their relative structure definitions.
@jtbrower
jtbrower / SimpleSoundPlayer.cs
Created September 25, 2020 16:23
Play a Sound Wave File in .Net, NetCore and Net5.0 without additional Media Libraries
namespace Gist
{
using System.Runtime.InteropServices;
//NOTICE : Applicable only to Windows and wav files
////////////////////////////////////////////////////////////////////////////////////////////////////
/// <summary>
/// A class that uses PInvoke to play a wave file in DotNet Core, .Net and Net5.0. This function
/// will not work on non Windows platforms, but does work on alternative UI frameworks such as
@PieroCastillo
PieroCastillo / Minimal SharpAudio Program.cs
Created March 18, 2021 19:33
Minimal Program using SharpAudio
using System;
using System.Collections.Generic;
using System.IO;
using System.Threading;
using SharpAudio.Codec;
namespace SharpAudio.Sample
{
class Program
{