Decouple 'AtmosphereParameters' from SystemBody, thus from graphics* and terrain*
parent
771e4dab58
commit
d3acb0497a
|
@ -6,7 +6,7 @@
|
|||
|
||||
#include "Camera.h"
|
||||
#include "vector3.h"
|
||||
#include "galaxy/SystemBody.h"
|
||||
#include "galaxy/AtmosphereParameters.h"
|
||||
#include "graphics/Drawables.h"
|
||||
#include "terrain/Terrain.h"
|
||||
|
||||
|
@ -39,7 +39,7 @@ public:
|
|||
virtual double GetMaxFeatureHeight() const = 0;
|
||||
|
||||
struct MaterialParameters {
|
||||
SystemBody::AtmosphereParameters atmosphere;
|
||||
AtmosphereParameters atmosphere;
|
||||
std::vector<Camera::Shadow> shadows;
|
||||
Sint32 patchDepth;
|
||||
Sint32 maxPatchDepth;
|
||||
|
|
|
@ -8,6 +8,7 @@
|
|||
#include "GameConfig.h"
|
||||
#include "Pi.h"
|
||||
#include "RefCounted.h"
|
||||
#include "galaxy/AtmosphereParameters.h"
|
||||
#include "graphics/Frustum.h"
|
||||
#include "graphics/Graphics.h"
|
||||
#include "graphics/Material.h"
|
||||
|
@ -752,7 +753,7 @@ void GasGiant::SetUpMaterials()
|
|||
surfDesc.effect = Graphics::EFFECT_GASSPHERE_TERRAIN;
|
||||
|
||||
//planetoid with atmosphere
|
||||
const SystemBody::AtmosphereParameters ap(GetSystemBody()->CalcAtmosphereParams());
|
||||
const AtmosphereParameters ap(GetSystemBody()->CalcAtmosphereParams());
|
||||
surfDesc.lighting = true;
|
||||
assert(ap.atmosDensity > 0.0);
|
||||
{
|
||||
|
|
|
@ -10,6 +10,7 @@
|
|||
#include "Pi.h"
|
||||
#include "RefCounted.h"
|
||||
#include "Sphere.h"
|
||||
#include "galaxy/SystemBody.h"
|
||||
#include "graphics/Frustum.h"
|
||||
#include "graphics/Graphics.h"
|
||||
#include "graphics/Material.h"
|
||||
|
|
|
@ -19,7 +19,7 @@ namespace Graphics {
|
|||
class Renderer;
|
||||
class Frustum;
|
||||
}
|
||||
class SystemBody;
|
||||
|
||||
class GeoPatchContext;
|
||||
class GeoSphere;
|
||||
class BasePatchJob;
|
||||
|
|
|
@ -10,6 +10,7 @@
|
|||
#include "Pi.h"
|
||||
#include "RefCounted.h"
|
||||
#include "galaxy/StarSystem.h"
|
||||
#include "galaxy/AtmosphereParameters.h"
|
||||
#include "graphics/Frustum.h"
|
||||
#include "graphics/Graphics.h"
|
||||
#include "graphics/Material.h"
|
||||
|
@ -496,7 +497,7 @@ void GeoSphere::SetUpMaterials()
|
|||
surfDesc.effect = Graphics::EFFECT_GEOSPHERE_STAR;
|
||||
} else {
|
||||
//planetoid with or without atmosphere
|
||||
const SystemBody::AtmosphereParameters ap(GetSystemBody()->CalcAtmosphereParams());
|
||||
const AtmosphereParameters ap(GetSystemBody()->CalcAtmosphereParams());
|
||||
surfDesc.lighting = true;
|
||||
if (ap.atmosDensity > 0.0) {
|
||||
surfDesc.quality |= Graphics::HAS_ATMOSPHERE;
|
||||
|
|
|
@ -2,8 +2,10 @@
|
|||
// Licensed under the terms of the GPL v3. See licenses/GPL-3.txt
|
||||
|
||||
#include "Planet.h"
|
||||
|
||||
#include "Color.h"
|
||||
#include "GeoSphere.h"
|
||||
#include "galaxy/SystemBody.h"
|
||||
#include "graphics/Graphics.h"
|
||||
#include "graphics/Material.h"
|
||||
#include "graphics/RenderState.h"
|
||||
|
|
|
@ -9,6 +9,7 @@
|
|||
#include "GeoSphere.h"
|
||||
#include "Json.h"
|
||||
#include "Space.h"
|
||||
#include "galaxy/SystemBody.h"
|
||||
#include "graphics/Graphics.h"
|
||||
#include "graphics/Renderer.h"
|
||||
|
||||
|
|
|
@ -0,0 +1,13 @@
|
|||
#ifndef ATMOSPHEREPARAMETERS_H_INCLUDED
|
||||
#define ATMOSPHEREPARAMETERS_H_INCLUDED
|
||||
|
||||
struct AtmosphereParameters {
|
||||
float atmosRadius;
|
||||
float atmosInvScaleHeight;
|
||||
float atmosDensity;
|
||||
float planetRadius;
|
||||
Color atmosCol;
|
||||
vector3d center;
|
||||
};
|
||||
|
||||
#endif // ATMOSPHEREPARAMETERS_H_INCLUDED
|
|
@ -3,6 +3,7 @@
|
|||
|
||||
#include "StarSystemGenerator.h"
|
||||
|
||||
#include "AtmosphereParameters.h"
|
||||
#include "Factions.h"
|
||||
#include "Galaxy.h"
|
||||
#include "Json.h"
|
||||
|
|
|
@ -5,6 +5,7 @@
|
|||
|
||||
#include "Lang.h"
|
||||
#include "EnumStrings.h"
|
||||
#include "AtmosphereParameters.h"
|
||||
#include "enum_table.h"
|
||||
#include "utils.h"
|
||||
|
||||
|
@ -51,7 +52,7 @@ bool SystemBody::IsScoopable() const
|
|||
}
|
||||
|
||||
// Calculate parameters used in the atmospheric model for shaders
|
||||
SystemBody::AtmosphereParameters SystemBody::CalcAtmosphereParams() const
|
||||
AtmosphereParameters SystemBody::CalcAtmosphereParams() const
|
||||
{
|
||||
PROFILE_SCOPED()
|
||||
AtmosphereParameters params;
|
||||
|
|
|
@ -14,6 +14,8 @@
|
|||
|
||||
class StarSystem;
|
||||
|
||||
struct AtmosphereParameters;
|
||||
|
||||
class SystemBody : public RefCounted {
|
||||
public:
|
||||
SystemBody(const SystemPath &path, StarSystem *system);
|
||||
|
@ -192,15 +194,6 @@ public:
|
|||
*outDensity = m_atmosDensity;
|
||||
}
|
||||
|
||||
struct AtmosphereParameters {
|
||||
float atmosRadius;
|
||||
float atmosInvScaleHeight;
|
||||
float atmosDensity;
|
||||
float planetRadius;
|
||||
Color atmosCol;
|
||||
vector3d center;
|
||||
};
|
||||
|
||||
AtmosphereParameters CalcAtmosphereParams() const;
|
||||
|
||||
bool IsScoopable() const;
|
||||
|
|
|
@ -8,6 +8,7 @@
|
|||
#include "StringF.h"
|
||||
#include "graphics/Graphics.h"
|
||||
#include <sstream>
|
||||
#include "galaxy/AtmosphereParameters.h"
|
||||
|
||||
namespace Graphics {
|
||||
namespace OGL {
|
||||
|
@ -88,7 +89,7 @@ namespace Graphics {
|
|||
|
||||
GasGiantProgram *p = static_cast<GasGiantProgram *>(m_program);
|
||||
const GeoSphere::MaterialParameters params = *static_cast<GeoSphere::MaterialParameters *>(this->specialParameter0);
|
||||
const SystemBody::AtmosphereParameters ap = params.atmosphere;
|
||||
const AtmosphereParameters ap = params.atmosphere;
|
||||
|
||||
p->emission.Set(this->emissive);
|
||||
p->sceneAmbient.Set(m_renderer->GetAmbientColor());
|
||||
|
|
|
@ -9,7 +9,6 @@
|
|||
#include "MaterialGL.h"
|
||||
#include "OpenGLLibs.h"
|
||||
#include "Program.h"
|
||||
#include "galaxy/StarSystem.h"
|
||||
|
||||
namespace Graphics {
|
||||
namespace OGL {
|
||||
|
|
|
@ -2,6 +2,7 @@
|
|||
// Licensed under the terms of the GPL v3. See licenses/GPL-3.txt
|
||||
|
||||
#include "GeoSphereMaterial.h"
|
||||
|
||||
#include "Camera.h"
|
||||
#include "GeoSphere.h"
|
||||
#include "RendererGL.h"
|
||||
|
@ -104,7 +105,7 @@ namespace Graphics {
|
|||
|
||||
GeoSphereProgram *p = static_cast<GeoSphereProgram *>(m_program);
|
||||
const GeoSphere::MaterialParameters params = *static_cast<GeoSphere::MaterialParameters *>(this->specialParameter0);
|
||||
const SystemBody::AtmosphereParameters ap = params.atmosphere;
|
||||
const AtmosphereParameters ap = params.atmosphere;
|
||||
|
||||
p->emission.Set(this->emissive);
|
||||
p->sceneAmbient.Set(m_renderer->GetAmbientColor());
|
||||
|
|
|
@ -9,7 +9,6 @@
|
|||
#include "MaterialGL.h"
|
||||
#include "OpenGLLibs.h"
|
||||
#include "Program.h"
|
||||
#include "galaxy/StarSystem.h"
|
||||
|
||||
namespace Graphics {
|
||||
namespace OGL {
|
||||
|
|
Loading…
Reference in New Issue