Skip to content

Instantly share code, notes, and snippets.

View lardratboy's full-sized avatar

Brad P. Taylor lardratboy

View GitHub Profile
@lardratboy
lardratboy / DataViewAs.js
Last active November 11, 2024 23:55
Asked claude.ai for a wrapper around the DataView class - results were interesting
// Data type ranges and normalization functions
const DATA_RANGES = {
'int8': [-128, 127],
'uint8': [0, 255],
'int16': [-32768, 32767],
'uint16': [0, 65535],
'int32': [-2147483648, 2147483647],
'uint32': [0, 4294967295],
};
@lardratboy
lardratboy / puke_bpt.py
Last active May 29, 2024 20:32
quick and dirty tool to display the chunk structure of a .bpt file
import io, struct, argparse
class Chunk:
def __init__(self, id):
self.id = id
self.children = []
def process_chunk( input, size_encoding, parent_chunk, remaining_data, depth = 0 ):
if None != parent_chunk.id and not parent_chunk.id in [ 'aBPT', 'aLII', 'aFRM', 'aLYR', 'aVEL', 'nPAL', 'nAMS', 'aANM', 'nFMS', 'nVLS', 'nLIS', 'nLRS' ]:
input.seek( input.tell() + remaining_data )
@lardratboy
lardratboy / repack.py
Last active May 31, 2024 17:50
quick and dirty 2D rectangle packer, for best results insert items in sorted order largest to smallest
class Rect:
def __init__(self, left, top, right, bottom):
self.left = left
self.top = top
self.right = right
self.bottom = bottom
def width(self):
@lardratboy
lardratboy / BPTRenderMaterialAs.cs
Last active November 23, 2015 23:28
Unity3d Utility Extension to render a Material to a .PNG (or JPG)
using UnityEngine;
#if UNITY_EDITOR
using System;
using System.Collections;
using System.Collections.Generic;
using System.IO;
using UnityEditor;
#endif
@lardratboy
lardratboy / Test
Created February 4, 2015 23:11
Test
package test;
public class Test {
static int[][] MAP_A = {
{0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},
{0,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0},
{0,0,0,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0},
{0,0,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0},
{0,0,0,0,0,0,0,0,1,0,1,0,0,0,1,1,1,0},
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ironictest
{
class Program
{
@lardratboy
lardratboy / PSD.h
Created December 11, 2014 02:26
This is an expanded version of the my PSD reader - handles layers, named alphas it is a bit messy but what living code isn't...
// Adobe Photoshop .PSD bitmap file loader
//
// Copyright (c) 2002, Brad P. Taylor, LLC
//
// All rights reserved, unauthorized reproduction prohibited
//
// -- FILE NOTES --
//
//////////////////////////////////////////////////////////////////////
@lardratboy
lardratboy / BPTDib.h
Created December 11, 2014 02:03
Another bit of code from BPainT this time from the windows display code
// BPTDib.h: interface for the BPTDib class.
//
// Copyright (c) 2000, Brad P. Taylor, LLC
//
// All rights reserved, unauthorized reproduction prohibited
//
// -- FILE NOTES --
//
//////////////////////////////////////////////////////////////////////
@lardratboy
lardratboy / BPTSRL.h
Created December 11, 2014 01:59
Adding some sample code for people to look at, here is a piece from BPainT this time
// BPTSRL.h: interface for the CBPTSRL class.
//
// Copyright (c) 2000, Brad P. Taylor, LLC
//
// All rights reserved, unauthorized reproduction prohibited
//
// -- FILE NOTES --
//
//////////////////////////////////////////////////////////////////////
@lardratboy
lardratboy / BPT_Pixels_2003.h
Last active August 29, 2015 14:09
Started looking at upgrading the pixel types used by the LSD engine, using this as an archive/reference.
// BPTLLC_Pixels.h
//
// Copyright (c) 2003, Brad P. Taylor, LLC
//
// All rights reserved, unauthorized reproduction prohibited
//
// -- FILE NOTES --
//
// **Portablilty warning**
//