aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/linden/indra/llprimitive/lltreeparams.h
diff options
context:
space:
mode:
authorJacek Antonelli2008-08-15 23:44:46 -0500
committerJacek Antonelli2008-08-15 23:44:46 -0500
commit38d6d37f2d982fa959e9e8a4a3f7e1ccfad7b5d4 (patch)
treeadca584755d22ca041a2dbfc35d4eca01f70b32c /linden/indra/llprimitive/lltreeparams.h
parentREADME.txt (diff)
downloadmeta-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 '')
-rw-r--r--linden/indra/llprimitive/lltreeparams.h202
1 files changed, 202 insertions, 0 deletions
diff --git a/linden/indra/llprimitive/lltreeparams.h b/linden/indra/llprimitive/lltreeparams.h
new file mode 100644
index 0000000..7822d31
--- /dev/null
+++ b/linden/indra/llprimitive/lltreeparams.h
@@ -0,0 +1,202 @@
1/**
2 * @file lltreeparams.h
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#ifndef LL_LLTREEPARAMS_H
29#define LL_LLTREEPARAMS_H
30
31/* for information about formulas associated with each type
32 * check the Weber + Penn paper
33 */
34typedef enum EShapeRatio { SR_CONICAL, SR_SPHERICAL, SR_HEMISPHERICAL,
35 SR_CYLINDRICAL, SR_TAPERED_CYLINDRICAL, SR_FLAME,
36 SR_INVERSE_CONICAL, SR_TEND_FLAME, SR_ENVELOPE};
37
38const U32 TREE_BLOCK_SIZE = 16;
39
40const U8 MAX_NUM_LEVELS = 4;
41
42class LLTreeParams
43{
44public:
45 LLTreeParams();
46 virtual ~LLTreeParams();
47
48 static F32 ShapeRatio(EShapeRatio shape, F32 ratio);
49
50public:
51
52 // Variables with an asterick (*) cannot be modified without a re-instancing the
53 // trunk/branches
54
55 // Variables with an exclamation point (!) should probably not be modified outside and instead
56 // be tied directly to the species
57
58 // Variables with a tilde (~) should be tied to a range specified by the
59 // species type but still slightly controllable by the user
60
61 // GENERAL
62
63 //! determines length/radius of branches on tree -- ie: general 'shape'
64 EShapeRatio mShape;
65
66 //! number of recursive branch levels...limit to MAX_NUM_LEVELS
67 U8 mLevels;
68
69 //~ percentage of trunk at bottom without branches
70 F32 mBaseSize;
71
72 //~ the general scale + variance of tree
73 F32 mScale, mScaleV;
74
75 // general scale of tree
76 F32 mScale0, mScaleV0;
77
78
79
80 // LOBING
81
82 //*! number of peaks in the radial distance about the perimeter
83 U8 mLobes;
84 // even numbers = obvius symmetry ... use odd numbers
85
86 //*! magnitude of the variations as a fraction of the radius
87 F32 mLobeDepth;
88
89
90
91 // FLARE
92
93 //*! causes exponential expansion near base of trunk
94 F32 mFlare;
95 // scales radius base by min 1 to '1 + flare'
96
97 //*! percentage of the height of the trunk to flair -- likely less than baseSize
98 F32 mFlarePercentage;
99
100 //*! number of cross sections to make for the flair
101 U8 mFlareRes;
102
103
104
105 // LEAVES
106
107 //~ number of leaves to make
108 U8 mLeaves;
109
110 //! scale of the leaves
111 F32 mLeafScaleX, mLeafScaleY;
112
113 // quality/density of leaves
114 F32 mLeafQuality;
115
116 // several params don't have level 0 values
117
118 // BRANCHES
119
120 //~ angle away from parent
121 F32 mDownAngle[MAX_NUM_LEVELS - 1];
122 F32 mDownAngleV[MAX_NUM_LEVELS - 1];
123
124 //~ rotation around parent
125 F32 mRotate[MAX_NUM_LEVELS - 1];
126 F32 mRotateV[MAX_NUM_LEVELS - 1];
127
128 //~ num branches to spawn
129 U8 mBranches[MAX_NUM_LEVELS - 1];
130
131 //~ fractional length of branch. 1 = same length as parent branch
132 F32 mLength[MAX_NUM_LEVELS];
133 F32 mLengthV[MAX_NUM_LEVELS];
134
135 //!~ ratio and ratiopower determine radius/length
136 F32 mRatio, mRatioPower;
137
138 //*! taper of branches
139 F32 mTaper[MAX_NUM_LEVELS];
140 // 0 - non-tapering cylinder
141 // 1 - taper to a point
142 // 2 - taper to a spherical end
143 // 3 - periodic tapering (concatenated spheres)
144
145 //! SEG SPLITTING
146 U8 mBaseSplits; //! num segsplits at first curve cross section of trunk
147 F32 mSegSplits[MAX_NUM_LEVELS]; //~ splits per cross section. 1 = 1 split per section
148 F32 mSplitAngle[MAX_NUM_LEVELS]; //~ angle that splits go from parent (tempered by height)
149 F32 mSplitAngleV[MAX_NUM_LEVELS]; //~ variance of the splits
150
151 // CURVE
152 F32 mCurve[MAX_NUM_LEVELS]; //* general, 1-axis, overall curve of branch
153 F32 mCurveV[MAX_NUM_LEVELS]; //* curve variance at each cross section from general overall curve
154 U8 mCurveRes[MAX_NUM_LEVELS]; //* number of cross sections for curve
155 F32 mCurveBack[MAX_NUM_LEVELS]; //* curveback is amount branch curves back towards
156
157 // vertices per cross section
158 U8 mVertices[MAX_NUM_LEVELS];
159
160 // * no longer useful with pre-instanced branches
161 // specifies upward tendency of branches.
162 //F32 mAttractionUp;
163 // 1 = each branch will slightly go upwards by the end of the branch
164 // >1 = branches tend to go upwards earlier in their length
165 // pruning not implemented
166 // Prune parameters
167 //F32 mPruneRatio;
168 //F32 mPruneWidth, mPruneWidthPeak;
169 //F32 mPrunePowerLow, mPrunePowerHigh;
170
171
172 // NETWORK MESSAGE DATA
173 // Below is the outline for network messages regarding trees.
174 // The general idea is that a user would pick a general 'tree type' (the first variable)
175 // and then several 'open ended' variables like 'branchiness' and 'leafiness'.
176 // The effect that each of these general user variables would then affect the actual
177 // tree parameters (like # branches, # segsplits) in different ways depending on
178 // the tree type selected. Essentially, each tree type should have a formula
179 // that expands the 'leafiness' and 'branchiness' user variables into actual
180 // values for the tree parameters.
181
182 // These formulas aren't made yet and will certainly require some tuning. The
183 // estimates below for the # bits required seems like a good guesstimate.
184
185 // VARIABLE - # bits (range) - VARIABLES AFFECTED
186 // tree type - 5 bits (32) -
187 // branches - 6 bits (64) - numBranches
188 // splits - 6 bits (64) - segsplits
189 // leafiness - 3 bits (8) - numLeaves
190 // branch spread - 5 bits (32) - splitAngle(V), rotate(V)
191 // angle - 5 bits (32) - downAngle(V)
192 // branch length - 6 bits (64) - branchlength(V)
193 // randomness - 7 bits (128) - percentage for randomness of the (V)'s
194 // basesize - 5 bits (32) - basesize
195
196 // total - 48 bits
197
198 //U8 mNetSpecies;
199
200};
201
202#endif