mirror of
https://git.mirrors.martin98.com/https://github.com/syoyo/tinygltf.git
synced 2025-09-23 16:53:17 +08:00
Check bufferView.target
This commit is contained in:
parent
d180641246
commit
4402576a91
@ -529,6 +529,12 @@ static void DrawMesh(tinygltf::Model &model, const tinygltf::Mesh &mesh) {
|
|||||||
for (; it != itEnd; it++) {
|
for (; it != itEnd; it++) {
|
||||||
assert(it->second >= 0);
|
assert(it->second >= 0);
|
||||||
const tinygltf::Accessor &accessor = model.accessors[it->second];
|
const tinygltf::Accessor &accessor = model.accessors[it->second];
|
||||||
|
const tinygltf::BufferView &bufferView = model.bufferViews[accessor.bufferView];
|
||||||
|
|
||||||
|
if (bufferView.target == 0) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
glBindBuffer(GL_ARRAY_BUFFER, gBufferState[accessor.bufferView].vb);
|
glBindBuffer(GL_ARRAY_BUFFER, gBufferState[accessor.bufferView].vb);
|
||||||
CheckErrors("bind buffer");
|
CheckErrors("bind buffer");
|
||||||
int size = 1;
|
int size = 1;
|
||||||
@ -668,7 +674,9 @@ static void DrawNode(tinygltf::Model &model, const tinygltf::Node &node) {
|
|||||||
// std::cout << it->first << std::endl;
|
// std::cout << it->first << std::endl;
|
||||||
// FIXME(syoyo): Refactor.
|
// FIXME(syoyo): Refactor.
|
||||||
// DrawCurves(scene, it->second);
|
// DrawCurves(scene, it->second);
|
||||||
DrawMesh(model, model.meshes[node.mesh]);
|
if (node.mesh > -1) {
|
||||||
|
DrawMesh(model, model.meshes[node.mesh]);
|
||||||
|
}
|
||||||
|
|
||||||
// Draw child nodes.
|
// Draw child nodes.
|
||||||
for (size_t i = 0; i < node.children.size(); i++) {
|
for (size_t i = 0; i < node.children.size(); i++) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user