lltreeparams.h

Go to the documentation of this file.
00001 
00032 #ifndef LL_LLTREEPARAMS_H
00033 #define LL_LLTREEPARAMS_H 
00034 
00035 /* for information about formulas associated with each type
00036  * check the Weber + Penn paper
00037  */
00038 enum EShapeRatio { SR_CONICAL, SR_SPHERICAL, SR_HEMISPHERICAL, 
00039                                 SR_CYLINDRICAL, SR_TAPERED_CYLINDRICAL, SR_FLAME, 
00040                                 SR_INVERSE_CONICAL, SR_TEND_FLAME, SR_ENVELOPE};
00041 
00042 const U32 TREE_BLOCK_SIZE = 16;
00043 
00044 const U8 MAX_NUM_LEVELS = 4;
00045 
00046 class LLTreeParams  
00047 {
00048 public:
00049         LLTreeParams();
00050         virtual ~LLTreeParams();
00051 
00052         static F32 ShapeRatio(EShapeRatio shape, F32 ratio);
00053 
00054 public:
00055 
00056         // Variables with an asterick (*) cannot be modified without a re-instancing the
00057         // trunk/branches
00058 
00059         // Variables with an exclamation point (!) should probably not be modified outside and instead
00060         // be tied directly to the species
00061 
00062         // Variables with a tilde (~) should be tied to a range specified by the 
00063         // species type but still slightly controllable by the user
00064 
00065         // GENERAL
00066 
00068         EShapeRatio mShape;
00069         
00071         U8 mLevels;
00072 
00073         //~ percentage of trunk at bottom without branches 
00074         F32 mBaseSize;
00075         
00076         //~ the general scale + variance of tree
00077         F32 mScale, mScaleV;
00078 
00079         // general scale of tree
00080         F32 mScale0, mScaleV0;
00081 
00082 
00083 
00084         // LOBING
00085 
00086         //*! number of peaks in the radial distance about the perimeter
00087         U8 mLobes;
00088                 //      even numbers = obvius symmetry ... use odd numbers
00089         
00090         //*! magnitude of the variations as a fraction of the radius
00091         F32 mLobeDepth;
00092 
00093 
00094 
00095         // FLARE
00096 
00097         //*! causes exponential expansion near base of trunk
00098         F32 mFlare;
00099                 //      scales radius base by min 1 to '1 + flare'
00100 
00101         //*! percentage of the height of the trunk to flair -- likely less than baseSize
00102         F32 mFlarePercentage;
00103 
00104         //*! number of cross sections to make for the flair
00105         U8 mFlareRes;
00106 
00107 
00108 
00109         // LEAVES
00110 
00111         //~ number of leaves to make
00112         U8 mLeaves;
00113 
00115         F32 mLeafScaleX, mLeafScaleY;
00116 
00117         // quality/density of leaves
00118         F32 mLeafQuality;
00119 
00120         // several params don't have level 0 values
00121 
00122         // BRANCHES 
00123 
00124         //~ angle away from parent
00125         F32 mDownAngle[MAX_NUM_LEVELS - 1];             
00126         F32 mDownAngleV[MAX_NUM_LEVELS - 1];
00127         
00128         //~ rotation around parent
00129         F32 mRotate[MAX_NUM_LEVELS - 1];
00130         F32 mRotateV[MAX_NUM_LEVELS - 1];
00131 
00132         //~ num branches to spawn
00133         U8 mBranches[MAX_NUM_LEVELS - 1];
00134 
00135         //~ fractional length of branch. 1 = same length as parent branch
00136         F32 mLength[MAX_NUM_LEVELS];
00137         F32 mLengthV[MAX_NUM_LEVELS];
00138 
00140         F32 mRatio, mRatioPower;        
00141 
00142         //*! taper of branches
00143         F32 mTaper[MAX_NUM_LEVELS];
00144                         // 0 - non-tapering cylinder
00145                         // 1 - taper to a point
00146                         // 2 - taper to a spherical end
00147                         // 3 - periodic tapering (concatenated spheres)
00148         
00150         U8 mBaseSplits;                                         
00151         F32 mSegSplits[MAX_NUM_LEVELS];         //~ splits per cross section. 1 = 1 split per section
00152         F32 mSplitAngle[MAX_NUM_LEVELS];        //~ angle that splits go from parent (tempered by height)
00153         F32 mSplitAngleV[MAX_NUM_LEVELS];       //~ variance of the splits
00154 
00155         // CURVE
00156         F32 mCurve[MAX_NUM_LEVELS];             //* general, 1-axis, overall curve of branch
00157         F32 mCurveV[MAX_NUM_LEVELS];    //* curve variance at each cross section from general overall curve
00158         U8 mCurveRes[MAX_NUM_LEVELS];   //* number of cross sections for curve
00159         F32 mCurveBack[MAX_NUM_LEVELS]; //* curveback is amount branch curves back towards 
00160         
00161         //  vertices per cross section
00162         U8 mVertices[MAX_NUM_LEVELS];
00163 
00164         // * no longer useful with pre-instanced branches
00165         // specifies upward tendency of branches. 
00166         //F32 mAttractionUp;    
00167                 //      1 = each branch will slightly go upwards by the end of the branch
00168                 //  >1 = branches tend to go upwards earlier in their length
00169         // pruning not implemented
00170         // Prune parameters
00171         //F32 mPruneRatio;
00172         //F32 mPruneWidth, mPruneWidthPeak;
00173         //F32 mPrunePowerLow, mPrunePowerHigh;
00174 
00175 
00176         // NETWORK MESSAGE DATA
00177         // Below is the outline for network messages regarding trees.  
00178         // The general idea is that a user would pick a general 'tree type' (the first variable)
00179         // and then several 'open ended' variables like 'branchiness' and 'leafiness'. 
00180         // The effect that each of these general user variables would then affect the actual
00181         // tree parameters (like # branches, # segsplits) in different ways depending on
00182         // the tree type selected.  Essentially, each tree type should have a formula
00183         // that expands the 'leafiness' and 'branchiness' user variables into actual
00184         // values for the tree parameters.  
00185 
00186         // These formulas aren't made yet and will certainly require some tuning.  The
00187         // estimates below for the # bits required seems like a good guesstimate.
00188 
00189         // VARIABLE                     -       # bits (range)  -       VARIABLES AFFECTED
00190         // tree type            -       5 bits (32)             -       
00191         // branches                     -       6 bits (64)             -       numBranches
00192         // splits                       -       6 bits (64)             -       segsplits
00193         // leafiness            -       3 bits (8)              -       numLeaves
00194         // branch spread        -       5 bits (32)             -       splitAngle(V), rotate(V)
00195         // angle                        -       5 bits (32)             -       downAngle(V)
00196         // branch length        -       6 bits (64)             -       branchlength(V)
00197         // randomness           -       7 bits (128)    -       percentage for randomness of the (V)'s
00198         // basesize                     -       5 bits (32)             -       basesize
00199         
00200         // total                        -       48 bits
00201 
00202         //U8 mNetSpecies;
00203 
00204 };
00205 
00206 #endif

Generated on Fri May 16 08:32:47 2008 for SecondLife by  doxygen 1.5.5