aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/linden/indra/newview/llface.inl
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/newview/llface.inl
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/newview/llface.inl241
1 files changed, 241 insertions, 0 deletions
diff --git a/linden/indra/newview/llface.inl b/linden/indra/newview/llface.inl
new file mode 100644
index 0000000..cdf858f
--- /dev/null
+++ b/linden/indra/newview/llface.inl
@@ -0,0 +1,241 @@
1/**
2 * @file llface.inl
3 * @brief Inline functions for LLFace
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_LLFACE_INL
29#define LL_LLFACE_INL
30
31#include "llglheaders.h"
32
33inline BOOL LLFace::getDirty() const
34{
35 return (mGeneration != mDrawPoolp->mGeneration);
36}
37
38inline void LLFace::clearDirty()
39{
40 mGeneration = mDrawPoolp->mGeneration;
41}
42
43inline const LLTextureEntry* LLFace::getTextureEntry() const
44{
45 return mVObjp->getTE(mTEOffset);
46}
47
48inline LLDrawPool* LLFace::getPool() const
49{
50 return mDrawPoolp;
51}
52
53inline S32 LLFace::getStride() const
54{
55 return mDrawPoolp->getStride();
56}
57
58inline LLDrawable* LLFace::getDrawable() const
59{
60 return mDrawablep;
61}
62
63inline LLViewerObject* LLFace::getViewerObject() const
64{
65 return mVObjp;
66}
67
68
69
70inline S32 LLFace::getVertices(LLStrider<LLVector3> &vertices)
71{
72 if (!mGeomCount)
73 {
74 return -1;
75 }
76 if (isState(BACKLIST))
77 {
78 if (!mBackupMem)
79 {
80 printDebugInfo();
81 llerrs << "No backup memory for face" << llendl;
82 }
83 vertices = (LLVector3*)(mBackupMem + (4 * mIndicesCount) + mDrawPoolp->mDataOffsets[LLDrawPool::DATA_VERTICES]);
84 vertices.setStride( mDrawPoolp->getStride());
85 return 0;
86 }
87 else
88 {
89 llassert(mGeomIndex >= 0);
90 mDrawPoolp->getVertexStrider(vertices, mGeomIndex);
91 mDrawPoolp->setDirty();
92 return mGeomIndex;
93 }
94}
95
96inline S32 LLFace::getNormals(LLStrider<LLVector3> &normals)
97{
98 if (!mGeomCount)
99 {
100 return -1;
101 }
102 if (isState(BACKLIST))
103 {
104 if (!mBackupMem)
105 {
106 printDebugInfo();
107 llerrs << "No backup memory for face" << llendl;
108 }
109 normals = (LLVector3*)(mBackupMem + (4 * mIndicesCount) + mDrawPoolp->mDataOffsets[LLDrawPool::DATA_NORMALS]);
110 normals.setStride( mDrawPoolp->getStride());
111 return 0;
112 }
113 else
114 {
115 llassert(mGeomIndex >= 0);
116 mDrawPoolp->getNormalStrider(normals, mGeomIndex);
117 mDrawPoolp->setDirty();
118 return mGeomIndex;
119 }
120}
121
122inline S32 LLFace::getBinormals(LLStrider<LLVector3> &binormals)
123{
124 if (!mGeomCount)
125 {
126 return -1;
127 }
128 if (isState(BACKLIST))
129 {
130 if (!mBackupMem)
131 {
132 printDebugInfo();
133 llerrs << "No backup memory for face" << llendl;
134 }
135 binormals = (LLVector3*)(mBackupMem + (4 * mIndicesCount) + mDrawPoolp->mDataOffsets[LLDrawPool::DATA_BINORMALS]);
136 binormals.setStride( mDrawPoolp->getStride());
137 return 0;
138 }
139 else
140 {
141 llassert(mGeomIndex >= 0);
142 mDrawPoolp->getBinormalStrider(binormals, mGeomIndex);
143 mDrawPoolp->setDirty();
144 return mGeomIndex;
145 }
146}
147
148
149inline S32 LLFace::getColors (LLStrider<LLColor4U> &colors)
150{
151 if (!mGeomCount)
152 {
153 return -1;
154 }
155 LLColor4U *colorp = NULL;
156 if (isState(BACKLIST))
157 {
158 if (!mBackupMem)
159 {
160 printDebugInfo();
161 llerrs << "No backup memory for face" << llendl;
162 }
163 colorp = (LLColor4U*)(mBackupMem + (4 * mIndicesCount) + (mGeomCount * mDrawPoolp->getStride()));
164 colors = colorp;
165 return 0;
166 }
167 else
168 {
169 llassert(mGeomIndex >= 0);
170 if (!mDrawPoolp->getColorStrider(colors, mGeomIndex))
171 {
172 printDebugInfo();
173 llerrs << "No color pointer for a color strider!" << llendl;
174 }
175 mDrawPoolp->setDirtyColors();
176 return mGeomIndex;
177 }
178}
179
180inline S32 LLFace::getTexCoords (LLStrider<LLVector2> &texCoords, S32 pass )
181{
182 if (!mGeomCount)
183 {
184 return -1;
185 }
186 if (isState(BACKLIST))
187 {
188 if (!mBackupMem)
189 {
190 printDebugInfo();
191 llerrs << "No backup memory for face" << llendl;
192 }
193 texCoords = (LLVector2*)(mBackupMem + (4 * mIndicesCount) + mDrawPoolp->mDataOffsets[LLDrawPool::DATA_TEX_COORDS0 + pass]);
194 texCoords.setStride( mDrawPoolp->getStride());
195 return 0;
196 }
197 else
198 {
199 llassert(mGeomIndex >= 0);
200 mDrawPoolp->getTexCoordStrider(texCoords, mGeomIndex, pass );
201 mDrawPoolp->setDirty();
202 return mGeomIndex;
203 }
204}
205
206inline S32 LLFace::getIndices (U32* &indicesp)
207{
208 if (isState(BACKLIST))
209 {
210 indicesp = (U32*)mBackupMem;
211 return 0;
212 }
213 else
214 {
215 indicesp = mDrawPoolp->getIndices(mIndicesIndex);
216 llassert(mGeomIndex >= 0);
217 return mGeomIndex;
218 }
219}
220
221inline const U32* LLFace::getRawIndices() const
222{
223 llassert(!isState(BACKLIST));
224
225 return &mDrawPoolp->mIndices[mIndicesIndex];
226}
227
228
229inline void LLFace::bindTexture(S32 stage) const
230{
231 if (mTexture)
232 {
233 mTexture->bindTexture(stage);
234 }
235 else
236 {
237 LLImageGL::unbindTexture(stage, GL_TEXTURE_2D);
238 }
239}
240
241#endif