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: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: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: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: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),
var buffer = _texture.GetBuffer();
buffer.Lock(Axiom.Graphics.BufferLocking.Normal);
DirectX does not allow locking of or directly writing to RenderTargets.
Use BlitFromMemory if you need the contents.
@Azerothian
Azerothian / gist:1375166
Created November 18, 2011 00:58 — forked from bdallen/gist:1375162
Blah
List<normutils.data.Entities.DHCPLease> _leases;
using (ISession session = Global._DatabaseConn.OpenSession())
{
using (ITransaction transaction = session.BeginTransaction())
{
// Get list of all Leases
//Leases = session.CreateCriteria(typeof(normutils.data.Entities.DHCPLease)).List<normutils.data.Entities.DHCPLease>();
var LQ = session.Query<normutils.data.Entities.DHCPLease>();
_leases = (from v in LQ
where v.BindState == "active"
-- Serverside --
nowjs.on('connect', function() {
util.log('Sending Message?');
this.now.receiveMessage('SERVER', 'Welcome to NowJS.');
});
everyone.now.distributeMessage = function(message) {
everyone.now.receiveMessage(this.now.name, message);
public override int Read(byte[] buffer, int offset, int count)
{
lock (_incomingLock)
{
_incomingMemoryStream.Position = 0;
var cnt = _incomingMemoryStream.Read(buffer, offset, count);
int amountleft = (int)(_incomingMemoryStream.Length - _incomingMemoryStream.Position);
var newMs = new MemoryStream();
if (amountleft > 0)
{
RewriteEngine on
RewriteCond %{SERVER_PORT} !^80$
RewriteRule ^(.*) http://%{SERVER_NAME}%{REQUEST_URI} [L]
// -------------------------------------
// - Branches Table Mapping - Branches.cs
// -------------------------------------
// Initial Table Mapping - 01.02.2011 - B Allen
using System;
using System.Collections.Generic;
using System.Data.Linq;
using System.Text;
using normist.data.Abstraction;
using NHibernate.Mapping.Attributes;