Stippling removed. Emulated with a texture and some texcoord manipluation. (looks identical, and works with and without shaders)

This commit is contained in:
Shyotl
2012-01-06 00:53:18 -06:00
parent dcbf39bcfa
commit 54bfdb7704
10 changed files with 32 additions and 46 deletions

View File

@@ -373,7 +373,7 @@ void LLPostProcess::createScreenTexture()
{ {
gGL.getTexUnit(0)->bindManual(LLTexUnit::TT_RECT_TEXTURE, mSceneRenderTexture->getTexName()); 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]); 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); gGL.getTexUnit(0)->setTextureAddressMode(LLTexUnit::TAM_CLAMP);
} }
} }

View File

@@ -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 // 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. //Already reffed in LLImageList via uuid_ui_image_map_t mUIImages. Don't use LLPointer here!
const S32 PIXELS = 32; static LLUIImage* checkboard_image = LLUI::getUIImage("checkerboard.tga");
static GLubyte checkerboard[PIXELS * PIXELS]; static F32 image_width = checkboard_image->getWidth();
static BOOL first = TRUE; static F32 image_height = checkboard_image->getHeight();
if( first )
{ F32 scale_x = rect.getWidth() / image_width;
for( S32 i = 0; i < PIXELS; i++ ) F32 scale_y = rect.getHeight() / image_height;
{ F32 offs_x = (parent_screen_rect.mLeft + rect.mLeft) / image_width;
for( S32 j = 0; j < PIXELS; j++ ) 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);
checkerboard[i * PIXELS + j] = ((i & 1) ^ (j & 1)) * 0xFF;
} gl_draw_scaled_image(rect.mLeft,rect.mBottom,rect.getWidth(),rect.getHeight(),checkboard_image->getImage(), UI_VERTEX_COLOR, uv_rect);
}
first = FALSE;
}
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(); gGL.flush();
} }

View File

@@ -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_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, BOOL filled = TRUE );
void gl_rect_2d(const LLRect& rect, const LLColor4& color, 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); void gl_drop_shadow(S32 left, S32 top, S32 right, S32 bottom, const LLColor4 &start_color, S32 lines);

View File

@@ -259,7 +259,7 @@ void LLFloaterSculptPreview::draw()
if (selected <= 0) if (selected <= 0)
{ {
gl_rect_2d_checkerboard(mPreviewRect); gl_rect_2d_checkerboard(getScreenRect(),mPreviewRect);
LLGLDisable gls_alpha(GL_ALPHA_TEST); LLGLDisable gls_alpha(GL_ALPHA_TEST);
if(mImagep.notNull()) if(mImagep.notNull())

View File

@@ -218,7 +218,7 @@ void LLColorSwatchCtrl::draw()
if ( mValid ) if ( mValid )
{ {
// Draw the color swatch // Draw the color swatch
gl_rect_2d_checkerboard( interior ); gl_rect_2d_checkerboard( getScreenRect(), interior );
gl_rect_2d(interior, mColor, TRUE); gl_rect_2d(interior, mColor, TRUE);
LLColor4 opaque_color = mColor; LLColor4 opaque_color = mColor;
opaque_color.mV[VALPHA] = 1.f; opaque_color.mV[VALPHA] = 1.f;
@@ -239,7 +239,7 @@ void LLColorSwatchCtrl::draw()
LLPointer<LLViewerFetchedTexture> fallback_image = LLViewerTextureManager::getFetchedTextureFromFile(mFallbackImageName); LLPointer<LLViewerFetchedTexture> fallback_image = LLViewerTextureManager::getFetchedTextureFromFile(mFallbackImageName);
if( fallback_image->getComponents() == 4 ) 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); gl_draw_scaled_image( interior.mLeft, interior.mBottom, interior.getWidth(), interior.getHeight(), fallback_image);
fallback_image->addTextureStats( (F32)(interior.getWidth() * interior.getHeight()) ); fallback_image->addTextureStats( (F32)(interior.getWidth() * interior.getHeight()) );

View File

@@ -264,7 +264,7 @@ void LLFloaterImagePreview::draw()
if (selected <= 0) if (selected <= 0)
{ {
gl_rect_2d_checkerboard(mPreviewRect); gl_rect_2d_checkerboard( getScreenRect(), mPreviewRect);
LLGLDisable gls_alpha(GL_ALPHA_TEST); LLGLDisable gls_alpha(GL_ALPHA_TEST);
if(mImagep.notNull()) if(mImagep.notNull())

View File

@@ -270,7 +270,7 @@ void LLPreviewTexture::draw()
// ...border // ...border
gl_rect_2d( border, LLColor4(0.f, 0.f, 0.f, 1.f)); 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() ) if ( mImage.notNull() )
{ {

View File

@@ -648,7 +648,7 @@ void LLFloaterTexturePicker::draw()
{ {
if( mTexturep->getComponents() == 4 ) 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 ); gl_draw_scaled_image( interior.mLeft, interior.mBottom, interior.getWidth(), interior.getHeight(), mTexturep );
@@ -1540,7 +1540,7 @@ void LLTextureCtrl::draw()
{ {
if( mTexturep->getComponents() == 4 ) 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); gl_draw_scaled_image( interior.mLeft, interior.mBottom, interior.getWidth(), interior.getHeight(), mTexturep);

View File

@@ -166,6 +166,16 @@ void LLViewerTextureList::doPreloadImages()
image->setAddressMode(LLTexUnit::TAM_WRAP); image->setAddressMode(LLTexUnit::TAM_WRAP);
mImagePreloads.insert(image); 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);
}
}
} }

Binary file not shown.

After

Width:  |  Height:  |  Size: 812 B