1

数据:

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。它们的格式为 a Vec3,因此它包含 8 Vec3。这对于立方体来说似乎是正确的。索引计数为 36,每个面有两个三角形,6 个面有 2 * 3 * 6 = 36。所以索引似乎也是正确的。

但是为什么纹理坐标的计数是 24?UV 的格式为 a Vec2,这意味着有 12 个Vec2。紫外线的计数不应该是 16 吗?

指数也有一个范围0 to 23。这对我来说也没有多大意义,它不应该只是从0 to 7吗?

4

1 回答 1

1

错误是我假设count参数表示单个组件的数量而不是完整的组件类型。

例如,盒子有 24 个位置顶点,而不仅仅是 8 个。

于 2017-05-07T20:58:30.707 回答