Even more cleanup

This commit is contained in:
Emma Broman
2020-09-18 10:23:47 +02:00
parent 614c523c69
commit fe4bb00108
4 changed files with 8 additions and 27 deletions
@@ -115,13 +115,6 @@ RenderableOrbitDisc::RenderableOrbitDisc(const ghoul::Dictionary& dictionary)
, _size(SizeInfo, 1.f, 0.f, 3.0e12f)
, _eccentricity(EccentricityInfo, 0.f, 0.f, 1.f)
, _offset(OffsetInfo, glm::vec2(0.f, 1.f), glm::vec2(0.f), glm::vec2(1.f))
, _shader(nullptr)
, _texture(nullptr)
, _textureFile(nullptr)
, _textureIsDirty(false)
, _quad(0)
, _vertexPositionBuffer(0)
, _planeIsDirty(false)
{
using ghoul::filesystem::File;
@@ -145,7 +138,7 @@ RenderableOrbitDisc::RenderableOrbitDisc(const ghoul::Dictionary& dictionary)
_texturePath = absPath(dictionary.value<std::string>(TextureInfo.identifier));
_textureFile = std::make_unique<File>(_texturePath);
_texturePath.onChange([&]() { loadTexture(); });
_texturePath.onChange([&]() { _textureIsDirty = true; });
addProperty(_texturePath);
_textureFile->setCallback([&](const File&) { _textureIsDirty = true; });
@@ -65,16 +65,16 @@ private:
properties::FloatProperty _eccentricity;
properties::Vec2Property _offset;
std::unique_ptr<ghoul::opengl::ProgramObject> _shader;
std::unique_ptr<ghoul::opengl::ProgramObject> _shader = nullptr;
UniformCache(modelViewProjection, textureOffset, opacity,
texture, eccentricity, semiMajorAxis) _uniformCache;
std::unique_ptr<ghoul::opengl::Texture> _texture;
std::unique_ptr<ghoul::opengl::Texture> _texture = nullptr;
std::unique_ptr<ghoul::filesystem::File> _textureFile;
bool _textureIsDirty;
bool _planeIsDirty;
GLuint _quad;
GLuint _vertexPositionBuffer;
bool _textureIsDirty = false;
bool _planeIsDirty = false;
GLuint _quad = 0;
GLuint _vertexPositionBuffer = 0;
};
} // namespace openspace
@@ -107,18 +107,6 @@ Fragment getFragment() {
vec4 diffuse = texture(discTexture, textureCoord);
diffuse.a *= opacity;
// The normal for the one plane depends on whether we are dealing
// with a front facing or back facing fragment
vec3 normal;
// The plane is oriented on the xz plane
// WARNING: This might not be the case for Uranus
if (gl_FrontFacing) {
normal = vec3(-1.0, 0.0, 0.0);
}
else {
normal = vec3(1.0, 0.0, 0.0);
}
Fragment frag;
frag.color = diffuse;
frag.depth = vs_position.w;
+1 -1
View File
@@ -37,7 +37,7 @@ uniform mat4 modelViewProjectionTransform;
void main() {
vs_st = in_st;
vs_position = z_normalization(
modelViewProjectionTransform * vec4(in_position.xy, 0.0, 1.0)
modelViewProjectionTransform * vec4(in_position, 0.0, 1.0)
);
gl_Position = vs_position;