hkPackedNiTriStripsData.cpp 8.71 KiB
/* Copyright (c) 2006, NIF File Format Library and Tools
All rights reserved. Please see niflib.h for license. */
//-----------------------------------NOTICE----------------------------------//
// Some of this file is automatically filled in by a Python script. Only //
// add custom code in the designated areas or it will be overwritten during //
// the next update. //
//-----------------------------------NOTICE----------------------------------//
//--BEGIN FILE HEAD CUSTOM CODE--//
//--END CUSTOM CODE--//
#include "../../include/FixLink.h"
#include "../../include/ObjectRegistry.h"
#include "../../include/NIF_IO.h"
#include "../../include/obj/hkPackedNiTriStripsData.h"
#include "../../include/gen/hkTriangle.h"
#include "../../include/gen/OblivionSubShape.h"
using namespace Niflib;
//Definition of TYPE constant
const Type hkPackedNiTriStripsData::TYPE("hkPackedNiTriStripsData", &bhkShapeCollection::TYPE );
hkPackedNiTriStripsData::hkPackedNiTriStripsData() : numTriangles((unsigned int)0), numVertices((unsigned int)0), unknownByte1((byte)0), numSubShapes((unsigned short)0) {
//--BEGIN CONSTRUCTOR CUSTOM CODE--//
//--END CUSTOM CODE--//
}
hkPackedNiTriStripsData::~hkPackedNiTriStripsData() {
//--BEGIN DESTRUCTOR CUSTOM CODE--//
//--END CUSTOM CODE--//
}
const Type & hkPackedNiTriStripsData::GetType() const {
return TYPE;
}
NiObject * hkPackedNiTriStripsData::Create() {
return new hkPackedNiTriStripsData;
}
void hkPackedNiTriStripsData::Read( istream& in, list<unsigned int> & link_stack, const NifInfo & info ) {
//--BEGIN PRE-READ CUSTOM CODE--//
//--END CUSTOM CODE--//
bhkShapeCollection::Read( in, link_stack, info );
NifStream( numTriangles, in, info );
triangles.resize(numTriangles);
for (unsigned int i1 = 0; i1 < triangles.size(); i1++) {
NifStream( triangles[i1].triangle, in, info );
NifStream( triangles[i1].weldingInfo, in, info );
if ( info.version <= 0x14000005 ) {
NifStream( triangles[i1].normal, in, info );
};
};
NifStream( numVertices, in, info );
if ( info.version >= 0x14020007 ) {
NifStream( unknownByte1, in, info );
};
vertices.resize(numVertices);
for (unsigned int i1 = 0; i1 < vertices.size(); i1++) {
NifStream( vertices[i1], in, info );
};
if ( info.version >= 0x14020007 ) {
NifStream( numSubShapes, in, info );
subShapes.resize(numSubShapes);
for (unsigned int i2 = 0; i2 < subShapes.size(); i2++) {
NifStream( subShapes[i2].layer, in, info );
NifStream( subShapes[i2].colFilter, in, info );
NifStream( subShapes[i2].wieldingType_, in, info );