diff options
Diffstat (limited to 'linden/indra/llmath/llcalc.h')
-rw-r--r-- | linden/indra/llmath/llcalc.h | 85 |
1 files changed, 85 insertions, 0 deletions
diff --git a/linden/indra/llmath/llcalc.h b/linden/indra/llmath/llcalc.h new file mode 100644 index 0000000..a376895 --- /dev/null +++ b/linden/indra/llmath/llcalc.h | |||
@@ -0,0 +1,85 @@ | |||
1 | /* | ||
2 | * LLCalc.h | ||
3 | * SecondLife | ||
4 | * | ||
5 | * Created by Aimee Walton on 28/09/2008. | ||
6 | * Copyright 2008 Aimee Walton. | ||
7 | * | ||
8 | */ | ||
9 | |||
10 | #ifndef LL_CALC_H | ||
11 | #define LL_CALC_H | ||
12 | |||
13 | #include <map> | ||
14 | #include <string> | ||
15 | |||
16 | //#include "llsd.h" | ||
17 | |||
18 | class LLCalc | ||
19 | { | ||
20 | public: | ||
21 | LLCalc(); | ||
22 | ~LLCalc(); | ||
23 | |||
24 | // Variable name constants | ||
25 | static const char* X_POS; | ||
26 | static const char* Y_POS; | ||
27 | static const char* Z_POS; | ||
28 | static const char* X_SCALE; | ||
29 | static const char* Y_SCALE; | ||
30 | static const char* Z_SCALE; | ||
31 | static const char* X_ROT; | ||
32 | static const char* Y_ROT; | ||
33 | static const char* Z_ROT; | ||
34 | static const char* HOLLOW; | ||
35 | static const char* CUT_BEGIN; | ||
36 | static const char* CUT_END; | ||
37 | static const char* PATH_BEGIN; | ||
38 | static const char* PATH_END; | ||
39 | static const char* TWIST_BEGIN; | ||
40 | static const char* TWIST_END; | ||
41 | static const char* X_SHEAR; | ||
42 | static const char* Y_SHEAR; | ||
43 | static const char* X_TAPER; | ||
44 | static const char* Y_TAPER; | ||
45 | static const char* RADIUS_OFFSET; | ||
46 | static const char* REVOLUTIONS; | ||
47 | static const char* SKEW; | ||
48 | static const char* X_HOLE; | ||
49 | static const char* Y_HOLE; | ||
50 | static const char* TEX_U_SCALE; | ||
51 | static const char* TEX_V_SCALE; | ||
52 | static const char* TEX_U_OFFSET; | ||
53 | static const char* TEX_V_OFFSET; | ||
54 | static const char* TEX_ROTATION; | ||
55 | static const char* TEX_TRANSPARENCY; | ||
56 | static const char* TEX_GLOW; | ||
57 | |||
58 | void setVar(const std::string& name, const F32& value); | ||
59 | void clearVar(const std::string& name); | ||
60 | void clearAllVariables(); | ||
61 | // void updateVariables(LLSD& vars); | ||
62 | |||
63 | bool evalString(const std::string& expression, F32& result); | ||
64 | std::string::size_type getLastErrorPos() { return mLastErrorPos; } | ||
65 | |||
66 | static LLCalc* getInstance(); | ||
67 | static void cleanUp(); | ||
68 | |||
69 | typedef std::map<std::string, F32> calc_map_t; | ||
70 | |||
71 | private: | ||
72 | std::string::size_type mLastErrorPos; | ||
73 | |||
74 | calc_map_t* mConstants; | ||
75 | calc_map_t* mVariables; | ||
76 | |||
77 | // *TODO: Add support for storing user defined variables, and stored functions. | ||
78 | // Will need UI work, and a means to save them between sessions. | ||
79 | // calc_map_t* mUserVariables; | ||
80 | |||
81 | // "There shall be only one" | ||
82 | static LLCalc* sInstance; | ||
83 | }; | ||
84 | |||
85 | #endif // LL_CALC_H | ||