diff options
Diffstat (limited to 'indra')
-rw-r--r-- | indra/llmath/llcalc.cpp | 2 | ||||
-rw-r--r-- | indra/llmath/llcalcparser.h | 11 |
2 files changed, 10 insertions, 3 deletions
diff --git a/indra/llmath/llcalc.cpp b/indra/llmath/llcalc.cpp index f399463a47..f16dbec63f 100644 --- a/indra/llmath/llcalc.cpp +++ b/indra/llmath/llcalc.cpp @@ -62,7 +62,9 @@ LLCalc::LLCalc() : mLastErrorPos(0) (*mConstants)["PI"] = F_PI; (*mConstants)["TWO_PI"] = F_TWO_PI; (*mConstants)["PI_BY_TWO"] = F_PI_BY_TWO; + (*mConstants)["SQRT_TWO_PI"] = F_SQRT_TWO_PI; (*mConstants)["SQRT2"] = F_SQRT2; + (*mConstants)["SQRT3"] = F_SQRT3; (*mConstants)["DEG_TO_RAD"] = DEG_TO_RAD; (*mConstants)["RAD_TO_DEG"] = RAD_TO_DEG; (*mConstants)["GRAVITY"] = GRAVITY; diff --git a/indra/llmath/llcalcparser.h b/indra/llmath/llcalcparser.h index a759a35710..600e173661 100644 --- a/indra/llmath/llcalcparser.h +++ b/indra/llmath/llcalcparser.h @@ -73,7 +73,9 @@ struct LLCalcParser : grammar<LLCalcParser> (str_p("SQRT") >> '(' >> expression[unary_func.value = bind(&LLCalcParser::_sqrt)(self,arg1)]) | (str_p("LOG") >> '(' >> expression[unary_func.value = bind(&LLCalcParser::_log)(self,arg1)]) | (str_p("EXP") >> '(' >> expression[unary_func.value = bind(&LLCalcParser::_exp)(self,arg1)]) | - (str_p("ABS") >> '(' >> expression[unary_func.value = bind(&LLCalcParser::_fabs)(self,arg1)]) + (str_p("ABS") >> '(' >> expression[unary_func.value = bind(&LLCalcParser::_fabs)(self,arg1)]) | + (str_p("FLR") >> '(' >> expression[unary_func.value = bind(&LLCalcParser::_floor)(self,arg1)]) | + (str_p("CEIL") >> '(' >> expression[unary_func.value = bind(&LLCalcParser::_ceil)(self,arg1)]) ) >> assert_syntax(ch_p(')')) ; @@ -118,7 +120,8 @@ struct LLCalcParser : grammar<LLCalcParser> term = power[term.value = arg1] >> *(('*' >> assert_syntax(power[term.value *= arg1])) | - ('/' >> assert_syntax(power[term.value /= arg1])) + ('/' >> assert_syntax(power[term.value /= arg1])) | + ('%' >> assert_syntax(power[term.value = bind(&fmodf)(term.value, arg1)])) ) ; @@ -153,7 +156,9 @@ private: F32 _sqrt(const F32& a) const { return sqrt(a); } F32 _log(const F32& a) const { return log(a); } F32 _exp(const F32& a) const { return exp(a); } - F32 _fabs(const F32& a) const { return fabs(a) * RAD_TO_DEG; } + F32 _fabs(const F32& a) const { return fabs(a); } + F32 _floor(const F32& a) const { return llfloor(a); } + F32 _ceil(const F32& a) const { return llceil(a); } F32 _atan2(const F32& a,const F32& b) const { return atan2(a,b); } |