module
Opal::Shader::FastMath
Overview
High-performance mathematical helpers and trigonometric lookup tables (LUT) for real-time text fragment shaders.
Defined in:
opal/shader/fast_math.crConstant Summary
-
HALF_PI =
Math::PI / 2.0 -
INV_TWO_PI =
1.0 / TWO_PI -
SIN_TABLE =
Slice(Float64).new(TABLE_SIZE) do |i| Math.sin((i.to_f * TWO_PI) / TABLE_SIZE.to_f) end -
Precomputed sine lookup table
-
TABLE_MASK =
1023 -
TABLE_SCALE =
1024.0 -
TABLE_SIZE =
1024 -
TWO_PI =
Math::PI * 2.0
Class Method Summary
-
.cos(angle : Float64) : Float64
Constant-time cosine approximation via lookup table
-
.sin(angle : Float64) : Float64
Constant-time sine approximation via lookup table without fmod or division
Class Method Detail
def self.sin(angle : Float64) : Float64
#
Constant-time sine approximation via lookup table without fmod or division