Stippling removed. Emulated with a texture and some texcoord manipluation. (looks identical, and works with and without shaders)
This commit is contained in:
@@ -373,7 +373,7 @@ void LLPostProcess::createScreenTexture()
|
||||
{
|
||||
gGL.getTexUnit(0)->bindManual(LLTexUnit::TT_RECT_TEXTURE, mSceneRenderTexture->getTexName());
|
||||
LLImageGL::setManualImage(GL_TEXTURE_RECTANGLE_ARB, 0, GL_RGB, mScreenWidth, mScreenHeight, GL_RGB, GL_UNSIGNED_BYTE, &data[0]);
|
||||
gGL.getTexUnit(0)->setTextureFilteringOption(LLTexUnit::TFO_BILINEAR);
|
||||
gGL.getTexUnit(0)->setTextureFilteringOption(LLTexUnit::TFO_POINT);
|
||||
gGL.getTexUnit(0)->setTextureAddressMode(LLTexUnit::TAM_CLAMP);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -949,45 +949,21 @@ void gl_ring( F32 radius, F32 width, const LLColor4& center_color, const LLColor
|
||||
}
|
||||
|
||||
// Draw gray and white checkerboard with black border
|
||||
void gl_rect_2d_checkerboard(const LLRect& rect, GLfloat alpha)
|
||||
void gl_rect_2d_checkerboard(const LLRect& parent_screen_rect, const LLRect& rect, GLfloat alpha)
|
||||
{
|
||||
// Initialize the first time this is called.
|
||||
const S32 PIXELS = 32;
|
||||
static GLubyte checkerboard[PIXELS * PIXELS];
|
||||
static BOOL first = TRUE;
|
||||
if( first )
|
||||
{
|
||||
for( S32 i = 0; i < PIXELS; i++ )
|
||||
{
|
||||
for( S32 j = 0; j < PIXELS; j++ )
|
||||
{
|
||||
checkerboard[i * PIXELS + j] = ((i & 1) ^ (j & 1)) * 0xFF;
|
||||
}
|
||||
}
|
||||
first = FALSE;
|
||||
}
|
||||
//Already reffed in LLImageList via uuid_ui_image_map_t mUIImages. Don't use LLPointer here!
|
||||
static LLUIImage* checkboard_image = LLUI::getUIImage("checkerboard.tga");
|
||||
static F32 image_width = checkboard_image->getWidth();
|
||||
static F32 image_height = checkboard_image->getHeight();
|
||||
|
||||
F32 scale_x = rect.getWidth() / image_width;
|
||||
F32 scale_y = rect.getHeight() / image_height;
|
||||
F32 offs_x = (parent_screen_rect.mLeft + rect.mLeft) / image_width;
|
||||
F32 offs_y = (parent_screen_rect.mBottom + rect.mBottom) / image_height;
|
||||
LLRectf uv_rect(offs_x,offs_y+scale_y,offs_x+scale_x,offs_y);
|
||||
|
||||
gl_draw_scaled_image(rect.mLeft,rect.mBottom,rect.getWidth(),rect.getHeight(),checkboard_image->getImage(), UI_VERTEX_COLOR, uv_rect);
|
||||
|
||||
gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE);
|
||||
|
||||
// ...white squares
|
||||
gGL.color4f( 1.f, 1.f, 1.f, alpha );
|
||||
gl_rect_2d(rect);
|
||||
|
||||
// ...gray squares
|
||||
gGL.color4f( .7f, .7f, .7f, alpha );
|
||||
gGL.flush();
|
||||
|
||||
if (!LLGLSLShader::sNoFixedFunction)
|
||||
{ //polygon stipple is deprecated
|
||||
glPolygonStipple( checkerboard );
|
||||
|
||||
LLGLEnable polygon_stipple(GL_POLYGON_STIPPLE);
|
||||
gl_rect_2d(rect);
|
||||
}
|
||||
else
|
||||
{
|
||||
gl_rect_2d(rect);
|
||||
}
|
||||
gGL.flush();
|
||||
}
|
||||
|
||||
|
||||
@@ -78,7 +78,7 @@ void gl_rect_2d_offset_local( S32 left, S32 top, S32 right, S32 bottom, const LL
|
||||
void gl_rect_2d_offset_local( S32 left, S32 top, S32 right, S32 bottom, S32 pixel_offset = 0, BOOL filled = TRUE );
|
||||
void gl_rect_2d(const LLRect& rect, BOOL filled = TRUE );
|
||||
void gl_rect_2d(const LLRect& rect, const LLColor4& color, BOOL filled = TRUE );
|
||||
void gl_rect_2d_checkerboard(const LLRect& rect, GLfloat alpha = 1.0f);
|
||||
void gl_rect_2d_checkerboard(const LLRect& parent_screen_rect, const LLRect& rect, GLfloat alpha = 1.0f);
|
||||
|
||||
void gl_drop_shadow(S32 left, S32 top, S32 right, S32 bottom, const LLColor4 &start_color, S32 lines);
|
||||
|
||||
|
||||
@@ -259,7 +259,7 @@ void LLFloaterSculptPreview::draw()
|
||||
|
||||
if (selected <= 0)
|
||||
{
|
||||
gl_rect_2d_checkerboard(mPreviewRect);
|
||||
gl_rect_2d_checkerboard(getScreenRect(),mPreviewRect);
|
||||
LLGLDisable gls_alpha(GL_ALPHA_TEST);
|
||||
|
||||
if(mImagep.notNull())
|
||||
|
||||
@@ -218,7 +218,7 @@ void LLColorSwatchCtrl::draw()
|
||||
if ( mValid )
|
||||
{
|
||||
// Draw the color swatch
|
||||
gl_rect_2d_checkerboard( interior );
|
||||
gl_rect_2d_checkerboard( getScreenRect(), interior );
|
||||
gl_rect_2d(interior, mColor, TRUE);
|
||||
LLColor4 opaque_color = mColor;
|
||||
opaque_color.mV[VALPHA] = 1.f;
|
||||
@@ -239,7 +239,7 @@ void LLColorSwatchCtrl::draw()
|
||||
LLPointer<LLViewerFetchedTexture> fallback_image = LLViewerTextureManager::getFetchedTextureFromFile(mFallbackImageName);
|
||||
if( fallback_image->getComponents() == 4 )
|
||||
{
|
||||
gl_rect_2d_checkerboard( interior );
|
||||
gl_rect_2d_checkerboard( getScreenRect(), interior );
|
||||
}
|
||||
gl_draw_scaled_image( interior.mLeft, interior.mBottom, interior.getWidth(), interior.getHeight(), fallback_image);
|
||||
fallback_image->addTextureStats( (F32)(interior.getWidth() * interior.getHeight()) );
|
||||
|
||||
@@ -264,7 +264,7 @@ void LLFloaterImagePreview::draw()
|
||||
|
||||
if (selected <= 0)
|
||||
{
|
||||
gl_rect_2d_checkerboard(mPreviewRect);
|
||||
gl_rect_2d_checkerboard( getScreenRect(), mPreviewRect);
|
||||
LLGLDisable gls_alpha(GL_ALPHA_TEST);
|
||||
|
||||
if(mImagep.notNull())
|
||||
|
||||
@@ -270,7 +270,7 @@ void LLPreviewTexture::draw()
|
||||
|
||||
// ...border
|
||||
gl_rect_2d( border, LLColor4(0.f, 0.f, 0.f, 1.f));
|
||||
gl_rect_2d_checkerboard( interior );
|
||||
gl_rect_2d_checkerboard( getScreenRect(), interior );
|
||||
|
||||
if ( mImage.notNull() )
|
||||
{
|
||||
|
||||
@@ -648,7 +648,7 @@ void LLFloaterTexturePicker::draw()
|
||||
{
|
||||
if( mTexturep->getComponents() == 4 )
|
||||
{
|
||||
gl_rect_2d_checkerboard( interior );
|
||||
gl_rect_2d_checkerboard( getScreenRect(), interior );
|
||||
}
|
||||
|
||||
gl_draw_scaled_image( interior.mLeft, interior.mBottom, interior.getWidth(), interior.getHeight(), mTexturep );
|
||||
@@ -1540,7 +1540,7 @@ void LLTextureCtrl::draw()
|
||||
{
|
||||
if( mTexturep->getComponents() == 4 )
|
||||
{
|
||||
gl_rect_2d_checkerboard( interior );
|
||||
gl_rect_2d_checkerboard( getScreenRect(), interior );
|
||||
}
|
||||
|
||||
gl_draw_scaled_image( interior.mLeft, interior.mBottom, interior.getWidth(), interior.getHeight(), mTexturep);
|
||||
|
||||
@@ -166,6 +166,16 @@ void LLViewerTextureList::doPreloadImages()
|
||||
image->setAddressMode(LLTexUnit::TAM_WRAP);
|
||||
mImagePreloads.insert(image);
|
||||
}
|
||||
//Hideous hack to set filtering and address modes without messing with our texture classes.
|
||||
{
|
||||
LLPointer<LLUIImage> temp_image = image_list->getUIImage("checkerboard.tga",LLViewerFetchedTexture::BOOST_UI);
|
||||
if(temp_image.notNull() && temp_image->getImage().notNull())
|
||||
{
|
||||
LLViewerTexture *tex = (LLViewerTexture*)temp_image->getImage().get();
|
||||
tex->setAddressMode(LLTexUnit::TAM_WRAP);
|
||||
tex->setFilteringOption(LLTexUnit::TFO_POINT);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
BIN
indra/newview/skins/default/textures/checkerboard.tga
Normal file
BIN
indra/newview/skins/default/textures/checkerboard.tga
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 812 B |
Reference in New Issue
Block a user