Skip to content

Commit

Permalink
Merge pull request #10 from amorilia/release/1.1.2
Browse files Browse the repository at this point in the history
Preparing 1.1.2 release.
  • Loading branch information
mharj committed Oct 28, 2012
2 parents cac7b7a + a2077c5 commit 1ba7221
Show file tree
Hide file tree
Showing 29 changed files with 206 additions and 74 deletions.
15 changes: 13 additions & 2 deletions CHANGELOG.TXT
@@ -1,6 +1,17 @@
== CHANGELOG ==

This is version 1.1.1 of NifSkope.
This is version 1.1.2 of NifSkope.

changes since 1.1.1:
* When combining material properties, keep original material names as much as possible (reported by koniption).
* Fix display of transformed havok shapes (reported by koniption).
* Skyrim material updates (contributed by ttl269).
* Skyrim body part updates.
* Document sane defaults for Skyrim bhkRigidBody "Unknown 7 Shorts" (reported by ttl296).
* Rename: binormals are now more accurately called bitangents.
* Collada export improvements (contributed by mharj).
* Support node culling by regular expression in collada/obj export (contributed by mharj).
* Fix block order of bhkCompressedMeshShapeData (reported by ttl269).

changes since 1.1.0:
* Fix unsigned int enum issue.
Expand All @@ -25,7 +36,7 @@ changes since 1.1.0-RC7:
* Fix: fixed #3525690 NifSkope Crash: MoppBvTree Triangles
* Fix: blocked invalid memory access when "triangles" is empty
* Fix: stopped triangle reordering on .obj import into "FO:NV" "NiTriShape"
* nif.xml: bhkCompressedMeshShape: merged "skyfox", "ttl296" and probably other peoples work
* nif.xml: bhkCompressedMeshShape: merged "skyfox", "ttl269" and probably other peoples work

changes since 1.1.0-RC6:
* Added initial support for "BSLODTriShape" - its being rendered
Expand Down
4 changes: 1 addition & 3 deletions NifSkope.pro
Expand Up @@ -4,7 +4,7 @@ TARGET = NifSkope

QT += xml opengl network

CONFIG += qt debug_and_release thread warn_on
CONFIG += qt debug_and_release debug_and_release_target thread warn_on

CONFIG += fsengine

Expand All @@ -22,8 +22,6 @@ macx{
# uncomment this if you want the text stats gl option
#DEFINES += USE_GL_QPAINTER

# On Windows this builds Release in release/ and Debug in debug/
# On Linux you may need CONFIG += debug_and_release debug_and_release_target
DESTDIR = .

# NIFSKOPE_VERSION macro
Expand Down
2 changes: 1 addition & 1 deletion VERSION
@@ -1 +1 @@
1.1.1
1.1.2
2 changes: 1 addition & 1 deletion docsys
Submodule docsys updated from 6d523e to 52bbd8
46 changes: 23 additions & 23 deletions gl/glmesh.cpp
Expand Up @@ -218,7 +218,7 @@ void Mesh::clear()
colors.clear();
coords.clear();
tangents.clear();
binormals.clear();
bitangents.clear();
triangles.clear();
tristrips.clear();
weights.clear();
Expand All @@ -229,7 +229,7 @@ void Mesh::clear()
transNorms.clear();
transColors.clear();
transTangents.clear();
transBinormals.clear();
transBitangents.clear();

double_sided = false;
}
Expand Down Expand Up @@ -580,7 +580,7 @@ void Mesh::transform()
for (int i = 0; i < colors.count(); i++)
colors[i].setRGBA(colors[i].red(), colors[i].green(), colors[i].blue(), 1);
tangents = nif->getArray<Vector3>( iData, "Tangents" );
binormals = nif->getArray<Vector3>( iData, "Binormals" );
bitangents = nif->getArray<Vector3>( iData, "Bitangents" );

