Skip to content

Instantly share code, notes, and snippets.

@deanhu2
deanhu2 / Blend Add Particle.shader
Created Jun 29, 2018 — forked from ThePhiMa/Blend Add Particle.shader
Blend Add Shader (as used in Diablo 3)
View Blend Add Particle.shader
// Blend Add Shader (as used in Diablo 3)
// Uses the alpha channel to determine if the pixel needs to be blended additively or by transparency.
// Is a good way prevent the additive buildup that makes a scene with a lot of particle effects white and unreadable while still having some particle texture features.
// Idea by Julian Love - http://www.gdcvault.com/play/1017660/Technical-Artist-Bootcamp-The-VFX
Shader "Custom/Blend Add Particle Test"
{
Properties
{
_MainTex("Base (RGB) Trans (A)", 2D) = "white" {}
_BlendThreshold("Blend Treshold (0.0:Additive, 1.0:Trasparency)", Range(0.0, 1.0)) = 0.5
@deanhu2
deanhu2 / hello_triangle.cpp
Created Mar 11, 2018 — forked from SuperV1234/hello_triangle.cpp
SDL2 + OpenGL ES 2.0 - "Hello triangle" example that works both on X11 and Emscripten
View hello_triangle.cpp
#include <exception>
#include <functional>
#ifdef __EMSCRIPTEN__
#include <emscripten.h>
#include <SDL.h>
#include <SDL_image.h>
#include <SDL_ttf.h>
View CallCFunction.rs
extern {
// Our C function definitions!
pub fn strcpy(dest: *mut u8, src: *const u8) -> *mut u8;
pub fn puts(s: *const u8) -> i32;
}
fn main() {
let x = b"Hello, world!\0"; // our string to copy
let mut y = [0u8; 32]; // declare some space on the stack to copy the string into
unsafe {
@deanhu2
deanhu2 / k_means_anchor_points.py
Created Jan 23, 2018 — forked from WillieMaddox/k_means_anchor_points.py
create darknet anchor points using k-means. Uses fast numpy array ops: pascal ~= 1.0 s coco ~= 16 s
View k_means_anchor_points.py
# -*- coding: utf-8 -*-
import numpy as np
import xml.etree.ElementTree as ET
from pycocotools.coco import COCO
def convert_coco_bbox(size, box):
dw = 1. / size[0]
dh = 1. / size[1]
x = box[0] + box[2] / 2.0
@deanhu2
deanhu2 / sgdlinreg.java
Created Jan 4, 2018 — forked from ngopal/sgdlinreg.java
Stochastic Gradient Descent, but this time in Java.
View sgdlinreg.java
package com.nikhilgopal.spark;
/**
* Created by nikhilgopal on 3/24/17.
*/
public class SGDLinReg {
public static void main(String[] args) {
double[] coefficients = {0.4, 0.8};
double[][] dataset = {
{1.0, 1.0},
@deanhu2
deanhu2 / 1_install_cuda.sh
Last active Dec 29, 2017 — forked from graphific/1_install_cuda.sh
Installation script for Cuda and drivers on Ubuntu 14.04
View 1_install_cuda.sh
#!/usr/bin/env bash
# Installation script for Cuda and drivers on Ubuntu 14.04, by Roelof Pieters (@graphific)
# BSD License
if [ "$(whoami)" == "root" ]; then
echo "running as root, please run as user you want to have stuff installed as"
exit 1
fi
###################################
# Ubuntu 14.04 Install script for:
# - Nvidia graphic drivers for Titan X: 352
View XMLParser.cpp
#include <iostream>
using namespace std;
void loadXML(std::string xml)
{
std::cout << xml;
}
int main()
@deanhu2
deanhu2 / UI.cpp
Last active Nov 8, 2017
A simple example on abstracting a UI interface, and creating a MVVM register component that controls communication via events.
View UI.cpp
/******************************************************************************
Online C++ Compiler.
Code, Compile, Run and Debug C++ program online.
Write your code in this editor and press "Run" button to compile and execute it.
*******************************************************************************/
#include "stdafx.h"
#include <iostream>
#include <vector>
#include <utility>
#include <map>
@deanhu2
deanhu2 / shape.cpp
Last active Nov 1, 2017
Minimal example of a shape interface and extending it to create a basic square object.
View shape.cpp
/******************************************************************************
Online C++ Compiler.
Code, Compile, Run and Debug C++ program online.
Write your code in this editor and press "Run" button to compile and execute it.
*******************************************************************************/
#include <iostream>