Skip to content

Instantly share code, notes, and snippets.

@Noxalus
Noxalus / gist:a36e52f62cb45585cdf7
Last active August 29, 2015 14:21
OpenCV draw a simple circle
void proccessImage(std::vector<unsigned char>& imageData, int width, int height)
{
// Create cv::Mat from std::vector<unsigned char>
Mat src(width, height, CV_8UC4, const_cast<unsigned char*>(imageData.data()));
Mat final;
// Draw a circle at position (300, 200) with a radius of 30
cv::Point center(300, 200);
circle(src, center, 30.f, CV_RGB(0, 0, 255), 3, 8, 0);
@Noxalus
Noxalus / gist:37a4e7a40ac70037f6b2
Last active August 29, 2015 14:14
Take 4 random values in an array with no duplicate entry
<?php
$array = array(
'42' => 'COUCOU1',
'87' => 'COUCOU2',
'38' => 'COUCOU3',
'98' => 'COUCOU4',
'74' => 'COUCOU5',
'16' => 'COUCOU6'
);
@Noxalus
Noxalus / gist:0b991c99cc122b031dd5
Created May 28, 2014 08:48
Add UIWebView to SDLwindow*
SDLwindow* sdlWindow = getWindow();
SDL_SysWMinfo info;
window* window;
SDL_VERSION(&info.version);
if (SDL_GetWindowWMInfo(sdlWindow, &info))
{
window = (info.info.uikit.window);
@Noxalus
Noxalus / main.cpp
Created March 25, 2014 17:27
Multiple camera rendering problem with render target
#include "minko/Minko.hpp"
#include "minko/MinkoSDL.hpp"
#include "minko/MinkoPNG.hpp"
using namespace minko;
using namespace minko::math;
using namespace minko::component;
const uint WINDOW_WIDTH = 800;
const uint WINDOW_HEIGHT = 600;
@Noxalus
Noxalus / gist:8213607
Created January 2, 2014 01:14
DrawRefraction C# method.
private void DrawRefractionMap()
{
_device.SetRenderTarget(_refractionRenderTarget);
_device.Clear(ClearOptions.Target, Color.CornflowerBlue, 1.0f, 1);
DrawSkybox(_viewMatrix, _projectionMatrix, _cameraPosition);
DrawTerrain(_refractionEffect, _viewMatrix);
_device.SetRenderTarget(null);
@Noxalus
Noxalus / Refraction.fx
Created January 2, 2014 00:31
HLSL refraction shader.
float4x4 World;
float4x4 View;
float4x4 Projection;
Texture2D Texture;
float4 ClippingPlane;
sampler2D SampleType = sampler_state
{
Texture = <Texture>;
MinFilter = LINEAR;
@Noxalus
Noxalus / gist:6466060
Created September 6, 2013 16:10
Lidgren cut the disconnect string.
NetIncomingMessage incMsg;
NetConnection sender;
while ((incMsg = server.ReadMessage()) != null)
{
sender = incMsg.SenderConnection;
Client t_client = clients.GetClientFromConnection(sender);
switch (incMsg.MessageType)
{
case NetIncomingMessageType.StatusChanged:
if (sender.Status == NetConnectionStatus.Connected)