if ( norms.count() < verts.count() ) norms.clear();
if ( colors.count() < verts.count() ) colors.clear();
Expand Down Expand Up @@ -658,12 +658,12 @@ void Mesh::transform()
if ( data.count() == verts.count() * 4 * 3 * 2 )
{
tangents.resize( verts.count() );
binormals.resize( verts.count() );
bitangents.resize( verts.count() );
Vector3 * t = (Vector3 *) data.data();
for ( int c = 0; c < verts.count(); c++ )
tangents[c] = *t++;
for ( int c = 0; c < verts.count(); c++ )
binormals[c] = *t++;
bitangents[c] = *t++;
}
}
}
Expand Down Expand Up @@ -731,8 +731,8 @@ void Mesh::transformShapes()
transNorms.fill( Vector3() );
transTangents.resize( tangents.count() );
transTangents.fill( Vector3() );
transBinormals.resize( binormals.count() );
transBinormals.fill( Vector3() );
transBitangents.resize( bitangents.count() );
transBitangents.fill( Vector3() );

Node * root = findParent( skelRoot );

Expand Down Expand Up @@ -768,8 +768,8 @@ void Mesh::transformShapes()
transNorms[vindex] += trans.rotation * norms[ vindex ] * weight.second;
if ( tangents.count() > vindex )
transTangents[vindex] += trans.rotation * tangents[ vindex ] * weight.second;
if ( binormals.count() > vindex )
transBinormals[vindex] += trans.rotation * binormals[ vindex ] * weight.second;
if ( bitangents.count() > vindex )
transBitangents[vindex] += trans.rotation * bitangents[ vindex ] * weight.second;
}
}
}
Expand All @@ -794,8 +794,8 @@ void Mesh::transformShapes()
transNorms[ vw.vertex ] += natrix * norms[ vw.vertex ] * vw.weight;
if ( transTangents.count() > vw.vertex )
transTangents[ vw.vertex ] += natrix * tangents[ vw.vertex ] * vw.weight;
if ( transBinormals.count() > vw.vertex )
transBinormals[ vw.vertex ] += natrix * binormals[ vw.vertex ] * vw.weight;
if ( transBitangents.count() > vw.vertex )
transBitangents[ vw.vertex ] += natrix * bitangents[ vw.vertex ] * vw.weight;
}
}
}
Expand All @@ -804,8 +804,8 @@ void Mesh::transformShapes()
transNorms[n].normalize();
for ( int t = 0; t < transTangents.count(); t++ )
transTangents[t].normalize();
for ( int t = 0; t < transBinormals.count(); t++ )
transBinormals[t].normalize();
for ( int t = 0; t < transBitangents.count(); t++ )
transBitangents[t].normalize();

bndSphere = BoundSphere( transVerts );
bndSphere.applyInv( viewTrans() );
Expand All @@ -816,7 +816,7 @@ void Mesh::transformShapes()
transVerts = verts;
transNorms = norms;
transTangents = tangents;
transBinormals = binormals;
transBitangents = bitangents;
}

