diff options
author | Jacek Antonelli | 2008-08-15 23:44:46 -0500 |
---|---|---|
committer | Jacek Antonelli | 2008-08-15 23:44:46 -0500 |
commit | 38d6d37f2d982fa959e9e8a4a3f7e1ccfad7b5d4 (patch) | |
tree | adca584755d22ca041a2dbfc35d4eca01f70b32c /linden/indra/llprimitive/lltreeparams.cpp | |
parent | README.txt (diff) | |
download | meta-impy-38d6d37f2d982fa959e9e8a4a3f7e1ccfad7b5d4.zip meta-impy-38d6d37f2d982fa959e9e8a4a3f7e1ccfad7b5d4.tar.gz meta-impy-38d6d37f2d982fa959e9e8a4a3f7e1ccfad7b5d4.tar.bz2 meta-impy-38d6d37f2d982fa959e9e8a4a3f7e1ccfad7b5d4.tar.xz |
Second Life viewer sources 1.13.2.12
Diffstat (limited to 'linden/indra/llprimitive/lltreeparams.cpp')
-rw-r--r-- | linden/indra/llprimitive/lltreeparams.cpp | 206 |
1 files changed, 206 insertions, 0 deletions
diff --git a/linden/indra/llprimitive/lltreeparams.cpp b/linden/indra/llprimitive/lltreeparams.cpp new file mode 100644 index 0000000..ce52cae --- /dev/null +++ b/linden/indra/llprimitive/lltreeparams.cpp | |||
@@ -0,0 +1,206 @@ | |||
1 | /** | ||
2 | * @file lltreeparams.cpp | ||
3 | * @brief implementation of the LLTreeParams class. | ||
4 | * | ||
5 | * Copyright (c) 2001-2007, Linden Research, Inc. | ||
6 | * | ||
7 | * The source code in this file ("Source Code") is provided by Linden Lab | ||
8 | * to you under the terms of the GNU General Public License, version 2.0 | ||
9 | * ("GPL"), unless you have obtained a separate licensing agreement | ||
10 | * ("Other License"), formally executed by you and Linden Lab. Terms of | ||
11 | * the GPL can be found in doc/GPL-license.txt in this distribution, or | ||
12 | * online at http://secondlife.com/developers/opensource/gplv2 | ||
13 | * | ||
14 | * There are special exceptions to the terms and conditions of the GPL as | ||
15 | * it is applied to this Source Code. View the full text of the exception | ||
16 | * in the file doc/FLOSS-exception.txt in this software distribution, or | ||
17 | * online at http://secondlife.com/developers/opensource/flossexception | ||
18 | * | ||
19 | * By copying, modifying or distributing this software, you acknowledge | ||
20 | * that you have read and understood your obligations described above, | ||
21 | * and agree to abide by those obligations. | ||
22 | * | ||
23 | * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO | ||
24 | * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY, | ||
25 | * COMPLETENESS OR PERFORMANCE. | ||
26 | */ | ||
27 | |||
28 | ////////////////////////////////////////////////////////////////////// | ||
29 | |||
30 | #include "linden_common.h" | ||
31 | |||
32 | #include "llmath.h" | ||
33 | |||
34 | #include "lltreeparams.h" | ||
35 | |||
36 | ////////////////////////////////////////////////////////////////////// | ||
37 | // Construction/Destruction | ||
38 | ////////////////////////////////////////////////////////////////////// | ||
39 | |||
40 | |||
41 | LLTreeParams::LLTreeParams() | ||
42 | { | ||
43 | |||
44 | // llinfos << "TREE PARAMS INITIALIZED" << llendl; | ||
45 | // init to basic something or other... | ||
46 | mShape = SR_TEND_FLAME; | ||
47 | mLevels = 1; | ||
48 | mScale = 15; | ||
49 | mScaleV = 0; | ||
50 | |||
51 | mBaseSize = 0.3f; | ||
52 | |||
53 | mRatio = 0.015f; | ||
54 | mRatioPower = 1.3f; | ||
55 | |||
56 | mLobes = 0; | ||
57 | mLobeDepth = .1f; | ||
58 | |||
59 | mFlare = 1.2f; | ||
60 | mFlarePercentage = 0.1f; | ||
61 | mFlareRes = 3; | ||
62 | |||
63 | //mAttractionUp = .5f; | ||
64 | |||
65 | mBaseSplits = 0; | ||
66 | |||
67 | mScale0 = 2.0; | ||
68 | mScaleV0 = 0.0; | ||
69 | |||
70 | // level 0 | ||
71 | |||
72 | // scaling | ||
73 | mLength[0] = 1.0f; | ||
74 | mLengthV[0] = 0; | ||
75 | mTaper[0] = 1.0f; | ||
76 | |||
77 | // stem splits | ||
78 | mSegSplits[0] = 0.15f; | ||
79 | mSplitAngle[0] = 15.0f; | ||
80 | mSplitAngleV[0] = 10.0f; | ||
81 | |||
82 | mVertices[0] = 5; | ||
83 | |||
84 | // curvature | ||
85 | mCurveRes[0] = 4; | ||
86 | mCurve[0] = 0; | ||
87 | mCurveV[0] = 25; | ||
88 | mCurveBack[0] = 0; | ||
89 | |||
90 | // level 1 | ||
91 | |||
92 | // scaling | ||
93 | mLength[1] = .3f; | ||
94 | mLengthV[1] = 0.05f; | ||
95 | mTaper[1] = 1.0f; | ||
96 | |||
97 | // angle params | ||
98 | mDownAngle[0] = 60.0f; | ||
99 | mDownAngleV[0] = 20.0f; | ||
100 | mRotate[0] = 140.0f; | ||
101 | mRotateV[0] = 0.0f; | ||
102 | mBranches[0] = 35; | ||
103 | |||
104 | mVertices[1] = 3; | ||
105 | |||
106 | // stem splits | ||
107 | mSplitAngle[1] = 0.0f; | ||
108 | mSplitAngleV[1] = 0.0f; | ||
109 | mSegSplits[1] = 0.0f; | ||
110 | |||
111 | // curvature | ||
112 | mCurveRes[1] = 4; | ||
113 | mCurve[1] = 0; | ||
114 | mCurveV[1] = 0; | ||
115 | mCurveBack[1] = 40; | ||
116 | |||
117 | // level 2 | ||
118 | mLength[2] = .6f; | ||
119 | mLengthV[2] = .1f; | ||
120 | mTaper[2] = 1; | ||
121 | |||
122 | mDownAngle[1] = 30; | ||
123 | mDownAngleV[1] = 10; | ||
124 | mRotate[1] = 140; | ||
125 | mRotateV[1] = 0; | ||
126 | |||
127 | mBranches[1] = 20; | ||
128 | mVertices[2] = 3; | ||
129 | |||
130 | mSplitAngle[2] = 0; | ||
131 | mSplitAngleV[2] = 0; | ||
132 | mSegSplits[2] = 0; | ||
133 | |||
134 | mCurveRes[2] = 3; | ||
135 | mCurve[2] = 10; | ||
136 | mCurveV[2] = 150; | ||
137 | mCurveBack[2] = 0; | ||
138 | |||
139 | // level 3 | ||
140 | mLength[3] = .4f; | ||
141 | mLengthV[3] = 0; | ||
142 | mTaper[3] = 1; | ||
143 | |||
144 | mDownAngle[2] = 45; | ||
145 | mDownAngleV[2] = 10; | ||
146 | mRotate[2] = 140; | ||
147 | mRotateV[2] = 0; | ||
148 | |||
149 | mBranches[2] = 5; | ||
150 | mVertices[3] = 3; | ||
151 | |||
152 | |||
153 | mSplitAngle[3] = 0; | ||
154 | mSplitAngleV[3] = 0; | ||
155 | mSegSplits[3] = 0; | ||
156 | |||
157 | mCurveRes[3] = 2; | ||
158 | mCurve[3] = 0; | ||
159 | mCurveV[3] = 0; | ||
160 | mCurveBack[3] = 0; | ||
161 | |||
162 | mLeaves = 0; | ||
163 | mLeafScaleX = 1.0f; | ||
164 | mLeafScaleY = 1.0f; | ||
165 | |||
166 | mLeafQuality = 1.25; | ||
167 | } | ||
168 | |||
169 | LLTreeParams::~LLTreeParams() | ||
170 | { | ||
171 | |||
172 | } | ||
173 | |||
174 | F32 LLTreeParams::ShapeRatio(EShapeRatio shape, F32 ratio) | ||
175 | { | ||
176 | switch (shape) { | ||
177 | case (SR_CONICAL): | ||
178 | return (.2f + .8f * ratio); | ||
179 | case (SR_SPHERICAL): | ||
180 | return (.2f + .8f * sinf(F_PI*ratio)); | ||
181 | case (SR_HEMISPHERICAL): | ||
182 | return (.2f + .8f * sinf(.5*F_PI*ratio)); | ||
183 | case (SR_CYLINDRICAL): | ||
184 | return (1); | ||
185 | case (SR_TAPERED_CYLINDRICAL): | ||
186 | return (.5f + .5f * ratio); | ||
187 | case (SR_FLAME): | ||
188 | if (ratio <= .7f) { | ||
189 | return ratio/.7f; | ||
190 | } else { | ||
191 | return ((1 - ratio)/.3f); | ||
192 | } | ||
193 | case (SR_INVERSE_CONICAL): | ||
194 | return (1 - .8f * ratio); | ||
195 | case (SR_TEND_FLAME): | ||
196 | if (ratio <= .7) { | ||
197 | return (.5f + .5f*(ratio/.7f)); | ||
198 | } else { | ||
199 | return (.5f + .5f * (1 - ratio)/.3f); | ||
200 | } | ||
201 | case (SR_ENVELOPE): | ||
202 | return 1; | ||
203 | default: | ||
204 | return 1; | ||
205 | } | ||
206 | } | ||