docstr: Construct a simple mesh and save it to a glb file in TexturesVertex mode.
docstr_tok: ["Construct","a","simple","mesh","and","save","it","to","a","glb","file","in","TexturesVertex","mode","."]
code: def test_save_toy(self):
      """
      Construct a simple mesh and save it to a glb file in TexturesVertex mode.
      """
  
      example = {}
      example["POSITION"] = torch.tensor(
          [
              [
                  [0.0, 0.0, 0.0],
                  [-1.0, 0.0, 0.0],
                  [-1.0, 0.0, 1.0],
                  [0.0, 0.0, 1.0],
                  [0.0, 1.0, 0.0],
                  [-1.0, 1.0, 0.0],
                  [-1.0, 1.0, 1.0],
                  [0.0, 1.0, 1.0],
              ]
          ]
      )
      example["indices"] = torch.tensor(
          [
              [
                  [1, 4, 2],
                  [4, 3, 2],
                  [3, 7, 2],
                  [7, 6, 2],
                  [3, 4, 7],
                  [4, 8, 7],
                  [8, 5, 7],
                  [5, 6, 7],
                  [5, 2, 6],
                  [5, 1, 2],
                  [1, 5, 4],
                  [5, 8, 4],
              ]
          ]
      )
      example["indices"] -= 1
      example["COLOR_0"] = torch.tensor(
          [
              [
                  [1.0, 0.0, 0.0],
                  [1.0, 0.0, 0.0],
                  [1.0, 0.0, 0.0],
                  [1.0, 0.0, 0.0],
                  [1.0, 0.0, 0.0],
                  [1.0, 0.0, 0.0],
                  [1.0, 0.0, 0.0],
                  [1.0, 0.0, 0.0],
              ]
          ]
      )
      # example['prop'] = {'material':
      #                       {'pbrMetallicRoughness':
      #                           {'baseColorFactor':
      #                                torch.tensor([[0.7, 0.7, 1, 0.5]]),
      #                            'metallicFactor': torch.tensor([1]),
      #                            'roughnessFactor': torch.tensor([0.1])},
      #                    'alphaMode': 'BLEND',
      #                    'doubleSided': True}}
  
      texture = TexturesVertex(example["COLOR_0"])
      mesh = Meshes(
          verts=example["POSITION"],
          faces=example["indices"],
          textures=texture,
      )
  
      glb = DATA_DIR / "example_write_texturesvertex.glb"
      _write(mesh, glb)
  
imports: import os.path
  import unittest
  from math import radians
  import numpy
  import torch
  from PIL import Image
  from pytorch3d.io import IO
  from pytorch3d.io.experimental_gltf_io import _read_header, MeshGlbFormat
  from pytorch3d.renderer import AmbientLights, BlendParams, FoVPerspectiveCameras, look_at_view_transform, PointLights, RasterizationSettings, rotate_on_spot
  from pytorch3d.renderer.mesh import HardPhongShader, MeshRasterizer, MeshRenderer, TexturesVertex
  from pytorch3d.structures import Meshes
  from pytorch3d.transforms import axis_angle_to_matrix
  from pytorch3d.utils import ico_sphere
  from pytorch3d.vis.texture_vis import texturesuv_image_PIL
  from .common_testing import get_pytorch3d_dir, get_tests_dir, TestCaseMixin
label_desc: Use image node_id 7 for calling the TestMeshGltfIO obj's underlying member method code with example usage: obj.test_save_toy() without return types