/*
Expand Down Expand Up @@ -1028,7 +1028,7 @@ void Mesh::drawSelection() const
}

if ( n == "Vertices" || n == "Normals" || n == "Vertex Colors"
|| n == "UV Sets" || n == "Tangents" || n == "Binormals" )
|| n == "UV Sets" || n == "Tangents" || n == "Bitangents" )
{
glDepthFunc( GL_LEQUAL );
glNormalColor();
Expand Down Expand Up @@ -1104,12 +1104,12 @@ void Mesh::drawSelection() const

if ( n == "TSpace" )
{
for ( int j = 0; j < transVerts.count() && j < transTangents.count() && j < transBinormals.count(); j++ )
for ( int j = 0; j < transVerts.count() && j < transTangents.count() && j < transBitangents.count(); j++ )
{
glVertex( transVerts.value( j ) );
glVertex( transVerts.value( j ) + transTangents.value( j ) * normalScale );
glVertex( transVerts.value( j ) );
glVertex( transVerts.value( j ) + transBinormals.value( j ) * normalScale );
glVertex( transVerts.value( j ) + transBitangents.value( j ) * normalScale );
}
}

Expand Down Expand Up @@ -1156,7 +1156,7 @@ void Mesh::drawSelection() const
glEnd();
}
}
if ( n == "Binormals" )
if ( n == "Bitangents" )
{
glDepthFunc( GL_LEQUAL );
glNormalColor();
Expand All @@ -1166,12 +1166,12 @@ void Mesh::drawSelection() const
if ( normalScale < 0.1f ) normalScale = 0.1f;

glBegin( GL_LINES );
for ( int j = 0; j < transVerts.count() && j < transBinormals.count(); j++ )
for ( int j = 0; j < transVerts.count() && j < transBitangents.count(); j++ )
{
glVertex( transVerts.value( j ) );
glVertex( transVerts.value( j ) + transBinormals.value( j ) * normalScale * 2 );
glVertex( transVerts.value( j ) + transBitangents.value( j ) * normalScale * 2 );
glVertex( transVerts.value( j ) );
glVertex( transVerts.value( j ) - transBinormals.value( j ) * normalScale / 2 );
glVertex( transVerts.value( j ) - transBitangents.value( j ) * normalScale / 2 );
}
glEnd();

Expand All @@ -1181,9 +1181,9 @@ void Mesh::drawSelection() const
glHighlightColor();
glBegin( GL_LINES );
glVertex( transVerts.value( i ) );
glVertex( transVerts.value( i ) + transBinormals.value( i ) * normalScale * 2);
glVertex( transVerts.value( i ) + transBitangents.value( i ) * normalScale * 2);
glVertex( transVerts.value( i ) );
glVertex( transVerts.value( i ) - transBinormals.value( i ) * normalScale / 2 );
glVertex( transVerts.value( i ) - transBitangents.value( i ) * normalScale / 2 );
glEnd();
}
}
Expand Down
8 changes: 4 additions & 4 deletions gl/glmesh.h
Expand Up @@ -86,8 +86,8 @@ class Mesh : public Node
QVector<Color4> colors;
//! Tangents
QVector<Vector3> tangents;
//! Binormals
QVector<Vector3> binormals;
//! Bitangents
QVector<Vector3> bitangents;

//! UV coordinate sets
QList< QVector<Vector2> > coords;
Expand All @@ -100,8 +100,8 @@ class Mesh : public Node
QVector<Color4> transColors;
//! Transformed tangents
QVector<Vector3> transTangents;
//! Transformed binormals
QVector<Vector3> transBinormals;
//! Transformed bitangents
QVector<Vector3> transBitangents;

int skelRoot;
Transform skelTrans;
Expand Down
7 changes: 6 additions & 1 deletion gl/glnode.cpp
Expand Up @@ -955,7 +955,12 @@ void drawHvkShape( const NifModel * nif, const QModelIndex & iShape, QStack<QMod
{
glPushMatrix();
Matrix4 tm = nif->get<Matrix4>( iShape, "Transform" );
glMultMatrix( tm );
// TODO find a better way to apply tm
Transform t;
Vector3 s;
tm.decompose(t.translation, t.rotation, s);
t.scale = (s[0] + s[1] + s[2]) / 3.0; // assume uniform
glMultMatrix( t );
drawHvkShape( nif, nif->getBlock( nif->getLink( iShape, "Shape" ) ), stack, scene, origin_color3fv );
glPopMatrix();
}
Expand Down
8 changes: 4 additions & 4 deletions gl/renderer.cpp
Expand Up @@ -327,7 +327,7 @@ bool Renderer::Program::load( const QString & filepath, Renderer * renderer )
QString id = list.value( 1 ).toLower();
if ( ! ok || id.isEmpty() )
throw QString( "malformed texcoord tag" );
if ( id != "tangents" && id != "binormals" && TexturingProperty::getId( id ) < 0 )
if ( id != "tangents" && id != "bitangents" && TexturingProperty::getId( id ) < 0 )
throw QString( "texcoord tag referres to unknown texture id '%1'" ).arg( id );
if ( texcoords.contains( unit ) )
throw QString( "texture unit %1 is assigned twiced" ).arg( unit );
Expand Down Expand Up @@ -579,12 +579,12 @@ bool Renderer::setupProgram( Program * prog, Mesh * mesh, const PropertyList & p
glEnableClientState( GL_TEXTURE_COORD_ARRAY );
glTexCoordPointer( 3, GL_FLOAT, 0, mesh->transTangents.data() );
}
else if ( itx.value() == "binormals" )
else if ( itx.value() == "bitangents" )
{
if ( ! mesh->transBinormals.count() )
if ( ! mesh->transBitangents.count() )
return false;
glEnableClientState( GL_TEXTURE_COORD_ARRAY );
glTexCoordPointer( 3, GL_FLOAT, 0, mesh->transBinormals.data() );
glTexCoordPointer( 3, GL_FLOAT, 0, mesh->transBitangents.data() );
}
else if (texprop != NULL)
{
Expand Down

0 comments on commit 1ba7221

Please sign in to comment.