예제 #1
0
      //разбор вершинного формата
    void ParseVertexFormatChannel (Parser::Iterator channel_iter, VertexFormat& vertex_format)
    {
      static const char* METHOD_NAME = "media::geometry::XmlMeshLibraryLoader::ParseVertexFormatChannel";

      const char *name            = get<const char*> (*channel_iter, "name", ""),
                 *semantic_string = *name ? get<const char*> (*channel_iter, "semantic", "custom") : get<const char*> (*channel_iter, "semantic"),
                 *type_string     = get<const char*> (*channel_iter, "type");

      VertexAttributeSemantic semantic         = get_vertex_attribute_semantic (semantic_string);
      VertexAttributeType     type             = get_vertex_attribute_type (type_string);
      unsigned int            offset           = get<unsigned int> (*channel_iter, "offset");

      if (semantic == VertexAttributeSemantic_Num)
        throw xtl::make_argument_exception (METHOD_NAME, "semantic", semantic_string);

      if (type == VertexAttributeType_Num)
        throw xtl::make_argument_exception (METHOD_NAME, "type", type_string);

      vertex_format.AddAttribute (name, semantic, type, offset);
    }