This commit is contained in:
end 2016-09-29 09:09:19 +02:00
commit 12e0a8ac43
3 changed files with 12887 additions and 4 deletions

26
data/mesh/ship_ufo.scad Normal file
View file

@ -0,0 +1,26 @@
difference() {
//union() {
union() {
// body
scale([1,1,0.5]) sphere(1, $fn=32);
// cockpit
translate([0,0,0.3]) sphere(0.5, $fn=16);
}
// small balls carved out of the body
smallBallsCirle = 1;
offsetHeight = 0.5;
translate([0, -smallBallsCirle, offsetHeight]) {
union() {
numBalls = 8;
translate([0,1,0]) {
for (i=[0:numBalls]) {
rotate(360*i/numBalls) translate([smallBallsCirle,0,0]) {
sphere(0.45, $fn=12);
}
}
}
}
}
}

12854
data/mesh/ship_ufo.stl Normal file

File diff suppressed because it is too large Load diff

View file

@ -16,9 +16,8 @@ namespace endofthejedi {
//m_missileModel = new PolygonModel("../data/mesh/quad_screen_coords.stl"); //m_missileModel = new PolygonModel("../data/mesh/quad_screen_coords.stl");
addModel("../data/mesh/small_atomic_bomb.stl", &m_missileModel); addModel("../data/mesh/small_atomic_bomb.stl", &m_missileModel);
//addModel("../data/mesh/planet_128.stl", &m_planetModel); addModel("../data/mesh/planet_64.stl", &m_planetModel);
addModel("../data/mesh/planet_12.stl", &m_planetModel); addModel("../data/mesh/ship_ufo.stl", &m_shipModel);
addModel("../data/mesh/planet_12.stl", &m_shipModel);
std::string vss_simple = std::string vss_simple =
#include "simple.vert" #include "simple.vert"
@ -210,7 +209,11 @@ namespace endofthejedi {
glm::mat4 RendererPolygon3d::computeModelMatrix(const game::Ship *ship) glm::mat4 RendererPolygon3d::computeModelMatrix(const game::Ship *ship)
{ {
// TODO: rotate them before shooting, that looks better // TODO: rotate them before shooting, that looks better
return computeModelMatrix(ship->position, m_state->shipRadius()); //return computeModelMatrix(ship->position, m_state->shipRadius());
// XXX model is flipped
glm::mat4 mat = computeModelMatrix(ship->position, 0.3);
mat = glm::rotate(mat, (float) M_PI, glm::vec3(0.0f, 1.0f, 0.0f));
return mat;
} }
glm::mat4 RendererPolygon3d::computeModelMatrix(const glm::vec2 &pos, float scale, float angle) glm::mat4 RendererPolygon3d::computeModelMatrix(const glm::vec2 &pos, float scale, float angle)