GameDev Calculator Guide
Basic Usage
- Select input format from the dropdown (Vector, Color, D3DXVECTOR4, or Hex)
- Enter values in the input field
- Click "Push to Stack" to add the value
- Use operation buttons to perform calculations
- Results appear in the stack display
Input Formats
Format | Example Input | Description |
---|---|---|
Vector | (1, 0, 0, 1) | Standard vector format (x, y, z, w) |
Color | rgba(255, 0, 0, 1) | Color in RGBA format |
D3DXVECTOR4 | D3DXVECTOR4(1.0f, 0.0f, 0.0f, 1.0f) | DirectX vector format |
Hex | #FF0000 | Hexadecimal color format |
Vector Operations
Normalize
Input: (3, 4, 0, 1)
Result: (0.600, 0.800, 0.000, 1.000)
Makes vector length = 1 while preserving direction
Length
Input: (3, 4, 0, 1)
Result: 5.000
Calculates vector magnitude
Dot Product
Input 1: (1, 0, 0, 1)
Input 2: (0, 1, 0, 1)
Result: 0.000
Calculates angle between vectors
Cross Product
Input 1: (1, 0, 0, 1)
Input 2: (0, 1, 0, 1)
Result: (0.000, 0.000, 1.000, 1.000)
Creates perpendicular vector
Color Operations
RGB to HSB
Input: rgba(255, 0, 0, 1)
Result: (0.000, 1.000, 1.000, 1.000)
Converts RGB to Hue, Saturation, Brightness
HSB to RGB
Input: (0.333, 1.000, 1.000, 1.000)
Result: rgba(0, 255, 0, 1)
Converts HSB back to RGB
Brightness
Input: rgba(255, 128, 0, 1)
Result: 0.607
Calculates perceived brightness
General Operations
Add/Subtract
Input 1: (1, 2, 3, 1)
Input 2: (4, 5, 6, 1)
Add Result: (5, 7, 9, 1)
Subtract Result: (-3, -3, -3, 1)
Multiply/Divide
Input: (2, 4, 6, 1)
Scalar: 2
Multiply Result: (4, 8, 12, 1)
Divide Result: (1, 2, 3, 1)
Lerp (Linear Interpolation)
Start: (0, 0, 0, 1)
End: (10, 10, 10, 1)
Factor: 0.5
Result: (5, 5, 5, 1)
Clamp
Input: (1.5, -0.5, 2.2, 1)
Min: 0.0, Max: 1.0
Result: (1.0, 0.0, 1.0, 1)
Stack Operations
- Dup (Duplicate): Creates a copy of the selected stack item
- Del (Delete): Removes the selected stack item
- Save: Stores the value in memory slots
Common Use Cases
Normalizing Direction Vector
- Enter vector: (3, 4, 0, 1)
- Push to Stack
- Click "Normalize"
- Result: (0.600, 0.800, 0.000, 1.000)
Color Space Conversion
- Select Color format
- Enter: rgba(255, 0, 0, 1)
- Push to Stack
- Click "RGB → HSB"
- Result in HSB format
Vector Reflection
- Enter incident vector: (1, -1, 0, 1)
- Push to Stack
- Enter normal vector: (0, 1, 0, 1)
- Push to Stack
- Click "Reflect"
- Result: (1, 1, 0, 1)