* some fixes
This commit is contained in:
parent
d2d8039589
commit
959202e111
3 changed files with 36 additions and 5 deletions
|
@ -29,12 +29,41 @@ void endofthejedi::Renderer::render(const game::State *state) {
|
|||
std::vector<GLfloat> reflections;
|
||||
|
||||
for (const game::Planet *planet : state->planets) {
|
||||
positions.push_back(glm::vec3(planet->position, -10.0f));
|
||||
positions.push_back(glm::vec3(planet->position, -5.0f));
|
||||
radii.push_back(planet->radius);
|
||||
colors.push_back(glm::vec4(1.0f, 0.0f, 0.0f, 0.5f));
|
||||
}
|
||||
|
||||
glUniform1f(m_shader.location("aspectratio"), 16.0f/9.0f);
|
||||
for (const game::Ship *ship : state->ships) {
|
||||
positions.push_back(glm::vec3(ship->position, -3.0f));
|
||||
radii.push_back(ship->radius);
|
||||
colors.push_back(glm::vec4(1.0f, 0.0f, 0.0f, 0.5f));
|
||||
}
|
||||
|
||||
for (const game::Player *player : state->players) {
|
||||
for (const game::Missile *missile : player->missiles) {
|
||||
positions.push_back(glm::vec3(missile->position, -3.0f));
|
||||
radii.push_back(0.01f);
|
||||
colors.push_back(glm::vec4(1.0f, 0.0f, 0.0f, 0.5f));
|
||||
}
|
||||
}
|
||||
|
||||
for (auto& pos : positions) {
|
||||
pos.x *= 5;
|
||||
pos.y *= 5;
|
||||
}
|
||||
for (auto& rad : radii) {
|
||||
rad *= 5;
|
||||
}
|
||||
|
||||
/*
|
||||
for (const game::Trace *trace : state->traces) {
|
||||
positions.push_back(glm::vec3(trace->position, -3.0f));
|
||||
radii.push_back(trace->radius);
|
||||
colors.push_back(glm::vec4(0.0f, 1.0f, 0.0f, 0.5f));
|
||||
}*/
|
||||
|
||||
glUniform1f(m_shader.location("aspectratio"), 1.0f);
|
||||
glUniform1i(m_shader.location("reflections"), 1);
|
||||
glUniform3f(m_shader.location("l_position"), 0.6f, 0.1f, 0.0f);
|
||||
glUniform1f(m_shader.location("l_radius"), 1.0f);
|
||||
|
|
|
@ -8,6 +8,10 @@
|
|||
#include "glclasses.hpp"
|
||||
#include "game.hpp"
|
||||
#include "state/planet.hpp"
|
||||
#include "state/trace.hpp"
|
||||
#include "state/player.hpp"
|
||||
#include "state/ship.hpp"
|
||||
#include "state/missile.hpp"
|
||||
|
||||
namespace endofthejedi {
|
||||
|
||||
|
|
|
@ -45,9 +45,7 @@ namespace game {
|
|||
}
|
||||
} while(glm::length(pos) < 0.2 && tries++ < 1000);
|
||||
|
||||
pos.x *= 10;
|
||||
pos.y *= 10;
|
||||
planets.push_back(new Planet(pos, (0.03 + 0.07*util::randf_0_1()) * 10));
|
||||
planets.push_back(new Planet(pos, 0.03 + 0.07*util::randf_0_1()));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue