This commit is contained in:
end 2016-10-02 11:26:28 +02:00
commit c3b84633f9
3 changed files with 5157 additions and 4 deletions

18
data/mesh/rocket.scad Normal file
View file

@ -0,0 +1,18 @@
$fn = 16;
translate([0, 0, -0.2]) {
cylinder(r=0.05, h=0.4);
translate([0, 0, 0.25]) cylinder(r=0.065, h=0.1);
translate([0, 0, 0.35]) sphere(r=0.07);
translate([0, 0, 0.35]) cylinder(r=0.01, h=0.2);
for (h=[0.07, 0.2]) {
translate([0, 0, h]) {
for (i=[0,1,2,3]) {
rotate([0, 0, 90*i]) {
cube([0.2, 0.01, 0.07], center=true);
}
}
}
}
}

5126
data/mesh/rocket.stl Normal file

File diff suppressed because it is too large Load diff

View file

@ -28,7 +28,8 @@ namespace endofthejedi {
m_shader.loadFile(fss_game_objects, GL_FRAGMENT_SHADER); m_shader.loadFile(fss_game_objects, GL_FRAGMENT_SHADER);
#endif #endif
addModel("../data/mesh/small_atomic_bomb.stl", &m_missileModel); //addModel("../data/mesh/small_atomic_bomb.stl", &m_missileModel);
addModel("../data/mesh/rocket.stl", &m_missileModel);
addModel("../data/mesh/planet_12.stl", &m_planetModel); addModel("../data/mesh/planet_12.stl", &m_planetModel);
addModel("../data/mesh/ship_ufo.stl", &m_shipModel); addModel("../data/mesh/ship_ufo.stl", &m_shipModel);
} }
@ -236,9 +237,17 @@ namespace endofthejedi {
glm::vec2 vn = glm::normalize(missile->velocity); glm::vec2 vn = glm::normalize(missile->velocity);
float a = std::atan2(vn.y, vn.x); float a = std::atan2(vn.y, vn.x);
glm::mat4 mat = computeModelMatrix(missile->position, 0.1f, a);
// TODO: which visual size has the rocket? in game its just a point with // TODO: which visual size has the rocket? in game its just a point with
// no size because all others have size. // no size because all others have size.
return computeModelMatrix(missile->position, 0.03f, a); //for atomic bomb
//return computeModelMatrix(missile->position, 0.03f, a);
// flipped too
mat = glm::rotate(mat, (float) M_PI/2.0f, glm::vec3(0.0f, 1.0f, 0.0f));
return mat;
} }
glm::mat4 RendererPolygon3d::computeModelMatrix(const game::Ship *ship) glm::mat4 RendererPolygon3d::computeModelMatrix(const game::Ship *ship)