diff options
Diffstat (limited to 'linden/indra/newview/llviewerjointshape.cpp')
-rw-r--r-- | linden/indra/newview/llviewerjointshape.cpp | 233 |
1 files changed, 0 insertions, 233 deletions
diff --git a/linden/indra/newview/llviewerjointshape.cpp b/linden/indra/newview/llviewerjointshape.cpp deleted file mode 100644 index 279115b..0000000 --- a/linden/indra/newview/llviewerjointshape.cpp +++ /dev/null | |||
@@ -1,233 +0,0 @@ | |||
1 | /** | ||
2 | * @file llviewerjointshape.cpp | ||
3 | * @brief Implementation of LLViewerJointShape class | ||
4 | * | ||
5 | * $LicenseInfo:firstyear=2001&license=viewergpl$ | ||
6 | * | ||
7 | * Copyright (c) 2001-2008, Linden Research, Inc. | ||
8 | * | ||
9 | * Second Life Viewer Source Code | ||
10 | * The source code in this file ("Source Code") is provided by Linden Lab | ||
11 | * to you under the terms of the GNU General Public License, version 2.0 | ||
12 | * ("GPL"), unless you have obtained a separate licensing agreement | ||
13 | * ("Other License"), formally executed by you and Linden Lab. Terms of | ||
14 | * the GPL can be found in doc/GPL-license.txt in this distribution, or | ||
15 | * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2 | ||
16 | * | ||
17 | * There are special exceptions to the terms and conditions of the GPL as | ||
18 | * it is applied to this Source Code. View the full text of the exception | ||
19 | * in the file doc/FLOSS-exception.txt in this software distribution, or | ||
20 | * online at http://secondlifegrid.net/programs/open_source/licensing/flossexception | ||
21 | * | ||
22 | * By copying, modifying or distributing this software, you acknowledge | ||
23 | * that you have read and understood your obligations described above, | ||
24 | * and agree to abide by those obligations. | ||
25 | * | ||
26 | * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO | ||
27 | * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY, | ||
28 | * COMPLETENESS OR PERFORMANCE. | ||
29 | * $/LicenseInfo$ | ||
30 | */ | ||
31 | |||
32 | //----------------------------------------------------------------------------- | ||
33 | // Header Files | ||
34 | //----------------------------------------------------------------------------- | ||
35 | #include "llviewerprecompiledheaders.h" | ||
36 | |||
37 | #include "llviewerjointshape.h" | ||
38 | |||
39 | #include "llbox.h" | ||
40 | #include "llsphere.h" | ||
41 | #include "llcylinder.h" | ||
42 | #include "llgldbg.h" | ||
43 | #include "llglheaders.h" | ||
44 | |||
45 | F32 LLViewerJointShape::sColorScale = 1.0f; | ||
46 | |||
47 | //----------------------------------------------------------------------------- | ||
48 | // LLViewerJointShape() | ||
49 | //----------------------------------------------------------------------------- | ||
50 | LLViewerJointShape::LLViewerJointShape() | ||
51 | { | ||
52 | mType = ST_NULL; | ||
53 | mColor[0] = 1.0f; | ||
54 | mColor[1] = 1.0f; | ||
55 | mColor[2] = 1.0f; | ||
56 | mColor[3] = 1.0f; | ||
57 | mTexture = NULL; | ||
58 | } | ||
59 | |||
60 | |||
61 | //----------------------------------------------------------------------------- | ||
62 | // LLViewerJointShape() | ||
63 | //----------------------------------------------------------------------------- | ||
64 | LLViewerJointShape::LLViewerJointShape( ShapeType type, F32 red, F32 green, F32 blue, F32 alpha ) | ||
65 | { | ||
66 | mType = type; | ||
67 | mColor[0] = red * sColorScale; | ||
68 | mColor[1] = green * sColorScale; | ||
69 | mColor[2] = blue * sColorScale; | ||
70 | mColor[3] = alpha; | ||
71 | mTexture = NULL; | ||
72 | } | ||
73 | |||
74 | |||
75 | //----------------------------------------------------------------------------- | ||
76 | // ~LLViewerJointShape() | ||
77 | // Class Destructor | ||
78 | //----------------------------------------------------------------------------- | ||
79 | LLViewerJointShape::~LLViewerJointShape() | ||
80 | { | ||
81 | } | ||
82 | |||
83 | |||
84 | //-------------------------------------------------------------------- | ||
85 | // getType() | ||
86 | //-------------------------------------------------------------------- | ||
87 | LLViewerJointShape::ShapeType LLViewerJointShape::getType() | ||
88 | { | ||
89 | return mType; | ||
90 | } | ||
91 | |||
92 | |||
93 | //-------------------------------------------------------------------- | ||
94 | // setType() | ||
95 | //-------------------------------------------------------------------- | ||
96 | void LLViewerJointShape::setType( ShapeType type ) | ||
97 | { | ||
98 | mType = type; | ||
99 | } | ||
100 | |||
101 | |||
102 | //-------------------------------------------------------------------- | ||
103 | // getColor() | ||
104 | //-------------------------------------------------------------------- | ||
105 | void LLViewerJointShape::getColor( F32 *red, F32 *green, F32 *blue, F32 *alpha ) | ||
106 | { | ||
107 | *red = mColor[0]; | ||
108 | *green = mColor[1]; | ||
109 | *blue = mColor[2]; | ||
110 | *alpha = mColor[3]; | ||
111 | } | ||
112 | |||
113 | //-------------------------------------------------------------------- | ||
114 | // setColor() | ||
115 | //-------------------------------------------------------------------- | ||
116 | void LLViewerJointShape::setColor( F32 red, F32 green, F32 blue, F32 alpha ) | ||
117 | { | ||
118 | mColor[0] = red * sColorScale; | ||
119 | mColor[1] = green * sColorScale; | ||
120 | mColor[2] = blue * sColorScale; | ||
121 | mColor[3] = alpha; | ||
122 | } | ||
123 | |||
124 | |||
125 | //-------------------------------------------------------------------- | ||
126 | // getTexture() | ||
127 | //-------------------------------------------------------------------- | ||
128 | LLViewerImage *LLViewerJointShape::getTexture() | ||
129 | { | ||
130 | return mTexture; | ||
131 | } | ||
132 | |||
133 | //-------------------------------------------------------------------- | ||
134 | // setTexture() | ||
135 | //-------------------------------------------------------------------- | ||
136 | void LLViewerJointShape::setTexture( LLViewerImage *texture ) | ||
137 | { | ||
138 | mTexture = texture; | ||
139 | } | ||
140 | |||
141 | |||
142 | //-------------------------------------------------------------------- | ||
143 | // drawBone() | ||
144 | //-------------------------------------------------------------------- | ||
145 | void LLViewerJointShape::drawBone() | ||
146 | { | ||
147 | } | ||
148 | |||
149 | |||
150 | //-------------------------------------------------------------------- | ||
151 | // isTransparent() | ||
152 | //-------------------------------------------------------------------- | ||
153 | BOOL LLViewerJointShape::isTransparent() | ||
154 | { | ||
155 | return ( (mColor[3] < 1.0f) || | ||
156 | (!mTexture.isNull() && (mTexture->getComponents()==4)) ); | ||
157 | } | ||
158 | |||
159 | //-------------------------------------------------------------------- | ||
160 | // drawShape() | ||
161 | //-------------------------------------------------------------------- | ||
162 | U32 LLViewerJointShape::drawShape( F32 pixelArea, BOOL first_pass ) | ||
163 | { | ||
164 | U32 triangle_count = 0; | ||
165 | |||
166 | //---------------------------------------------------------------- | ||
167 | // render ST_NULL | ||
168 | //---------------------------------------------------------------- | ||
169 | if (mType == ST_NULL) | ||
170 | { | ||
171 | return triangle_count; | ||
172 | } | ||
173 | |||
174 | //---------------------------------------------------------------- | ||
175 | // setup current color | ||
176 | //---------------------------------------------------------------- | ||
177 | glColor4fv(mColor.mV); | ||
178 | |||
179 | //---------------------------------------------------------------- | ||
180 | // setup current texture | ||
181 | //---------------------------------------------------------------- | ||
182 | glMatrixMode(GL_TEXTURE); | ||
183 | glPushMatrix(); | ||
184 | glLoadIdentity(); | ||
185 | if (mType == ST_SPHERE) | ||
186 | { | ||
187 | glTranslatef(-0.25f, 0.0f, 0.0f); | ||
188 | } | ||
189 | glMatrixMode(GL_MODELVIEW); | ||
190 | LLViewerImage::bindTexture(mTexture); | ||
191 | |||
192 | //---------------------------------------------------------------- | ||
193 | // update pixel area | ||
194 | //---------------------------------------------------------------- | ||
195 | F32 s1 = llmax( getScale().mV[VX], llmax( getScale().mV[VY], getScale().mV[VZ] ) ); | ||
196 | F32 s2 = llmin( getScale().mV[VX], llmax( getScale().mV[VY], getScale().mV[VZ] ) ); | ||
197 | pixelArea *= s1 * s2; | ||
198 | |||
199 | //---------------------------------------------------------------- | ||
200 | // render shape | ||
201 | //---------------------------------------------------------------- | ||
202 | switch ( mType ) | ||
203 | { | ||
204 | case ST_CUBE: | ||
205 | gBox.render(); | ||
206 | break; | ||
207 | |||
208 | case ST_SPHERE: | ||
209 | gSphere.render( pixelArea ); | ||
210 | break; | ||
211 | |||
212 | case ST_CYLINDER: | ||
213 | gCylinder.render( pixelArea ); | ||
214 | break; | ||
215 | |||
216 | default: | ||
217 | break; | ||
218 | } | ||
219 | |||
220 | //---------------------------------------------------------------- | ||
221 | // disable texture | ||
222 | //---------------------------------------------------------------- | ||
223 | if ( mTexture ) | ||
224 | { | ||
225 | glMatrixMode(GL_TEXTURE); | ||
226 | glPopMatrix(); | ||
227 | glMatrixMode(GL_MODELVIEW); | ||
228 | } | ||
229 | |||
230 | return triangle_count; | ||
231 | } | ||
232 | |||
233 | // End | ||