Skip to content

Commit

Permalink
Fixed errors on drawing bhkPackedNiTriStripsShape
Browse files Browse the repository at this point in the history
  • Loading branch information
fo76utils committed Feb 13, 2025
1 parent cea52d4 commit 7b0af63
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,10 @@
* Implemented experimental glTF export and import for Skyrim: Special Edition, Fallout 4 and Fallout 76. See [README\_GLTF.md](https://github.com/fo76utils/nifskope/blob/develop/README_GLTF.md) for details, and known limitations and issues.
* Updating bounds has been implemented for skinned BSTriShape meshes, and 'Update All Bounds' is now applicable to Skyrim Special Edition NIFs.
* The viewport is now enabled by default on opening a new window, and not only after loading a NIF. This allows models imported to a new window to be visible, but may increase startup time, because resources need to be initialized for the default game (the default NIF version can be configured in the general settings).
* Implemented triangle selection on triangle strips, shift-clicking selects the last point of the triangle.
* Added keyboard controls for setting the light direction: F, L, T, Up, Down, Left and Right control the light source instead of the camera if Shift is held down.
* Fixed incorrect sorting of link rows.
* Fixed errors on drawing bhkPackedNiTriStripsShape.
* Fixed the light direction being reset on changes to the render settings.
* Fixed loading Fallout 76 and Starfield cube maps with legacy DDS header.
* Minor optimizations: faster cube map filtering, and use of SIMD data types in 'noavx' GCC and Clang builds.
Expand Down
7 changes: 6 additions & 1 deletion src/gl/glnode.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -838,7 +838,12 @@ void Node::drawHvkShape( const NifModel * nif, const QModelIndex & iShape, HvkSh
&& ( iTriangles = nif->getIndex( iData, "Triangles" ) ).isValid() && nif->rowCount( iTriangles ) >= 1 ) {

QVector<Vector3> verts = nif->getArray<Vector3>( iVerts );
QVector<Triangle> triangles = nif->getArray<Triangle>( iTriangles );
QVector<Triangle> triangles( nif->rowCount( iTriangles ) );
for ( int i = 0; i < triangles.size(); i++ ) {
// assume that "Triangle" item is in row 0 of "TriangleData"
if ( auto iTriangle = nif->getIndex( nif->getIndex( iTriangles, i ), 0 ); iTriangle.isValid() )
triangles[i] = nif->get<Triangle>( iTriangle );
}

scene->drawTriangles( verts.constData(), size_t( verts.size() ), nullptr, false, GL_TRIANGLES,
size_t( triangles.size() ) * 3, GL_UNSIGNED_SHORT, triangles.constData() );
Expand Down

0 comments on commit 7b0af63

Please sign in to comment.