mirror of
https://github.com/ZDoom/ZDRay.git
synced 2024-11-29 15:12:25 +00:00
- simplify outer interface slightly
This commit is contained in:
parent
ce7074f646
commit
2555eec131
5 changed files with 21 additions and 31 deletions
|
@ -320,24 +320,20 @@ struct FLevel
|
||||||
|
|
||||||
TArray<UDMFKey> props;
|
TArray<UDMFKey> props;
|
||||||
|
|
||||||
|
TArray<ThingLight> ThingLights;
|
||||||
|
TArray<SurfaceLightDef> SurfaceLights;
|
||||||
|
|
||||||
void FindMapBounds ();
|
void FindMapBounds ();
|
||||||
void RemoveExtraLines ();
|
void RemoveExtraLines ();
|
||||||
void RemoveExtraSides ();
|
void RemoveExtraSides ();
|
||||||
void RemoveExtraSectors ();
|
void RemoveExtraSectors ();
|
||||||
|
void SetupLights();
|
||||||
|
|
||||||
int NumSides() const { return Sides.Size(); }
|
int NumSides() const { return Sides.Size(); }
|
||||||
int NumLines() const { return Lines.Size(); }
|
int NumLines() const { return Lines.Size(); }
|
||||||
int NumSectors() const { return Sectors.Size(); }
|
int NumSectors() const { return Sectors.Size(); }
|
||||||
int NumThings() const { return Things.Size(); }
|
int NumThings() const { return Things.Size(); }
|
||||||
|
|
||||||
// Dlight helpers
|
|
||||||
|
|
||||||
TArray<ThingLight> ThingLights;
|
|
||||||
TArray<SurfaceLightDef> SurfaceLights;
|
|
||||||
|
|
||||||
void SetupDlight();
|
|
||||||
void CreateLights();
|
|
||||||
|
|
||||||
const Vec3 &GetSunColor() const;
|
const Vec3 &GetSunColor() const;
|
||||||
const Vec3 &GetSunDirection() const;
|
const Vec3 &GetSunDirection() const;
|
||||||
IntSector *GetFrontSector(const IntSideDef *side);
|
IntSector *GetFrontSector(const IntSideDef *side);
|
||||||
|
@ -348,6 +344,7 @@ struct FLevel
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void CheckSkySectors();
|
void CheckSkySectors();
|
||||||
|
void CreateLights();
|
||||||
};
|
};
|
||||||
|
|
||||||
const int BLOCKSIZE = 128;
|
const int BLOCKSIZE = 128;
|
||||||
|
|
|
@ -615,19 +615,8 @@ void FProcessor::BuildNodes()
|
||||||
|
|
||||||
void FProcessor::BuildLightmaps()
|
void FProcessor::BuildLightmaps()
|
||||||
{
|
{
|
||||||
LMBuilder.ambience = 0.0f;
|
Level.SetupLights();
|
||||||
LMBuilder.samples = Samples;
|
LMBuilder.CreateLightmaps(Level, Samples, LMDims);
|
||||||
LMBuilder.textureWidth = LMDims;
|
|
||||||
LMBuilder.textureHeight = LMDims;
|
|
||||||
|
|
||||||
Level.SetupDlight();
|
|
||||||
Level.CreateLights();
|
|
||||||
|
|
||||||
LMBuilder.CreateLightmaps(Level);
|
|
||||||
|
|
||||||
//LMBuilder.WriteTexturesToTGA();
|
|
||||||
//LMBuilder.WriteMeshToOBJ();
|
|
||||||
|
|
||||||
LightmapsBuilt = true;
|
LightmapsBuilt = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -41,7 +41,7 @@
|
||||||
static const Vec3 defaultSunColor(1, 1, 1);
|
static const Vec3 defaultSunColor(1, 1, 1);
|
||||||
static const Vec3 defaultSunDirection(0.45f, 0.3f, 0.9f);
|
static const Vec3 defaultSunDirection(0.45f, 0.3f, 0.9f);
|
||||||
|
|
||||||
void FLevel::SetupDlight()
|
void FLevel::SetupLights()
|
||||||
{
|
{
|
||||||
CheckSkySectors();
|
CheckSkySectors();
|
||||||
|
|
||||||
|
@ -79,6 +79,8 @@ void FLevel::SetupDlight()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
CreateLights();
|
||||||
}
|
}
|
||||||
|
|
||||||
void FLevel::CheckSkySectors()
|
void FLevel::CheckSkySectors()
|
||||||
|
|
|
@ -719,9 +719,13 @@ void LightmapBuilder::CreateSurfaceLights()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void LightmapBuilder::CreateLightmaps(FLevel &doomMap)
|
void LightmapBuilder::CreateLightmaps(FLevel &doomMap, int sampleDistance, int textureSize)
|
||||||
{
|
{
|
||||||
map = &doomMap;
|
map = &doomMap;
|
||||||
|
samples = sampleDistance;
|
||||||
|
textureWidth = textureSize;
|
||||||
|
textureHeight = textureSize;
|
||||||
|
|
||||||
mesh = std::make_unique<LevelMesh>(doomMap);
|
mesh = std::make_unique<LevelMesh>(doomMap);
|
||||||
|
|
||||||
CreateSurfaceLights();
|
CreateSurfaceLights();
|
||||||
|
|
|
@ -61,15 +61,9 @@ public:
|
||||||
LightmapBuilder();
|
LightmapBuilder();
|
||||||
~LightmapBuilder();
|
~LightmapBuilder();
|
||||||
|
|
||||||
void CreateLightmaps(FLevel &doomMap);
|
void CreateLightmaps(FLevel &doomMap, int sampleDistance, int textureSize);
|
||||||
//void WriteTexturesToTGA();
|
|
||||||
void AddLightmapLump(FWadWriter &wadFile);
|
void AddLightmapLump(FWadWriter &wadFile);
|
||||||
|
|
||||||
int samples = 16;
|
|
||||||
float ambience = 0.0f;
|
|
||||||
int textureWidth = 128;
|
|
||||||
int textureHeight = 128;
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void NewTexture();
|
void NewTexture();
|
||||||
bool MakeRoomForBlock(const int width, const int height, int *x, int *y, int *num);
|
bool MakeRoomForBlock(const int width, const int height, int *x, int *y, int *num);
|
||||||
|
@ -87,8 +81,12 @@ private:
|
||||||
|
|
||||||
void CreateSurfaceLights();
|
void CreateSurfaceLights();
|
||||||
|
|
||||||
std::unique_ptr<LevelMesh> mesh;
|
|
||||||
FLevel *map;
|
FLevel *map;
|
||||||
|
int samples = 16;
|
||||||
|
int textureWidth = 128;
|
||||||
|
int textureHeight = 128;
|
||||||
|
|
||||||
|
std::unique_ptr<LevelMesh> mesh;
|
||||||
std::vector<std::unique_ptr<SurfaceLight>> surfaceLights;
|
std::vector<std::unique_ptr<SurfaceLight>> surfaceLights;
|
||||||
std::vector<std::vector<uint16_t>> textures;
|
std::vector<std::vector<uint16_t>> textures;
|
||||||
std::vector<uint16_t> indirectoutput;
|
std::vector<uint16_t> indirectoutput;
|
||||||
|
|
Loading…
Reference in a new issue