mirror of
https://github.com/godotengine/godot.git
synced 2025-12-08 06:09:55 +00:00
Merge pull request #105249 from Repiteo/core/math-defs-namespace
Core: Use `Math` namespace for constants
This commit is contained in:
commit
717df3ee88
181 changed files with 812 additions and 818 deletions
|
|
@ -2254,10 +2254,10 @@ void GDScriptLanguage::init() {
|
|||
_add_global(StaticCString::create(CoreConstants::get_global_constant_name(i)), CoreConstants::get_global_constant_value(i));
|
||||
}
|
||||
|
||||
_add_global(StaticCString::create("PI"), Math_PI);
|
||||
_add_global(StaticCString::create("TAU"), Math_TAU);
|
||||
_add_global(StaticCString::create("INF"), INFINITY);
|
||||
_add_global(StaticCString::create("NAN"), NAN);
|
||||
_add_global(StaticCString::create("PI"), Math::PI);
|
||||
_add_global(StaticCString::create("TAU"), Math::TAU);
|
||||
_add_global(StaticCString::create("INF"), Math::INF);
|
||||
_add_global(StaticCString::create("NAN"), Math::NaN);
|
||||
|
||||
//populate native classes
|
||||
|
||||
|
|
|
|||
|
|
@ -488,22 +488,22 @@ void GDScriptLanguage::get_public_functions(List<MethodInfo> *p_functions) const
|
|||
void GDScriptLanguage::get_public_constants(List<Pair<String, Variant>> *p_constants) const {
|
||||
Pair<String, Variant> pi;
|
||||
pi.first = "PI";
|
||||
pi.second = Math_PI;
|
||||
pi.second = Math::PI;
|
||||
p_constants->push_back(pi);
|
||||
|
||||
Pair<String, Variant> tau;
|
||||
tau.first = "TAU";
|
||||
tau.second = Math_TAU;
|
||||
tau.second = Math::TAU;
|
||||
p_constants->push_back(tau);
|
||||
|
||||
Pair<String, Variant> infinity;
|
||||
infinity.first = "INF";
|
||||
infinity.second = INFINITY;
|
||||
infinity.second = Math::INF;
|
||||
p_constants->push_back(infinity);
|
||||
|
||||
Pair<String, Variant> nan;
|
||||
nan.first = "NAN";
|
||||
nan.second = NAN;
|
||||
nan.second = Math::NaN;
|
||||
p_constants->push_back(nan);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -2720,16 +2720,16 @@ GDScriptParser::ExpressionNode *GDScriptParser::parse_builtin_constant(Expressio
|
|||
|
||||
switch (op_type) {
|
||||
case GDScriptTokenizer::Token::CONST_PI:
|
||||
constant->value = Math_PI;
|
||||
constant->value = Math::PI;
|
||||
break;
|
||||
case GDScriptTokenizer::Token::CONST_TAU:
|
||||
constant->value = Math_TAU;
|
||||
constant->value = Math::TAU;
|
||||
break;
|
||||
case GDScriptTokenizer::Token::CONST_INF:
|
||||
constant->value = INFINITY;
|
||||
constant->value = Math::INF;
|
||||
break;
|
||||
case GDScriptTokenizer::Token::CONST_NAN:
|
||||
constant->value = NAN;
|
||||
constant->value = Math::NaN;
|
||||
break;
|
||||
default:
|
||||
return nullptr; // Unreachable.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue