#include "shape.h"
#include <msp/geometry/loader.h>
+using namespace std;
+
namespace Msp::Game {
+Shape::Shape(Handle<Entity> e, const Setup &s):
+ Component(e),
+ setup(s)
+{
+ if(!setup.shape)
+ throw invalid_argument("Shape::Shape");
+}
+
ShapeSetup::Loader::Loader(ShapeSetup &s):
ObjectLoader(s)
{
const Setup &setup;
public:
- Shape(Handle<Entity> p, const Setup &s): Component(p), setup(s) { }
+ Shape(Handle<Entity>, const Setup &);
- const Geometry::Shape<float, 3> *get_shape() const { return setup.shape.get(); }
+ const Geometry::Shape<float, 3> &get_shape() const { return *setup.shape; }
const std::string &get_technique_name() const { return setup.technique_name; }
unsigned get_render_detail() const { return setup.render_detail; }
};
{
const GL::Technique &tech = stage.get_resources().get<GL::Technique>(shape->get_technique_name());
re.generated_mesh = Game::Owned<DynamicMeshSource>(re.entity, (GL::VERTEX3, GL::NORMAL3), tech);
- GL::ShapeBuilder(*shape->get_shape(), shape->get_render_detail()).build(re.generated_mesh->get_mesh());
+ GL::ShapeBuilder(shape->get_shape(), shape->get_render_detail()).build(re.generated_mesh->get_mesh());
}
}