Skip to content

Instantly share code, notes, and snippets.

View Martin-Pitt's full-sized avatar

Martin "Nexii" Pitt Martin-Pitt

View GitHub Profile

Number Display Revised

Done a bunch of maths and scripting to revise this mesh design to optimise it.

It'll feature a rectangular panel to display 3 digits at once using a texture that has numbers from 0-999. There will be three of these digit panels each with a separate material.

Between the digit panels will be locations for separators such as commas or points.

I also want to be able to support negative numbers. After a lot of thought, the best way to approach this would be to slide a minus character left/right depending on how many digits the number has visible. So there would have to be a long thin rectangle going through all digit panels as well as extending out so that I can place the minus when the display has all 9 digits occupied.

In terms of relative sizes to reference for the geometry (via pixels in the font texture):

@Martin-Pitt
Martin-Pitt / technical-meshes.md
Created October 21, 2024 11:12
Technical Meshes Commission

A set of meshes and variants for technical use. These are very low poly but all with same LOD levels to make sure they always appear correctly.

These are 'technical' meshes in the sense they are used for scripting user interfaces. So they are very low poly but have certain useful exact shapes and UV mapping.

A lot of my inspiration was drawn from looking at Game UI Database — I'd love to be able to recreate a lot of these UIs and was wondering what it would take to do that in SL.

Layered Icons

A mesh for displaying icons.

Contains these layers in order from front to back:

  • Superscript Icon — for showing a small sub-icon in the top right
key object;
default
{
state_entry()
{
llSetScale(llGetAgentSize(llGetOwner()));
llSensorRepeat("Target", "", ACTIVE|PASSIVE, 96.0, TWO_PI, 1.0);
}
@Martin-Pitt
Martin-Pitt / interpolation.js
Created February 15, 2024 01:16
Rescale Interpolation
/*
More interesting interpolation functions to make life easier.
Rescale is a function which can interpolate a value between two different ranges.
Say you have a number which represents the position of a slider.
The slider has a start and end as well.
You want the slider to control a box between two locations.
So you could do the following:
@Martin-Pitt
Martin-Pitt / capture.mjs
Created October 29, 2023 11:59
Codepen screen recording
import { promises as fs } from 'fs';
import path from 'path';
import puppeteer from 'puppeteer';
import { PuppeteerScreenRecorder } from 'puppeteer-screen-recorder';
const viewport = {
width: 512,
height: 512,
deviceScaleFactor: 1,
// isMobile: true,
@Martin-Pitt
Martin-Pitt / render-bestagons.js
Created July 21, 2023 19:24
How to render clip-path hexagons (bestagons), this function creates the clip-path polygon function values for you, with vmax so it always acts like background cover algorithm
const RowStep = 14.39
const ColumnStep = RowStep * 5/6; // 37.5;
const HexMax = ColumnStep * 4/3;
const HexMin = ColumnStep * 2/3;
const Rows = Math.ceil(100 / RowStep);
const Columns = Math.ceil(100 / ColumnStep);
function renderBestagons(t = 1) {
let polygons = [];
let r = Rows;
module.exports = {
config: {
fontSize: 16,
fontFamily: '"Fira Code", Menlo, "DejaVu Sans Mono", Consolas, "Lucida Console", monospace',
cursorColor: 'hsla(215, 100%, 90%, 1)',
cursorShape: 'BEAM',
foregroundColor: 'white',
backgroundColor: 'hsla(0, 0%, 0%, 0)',
borderColor: 'hsl(215, 20%, 20%)',
css: `
@Martin-Pitt
Martin-Pitt / pan-zoom-touch-and-trackpad.js
Last active September 9, 2024 16:51
Panning and Pinch-Zoom gesture handler for both touchscreens and trackpads; Works really well on a MacBook trackpad
// Target state
var tx = 0;
var ty = 0;
var scale = 1;
function visualiseTargetState() {
box.style.transform = `translate(${tx}px, ${ty}px) scale(${scale})`;
}
Room&
Status
Event starts within 10m -> Booked
Free
Use now -> In Use
Booked
Check in -> In Use
10m grace period -> Free
Clients
List*
Client -> Detail
Add -> New Client
Detail
Unchanged*
Blur or close -> List
Edit a field -> Edited Details
Delete and confirm -> List
Edited Details