mirror of
https://github.com/TorqueGameEngines/Torque3D.git
synced 2026-07-13 23:54:35 +00:00
1) bumped bytesPerTexel on up to 8 and got rid of the explicit fillin
2) fed glTexSubImage3D GL_RGBA instead of a second GFXGLTextureType[mFormat]. this tells it what order colors come in, not what size 3)for safeties sake, skipped out on updatetexture if the fed cubemap isn't initialized yet
This commit is contained in:
parent
871fdf3664
commit
413d756b80
1 changed files with 6 additions and 13 deletions
|
|
@ -290,24 +290,19 @@ U8* GFXGLCubemap::getTextureData(U32 face, U32 mip)
|
||||||
{
|
{
|
||||||
AssertFatal(mMipMapLevels, "");
|
AssertFatal(mMipMapLevels, "");
|
||||||
mip = (mip < mMipMapLevels) ? mip : 0;
|
mip = (mip < mMipMapLevels) ? mip : 0;
|
||||||
const U32 bytesPerTexel = 4; //TODO make work with more formats!!!!!
|
const U32 bytesPerTexel = 8; //TODO make work with more formats!!!!!
|
||||||
const U32 dataSize = ImageUtil::isCompressedFormat(mFaceFormat)
|
const U32 dataSize = ImageUtil::isCompressedFormat(mFaceFormat)
|
||||||
? getCompressedSurfaceSize(mFaceFormat, mWidth, mHeight, mip)
|
? getCompressedSurfaceSize(mFaceFormat, mWidth, mHeight, mip)
|
||||||
: (mWidth >> mip) * (mHeight >> mip) * bytesPerTexel;
|
: (mWidth >> mip) * (mHeight >> mip) * bytesPerTexel;
|
||||||
|
|
||||||
U8* data = new U8[dataSize];
|
U8* data = new U8[dataSize];
|
||||||
|
PRESERVE_TEXTURE(GL_TEXTURE_CUBE_MAP);
|
||||||
for (U32 i = 0; i < dataSize; i++)
|
|
||||||
{
|
|
||||||
data[i] = 1;
|
|
||||||
}
|
|
||||||
/*PRESERVE_TEXTURE(GL_TEXTURE_CUBE_MAP);
|
|
||||||
glBindTexture(GL_TEXTURE_CUBE_MAP, mCubemap);
|
glBindTexture(GL_TEXTURE_CUBE_MAP, mCubemap);
|
||||||
|
|
||||||
if (ImageUtil::isCompressedFormat(mFaceFormat))
|
if (ImageUtil::isCompressedFormat(mFaceFormat))
|
||||||
glGetCompressedTexImage(faceList[face], mip, data);
|
glGetCompressedTexImage(faceList[face], mip, data);
|
||||||
else
|
else
|
||||||
glGetTexImage(faceList[face], mip, GFXGLTextureFormat[mFaceFormat], GFXGLTextureType[mFaceFormat], data);*/
|
glGetTexImage(faceList[face], mip, GFXGLTextureFormat[mFaceFormat], GFXGLTextureType[mFaceFormat], data);
|
||||||
|
|
||||||
return data;
|
return data;
|
||||||
}
|
}
|
||||||
|
|
@ -367,7 +362,7 @@ void GFXGLCubemapArray::init(GFXCubemapHandle *cubemaps, const U32 cubemapCount)
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{*/ //TODO figure out xyzOffsets
|
{*/ //TODO figure out xyzOffsets
|
||||||
glTexSubImage3D(GL_TEXTURE_CUBE_MAP_ARRAY, currentMip, 0, 0, 0, mipSize, mipSize, i * face, GFXGLTextureFormat[mFormat], GFXGLTextureType[mFormat], pixelData);
|
glTexSubImage3D(GL_TEXTURE_CUBE_MAP_ARRAY, currentMip, 0, 0, 0, mipSize, mipSize, i * face, GL_RGBA, GFXGLTextureType[mFormat], pixelData);
|
||||||
//}
|
//}
|
||||||
delete[] pixelData;
|
delete[] pixelData;
|
||||||
}
|
}
|
||||||
|
|
@ -432,7 +427,8 @@ void GFXGLCubemapArray::init(const U32 cubemapCount, const U32 cubemapFaceSize,
|
||||||
void GFXGLCubemapArray::updateTexture(const GFXCubemapHandle &cubemap, const U32 slot)
|
void GFXGLCubemapArray::updateTexture(const GFXCubemapHandle &cubemap, const U32 slot)
|
||||||
{
|
{
|
||||||
AssertFatal(slot <= mNumCubemaps, "GFXD3D11CubemapArray::updateTexture - trying to update a cubemap texture that is out of bounds!");
|
AssertFatal(slot <= mNumCubemaps, "GFXD3D11CubemapArray::updateTexture - trying to update a cubemap texture that is out of bounds!");
|
||||||
|
if (!cubemap->isInitialized())
|
||||||
|
return;
|
||||||
const bool isCompressed = ImageUtil::isCompressedFormat(mFormat);
|
const bool isCompressed = ImageUtil::isCompressedFormat(mFormat);
|
||||||
|
|
||||||
GFXGLCubemap* glTex = static_cast<GFXGLCubemap*>(cubemap.getPointer());
|
GFXGLCubemap* glTex = static_cast<GFXGLCubemap*>(cubemap.getPointer());
|
||||||
|
|
@ -456,9 +452,6 @@ void GFXGLCubemapArray::updateTexture(const GFXCubemapHandle &cubemap, const U32
|
||||||
delete[] pixelData;
|
delete[] pixelData;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool tmp = true;
|
|
||||||
bool asdf = true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void GFXGLCubemapArray::copyTo(GFXCubemapArray *pDstCubemap)
|
void GFXGLCubemapArray::copyTo(GFXCubemapArray *pDstCubemap)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue