数据:
pos Accessor { buffer_view: "bufferView_30", byte_offset: 0, byte_stride: 12, component_type: F32, count: 24, kind: Vec3, max: Some([0.5, 0.5, 0.5]), min: Some([-0.5, -0.5, -0.5]), name: None }
pos BufferView { buffer: "BoxTextured", byte_offset: 72, byte_length: 768, target: Some(ArrayBuffer), name: None }
pos Buffer { uri: "BoxTextured.bin", byte_length: 840, kind: Some("arraybuffer"), name: None }
。
normal Accessor { buffer_view: "bufferView_30", byte_offset: 288, byte_stride: 12, component_type: F32, count: 24, kind: Vec3, max: Some([1, 1, 1]), min: Some([-1, -1, -1]), name: None }
normal BufferView { buffer: "BoxTextured", byte_offset: 72, byte_length: 768, target: Some(ArrayBuffer), name: None }
normal Buffer { uri: "BoxTextured.bin", byte_length: 840, kind: Some("arraybuffer"), name: None }
。
uv Accessor { buffer_view: "bufferView_30", byte_offset: 576, byte_stride: 8, component_type: F32, count: 24, kind: Vec2, max: Some([6, 1]), min: Some([0, 0]), name: None }
uv BufferView { buffer: "BoxTextured", byte_offset: 72, byte_length: 768, target: Some(ArrayBuffer), name: None }
uv Buffer { uri: "BoxTextured.bin", byte_length: 840, kind: Some("arraybuffer"), name: None }
。
ind Accessor { buffer_view: "bufferView_29", byte_offset: 0, byte_stride: 0, component_type: U16, count: 36, kind: Scalar, max: None, min: None, name: None }
ind BufferView { buffer: "BoxTextured", byte_offset: 0, byte_length: 72, target: Some(ElementArrayBuffer), name: None }
ind Buffer { uri: "BoxTextured.bin", byte_length: 840, kind: Some("arraybuffer"), name: None }
。
indices [0, 1, 2, 3, 2, 1, 4, 5, 6, 7, 6, 5, 8, 9, 10, 11, 10, 9, 12, 13, 14, 15, 14, 13, 16, 17, 18, 19, 18, 17, 20, 21, 22, 23, 22, 21]
我正在尝试加载以下示例模型。
Position
和Normal
的计数为24。它们具有Vec3
的格式,因此它包含8 Vec3
s。对于立方体来说,这似乎是正确的。指数计数为36,每个面部有两个三角形,有6个面的面部为2 * 3 * 6 = 36。
但是为什么纹理坐标的数量为24?紫外线具有Vec2
的格式,这意味着有12 Vec2
s。紫外线不应该有16个吗?
这些索引也具有0 to 23
的范围。对我来说,这也没有多大意义,不应该仅来自0 to 7
吗?
错误是我假设count
参数指示单个组件的计数,而不是完整的组件类型。
例如,该框具有24个位置顶点,而不仅仅是8个。