Removed Atmosphere stuff from RenderablePlanet.

This commit is contained in:
Jonathas Costa
2016-10-29 13:43:13 -04:00
parent ded3cb20ee
commit 2ca0bfd798
2 changed files with 12 additions and 1607 deletions

File diff suppressed because it is too large Load Diff

View File

@@ -66,38 +66,6 @@ public:
bool isShadowing;
};
// See: Precomputed Atmospheric Scattering from Bruneton et al.
// for explanation of the following parameters.
const unsigned int TRANSMITTANCE_TABLE_WIDTH = 256;
const unsigned int TRANSMITTANCE_TABLE_HEIGHT = 64;
const unsigned int IRRADIANCE_TABLE_WIDTH = 64;
const unsigned int IRRADIANCE_TABLE_HEIGHT = 16;
const unsigned int DELTA_E_TABLE_WIDTH = 64;
const unsigned int DELTA_E_TABLE_HEIGHT = 16;
/*const unsigned int TRANSMITTANCE_TABLE_WIDTH = 512;
const unsigned int TRANSMITTANCE_TABLE_HEIGHT = 128;
const unsigned int IRRADIANCE_TABLE_WIDTH = 128;
const unsigned int IRRADIANCE_TABLE_HEIGHT = 32;
const unsigned int DELTA_E_TABLE_WIDTH = 128;
const unsigned int DELTA_E_TABLE_HEIGHT = 32;*/
const unsigned int R_SAMPLES = 32;
const unsigned int MU_SAMPLES = 128;
const unsigned int MU_S_SAMPLES = 32;
const unsigned int NU_SAMPLES = 8;
/*const unsigned int R_SAMPLES = 64;
const unsigned int MU_SAMPLES = 256;
const unsigned int MU_S_SAMPLES = 64;
const unsigned int NU_SAMPLES = 16;*/
public:
explicit RenderablePlanet(const ghoul::Dictionary& dictionary);
~RenderablePlanet();
@@ -111,71 +79,17 @@ public:
protected:
void loadTexture();
private:
void loadComputationPrograms();
void unloadComputationPrograms();
void createComputationTextures();
void deleteComputationTextures();
void deleteUnusedComputationTextures();
void loadAtmosphereDataIntoShaderProgram(std::unique_ptr<ghoul::opengl::ProgramObject> & shaderProg);
void executeCalculations(const GLuint vao, const GLenum drawBuffers[2], const GLsizei vertexSize);
void preCalculateAtmosphereParam();
void createAtmosphereFBO();
void createRenderQuad(GLuint * vao, GLuint * vbo, const GLfloat size);
void renderQuadForCalc(const GLuint vao, const GLsizei size);
void step3DTexture(std::unique_ptr<ghoul::opengl::ProgramObject> & shaderProg,
const int layer, const bool doCalc = true);
void saveTextureToPPMFile(const GLenum color_buffer_attachment, const std::string & fileName,
const int width, const int height) const;
private:
properties::StringProperty _colorTexturePath;
properties::StringProperty _nightTexturePath;
properties::StringProperty _heightMapTexturePath;
properties::StringProperty _cloudsTexturePath;
properties::StringProperty _reflectanceTexturePath;
std::unique_ptr<ghoul::opengl::ProgramObject> _programObject;
std::unique_ptr<ghoul::opengl::ProgramObject> _transmittanceProgramObject;
std::unique_ptr<ghoul::opengl::ProgramObject> _irradianceProgramObject;
std::unique_ptr<ghoul::opengl::ProgramObject> _irradianceSupTermsProgramObject;
std::unique_ptr<ghoul::opengl::ProgramObject> _inScatteringProgramObject;
std::unique_ptr<ghoul::opengl::ProgramObject> _inScatteringSupTermsProgramObject;
std::unique_ptr<ghoul::opengl::ProgramObject> _deltaEProgramObject;
std::unique_ptr<ghoul::opengl::ProgramObject> _deltaSProgramObject;
std::unique_ptr<ghoul::opengl::ProgramObject> _deltaSSupTermsProgramObject;
std::unique_ptr<ghoul::opengl::ProgramObject> _deltaJProgramObject;
std::unique_ptr<ghoul::opengl::ProgramObject> _atmosphereProgramObject;
ghoul::opengl::TextureUnit _dummyTextureUnit;
ghoul::opengl::TextureUnit _dummy3DTextureUnit;
ghoul::opengl::TextureUnit _transmittanceTableTextureUnit;
ghoul::opengl::TextureUnit _irradianceTableTextureUnit;
ghoul::opengl::TextureUnit _inScatteringTableTextureUnit;
ghoul::opengl::TextureUnit _deltaETableTextureUnit;
ghoul::opengl::TextureUnit _deltaSRayleighTableTextureUnit;
ghoul::opengl::TextureUnit _deltaSMieTableTextureUnit;
ghoul::opengl::TextureUnit _deltaJTableTextureUnit;
ghoul::opengl::TextureUnit _atmosphereTextureUnit;
std::unique_ptr<ghoul::opengl::Texture> _texture;
std::unique_ptr<ghoul::opengl::Texture> _nightTexture;
std::unique_ptr<ghoul::opengl::Texture> _reflectanceTexture;
std::unique_ptr<ghoul::opengl::Texture> _nightTexture;
std::unique_ptr<ghoul::opengl::Texture> _heightMapTexture;
std::unique_ptr<ghoul::opengl::Texture> _cloudsTexture;
GLuint _transmittanceTableTexture;
GLuint _irradianceTableTexture;
GLuint _inScatteringTableTexture;
GLuint _deltaETableTexture;
GLuint _deltaSRayleighTableTexture;
GLuint _deltaSMieTableTexture;
GLuint _deltaJTableTexture;
GLuint _dummyTexture;
GLuint _dummy3DTexture;
GLuint _atmosphereTexture;
GLuint _atmosphereFBO;
GLuint _atmosphereRenderVAO;
GLuint _atmosphereRenderVBO;
properties::FloatProperty _heightExaggeration;
planetgeometry::PlanetGeometry* _geometry;
@@ -189,31 +103,12 @@ private:
std::string _frame;
std::string _target;
bool _hasNightTexture;
bool _hasReflectanceTexture;
bool _hasHeightTexture;
bool _hasCloudsTexture;
bool _shadowEnabled;
double _time;
// Atmosphere Data
bool _atmosphereCalculated;
bool _atmosphereEnabled;
float _atmosphereRadius;
float _atmospherePlanetRadius;
float _planetAverageGroundReflectance;
float _rayleighHeightScale;
float _mieHeightScale;
float _miePhaseConstant;
glm::vec3 _mieExtinctionCoeff;
glm::vec3 _rayleighScatteringCoeff;
glm::vec3 _mieScatteringCoeff;
bool tempPic;
unsigned int count;
};
} // namespace openspace