void Water::Init() { Shutdown(); Terrain * terrain = Environment::Instance()->GetTerrain(); if (!terrain) return ; mSizeX = terrain->GetConfig().xVertexCount - 1; mSizeZ = terrain->GetConfig().zVertexCount - 1; mGridSize = terrain->GetConfig().xSize / mSizeX; mData = new char[mSizeX * mSizeZ]; ZeroMemory(mData, mSizeX * mSizeZ); _allocBlock(); mTech = Environment::Instance()->GetShaderLib()->GetTechnique("Water"); mTech_UnderWater = Environment::Instance()->GetShaderLib()->GetTechnique("UnderWater"); mTex_Wave = VideoBufferManager::Instance()->Load2DTexture("Water\\PerlinNormalHeight.dds", "Water\\PerlinNormalHeight.dds"); mTex_Fresnel = VideoBufferManager::Instance()->Load2DTexture("Water\\Fresnel.bmp", "Water\\Fresnel.bmp"); mTex_Normal0 = mTex_Wave;//VideoBufferManager::Instance()->Load2DTexture("Water\\WaterNormal1.tga", "Water\\WaterNormal1.tga"); mTex_Normal1 = mTex_Wave;//VideoBufferManager::Instance()->Load2DTexture("Water\\WaterNormal2.tga", "Water\\WaterNormal2.tga"); d_assert (mTech != NULL && mTex_Normal0 != NULL && mTech_UnderWater != NULL); _initRT(); }
SmallArena::Block* SmallArena::_claimBlock(size_t rounded_size, Block** free_head) { Block* free_block = *free_head; if (free_block) { removeFromLLAndNull(free_block); return free_block; } return _allocBlock(rounded_size, NULL); }