diff options
Diffstat (limited to '')
-rw-r--r-- | linden/indra/newview/llvotree.h | 137 |
1 files changed, 137 insertions, 0 deletions
diff --git a/linden/indra/newview/llvotree.h b/linden/indra/newview/llvotree.h new file mode 100644 index 0000000..4d11d20 --- /dev/null +++ b/linden/indra/newview/llvotree.h | |||
@@ -0,0 +1,137 @@ | |||
1 | /** | ||
2 | * @file llvotree.h | ||
3 | * @brief LLVOTree class header file | ||
4 | * | ||
5 | * Copyright (c) 2002-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_LLVOTREE_H | ||
29 | #define LL_LLVOTREE_H | ||
30 | |||
31 | #include "llviewerobject.h" | ||
32 | #include "lldarray.h" | ||
33 | #include "xform.h" | ||
34 | |||
35 | class LLFace; | ||
36 | class LLDrawPool; | ||
37 | |||
38 | |||
39 | class LLVOTree : public LLViewerObject | ||
40 | { | ||
41 | public: | ||
42 | LLVOTree(const LLUUID &id, const LLPCode pcode, LLViewerRegion *regionp); | ||
43 | virtual ~LLVOTree(); | ||
44 | |||
45 | // Initialize data that's only inited once per class. | ||
46 | static void initClass(); | ||
47 | static void cleanupClass(); | ||
48 | |||
49 | /*virtual*/ U32 processUpdateMessage(LLMessageSystem *mesgsys, | ||
50 | void **user_data, | ||
51 | U32 block_num, const EObjectUpdateType update_type, | ||
52 | LLDataPacker *dp); | ||
53 | /*virtual*/ BOOL idleUpdate(LLAgent &agent, LLWorld &world, const F64 &time); | ||
54 | |||
55 | // Graphical stuff for objects - maybe broken out into render class later? | ||
56 | /*virtual*/ void render(LLAgent &agent); | ||
57 | /*virtual*/ void setPixelAreaAndAngle(LLAgent &agent); | ||
58 | /*virtual*/ void updateTextures(LLAgent &agent); | ||
59 | |||
60 | /*virtual*/ LLDrawable* createDrawable(LLPipeline *pipeline); | ||
61 | /*virtual*/ BOOL updateGeometry(LLDrawable *drawable); | ||
62 | |||
63 | void updateRadius(); | ||
64 | |||
65 | void drawBranchPipeline(LLDrawPool *draw_pool, S32 trunk_LOD, S32 stop_level, U16 depth, U16 trunk_depth, F32 scale, F32 twist, F32 droop, F32 branches, F32 alpha); | ||
66 | |||
67 | void drawBranch(S32 stop_level, U16 depth, U16 trunk_depth, F32 scale, F32 twist, F32 droop, F32 branches, F32 alpha, BOOL draw_leaves); | ||
68 | |||
69 | static S32 sMaxTreeSpecies; | ||
70 | |||
71 | struct TreeSpeciesData | ||
72 | { | ||
73 | LLUUID mTextureID; | ||
74 | |||
75 | F32 mBranchLength; // Scale (length) of tree branches | ||
76 | F32 mDroop; // Droop from vertical (degrees) at each branch recursion | ||
77 | F32 mTwist; // Twist | ||
78 | F32 mBranches; // Number of branches emitted at each recursion level | ||
79 | U8 mDepth; // Number of recursions to tips of branches | ||
80 | F32 mScaleStep; // Multiplier for scale at each recursion level | ||
81 | U8 mTrunkDepth; | ||
82 | |||
83 | F32 mLeafScale; // Scales leaf texture when rendering | ||
84 | F32 mTrunkLength; // Scales branch diameters when rendering | ||
85 | F32 mBillboardScale; // Scales the billboard representation | ||
86 | F32 mBillboardRatio; // Height to width aspect ratio | ||
87 | F32 mTrunkAspect; | ||
88 | F32 mBranchAspect; | ||
89 | F32 mRandomLeafRotate; | ||
90 | F32 mNoiseScale; // Scaling of noise function in perlin space (norm = 1.0) | ||
91 | F32 mNoiseMag; // amount of perlin noise to deform by (0 = none) | ||
92 | F32 mTaper; // amount of perlin noise to deform by (0 = none) | ||
93 | F32 mRepeatTrunkZ; // Times to repeat the trunk texture vertically along trunk | ||
94 | }; | ||
95 | |||
96 | static F32 sTreeFactor; // Tree level of detail factor | ||
97 | |||
98 | friend class LLDrawPoolTree; | ||
99 | protected: | ||
100 | LLVector3 mTrunkBend; // Accumulated wind (used for blowing trees) | ||
101 | LLVector3 mTrunkVel; // | ||
102 | LLVector3 mWind; | ||
103 | |||
104 | LLPointer<LLViewerImage> mTreeImagep; // Pointer to proper tree image | ||
105 | |||
106 | U8 mSpecies; // Species of tree | ||
107 | F32 mBranchLength; // Scale (length) of tree branches | ||
108 | F32 mTrunkLength; // Trunk length (first recursion) | ||
109 | F32 mDroop; // Droop from vertical (degrees) at each branch recursion | ||
110 | F32 mTwist; // Twist | ||
111 | F32 mBranches; // Number of branches emitted at each recursion level | ||
112 | U8 mDepth; // Number of recursions to tips of branches | ||
113 | F32 mScaleStep; // Multiplier for scale at each recursion level | ||
114 | U8 mTrunkDepth; | ||
115 | |||
116 | F32 mLeafScale; // Scales leaf texture when rendering | ||
117 | |||
118 | F32 mBillboardScale; // How big to draw the billboard? | ||
119 | F32 mBillboardRatio; // Height to width ratio of billboard | ||
120 | F32 mTrunkAspect; // Ratio between width/length of trunk | ||
121 | F32 mBranchAspect; // Ratio between width/length of branch | ||
122 | F32 mRandomLeafRotate; // How much to randomly rotate leaves about arbitrary axis | ||
123 | |||
124 | U32 mFrameCount; | ||
125 | |||
126 | typedef std::map<U32, TreeSpeciesData*> SpeciesMap; | ||
127 | static SpeciesMap sSpeciesTable; | ||
128 | |||
129 | static S32 sLODIndexOffset[4]; | ||
130 | static S32 sLODIndexCount[4]; | ||
131 | static S32 sLODVertexOffset[4]; | ||
132 | static S32 sLODVertexCount[4]; | ||
133 | static S32 sLODSlices[4]; | ||
134 | static F32 sLODAngles[4]; | ||
135 | }; | ||
136 | |||
137 | #endif | ||