ScreenParams InitScreenParams() { ScreenParams params; params.pixel_number = 80; params.look_at = make_float3(LookAtX0, LookAtY0, LookAtZ0); SetPixels(params); SetLength(params); return params; }
cImage::cImage( const Uint8* data, const eeUint& Width, const eeUint& Height, const eeUint& Channels ) : mPixels(NULL), mWidth(Width), mHeight(Height), mChannels(Channels), mSize(0), mAvoidFree(false), mLoadedFromStbi(false) { SetPixels( data ); }
cImage::cImage( cImage * image ) : mPixels(NULL), mWidth(image->mWidth), mHeight(image->mHeight), mChannels(image->mChannels), mSize(image->mSize), mAvoidFree(image->mAvoidFree), mLoadedFromStbi(image->mLoadedFromStbi) { SetPixels( image->GetPixelsPtr() ); }
//------------------------------------------------------------------------------------ // Building the mipmap for a tile based image //------------------------------------------------------------------------------------ bool Image::BuildTileMipMap( int NumCols, int NumRows ) { BuildMipMaps(); int tW = m_iWidth / NumCols; int tH = m_iHeight / NumRows; int mipmapLevel = 1; int maxmipmaplevel = 0; u8* pTempData = KGE_NEW_ARRAY(u8, tW * tH * 4); int t = 1, tth, ttw; Image* imgTemp = KGE_NEW(Image)("Temp"); imgTemp->CreateImage(tW, tH, 1, 4, EIF_RGBA, 0); int wi = m_iWidth; while (wi > NumCols) { wi /= 2; maxmipmaplevel++; } io::Logger::Log(io::ELM_Warning, "mmm = %d", maxmipmaplevel); for ( int j = 0; j < maxmipmaplevel - 1; j++) { for (int y = 0; y < NumRows; y++) { for (int x = 0; x < NumCols; x++) { GetPixels(x * tW , y * tH, 1, tW, tH, 1, EIF_BGRA, pTempData); imgTemp->SetData(pTempData); t = math::pow(2, mipmapLevel); ttw = tW / t; tth = tH / t; imgTemp->Scale(ttw, tth, 1); SetPixels(x * ttw, y * tth, 1, ttw, tth, 1, EIF_BGRA, imgTemp->GetData(), mipmapLevel); } // for x } // for y mipmapLevel++; } // for j // TODO: Not tested KGE_DELETE_ARRAY(pTempData); KGE_DELETE(imgTemp, Image); return true; } // BuildTileMipMap
cImage &cImage::operator =(const cImage &right) { mWidth = right.mWidth; mHeight = right.mHeight; mChannels = right.mChannels; mSize = right.mSize; mAvoidFree = right.mAvoidFree; mLoadedFromStbi = right.mLoadedFromStbi; ClearCache(); if ( NULL != right.mPixels ) { SetPixels( right.mPixels ); } return *this; }