Skip to content
Snippets Groups Projects
Commit 77a207f0 authored by Alecu100's avatar Alecu100
Browse files

fixed niflib to exporter geometry data with binormals and tangets in it but...

fixed niflib to exporter geometry data with binormals and tangets in it but broke niflib a bit. WARNING! from now on niflib will cause bugs when regenerated because of this
parent 3fad3f63
No related branches found
No related tags found
No related merge requests found
...@@ -182,7 +182,8 @@ public: ...@@ -182,7 +182,8 @@ public:
int max_bones_per_partition = 4, int max_bones_per_partition = 4,
bool stripify = false, bool stripify = false,
bool tangent_space = false, bool tangent_space = false,
float min_vertex_weight = 0.001f float min_vertex_weight = 0.001f,
byte tspace_flags = 0
) const; ) const;
/* /*
......
...@@ -703,7 +703,7 @@ void ComplexShape::Merge( NiAVObject * root ) { ...@@ -703,7 +703,7 @@ void ComplexShape::Merge( NiAVObject * root ) {
//Done Merging //Done Merging
} }
Ref<NiAVObject> ComplexShape::Split( NiNode * parent, Matrix44 & transform, int max_bones_per_partition, bool stripify, bool tangent_space, float min_vertex_weight ) const { Ref<NiAVObject> ComplexShape::Split( NiNode * parent, Matrix44 & transform, int max_bones_per_partition, bool stripify, bool tangent_space, float min_vertex_weight, byte tspace_flags ) const {
//Make sure parent is not NULL //Make sure parent is not NULL
if ( parent == NULL ) { if ( parent == NULL ) {
...@@ -1092,7 +1092,15 @@ Ref<NiAVObject> ComplexShape::Split( NiNode * parent, Matrix44 & transform, int ...@@ -1092,7 +1092,15 @@ Ref<NiAVObject> ComplexShape::Split( NiNode * parent, Matrix44 & transform, int
//If tangent space was requested, generate it //If tangent space was requested, generate it
if ( tangent_space ) { if ( tangent_space ) {
shapes[shape_num]->UpdateTangentSpace(); if(tspace_flags == 0) {
shapes[shape_num]->UpdateTangentSpace();
} else {
if(shapes[shape_num]->GetData() != NULL) {
shapes[shape_num]->GetData()->SetUVSetCount(1);
shapes[shape_num]->GetData()->SetTspaceFlag(tspace_flags);
shapes[shape_num]->UpdateTangentSpace(1);
}
}
} }
//Next Shape //Next Shape
......
...@@ -155,7 +155,7 @@ void NiGeometryData::Write( ostream& out, const map<NiObjectRef,unsigned int> & ...@@ -155,7 +155,7 @@ void NiGeometryData::Write( ostream& out, const map<NiObjectRef,unsigned int> &
//--END CUSTOM CODE--// //--END CUSTOM CODE--//
NiObject::Write( out, link_map, missing_link_stack, info ); NiObject::Write( out, link_map, missing_link_stack, info );
bsNumUvSets = (unsigned short)(uvSets.size()); bsNumUvSets = ((unsigned short)(uvSets.size()) | (bsNumUvSets & 0xFF00));
numUvSets = (unsigned short)(uvSets.size()); numUvSets = (unsigned short)(uvSets.size());
numVertices = (unsigned short)(vertices.size()); numVertices = (unsigned short)(vertices.size());
if ( info.version >= 0x0A020000 ) { if ( info.version >= 0x0A020000 ) {
...@@ -659,12 +659,12 @@ void NiGeometryData::SetBound(Vector3 const & center, float radius) ...@@ -659,12 +659,12 @@ void NiGeometryData::SetBound(Vector3 const & center, float radius)
byte NiGeometryData::GetTspaceFlag() const { byte NiGeometryData::GetTspaceFlag() const {
return numUvSets | bsNumUvSets; return (numUvSets | bsNumUvSets) >> 8;
} }
void NiGeometryData::SetTspaceFlag( byte value ) { void NiGeometryData::SetTspaceFlag( byte value ) {
numUvSets = value; numUvSets = ((value << 8) | numUvSets);
bsNumUvSets = value; bsNumUvSets = ((value << 8) | bsNumUvSets);
} }
bool NiGeometryData::GetHasNormals() const { bool NiGeometryData::GetHasNormals() const {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment