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