1 #ifndef VTESTBED_GRAPHICS_SHIPHULLOBJECT_HH 2 #define VTESTBED_GRAPHICS_SHIPHULLOBJECT_HH 4 #include <Magnum/GL/Buffer.h> 5 #include <Magnum/GL/Mesh.h> 6 #include <Magnum/Shaders/Phong.h> 8 #include <vtestbed/core/types.hh> 9 #include <vtestbed/core/testbed.hh> 10 #include <vtestbed/geometry/polyhedron.hh> 11 #include <vtestbed/graphics/IndexBuffer.hh> 12 #include <vtestbed/graphics/ShipShader.hh> 13 #include <vtestbed/graphics/VertexBuffer.hh> 14 #include <vtestbed/graphics/types.hh> 24 using vec3 = vtb::core::Vector3<T>;
39 inline explicit Spherlet(Vector3 p, Vector3 c): position(p), color(c) {}
40 inline explicit Spherlet(vec3 p, vec3 c): position0(p), color0(c) {}
41 inline Spherlet(
const Spherlet& rhs): position(rhs.position), color(rhs.color) {}
42 inline Spherlet() =
default;
47 Magnum::GL::Mesh _mesh{Magnum::GL::MeshPrimitive::Triangles};
50 Magnum::Shaders::Phong _phongShader;
57 Vector3 _ambientColor{0.2f, 0.2f, 0.2f};
58 Vector3 _diffuseColor{0.184, 0.513, 0.8};
59 Vector3 _specularColor{0.517333f, 0.142002f, 0.0818566f};
60 Float _shininess{80.0f};
62 bool _transparency =
true;
69 void draw(
const Matrix4& m, Camera3D& camera)
override;
78 setColor(
const vec3& color) {
79 this->_diffuseColor[0] = color(0);
80 this->_diffuseColor[1] = color(1);
81 this->_diffuseColor[2] = color(2);
90 transparency(
bool b) {
91 this->_transparency = b;
96 _centres.emplace_back(Vector3{0.0f, 0.0f, 0.0f}, Color3{0.0f, 0.0f, 0.0f});
100 setCenter(Vector3& pos,
int num) {
101 _centres[num].position = pos;
105 setColor(Color3& color,
int num) {
106 _centres[num].color = color;
111 return this->_diffuseColor;
120 #endif // vim:filetype=cpp