diff --git a/resources/radar/wormHole.png b/resources/radar/wormHole.png new file mode 100644 index 0000000000..689be192ce Binary files /dev/null and b/resources/radar/wormHole.png differ diff --git a/resources/wormHole1.png b/resources/wormHole1.png deleted file mode 100644 index 5b8a1a0447..0000000000 Binary files a/resources/wormHole1.png and /dev/null differ diff --git a/resources/wormHole2.png b/resources/wormHole2.png deleted file mode 100644 index 61d4ac8f64..0000000000 Binary files a/resources/wormHole2.png and /dev/null differ diff --git a/resources/wormHole3.png b/resources/wormHole3.png deleted file mode 100644 index 15e01b3e06..0000000000 Binary files a/resources/wormHole3.png and /dev/null differ diff --git a/resources/wormHole3d.png b/resources/wormHole3d.png new file mode 100644 index 0000000000..eec32d80be Binary files /dev/null and b/resources/wormHole3d.png differ diff --git a/src/spaceObjects/wormHole.cpp b/src/spaceObjects/wormHole.cpp index e2d1fd8042..c4c19c5ddd 100644 --- a/src/spaceObjects/wormHole.cpp +++ b/src/spaceObjects/wormHole.cpp @@ -54,61 +54,43 @@ WormHole::WormHole() pathPlanner->addAvoidObject(this, (DEFAULT_COLLISION_RADIUS * AVOIDANCE_MULTIPLIER) ); setRadarSignatureInfo(0.9, 0.0, 0.0); - - // Choose a texture to show on radar - radar_visual = irandom(1, 3); - registerMemberReplication(&radar_visual); - - // Create some overlaying clouds - for(int n=0; n quad{ + static std::array quad{ glm::vec3{}, {0.f, 1.f}, glm::vec3{}, {1.f, 1.f}, glm::vec3{}, {1.f, 0.f}, glm::vec3{}, {0.f, 0.f} }; + textureManager.getTexture("wormHole3d.png")->bind(); + ShaderRegistry::ScopedShader shader(ShaderRegistry::Shaders::Billboard); + + auto model_matrix = getModelMatrix(); + auto modeldata_matrix = glm::rotate(model_matrix, glm::radians(120.f), {1.f, 0.f, 0.f}); + + glUniformMatrix4fv(shader.get().uniform(ShaderRegistry::Uniforms::Model), 1, GL_FALSE, glm::value_ptr(modeldata_matrix)); + glUniform4f(shader.get().uniform(ShaderRegistry::Uniforms::Color), 1.f, 1.f, 1.f, 5000.f); gl::ScopedVertexAttribArray positions(shader.get().attribute(ShaderRegistry::Attributes::Position)); gl::ScopedVertexAttribArray texcoords(shader.get().attribute(ShaderRegistry::Attributes::Texcoords)); - for(int n=0; nbind(); - glUniform4f(shader.get().uniform(ShaderRegistry::Uniforms::Color), alpha * 0.8f, alpha * 0.8f, alpha * 0.8f, size); - auto model_matrix = glm::translate(getModelMatrix(), {cloud.offset.x, cloud.offset.y, 0}); - glUniformMatrix4fv(shader.get().uniform(ShaderRegistry::Uniforms::Model), 1, GL_FALSE, glm::value_ptr(model_matrix)); + glVertexAttribPointer(positions.get(), 3, GL_FLOAT, GL_FALSE, sizeof(VertexAndTexCoords), (GLvoid*)quad.data()); + glVertexAttribPointer(texcoords.get(), 2, GL_FLOAT, GL_FALSE, sizeof(VertexAndTexCoords), (GLvoid*)((char*)quad.data() + sizeof(glm::vec3))); - glVertexAttribPointer(positions.get(), 3, GL_FLOAT, GL_FALSE, sizeof(VertexAndTexCoords), (GLvoid*)quad.data()); - glVertexAttribPointer(texcoords.get(), 2, GL_FLOAT, GL_FALSE, sizeof(VertexAndTexCoords), (GLvoid*)((char*)quad.data() + sizeof(glm::vec3))); - std::initializer_list indices = { 0, 2, 1, 0, 3, 2 }; - glDrawElements(GL_TRIANGLES, 6, GL_UNSIGNED_SHORT, std::begin(indices)); - } + std::initializer_list indices = { 0, 2, 1, 0, 3, 2 }; + glDrawElements(GL_TRIANGLES, 6, GL_UNSIGNED_SHORT, std::begin(indices)); + glBlendFunc(GL_ONE, GL_ONE); } void WormHole::drawOnRadar(sp::RenderTarget& renderer, glm::vec2 position, float scale, float rotation, bool long_range) { - renderer.drawRotatedSpriteBlendAdd("wormHole" + string(radar_visual) + ".png", position, getRadius() * scale * 3.0f, getRotation() - rotation); + renderer.drawRotatedSpriteBlendAdd("radar/wormHole.png", position, getRadius() * scale * 3.0f, getRotation() - rotation); } // Draw a line toward the target position @@ -179,8 +161,3 @@ void WormHole::onTeleportation(ScriptSimpleCallback callback) { this->on_teleportation = callback; } - -glm::mat4 WormHole::getModelMatrix() const -{ - return glm::identity(); -} diff --git a/src/spaceObjects/wormHole.h b/src/spaceObjects/wormHole.h index 8a316c01eb..0b350ee1e2 100644 --- a/src/spaceObjects/wormHole.h +++ b/src/spaceObjects/wormHole.h @@ -12,10 +12,6 @@ class WormHole : public SpaceObject, public Updatable float update_delta = 0.0f; P pathPlanner; - int radar_visual; - static const int cloud_count = 5; - NebulaCloud clouds[cloud_count]; - ScriptSimpleCallback on_teleportation; public: @@ -33,9 +29,6 @@ class WormHole : public SpaceObject, public Updatable void onTeleportation(ScriptSimpleCallback callback); virtual string getExportLine() override { return "WormHole():setPosition(" + string(getPosition().x, 0) + ", " + string(getPosition().y, 0) + "):setTargetPosition(" + string(target_position.x, 0) + ", " + string(target_position.y, 0) + ")"; } - -protected: - glm::mat4 getModelMatrix() const override; }; #endif//WORM_HOLE_H