/****************************************************************************** libx42.net - skinned vertex animation library (.NET API) Copyright (C) 2007 HermitWorks Entertainment Corporation This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc. 51 Franklin Street, Fifth Floor Boston, MA 02110-1301, USA. ******************************************************************************/ #include "Stdafx.h" #include "Tag.h" #include "Model.h" #include "Group.h" #include "Bone.h" using namespace System; using namespace System::Collections::Generic; using namespace System::IO; namespace Libx42 { const x42tag_t& Tag::RawTag::get( void ) { return owner->m->tags[index]; } String^ Tag::Name::get( void ) { return owner->GetModelString( RawTag.name ); } Bone^ Tag::Bone::get( void ) { if( RawTag.bone == X42_MODEL_BONE ) return nullptr; return owner->Bones[(int)RawTag.bone]; } Math::Affine Tag::Matrix::get( void ) { Math::Affine ret; memcpy( &ret, &RawTag.tagMatrix, sizeof( affine_t ) ); return ret; } TagCollection::TagCollection( Model ^owner ) : ModelItemCollection< Tag^ >( owner ) { items = gcnew array< Tag^ >( owner->m->header.numTags ); for( int i = 0; i < items->Length; i++ ) items[i] = gcnew Tag( owner, i ); } array< Tag^ >^ TagCollection::GetStaticTags( void ) { List< Tag^ > retList; for( int i = 0; i < items->Length; i++ ) if( !items[i]->Bone ) retList.Add( items[i] ); return retList.ToArray(); } };