Skip to content

Commit

Permalink
snoggledog
Browse files Browse the repository at this point in the history
  • Loading branch information
CCIGAMES committed Mar 2, 2024
1 parent 0eb7142 commit ded8339
Show file tree
Hide file tree
Showing 6 changed files with 203 additions and 0 deletions.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
80 changes: 80 additions & 0 deletions sonic3air-main/Oxygen/oxygenengine/data/font/smallfont.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
{
"ascender": "5",
"descender": "0",
"lineheight": "6",
"space": "1",

"texture": "smallfont.png",
"characters":
{
"0": "1 1 3 5",
"1": "5 1 3 5",
"2": "9 1 3 5",
"3": "13 1 3 5",
"4": "17 1 3 5",
"5": "21 1 3 5",
"6": "25 1 3 5",
"7": "29 1 3 5",
"8": "33 1 3 5",
"9": "37 1 3 5",
".": "41 1 1 5",
"\u02c5": "43 1 3 5",
" ": "47 1 2 5",

"A": "50 1 3 5",
"B": "54 1 3 5",
"C": "58 1 3 5",
"D": "62 1 3 5",
"E": "66 1 3 5",
"F": "70 1 3 5",
"G": "74 1 3 5",
"H": "78 1 3 5",
"I": "82 1 1 5",
"J": "84 1 3 5",
"K": "88 1 3 5",
"L": "92 1 3 5",
"M": "96 1 5 5",
"N": "102 1 3 5",
"O": "106 1 3 5",
"P": "110 1 3 5",
"Q": "114 1 3 5",
"R": "118 1 3 5",
"S": "122 1 3 5",
"T": "126 1 3 5",
"U": "130 1 3 5",
"V": "134 1 3 5",
"W": "138 1 5 5",
"X": "144 1 3 5",
"Y": "148 1 3 5",
"Z": "152 1 3 5",

"a": "redirect: A",
"b": "redirect: B",
"c": "redirect: C",
"d": "redirect: D",
"e": "redirect: E",
"f": "redirect: F",
"g": "redirect: G",
"h": "redirect: H",
"i": "redirect: I",
"j": "redirect: J",
"k": "redirect: K",
"l": "redirect: L",
"m": "redirect: M",
"n": "redirect: N",
"o": "redirect: O",
"p": "redirect: P",
"q": "redirect: Q",
"r": "redirect: R",
"s": "redirect: S",
"t": "redirect: T",
"u": "redirect: U",
"v": "redirect: V",
"w": "redirect: W",
"x": "redirect: X",
"y": "redirect: Y",
"z": "redirect: Z",

"/": "158 1 7 5"
}
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
123 changes: 123 additions & 0 deletions sonic3air-main/Oxygen/oxygenengine/data/shader/debugdraw_plane.shader
Original file line number Diff line number Diff line change
@@ -0,0 +1,123 @@

## ----- Shared -------------------------------------------------------------------

// Needed for isamplerBuffer
#version 140

precision mediump float;
precision mediump int;



## ----- Vertex -------------------------------------------------------------------

in vec2 position;
out vec2 uv0;

void main()
{
uv0.xy = position.xy;
gl_Position.x = position.x * 2.0 - 1.0;
gl_Position.y = 1.0 - position.y * 2.0;
gl_Position.z = 0.0;
gl_Position.w = 1.0;
}



## ----- Fragment -----------------------------------------------------------------

in vec2 uv0;
out vec4 FragColor;

uniform isamplerBuffer IndexTexture;
uniform isamplerBuffer PatternCacheTexture;
uniform sampler2D PaletteTexture;
uniform ivec4 PlayfieldSize;
uniform int HighlightPrio; // 0 or 1


vec4 getPaletteColor(int paletteIndex, float paletteOffsetY)
{
#ifdef GL_ES
int paletteY = paletteIndex / 256;
int paletteX = paletteIndex - paletteY * 256;
#else
int paletteX = paletteIndex & 0xff;
int paletteY = paletteIndex >> 8;
#endif
vec2 samplePosition = vec2((float(paletteX) + 0.5) / 256.0, (float(paletteY) + 0.5) / 4.0 + paletteOffsetY);
return texture(PaletteTexture, samplePosition);
}


void main()
{
int ix = int(uv0.x * float(PlayfieldSize.x));
int iy = int(uv0.y * float(PlayfieldSize.y));

int patternX = int(ix / 8);
int patternY = int(iy / 8);
int localX = ix - patternX * 8;
int localY = iy - patternY * 8;

#ifdef USE_BUFFER_TEXTURES
int patternIndex = texelFetch(IndexTexture, patternX + patternY * PlayfieldSize.z).x;
// No support for GL_ES here
#else
vec2 texel = texture(IndexTexture, vec2((float(patternX + patternY * PlayfieldSize.z) + 0.5) / float(PlayfieldSize.z * PlayfieldSize.w), 0.5)).ra;
int patternIndexH = int(texel.y * 255.5);
int patternIndexL = int(texel.x * 255.5);
#ifndef GL_ES
int patternIndex = patternIndexL + patternIndexH * 256;
#endif
#endif

#ifdef GL_ES
int atex = int((patternIndexH - int(patternIndexH / 0x80) * 0x80) / 0x20) * 0x10;
localX = ((patternIndexH - int(patternIndexH / 0x10) * 0x10) < 0x08) ? localX : (7 - localX);
localY = ((patternIndexH - int(patternIndexH / 0x20) * 0x20) < 0x10) ? localY : (7 - localY);
#else
int atex = (patternIndex >> 9) & 0x30;
localX = ((patternIndex & 0x0800) == 0) ? localX : (7 - localX);
localY = ((patternIndex & 0x1000) == 0) ? localY : (7 - localY);
#endif

int patternCacheLookupIndexX = localX + localY * 8;
#ifdef GL_ES
int patternCacheLookupIndexY = patternIndexL + (patternIndexH - int(patternIndexH / 8) * 8) * 0x100;
#else
int patternCacheLookupIndexY = patternIndex & 0x07ff;
#endif
#ifdef USE_BUFFER_TEXTURES
int paletteIndex = texelFetch(PatternCacheTexture, patternCacheLookupIndexX + patternCacheLookupIndexY * 64).x;
#else
int paletteIndex = int(texture(PatternCacheTexture, vec2((float(patternCacheLookupIndexX) + 0.5) / 64.0, (float(patternCacheLookupIndexY) + 0.5) / 2048.0)).x * 256.0);
#endif
paletteIndex += atex;

vec4 color = getPaletteColor(paletteIndex, 0.0);
if ((patternIndex >> 15) < HighlightPrio)
color.rgb *= 0.3;

// Only for debugging
/*
vec3 bgcolor = vec3(1.0, 1.0, 1.0) * ((((localX + localY) & 0x02) == 0) ? 0.2 : 0.1);
color.rgb = color.rgb * color.a + bgcolor * (1.0 - color.a);
*/
color.a = 1.0;

FragColor = color;
}



## ----- TECH ---------------------------------------------------------------------

technique Standard
{
blendfunc = opaque;
vs = Shared + Vertex;
fs = Shared + Fragment;
vertexattrib[0] = position;
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit ded8339

Please sign in to comment.