chore: run dotnet format scoped default (was previously scoped to just 'style')
This commit is contained in:
parent
8799edf99b
commit
c06874f14a
23 changed files with 749 additions and 485 deletions
|
|
@ -210,7 +210,8 @@ public unsafe partial class AmpEnvelope : IExample
|
|||
}
|
||||
}
|
||||
break;
|
||||
default: break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -88,10 +88,18 @@ public unsafe partial class StreamCallback : IExample
|
|||
{
|
||||
switch (waveType)
|
||||
{
|
||||
case WaveType.Sine: SetAudioStreamCallback(stream, &SineCallback); break;
|
||||
case WaveType.Square: SetAudioStreamCallback(stream, &SquareCallback); break;
|
||||
case WaveType.Triangle: SetAudioStreamCallback(stream, &TriangleCallback); break;
|
||||
case WaveType.Sawtooth: SetAudioStreamCallback(stream, &SawtoothCallback); break;
|
||||
case WaveType.Sine:
|
||||
SetAudioStreamCallback(stream, &SineCallback);
|
||||
break;
|
||||
case WaveType.Square:
|
||||
SetAudioStreamCallback(stream, &SquareCallback);
|
||||
break;
|
||||
case WaveType.Triangle:
|
||||
SetAudioStreamCallback(stream, &TriangleCallback);
|
||||
break;
|
||||
case WaveType.Sawtooth:
|
||||
SetAudioStreamCallback(stream, &SawtoothCallback);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -243,13 +243,19 @@ public partial class Camera3dFps : IExample
|
|||
// Clamp view up
|
||||
float maxAngleUp = Vector3Angle(up, yaw);
|
||||
maxAngleUp -= 0.001f; // Avoid numerical errors
|
||||
if (-(lookRotation.Y) > maxAngleUp) { lookRotation.Y = -maxAngleUp; }
|
||||
if (-(lookRotation.Y) > maxAngleUp)
|
||||
{
|
||||
lookRotation.Y = -maxAngleUp;
|
||||
}
|
||||
|
||||
// Clamp view down
|
||||
float maxAngleDown = Vector3Angle(Vector3Negate(up), yaw);
|
||||
maxAngleDown *= -1.0f; // Downwards angle is negative
|
||||
maxAngleDown += 0.001f; // Avoid numerical errors
|
||||
if (-(lookRotation.Y) < maxAngleDown) { lookRotation.Y = -maxAngleDown; }
|
||||
if (-(lookRotation.Y) < maxAngleDown)
|
||||
{
|
||||
lookRotation.Y = -maxAngleDown;
|
||||
}
|
||||
|
||||
// Up and down
|
||||
Vector3 right = Vector3Normalize(Vector3CrossProduct(yaw, up));
|
||||
|
|
|
|||
|
|
@ -237,112 +237,218 @@ public partial class KeyboardTestbed : IExample
|
|||
{
|
||||
switch ((KeyboardKey)key)
|
||||
{
|
||||
case KeyboardKey.Apostrophe: return "'"; // Key: '
|
||||
case KeyboardKey.Comma: return ","; // Key: ,
|
||||
case KeyboardKey.Minus: return "-"; // Key: -
|
||||
case KeyboardKey.Period: return "."; // Key: .
|
||||
case KeyboardKey.Slash: return "/"; // Key: /
|
||||
case KeyboardKey.Zero: return "0"; // Key: 0
|
||||
case KeyboardKey.One: return "1"; // Key: 1
|
||||
case KeyboardKey.Two: return "2"; // Key: 2
|
||||
case KeyboardKey.Three: return "3"; // Key: 3
|
||||
case KeyboardKey.Four: return "4"; // Key: 4
|
||||
case KeyboardKey.Five: return "5"; // Key: 5
|
||||
case KeyboardKey.Six: return "6"; // Key: 6
|
||||
case KeyboardKey.Seven: return "7"; // Key: 7
|
||||
case KeyboardKey.Eight: return "8"; // Key: 8
|
||||
case KeyboardKey.Nine: return "9"; // Key: 9
|
||||
case KeyboardKey.Semicolon: return ";"; // Key: ;
|
||||
case KeyboardKey.Equal: return "="; // Key: =
|
||||
case KeyboardKey.A: return "A"; // Key: A | a
|
||||
case KeyboardKey.B: return "B"; // Key: B | b
|
||||
case KeyboardKey.C: return "C"; // Key: C | c
|
||||
case KeyboardKey.D: return "D"; // Key: D | d
|
||||
case KeyboardKey.E: return "E"; // Key: E | e
|
||||
case KeyboardKey.F: return "F"; // Key: F | f
|
||||
case KeyboardKey.G: return "G"; // Key: G | g
|
||||
case KeyboardKey.H: return "H"; // Key: H | h
|
||||
case KeyboardKey.I: return "I"; // Key: I | i
|
||||
case KeyboardKey.J: return "J"; // Key: J | j
|
||||
case KeyboardKey.K: return "K"; // Key: K | k
|
||||
case KeyboardKey.L: return "L"; // Key: L | l
|
||||
case KeyboardKey.M: return "M"; // Key: M | m
|
||||
case KeyboardKey.N: return "N"; // Key: N | n
|
||||
case KeyboardKey.O: return "O"; // Key: O | o
|
||||
case KeyboardKey.P: return "P"; // Key: P | p
|
||||
case KeyboardKey.Q: return "Q"; // Key: Q | q
|
||||
case KeyboardKey.R: return "R"; // Key: R | r
|
||||
case KeyboardKey.S: return "S"; // Key: S | s
|
||||
case KeyboardKey.T: return "T"; // Key: T | t
|
||||
case KeyboardKey.U: return "U"; // Key: U | u
|
||||
case KeyboardKey.V: return "V"; // Key: V | v
|
||||
case KeyboardKey.W: return "W"; // Key: W | w
|
||||
case KeyboardKey.X: return "X"; // Key: X | x
|
||||
case KeyboardKey.Y: return "Y"; // Key: Y | y
|
||||
case KeyboardKey.Z: return "Z"; // Key: Z | z
|
||||
case KeyboardKey.LeftBracket: return "["; // Key: [
|
||||
case KeyboardKey.Backslash: return "\\"; // Key: '\'
|
||||
case KeyboardKey.RightBracket: return "]"; // Key: ]
|
||||
case KeyboardKey.Grave: return "`"; // Key: `
|
||||
case KeyboardKey.Space: return "SPACE"; // Key: Space
|
||||
case KeyboardKey.Escape: return "ESC"; // Key: Esc
|
||||
case KeyboardKey.Enter: return "ENTER"; // Key: Enter
|
||||
case KeyboardKey.Tab: return "TAB"; // Key: Tab
|
||||
case KeyboardKey.Backspace: return "BACK"; // Key: Backspace
|
||||
case KeyboardKey.Insert: return "INS"; // Key: Ins
|
||||
case KeyboardKey.Delete: return "DEL"; // Key: Del
|
||||
case KeyboardKey.Right: return "RIGHT"; // Key: Cursor right
|
||||
case KeyboardKey.Left: return "LEFT"; // Key: Cursor left
|
||||
case KeyboardKey.Down: return "DOWN"; // Key: Cursor down
|
||||
case KeyboardKey.Up: return "UP"; // Key: Cursor up
|
||||
case KeyboardKey.PageUp: return "PGUP"; // Key: Page up
|
||||
case KeyboardKey.PageDown: return "PGDOWN"; // Key: Page down
|
||||
case KeyboardKey.Home: return "HOME"; // Key: Home
|
||||
case KeyboardKey.End: return "END"; // Key: End
|
||||
case KeyboardKey.CapsLock: return "CAPS"; // Key: Caps lock
|
||||
case KeyboardKey.ScrollLock: return "LOCK"; // Key: Scroll down
|
||||
case KeyboardKey.NumLock: return "NUMLOCK"; // Key: Num lock
|
||||
case KeyboardKey.PrintScreen: return "PRINTSCR"; // Key: Print screen
|
||||
case KeyboardKey.Pause: return "PAUSE"; // Key: Pause
|
||||
case KeyboardKey.F1: return "F1"; // Key: F1
|
||||
case KeyboardKey.F2: return "F2"; // Key: F2
|
||||
case KeyboardKey.F3: return "F3"; // Key: F3
|
||||
case KeyboardKey.F4: return "F4"; // Key: F4
|
||||
case KeyboardKey.F5: return "F5"; // Key: F5
|
||||
case KeyboardKey.F6: return "F6"; // Key: F6
|
||||
case KeyboardKey.F7: return "F7"; // Key: F7
|
||||
case KeyboardKey.F8: return "F8"; // Key: F8
|
||||
case KeyboardKey.F9: return "F9"; // Key: F9
|
||||
case KeyboardKey.F10: return "F10"; // Key: F10
|
||||
case KeyboardKey.F11: return "F11"; // Key: F11
|
||||
case KeyboardKey.F12: return "F12"; // Key: F12
|
||||
case KeyboardKey.LeftShift: return "LSHIFT"; // Key: Shift left
|
||||
case KeyboardKey.LeftControl: return "LCTRL"; // Key: Control left
|
||||
case KeyboardKey.LeftAlt: return "LALT"; // Key: Alt left
|
||||
case KeyboardKey.LeftSuper: return "WIN"; // Key: Super left
|
||||
case KeyboardKey.RightShift: return "RSHIFT"; // Key: Shift right
|
||||
case KeyboardKey.RightControl: return "RCTRL"; // Key: Control right
|
||||
case KeyboardKey.RightAlt: return "ALTGR"; // Key: Alt right
|
||||
case KeyboardKey.RightSuper: return "RSUPER"; // Key: Super right
|
||||
case KeyboardKey.KeyboardMenu: return "KBMENU"; // Key: KB menu
|
||||
case KeyboardKey.Kp0: return "KP0"; // Key: Keypad 0
|
||||
case KeyboardKey.Kp1: return "KP1"; // Key: Keypad 1
|
||||
case KeyboardKey.Kp2: return "KP2"; // Key: Keypad 2
|
||||
case KeyboardKey.Kp3: return "KP3"; // Key: Keypad 3
|
||||
case KeyboardKey.Kp4: return "KP4"; // Key: Keypad 4
|
||||
case KeyboardKey.Kp5: return "KP5"; // Key: Keypad 5
|
||||
case KeyboardKey.Kp6: return "KP6"; // Key: Keypad 6
|
||||
case KeyboardKey.Kp7: return "KP7"; // Key: Keypad 7
|
||||
case KeyboardKey.Kp8: return "KP8"; // Key: Keypad 8
|
||||
case KeyboardKey.Kp9: return "KP9"; // Key: Keypad 9
|
||||
case KeyboardKey.KpDecimal: return "KPDEC"; // Key: Keypad .
|
||||
case KeyboardKey.KpDivide: return "KPDIV"; // Key: Keypad /
|
||||
case KeyboardKey.KpMultiply: return "KPMUL"; // Key: Keypad *
|
||||
case KeyboardKey.KpSubtract: return "KPSUB"; // Key: Keypad -
|
||||
case KeyboardKey.KpAdd: return "KPADD"; // Key: Keypad +
|
||||
case KeyboardKey.KpEnter: return "KPENTER"; // Key: Keypad Enter
|
||||
case KeyboardKey.KpEqual: return "KPEQU"; // Key: Keypad =
|
||||
default: return "";
|
||||
case KeyboardKey.Apostrophe:
|
||||
return "'"; // Key: '
|
||||
case KeyboardKey.Comma:
|
||||
return ","; // Key: ,
|
||||
case KeyboardKey.Minus:
|
||||
return "-"; // Key: -
|
||||
case KeyboardKey.Period:
|
||||
return "."; // Key: .
|
||||
case KeyboardKey.Slash:
|
||||
return "/"; // Key: /
|
||||
case KeyboardKey.Zero:
|
||||
return "0"; // Key: 0
|
||||
case KeyboardKey.One:
|
||||
return "1"; // Key: 1
|
||||
case KeyboardKey.Two:
|
||||
return "2"; // Key: 2
|
||||
case KeyboardKey.Three:
|
||||
return "3"; // Key: 3
|
||||
case KeyboardKey.Four:
|
||||
return "4"; // Key: 4
|
||||
case KeyboardKey.Five:
|
||||
return "5"; // Key: 5
|
||||
case KeyboardKey.Six:
|
||||
return "6"; // Key: 6
|
||||
case KeyboardKey.Seven:
|
||||
return "7"; // Key: 7
|
||||
case KeyboardKey.Eight:
|
||||
return "8"; // Key: 8
|
||||
case KeyboardKey.Nine:
|
||||
return "9"; // Key: 9
|
||||
case KeyboardKey.Semicolon:
|
||||
return ";"; // Key: ;
|
||||
case KeyboardKey.Equal:
|
||||
return "="; // Key: =
|
||||
case KeyboardKey.A:
|
||||
return "A"; // Key: A | a
|
||||
case KeyboardKey.B:
|
||||
return "B"; // Key: B | b
|
||||
case KeyboardKey.C:
|
||||
return "C"; // Key: C | c
|
||||
case KeyboardKey.D:
|
||||
return "D"; // Key: D | d
|
||||
case KeyboardKey.E:
|
||||
return "E"; // Key: E | e
|
||||
case KeyboardKey.F:
|
||||
return "F"; // Key: F | f
|
||||
case KeyboardKey.G:
|
||||
return "G"; // Key: G | g
|
||||
case KeyboardKey.H:
|
||||
return "H"; // Key: H | h
|
||||
case KeyboardKey.I:
|
||||
return "I"; // Key: I | i
|
||||
case KeyboardKey.J:
|
||||
return "J"; // Key: J | j
|
||||
case KeyboardKey.K:
|
||||
return "K"; // Key: K | k
|
||||
case KeyboardKey.L:
|
||||
return "L"; // Key: L | l
|
||||
case KeyboardKey.M:
|
||||
return "M"; // Key: M | m
|
||||
case KeyboardKey.N:
|
||||
return "N"; // Key: N | n
|
||||
case KeyboardKey.O:
|
||||
return "O"; // Key: O | o
|
||||
case KeyboardKey.P:
|
||||
return "P"; // Key: P | p
|
||||
case KeyboardKey.Q:
|
||||
return "Q"; // Key: Q | q
|
||||
case KeyboardKey.R:
|
||||
return "R"; // Key: R | r
|
||||
case KeyboardKey.S:
|
||||
return "S"; // Key: S | s
|
||||
case KeyboardKey.T:
|
||||
return "T"; // Key: T | t
|
||||
case KeyboardKey.U:
|
||||
return "U"; // Key: U | u
|
||||
case KeyboardKey.V:
|
||||
return "V"; // Key: V | v
|
||||
case KeyboardKey.W:
|
||||
return "W"; // Key: W | w
|
||||
case KeyboardKey.X:
|
||||
return "X"; // Key: X | x
|
||||
case KeyboardKey.Y:
|
||||
return "Y"; // Key: Y | y
|
||||
case KeyboardKey.Z:
|
||||
return "Z"; // Key: Z | z
|
||||
case KeyboardKey.LeftBracket:
|
||||
return "["; // Key: [
|
||||
case KeyboardKey.Backslash:
|
||||
return "\\"; // Key: '\'
|
||||
case KeyboardKey.RightBracket:
|
||||
return "]"; // Key: ]
|
||||
case KeyboardKey.Grave:
|
||||
return "`"; // Key: `
|
||||
case KeyboardKey.Space:
|
||||
return "SPACE"; // Key: Space
|
||||
case KeyboardKey.Escape:
|
||||
return "ESC"; // Key: Esc
|
||||
case KeyboardKey.Enter:
|
||||
return "ENTER"; // Key: Enter
|
||||
case KeyboardKey.Tab:
|
||||
return "TAB"; // Key: Tab
|
||||
case KeyboardKey.Backspace:
|
||||
return "BACK"; // Key: Backspace
|
||||
case KeyboardKey.Insert:
|
||||
return "INS"; // Key: Ins
|
||||
case KeyboardKey.Delete:
|
||||
return "DEL"; // Key: Del
|
||||
case KeyboardKey.Right:
|
||||
return "RIGHT"; // Key: Cursor right
|
||||
case KeyboardKey.Left:
|
||||
return "LEFT"; // Key: Cursor left
|
||||
case KeyboardKey.Down:
|
||||
return "DOWN"; // Key: Cursor down
|
||||
case KeyboardKey.Up:
|
||||
return "UP"; // Key: Cursor up
|
||||
case KeyboardKey.PageUp:
|
||||
return "PGUP"; // Key: Page up
|
||||
case KeyboardKey.PageDown:
|
||||
return "PGDOWN"; // Key: Page down
|
||||
case KeyboardKey.Home:
|
||||
return "HOME"; // Key: Home
|
||||
case KeyboardKey.End:
|
||||
return "END"; // Key: End
|
||||
case KeyboardKey.CapsLock:
|
||||
return "CAPS"; // Key: Caps lock
|
||||
case KeyboardKey.ScrollLock:
|
||||
return "LOCK"; // Key: Scroll down
|
||||
case KeyboardKey.NumLock:
|
||||
return "NUMLOCK"; // Key: Num lock
|
||||
case KeyboardKey.PrintScreen:
|
||||
return "PRINTSCR"; // Key: Print screen
|
||||
case KeyboardKey.Pause:
|
||||
return "PAUSE"; // Key: Pause
|
||||
case KeyboardKey.F1:
|
||||
return "F1"; // Key: F1
|
||||
case KeyboardKey.F2:
|
||||
return "F2"; // Key: F2
|
||||
case KeyboardKey.F3:
|
||||
return "F3"; // Key: F3
|
||||
case KeyboardKey.F4:
|
||||
return "F4"; // Key: F4
|
||||
case KeyboardKey.F5:
|
||||
return "F5"; // Key: F5
|
||||
case KeyboardKey.F6:
|
||||
return "F6"; // Key: F6
|
||||
case KeyboardKey.F7:
|
||||
return "F7"; // Key: F7
|
||||
case KeyboardKey.F8:
|
||||
return "F8"; // Key: F8
|
||||
case KeyboardKey.F9:
|
||||
return "F9"; // Key: F9
|
||||
case KeyboardKey.F10:
|
||||
return "F10"; // Key: F10
|
||||
case KeyboardKey.F11:
|
||||
return "F11"; // Key: F11
|
||||
case KeyboardKey.F12:
|
||||
return "F12"; // Key: F12
|
||||
case KeyboardKey.LeftShift:
|
||||
return "LSHIFT"; // Key: Shift left
|
||||
case KeyboardKey.LeftControl:
|
||||
return "LCTRL"; // Key: Control left
|
||||
case KeyboardKey.LeftAlt:
|
||||
return "LALT"; // Key: Alt left
|
||||
case KeyboardKey.LeftSuper:
|
||||
return "WIN"; // Key: Super left
|
||||
case KeyboardKey.RightShift:
|
||||
return "RSHIFT"; // Key: Shift right
|
||||
case KeyboardKey.RightControl:
|
||||
return "RCTRL"; // Key: Control right
|
||||
case KeyboardKey.RightAlt:
|
||||
return "ALTGR"; // Key: Alt right
|
||||
case KeyboardKey.RightSuper:
|
||||
return "RSUPER"; // Key: Super right
|
||||
case KeyboardKey.KeyboardMenu:
|
||||
return "KBMENU"; // Key: KB menu
|
||||
case KeyboardKey.Kp0:
|
||||
return "KP0"; // Key: Keypad 0
|
||||
case KeyboardKey.Kp1:
|
||||
return "KP1"; // Key: Keypad 1
|
||||
case KeyboardKey.Kp2:
|
||||
return "KP2"; // Key: Keypad 2
|
||||
case KeyboardKey.Kp3:
|
||||
return "KP3"; // Key: Keypad 3
|
||||
case KeyboardKey.Kp4:
|
||||
return "KP4"; // Key: Keypad 4
|
||||
case KeyboardKey.Kp5:
|
||||
return "KP5"; // Key: Keypad 5
|
||||
case KeyboardKey.Kp6:
|
||||
return "KP6"; // Key: Keypad 6
|
||||
case KeyboardKey.Kp7:
|
||||
return "KP7"; // Key: Keypad 7
|
||||
case KeyboardKey.Kp8:
|
||||
return "KP8"; // Key: Keypad 8
|
||||
case KeyboardKey.Kp9:
|
||||
return "KP9"; // Key: Keypad 9
|
||||
case KeyboardKey.KpDecimal:
|
||||
return "KPDEC"; // Key: Keypad .
|
||||
case KeyboardKey.KpDivide:
|
||||
return "KPDIV"; // Key: Keypad /
|
||||
case KeyboardKey.KpMultiply:
|
||||
return "KPMUL"; // Key: Keypad *
|
||||
case KeyboardKey.KpSubtract:
|
||||
return "KPSUB"; // Key: Keypad -
|
||||
case KeyboardKey.KpAdd:
|
||||
return "KPADD"; // Key: Keypad +
|
||||
case KeyboardKey.KpEnter:
|
||||
return "KPENTER"; // Key: Keypad Enter
|
||||
case KeyboardKey.KpEqual:
|
||||
return "KPEQU"; // Key: Keypad =
|
||||
default:
|
||||
return "";
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -314,13 +314,26 @@ public partial class ViewportScaling : IExample
|
|||
|
||||
switch (viewportType)
|
||||
{
|
||||
case ViewportType.KeepAspectInteger: KeepAspectCenteredInteger(screenWidth, screenHeight, gameWidth, gameHeight, ref sourceRect, ref destRect); break;
|
||||
case ViewportType.KeepHeightInteger: KeepHeightCenteredInteger(screenWidth, screenHeight, gameWidth, gameHeight, ref sourceRect, ref destRect); break;
|
||||
case ViewportType.KeepWidthInteger: KeepWidthCenteredInteger(screenWidth, screenHeight, gameWidth, gameHeight, ref sourceRect, ref destRect); break;
|
||||
case ViewportType.KeepAspect: KeepAspectCentered(screenWidth, screenHeight, gameWidth, gameHeight, ref sourceRect, ref destRect); break;
|
||||
case ViewportType.KeepHeight: KeepHeightCentered(screenWidth, screenHeight, gameWidth, gameHeight, ref sourceRect, ref destRect); break;
|
||||
case ViewportType.KeepWidth: KeepWidthCentered(screenWidth, screenHeight, gameWidth, gameHeight, ref sourceRect, ref destRect); break;
|
||||
default: break;
|
||||
case ViewportType.KeepAspectInteger:
|
||||
KeepAspectCenteredInteger(screenWidth, screenHeight, gameWidth, gameHeight, ref sourceRect, ref destRect);
|
||||
break;
|
||||
case ViewportType.KeepHeightInteger:
|
||||
KeepHeightCenteredInteger(screenWidth, screenHeight, gameWidth, gameHeight, ref sourceRect, ref destRect);
|
||||
break;
|
||||
case ViewportType.KeepWidthInteger:
|
||||
KeepWidthCenteredInteger(screenWidth, screenHeight, gameWidth, gameHeight, ref sourceRect, ref destRect);
|
||||
break;
|
||||
case ViewportType.KeepAspect:
|
||||
KeepAspectCentered(screenWidth, screenHeight, gameWidth, gameHeight, ref sourceRect, ref destRect);
|
||||
break;
|
||||
case ViewportType.KeepHeight:
|
||||
KeepHeightCentered(screenWidth, screenHeight, gameWidth, gameHeight, ref sourceRect, ref destRect);
|
||||
break;
|
||||
case ViewportType.KeepWidth:
|
||||
KeepWidthCentered(screenWidth, screenHeight, gameWidth, gameHeight, ref sourceRect, ref destRect);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
UnloadRenderTexture(target);
|
||||
|
|
|
|||
|
|
@ -8,7 +8,10 @@ namespace Examples;
|
|||
public sealed class ExcludeFromBrowserAttribute : Attribute
|
||||
{
|
||||
/// <summary>Why the example cannot run in the browser.</summary>
|
||||
public string Reason { get; }
|
||||
public string Reason
|
||||
{
|
||||
get;
|
||||
}
|
||||
|
||||
public ExcludeFromBrowserAttribute(string reason = null)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -14,10 +14,16 @@ namespace Examples;
|
|||
public interface IExample
|
||||
{
|
||||
/// <summary>Display name shown in the navigation dropdown.</summary>
|
||||
string Name { get; }
|
||||
string Name
|
||||
{
|
||||
get;
|
||||
}
|
||||
|
||||
/// <summary>Window title, matching the example's standalone <c>Main()</c>.</summary>
|
||||
string Title { get; }
|
||||
string Title
|
||||
{
|
||||
get;
|
||||
}
|
||||
|
||||
/// <summary>Desktop window size, matching the standalone <c>Main()</c>. The browser canvas is fixed at 800x450.</summary>
|
||||
int Width => 800;
|
||||
|
|
|
|||
|
|
@ -423,8 +423,12 @@ public partial class Decals : IExample
|
|||
nV3 = ClipSegment(inMesh[i + 1], nV1, planes[face], s);
|
||||
nV4 = ClipSegment(inMesh[i + 1], nV2, planes[face], s);
|
||||
|
||||
outMesh.Add(nV3); outMesh.Add(nV2); outMesh.Add(nV1);
|
||||
outMesh.Add(nV2); outMesh.Add(nV3); outMesh.Add(nV4);
|
||||
outMesh.Add(nV3);
|
||||
outMesh.Add(nV2);
|
||||
outMesh.Add(nV1);
|
||||
outMesh.Add(nV2);
|
||||
outMesh.Add(nV3);
|
||||
outMesh.Add(nV4);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
@ -443,8 +447,12 @@ public partial class Decals : IExample
|
|||
nV4 = ClipSegment(inMesh[i + 2], nV2, planes[face], s);
|
||||
}
|
||||
|
||||
outMesh.Add(nV1); outMesh.Add(nV2); outMesh.Add(nV3);
|
||||
outMesh.Add(nV4); outMesh.Add(nV3); outMesh.Add(nV2);
|
||||
outMesh.Add(nV1);
|
||||
outMesh.Add(nV2);
|
||||
outMesh.Add(nV3);
|
||||
outMesh.Add(nV4);
|
||||
outMesh.Add(nV3);
|
||||
outMesh.Add(nV2);
|
||||
}
|
||||
break;
|
||||
case 2:
|
||||
|
|
@ -454,7 +462,9 @@ public partial class Decals : IExample
|
|||
nV1 = inMesh[i];
|
||||
nV2 = ClipSegment(nV1, inMesh[i + 1], planes[face], s);
|
||||
nV3 = ClipSegment(nV1, inMesh[i + 2], planes[face], s);
|
||||
outMesh.Add(nV1); outMesh.Add(nV2); outMesh.Add(nV3);
|
||||
outMesh.Add(nV1);
|
||||
outMesh.Add(nV2);
|
||||
outMesh.Add(nV3);
|
||||
}
|
||||
|
||||
if (!v2Out)
|
||||
|
|
@ -462,7 +472,9 @@ public partial class Decals : IExample
|
|||
nV1 = inMesh[i + 1];
|
||||
nV2 = ClipSegment(nV1, inMesh[i + 2], planes[face], s);
|
||||
nV3 = ClipSegment(nV1, inMesh[i], planes[face], s);
|
||||
outMesh.Add(nV1); outMesh.Add(nV2); outMesh.Add(nV3);
|
||||
outMesh.Add(nV1);
|
||||
outMesh.Add(nV2);
|
||||
outMesh.Add(nV3);
|
||||
}
|
||||
|
||||
if (!v3Out)
|
||||
|
|
@ -470,7 +482,9 @@ public partial class Decals : IExample
|
|||
nV1 = inMesh[i + 2];
|
||||
nV2 = ClipSegment(nV1, inMesh[i], planes[face], s);
|
||||
nV3 = ClipSegment(nV1, inMesh[i + 1], planes[face], s);
|
||||
outMesh.Add(nV1); outMesh.Add(nV2); outMesh.Add(nV3);
|
||||
outMesh.Add(nV1);
|
||||
outMesh.Add(nV2);
|
||||
outMesh.Add(nV3);
|
||||
}
|
||||
break;
|
||||
default: // The entire face lies outside of the plane, so let's discard the corresponding vertices
|
||||
|
|
|
|||
|
|
@ -209,10 +209,22 @@ public partial class DeferredRendering : IExample
|
|||
);
|
||||
|
||||
// Check key inputs to enable/disable lights
|
||||
if (IsKeyPressed(KeyboardKey.Y)) { lights[0].Enabled = !lights[0].Enabled; }
|
||||
if (IsKeyPressed(KeyboardKey.R)) { lights[1].Enabled = !lights[1].Enabled; }
|
||||
if (IsKeyPressed(KeyboardKey.G)) { lights[2].Enabled = !lights[2].Enabled; }
|
||||
if (IsKeyPressed(KeyboardKey.B)) { lights[3].Enabled = !lights[3].Enabled; }
|
||||
if (IsKeyPressed(KeyboardKey.Y))
|
||||
{
|
||||
lights[0].Enabled = !lights[0].Enabled;
|
||||
}
|
||||
if (IsKeyPressed(KeyboardKey.R))
|
||||
{
|
||||
lights[1].Enabled = !lights[1].Enabled;
|
||||
}
|
||||
if (IsKeyPressed(KeyboardKey.G))
|
||||
{
|
||||
lights[2].Enabled = !lights[2].Enabled;
|
||||
}
|
||||
if (IsKeyPressed(KeyboardKey.B))
|
||||
{
|
||||
lights[3].Enabled = !lights[3].Enabled;
|
||||
}
|
||||
|
||||
// Check key inputs to switch between G-buffer textures
|
||||
if (IsKeyPressed(KeyboardKey.One))
|
||||
|
|
@ -361,7 +373,8 @@ public partial class DeferredRendering : IExample
|
|||
DrawText("ALBEDO TEXTURE", 10, screenHeight - 30, 20, Color.DarkGreen);
|
||||
}
|
||||
break;
|
||||
default: break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
DrawText("Toggle lights keys: [Y][R][G][B]", 10, 40, 20, Color.DarkGray);
|
||||
|
|
|
|||
|
|
@ -67,10 +67,14 @@ public partial class LightmapRendering : IExample
|
|||
mesh.AllocTexCoords2();
|
||||
|
||||
// X // Y
|
||||
mesh.TexCoords2[0] = 0.0f; mesh.TexCoords2[1] = 0.0f;
|
||||
mesh.TexCoords2[2] = 1.0f; mesh.TexCoords2[3] = 0.0f;
|
||||
mesh.TexCoords2[4] = 0.0f; mesh.TexCoords2[5] = 1.0f;
|
||||
mesh.TexCoords2[6] = 1.0f; mesh.TexCoords2[7] = 1.0f;
|
||||
mesh.TexCoords2[0] = 0.0f;
|
||||
mesh.TexCoords2[1] = 0.0f;
|
||||
mesh.TexCoords2[2] = 1.0f;
|
||||
mesh.TexCoords2[3] = 0.0f;
|
||||
mesh.TexCoords2[4] = 0.0f;
|
||||
mesh.TexCoords2[5] = 1.0f;
|
||||
mesh.TexCoords2[6] = 1.0f;
|
||||
mesh.TexCoords2[7] = 1.0f;
|
||||
|
||||
// Load a new texcoords2 attributes buffer
|
||||
mesh.VboId[(int)ShaderLocationIndex.VertexTexcoord02] =
|
||||
|
|
|
|||
|
|
@ -213,17 +213,38 @@ public partial class DigitalClock : IExample
|
|||
{
|
||||
switch (value)
|
||||
{
|
||||
case 0: Draw7SDisplay(position, 0b00111111, colorOn, colorOff); break;
|
||||
case 1: Draw7SDisplay(position, 0b00000110, colorOn, colorOff); break;
|
||||
case 2: Draw7SDisplay(position, 0b01011011, colorOn, colorOff); break;
|
||||
case 3: Draw7SDisplay(position, 0b01001111, colorOn, colorOff); break;
|
||||
case 4: Draw7SDisplay(position, 0b01100110, colorOn, colorOff); break;
|
||||
case 5: Draw7SDisplay(position, 0b01101101, colorOn, colorOff); break;
|
||||
case 6: Draw7SDisplay(position, 0b01111101, colorOn, colorOff); break;
|
||||
case 7: Draw7SDisplay(position, 0b00000111, colorOn, colorOff); break;
|
||||
case 8: Draw7SDisplay(position, 0b01111111, colorOn, colorOff); break;
|
||||
case 9: Draw7SDisplay(position, 0b01101111, colorOn, colorOff); break;
|
||||
default: break;
|
||||
case 0:
|
||||
Draw7SDisplay(position, 0b00111111, colorOn, colorOff);
|
||||
break;
|
||||
case 1:
|
||||
Draw7SDisplay(position, 0b00000110, colorOn, colorOff);
|
||||
break;
|
||||
case 2:
|
||||
Draw7SDisplay(position, 0b01011011, colorOn, colorOff);
|
||||
break;
|
||||
case 3:
|
||||
Draw7SDisplay(position, 0b01001111, colorOn, colorOff);
|
||||
break;
|
||||
case 4:
|
||||
Draw7SDisplay(position, 0b01100110, colorOn, colorOff);
|
||||
break;
|
||||
case 5:
|
||||
Draw7SDisplay(position, 0b01101101, colorOn, colorOff);
|
||||
break;
|
||||
case 6:
|
||||
Draw7SDisplay(position, 0b01111101, colorOn, colorOff);
|
||||
break;
|
||||
case 7:
|
||||
Draw7SDisplay(position, 0b00000111, colorOn, colorOff);
|
||||
break;
|
||||
case 8:
|
||||
Draw7SDisplay(position, 0b01111111, colorOn, colorOff);
|
||||
break;
|
||||
case 9:
|
||||
Draw7SDisplay(position, 0b01101111, colorOn, colorOff);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -68,8 +68,14 @@ public partial class DoublePendulum : IExample
|
|||
public void Init()
|
||||
{
|
||||
// Simulation Parameters
|
||||
l1 = 15.0f; m1 = 0.2f; theta1 = DEG2RAD * 170; w1 = 0;
|
||||
l2 = 15.0f; m2 = 0.1f; theta2 = DEG2RAD * 0; w2 = 0;
|
||||
l1 = 15.0f;
|
||||
m1 = 0.2f;
|
||||
theta1 = DEG2RAD * 170;
|
||||
w1 = 0;
|
||||
l2 = 15.0f;
|
||||
m2 = 0.1f;
|
||||
theta2 = DEG2RAD * 0;
|
||||
w2 = 0;
|
||||
lengthScaler = 0.1f;
|
||||
totalM = m1 + m2;
|
||||
|
||||
|
|
@ -82,7 +88,8 @@ public partial class DoublePendulum : IExample
|
|||
L2 = l2 * lengthScaler;
|
||||
|
||||
// Draw parameters
|
||||
lineThick = 20; trailThick = 2;
|
||||
lineThick = 20;
|
||||
trailThick = 2;
|
||||
fateAlpha = 0.01f;
|
||||
|
||||
// Create framebuffer
|
||||
|
|
|
|||
|
|
@ -166,20 +166,26 @@ public partial class HilbertCurve : IExample
|
|||
temp = vect.X;
|
||||
vect.X = vect.Y;
|
||||
vect.Y = temp;
|
||||
} break;
|
||||
}
|
||||
break;
|
||||
case 2:
|
||||
{
|
||||
vect.X += len;
|
||||
vect.Y += len;
|
||||
} break;
|
||||
case 1: vect.Y += len; break;
|
||||
}
|
||||
break;
|
||||
case 1:
|
||||
vect.Y += len;
|
||||
break;
|
||||
case 3:
|
||||
{
|
||||
temp = len - 1 - vect.X;
|
||||
vect.X = 2 * len - 1 - vect.Y;
|
||||
vect.Y = temp;
|
||||
} break;
|
||||
default: break;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -79,11 +79,21 @@ public partial class MathAngleRotation : IExample
|
|||
Color col;
|
||||
switch (i)
|
||||
{
|
||||
case 0: col = Color.Green; break;
|
||||
case 1: col = Color.Orange; break;
|
||||
case 2: col = Color.Blue; break;
|
||||
case 3: col = Color.Magenta; break;
|
||||
default: col = Color.White; break;
|
||||
case 0:
|
||||
col = Color.Green;
|
||||
break;
|
||||
case 1:
|
||||
col = Color.Orange;
|
||||
break;
|
||||
case 2:
|
||||
col = Color.Blue;
|
||||
break;
|
||||
case 3:
|
||||
col = Color.Magenta;
|
||||
break;
|
||||
default:
|
||||
col = Color.White;
|
||||
break;
|
||||
}
|
||||
|
||||
DrawLineEx(center, end, 5.0f, col);
|
||||
|
|
|
|||
|
|
@ -194,17 +194,26 @@ public partial class PenroseTile : IExample
|
|||
char step = production[i];
|
||||
switch (step)
|
||||
{
|
||||
case 'W': newProduction.Append(ls.ruleW); break;
|
||||
case 'X': newProduction.Append(ls.ruleX); break;
|
||||
case 'Y': newProduction.Append(ls.ruleY); break;
|
||||
case 'Z': newProduction.Append(ls.ruleZ); break;
|
||||
case 'W':
|
||||
newProduction.Append(ls.ruleW);
|
||||
break;
|
||||
case 'X':
|
||||
newProduction.Append(ls.ruleX);
|
||||
break;
|
||||
case 'Y':
|
||||
newProduction.Append(ls.ruleY);
|
||||
break;
|
||||
case 'Z':
|
||||
newProduction.Append(ls.ruleZ);
|
||||
break;
|
||||
default:
|
||||
{
|
||||
if (step != 'F')
|
||||
{
|
||||
newProduction.Append(step);
|
||||
}
|
||||
} break;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -162,10 +162,26 @@ public partial class RectangleAdvanced : IExample
|
|||
{
|
||||
Color color = new Color(0, 0, 0, 0);
|
||||
float radius = 0.0f;
|
||||
if (k == 0) { color = left; radius = radiusLeft; } // [1] Upper Left Corner
|
||||
if (k == 1) { color = right; radius = radiusRight; } // [3] Upper Right Corner
|
||||
if (k == 2) { color = right; radius = radiusRight; } // [5] Lower Right Corner
|
||||
if (k == 3) { color = left; radius = radiusLeft; } // [7] Lower Left Corner
|
||||
if (k == 0)
|
||||
{
|
||||
color = left;
|
||||
radius = radiusLeft;
|
||||
} // [1] Upper Left Corner
|
||||
if (k == 1)
|
||||
{
|
||||
color = right;
|
||||
radius = radiusRight;
|
||||
} // [3] Upper Right Corner
|
||||
if (k == 2)
|
||||
{
|
||||
color = right;
|
||||
radius = radiusRight;
|
||||
} // [5] Lower Right Corner
|
||||
if (k == 3)
|
||||
{
|
||||
color = left;
|
||||
radius = radiusLeft;
|
||||
} // [7] Lower Left Corner
|
||||
|
||||
float angle = angles[k];
|
||||
Vector2 center = centers[k];
|
||||
|
|
|
|||
|
|
@ -193,19 +193,23 @@ public partial class SimpleParticles : IExample
|
|||
{
|
||||
newParticle.radius = 5.0f;
|
||||
newParticle.color = Color.Blue;
|
||||
} break;
|
||||
}
|
||||
break;
|
||||
case ParticleType.Smoke:
|
||||
{
|
||||
newParticle.radius = 7.0f;
|
||||
newParticle.color = Color.Gray;
|
||||
} break;
|
||||
}
|
||||
break;
|
||||
case ParticleType.Fire:
|
||||
{
|
||||
newParticle.radius = 10.0f;
|
||||
newParticle.color = Color.Yellow;
|
||||
speed /= 10.0f;
|
||||
} break;
|
||||
default: break;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
float direction = (float)(random.Next(360));
|
||||
|
|
@ -242,7 +246,8 @@ public partial class SimpleParticles : IExample
|
|||
buffer[i].position.X += buffer[i].velocity.X;
|
||||
buffer[i].velocity.Y += 0.2f; // Gravity
|
||||
buffer[i].position.Y += buffer[i].velocity.Y;
|
||||
} break;
|
||||
}
|
||||
break;
|
||||
case ParticleType.Smoke:
|
||||
{
|
||||
buffer[i].position.X += buffer[i].velocity.X;
|
||||
|
|
@ -256,7 +261,8 @@ public partial class SimpleParticles : IExample
|
|||
{
|
||||
buffer[i].alive = false;
|
||||
}
|
||||
} break;
|
||||
}
|
||||
break;
|
||||
case ParticleType.Fire:
|
||||
{
|
||||
// Add a little horizontal oscillation to fire particles
|
||||
|
|
@ -271,8 +277,10 @@ public partial class SimpleParticles : IExample
|
|||
{
|
||||
buffer[i].alive = false;
|
||||
}
|
||||
} break;
|
||||
default: break;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
// Disable particle when out of screen
|
||||
|
|
|
|||
|
|
@ -135,7 +135,8 @@ public partial class Text3D : IExample
|
|||
layerDistance = 0.01f;
|
||||
|
||||
wcfg = new WaveTextConfig();
|
||||
wcfg.WaveSpeed.X = wcfg.WaveSpeed.Y = 3.0f; wcfg.WaveSpeed.Z = 0.5f;
|
||||
wcfg.WaveSpeed.X = wcfg.WaveSpeed.Y = 3.0f;
|
||||
wcfg.WaveSpeed.Z = 0.5f;
|
||||
wcfg.WaveOffset.X = wcfg.WaveOffset.Y = wcfg.WaveOffset.Z = 0.35f;
|
||||
wcfg.WaveRange.X = wcfg.WaveRange.Y = wcfg.WaveRange.Z = 0.45f;
|
||||
|
||||
|
|
@ -230,12 +231,16 @@ public partial class Text3D : IExample
|
|||
}
|
||||
|
||||
// Handle text layers changes
|
||||
if (IsKeyPressed(KeyboardKey.Home)) { if (layers > 1)
|
||||
if (IsKeyPressed(KeyboardKey.Home))
|
||||
{
|
||||
if (layers > 1)
|
||||
{
|
||||
--layers;
|
||||
}
|
||||
}
|
||||
else if (IsKeyPressed(KeyboardKey.End)) { if (layers < TextMaxLayers)
|
||||
else if (IsKeyPressed(KeyboardKey.End))
|
||||
{
|
||||
if (layers < TextMaxLayers)
|
||||
{
|
||||
++layers;
|
||||
}
|
||||
|
|
@ -559,19 +564,27 @@ public partial class Text3D : IExample
|
|||
|
||||
// Front Face
|
||||
Rlgl.Normal3f(0.0f, 1.0f, 0.0f); // Normal Pointing Up
|
||||
Rlgl.TexCoord2f(tx, ty); Rlgl.Vertex3f(x, y, z); // Top Left Of The Texture and Quad
|
||||
Rlgl.TexCoord2f(tx, th); Rlgl.Vertex3f(x, y, z + height); // Bottom Left Of The Texture and Quad
|
||||
Rlgl.TexCoord2f(tw, th); Rlgl.Vertex3f(x + width, y, z + height); // Bottom Right Of The Texture and Quad
|
||||
Rlgl.TexCoord2f(tw, ty); Rlgl.Vertex3f(x + width, y, z); // Top Right Of The Texture and Quad
|
||||
Rlgl.TexCoord2f(tx, ty);
|
||||
Rlgl.Vertex3f(x, y, z); // Top Left Of The Texture and Quad
|
||||
Rlgl.TexCoord2f(tx, th);
|
||||
Rlgl.Vertex3f(x, y, z + height); // Bottom Left Of The Texture and Quad
|
||||
Rlgl.TexCoord2f(tw, th);
|
||||
Rlgl.Vertex3f(x + width, y, z + height); // Bottom Right Of The Texture and Quad
|
||||
Rlgl.TexCoord2f(tw, ty);
|
||||
Rlgl.Vertex3f(x + width, y, z); // Top Right Of The Texture and Quad
|
||||
|
||||
if (backface)
|
||||
{
|
||||
// Back Face
|
||||
Rlgl.Normal3f(0.0f, -1.0f, 0.0f); // Normal Pointing Down
|
||||
Rlgl.TexCoord2f(tx, ty); Rlgl.Vertex3f(x, y, z); // Top Right Of The Texture and Quad
|
||||
Rlgl.TexCoord2f(tw, ty); Rlgl.Vertex3f(x + width, y, z); // Top Left Of The Texture and Quad
|
||||
Rlgl.TexCoord2f(tw, th); Rlgl.Vertex3f(x + width, y, z + height); // Bottom Left Of The Texture and Quad
|
||||
Rlgl.TexCoord2f(tx, th); Rlgl.Vertex3f(x, y, z + height); // Bottom Right Of The Texture and Quad
|
||||
Rlgl.TexCoord2f(tx, ty);
|
||||
Rlgl.Vertex3f(x, y, z); // Top Right Of The Texture and Quad
|
||||
Rlgl.TexCoord2f(tw, ty);
|
||||
Rlgl.Vertex3f(x + width, y, z); // Top Left Of The Texture and Quad
|
||||
Rlgl.TexCoord2f(tw, th);
|
||||
Rlgl.Vertex3f(x + width, y, z + height); // Bottom Left Of The Texture and Quad
|
||||
Rlgl.TexCoord2f(tx, th);
|
||||
Rlgl.Vertex3f(x, y, z + height); // Bottom Right Of The Texture and Quad
|
||||
}
|
||||
Rlgl.End();
|
||||
Rlgl.PopMatrix();
|
||||
|
|
|
|||
Loading…
Reference in a new issue