Skip to content

Instantly share code, notes, and snippets.

View Azerothian's full-sized avatar
♾️
Over thinking, over analyzing separates the body from the mind

Matthew Mckenzie Azerothian

♾️
Over thinking, over analyzing separates the body from the mind
View GitHub Profile
@Azerothian
Azerothian / gist:1605589
Created January 13, 2012 11:12
Axiom BrowserRender
void BrowserManager_BrowserRenderEvent(Guid id, System.Drawing.Bitmap screen)
{
if (id == _browserId)
{
_texture = TextureManager.Instance.CreateManual("DynamicTexture", ResourceGroupManager.DefaultResourceGroupName, TextureType.TwoD, screen.Width, screen.Height, 0, Axiom.Media.PixelFormat.R8G8B8A8, TextureUsage.RenderTarget);
_material = (Material)MaterialManager.Instance.Create("DynamicMaterial", ResourceGroupManager.DefaultResourceGroupName);
_material.GetTechnique(0).GetPass(0).CreateTextureUnitState("DynamicTexture");
var bitmapData = screen.LockBits(
new System.Drawing.Rectangle(0, 0, screen.Width, screen.Height),
@Azerothian
Azerothian / gist:1618683
Created January 16, 2012 02:17
Axiom BrowserRender
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Axiom.Graphics;
using Axiom.Core;
using Axiom.Media;
using System.Drawing.Imaging;
using System.IO;
@Azerothian
Azerothian / gist:1619473
Created January 16, 2012 06:53
AxiomEngine - Dynamic Textures
public void CreateScene()
{
_entity = _root.SceneManager.CreateEntity("CubeBrowser", PrefabEntity.Cube);
_sceneNode = Root.Instance.SceneManager.RootSceneNode.CreateChildSceneNode();
_sceneNode.AttachObject(_entity);
_sceneNode.Yaw(45);
_sceneNode.Position = new Vector3(0, 0, -300);
Bitmap bmp = new Bitmap(100, 100, System.Drawing.Imaging.PixelFormat.Format32bppArgb);
@Azerothian
Azerothian / gist:1619547
Created January 16, 2012 07:17
Bitmap To texture
/// <summary>
/// Bitmaps to texture.
/// </summary>
/// <param name="bmp">The BMP.</param>
/// <param name="texture">The texture.</param>
public unsafe static void BitmapToTexture(Bitmap bitmap, Texture texture)
{
var bmp = bitmap.Clone(new System.Drawing.Rectangle(0, 0, bitmap.Width, bitmap.Height), System.Drawing.Imaging.PixelFormat.Format32bppArgb);
@Azerothian
Azerothian / gist:1620120
Created January 16, 2012 10:14
Inputreader Win32
// Will capture the Inputs correctly // Mouse will dissappear
_inputReader.Initialize(_renderWindow, true, true, false, true);
_inputReader.UseKeyboardEvents = false;
_inputReader.UseMouseEvents = false;
// Mouse will not dissappear // will not fire off click events
_inputReader.Initialize(_renderWindow, true, true, false, true);
@Azerothian
Azerothian / gist:1620645
Created January 16, 2012 12:28
Intersections
RaySceneQuery SceneQuery = _root.SceneManager.CreateRayQuery(
_camera.GetCameraToViewportRay(
inputReader.AbsoluteMouseX / (float)_renderWindow.Width,
inputReader.AbsoluteMouseY / (float)_renderWindow.Height)
,
0x40000000
);
foreach (RaySceneQueryResultEntry result in SceneQuery.Execute())
{
@Azerothian
Azerothian / gist:1645029
Created January 20, 2012 04:03
Bitmap To texture
public unsafe static void BitmapToTexture(Bitmap bitmap, Texture texture)
{
var bmp = bitmap.Clone(new System.Drawing.Rectangle(0, 0, bitmap.Width, bitmap.Height), System.Drawing.Imaging.PixelFormat.Format32bppArgb);
var bitmapData = bmp.LockBits(
new System.Drawing.Rectangle(0, 0, bmp.Width, bmp.Height),
ImageLockMode.ReadOnly,
bmp.PixelFormat);
@Azerothian
Azerothian / gist:1897053
Created February 24, 2012 03:18
Axiom Patch - Added Tao v4.0 Project files
Index: Lib/Managed/XPlatform/Tao/2.1.0.0/source/src/Tao.Cg/Tao.Cg.v4.0.csproj
===================================================================
--- Lib/Managed/XPlatform/Tao/2.1.0.0/source/src/Tao.Cg/Tao.Cg.v4.0.csproj (revision 0)
+++ Lib/Managed/XPlatform/Tao/2.1.0.0/source/src/Tao.Cg/Tao.Cg.v4.0.csproj (working copy)
@@ -0,0 +1,90 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="4.0">
+ <PropertyGroup>
+ <ProjectType>Local</ProjectType>
+ <ProductVersion>8.0.50727</ProductVersion>
@Azerothian
Azerothian / controller.php
Created March 16, 2012 02:39
concrete5 vanilla intergration 1.0.2
<?php
defined('C5_EXECUTE') or die(_("Access Denied."));
class VanillaForumsPackage extends Package {
protected $pkgHandle = 'vanilla_forums';
protected $appVersionRequired = '5.5';
protected $pkgVersion = '1.0.2';
public function getPackageDescription() {
@Azerothian
Azerothian / gist:7854358
Created December 8, 2013 07:39
catch example that will maintain the original stack when a exception has been caught and is being rethrown
public void Test()
{
try {
throw new Exception();
} catch (Exception ex)
{
// do logging or what ever
throw;
}
}