mirror of
https://github.com/ZDoom/gzdoom.git
synced 2024-11-10 14:51:40 +00:00
- avoid passing game structs to common backend code
InitLightmap was using a „FLevelLocals“ pointer, better pass the needed elements separately instead.
This commit is contained in:
parent
af957b438a
commit
45e7badb71
6 changed files with 15 additions and 15 deletions
|
@ -362,9 +362,9 @@ void OpenGLFrameBuffer::BlurScene(float amount)
|
|||
GLRenderer->BlurScene(amount);
|
||||
}
|
||||
|
||||
void OpenGLFrameBuffer::InitLightmap(FLevelLocals *Level)
|
||||
void OpenGLFrameBuffer::InitLightmap(int LMTextureSize, int LMTextureCount, TArray<uint16_t>& LMTextureData)
|
||||
{
|
||||
if (Level->LMTextureData.Size() > 0)
|
||||
if (LMTextureData.Size() > 0)
|
||||
{
|
||||
GLint activeTex = 0;
|
||||
glGetIntegerv(GL_ACTIVE_TEXTURE, &activeTex);
|
||||
|
@ -374,14 +374,14 @@ void OpenGLFrameBuffer::InitLightmap(FLevelLocals *Level)
|
|||
glGenTextures(1, (GLuint*)&GLRenderer->mLightMapID);
|
||||
|
||||
glBindTexture(GL_TEXTURE_2D_ARRAY, GLRenderer->mLightMapID);
|
||||
glTexImage3D(GL_TEXTURE_2D_ARRAY, 0, GL_RGB16F, Level->LMTextureSize, Level->LMTextureSize, Level->LMTextureCount, 0, GL_RGB, GL_HALF_FLOAT, &Level->LMTextureData[0]);
|
||||
glTexImage3D(GL_TEXTURE_2D_ARRAY, 0, GL_RGB16F, LMTextureSize, LMTextureSize, LMTextureCount, 0, GL_RGB, GL_HALF_FLOAT, &LMTextureData[0]);
|
||||
glTexParameteri(GL_TEXTURE_2D_ARRAY, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
|
||||
glTexParameteri(GL_TEXTURE_2D_ARRAY, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
|
||||
glGenerateMipmap(GL_TEXTURE_2D_ARRAY);
|
||||
|
||||
glActiveTexture(activeTex);
|
||||
|
||||
Level->LMTextureData.Reset(); // We no longer need this, release the memory
|
||||
LMTextureData.Reset(); // We no longer need this, release the memory
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -50,7 +50,7 @@ public:
|
|||
IIndexBuffer *CreateIndexBuffer() override;
|
||||
IDataBuffer *CreateDataBuffer(int bindingpoint, bool ssbo, bool needsresize) override;
|
||||
|
||||
void InitLightmap(FLevelLocals* Level) override;
|
||||
void InitLightmap(int LMTextureSize, int LMTextureCount, TArray<uint16_t>& LMTextureData) override;
|
||||
|
||||
// Retrieves a buffer containing image data for a screenshot.
|
||||
// Hint: Pitch can be negative for upside-down images, in which case buffer
|
||||
|
|
|
@ -221,7 +221,7 @@ public:
|
|||
virtual int GetClientHeight() = 0;
|
||||
virtual void BlurScene(float amount) {}
|
||||
|
||||
virtual void InitLightmap(FLevelLocals *Level) {}
|
||||
virtual void InitLightmap(int LMTextureSize, int LMTextureCount, TArray<uint16_t>& LMTextureData) {}
|
||||
|
||||
// Interface to hardware rendering resources
|
||||
virtual IVertexBuffer *CreateVertexBuffer() { return nullptr; }
|
||||
|
|
|
@ -579,13 +579,13 @@ void VulkanFrameBuffer::BeginFrame()
|
|||
}
|
||||
}
|
||||
|
||||
void VulkanFrameBuffer::InitLightmap(FLevelLocals* Level)
|
||||
void VulkanFrameBuffer::InitLightmap(int LMTextureSize, int LMTextureCount, TArray<uint16_t>& LMTextureData)
|
||||
{
|
||||
if (Level->LMTextureData.Size() > 0)
|
||||
if (LMTextureData.Size() > 0)
|
||||
{
|
||||
int w = Level->LMTextureSize;
|
||||
int h = Level->LMTextureSize;
|
||||
int count = Level->LMTextureCount;
|
||||
int w = LMTextureSize;
|
||||
int h = LMTextureSize;
|
||||
int count = LMTextureCount;
|
||||
int pixelsize = 8;
|
||||
auto& lightmap = mActiveRenderBuffers->Lightmap;
|
||||
|
||||
|
@ -620,7 +620,7 @@ void VulkanFrameBuffer::InitLightmap(FLevelLocals* Level)
|
|||
stagingBuffer->SetDebugName("VkHardwareTexture.mStagingBuffer");
|
||||
|
||||
uint16_t one = 0x3c00; // half-float 1.0
|
||||
uint16_t* src = &Level->LMTextureData[0];
|
||||
uint16_t* src = &LMTextureData[0];
|
||||
uint16_t* data = (uint16_t*)stagingBuffer->Map(0, totalSize);
|
||||
for (int i = w * h * count; i > 0; i--)
|
||||
{
|
||||
|
@ -650,7 +650,7 @@ void VulkanFrameBuffer::InitLightmap(FLevelLocals* Level)
|
|||
FrameTextureUpload.Buffers.push_back(std::move(stagingBuffer));
|
||||
FrameTextureUpload.TotalSize += totalSize;
|
||||
|
||||
Level->LMTextureData.Reset(); // We no longer need this, release the memory
|
||||
LMTextureData.Reset(); // We no longer need this, release the memory
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -85,7 +85,7 @@ public:
|
|||
void SetTextureFilterMode() override;
|
||||
void StartPrecaching() override;
|
||||
void BeginFrame() override;
|
||||
void InitLightmap(FLevelLocals* Level) override;
|
||||
void InitLightmap(int LMTextureSize, int LMTextureCount, TArray<uint16_t>& LMTextureData) override;
|
||||
void BlurScene(float amount) override;
|
||||
void PostProcessScene(bool swscene, int fixedcm, float flash, const std::function<void()> &afterBloomDrawEndScene2D) override;
|
||||
void AmbientOccludeScene(float m5) override;
|
||||
|
|
|
@ -3249,7 +3249,7 @@ void MapLoader::LoadLevel(MapData *map, const char *lumpname, int position)
|
|||
Level->ClearDynamic3DFloorData(); // CreateVBO must be run on the plain 3D floor data.
|
||||
CreateVBO(screen->mVertexData, Level->sectors);
|
||||
|
||||
screen->InitLightmap(Level);
|
||||
screen->InitLightmap(Level->LMTextureSize, Level->LMTextureCount, Level->LMTextureData);
|
||||
|
||||
for (auto &sec : Level->sectors)
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue