diff options
author | Jacek Antonelli | 2009-01-11 16:10:39 -0600 |
---|---|---|
committer | Jacek Antonelli | 2009-01-11 16:10:43 -0600 |
commit | a87e38229921b48c32187c672a942516722f1b52 (patch) | |
tree | 9e1dc0bc2318a9c6fa454bdb6d873a6af0e0ce3c /linden/indra/newview/llmaniptranslate.cpp | |
parent | Second Life viewer sources 1.22.4-RC (diff) | |
download | meta-impy-a87e38229921b48c32187c672a942516722f1b52.zip meta-impy-a87e38229921b48c32187c672a942516722f1b52.tar.gz meta-impy-a87e38229921b48c32187c672a942516722f1b52.tar.bz2 meta-impy-a87e38229921b48c32187c672a942516722f1b52.tar.xz |
Second Life viewer sources 1.22.5-RC
Diffstat (limited to '')
-rw-r--r-- | linden/indra/newview/llmaniptranslate.cpp | 44 |
1 files changed, 36 insertions, 8 deletions
diff --git a/linden/indra/newview/llmaniptranslate.cpp b/linden/indra/newview/llmaniptranslate.cpp index 30fa745..fd02be6 100644 --- a/linden/indra/newview/llmaniptranslate.cpp +++ b/linden/indra/newview/llmaniptranslate.cpp | |||
@@ -4,7 +4,7 @@ | |||
4 | * | 4 | * |
5 | * $LicenseInfo:firstyear=2002&license=viewergpl$ | 5 | * $LicenseInfo:firstyear=2002&license=viewergpl$ |
6 | * | 6 | * |
7 | * Copyright (c) 2002-2008, Linden Research, Inc. | 7 | * Copyright (c) 2002-2009, Linden Research, Inc. |
8 | * | 8 | * |
9 | * Second Life Viewer Source Code | 9 | * Second Life Viewer Source Code |
10 | * The source code in this file ("Source Code") is provided by Linden Lab | 10 | * The source code in this file ("Source Code") is provided by Linden Lab |
@@ -77,7 +77,7 @@ const F32 PLANE_TICK_SIZE = 0.4f; | |||
77 | const F32 MANIPULATOR_SCALE_HALF_LIFE = 0.07f; | 77 | const F32 MANIPULATOR_SCALE_HALF_LIFE = 0.07f; |
78 | const F32 SNAP_ARROW_SCALE = 0.7f; | 78 | const F32 SNAP_ARROW_SCALE = 0.7f; |
79 | 79 | ||
80 | static GLuint sGridTex = 0; | 80 | static LLPointer<LLImageGL> sGridTex = NULL ; |
81 | 81 | ||
82 | const LLManip::EManipPart MANIPULATOR_IDS[9] = | 82 | const LLManip::EManipPart MANIPULATOR_IDS[9] = |
83 | { | 83 | { |
@@ -119,22 +119,50 @@ LLManipTranslate::LLManipTranslate( LLToolComposite* composite ) | |||
119 | mPlaneScales(1.f, 1.f, 1.f), | 119 | mPlaneScales(1.f, 1.f, 1.f), |
120 | mPlaneManipPositions(1.f, 1.f, 1.f, 1.f) | 120 | mPlaneManipPositions(1.f, 1.f, 1.f, 1.f) |
121 | { | 121 | { |
122 | if (sGridTex == 0) | 122 | if (sGridTex.isNull()) |
123 | { | 123 | { |
124 | restoreGL(); | 124 | restoreGL(); |
125 | } | 125 | } |
126 | } | 126 | } |
127 | 127 | ||
128 | //static | 128 | //static |
129 | U32 LLManipTranslate::getGridTexName() | ||
130 | { | ||
131 | if(sGridTex.isNull()) | ||
132 | { | ||
133 | restoreGL() ; | ||
134 | } | ||
135 | |||
136 | return sGridTex.isNull() ? 0 : sGridTex->getTexName() ; | ||
137 | } | ||
138 | |||
139 | //static | ||
140 | void LLManipTranslate::destroyGL() | ||
141 | { | ||
142 | if (sGridTex) | ||
143 | { | ||
144 | sGridTex = NULL ; | ||
145 | } | ||
146 | } | ||
147 | |||
148 | //static | ||
129 | void LLManipTranslate::restoreGL() | 149 | void LLManipTranslate::restoreGL() |
130 | { | 150 | { |
131 | //generate grid texture | 151 | //generate grid texture |
132 | U32 rez = 512; | 152 | U32 rez = 512; |
133 | U32 mip = 0; | 153 | U32 mip = 0; |
134 | 154 | ||
135 | GLuint* d = new GLuint[rez*rez]; | 155 | destroyGL() ; |
136 | glGenTextures(1, &sGridTex); | 156 | sGridTex = new LLImageGL() ; |
137 | gGL.getTexUnit(0)->bindManual(LLTexUnit::TT_TEXTURE, sGridTex); | 157 | if(!sGridTex->createGLTexture()) |
158 | { | ||
159 | sGridTex = NULL ; | ||
160 | return ; | ||
161 | } | ||
162 | |||
163 | GLuint* d = new GLuint[rez*rez]; | ||
164 | |||
165 | gGL.getTexUnit(0)->bindManual(LLTexUnit::TT_TEXTURE, sGridTex->getTexName()); | ||
138 | glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR_MIPMAP_LINEAR); | 166 | glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR_MIPMAP_LINEAR); |
139 | glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST); | 167 | glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST); |
140 | 168 | ||
@@ -1503,7 +1531,7 @@ void LLManipTranslate::renderSnapGuides() | |||
1503 | LLGLDisable stencil(GL_STENCIL_TEST); | 1531 | LLGLDisable stencil(GL_STENCIL_TEST); |
1504 | { | 1532 | { |
1505 | LLGLDepthTest gls_depth(GL_TRUE, GL_FALSE, GL_GREATER); | 1533 | LLGLDepthTest gls_depth(GL_TRUE, GL_FALSE, GL_GREATER); |
1506 | gGL.getTexUnit(0)->bindManual(LLTexUnit::TT_TEXTURE, sGridTex); | 1534 | gGL.getTexUnit(0)->bindManual(LLTexUnit::TT_TEXTURE, getGridTexName()); |
1507 | gGL.flush(); | 1535 | gGL.flush(); |
1508 | gGL.blendFunc(LLRender::BF_ZERO, LLRender::BF_ONE_MINUS_SOURCE_ALPHA); | 1536 | gGL.blendFunc(LLRender::BF_ZERO, LLRender::BF_ONE_MINUS_SOURCE_ALPHA); |
1509 | renderGrid(u,v,tiles,0.9f, 0.9f, 0.9f,a*0.15f); | 1537 | renderGrid(u,v,tiles,0.9f, 0.9f, 0.9f,a*0.15f); |
@@ -1518,7 +1546,7 @@ void LLManipTranslate::renderSnapGuides() | |||
1518 | renderGrid(u,v,tiles,0.0f, 0.0f, 0.0f,a*0.16f); | 1546 | renderGrid(u,v,tiles,0.0f, 0.0f, 0.0f,a*0.16f); |
1519 | 1547 | ||
1520 | //draw grid top | 1548 | //draw grid top |
1521 | gGL.getTexUnit(0)->bindManual(LLTexUnit::TT_TEXTURE, sGridTex); | 1549 | gGL.getTexUnit(0)->bindManual(LLTexUnit::TT_TEXTURE, getGridTexName()); |
1522 | renderGrid(u,v,tiles,1,1,1,a); | 1550 | renderGrid(u,v,tiles,1,1,1,a); |
1523 | 1551 | ||
1524 | gGL.popMatrix(); | 1552 | gGL.popMatrix(); |