KlassischeKeplerKriege/game/renderer_polygon_3d/renderer_polygon_3d.hpp
2016-09-28 21:26:11 +02:00

60 lines
1.7 KiB
C++

#include "renderer.hpp"
#include "glclasses.hpp"
#include "game.hpp"
#include "state/trace.hpp"
#include "state/object.hpp"
#include "state/missile.hpp"
#include "state/player.hpp"
#include "state/planet.hpp"
#include "state/ship.hpp"
#include "state/explosion.hpp"
#include "particle_batch.hpp"
#include "polygon_model.hpp"
#include <glm/gtc/matrix_transform.hpp>
namespace endofthejedi {
class RendererPolygon3d : public Renderer {
public:
void setup();
void render(const game::State *state) override;
private:
void renderPlanets();
void renderMissiles();
void renderShips();
void renderParticles();
void addModel(const std::string &filename, PolygonModel **dest);
// shortcuts which use the lower versions
glm::mat4 computeModelMatrix(const game::Planet *planet);
glm::mat4 computeModelMatrix(const game::Missile *missile);
glm::mat4 computeModelMatrix(const game::Ship *ship);
// do the actual computation with these values
glm::mat4 computeModelMatrix(const glm::vec2 &pos, float scale, float angle=0.0);
private:
// all models are also here (for easy reloading etc.)
std::vector<PolygonModel*> m_models;
// and with a specific variable name here
PolygonModel *m_missileModel;
PolygonModel *m_planetModel;
PolygonModel *m_shipModel;
// for rendering everything
Shader m_shader;
// for accessing
const game::State *m_state;
ParticleBatch *m_particles;
};
}