{"id":63,"date":"2011-02-27T19:00:32","date_gmt":"2011-02-27T10:00:32","guid":{"rendered":"http:\/\/chitora.com\/blog\/?p=63"},"modified":"2011-03-09T23:26:25","modified_gmt":"2011-03-09T14:26:25","slug":"collada","status":"publish","type":"post","link":"https:\/\/www.chitora.com\/blog\/?p=63","title":{"rendered":"XSD\u3067COLLADA"},"content":{"rendered":"<p>COLLADA\u306e\u3068\u3063\u304b\u308a\u306f\u3053\u3061\u3089\u3002<a href=\"http:\/\/codezine.jp\/article\/detail\/843\" target=\"_blank\">COLLADA DOM\u3092\u4f7f\u3063\u305f3D\u30e2\u30c7\u30eb\u30c7\u30fc\u30bf\u306e\u8aad\u307f\u8fbc\u307f<\/a>\u3002<\/p>\n<p>XSD\u306f\u3053\u3061\u3089\u3002<a href=\"http:\/\/www.codesynthesis.com\/products\/xsd\/\" target=\"_blank\">CodeSynthesis XSD<\/a><\/p>\n<p>\u304a\u304a\u307e\u304b\u306a\u6d41\u308c\u3068\u3057\u3066\u306f\uff0c<\/p>\n<ul>\n<li>XSD\u3092Visual Studio\u306b<a href=\"http:\/\/wiki.codesynthesis.com\/Using_XSD_with_Microsoft_Visual_Studio\" target=\"_blank\">\u5c0e\u5165\u3059\u308b<\/a>\u3002<\/li>\n<li><a href=\"http:\/\/www.khronos.org\/files\/collada_schema_1_4\" target=\"_blank\">COLLADA 1.4.1 Schema (includes OpenGL ES Profile)<\/a>\u3092\u30ed\u30fc\u30ab\u30eb\u306b\u4fdd\u5b58\u3059\u308b\u3002<\/li>\n<li>\u4fdd\u5b58\u3057\u305fSchema\u3092\u30bd\u30ea\u30e5\u30fc\u30b7\u30e7\u30f3\u306b\u8ffd\u52a0\u3057\u3066\uff0cXSD\u3067C++\u30d1\u30fc\u30b5\u306b\u30b3\u30f3\u30d1\u30a4\u30eb\u3059\u308b\u3002<\/li>\n<li>\u30b3\u30f3\u30d1\u30a4\u30eb\u30aa\u30d7\u30b7\u30e7\u30f3\u306f<a href=\"http:\/\/wiki.codesynthesis.com\/Schemas\/COLLADA\" target=\"_blank\">\u3053\u3061\u3089<\/a>\u306b\u3042\u308b\u3088\u3046\u306b&#8211;parts 3\u7b49\u3067\u5206\u5272\u6307\u5b9a\u304c\u5fc5\u9808\u3002<\/li>\n<li>\u30b3\u30f3\u30d1\u30a4\u30eb\u3057\u305fC++\u30d1\u30fc\u30b5\u3092\u30bd\u30ea\u30e5\u30fc\u30b7\u30e7\u30f3\u306b\u8ffd\u52a0\u3059\u308b\u3002<\/li>\n<li>COLLADA\u306e\u8aad\u307f\u8fbc\u307f\u90e8\u5206\u3092\u4f5c\u6210\u3059\u308b\u3002\uff11\u884c\u3067\u8aad\u307f\u8fbc\u3081\u308b\u304c\u521d\u3081\u304b\u3089<a href=\"http:\/\/wiki.codesynthesis.com\/Tree\/FAQ#How_can_I_speed_up_parsing.3F\" target=\"_blank\">\u9ad8\u901f\u5316<\/a>\u306b\u5bfe\u5fdc\u3057\u305f\u65b9\u304c\u3088\u3044\u3002<\/li>\n<li>OpenGL\u306e\u8868\u793a\u51e6\u7406\u3092\u4f5c\u6210\u3059\u308b\u3002\u30d1\u30fc\u30b9\u7d50\u679c\u306e\u5229\u7528\u65b9\u6cd5\uff08triangle\u306e\u307f\u63cf\u753b\uff09\u306f\u4e0b\u8a18\u3002<\/li>\n<\/ul>\n<pre>\r\nusing namespace COLLADASchema;\r\nconst COLLADA::library_geometries_sequence&amp; g = bhc-&gt;m_dae_preview-&gt;library_geometries();\r\nfor (COLLADA::library_geometries_const_iterator i = g.begin(); i != g.end(); i++) {\r\n  const library_geometries::geometry_sequence&amp; h = (*i).geometry();\r\n  for (library_geometries::geometry_const_iterator j = h.begin(); j != h.end(); j++) {\r\n    const mesh::triangles_sequence&amp; t = (*j).mesh()-&gt;triangles();\r\n    for (mesh::triangles_const_iterator k = t.begin(); k != t.end(); k++) {\r\n      unsigned int numberOfInputs = (*k).input().size();\r\n      unsigned int numberOfTriangles = (*k).p()-&gt;size() \/ numberOfInputs;\r\n      unsigned int offset = 0;\r\n      int texoffset = -255;\r\n      int noroffset = -255;\r\n      for (triangles::input_const_iterator l = (*k).input().begin(); l != (*k).input().end(); l++) {\r\n        if ((*l).semantic() == \"VERTEX\")\r\n          offset = (*l).offset();\r\n        if ((*l).semantic() == \"TEXCOORD\")\r\n          texoffset = (*l).offset();\r\n        if ((*l).semantic() == \"NORMAL\")\r\n          noroffset = (*l).offset();\r\n      }\r\n      for (int ii = 0; ii &lt; numberOfTriangles; ii++) {\r\n        int index = (*k).p()-&gt;at(ii * numberOfInputs + offset);\r\n        if (noroffset == -255) {\r\n          glNormal3f(\r\n            (*j).mesh()-&gt;source().at(1).float_array()-&gt;at(index * 3),\r\n            (*j).mesh()-&gt;source().at(1).float_array()-&gt;at(index * 3 + 1),\r\n            (*j).mesh()-&gt;source().at(1).float_array()-&gt;at(index * 3 + 2)\r\n          );\r\n        } else {\r\n          int norindex = (*k).p()-&gt;at(ii * numberOfInputs + noroffset);\r\n          glNormal3f(\r\n            (*j).mesh()-&gt;source().at(1).float_array()-&gt;at(norindex * 3),\r\n            (*j).mesh()-&gt;source().at(1).float_array()-&gt;at(norindex * 3 + 1),\r\n            (*j).mesh()-&gt;source().at(1).float_array()-&gt;at(norindex * 3 + 2)\r\n          );\r\n        }\r\n        if (texoffset != -255) {\r\n          int texindex = (*k).p()-&gt;at(ii * numberOfInputs + texoffset);\r\n          glTexCoord2f(\r\n            (*j).mesh()-&gt;source().at(2).float_array()-&gt;at(texindex * 2),\r\n            (*j).mesh()-&gt;source().at(2).float_array()-&gt;at(texindex * 2 + 1)\r\n          );\r\n        }\r\n        glVertex3f(\r\n          (*j).mesh()-&gt;source().at(0).float_array()-&gt;at(index * 3),\r\n          (*j).mesh()-&gt;source().at(0).float_array()-&gt;at(index * 3 + 1),\r\n          (*j).mesh()-&gt;source().at(0).float_array()-&gt;at(index * 3 + 2)\r\n        );\r\n      }\r\n    }\r\n  }\r\n}\r\n<\/pre>\n<p>m_dae_preview\u306f\uff0c<\/p>\n<pre>std::auto_ptr&lt;COLLADASchema::COLLADA&gt;\u00a0\u00a0 m_dae_preview;\r\n<\/pre>\n<p>\u3068\u3044\u3046\u30c7\u30fc\u30bf\u30e1\u30f3\u30d0\u3067\uff0cCOLLADA\u3092\u30ed\u30fc\u30c9\u3057\u305f\u7d50\u679c\u3092\u4fdd\u6301\u3057\u3066\u3044\u308b\u3002<\/p>\n<p>COLLADA DOM\u3088\u308a\u5c11\u3057\u901f\u5ea6\u304c\u9045\u3044\u3057\uff0c\u5206\u304b\u308a\u3084\u3059\u3055\u3082\u306a\u3044\u306e\u3067\uff0cCOLLADA\u3092\u30d1\u30fc\u30b9\u3057\u3066\u307f\u305f\u3044\u4eba\u306f\u7d20\u76f4\u306bCOLLADA DOM\u3092\u4f7f\u3063\u305f\u65b9\u304c\u3088\u3044\u304b\u3082\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>COLLADA\u306e\u3068\u3063\u304b\u308a\u306f\u3053\u3061\u3089\u3002COLLADA DOM\u3092\u4f7f\u3063\u305f3D\u30e2\u30c7\u30eb\u30c7\u30fc\u30bf\u306e\u8aad\u307f\u8fbc\u307f\u3002 XSD\u306f\u3053\u3061\u3089\u3002CodeSynthesis XSD \u304a\u304a\u307e\u304b\u306a\u6d41\u308c\u3068\u3057\u3066\u306f\uff0c XSD\u3092Visual Studio\u306b\u5c0e\u5165\u3059\u308b\u3002  [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_monsterinsights_skip_tracking":false,"_monsterinsights_sitenote_active":false,"_monsterinsights_sitenote_note":"","_monsterinsights_sitenote_category":0,"footnotes":""},"categories":[4],"tags":[],"class_list":["post-63","post","type-post","status-publish","format-standard","hentry","category-bh"],"_links":{"self":[{"href":"https:\/\/www.chitora.com\/blog\/index.php?rest_route=\/wp\/v2\/posts\/63","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.chitora.com\/blog\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.chitora.com\/blog\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.chitora.com\/blog\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.chitora.com\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=63"}],"version-history":[{"count":13,"href":"https:\/\/www.chitora.com\/blog\/index.php?rest_route=\/wp\/v2\/posts\/63\/revisions"}],"predecessor-version":[{"id":76,"href":"https:\/\/www.chitora.com\/blog\/index.php?rest_route=\/wp\/v2\/posts\/63\/revisions\/76"}],"wp:attachment":[{"href":"https:\/\/www.chitora.com\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=63"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.chitora.com\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=63"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.chitora.com\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=63"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}