Merge branch 'master' of https://git.j3d1.de/KKK/KlassischeKeplerKriege
This commit is contained in:
commit
1046fc644f
4 changed files with 38 additions and 27 deletions
|
@ -49,8 +49,8 @@ namespace developer {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::cout<<"[developer console] adding developer "
|
//std::cout<<"[developer console] adding developer "
|
||||||
"callback for token '" << token << "'" << std::endl;
|
// "callback for token '" << token << "'" << std::endl;
|
||||||
|
|
||||||
m_callbacks[token] = cb;
|
m_callbacks[token] = cb;
|
||||||
|
|
||||||
|
|
|
@ -78,11 +78,11 @@ namespace endofthejedi {
|
||||||
NULL, NULL, NULL);
|
NULL, NULL, NULL);
|
||||||
|
|
||||||
|
|
||||||
if (color_type == PNG_COLOR_TYPE_RGB) {
|
//if (color_type == PNG_COLOR_TYPE_RGB) {
|
||||||
puts("PNG_COLOR_TYPE_RGB");
|
// puts("PNG_COLOR_TYPE_RGB");
|
||||||
} else if (color_type == PNG_COLOR_TYPE_RGBA) {
|
//} else if (color_type == PNG_COLOR_TYPE_RGBA) {
|
||||||
puts("PNG_COLOR_TYPE_RGBA");
|
// puts("PNG_COLOR_TYPE_RGBA");
|
||||||
}
|
//}
|
||||||
|
|
||||||
//update width and height based on png info
|
//update width and height based on png info
|
||||||
|
|
||||||
|
@ -95,11 +95,11 @@ namespace endofthejedi {
|
||||||
|
|
||||||
m_size = glm::vec2();
|
m_size = glm::vec2();
|
||||||
|
|
||||||
puts("#########################################");
|
//puts("#########################################");
|
||||||
printf("# PNG: width=%d, height=%d\n", twidth, theight);
|
//printf("# PNG: width=%d, height=%d\n", twidth, theight);
|
||||||
printf("# powers of two: w=%d, h=%d\n", pot_width, pot_height);
|
//printf("# powers of two: w=%d, h=%d\n", pot_width, pot_height);
|
||||||
printf("# uv scale two: x=%f, y=%f\n", m_uvScale.x, m_uvScale.y);
|
//printf("# uv scale two: x=%f, y=%f\n", m_uvScale.x, m_uvScale.y);
|
||||||
puts("#########################################");
|
//puts("#########################################");
|
||||||
|
|
||||||
// Update the png info struct.
|
// Update the png info struct.
|
||||||
png_read_update_info(png_ptr, info_ptr);
|
png_read_update_info(png_ptr, info_ptr);
|
||||||
|
|
|
@ -38,7 +38,8 @@ void RendererPolygon3d::setup() {
|
||||||
addModel("../data/mesh/ship_ufo.stl", &m_shipModel);
|
addModel("../data/mesh/ship_ufo.stl", &m_shipModel);
|
||||||
|
|
||||||
m_texture = nullptr;
|
m_texture = nullptr;
|
||||||
m_backgroundTexturePath = "../data/img/background_3.png";
|
//m_backgroundTexturePath = "../data/img/background_3.png";
|
||||||
|
m_backgroundTexturePath = "../data/img/stars_nebular.png";
|
||||||
loadBackgroundTexture();
|
loadBackgroundTexture();
|
||||||
|
|
||||||
m_postprocess_shader.init();
|
m_postprocess_shader.init();
|
||||||
|
@ -86,15 +87,15 @@ void RendererPolygon3d::loadBackgroundTexture() {
|
||||||
glActiveTexture(GL_TEXTURE0);
|
glActiveTexture(GL_TEXTURE0);
|
||||||
m_texture->loadPng();
|
m_texture->loadPng();
|
||||||
|
|
||||||
std::cout << "texture loading: " << m_texture->valid() << std::endl;
|
//std::cout << "texture loading: " << m_texture->valid() << std::endl;
|
||||||
if (!m_texture->valid()) {
|
if (!m_texture->valid()) {
|
||||||
std::cout << "loading failed!";
|
std::cout << "loading failed!";
|
||||||
return;
|
return;
|
||||||
// exit(-1);
|
// exit(-1);
|
||||||
}
|
}
|
||||||
|
|
||||||
glm::vec2 s = m_texture->size();
|
//glm::vec2 s = m_texture->size();
|
||||||
std::cout << "texture size is " << s.x << " X " << s.y << std::endl;
|
//std::cout << "texture size is " << s.x << " X " << s.y << std::endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
void RendererPolygon3d::renderBackgroundImage() {
|
void RendererPolygon3d::renderBackgroundImage() {
|
||||||
|
@ -252,6 +253,9 @@ void RendererPolygon3d::addExplosionEffect(size_t id,
|
||||||
const glm::vec2 &missileVelocity,
|
const glm::vec2 &missileVelocity,
|
||||||
bool isPlanetHit, size_t n,
|
bool isPlanetHit, size_t n,
|
||||||
float duration) {
|
float duration) {
|
||||||
|
|
||||||
|
(void) missileVelocity;
|
||||||
|
|
||||||
// float particleRadius = 0.005;
|
// float particleRadius = 0.005;
|
||||||
// float particleRadius = 0.003;
|
// float particleRadius = 0.003;
|
||||||
float particleRadius = 0.02;
|
float particleRadius = 0.02;
|
||||||
|
@ -560,18 +564,8 @@ void RendererPolygon3d::renderShips() {
|
||||||
|
|
||||||
void RendererPolygon3d::addModel(const std::string &filename,
|
void RendererPolygon3d::addModel(const std::string &filename,
|
||||||
PolygonModel **dest) {
|
PolygonModel **dest) {
|
||||||
|
|
||||||
// std::cout<<"adding a model: " << filename << std::endl;
|
// std::cout<<"adding a model: " << filename << std::endl;
|
||||||
|
|
||||||
*dest = new PolygonModel(filename);
|
|
||||||
if (!(*dest)->import()) {
|
|
||||||
std::cout << "error: failed to load needed model!!!" << std::endl
|
|
||||||
<< std::endl;
|
|
||||||
exit(-1);
|
|
||||||
}
|
|
||||||
|
|
||||||
(*dest)->setup(&m_shader_game_objects);
|
|
||||||
(*dest)->uploadToOpenGl();
|
|
||||||
|
|
||||||
*dest = new PolygonModel(filename);
|
*dest = new PolygonModel(filename);
|
||||||
if (!(*dest)->import()) {
|
if (!(*dest)->import()) {
|
||||||
std::cout << "error: failed to load needed model!!!" << std::endl
|
std::cout << "error: failed to load needed model!!!" << std::endl
|
||||||
|
|
|
@ -166,9 +166,16 @@ namespace game {
|
||||||
for (Missile *missile : player->missiles) {
|
for (Missile *missile : player->missiles) {
|
||||||
player->missiles.remove(missile);
|
player->missiles.remove(missile);
|
||||||
missile->player = nullptr;
|
missile->player = nullptr;
|
||||||
|
m_nextEvents.push_back(new MissileEvent(LifeCycle::Destroy, missile));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (player->ship != nullptr) {
|
||||||
|
ships.remove(player->ship);
|
||||||
|
m_nextEvents.push_back(new ShipEvent(LifeCycle::Destroy, player->ship));
|
||||||
|
}
|
||||||
|
|
||||||
players.remove(player);
|
players.remove(player);
|
||||||
|
delete(player);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -535,6 +542,16 @@ namespace game {
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case EventType::Ship:
|
||||||
|
{
|
||||||
|
auto *se = static_cast<ShipEvent*>(evt);
|
||||||
|
//std::cout<<"got missile delete event, finally deleting missile #"
|
||||||
|
// << me->object()->id << std::endl;
|
||||||
|
|
||||||
|
delete(se->object());
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
case EventType::Missile:
|
case EventType::Missile:
|
||||||
{
|
{
|
||||||
auto *me = static_cast<MissileEvent*>(evt);
|
auto *me = static_cast<MissileEvent*>(evt);
|
||||||
|
|
Loading…
Reference in a new issue