|
|
@@ -20,6 +20,10 @@ namespace engine {
|
|
|
return make_vector(json[0].asFloat(), json[1].asFloat());
|
|
|
}
|
|
|
|
|
|
+ math::vec2 to_vec2(Json::Value const & json, math::vec2 const & backup) {
|
|
|
+ return json.isNull() ? backup : to_vec2(json);
|
|
|
+ }
|
|
|
+
|
|
|
flyweight<graphics::shader_program> to_program(Json::Value const & json) {
|
|
|
return graphics::shader_program::create(json["fragmentShader"].asString(),
|
|
|
json["vertexShader"].asString());
|
|
|
@@ -33,7 +37,7 @@ namespace engine {
|
|
|
|
|
|
graphics::object to_object(Json::Value const & json) {
|
|
|
flyweight<graphics::material> mat = to_material(json["material"]);
|
|
|
- auto frame_size = to_vec2(json["frameSize"]);
|
|
|
+ auto frame_size = to_vec2(json["frameSize"], make_vector(1.f, 1.f));
|
|
|
math::dim2::rectangle pos = {to_vec2(json["position"]),
|
|
|
mat.actual().size() * frame_size};
|
|
|
return {pos, pos, mat, {{{0, 0}}, frame_size}};
|