X-Git-Url: https://git.dogcows.com/gitweb?p=chaz%2Fyoink;a=blobdiff_plain;f=src%2Fmoof%2Fmesh_bindings.cc;h=290b42aef012ab09a8e221a7756bfd700c5d2a7f;hp=02138add2249c6c3ecae12a085ea9bf96b97f5e4;hb=HEAD;hpb=6f1b787a10d8ab1a3117a4b8c004dd2d90599608 diff --git a/src/moof/mesh_bindings.cc b/src/moof/mesh_bindings.cc index 02138ad..290b42a 100644 --- a/src/moof/mesh_bindings.cc +++ b/src/moof/mesh_bindings.cc @@ -1,13 +1,11 @@ -/*] Copyright (c) 2009-2010, Charles McGarvey [************************** +/*] Copyright (c) 2009-2011, Charles McGarvey [***************************** **] All rights reserved. * -* vi:ts=4 sw=4 tw=75 -* * Distributable under the terms and conditions of the 2-clause BSD license; * see the file COPYING for a complete text of the license. * -**************************************************************************/ +*****************************************************************************/ #include "log.hh" #include "mesh.hh" @@ -33,12 +31,14 @@ static int mesh_new(script& script) static int mesh_draw(script& script) { - mesh_handle* mesh; + mesh_handle mesh; script[1].require_object("mesh").get(mesh); scalar alpha; - if (script[2].get(alpha)) (*mesh)->draw(alpha); - else (*mesh)->draw(); + if (script[2].get(alpha)) + mesh->draw(alpha); + else + mesh->draw(); return 0; } @@ -70,17 +70,19 @@ static int object_draw(script& script) mesh::object_ptr* object; script[1].require_object("mesh object").get(object); - scalar alpha; - bool recurse; - if (script[2].get(alpha)) - { - if (script[3].get(recurse)) (*object)->draw(alpha, recurse); - else (*object)->draw(alpha); + scalar alpha; + bool recurse; + if (script[2].get(alpha)) { + if (script[3].get(recurse)) + (*object)->draw(alpha, recurse); + else + (*object)->draw(alpha); } - else - { - if (script[2].get(recurse)) (*object)->draw(SCALAR(0.0), recurse); - else (*object)->draw(); + else { + if (script[2].get(recurse)) + (*object)->draw(SCALAR(0.0), recurse); + else + (*object)->draw(); } return 0; @@ -91,21 +93,18 @@ static int object_index(script& script) mesh::object_ptr* object; script[1].require_object("mesh object").get(object); - if (script[2].is_number()) - { + if (script[2].is_number()) { unsigned index; script[2].get(index); --index; script.push((*object)->kids[index]); } - else if (script[2].is_string()) - { + else if (script[2].is_string()) { std::string name; script[2].get(name); script.push((*object)->kids_byname[name]); } - else - { + else { script[2].raise_type_error("index or name"); } return 1;