aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/linden/indra/newview/llvoground.cpp
diff options
context:
space:
mode:
authorJacek Antonelli2008-08-15 23:44:50 -0500
committerJacek Antonelli2008-08-15 23:44:50 -0500
commit89fe5dab825a62a0e3fd8d248cbc91c65eb2a426 (patch)
treebcff14b7888d04a2fec799c59369f6095224bd08 /linden/indra/newview/llvoground.cpp
parentSecond Life viewer sources 1.13.3.2 (diff)
downloadmeta-impy-89fe5dab825a62a0e3fd8d248cbc91c65eb2a426.zip
meta-impy-89fe5dab825a62a0e3fd8d248cbc91c65eb2a426.tar.gz
meta-impy-89fe5dab825a62a0e3fd8d248cbc91c65eb2a426.tar.bz2
meta-impy-89fe5dab825a62a0e3fd8d248cbc91c65eb2a426.tar.xz
Second Life viewer sources 1.14.0.0
Diffstat (limited to '')
-rw-r--r--linden/indra/newview/llvoground.cpp84
1 files changed, 34 insertions, 50 deletions
diff --git a/linden/indra/newview/llvoground.cpp b/linden/indra/newview/llvoground.cpp
index 7001cb8..0ae6ed8 100644
--- a/linden/indra/newview/llvoground.cpp
+++ b/linden/indra/newview/llvoground.cpp
@@ -28,6 +28,7 @@
28#include "llviewerprecompiledheaders.h" 28#include "llviewerprecompiledheaders.h"
29 29
30#include "llvoground.h" 30#include "llvoground.h"
31#include "lldrawpoolground.h"
31 32
32#include "llviewercontrol.h" 33#include "llviewercontrol.h"
33 34
@@ -40,7 +41,7 @@
40#include "pipeline.h" 41#include "pipeline.h"
41 42
42LLVOGround::LLVOGround(const LLUUID &id, const LLPCode pcode, LLViewerRegion *regionp) 43LLVOGround::LLVOGround(const LLUUID &id, const LLPCode pcode, LLViewerRegion *regionp)
43: LLViewerObject(id, pcode, regionp) 44: LLStaticViewerObject(id, pcode, regionp)
44{ 45{
45 mbCanSelect = FALSE; 46 mbCanSelect = FALSE;
46} 47}
@@ -57,10 +58,10 @@ BOOL LLVOGround::idleUpdate(LLAgent &agent, LLWorld &world, const F64 &time)
57 return TRUE; 58 return TRUE;
58 } 59 }
59 60
60 if (mDrawable) 61 /*if (mDrawable)
61 { 62 {
62 gPipeline.markRebuild(mDrawable, LLDrawable::REBUILD_VOLUME, TRUE); 63 gPipeline.markRebuild(mDrawable, LLDrawable::REBUILD_VOLUME, TRUE);
63 } 64 }*/
64 return TRUE; 65 return TRUE;
65} 66}
66 67
@@ -75,7 +76,8 @@ LLDrawable *LLVOGround::createDrawable(LLPipeline *pipeline)
75 pipeline->allocDrawable(this); 76 pipeline->allocDrawable(this);
76 mDrawable->setLit(FALSE); 77 mDrawable->setLit(FALSE);
77 78
78 LLDrawPool *poolp = gPipeline.getPool(LLDrawPool::POOL_GROUND); 79 mDrawable->setRenderType(LLPipeline::RENDER_TYPE_GROUND);
80 LLDrawPoolGround *poolp = (LLDrawPoolGround*) gPipeline.getPool(LLDrawPool::POOL_GROUND);
79 81
80 mDrawable->addFace(poolp, NULL); 82 mDrawable->addFace(poolp, NULL);
81 83
@@ -87,15 +89,25 @@ BOOL LLVOGround::updateGeometry(LLDrawable *drawable)
87 LLStrider<LLVector3> verticesp; 89 LLStrider<LLVector3> verticesp;
88 LLStrider<LLVector3> normalsp; 90 LLStrider<LLVector3> normalsp;
89 LLStrider<LLVector2> texCoordsp; 91 LLStrider<LLVector2> texCoordsp;
90 U32 *indicesp; 92 LLStrider<U32> indicesp;
91 S32 index_offset; 93 S32 index_offset;
92 LLFace *face; 94 LLFace *face;
93 95
96 LLDrawPoolGround *poolp = (LLDrawPoolGround*) gPipeline.getPool(LLDrawPool::POOL_GROUND);
97
94 if (drawable->getNumFaces() < 1) 98 if (drawable->getNumFaces() < 1)
95 drawable->addFace(gPipeline.getPool(LLDrawPool::POOL_GROUND), NULL); 99 drawable->addFace(poolp, NULL);
96 face = drawable->getFace(0); 100 face = drawable->getFace(0);
97 face->setPrimType(LLTriangles); 101
98 face->setSize(6, 12); 102 if (face->mVertexBuffer.isNull())
103 {
104 face->setSize(5, 12);
105 face->mVertexBuffer = new LLVertexBuffer(LLDrawPoolGround::VERTEX_DATA_MASK, GL_STREAM_DRAW_ARB);
106 face->mVertexBuffer->allocateBuffer(face->getGeomCount(), face->getIndicesCount(), TRUE);
107 face->setGeomIndex(0);
108 face->setIndicesIndex(0);
109 }
110
99 index_offset = face->getGeometry(verticesp,normalsp,texCoordsp, indicesp); 111 index_offset = face->getGeometry(verticesp,normalsp,texCoordsp, indicesp);
100 if (-1 == index_offset) 112 if (-1 == index_offset)
101 { 113 {
@@ -117,68 +129,40 @@ BOOL LLVOGround::updateGeometry(LLDrawable *drawable)
117 left_dir.normVec(); 129 left_dir.normVec();
118 130
119 // Our center top point 131 // Our center top point
120 LLVector3 center_top, center_bottom;
121
122 LLColor4 ground_color = gSky.getFogColor(); 132 LLColor4 ground_color = gSky.getFogColor();
123 ground_color.mV[3] = 1.f; 133 ground_color.mV[3] = 1.f;
124 face->setFaceColor(ground_color); 134 face->setFaceColor(ground_color);
125 135
126 if (gCamera->getOrigin().mV[VZ] < gAgent.getRegion()->getWaterHeight()) 136 *(verticesp++) = LLVector3(64, 64, 0);
127 { 137 *(verticesp++) = LLVector3(-64, 64, 0);
128 // Underwater 138 *(verticesp++) = LLVector3(-64, -64, 0);
129 //center_top = gCamera->getOrigin() + at_dir*gCamera->getFar(); 139 *(verticesp++) = LLVector3(64, -64, 0);
130 center_top = gCamera->getOrigin() - LLVector3(0, 0, 5); 140 *(verticesp++) = LLVector3(0, 0, -1024);
131 center_bottom = gCamera->getOrigin() + at_dir*gCamera->getFar();;
132 //center_top.mV[VZ] = gAgent.getRegion()->getWaterHeight() + 0.5f;
133 center_bottom.mV[VZ] = -100.f;
134 }
135 else
136 {
137 // Above water
138 center_top = gCamera->getOrigin() - LLVector3(0, 0, 30);
139 if ((gPipeline.getVertexShaderLevel(LLPipeline::SHADER_ENVIRONMENT) > 0))
140 {
141 center_top.mV[VZ] = gAgent.getRegion()->getWaterHeight();
142 }
143 //center_top = gCamera->getOrigin() + at_dir*9000.f;
144 center_bottom = gCamera->getOrigin() - at_dir*gCamera->getFar();
145 //center_top.mV[VZ] = 0.f;
146 //center_bottom.mV[VZ] = gAgent.getRegion()->getWaterHeight();
147 }
148
149 *(verticesp++) = center_top + LLVector3(6000, 6000, 0);
150 *(verticesp++) = center_top + LLVector3(-6000, 6000, 0);
151 *(verticesp++) = center_top + LLVector3(-6000, -6000, 0);
152
153 *(verticesp++) = center_top + LLVector3(-6000, -6000, 0);
154 *(verticesp++) = center_top + LLVector3(6000, -6000, 0);
155 *(verticesp++) = center_top + LLVector3(6000, 6000, 0);
156 141
157 142
158 // Triangles for each side 143 // Triangles for each side
159 *indicesp++ = index_offset + 0; 144 *indicesp++ = index_offset + 0;
160 *indicesp++ = index_offset + 1; 145 *indicesp++ = index_offset + 1;
161 *indicesp++ = index_offset + 3; 146 *indicesp++ = index_offset + 4;
162 147
163 *indicesp++ = index_offset + 0; 148 *indicesp++ = index_offset + 1;
164 *indicesp++ = index_offset + 3;
165 *indicesp++ = index_offset + 2; 149 *indicesp++ = index_offset + 2;
150 *indicesp++ = index_offset + 4;
166 151
167 *indicesp++ = index_offset + 2; 152 *indicesp++ = index_offset + 2;
168 *indicesp++ = index_offset + 3; 153 *indicesp++ = index_offset + 3;
169 *indicesp++ = index_offset + 5; 154 *indicesp++ = index_offset + 4;
170 155
171 *indicesp++ = index_offset + 2; 156 *indicesp++ = index_offset + 3;
172 *indicesp++ = index_offset + 5; 157 *indicesp++ = index_offset + 0;
173 *indicesp++ = index_offset + 4; 158 *indicesp++ = index_offset + 4;
174 159
175 *(texCoordsp++) = LLVector2(0.f, 0.f); 160 *(texCoordsp++) = LLVector2(0.f, 0.f);
176 *(texCoordsp++) = LLVector2(1.f, 0.f); 161 *(texCoordsp++) = LLVector2(1.f, 0.f);
177 *(texCoordsp++) = LLVector2(0.f, 1.f);
178 *(texCoordsp++) = LLVector2(1.f, 1.f); 162 *(texCoordsp++) = LLVector2(1.f, 1.f);
179 *(texCoordsp++) = LLVector2(0.f, 2.f); 163 *(texCoordsp++) = LLVector2(0.f, 1.f);
180 *(texCoordsp++) = LLVector2(1.f, 2.f); 164 *(texCoordsp++) = LLVector2(0.5f, 0.5f);
181 165
182 LLPipeline::sCompiles++; 166 LLPipeline::sCompiles++;
183 return TRUE; 167 return TRUE;
184} 168}