mirror of
https://github.com/panda3d/panda3d.git
synced 2025-09-27 07:03:36 -04:00
assimp: Support reading tangents and binormals
This commit is contained in:
parent
5a483e3899
commit
162a7b2c34
@ -721,6 +721,10 @@ load_mesh(size_t index) {
|
||||
aformat->add_column(InternalName::get_texcoord_name(out.str()), 3, Geom::NT_stdfloat, Geom::C_texcoord);
|
||||
}
|
||||
}
|
||||
if (mesh.HasTangentsAndBitangents()) {
|
||||
aformat->add_column(InternalName::get_tangent(), 3, Geom::NT_stdfloat, Geom::C_vector);
|
||||
aformat->add_column(InternalName::get_binormal(), 3, Geom::NT_stdfloat, Geom::C_vector);
|
||||
}
|
||||
|
||||
PT(GeomVertexArrayFormat) tb_aformat = new GeomVertexArrayFormat;
|
||||
tb_aformat->add_column(InternalName::make("transform_blend"), 1, Geom::NT_uint16, Geom::C_index);
|
||||
@ -853,6 +857,18 @@ load_mesh(size_t index) {
|
||||
}
|
||||
}
|
||||
|
||||
// Now the tangents and bitangents, if any.
|
||||
if (mesh.HasTangentsAndBitangents()) {
|
||||
GeomVertexWriter tangent (vdata, InternalName::get_tangent());
|
||||
GeomVertexWriter binormal (vdata, InternalName::get_binormal());
|
||||
for (size_t i = 0; i < mesh.mNumVertices; ++i) {
|
||||
const aiVector3D &tvec = mesh.mTangents[i];
|
||||
const aiVector3D &bvec = mesh.mBitangents[i];
|
||||
tangent.add_data3(tvec.x, tvec.y, tvec.z);
|
||||
binormal.add_data3(bvec.x, bvec.y, bvec.z);
|
||||
}
|
||||
}
|
||||
|
||||
// Now the transform blend table
|
||||
if (character) {
|
||||
GeomVertexWriter transform_blend (vdata, InternalName::get_transform_blend());
|
||||
|
Loading…
x
Reference in New Issue
Block a user