Fixed FIRE-8417. Also, support for aurora-sim regions with non power of two sizes
parent
538675e56c
commit
e76211216d
|
|
@ -485,7 +485,10 @@ void LLImageGL::setSize(S32 width, S32 height, S32 ncomponents)
|
|||
// Check if dimensions are a power of two!
|
||||
if (!checkSize(width,height))
|
||||
{
|
||||
llerrs << llformat("Texture has non power of two dimension: %dx%d",width,height) << llendl;
|
||||
// <FS:CR> FIRE-8063: Don't error out if texture has non power of two dimensions, just warn us
|
||||
//llerrs << llformat("Texture has non power of two dimension: %dx%d",width,height) << llendl;
|
||||
llwarns << llformat("Texture has non power of two dimension: %dx%d",width,height) << llendl;
|
||||
// </FS:CR>
|
||||
}
|
||||
|
||||
if (mTexName)
|
||||
|
|
|
|||
|
|
@ -75,47 +75,61 @@ void LLPatchVertexArray::create(U32 surface_width, U32 patch_width, F32 meters_p
|
|||
power_of_two *= 2;
|
||||
surface_order += 1;
|
||||
}
|
||||
|
||||
if (power_of_two == (surface_width-1))
|
||||
{
|
||||
mSurfaceWidth = surface_width;
|
||||
|
||||
// Make sure patch_width is a factor of (surface_width - 1)
|
||||
U32 ratio = (surface_width - 1) / patch_width;
|
||||
F32 fratio = ((float)(surface_width - 1)) / ((float)(patch_width));
|
||||
if ( fratio == (float)(ratio))
|
||||
{
|
||||
// Make sure patch_width is a power of two
|
||||
power_of_two = 1;
|
||||
U32 patch_order = 0;
|
||||
while (power_of_two < patch_width)
|
||||
{
|
||||
power_of_two *= 2;
|
||||
patch_order += 1;
|
||||
}
|
||||
if (power_of_two == patch_width)
|
||||
{
|
||||
mPatchWidth = patch_width;
|
||||
mPatchOrder = patch_order;
|
||||
}
|
||||
else // patch_width is not a power of two...
|
||||
{
|
||||
mPatchWidth = 0;
|
||||
mPatchOrder = 0;
|
||||
}
|
||||
}
|
||||
else // patch_width is not a factor of (surface_width - 1)...
|
||||
{
|
||||
mPatchWidth = 0;
|
||||
mPatchOrder = 0;
|
||||
}
|
||||
// <FS:CR> FIRE-8063 - Aurora non power of two regions
|
||||
//if (power_of_two == (surface_width-1))
|
||||
if (power_of_two != (surface_width-1))
|
||||
{
|
||||
surface_width = power_of_two + 1;
|
||||
}
|
||||
else // surface_width is not a power of two...
|
||||
// </FS:CR>
|
||||
|
||||
mSurfaceWidth = surface_width;
|
||||
|
||||
// Make sure patch_width is a factor of (surface_width - 1)
|
||||
U32 ratio = (surface_width - 1) / patch_width;
|
||||
F32 fratio = ((float)(surface_width - 1)) / ((float)(patch_width));
|
||||
if ( fratio == (float)(ratio))
|
||||
{
|
||||
// Make sure patch_width is a power of two
|
||||
power_of_two = 1;
|
||||
U32 patch_order = 0;
|
||||
while (power_of_two < patch_width)
|
||||
{
|
||||
power_of_two *= 2;
|
||||
patch_order += 1;
|
||||
}
|
||||
// <FS:CR> FIRE-8063 - Aurora non power of two regions
|
||||
//if (power_of_two == patch_width)
|
||||
if (power_of_two != patch_width)
|
||||
{
|
||||
patch_width = power_of_two;
|
||||
}
|
||||
// </FS:CR>
|
||||
|
||||
mPatchWidth = patch_width;
|
||||
mPatchOrder = patch_order;
|
||||
|
||||
// <FS:CR> FIRE-8063 - Aurora non power of two regions
|
||||
//else // patch_width is not a power of two...
|
||||
//{
|
||||
// mPatchWidth = 0;
|
||||
// mPatchOrder = 0;
|
||||
//}
|
||||
// </FS:CR>
|
||||
}
|
||||
else // patch_width is not a factor of (surface_width - 1)...
|
||||
{
|
||||
mSurfaceWidth = 0;
|
||||
mPatchWidth = 0;
|
||||
mPatchOrder = 0;
|
||||
}
|
||||
// <FS:CR> FIRE-8063 - Aurora non power of two regions
|
||||
//else // surface_width is not a power of two...
|
||||
//{
|
||||
// mSurfaceWidth = 0;
|
||||
// mPatchWidth = 0;
|
||||
// mPatchOrder = 0;
|
||||
//}
|
||||
// </FS:CR>
|
||||
|
||||
// PART 2 -- Allocate memory for the render level table
|
||||
if (mPatchWidth > 0)
|
||||
|
|
|
|||
|
|
@ -122,10 +122,6 @@ LLWorld::LLWorld() :
|
|||
mDefaultWaterTexturep = LLViewerTextureManager::getLocalTexture(raw.get(), FALSE);
|
||||
gGL.getTexUnit(0)->bind(mDefaultWaterTexturep);
|
||||
mDefaultWaterTexturep->setAddressMode(LLTexUnit::TAM_CLAMP);
|
||||
|
||||
// <FS:CR> Aurora Sim>
|
||||
refreshLimits();
|
||||
// </FS:CR> Aurora Sim>
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -664,7 +660,7 @@ LLViewerRegion* LLWorld::addRegion(const U64 ®ion_handle, const LLHost &host,
|
|||
|
||||
if(dir == NORTH || dir == SOUTH) adj_x += WORLD_PATCH_SIZE;
|
||||
if(dir == EAST || dir == WEST) adj_y += WORLD_PATCH_SIZE;
|
||||
// <FS:CR> Aurora Sim
|
||||
// </FS:CR> Aurora Sim
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue