uid issue
This commit is contained in:
280
mdlobjects/_vpc_/manifest_mdlobjects/win32/manifest.txt
Normal file
280
mdlobjects/_vpc_/manifest_mdlobjects/win32/manifest.txt
Normal file
@ -0,0 +1,280 @@
|
||||
// ----------------------------------------- //
|
||||
// File generated by VPC //
|
||||
// ----------------------------------------- //
|
||||
|
||||
Source file: D:\Users\berta\Downloads\csgosourcecode\cstrike15_src\mdlobjects\authphysfx.cpp
|
||||
Debug output file: D:\Users\berta\Downloads\csgosourcecode\cstrike15_src\mdlobjects\authphysfx.cpp
|
||||
Release output file: D:\Users\berta\Downloads\csgosourcecode\cstrike15_src\mdlobjects\authphysfx.cpp
|
||||
Containing unity file:
|
||||
PCH file:
|
||||
|
||||
Source file: D:\Users\berta\Downloads\csgosourcecode\cstrike15_src\common\debug_lib_check.cpp
|
||||
Debug output file: D:\Users\berta\Downloads\csgosourcecode\cstrike15_src\common\debug_lib_check.cpp
|
||||
Release output file: D:\Users\berta\Downloads\csgosourcecode\cstrike15_src\common\debug_lib_check.cpp
|
||||
Containing unity file:
|
||||
PCH file:
|
||||
|
||||
Source file: D:\Users\berta\Downloads\csgosourcecode\cstrike15_src\mdlobjects\dmeanimationassemblycommand.cpp
|
||||
Debug output file: D:\Users\berta\Downloads\csgosourcecode\cstrike15_src\mdlobjects\dmeanimationassemblycommand.cpp
|
||||
Release output file: D:\Users\berta\Downloads\csgosourcecode\cstrike15_src\mdlobjects\dmeanimationassemblycommand.cpp
|
||||
Containing unity file:
|
||||
PCH file:
|
||||
|
||||
Source file: D:\Users\berta\Downloads\csgosourcecode\cstrike15_src\mdlobjects\dmeanimblocksize.cpp
|
||||
Debug output file: D:\Users\berta\Downloads\csgosourcecode\cstrike15_src\mdlobjects\dmeanimblocksize.cpp
|
||||
Release output file: D:\Users\berta\Downloads\csgosourcecode\cstrike15_src\mdlobjects\dmeanimblocksize.cpp
|
||||
Containing unity file:
|
||||
PCH file:
|
||||
|
||||
Source file: D:\Users\berta\Downloads\csgosourcecode\cstrike15_src\mdlobjects\dmeanimcmd.cpp
|
||||
Debug output file: D:\Users\berta\Downloads\csgosourcecode\cstrike15_src\mdlobjects\dmeanimcmd.cpp
|
||||
Release output file: D:\Users\berta\Downloads\csgosourcecode\cstrike15_src\mdlobjects\dmeanimcmd.cpp
|
||||
Containing unity file:
|
||||
PCH file:
|
||||
|
||||
Source file: D:\Users\berta\Downloads\csgosourcecode\cstrike15_src\mdlobjects\dmeassemblycommand.cpp
|
||||
Debug output file: D:\Users\berta\Downloads\csgosourcecode\cstrike15_src\mdlobjects\dmeassemblycommand.cpp
|
||||
Release output file: D:\Users\berta\Downloads\csgosourcecode\cstrike15_src\mdlobjects\dmeassemblycommand.cpp
|
||||
Containing unity file:
|
||||
PCH file:
|
||||
|
||||
Source file: D:\Users\berta\Downloads\csgosourcecode\cstrike15_src\mdlobjects\dmeasset.cpp
|
||||
Debug output file: D:\Users\berta\Downloads\csgosourcecode\cstrike15_src\mdlobjects\dmeasset.cpp
|
||||
Release output file: D:\Users\berta\Downloads\csgosourcecode\cstrike15_src\mdlobjects\dmeasset.cpp
|
||||
Containing unity file:
|
||||
PCH file:
|
||||
|
||||
Source file: D:\Users\berta\Downloads\csgosourcecode\cstrike15_src\mdlobjects\dmebbox.cpp
|
||||
Debug output file: D:\Users\berta\Downloads\csgosourcecode\cstrike15_src\mdlobjects\dmebbox.cpp
|
||||
Release output file: D:\Users\berta\Downloads\csgosourcecode\cstrike15_src\mdlobjects\dmebbox.cpp
|
||||
Containing unity file:
|
||||
PCH file:
|
||||
|
||||
Source file: D:\Users\berta\Downloads\csgosourcecode\cstrike15_src\mdlobjects\dmeblankbodypart.cpp
|
||||
Debug output file: D:\Users\berta\Downloads\csgosourcecode\cstrike15_src\mdlobjects\dmeblankbodypart.cpp
|
||||
Release output file: D:\Users\berta\Downloads\csgosourcecode\cstrike15_src\mdlobjects\dmeblankbodypart.cpp
|
||||
Containing unity file:
|
||||
PCH file:
|
||||
|
||||
Source file: D:\Users\berta\Downloads\csgosourcecode\cstrike15_src\mdlobjects\dmebodygroup.cpp
|
||||
Debug output file: D:\Users\berta\Downloads\csgosourcecode\cstrike15_src\mdlobjects\dmebodygroup.cpp
|
||||
Release output file: D:\Users\berta\Downloads\csgosourcecode\cstrike15_src\mdlobjects\dmebodygroup.cpp
|
||||
Containing unity file:
|
||||
PCH file:
|
||||
|
||||
Source file: D:\Users\berta\Downloads\csgosourcecode\cstrike15_src\mdlobjects\dmebodygrouplist.cpp
|
||||
Debug output file: D:\Users\berta\Downloads\csgosourcecode\cstrike15_src\mdlobjects\dmebodygrouplist.cpp
|
||||
Release output file: D:\Users\berta\Downloads\csgosourcecode\cstrike15_src\mdlobjects\dmebodygrouplist.cpp
|
||||
Containing unity file:
|
||||
PCH file:
|
||||
|
||||
Source file: D:\Users\berta\Downloads\csgosourcecode\cstrike15_src\mdlobjects\dmebodypart.cpp
|
||||
Debug output file: D:\Users\berta\Downloads\csgosourcecode\cstrike15_src\mdlobjects\dmebodypart.cpp
|
||||
Release output file: D:\Users\berta\Downloads\csgosourcecode\cstrike15_src\mdlobjects\dmebodypart.cpp
|
||||
Containing unity file:
|
||||
PCH file:
|
||||
|
||||
Source file: D:\Users\berta\Downloads\csgosourcecode\cstrike15_src\mdlobjects\dmeboneflexdriver.cpp
|
||||
Debug output file: D:\Users\berta\Downloads\csgosourcecode\cstrike15_src\mdlobjects\dmeboneflexdriver.cpp
|
||||
Release output file: D:\Users\berta\Downloads\csgosourcecode\cstrike15_src\mdlobjects\dmeboneflexdriver.cpp
|
||||
Containing unity file:
|
||||
PCH file:
|
||||
|
||||
Source file: D:\Users\berta\Downloads\csgosourcecode\cstrike15_src\mdlobjects\dmebonemask.cpp
|
||||
Debug output file: D:\Users\berta\Downloads\csgosourcecode\cstrike15_src\mdlobjects\dmebonemask.cpp
|
||||
Release output file: D:\Users\berta\Downloads\csgosourcecode\cstrike15_src\mdlobjects\dmebonemask.cpp
|
||||
Containing unity file:
|
||||
PCH file:
|
||||
|
||||
Source file: D:\Users\berta\Downloads\csgosourcecode\cstrike15_src\mdlobjects\dmebonemasklist.cpp
|
||||
Debug output file: D:\Users\berta\Downloads\csgosourcecode\cstrike15_src\mdlobjects\dmebonemasklist.cpp
|
||||
Release output file: D:\Users\berta\Downloads\csgosourcecode\cstrike15_src\mdlobjects\dmebonemasklist.cpp
|
||||
Containing unity file:
|
||||
PCH file:
|
||||
|
||||
Source file: D:\Users\berta\Downloads\csgosourcecode\cstrike15_src\mdlobjects\dmeboneweight.cpp
|
||||
Debug output file: D:\Users\berta\Downloads\csgosourcecode\cstrike15_src\mdlobjects\dmeboneweight.cpp
|
||||
Release output file: D:\Users\berta\Downloads\csgosourcecode\cstrike15_src\mdlobjects\dmeboneweight.cpp
|
||||
Containing unity file:
|
||||
PCH file:
|
||||
|
||||
Source file: D:\Users\berta\Downloads\csgosourcecode\cstrike15_src\mdlobjects\dmecollisionjoints.cpp
|
||||
Debug output file: D:\Users\berta\Downloads\csgosourcecode\cstrike15_src\mdlobjects\dmecollisionjoints.cpp
|
||||
Release output file: D:\Users\berta\Downloads\csgosourcecode\cstrike15_src\mdlobjects\dmecollisionjoints.cpp
|
||||
Containing unity file:
|
||||
PCH file:
|
||||
|
||||
Source file: D:\Users\berta\Downloads\csgosourcecode\cstrike15_src\mdlobjects\dmecollisionmodel.cpp
|
||||
Debug output file: D:\Users\berta\Downloads\csgosourcecode\cstrike15_src\mdlobjects\dmecollisionmodel.cpp
|
||||
Release output file: D:\Users\berta\Downloads\csgosourcecode\cstrike15_src\mdlobjects\dmecollisionmodel.cpp
|
||||
Containing unity file:
|
||||
PCH file:
|
||||
|
||||
Source file: D:\Users\berta\Downloads\csgosourcecode\cstrike15_src\mdlobjects\dmedefinebone.cpp
|
||||
Debug output file: D:\Users\berta\Downloads\csgosourcecode\cstrike15_src\mdlobjects\dmedefinebone.cpp
|
||||
Release output file: D:\Users\berta\Downloads\csgosourcecode\cstrike15_src\mdlobjects\dmedefinebone.cpp
|
||||
Containing unity file:
|
||||
PCH file:
|
||||
|
||||
Source file: D:\Users\berta\Downloads\csgosourcecode\cstrike15_src\mdlobjects\dmedefinebonelist.cpp
|
||||
Debug output file: D:\Users\berta\Downloads\csgosourcecode\cstrike15_src\mdlobjects\dmedefinebonelist.cpp
|
||||
Release output file: D:\Users\berta\Downloads\csgosourcecode\cstrike15_src\mdlobjects\dmedefinebonelist.cpp
|
||||
Containing unity file:
|
||||
PCH file:
|
||||
|
||||
Source file: D:\Users\berta\Downloads\csgosourcecode\cstrike15_src\mdlobjects\dmeelementgroup.cpp
|
||||
Debug output file: D:\Users\berta\Downloads\csgosourcecode\cstrike15_src\mdlobjects\dmeelementgroup.cpp
|
||||
Release output file: D:\Users\berta\Downloads\csgosourcecode\cstrike15_src\mdlobjects\dmeelementgroup.cpp
|
||||
Containing unity file:
|
||||
PCH file:
|
||||
|
||||
Source file: D:\Users\berta\Downloads\csgosourcecode\cstrike15_src\mdlobjects\dmeeyeball.cpp
|
||||
Debug output file: D:\Users\berta\Downloads\csgosourcecode\cstrike15_src\mdlobjects\dmeeyeball.cpp
|
||||
Release output file: D:\Users\berta\Downloads\csgosourcecode\cstrike15_src\mdlobjects\dmeeyeball.cpp
|
||||
Containing unity file:
|
||||
PCH file:
|
||||
|
||||
Source file: D:\Users\berta\Downloads\csgosourcecode\cstrike15_src\mdlobjects\dmeeyeballglobals.cpp
|
||||
Debug output file: D:\Users\berta\Downloads\csgosourcecode\cstrike15_src\mdlobjects\dmeeyeballglobals.cpp
|
||||
Release output file: D:\Users\berta\Downloads\csgosourcecode\cstrike15_src\mdlobjects\dmeeyeballglobals.cpp
|
||||
Containing unity file:
|
||||
PCH file:
|
||||
|
||||
Source file: D:\Users\berta\Downloads\csgosourcecode\cstrike15_src\mdlobjects\dmeeyelid.cpp
|
||||
Debug output file: D:\Users\berta\Downloads\csgosourcecode\cstrike15_src\mdlobjects\dmeeyelid.cpp
|
||||
Release output file: D:\Users\berta\Downloads\csgosourcecode\cstrike15_src\mdlobjects\dmeeyelid.cpp
|
||||
Containing unity file:
|
||||
PCH file:
|
||||
|
||||
Source file: D:\Users\berta\Downloads\csgosourcecode\cstrike15_src\mdlobjects\dmehitbox.cpp
|
||||
Debug output file: D:\Users\berta\Downloads\csgosourcecode\cstrike15_src\mdlobjects\dmehitbox.cpp
|
||||
Release output file: D:\Users\berta\Downloads\csgosourcecode\cstrike15_src\mdlobjects\dmehitbox.cpp
|
||||
Containing unity file:
|
||||
PCH file:
|
||||
|
||||
Source file: D:\Users\berta\Downloads\csgosourcecode\cstrike15_src\mdlobjects\dmehitboxset.cpp
|
||||
Debug output file: D:\Users\berta\Downloads\csgosourcecode\cstrike15_src\mdlobjects\dmehitboxset.cpp
|
||||
Release output file: D:\Users\berta\Downloads\csgosourcecode\cstrike15_src\mdlobjects\dmehitboxset.cpp
|
||||
Containing unity file:
|
||||
PCH file:
|
||||
|
||||
Source file: D:\Users\berta\Downloads\csgosourcecode\cstrike15_src\mdlobjects\dmehitboxsetlist.cpp
|
||||
Debug output file: D:\Users\berta\Downloads\csgosourcecode\cstrike15_src\mdlobjects\dmehitboxsetlist.cpp
|
||||
Release output file: D:\Users\berta\Downloads\csgosourcecode\cstrike15_src\mdlobjects\dmehitboxsetlist.cpp
|
||||
Containing unity file:
|
||||
PCH file:
|
||||
|
||||
Source file: D:\Users\berta\Downloads\csgosourcecode\cstrike15_src\mdlobjects\dmeik.cpp
|
||||
Debug output file: D:\Users\berta\Downloads\csgosourcecode\cstrike15_src\mdlobjects\dmeik.cpp
|
||||
Release output file: D:\Users\berta\Downloads\csgosourcecode\cstrike15_src\mdlobjects\dmeik.cpp
|
||||
Containing unity file:
|
||||
PCH file:
|
||||
|
||||
Source file: D:\Users\berta\Downloads\csgosourcecode\cstrike15_src\mdlobjects\dmeincludemodellist.cpp
|
||||
Debug output file: D:\Users\berta\Downloads\csgosourcecode\cstrike15_src\mdlobjects\dmeincludemodellist.cpp
|
||||
Release output file: D:\Users\berta\Downloads\csgosourcecode\cstrike15_src\mdlobjects\dmeincludemodellist.cpp
|
||||
Containing unity file:
|
||||
PCH file:
|
||||
|
||||
Source file: D:\Users\berta\Downloads\csgosourcecode\cstrike15_src\mdlobjects\dmejigglebone.cpp
|
||||
Debug output file: D:\Users\berta\Downloads\csgosourcecode\cstrike15_src\mdlobjects\dmejigglebone.cpp
|
||||
Release output file: D:\Users\berta\Downloads\csgosourcecode\cstrike15_src\mdlobjects\dmejigglebone.cpp
|
||||
Containing unity file:
|
||||
PCH file:
|
||||
|
||||
Source file: D:\Users\berta\Downloads\csgosourcecode\cstrike15_src\mdlobjects\dmelod.cpp
|
||||
Debug output file: D:\Users\berta\Downloads\csgosourcecode\cstrike15_src\mdlobjects\dmelod.cpp
|
||||
Release output file: D:\Users\berta\Downloads\csgosourcecode\cstrike15_src\mdlobjects\dmelod.cpp
|
||||
Containing unity file:
|
||||
PCH file:
|
||||
|
||||
Source file: D:\Users\berta\Downloads\csgosourcecode\cstrike15_src\mdlobjects\dmelodlist.cpp
|
||||
Debug output file: D:\Users\berta\Downloads\csgosourcecode\cstrike15_src\mdlobjects\dmelodlist.cpp
|
||||
Release output file: D:\Users\berta\Downloads\csgosourcecode\cstrike15_src\mdlobjects\dmelodlist.cpp
|
||||
Containing unity file:
|
||||
PCH file:
|
||||
|
||||
Source file: D:\Users\berta\Downloads\csgosourcecode\cstrike15_src\mdlobjects\dmematerialgroup.cpp
|
||||
Debug output file: D:\Users\berta\Downloads\csgosourcecode\cstrike15_src\mdlobjects\dmematerialgroup.cpp
|
||||
Release output file: D:\Users\berta\Downloads\csgosourcecode\cstrike15_src\mdlobjects\dmematerialgroup.cpp
|
||||
Containing unity file:
|
||||
PCH file:
|
||||
|
||||
Source file: D:\Users\berta\Downloads\csgosourcecode\cstrike15_src\mdlobjects\dmematerialgrouplist.cpp
|
||||
Debug output file: D:\Users\berta\Downloads\csgosourcecode\cstrike15_src\mdlobjects\dmematerialgrouplist.cpp
|
||||
Release output file: D:\Users\berta\Downloads\csgosourcecode\cstrike15_src\mdlobjects\dmematerialgrouplist.cpp
|
||||
Containing unity file:
|
||||
PCH file:
|
||||
|
||||
Source file: D:\Users\berta\Downloads\csgosourcecode\cstrike15_src\mdlobjects\dmematsysroot.cpp
|
||||
Debug output file: D:\Users\berta\Downloads\csgosourcecode\cstrike15_src\mdlobjects\dmematsysroot.cpp
|
||||
Release output file: D:\Users\berta\Downloads\csgosourcecode\cstrike15_src\mdlobjects\dmematsysroot.cpp
|
||||
Containing unity file:
|
||||
PCH file:
|
||||
|
||||
Source file: D:\Users\berta\Downloads\csgosourcecode\cstrike15_src\mdlobjects\dmemdllist.cpp
|
||||
Debug output file: D:\Users\berta\Downloads\csgosourcecode\cstrike15_src\mdlobjects\dmemdllist.cpp
|
||||
Release output file: D:\Users\berta\Downloads\csgosourcecode\cstrike15_src\mdlobjects\dmemdllist.cpp
|
||||
Containing unity file:
|
||||
PCH file:
|
||||
|
||||
Source file: D:\Users\berta\Downloads\csgosourcecode\cstrike15_src\mdlobjects\dmemotioncontrol.cpp
|
||||
Debug output file: D:\Users\berta\Downloads\csgosourcecode\cstrike15_src\mdlobjects\dmemotioncontrol.cpp
|
||||
Release output file: D:\Users\berta\Downloads\csgosourcecode\cstrike15_src\mdlobjects\dmemotioncontrol.cpp
|
||||
Containing unity file:
|
||||
PCH file:
|
||||
|
||||
Source file: D:\Users\berta\Downloads\csgosourcecode\cstrike15_src\mdlobjects\dmemouth.cpp
|
||||
Debug output file: D:\Users\berta\Downloads\csgosourcecode\cstrike15_src\mdlobjects\dmemouth.cpp
|
||||
Release output file: D:\Users\berta\Downloads\csgosourcecode\cstrike15_src\mdlobjects\dmemouth.cpp
|
||||
Containing unity file:
|
||||
PCH file:
|
||||
|
||||
Source file: D:\Users\berta\Downloads\csgosourcecode\cstrike15_src\mdlobjects\dmeposeparameter.cpp
|
||||
Debug output file: D:\Users\berta\Downloads\csgosourcecode\cstrike15_src\mdlobjects\dmeposeparameter.cpp
|
||||
Release output file: D:\Users\berta\Downloads\csgosourcecode\cstrike15_src\mdlobjects\dmeposeparameter.cpp
|
||||
Containing unity file:
|
||||
PCH file:
|
||||
|
||||
Source file: D:\Users\berta\Downloads\csgosourcecode\cstrike15_src\mdlobjects\dmeposeparameterlist.cpp
|
||||
Debug output file: D:\Users\berta\Downloads\csgosourcecode\cstrike15_src\mdlobjects\dmeposeparameterlist.cpp
|
||||
Release output file: D:\Users\berta\Downloads\csgosourcecode\cstrike15_src\mdlobjects\dmeposeparameterlist.cpp
|
||||
Containing unity file:
|
||||
PCH file:
|
||||
|
||||
Source file: D:\Users\berta\Downloads\csgosourcecode\cstrike15_src\mdlobjects\dmeproceduralbone.cpp
|
||||
Debug output file: D:\Users\berta\Downloads\csgosourcecode\cstrike15_src\mdlobjects\dmeproceduralbone.cpp
|
||||
Release output file: D:\Users\berta\Downloads\csgosourcecode\cstrike15_src\mdlobjects\dmeproceduralbone.cpp
|
||||
Containing unity file:
|
||||
PCH file:
|
||||
|
||||
Source file: D:\Users\berta\Downloads\csgosourcecode\cstrike15_src\mdlobjects\dmesequence.cpp
|
||||
Debug output file: D:\Users\berta\Downloads\csgosourcecode\cstrike15_src\mdlobjects\dmesequence.cpp
|
||||
Release output file: D:\Users\berta\Downloads\csgosourcecode\cstrike15_src\mdlobjects\dmesequence.cpp
|
||||
Containing unity file:
|
||||
PCH file:
|
||||
|
||||
Source file: D:\Users\berta\Downloads\csgosourcecode\cstrike15_src\mdlobjects\dmesequencelist.cpp
|
||||
Debug output file: D:\Users\berta\Downloads\csgosourcecode\cstrike15_src\mdlobjects\dmesequencelist.cpp
|
||||
Release output file: D:\Users\berta\Downloads\csgosourcecode\cstrike15_src\mdlobjects\dmesequencelist.cpp
|
||||
Containing unity file:
|
||||
PCH file:
|
||||
|
||||
Source file: D:\Users\berta\Downloads\csgosourcecode\cstrike15_src\mdlobjects\dmeskinner.cpp
|
||||
Debug output file: D:\Users\berta\Downloads\csgosourcecode\cstrike15_src\mdlobjects\dmeskinner.cpp
|
||||
Release output file: D:\Users\berta\Downloads\csgosourcecode\cstrike15_src\mdlobjects\dmeskinner.cpp
|
||||
Containing unity file:
|
||||
PCH file:
|
||||
|
||||
Source file: D:\Users\berta\Downloads\csgosourcecode\cstrike15_src\mdlobjects\mpp_utils.cpp
|
||||
Debug output file: D:\Users\berta\Downloads\csgosourcecode\cstrike15_src\mdlobjects\mpp_utils.cpp
|
||||
Release output file: D:\Users\berta\Downloads\csgosourcecode\cstrike15_src\mdlobjects\mpp_utils.cpp
|
||||
Containing unity file:
|
||||
PCH file:
|
||||
|
||||
Source file: D:\Users\berta\Downloads\csgosourcecode\cstrike15_src\mdlobjects\physmodelsource.cpp
|
||||
Debug output file: D:\Users\berta\Downloads\csgosourcecode\cstrike15_src\mdlobjects\physmodelsource.cpp
|
||||
Release output file: D:\Users\berta\Downloads\csgosourcecode\cstrike15_src\mdlobjects\physmodelsource.cpp
|
||||
Containing unity file:
|
||||
PCH file:
|
||||
|
2059
mdlobjects/authphysfx.cpp
Normal file
2059
mdlobjects/authphysfx.cpp
Normal file
File diff suppressed because it is too large
Load Diff
970
mdlobjects/dmeanimationassemblycommand.cpp
Normal file
970
mdlobjects/dmeanimationassemblycommand.cpp
Normal file
@ -0,0 +1,970 @@
|
||||
//===== Copyright (c) 1996-2009, Valve Corporation, All rights reserved. ====
|
||||
//
|
||||
// Animation commands
|
||||
//
|
||||
//==========================================================================
|
||||
|
||||
|
||||
// Valve includes
|
||||
#include "datamodel/dmelementfactoryhelper.h"
|
||||
#include "mdlobjects/dmeanimationassemblycommand.h"
|
||||
#include "mdlobjects/dmebonemask.h"
|
||||
#include "mdlobjects/dmesequence.h"
|
||||
#include "mdlobjects/mpp_utils.h"
|
||||
#include "bone_setup.h"
|
||||
|
||||
|
||||
// memdbgon must be the last include file in a .cpp file!!!
|
||||
#include "tier0/memdbgon.h"
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
//
|
||||
//-----------------------------------------------------------------------------
|
||||
DEFINE_LOGGING_CHANNEL_NO_TAGS( LOG_DME_AAC, "DmeAnimationAssemblyCommand" );
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Get the CDmeSequence & CDmeChannelsClip from the specified CDmElement
|
||||
//-----------------------------------------------------------------------------
|
||||
static bool ConvertToDmeSequenceAndDmeChannelsClip(
|
||||
CDmeSequence *&pDmeSequence,
|
||||
CDmeChannelsClip *&pDmeChannelsClip,
|
||||
CDmElement *pDmElement,
|
||||
const CUtlString &sDmElementId )
|
||||
{
|
||||
if ( !pDmElement )
|
||||
{
|
||||
Log_Error( LOG_DME_AAC, "%s: No DmElement Specified specified\n", sDmElementId.Get() );
|
||||
return false;
|
||||
}
|
||||
|
||||
CDmeSequence *pDmeSequenceTmp = CastElement< CDmeSequence >( pDmElement );
|
||||
if ( !pDmeSequenceTmp )
|
||||
{
|
||||
Log_Error( LOG_DME_AAC, "%s: No DmeSequence Specified specified\n", sDmElementId.Get() );
|
||||
return false;
|
||||
}
|
||||
|
||||
CDmeChannelsClip *pDmeChannelsClipTmp = pDmeSequenceTmp->GetDmeChannelsClip();
|
||||
if ( !pDmeChannelsClipTmp )
|
||||
{
|
||||
Log_Error( LOG_DME_AAC, "%s: Specified Sequence %s Has No DmeChannelsClip\n", sDmElementId.Get(), ComputeDmElementIdStr( pDmeSequenceTmp ).Get() );
|
||||
return false;
|
||||
}
|
||||
|
||||
pDmeSequence = pDmeSequenceTmp;
|
||||
pDmeChannelsClip = pDmeChannelsClipTmp;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Expose this class to the scene database
|
||||
//-----------------------------------------------------------------------------
|
||||
IMPLEMENT_ELEMENT_FACTORY( DmeAnimationAssemblyCommand, CDmeAnimationAssemblyCommand );
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
//
|
||||
//-----------------------------------------------------------------------------
|
||||
void CDmeAnimationAssemblyCommand::OnConstruction()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
//
|
||||
//-----------------------------------------------------------------------------
|
||||
void CDmeAnimationAssemblyCommand::OnDestruction()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Expose this class to the scene database
|
||||
//-----------------------------------------------------------------------------
|
||||
IMPLEMENT_ELEMENT_FACTORY( DmeFixupLoop, CDmeFixupLoop );
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
//
|
||||
//-----------------------------------------------------------------------------
|
||||
void CDmeFixupLoop::OnConstruction()
|
||||
{
|
||||
m_nStartFrame.Init( this, "startFrame" );
|
||||
m_nEndFrame.Init( this, "endFrame" );
|
||||
}
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
//
|
||||
//-----------------------------------------------------------------------------
|
||||
void CDmeFixupLoop::OnDestruction()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
//
|
||||
//-----------------------------------------------------------------------------
|
||||
bool CDmeFixupLoop::Apply( CDmElement *pDmElement )
|
||||
{
|
||||
CDmeSequence *pDmeSequenceDst = NULL;
|
||||
CDmeChannelsClip *pDmeChannelsClipDst = NULL;
|
||||
|
||||
if ( !ConvertToDmeSequenceAndDmeChannelsClip( pDmeSequenceDst, pDmeChannelsClipDst, pDmElement, ComputeDmElementIdStr( this ) ) )
|
||||
return false;
|
||||
|
||||
const DmeFramerate_t dmeFrameRateDst = pDmeSequenceDst->GetFrameRate();
|
||||
const int nFrameCountDst = pDmeSequenceDst->GetFrameCount();
|
||||
int nStartFrame = m_nStartFrame.Get();
|
||||
int nEndFrame = m_nEndFrame.Get();
|
||||
|
||||
// Make sure loop doesn't exceed animation length
|
||||
if ( nEndFrame - nStartFrame > nFrameCountDst )
|
||||
{
|
||||
nEndFrame = nFrameCountDst + nStartFrame;
|
||||
if ( nEndFrame < 0 )
|
||||
{
|
||||
nEndFrame = 0;
|
||||
nStartFrame = -( nFrameCountDst - 1 );
|
||||
}
|
||||
}
|
||||
|
||||
DmeTime_t nStartTime( nStartFrame, dmeFrameRateDst );
|
||||
DmeTime_t nEndTime( nEndFrame, dmeFrameRateDst );
|
||||
|
||||
for ( int i = 0; i < pDmeChannelsClipDst->m_Channels.Count(); ++i )
|
||||
{
|
||||
CDmeChannel *pDmeChannelDst = pDmeChannelsClipDst->m_Channels[i];
|
||||
if ( !pDmeChannelDst )
|
||||
continue;
|
||||
|
||||
CDmeLog *pDmeLogDst = pDmeChannelDst->GetLog();
|
||||
if ( !pDmeLogDst )
|
||||
continue;
|
||||
|
||||
CDmeVector3Log *pDmeVector3LogDst = CastElement< CDmeVector3Log >( pDmeLogDst );
|
||||
if ( pDmeVector3LogDst )
|
||||
{
|
||||
Apply( pDmeVector3LogDst, nStartTime, nEndTime );
|
||||
continue;
|
||||
}
|
||||
|
||||
CDmeQuaternionLog *pDmeQuaternionLogDst = CastElement< CDmeQuaternionLog >( pDmeLogDst );
|
||||
if ( pDmeQuaternionLogDst )
|
||||
{
|
||||
Apply( pDmeQuaternionLogDst, nStartTime, nEndTime );
|
||||
continue;
|
||||
}
|
||||
|
||||
// ERROR - Unsupported log type
|
||||
Log_Warning( LOG_DME_AAC, "%s: Unsupported DmeLog Type: \"%s\"\n", ComputeDmElementIdStr( this ).Get(), ComputeDmElementIdStr( pDmeSequenceDst ).Get() );
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
//
|
||||
//-----------------------------------------------------------------------------
|
||||
template < class T >
|
||||
void ComputeDelta( T &result, const T &a, const T &b );
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
//
|
||||
//-----------------------------------------------------------------------------
|
||||
template<> void ComputeDelta< Vector >( Vector &vResult, const Vector &vA, const Vector &vB )
|
||||
{
|
||||
VectorSubtract( vA, vB, vResult );
|
||||
}
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
//
|
||||
//-----------------------------------------------------------------------------
|
||||
template<> void ComputeDelta< Quaternion >( Quaternion &qResult, const Quaternion &qA, const Quaternion &qB )
|
||||
{
|
||||
QuaternionMA( qA, -1.0f, qB, qResult );
|
||||
}
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
//
|
||||
//-----------------------------------------------------------------------------
|
||||
template < class T >
|
||||
void AddScaledDelta( T &result, float flScale, const T &a, const T &b );
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
//
|
||||
//-----------------------------------------------------------------------------
|
||||
template<> void AddScaledDelta< Vector >( Vector &vResult, float flScale, const Vector &vDelta, const Vector &vOrig )
|
||||
{
|
||||
VectorMA( vOrig, flScale, vDelta, vResult );
|
||||
}
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
//
|
||||
//-----------------------------------------------------------------------------
|
||||
template<> void AddScaledDelta< Quaternion >( Quaternion &qResult, float flScale, const Quaternion &qDelta, const Quaternion &qOrig )
|
||||
{
|
||||
QuaternionSM( flScale, qDelta, qOrig, qResult );
|
||||
}
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
//
|
||||
//-----------------------------------------------------------------------------
|
||||
template < class T >
|
||||
void CDmeFixupLoop::Apply(
|
||||
CDmeTypedLog< T > *pDmeTypedLogDst,
|
||||
const DmeTime_t &dmeTimeStart,
|
||||
const DmeTime_t &dmeTimeEnd ) const
|
||||
{
|
||||
if ( !pDmeTypedLogDst )
|
||||
return;
|
||||
|
||||
const DmeTime_t dmeTimeRange( dmeTimeEnd - dmeTimeStart );
|
||||
if ( dmeTimeRange.GetSeconds() <= 0.0 )
|
||||
return;
|
||||
|
||||
if ( dmeTimeStart.GetSeconds() > 0.0f )
|
||||
return;
|
||||
|
||||
const float flTimeRange = dmeTimeRange.GetSeconds();
|
||||
|
||||
const int nKeyCount = pDmeTypedLogDst->GetKeyCount();
|
||||
if ( nKeyCount <= 0 )
|
||||
return;
|
||||
|
||||
CUtlVector< DmeTime_t > times;
|
||||
CUtlVector< T > values;
|
||||
|
||||
for ( int i = 0; i < nKeyCount; ++i )
|
||||
{
|
||||
times.AddToTail( pDmeTypedLogDst->GetKeyTime( i ) );
|
||||
values.AddToTail( pDmeTypedLogDst->GetKeyValue( i ) );
|
||||
}
|
||||
|
||||
Assert( nKeyCount == pDmeTypedLogDst->GetKeyCount() );
|
||||
|
||||
T delta;
|
||||
ComputeDelta< T >( delta, values[ nKeyCount - 1 ], values[ 0 ] );
|
||||
|
||||
T newValue;
|
||||
|
||||
if ( dmeTimeStart.GetSeconds() < 0.0f )
|
||||
{
|
||||
const DmeTime_t dmeTimeBegin = times[ nKeyCount - 1 ] + dmeTimeStart;
|
||||
for ( int nKeyIndex = 0; nKeyIndex < nKeyCount; ++nKeyIndex )
|
||||
{
|
||||
const DmeTime_t &dmeTimeKey = times[ nKeyIndex ];
|
||||
if ( dmeTimeKey < dmeTimeBegin )
|
||||
continue;
|
||||
|
||||
float flScale = ( dmeTimeKey - dmeTimeBegin ).GetSeconds() / flTimeRange;
|
||||
flScale = 3.0f * flScale * flScale - 2.0f * flScale * flScale * flScale;
|
||||
|
||||
AddScaledDelta( newValue, -flScale, delta, values[ nKeyIndex ] );
|
||||
values[ nKeyIndex ] = newValue;
|
||||
}
|
||||
}
|
||||
|
||||
if ( dmeTimeEnd.GetSeconds() > 0.0f )
|
||||
{
|
||||
const DmeTime_t dmeTimeBegin = times[ 0 ];
|
||||
for ( int nKeyIndex = 0; nKeyIndex < nKeyCount; ++nKeyIndex )
|
||||
{
|
||||
const DmeTime_t dmeTimeKey = times[ nKeyIndex ];
|
||||
if ( dmeTimeKey > dmeTimeEnd )
|
||||
break;
|
||||
|
||||
float flScale = ( dmeTimeEnd - ( dmeTimeKey - dmeTimeBegin ) ).GetSeconds() / flTimeRange;
|
||||
flScale = 3.0f * flScale * flScale - 2.0f * flScale * flScale * flScale;
|
||||
|
||||
AddScaledDelta( newValue, flScale, delta, values[ nKeyIndex ] );
|
||||
values[ nKeyIndex ] = newValue;
|
||||
}
|
||||
}
|
||||
|
||||
CDmeTypedLogLayer< T > *pDmeTypedLogLayer = CastElement< CDmeTypedLogLayer< T > >( pDmeTypedLogDst->AddNewLayer() );
|
||||
if ( pDmeTypedLogLayer )
|
||||
{
|
||||
pDmeTypedLogLayer->SetAllKeys( times, values );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Expose this class to the scene database
|
||||
//-----------------------------------------------------------------------------
|
||||
IMPLEMENT_ELEMENT_FACTORY( DmeSubtract, CDmeSubtract );
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
//
|
||||
//-----------------------------------------------------------------------------
|
||||
void CDmeSubtract::OnConstruction()
|
||||
{
|
||||
m_eSequence.Init( this, "sequence", FATTRIB_NEVERCOPY );
|
||||
m_nFrame.Init( this, "frame" );
|
||||
}
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
//
|
||||
//-----------------------------------------------------------------------------
|
||||
void CDmeSubtract::OnDestruction()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
//
|
||||
//-----------------------------------------------------------------------------
|
||||
bool CDmeSubtract::Apply( CDmElement *pDmElement )
|
||||
{
|
||||
CDmeSequence *pDmeSequenceDst = NULL;
|
||||
CDmeChannelsClip *pDmeChannelsClipDst = NULL;
|
||||
|
||||
if ( !ConvertToDmeSequenceAndDmeChannelsClip( pDmeSequenceDst, pDmeChannelsClipDst, pDmElement, ComputeDmElementIdStr( this ) ) )
|
||||
return false;
|
||||
|
||||
CDmeSequence *pDmeSequenceSrc = NULL;
|
||||
CDmeChannelsClip *pDmeChannelsClipSrc = NULL;
|
||||
|
||||
if ( !ConvertToDmeSequenceAndDmeChannelsClip( pDmeSequenceSrc, pDmeChannelsClipSrc, m_eSequence.GetElement(), ComputeDmElementIdStr( this ) ) )
|
||||
return false;
|
||||
|
||||
const DmeFramerate_t dmeFrameRateSrc = pDmeSequenceSrc->GetFrameRate();
|
||||
const DmeTime_t dmeTimeSrc( m_nFrame.Get(), dmeFrameRateSrc );
|
||||
|
||||
if ( dmeTimeSrc < pDmeChannelsClipSrc->GetStartTime() )
|
||||
{
|
||||
Log_Warning( LOG_DME_AAC, "%s: .%s %d (%.2fs @ %g fps) < %s Start Time of %.2fs\n",
|
||||
ComputeDmElementIdStr( this ).Get(),
|
||||
m_nFrame.GetAttribute()->GetName(),
|
||||
m_nFrame.Get(),
|
||||
dmeTimeSrc.GetSeconds(),
|
||||
dmeFrameRateSrc.GetFramesPerSecond(),
|
||||
ComputeDmElementIdStr( pDmeSequenceSrc ).Get(),
|
||||
pDmeChannelsClipSrc->GetStartTime().GetSeconds() );
|
||||
}
|
||||
|
||||
if ( dmeTimeSrc > pDmeChannelsClipSrc->GetEndTime() )
|
||||
{
|
||||
Log_Warning( LOG_DME_AAC, "%s: .%s %d (%.2fs @ %g fps) > %s End Time of %.2fs\n",
|
||||
ComputeDmElementIdStr( this ).Get(),
|
||||
m_nFrame.GetAttribute()->GetName(),
|
||||
m_nFrame.Get(),
|
||||
dmeTimeSrc.GetSeconds(),
|
||||
dmeFrameRateSrc.GetFramesPerSecond(),
|
||||
ComputeDmElementIdStr( pDmeSequenceSrc ).Get(),
|
||||
pDmeChannelsClipSrc->GetEndTime().GetSeconds() );
|
||||
}
|
||||
|
||||
// Match up channels by name.
|
||||
for ( int i = 0; i < pDmeChannelsClipDst->m_Channels.Count(); ++i )
|
||||
{
|
||||
CDmeChannel *pDmeChannelDst = pDmeChannelsClipDst->m_Channels[i];
|
||||
if ( !pDmeChannelDst )
|
||||
continue;
|
||||
|
||||
CDmeLog *pDmeLogDst = pDmeChannelDst->GetLog();
|
||||
if ( !pDmeLogDst )
|
||||
continue;
|
||||
|
||||
const char *pszDmeChannelName = pDmeChannelDst->GetName();
|
||||
|
||||
CDmeVector3Log *pDmeVector3LogDst = CastElement< CDmeVector3Log >( pDmeLogDst );
|
||||
CDmeQuaternionLog *pDmeQuaternionLogDst = CastElement< CDmeQuaternionLog >( pDmeLogDst );
|
||||
|
||||
bool bFound = false;
|
||||
|
||||
for ( int j = 0; j < pDmeChannelsClipSrc->m_Channels.Count(); ++j )
|
||||
{
|
||||
CDmeChannel *pDmeChannelSrc = pDmeChannelsClipSrc->m_Channels[j];
|
||||
if ( !pDmeChannelSrc || Q_stricmp( pszDmeChannelName, pDmeChannelSrc->GetName() ) )
|
||||
continue;
|
||||
|
||||
CDmeLog *pDmeLogSrc = pDmeChannelSrc->GetLog();
|
||||
if ( !pDmeLogDst )
|
||||
continue;
|
||||
|
||||
CDmeVector3Log *pDmeVector3LogSrc = CastElement< CDmeVector3Log >( pDmeLogSrc );
|
||||
if ( pDmeVector3LogSrc && pDmeVector3LogDst )
|
||||
{
|
||||
Subtract( pDmeVector3LogDst, pDmeVector3LogSrc, dmeTimeSrc );
|
||||
bFound = true;
|
||||
continue;
|
||||
}
|
||||
|
||||
CDmeQuaternionLog *pDmeQuaternionLogSrc = CastElement< CDmeQuaternionLog >( pDmeLogSrc );
|
||||
if ( pDmeQuaternionLogSrc && pDmeQuaternionLogDst )
|
||||
{
|
||||
Subtract( pDmeQuaternionLogDst, pDmeQuaternionLogSrc, dmeTimeSrc );
|
||||
bFound = true;
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
if ( !bFound )
|
||||
{
|
||||
Log_Warning( LOG_DME_AAC, "%s: No Channel Found To Subtract From %s\n",
|
||||
ComputeDmElementIdStr( this ).Get(),
|
||||
ComputeDmElementIdStr( pDmeChannelDst ).Get() );
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
//
|
||||
//-----------------------------------------------------------------------------
|
||||
template< class T > void CDmeSubtract::Subtract(
|
||||
CDmeTypedLog< T > *pDmeTypedLogDst,
|
||||
const CDmeTypedLog< T > *pDmeTypedLogSrc,
|
||||
const DmeTime_t &dmeTimeSrc ) const
|
||||
{
|
||||
const T valueSrc = pDmeTypedLogSrc->GetValue( dmeTimeSrc );
|
||||
|
||||
CUtlVector< DmeTime_t > times;
|
||||
CUtlVector< T > values;
|
||||
|
||||
T valueDst;
|
||||
|
||||
for ( int i = 0; i < pDmeTypedLogDst->GetKeyCount(); ++i )
|
||||
{
|
||||
times.AddToTail( pDmeTypedLogDst->GetKeyTime( i ) );
|
||||
Subtract( valueDst, pDmeTypedLogDst->GetKeyValue( i ), valueSrc );
|
||||
values.AddToTail( valueDst );
|
||||
}
|
||||
|
||||
CDmeTypedLogLayer< T > *pDmeTypedLogLayer = CastElement< CDmeTypedLogLayer< T > >( pDmeTypedLogDst->AddNewLayer() );
|
||||
if ( pDmeTypedLogLayer )
|
||||
{
|
||||
pDmeTypedLogLayer->SetAllKeys( times, values );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
//
|
||||
//-----------------------------------------------------------------------------
|
||||
void CDmeSubtract::Subtract( Vector &vResult, const Vector &vDst, const Vector &vSrc ) const
|
||||
{
|
||||
VectorSubtract( vDst, vSrc, vResult );
|
||||
}
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
//
|
||||
//-----------------------------------------------------------------------------
|
||||
void CDmeSubtract::Subtract( Quaternion &qResult, const Quaternion &qDst, const Quaternion &qSrc ) const
|
||||
{
|
||||
QuaternionSM( -1, qSrc, qDst, qResult );
|
||||
}
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Expose this class to the scene database
|
||||
//-----------------------------------------------------------------------------
|
||||
IMPLEMENT_ELEMENT_FACTORY( DmePreSubtract, CDmePreSubtract );
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
//
|
||||
//-----------------------------------------------------------------------------
|
||||
void CDmePreSubtract::OnConstruction()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
//
|
||||
//-----------------------------------------------------------------------------
|
||||
void CDmePreSubtract::OnDestruction()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
//
|
||||
//-----------------------------------------------------------------------------
|
||||
void CDmePreSubtract::Subtract( Vector &vResult, const Vector &vDst, const Vector &vSrc ) const
|
||||
{
|
||||
VectorSubtract( vSrc, vDst, vResult );
|
||||
}
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
//
|
||||
//-----------------------------------------------------------------------------
|
||||
void CDmePreSubtract::Subtract( Quaternion &qResult, const Quaternion &qDst, const Quaternion &qSrc ) const
|
||||
{
|
||||
QuaternionMA( qDst, -1, qSrc, qResult );
|
||||
}
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Expose this class to the scene database
|
||||
//-----------------------------------------------------------------------------
|
||||
IMPLEMENT_ELEMENT_FACTORY( DmeRotateTo, CDmeRotateTo );
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
//
|
||||
//-----------------------------------------------------------------------------
|
||||
void CDmeRotateTo::OnConstruction()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
//
|
||||
//-----------------------------------------------------------------------------
|
||||
void CDmeRotateTo::OnDestruction()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
//
|
||||
//-----------------------------------------------------------------------------
|
||||
bool CDmeRotateTo::Apply( CDmElement *pDmElement )
|
||||
{
|
||||
CDmeSequence *pDmeSequenceDst = NULL;
|
||||
CDmeChannelsClip *pDmeChannelsClipDst = NULL;
|
||||
|
||||
if ( !ConvertToDmeSequenceAndDmeChannelsClip( pDmeSequenceDst, pDmeChannelsClipDst, pDmElement, ComputeDmElementIdStr( this ) ) )
|
||||
return false;
|
||||
|
||||
CDmeDag *pDmeDag = pDmeSequenceDst->m_eSkeleton.GetElement();
|
||||
if ( !pDmeDag )
|
||||
{
|
||||
Log_Error( LOG_DME_AAC, "%s: Specified Sequence %s Has No Skeleton\n", ComputeDmElementIdStr( this ).Get(), ComputeDmElementIdStr( pDmeSequenceDst ).Get() );
|
||||
return false;
|
||||
}
|
||||
|
||||
// If the skeleton is a CDmeModel then all children of the skeleton
|
||||
// are nodes that have no parent, i.e. root nodes which must be
|
||||
// adjusted, otherwise if it's a normal DmeDag assume it's the only
|
||||
// root node of the skeleton
|
||||
CDmeModel *pDmeModel = CastElement< CDmeModel >( pDmeDag );
|
||||
if ( pDmeModel )
|
||||
{
|
||||
for ( int i = 0; i < pDmeModel->GetChildCount(); ++i )
|
||||
{
|
||||
SubApply( pDmeModel->GetChild( i ), pDmeChannelsClipDst, pDmeModel->IsZUp() );
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
Log_Warning( LOG_DME_AAC, "%s: Cannot Determine If Sequence %s Is Y Or Z Up, Assuming Z Up\n", ComputeDmElementIdStr( this ).Get(), ComputeDmElementIdStr( pDmeSequenceDst ).Get() );
|
||||
SubApply( pDmeDag, pDmeChannelsClipDst, true );
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Find the translate & rotate channels and logs which refer to the specified
|
||||
// DmeDag
|
||||
//-----------------------------------------------------------------------------
|
||||
static bool GetDmeChannelsForDag(
|
||||
CDmeTypedLog< Vector > *&pDmeTranslateLog,
|
||||
CDmeTypedLog< Quaternion > *&pDmeRotateLog,
|
||||
CDmeDag *pDmeDag,
|
||||
CDmeChannelsClip *pDmeChannelsClip )
|
||||
{
|
||||
pDmeTranslateLog = NULL;
|
||||
pDmeRotateLog = NULL;
|
||||
|
||||
if ( !pDmeDag || !pDmeChannelsClip )
|
||||
return false;
|
||||
|
||||
CDmeTransform *pDmeTransform = pDmeDag->GetTransform();
|
||||
if ( !pDmeTransform )
|
||||
return false;
|
||||
|
||||
for ( int i = 0; pDmeChannelsClip->m_Channels.Count(); ++i )
|
||||
{
|
||||
CDmeChannel *pDmeChannel = pDmeChannelsClip->m_Channels[i];
|
||||
if ( !pDmeChannel )
|
||||
continue;
|
||||
|
||||
if ( pDmeChannel->GetToElement() != pDmeTransform )
|
||||
continue;
|
||||
|
||||
CDmeLog *pDmeLog = pDmeChannel->GetLog();
|
||||
if ( !pDmeLog )
|
||||
continue;
|
||||
|
||||
CDmeTypedLog< Vector > *pDmeTranslateLogTmp = CastElement< CDmeTypedLog< Vector > >( pDmeLog );
|
||||
if ( pDmeTranslateLogTmp )
|
||||
{
|
||||
if ( pDmeTranslateLog == NULL )
|
||||
{
|
||||
pDmeTranslateLog = pDmeTranslateLogTmp;
|
||||
// Quit if we've found both translate & rotate
|
||||
if ( pDmeRotateLog )
|
||||
break;
|
||||
}
|
||||
else
|
||||
{
|
||||
Log_Warning( LOG_DME_AAC, "%s: Multiple Translate Channels Found For Dag, Using %s, Ignoring %s\n",
|
||||
ComputeDmElementIdStr( pDmeDag ).Get(),
|
||||
ComputeDmElementIdStr( pDmeTranslateLog ).Get(),
|
||||
ComputeDmElementIdStr( pDmeChannel ).Get() );
|
||||
}
|
||||
|
||||
continue;
|
||||
}
|
||||
|
||||
CDmeTypedLog< Quaternion > *pDmeRotateLogTmp = CastElement< CDmeTypedLog< Quaternion > >( pDmeLog );
|
||||
if ( pDmeRotateLogTmp )
|
||||
{
|
||||
if ( pDmeRotateLog == NULL )
|
||||
{
|
||||
pDmeRotateLog = pDmeRotateLogTmp;
|
||||
// Quit if we've found both translate & rotate
|
||||
if ( pDmeTranslateLog )
|
||||
break;
|
||||
}
|
||||
else
|
||||
{
|
||||
Log_Warning( LOG_DME_AAC, "%s: Multiple Rotate Channels Found For Dag, Using %s, Ignoring %s\n",
|
||||
ComputeDmElementIdStr( pDmeDag ).Get(),
|
||||
ComputeDmElementIdStr( pDmeRotateLog ).Get(),
|
||||
ComputeDmElementIdStr( pDmeChannel ).Get() );
|
||||
}
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
return pDmeTranslateLog != NULL && pDmeRotateLog != NULL;
|
||||
}
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
//
|
||||
//-----------------------------------------------------------------------------
|
||||
static void ComputeMergedKeyTimes(
|
||||
CUtlVector< DmeTime_t > &mergedTimes,
|
||||
CDmeLog *pDmeLogA,
|
||||
CDmeLog *pDmeLogB )
|
||||
{
|
||||
mergedTimes.RemoveAll();
|
||||
|
||||
CUtlRBTree< DmeTime_t > timesTree( CDefOps< DmeTime_t >::LessFunc );
|
||||
|
||||
for ( int i = 0; i < 2; ++i )
|
||||
{
|
||||
CDmeLog *pDmeLog = ( i == 0 ) ? pDmeLogA : pDmeLogB;
|
||||
if ( !pDmeLog )
|
||||
continue;
|
||||
|
||||
for ( int j = 0; j < pDmeLog->GetKeyCount(); ++j )
|
||||
{
|
||||
timesTree.InsertIfNotFound( pDmeLog->GetKeyTime( j ) );
|
||||
}
|
||||
}
|
||||
|
||||
for ( CUtlRBTree< DmeTime_t >::IndexType_t i = timesTree.FirstInorder(); timesTree.IsValidIndex( i ); i = timesTree.NextInorder( i ) )
|
||||
{
|
||||
mergedTimes.AddToTail( timesTree.Element( i ) );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
//
|
||||
//-----------------------------------------------------------------------------
|
||||
template < class T >
|
||||
static void GetAllKeys(
|
||||
CUtlVector< DmeTime_t > &keyTimes,
|
||||
CUtlVector< T > &keyValues,
|
||||
CDmeTypedLog< T > *pDmeTypedLog )
|
||||
{
|
||||
keyTimes.RemoveAll();
|
||||
keyValues.RemoveAll();
|
||||
|
||||
const int nKeyCount = pDmeTypedLog->GetKeyCount();
|
||||
if ( nKeyCount <= 0 )
|
||||
return;
|
||||
|
||||
keyTimes.EnsureCapacity( nKeyCount );
|
||||
keyValues.EnsureCapacity( nKeyCount );
|
||||
|
||||
Assert( keyTimes.Count() == 0 );
|
||||
Assert( keyValues.Count() == 0 );
|
||||
|
||||
for ( int i = 0; i < nKeyCount; ++i )
|
||||
{
|
||||
keyTimes.AddToTail( pDmeTypedLog->GetKeyTime( i ) );
|
||||
keyValues.AddToTail( pDmeTypedLog->GetKeyValue( i ) );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
//
|
||||
//-----------------------------------------------------------------------------
|
||||
void CDmeRotateTo::SubApply( CDmeDag *pDmeDag, CDmeChannelsClip *pDmeChannelsClip, bool bZUp )
|
||||
{
|
||||
if ( !pDmeDag || !pDmeChannelsClip )
|
||||
return;
|
||||
|
||||
CDmeTransform *pDmeTransform = pDmeDag->GetTransform();
|
||||
if ( !pDmeTransform )
|
||||
return;
|
||||
|
||||
CDmeTypedLog< Vector > *pDmeTranslateLog = NULL;
|
||||
CDmeTypedLog< Quaternion > *pDmeRotateLog = NULL;
|
||||
|
||||
if ( !GetDmeChannelsForDag( pDmeTranslateLog, pDmeRotateLog, pDmeDag, pDmeChannelsClip ) )
|
||||
{
|
||||
Log_Error( LOG_DME_AAC, "%s: Couldn't Find Translate & Rotate channels for DmeDag %s\n",
|
||||
ComputeDmElementIdStr( this ).Get(),
|
||||
ComputeDmElementIdStr( pDmeDag ).Get() );
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
Assert( pDmeTranslateLog && pDmeRotateLog );
|
||||
|
||||
matrix3x4_t mRoot;
|
||||
|
||||
{
|
||||
float flDeltaAngle = 0.0f;
|
||||
|
||||
const DmeTime_t dmeTimeBegin = pDmeTranslateLog->GetBeginTime();
|
||||
const DmeTime_t dmeTimeEnd = pDmeTranslateLog->GetEndTime();
|
||||
|
||||
const Vector vPos( pDmeTranslateLog->GetValue( dmeTimeEnd ) - pDmeTranslateLog->GetValue( dmeTimeBegin ) );
|
||||
|
||||
// TODO: Handle Y/Z Up
|
||||
|
||||
if ( bZUp )
|
||||
{
|
||||
// ZUp
|
||||
if ( vPos.x != 0.0f || vPos.y != 0.0f )
|
||||
{
|
||||
const float flAngle = atan2( vPos.y, vPos.x ) * ( 180.0f / M_PI );
|
||||
flDeltaAngle = m_flAngle.Get() - flAngle;
|
||||
}
|
||||
|
||||
AngleMatrix( QAngle( 0.0f, flDeltaAngle, 0.0f ), mRoot );
|
||||
}
|
||||
else
|
||||
{
|
||||
// YUp
|
||||
if ( vPos.x != 0.0f || vPos.z != 0.0f )
|
||||
{
|
||||
const float flAngle = atan2( vPos.x, vPos.z ) * ( 180.0f / M_PI );
|
||||
flDeltaAngle = m_flAngle.Get() - flAngle;
|
||||
}
|
||||
|
||||
AngleMatrix( QAngle( flDeltaAngle, 0.0f, 0.0f ), mRoot );
|
||||
}
|
||||
}
|
||||
|
||||
matrix3x4_t mSrc;
|
||||
matrix3x4_t mDst;
|
||||
|
||||
CUtlVector< DmeTime_t > mergedKeyTimes;
|
||||
ComputeMergedKeyTimes( mergedKeyTimes, pDmeTranslateLog, pDmeRotateLog );
|
||||
|
||||
Vector vTmp;
|
||||
CUtlVector< Vector > vValues;
|
||||
|
||||
Quaternion qTmp;
|
||||
CUtlVector< Quaternion > qValues;
|
||||
|
||||
for ( int i = 0; i < mergedKeyTimes.Count(); ++i )
|
||||
{
|
||||
const DmeTime_t &dmeTime = mergedKeyTimes[i];
|
||||
AngleMatrix( RadianEuler( pDmeRotateLog->GetValue( dmeTime ) ), pDmeTranslateLog->GetValue( dmeTime ), mSrc );
|
||||
ConcatTransforms( mRoot, mSrc, mDst );
|
||||
MatrixAngles( mDst, qTmp, vTmp );
|
||||
vValues.AddToTail( vTmp );
|
||||
qValues.AddToTail( qTmp );
|
||||
}
|
||||
|
||||
CDmeTypedLogLayer< Vector > *pDmeTranslateLayer = CastElement< CDmeTypedLogLayer< Vector > >( pDmeTranslateLog->AddNewLayer() );
|
||||
if ( pDmeTranslateLayer )
|
||||
{
|
||||
pDmeTranslateLayer->SetAllKeys( mergedKeyTimes, vValues );
|
||||
pDmeTranslateLayer->RemoveRedundantKeys( true );
|
||||
}
|
||||
else
|
||||
{
|
||||
Log_Error( LOG_DME_AAC, "%s: Couldn't Create Translate Layer\n", ComputeDmElementIdStr( this ).Get() );
|
||||
}
|
||||
|
||||
CDmeTypedLogLayer< Quaternion > *pDmeRotateLayer = CastElement< CDmeTypedLogLayer< Quaternion > >( pDmeRotateLog->AddNewLayer() );
|
||||
if ( pDmeRotateLayer )
|
||||
{
|
||||
pDmeRotateLayer->SetAllKeys( mergedKeyTimes, qValues );
|
||||
pDmeRotateLayer->RemoveRedundantKeys( true );
|
||||
}
|
||||
else
|
||||
{
|
||||
Log_Error( LOG_DME_AAC, "%s: Couldn't Create Rotate Layer\n", ComputeDmElementIdStr( this ).Get() );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Expose this class to the scene database
|
||||
//-----------------------------------------------------------------------------
|
||||
IMPLEMENT_ELEMENT_FACTORY( DmeBoneMaskCmd, CDmeBoneMaskCmd );
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
//
|
||||
//-----------------------------------------------------------------------------
|
||||
void CDmeBoneMaskCmd::OnConstruction()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
//
|
||||
//-----------------------------------------------------------------------------
|
||||
void CDmeBoneMaskCmd::OnDestruction()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
//
|
||||
//-----------------------------------------------------------------------------
|
||||
bool CDmeBoneMaskCmd::Apply( CDmElement *pDmElement )
|
||||
{
|
||||
CDmeSequence *pDmeSequenceDst = NULL;
|
||||
CDmeChannelsClip *pDmeChannelsClipDst = NULL;
|
||||
|
||||
if ( !ConvertToDmeSequenceAndDmeChannelsClip( pDmeSequenceDst, pDmeChannelsClipDst, pDmElement, ComputeDmElementIdStr( this ) ) )
|
||||
return false;
|
||||
|
||||
CDmeDag *pDmeDag = pDmeSequenceDst->m_eSkeleton.GetElement();
|
||||
if ( !pDmeDag )
|
||||
{
|
||||
Log_Error( LOG_DME_AAC, "%s: Specified Sequence %s Has No Skeleton\n", ComputeDmElementIdStr( this ).Get(), ComputeDmElementIdStr( pDmeSequenceDst ).Get() );
|
||||
return false;
|
||||
}
|
||||
|
||||
CDmeBoneMask *pDmeBoneMask = pDmeSequenceDst->m_eBoneMask.GetElement();
|
||||
if ( !pDmeBoneMask )
|
||||
{
|
||||
Log_Error( LOG_DME_AAC, "%s: Specified Sequence %s Has No Bone Mask\n", ComputeDmElementIdStr( this ).Get(), ComputeDmElementIdStr( pDmeSequenceDst ).Get() );
|
||||
return false;
|
||||
}
|
||||
|
||||
CUtlStack< CDmeDag * > depthFirstStack;
|
||||
depthFirstStack.Push( pDmeDag );
|
||||
|
||||
while ( depthFirstStack.Count() )
|
||||
{
|
||||
depthFirstStack.Pop( pDmeDag );
|
||||
if ( !pDmeDag )
|
||||
continue;
|
||||
|
||||
for ( int i = pDmeDag->GetChildCount() - 1; i >= 0; --i )
|
||||
{
|
||||
depthFirstStack.Push( pDmeDag->GetChild( i ) );
|
||||
}
|
||||
|
||||
SubApply( pDmeChannelsClipDst, pDmeDag, pDmeBoneMask );
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
//
|
||||
//-----------------------------------------------------------------------------
|
||||
void CDmeBoneMaskCmd::SubApply( CDmeChannelsClip *pDmeChannelsClip, CDmeDag *pDmeDag, CDmeBoneMask *pDmeBoneMask )
|
||||
{
|
||||
if ( !pDmeChannelsClip || !pDmeDag || !pDmeBoneMask )
|
||||
return;
|
||||
|
||||
const float flWeight = pDmeBoneMask->GetBoneWeight( pDmeDag->GetName() );
|
||||
|
||||
// Nothing to do if full weight
|
||||
if ( flWeight == 1.0f )
|
||||
return;
|
||||
|
||||
CDmeTransform *pDmeTransform = pDmeDag->GetTransform();
|
||||
if ( !pDmeTransform )
|
||||
return;
|
||||
|
||||
CDmeTypedLog< Vector > *pDmeTranslateLog = NULL;
|
||||
CDmeTypedLog< Quaternion > *pDmeRotateLog = NULL;
|
||||
|
||||
if ( !GetDmeChannelsForDag( pDmeTranslateLog, pDmeRotateLog, pDmeDag, pDmeChannelsClip ) )
|
||||
{
|
||||
Log_Error( LOG_DME_AAC, "%s: Couldn't Find Translate & Rotate channels for DmeDag %s\n",
|
||||
ComputeDmElementIdStr( this ).Get(),
|
||||
ComputeDmElementIdStr( pDmeDag ).Get() );
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
Vector vTmp;
|
||||
CUtlVector< DmeTime_t > vTimes;
|
||||
CUtlVector< Vector > vValues;
|
||||
|
||||
GetAllKeys( vTimes, vValues, pDmeTranslateLog );
|
||||
|
||||
for ( int i = 0; i < vValues.Count(); ++i )
|
||||
{
|
||||
VectorScale( vValues[i], flWeight, vTmp );
|
||||
vValues[i] = vTmp;
|
||||
}
|
||||
|
||||
Quaternion qTmp;
|
||||
CUtlVector< DmeTime_t > qTimes;
|
||||
CUtlVector< Quaternion > qValues;
|
||||
|
||||
GetAllKeys( qTimes, qValues, pDmeRotateLog );
|
||||
|
||||
for ( int i = 0; i < qValues.Count(); ++i )
|
||||
{
|
||||
QuaternionScale( qValues[i], flWeight, qTmp );
|
||||
qValues[i] = qTmp;
|
||||
}
|
||||
|
||||
CDmeTypedLogLayer< Vector > *pDmeTranslateLayer = CastElement< CDmeTypedLogLayer< Vector > >( pDmeTranslateLog->AddNewLayer() );
|
||||
if ( pDmeTranslateLayer )
|
||||
{
|
||||
pDmeTranslateLayer->SetAllKeys( vTimes, vValues );
|
||||
pDmeTranslateLayer->RemoveRedundantKeys( true );
|
||||
}
|
||||
else
|
||||
{
|
||||
Log_Error( LOG_DME_AAC, "%s: Couldn't Create Translate Layer\n", ComputeDmElementIdStr( this ).Get() );
|
||||
}
|
||||
|
||||
CDmeTypedLogLayer< Quaternion > *pDmeRotateLayer = CastElement< CDmeTypedLogLayer< Quaternion > >( pDmeRotateLog->AddNewLayer() );
|
||||
if ( pDmeRotateLayer )
|
||||
{
|
||||
pDmeRotateLayer->SetAllKeys( qTimes, qValues );
|
||||
pDmeRotateLayer->RemoveRedundantKeys( true );
|
||||
}
|
||||
else
|
||||
{
|
||||
Log_Error( LOG_DME_AAC, "%s: Couldn't Create Rotate Layer\n", ComputeDmElementIdStr( this ).Get() );
|
||||
}
|
||||
}
|
38
mdlobjects/dmeanimblocksize.cpp
Normal file
38
mdlobjects/dmeanimblocksize.cpp
Normal file
@ -0,0 +1,38 @@
|
||||
//===== Copyright (c) 1996-2009, Valve Corporation, All rights reserved. ====
|
||||
//
|
||||
// Dme $animblocksize
|
||||
//
|
||||
//===========================================================================
|
||||
|
||||
|
||||
#include "mdlobjects/dmeanimblocksize.h"
|
||||
#include "datamodel/dmelementfactoryhelper.h"
|
||||
|
||||
|
||||
// memdbgon must be the last include file in a .cpp file!!!
|
||||
#include "tier0/memdbgon.h"
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Expose this class to the scene database
|
||||
//-----------------------------------------------------------------------------
|
||||
IMPLEMENT_ELEMENT_FACTORY( DmeAnimBlockSize, CDmeAnimBlockSize );
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Purpose:
|
||||
//-----------------------------------------------------------------------------
|
||||
void CDmeAnimBlockSize::OnConstruction()
|
||||
{
|
||||
m_nSize.Init( this, "size" );
|
||||
m_bStall.InitAndSet( this, "stall", true );
|
||||
m_nStorageType.InitAndSet( this, "storageType", ANIMBLOCKSTORAGETYPE_LOWRES );
|
||||
}
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
//
|
||||
//-----------------------------------------------------------------------------
|
||||
void CDmeAnimBlockSize::OnDestruction()
|
||||
{
|
||||
}
|
434
mdlobjects/dmeanimcmd.cpp
Normal file
434
mdlobjects/dmeanimcmd.cpp
Normal file
@ -0,0 +1,434 @@
|
||||
//===== Copyright (c) 1996-2009, Valve Corporation, All rights reserved. ====
|
||||
//
|
||||
// Animation commands
|
||||
//
|
||||
//==========================================================================
|
||||
|
||||
|
||||
// Valve includes
|
||||
#include "datamodel/dmelementfactoryhelper.h"
|
||||
#include "mdlobjects/dmeanimcmd.h"
|
||||
#include "mdlobjects/dmemotioncontrol.h"
|
||||
#include "mdlobjects/dmesequence.h"
|
||||
#include "mdlobjects/dmeanimationassemblycommand.h"
|
||||
#include "movieobjects/dmechannel.h"
|
||||
#include "bone_setup.h"
|
||||
|
||||
|
||||
// memdbgon must be the last include file in a .cpp file!!!
|
||||
#include "tier0/memdbgon.h"
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Expose this class to the scene database
|
||||
//-----------------------------------------------------------------------------
|
||||
IMPLEMENT_ELEMENT_FACTORY( DmeAnimCmd, CDmeAnimCmd );
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
//
|
||||
//-----------------------------------------------------------------------------
|
||||
void CDmeAnimCmd::OnConstruction()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
//
|
||||
//-----------------------------------------------------------------------------
|
||||
void CDmeAnimCmd::OnDestruction()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Expose this class to the scene database
|
||||
//-----------------------------------------------------------------------------
|
||||
IMPLEMENT_ELEMENT_FACTORY( DmeAnimCmdFixupLoop, CDmeAnimCmdFixupLoop );
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
//
|
||||
//-----------------------------------------------------------------------------
|
||||
void CDmeAnimCmdFixupLoop::OnConstruction()
|
||||
{
|
||||
m_nStartFrame.Init( this, "startFrame" );
|
||||
m_nEndFrame.Init( this, "endFrame" );
|
||||
}
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
//
|
||||
//-----------------------------------------------------------------------------
|
||||
void CDmeAnimCmdFixupLoop::OnDestruction()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
//
|
||||
//-----------------------------------------------------------------------------
|
||||
const char *CDmeAnimCmdFixupLoop::GetAssemblyDmElementTypeString()
|
||||
{
|
||||
return CDmeFixupLoop::GetStaticTypeSymbol().String();
|
||||
}
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Expose this class to the scene database
|
||||
//-----------------------------------------------------------------------------
|
||||
IMPLEMENT_ELEMENT_FACTORY( DmeAnimCmdWeightList, CDmeAnimCmdWeightList );
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
//
|
||||
//-----------------------------------------------------------------------------
|
||||
void CDmeAnimCmdWeightList::OnConstruction()
|
||||
{
|
||||
m_sWeightListName.Init( this, "weightListName" );
|
||||
}
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
//
|
||||
//-----------------------------------------------------------------------------
|
||||
void CDmeAnimCmdWeightList::OnDestruction()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Expose this class to the scene database
|
||||
//-----------------------------------------------------------------------------
|
||||
IMPLEMENT_ELEMENT_FACTORY( DmeAnimCmdSubtract, CDmeAnimCmdSubtract );
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
//
|
||||
//-----------------------------------------------------------------------------
|
||||
void CDmeAnimCmdSubtract::OnConstruction()
|
||||
{
|
||||
m_eAnimation.Init( this, "animation", FATTRIB_NEVERCOPY );
|
||||
m_nFrame.Init( this, "frame" );
|
||||
}
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
//
|
||||
//-----------------------------------------------------------------------------
|
||||
void CDmeAnimCmdSubtract::OnDestruction()
|
||||
{
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
//
|
||||
//-----------------------------------------------------------------------------
|
||||
const char *CDmeAnimCmdSubtract::GetAssemblyDmElementTypeString()
|
||||
{
|
||||
return CDmeSubtract::GetStaticTypeSymbol().String();
|
||||
}
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Expose this class to the scene database
|
||||
//-----------------------------------------------------------------------------
|
||||
IMPLEMENT_ELEMENT_FACTORY( DmeAnimCmdPreSubtract, CDmeAnimCmdPreSubtract );
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
//
|
||||
//-----------------------------------------------------------------------------
|
||||
void CDmeAnimCmdPreSubtract::OnConstruction()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
//
|
||||
//-----------------------------------------------------------------------------
|
||||
void CDmeAnimCmdPreSubtract::OnDestruction()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
//
|
||||
//-----------------------------------------------------------------------------
|
||||
const char *CDmeAnimCmdPreSubtract::GetAssemblyDmElementTypeString()
|
||||
{
|
||||
return CDmePreSubtract::GetStaticTypeSymbol().String();
|
||||
}
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// CDmeAnimCmdAlign
|
||||
//-----------------------------------------------------------------------------
|
||||
//-----------------------------------------------------------------------------
|
||||
// Expose this class to the scene database
|
||||
//-----------------------------------------------------------------------------
|
||||
IMPLEMENT_ELEMENT_FACTORY( DmeAnimCmdAlign, CDmeAnimCmdAlign );
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
//
|
||||
//-----------------------------------------------------------------------------
|
||||
void CDmeAnimCmdAlign::OnConstruction()
|
||||
{
|
||||
m_eAnimation.Init( this, "animation", FATTRIB_NEVERCOPY );
|
||||
m_sBoneName.Init( this, "boneName" );
|
||||
m_nSourceFrame.Init( this, "sourceFrame" );
|
||||
m_nDestinatonFrame.Init( this, "destinationFrame" );
|
||||
m_eMotionControl.InitAndCreate( this, "motionControl" );
|
||||
}
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
//
|
||||
//-----------------------------------------------------------------------------
|
||||
void CDmeAnimCmdAlign::OnDestruction()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// CDmeAnimCmdRotateTo
|
||||
//-----------------------------------------------------------------------------
|
||||
//-----------------------------------------------------------------------------
|
||||
// Expose this class to the scene database
|
||||
//-----------------------------------------------------------------------------
|
||||
IMPLEMENT_ELEMENT_FACTORY( DmeAnimCmdRotateTo, CDmeAnimCmdRotateTo );
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
//
|
||||
//-----------------------------------------------------------------------------
|
||||
void CDmeAnimCmdRotateTo::OnConstruction()
|
||||
{
|
||||
m_flAngle.Init( this, "angle" );
|
||||
}
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
//
|
||||
//-----------------------------------------------------------------------------
|
||||
void CDmeAnimCmdRotateTo::OnDestruction()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
//
|
||||
//-----------------------------------------------------------------------------
|
||||
const char *CDmeAnimCmdRotateTo::GetAssemblyDmElementTypeString()
|
||||
{
|
||||
return CDmeRotateTo::GetStaticTypeSymbol().String();
|
||||
}
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Expose this class to the scene database
|
||||
//-----------------------------------------------------------------------------
|
||||
IMPLEMENT_ELEMENT_FACTORY( DmeAnimCmdWalkFrame, CDmeAnimCmdWalkFrame );
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
//
|
||||
//-----------------------------------------------------------------------------
|
||||
void CDmeAnimCmdWalkFrame::OnConstruction()
|
||||
{
|
||||
m_eMotionControl.InitAndCreate( this, "motionControl" );
|
||||
m_nEndFrame.Init( this, "endFrame" );
|
||||
}
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
//
|
||||
//-----------------------------------------------------------------------------
|
||||
void CDmeAnimCmdWalkFrame::OnDestruction()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// CDmeAnimCmdDerivative
|
||||
//-----------------------------------------------------------------------------
|
||||
//-----------------------------------------------------------------------------
|
||||
// Expose this class to the scene database
|
||||
//-----------------------------------------------------------------------------
|
||||
IMPLEMENT_ELEMENT_FACTORY( DmeAnimCmdDerivative, CDmeAnimCmdDerivative );
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
//
|
||||
//-----------------------------------------------------------------------------
|
||||
void CDmeAnimCmdDerivative::OnConstruction()
|
||||
{
|
||||
m_flScale.InitAndSet( this, "scale", 1.0f );
|
||||
}
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
//
|
||||
//-----------------------------------------------------------------------------
|
||||
void CDmeAnimCmdDerivative::OnDestruction()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// CDmeAnimCmdLinearDelta
|
||||
//-----------------------------------------------------------------------------
|
||||
//-----------------------------------------------------------------------------
|
||||
// Expose this class to the scene database
|
||||
//-----------------------------------------------------------------------------
|
||||
IMPLEMENT_ELEMENT_FACTORY( DmeAnimCmdLinearDelta, CDmeAnimCmdLinearDelta );
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
//
|
||||
//-----------------------------------------------------------------------------
|
||||
void CDmeAnimCmdLinearDelta::OnConstruction()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
//
|
||||
//-----------------------------------------------------------------------------
|
||||
void CDmeAnimCmdLinearDelta::OnDestruction()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// CDmeAnimCmdSplineDelta
|
||||
//-----------------------------------------------------------------------------
|
||||
//-----------------------------------------------------------------------------
|
||||
// Expose this class to the scene database
|
||||
//-----------------------------------------------------------------------------
|
||||
IMPLEMENT_ELEMENT_FACTORY( DmeAnimCmdSplineDelta, CDmeAnimCmdSplineDelta );
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
//
|
||||
//-----------------------------------------------------------------------------
|
||||
void CDmeAnimCmdSplineDelta::OnConstruction()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
//
|
||||
//-----------------------------------------------------------------------------
|
||||
void CDmeAnimCmdSplineDelta::OnDestruction()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// CDmeAnimCmdCompress
|
||||
//-----------------------------------------------------------------------------
|
||||
//-----------------------------------------------------------------------------
|
||||
// Expose this class to the scene database
|
||||
//-----------------------------------------------------------------------------
|
||||
IMPLEMENT_ELEMENT_FACTORY( DmeAnimCmdCompress, CDmeAnimCmdCompress );
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
//
|
||||
//-----------------------------------------------------------------------------
|
||||
void CDmeAnimCmdCompress::OnConstruction()
|
||||
{
|
||||
m_nSkipFrames.Init( this, "skipFrames" );
|
||||
}
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
//
|
||||
//-----------------------------------------------------------------------------
|
||||
void CDmeAnimCmdCompress::OnDestruction()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// CDmeAnimCmdNumFrames
|
||||
//-----------------------------------------------------------------------------
|
||||
//-----------------------------------------------------------------------------
|
||||
// Expose this class to the scene database
|
||||
//-----------------------------------------------------------------------------
|
||||
IMPLEMENT_ELEMENT_FACTORY( DmeAnimCmdNumFrames, CDmeAnimCmdNumFrames );
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
//
|
||||
//-----------------------------------------------------------------------------
|
||||
void CDmeAnimCmdNumFrames::OnConstruction()
|
||||
{
|
||||
m_nFrames.Init( this, "frames" );
|
||||
}
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
//
|
||||
//-----------------------------------------------------------------------------
|
||||
void CDmeAnimCmdNumFrames::OnDestruction()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// CDmeAnimCmdLocalHierarchy
|
||||
//-----------------------------------------------------------------------------
|
||||
//-----------------------------------------------------------------------------
|
||||
// Expose this class to the scene database
|
||||
//-----------------------------------------------------------------------------
|
||||
IMPLEMENT_ELEMENT_FACTORY( DmeAnimCmdLocalHierarchy, CDmeAnimCmdLocalHierarchy );
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
//
|
||||
//-----------------------------------------------------------------------------
|
||||
void CDmeAnimCmdLocalHierarchy::OnConstruction()
|
||||
{
|
||||
m_sBoneName.Init( this, "boneName" );
|
||||
m_sParentBoneName.Init( this, "parentBoneName" );
|
||||
m_flStartFrame.Init( this, "startFrame" );
|
||||
m_flPeakFrame.Init( this, "peakFrame" );
|
||||
m_flTailFrame.Init( this, "tailFrame" );
|
||||
m_flEndFrame.Init( this, "endFrame" );
|
||||
}
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
//
|
||||
//-----------------------------------------------------------------------------
|
||||
void CDmeAnimCmdLocalHierarchy::OnDestruction()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// CDmeAnimCmdNoAnimation
|
||||
//-----------------------------------------------------------------------------
|
||||
//-----------------------------------------------------------------------------
|
||||
// Expose this class to the scene database
|
||||
//-----------------------------------------------------------------------------
|
||||
IMPLEMENT_ELEMENT_FACTORY( DmeAnimCmdNoAnimation, CDmeAnimCmdNoAnimation );
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
//
|
||||
//-----------------------------------------------------------------------------
|
||||
void CDmeAnimCmdNoAnimation::OnConstruction()
|
||||
{
|
||||
m_bNullAttr.Init( this, "nullAttr" );
|
||||
}
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
//
|
||||
//-----------------------------------------------------------------------------
|
||||
void CDmeAnimCmdNoAnimation::OnDestruction()
|
||||
{
|
||||
}
|
37
mdlobjects/dmeassemblycommand.cpp
Normal file
37
mdlobjects/dmeassemblycommand.cpp
Normal file
@ -0,0 +1,37 @@
|
||||
//====== Copyright <20> 1996-2009, Valve Corporation, All rights reserved. =======
|
||||
//
|
||||
// DmeAssemblyCommand
|
||||
//
|
||||
//=============================================================================
|
||||
|
||||
|
||||
// Valve includes
|
||||
#include "datamodel/dmelementfactoryhelper.h"
|
||||
#include "mdlobjects/dmeassemblycommand.h"
|
||||
|
||||
|
||||
// memdbgon must be the last include file in a .cpp file!!!
|
||||
#include "tier0/memdbgon.h"
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// DmeJiggleBone
|
||||
//-----------------------------------------------------------------------------
|
||||
IMPLEMENT_ELEMENT_FACTORY( DmeAssemblyCommand, CDmeAssemblyCommand );
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
//
|
||||
//-----------------------------------------------------------------------------
|
||||
void CDmeAssemblyCommand::OnConstruction()
|
||||
{
|
||||
// No attributes
|
||||
}
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
//
|
||||
//-----------------------------------------------------------------------------
|
||||
void CDmeAssemblyCommand::OnDestruction()
|
||||
{
|
||||
}
|
78
mdlobjects/dmeasset.cpp
Normal file
78
mdlobjects/dmeasset.cpp
Normal file
@ -0,0 +1,78 @@
|
||||
//===== Copyright (c) 1996-2009, Valve Corporation, All rights reserved. ====
|
||||
//
|
||||
// Dme Asset
|
||||
//
|
||||
//===========================================================================
|
||||
|
||||
|
||||
// Valve includes
|
||||
#include "datamodel/dmelementfactoryhelper.h"
|
||||
#include "mdlobjects/dmeasset.h"
|
||||
|
||||
|
||||
// memdbgon must be the last include file in a .cpp file!!!
|
||||
#include "tier0/memdbgon.h"
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// DmeRelatedAsset
|
||||
//-----------------------------------------------------------------------------
|
||||
IMPLEMENT_ELEMENT_FACTORY( DmeRelatedAsset, CDmeRelatedAsset );
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
//
|
||||
//-----------------------------------------------------------------------------
|
||||
void CDmeRelatedAsset::OnConstruction()
|
||||
{
|
||||
m_sPath.Init( this, "path" );
|
||||
m_bIncludeModel.Init( this, "includeModel" );
|
||||
m_sNotes.Init( this, "notes" );
|
||||
m_bUseSkeleton.Init( this, "useSkeleton" );
|
||||
m_bAlwaysIncludeAttachments.Init( this, "alwaysIncludeAttachments" );
|
||||
m_eAssembleCmds.Init( this, "assembleCmds" );
|
||||
}
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
//
|
||||
//-----------------------------------------------------------------------------
|
||||
void CDmeRelatedAsset::OnDestruction()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// DmeAssetRoot
|
||||
//-----------------------------------------------------------------------------
|
||||
IMPLEMENT_ELEMENT_FACTORY( DmeAssetRoot, CDmeAssetRoot );
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
//
|
||||
//-----------------------------------------------------------------------------
|
||||
void CDmeAssetRoot::OnConstruction()
|
||||
{
|
||||
m_sMdlPath.Init( this, "mdlPath" );
|
||||
m_sSurfaceProperty.Init( this, "surfaceProperty" );
|
||||
m_ePostAssembleCmds.Init( this, "postAssembleCmds" );
|
||||
m_eRelatedAssets.Init( this, "relatedAssets" );
|
||||
m_sNameAtCreationTime.Init( this, "nameAtCreationTime" );
|
||||
m_sNotes.Init( this, "notes" );
|
||||
m_bAmbientBoost.Init( this, "ambientBoost" );
|
||||
m_bCastTextureShadows.Init( this, "castTextureShadows" );
|
||||
m_bDoNotCastShadows.Init( this, "doNotCastShadows" );
|
||||
m_sDynamicLightingOrigin.Init( this, "dynamicLightingOrigin" );
|
||||
m_nOpacity.Init( this, "opacity" );
|
||||
m_bNoForcedFade.Init( this, "noForcedFace" );
|
||||
m_bSubdivisionSurface.Init( this, "subdivisionSurface" );
|
||||
m_sContentsDescription.Init( this, "contentsDescription" );
|
||||
}
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
//
|
||||
//-----------------------------------------------------------------------------
|
||||
void CDmeAssetRoot::OnDestruction()
|
||||
{
|
||||
}
|
212
mdlobjects/dmebbox.cpp
Normal file
212
mdlobjects/dmebbox.cpp
Normal file
@ -0,0 +1,212 @@
|
||||
//====== Copyright <20> 1996-2004, Valve Corporation, All rights reserved. =====//
|
||||
//
|
||||
// Dme version of an axis aligned bounding box
|
||||
//
|
||||
//===========================================================================//
|
||||
|
||||
|
||||
// Valve includes
|
||||
#include "datamodel/dmelementfactoryhelper.h"
|
||||
#include "mdlobjects/dmebbox.h"
|
||||
#include "mathlib/mathlib.h"
|
||||
#include "tier2/renderutils.h"
|
||||
|
||||
|
||||
// memdbgon must be the last include file in a .cpp file!!!
|
||||
#include "tier0/memdbgon.h"
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Expose this class to the scene database
|
||||
//-----------------------------------------------------------------------------
|
||||
IMPLEMENT_ELEMENT_FACTORY( DmeBBox, CDmeBBox );
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Purpose:
|
||||
//-----------------------------------------------------------------------------
|
||||
void CDmeBBox::OnConstruction()
|
||||
{
|
||||
Vector vMin;
|
||||
Vector vMax;
|
||||
|
||||
ClearBounds( vMin, vMax );
|
||||
|
||||
m_vMinBounds.InitAndSet( this, "minBounds", vMin );
|
||||
m_vMaxBounds.InitAndSet( this, "maxBounds", vMax );
|
||||
}
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
//
|
||||
//-----------------------------------------------------------------------------
|
||||
void CDmeBBox::OnDestruction()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
//
|
||||
//-----------------------------------------------------------------------------
|
||||
void CDmeBBox::Clear()
|
||||
{
|
||||
Vector vMin;
|
||||
Vector vMax;
|
||||
|
||||
ClearBounds( vMin, vMax );
|
||||
|
||||
m_vMinBounds = vMin;
|
||||
m_vMaxBounds = vMax;
|
||||
}
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
//
|
||||
//-----------------------------------------------------------------------------
|
||||
bool CDmeBBox::Empty() const
|
||||
{
|
||||
const Vector &vMin = m_vMinBounds.Get();
|
||||
const Vector &vMax = m_vMaxBounds.Get();
|
||||
|
||||
return vMin.x > vMax.x || vMin.y > vMax.y || vMin.z > vMax.z;
|
||||
}
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
//
|
||||
//-----------------------------------------------------------------------------
|
||||
void CDmeBBox::TransformUsing( const matrix3x4_t &mMatrix )
|
||||
{
|
||||
Vector vMin;
|
||||
Vector vMax;
|
||||
|
||||
TransformAABB( mMatrix, m_vMinBounds, m_vMaxBounds, vMin, vMax );
|
||||
|
||||
m_vMinBounds = vMin;
|
||||
m_vMaxBounds = vMax;
|
||||
}
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
//
|
||||
//-----------------------------------------------------------------------------
|
||||
void CDmeBBox::Expand( const Vector &vPoint )
|
||||
{
|
||||
Vector vMin = m_vMinBounds;
|
||||
Vector vMax = m_vMaxBounds;
|
||||
|
||||
AddPointToBounds( vPoint, vMin, vMax );
|
||||
|
||||
m_vMinBounds = vMin;
|
||||
m_vMaxBounds = vMax;
|
||||
}
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
//
|
||||
//-----------------------------------------------------------------------------
|
||||
void CDmeBBox::Expand( const CDmeBBox &bbox )
|
||||
{
|
||||
Expand( bbox.m_vMinBounds );
|
||||
Expand( bbox.m_vMaxBounds );
|
||||
}
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
//
|
||||
//-----------------------------------------------------------------------------
|
||||
bool CDmeBBox::Contains( const Vector &vPoint ) const
|
||||
{
|
||||
const Vector &vMin = m_vMinBounds.Get();
|
||||
const Vector &vMax = m_vMaxBounds.Get();
|
||||
|
||||
return
|
||||
vPoint.x >= vMin.x && vPoint.x <= vMax.x &&
|
||||
vPoint.y >= vMin.y && vPoint.y <= vMax.y &&
|
||||
vPoint.z >= vMin.z && vPoint.z <= vMax.z;
|
||||
}
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
//
|
||||
//-----------------------------------------------------------------------------
|
||||
bool CDmeBBox::Intersects( const CDmeBBox &bbox ) const
|
||||
{
|
||||
return QuickBoxIntersectTest( m_vMinBounds, m_vMaxBounds, bbox.m_vMinBounds, bbox.m_vMaxBounds );
|
||||
}
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
//
|
||||
//-----------------------------------------------------------------------------
|
||||
float CDmeBBox::Width() const
|
||||
{
|
||||
const float flWidth = m_vMaxBounds.Get().x - m_vMinBounds.Get().x;
|
||||
return flWidth > 0.0f ? flWidth : 0.0f;
|
||||
}
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
//
|
||||
//-----------------------------------------------------------------------------
|
||||
float CDmeBBox::Height() const
|
||||
{
|
||||
const float flHeight = m_vMaxBounds.Get().y - m_vMinBounds.Get().y;
|
||||
return flHeight > 0.0f ? flHeight : 0.0f;
|
||||
}
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
//
|
||||
//-----------------------------------------------------------------------------
|
||||
float CDmeBBox::Depth() const
|
||||
{
|
||||
const float flDepth = m_vMaxBounds.Get().z - m_vMinBounds.Get().z;
|
||||
return flDepth > 0.0f ? flDepth : 0.0f;
|
||||
}
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
//
|
||||
//-----------------------------------------------------------------------------
|
||||
Vector CDmeBBox::Center() const
|
||||
{
|
||||
const Vector &vMin = m_vMinBounds.Get();
|
||||
const Vector &vMax = m_vMaxBounds.Get();
|
||||
|
||||
return Vector(
|
||||
( vMax.x + vMin.x ) / 2.0f,
|
||||
( vMax.y + vMin.y ) / 2.0f,
|
||||
( vMax.z + vMin.z ) / 2.0f );
|
||||
}
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
//
|
||||
//-----------------------------------------------------------------------------
|
||||
const Vector &CDmeBBox::Min() const
|
||||
{
|
||||
return m_vMinBounds.Get();
|
||||
}
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
//
|
||||
//-----------------------------------------------------------------------------
|
||||
const Vector &CDmeBBox::Max() const
|
||||
{
|
||||
return m_vMaxBounds.Get();
|
||||
}
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
//
|
||||
//-----------------------------------------------------------------------------
|
||||
void CDmeBBox::Draw( const matrix3x4_t &shapeToWorld, CDmeDrawSettings *pDrawSettings /*= NULL */ )
|
||||
{
|
||||
static const Color cRenderColor( 0, 192, 0 );
|
||||
Vector vOrigin;
|
||||
QAngle angles;
|
||||
MatrixAngles( shapeToWorld, angles, vOrigin );
|
||||
RenderBox( vOrigin, angles, m_vMinBounds, m_vMaxBounds, cRenderColor, true );
|
||||
}
|
35
mdlobjects/dmeblankbodypart.cpp
Normal file
35
mdlobjects/dmeblankbodypart.cpp
Normal file
@ -0,0 +1,35 @@
|
||||
//====== Copyright <20> 1996-2004, Valve Corporation, All rights reserved. =====//
|
||||
//
|
||||
// Dme blank/empty body part base class
|
||||
//
|
||||
//===========================================================================//
|
||||
|
||||
|
||||
#include "datamodel/dmelementfactoryhelper.h"
|
||||
#include "mdlobjects/dmeblankbodypart.h"
|
||||
|
||||
|
||||
// memdbgon must be the last include file in a .cpp file!!!
|
||||
#include "tier0/memdbgon.h"
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Expose this class to the scene database
|
||||
//-----------------------------------------------------------------------------
|
||||
IMPLEMENT_ELEMENT_FACTORY( DmeBlankBodyPart, CDmeBlankBodyPart );
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
//
|
||||
//-----------------------------------------------------------------------------
|
||||
void CDmeBlankBodyPart::OnConstruction()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
//
|
||||
//-----------------------------------------------------------------------------
|
||||
void CDmeBlankBodyPart::OnDestruction()
|
||||
{
|
||||
}
|
51
mdlobjects/dmebodygroup.cpp
Normal file
51
mdlobjects/dmebodygroup.cpp
Normal file
@ -0,0 +1,51 @@
|
||||
//====== Copyright <20> 1996-2004, Valve Corporation, All rights reserved. =====//
|
||||
//
|
||||
// Dme version of a body group
|
||||
//
|
||||
//===========================================================================//
|
||||
|
||||
#include "mdlobjects/dmebodygroup.h"
|
||||
#include "datamodel/dmelementfactoryhelper.h"
|
||||
#include "mdlobjects/dmelodlist.h"
|
||||
|
||||
// memdbgon must be the last include file in a .cpp file!!!
|
||||
#include "tier0/memdbgon.h"
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Expose this class to the scene database
|
||||
//-----------------------------------------------------------------------------
|
||||
IMPLEMENT_ELEMENT_FACTORY( DmeBodyGroup, CDmeBodyGroup );
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Purpose:
|
||||
//-----------------------------------------------------------------------------
|
||||
void CDmeBodyGroup::OnConstruction()
|
||||
{
|
||||
m_BodyParts.Init( this, "bodyPartList" );
|
||||
}
|
||||
|
||||
void CDmeBodyGroup::OnDestruction()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Finds a body part by name
|
||||
//-----------------------------------------------------------------------------
|
||||
CDmeLODList *CDmeBodyGroup::FindBodyPart( const char *pName )
|
||||
{
|
||||
int nCount = m_BodyParts.Count();
|
||||
for ( int i = 0; i < nCount; ++i )
|
||||
{
|
||||
CDmeLODList *pLODList = CastElement< CDmeLODList >( m_BodyParts[ i ] );
|
||||
if ( !pLODList )
|
||||
continue;
|
||||
|
||||
if ( !Q_stricmp( pName, pLODList->GetName() ) )
|
||||
return pLODList;
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
77
mdlobjects/dmebodygrouplist.cpp
Normal file
77
mdlobjects/dmebodygrouplist.cpp
Normal file
@ -0,0 +1,77 @@
|
||||
//====== Copyright <20> 1996-2004, Valve Corporation, All rights reserved. =====//
|
||||
//
|
||||
// Dme version of a body group list
|
||||
//
|
||||
//===========================================================================//
|
||||
|
||||
#include "mdlobjects/dmebodygrouplist.h"
|
||||
#include "datamodel/dmelementfactoryhelper.h"
|
||||
#include "mdlobjects/dmebodygroup.h"
|
||||
#include "mdlobjects/dmelodlist.h"
|
||||
|
||||
// memdbgon must be the last include file in a .cpp file!!!
|
||||
#include "tier0/memdbgon.h"
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Expose this class to the scene database
|
||||
//-----------------------------------------------------------------------------
|
||||
IMPLEMENT_ELEMENT_FACTORY( DmeBodyGroupList, CDmeBodyGroupList );
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Purpose:
|
||||
//-----------------------------------------------------------------------------
|
||||
void CDmeBodyGroupList::OnConstruction()
|
||||
{
|
||||
m_BodyGroups.Init( this, "bodyGroupList" );
|
||||
}
|
||||
|
||||
void CDmeBodyGroupList::OnDestruction()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Finds a body group by name
|
||||
//-----------------------------------------------------------------------------
|
||||
CDmeBodyGroup *CDmeBodyGroupList::FindBodyGroup( const char *pName )
|
||||
{
|
||||
int nCount = m_BodyGroups.Count();
|
||||
for ( int i = 0; i < nCount; ++i )
|
||||
{
|
||||
if ( !Q_stricmp( pName, m_BodyGroups[i]->GetName() ) )
|
||||
return m_BodyGroups[i];
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Gets the 'main' body part (used for compilation)
|
||||
//-----------------------------------------------------------------------------
|
||||
CDmeLODList *CDmeBodyGroupList::GetMainBodyPart()
|
||||
{
|
||||
if ( m_BodyGroups.Count() == 0 )
|
||||
return NULL;
|
||||
|
||||
CDmeBodyGroup *pMainBodyGroup = FindBodyGroup( "default" );
|
||||
if ( !pMainBodyGroup )
|
||||
{
|
||||
pMainBodyGroup = m_BodyGroups[0];
|
||||
}
|
||||
|
||||
CDmeLODList *pLODList = CastElement< CDmeLODList >( pMainBodyGroup->FindBodyPart( "default" ) );
|
||||
if ( pLODList )
|
||||
return pLODList;
|
||||
|
||||
const int nBodypartCount = pMainBodyGroup->m_BodyParts.Count();
|
||||
for ( int i = 0; i < nBodypartCount; ++i )
|
||||
{
|
||||
pLODList = CastElement< CDmeLODList >( pMainBodyGroup->m_BodyParts[ i ] );
|
||||
if ( pLODList && pLODList->m_LODs.Count() > 0 )
|
||||
return pLODList;
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
35
mdlobjects/dmebodypart.cpp
Normal file
35
mdlobjects/dmebodypart.cpp
Normal file
@ -0,0 +1,35 @@
|
||||
//====== Copyright <20> 1996-2004, Valve Corporation, All rights reserved. =====//
|
||||
//
|
||||
// Dme body part base class
|
||||
//
|
||||
//===========================================================================//
|
||||
|
||||
|
||||
#include "datamodel/dmelementfactoryhelper.h"
|
||||
#include "mdlobjects/dmebodypart.h"
|
||||
|
||||
|
||||
// memdbgon must be the last include file in a .cpp file!!!
|
||||
#include "tier0/memdbgon.h"
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Expose this class to the scene database
|
||||
//-----------------------------------------------------------------------------
|
||||
IMPLEMENT_ELEMENT_FACTORY( DmeBodyPart, CDmeBodyPart );
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
//
|
||||
//-----------------------------------------------------------------------------
|
||||
void CDmeBodyPart::OnConstruction()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
//
|
||||
//-----------------------------------------------------------------------------
|
||||
void CDmeBodyPart::OnDestruction()
|
||||
{
|
||||
}
|
163
mdlobjects/dmeboneflexdriver.cpp
Normal file
163
mdlobjects/dmeboneflexdriver.cpp
Normal file
@ -0,0 +1,163 @@
|
||||
//===== Copyright (c) 1996-2009, Valve Corporation, All rights reserved. ====
|
||||
//
|
||||
// Dme version of QC $BoneFlexDriver
|
||||
//
|
||||
//===========================================================================//
|
||||
|
||||
|
||||
// Valve includes
|
||||
#include "datamodel/dmelementfactoryhelper.h"
|
||||
#include "mdlobjects/dmeBoneFlexDriver.h"
|
||||
|
||||
|
||||
// memdbgon must be the last include file in a .cpp file!!!
|
||||
#include "tier0/memdbgon.h"
|
||||
|
||||
|
||||
//===========================================================================//
|
||||
// CDmeBoneFlexDriverControl
|
||||
//===========================================================================//
|
||||
//-----------------------------------------------------------------------------
|
||||
// Expose this class to the scene database
|
||||
//-----------------------------------------------------------------------------
|
||||
IMPLEMENT_ELEMENT_FACTORY( DmeBoneFlexDriverControl, CDmeBoneFlexDriverControl );
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
//
|
||||
//-----------------------------------------------------------------------------
|
||||
void CDmeBoneFlexDriverControl::OnConstruction()
|
||||
{
|
||||
m_sFlexControllerName.Init( this, "flexControllerName" );
|
||||
m_nBoneComponent.Init( this, "boneComponent" );
|
||||
m_flMin.InitAndSet( this, "min", 0.0f );
|
||||
m_flMax.InitAndSet( this, "max", 1.0f );
|
||||
}
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
//
|
||||
//-----------------------------------------------------------------------------
|
||||
void CDmeBoneFlexDriverControl::OnDestruction()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
//
|
||||
//-----------------------------------------------------------------------------
|
||||
int CDmeBoneFlexDriverControl::SetBoneComponent( int nBoneComponent )
|
||||
{
|
||||
// Range [STUDIO_BONE_FLEX_TX, STUDIO_BONE_FLEX_RZ]
|
||||
m_nBoneComponent = clamp( nBoneComponent, 0, 5 );
|
||||
return m_nBoneComponent.Get();
|
||||
}
|
||||
|
||||
|
||||
//===========================================================================//
|
||||
// CDmeBoneFlexDriver
|
||||
//===========================================================================//
|
||||
//-----------------------------------------------------------------------------
|
||||
// Expose this class to the scene database
|
||||
//-----------------------------------------------------------------------------
|
||||
IMPLEMENT_ELEMENT_FACTORY( DmeBoneFlexDriver, CDmeBoneFlexDriver );
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
//
|
||||
//-----------------------------------------------------------------------------
|
||||
void CDmeBoneFlexDriver::OnConstruction()
|
||||
{
|
||||
m_sBoneName.Init( this, "boneName" );
|
||||
m_eControlList.Init( this, "controlList" );
|
||||
}
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
//
|
||||
//-----------------------------------------------------------------------------
|
||||
void CDmeBoneFlexDriver::OnDestruction()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
//
|
||||
//-----------------------------------------------------------------------------
|
||||
CDmeBoneFlexDriverControl *CDmeBoneFlexDriver::FindOrCreateControl( const char *pszControlName )
|
||||
{
|
||||
CDmeBoneFlexDriverControl *pDmeBoneFlexDriverControl = NULL;
|
||||
|
||||
for ( int i = 0; i < m_eControlList.Count(); ++i )
|
||||
{
|
||||
pDmeBoneFlexDriverControl = m_eControlList[i];
|
||||
if ( !pDmeBoneFlexDriverControl )
|
||||
continue;
|
||||
|
||||
if ( !Q_stricmp( pszControlName, pDmeBoneFlexDriverControl->m_sFlexControllerName.Get() ) )
|
||||
return pDmeBoneFlexDriverControl;
|
||||
}
|
||||
|
||||
pDmeBoneFlexDriverControl = CreateElement< CDmeBoneFlexDriverControl >( "", GetFileId() ); // Nameless
|
||||
if ( !pDmeBoneFlexDriverControl )
|
||||
return NULL;
|
||||
|
||||
pDmeBoneFlexDriverControl->m_sFlexControllerName = pszControlName;
|
||||
m_eControlList.AddToTail( pDmeBoneFlexDriverControl );
|
||||
|
||||
return pDmeBoneFlexDriverControl;
|
||||
}
|
||||
|
||||
|
||||
//===========================================================================//
|
||||
// CDmeBoneFlexDriverList
|
||||
//===========================================================================//
|
||||
//-----------------------------------------------------------------------------
|
||||
// Expose this class to the scene database
|
||||
//-----------------------------------------------------------------------------
|
||||
IMPLEMENT_ELEMENT_FACTORY( DmeBoneFlexDriverList, CDmeBoneFlexDriverList );
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
//
|
||||
//-----------------------------------------------------------------------------
|
||||
void CDmeBoneFlexDriverList::OnConstruction()
|
||||
{
|
||||
m_eBoneFlexDriverList.Init( this, "boneFlexDriverList" );
|
||||
}
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
//
|
||||
//-----------------------------------------------------------------------------
|
||||
void CDmeBoneFlexDriverList::OnDestruction()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
//
|
||||
//-----------------------------------------------------------------------------
|
||||
CDmeBoneFlexDriver *CDmeBoneFlexDriverList::FindOrCreateBoneFlexDriver( const char *pszBoneName )
|
||||
{
|
||||
CDmeBoneFlexDriver *pDmeBoneFlexDriver = NULL;
|
||||
|
||||
for ( int i = 0; i < m_eBoneFlexDriverList.Count(); ++i )
|
||||
{
|
||||
pDmeBoneFlexDriver = m_eBoneFlexDriverList[i];
|
||||
if ( !pDmeBoneFlexDriver )
|
||||
continue;
|
||||
|
||||
if ( !Q_stricmp( pszBoneName, pDmeBoneFlexDriver->m_sBoneName.Get() ) )
|
||||
return pDmeBoneFlexDriver;
|
||||
}
|
||||
|
||||
pDmeBoneFlexDriver = CreateElement< CDmeBoneFlexDriver >( "", GetFileId() ); // Nameless
|
||||
if ( !pDmeBoneFlexDriver )
|
||||
return NULL;
|
||||
|
||||
pDmeBoneFlexDriver->m_sBoneName = pszBoneName;
|
||||
m_eBoneFlexDriverList.AddToTail( pDmeBoneFlexDriver );
|
||||
|
||||
return pDmeBoneFlexDriver;
|
||||
}
|
57
mdlobjects/dmebonemask.cpp
Normal file
57
mdlobjects/dmebonemask.cpp
Normal file
@ -0,0 +1,57 @@
|
||||
//====== Copyright <20> 1996-2008, Valve Corporation, All rights reserved. =====//
|
||||
//
|
||||
// A list of DmeBoneWeight elements, replacing QC's $WeightList
|
||||
//
|
||||
//===========================================================================//
|
||||
|
||||
|
||||
#include "datamodel/dmelementfactoryhelper.h"
|
||||
#include "mdlobjects/dmeboneweight.h"
|
||||
#include "mdlobjects/dmebonemask.h"
|
||||
|
||||
|
||||
// memdbgon must be the last include file in a .cpp file!!!
|
||||
#include "tier0/memdbgon.h"
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Expose this class to the scene database
|
||||
//-----------------------------------------------------------------------------
|
||||
IMPLEMENT_ELEMENT_FACTORY( DmeBoneMask, CDmeBoneMask );
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
//
|
||||
//-----------------------------------------------------------------------------
|
||||
void CDmeBoneMask::OnConstruction()
|
||||
{
|
||||
m_BoneWeights.Init( this, "boneWeightList" );
|
||||
}
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
//
|
||||
//-----------------------------------------------------------------------------
|
||||
void CDmeBoneMask::OnDestruction()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
//
|
||||
//-----------------------------------------------------------------------------
|
||||
float CDmeBoneMask::GetBoneWeight( const char *pszBoneName )
|
||||
{
|
||||
for ( int i = 0; i < m_BoneWeights.Count(); ++i )
|
||||
{
|
||||
CDmeBoneWeight *pDmeBoneWeight = m_BoneWeights[i];
|
||||
if ( !pDmeBoneWeight )
|
||||
continue;
|
||||
|
||||
if ( !V_stricmp( pszBoneName, pDmeBoneWeight->GetName() ) )
|
||||
return pDmeBoneWeight->m_flWeight.Get();
|
||||
}
|
||||
|
||||
// Couldn't find the bone, return full weight
|
||||
return 1.0f;
|
||||
}
|
38
mdlobjects/dmebonemasklist.cpp
Normal file
38
mdlobjects/dmebonemasklist.cpp
Normal file
@ -0,0 +1,38 @@
|
||||
//====== Copyright <20> 1996-2008, Valve Corporation, All rights reserved. =====//
|
||||
//
|
||||
// A list of DmeBoneWeight elements, replacing QC's $WeightList
|
||||
//
|
||||
//===========================================================================//
|
||||
|
||||
|
||||
#include "datamodel/dmelementfactoryhelper.h"
|
||||
#include "mdlobjects/dmebonemask.h"
|
||||
#include "mdlobjects/dmebonemasklist.h"
|
||||
|
||||
|
||||
// memdbgon must be the last include file in a .cpp file!!!
|
||||
#include "tier0/memdbgon.h"
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Expose this class to the scene database
|
||||
//-----------------------------------------------------------------------------
|
||||
IMPLEMENT_ELEMENT_FACTORY( DmeBoneMaskList, CDmeBoneMaskList );
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
//
|
||||
//-----------------------------------------------------------------------------
|
||||
void CDmeBoneMaskList::OnConstruction()
|
||||
{
|
||||
m_eDefaultBoneMask.Init( this, "defaultBoneMask" );
|
||||
m_BoneMaskList.Init( this, "boneMaskList" );
|
||||
}
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
//
|
||||
//-----------------------------------------------------------------------------
|
||||
void CDmeBoneMaskList::OnDestruction()
|
||||
{
|
||||
}
|
36
mdlobjects/dmeboneweight.cpp
Normal file
36
mdlobjects/dmeboneweight.cpp
Normal file
@ -0,0 +1,36 @@
|
||||
//====== Copyright <20> 1996-2008, Valve Corporation, All rights reserved. =====//
|
||||
//
|
||||
// Dme version of a bone weight as in QC $WeightList
|
||||
//
|
||||
//===========================================================================//
|
||||
|
||||
|
||||
#include "datamodel/dmelementfactoryhelper.h"
|
||||
#include "mdlobjects/dmeboneweight.h"
|
||||
|
||||
|
||||
// memdbgon must be the last include file in a .cpp file!!!
|
||||
#include "tier0/memdbgon.h"
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Expose this class to the scene database
|
||||
//-----------------------------------------------------------------------------
|
||||
IMPLEMENT_ELEMENT_FACTORY( DmeBoneWeight, CDmeBoneWeight );
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
//
|
||||
//-----------------------------------------------------------------------------
|
||||
void CDmeBoneWeight::OnConstruction()
|
||||
{
|
||||
m_flWeight.Init( this, "weight" );
|
||||
}
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
//
|
||||
//-----------------------------------------------------------------------------
|
||||
void CDmeBoneWeight::OnDestruction()
|
||||
{
|
||||
}
|
142
mdlobjects/dmecollisionjoints.cpp
Normal file
142
mdlobjects/dmecollisionjoints.cpp
Normal file
@ -0,0 +1,142 @@
|
||||
//====== Copyright <20> 1996-2004, Valve Corporation, All rights reserved. =====//
|
||||
//
|
||||
// Dme $collisionjoints
|
||||
//
|
||||
//===========================================================================//
|
||||
|
||||
|
||||
#include "datamodel/dmelementfactoryhelper.h"
|
||||
#include "mdlobjects/dmecollisionjoints.h"
|
||||
|
||||
|
||||
// memdbgon must be the last include file in a .cpp file!!!
|
||||
#include "tier0/memdbgon.h"
|
||||
|
||||
|
||||
//===========================================================================
|
||||
// Expose DmeJointConstrain class to the scene database
|
||||
//===========================================================================
|
||||
IMPLEMENT_ELEMENT_FACTORY( DmeJointConstrain, CDmeJointConstrain );
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
//
|
||||
//-----------------------------------------------------------------------------
|
||||
void CDmeJointConstrain::OnConstruction()
|
||||
{
|
||||
m_nType.InitAndSet( this, "type", 1 ); // 0: Free, 1: Fixed, 2: Limit
|
||||
m_aLimitMin.Init( this, "minAngle" );
|
||||
m_aLimitMax.Init( this, "maxAngle" );
|
||||
m_flFriction.Init( this, "friction" );
|
||||
}
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
//
|
||||
//-----------------------------------------------------------------------------
|
||||
void CDmeJointConstrain::OnDestruction()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
//
|
||||
//-----------------------------------------------------------------------------
|
||||
void CDmeJointConstrain::OnAttributeChanged( CDmAttribute *pAttribute )
|
||||
{
|
||||
// Limit "type" to [0:2]
|
||||
// TODO: Check for recursive behavior
|
||||
|
||||
if ( pAttribute == m_nType.GetAttribute() )
|
||||
{
|
||||
m_nType.Set( clamp( m_nType.Get(), 0, 2 ) );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//===========================================================================
|
||||
// Expose DmeJointAnimatedFriction class to the scene database
|
||||
//===========================================================================
|
||||
IMPLEMENT_ELEMENT_FACTORY( DmeJointAnimatedFriction, CDmeJointAnimatedFriction );
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
//
|
||||
//-----------------------------------------------------------------------------
|
||||
void CDmeJointAnimatedFriction::OnConstruction()
|
||||
{
|
||||
m_nMinFriction.InitAndSet( this, "minFriction", 1.0f );
|
||||
m_nMaxFriction.InitAndSet( this, "maxFriction", 1.0f );
|
||||
m_tTimeIn.Init( this, "timeIn" );
|
||||
m_tTimeHold.Init( this, "timeHold" );
|
||||
m_tTimeOut.Init( this, "timeOut" );
|
||||
}
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
//
|
||||
//-----------------------------------------------------------------------------
|
||||
void CDmeJointAnimatedFriction::OnDestruction()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
//===========================================================================
|
||||
// Expose DmeCollisionJoint class to the scene database
|
||||
//===========================================================================
|
||||
IMPLEMENT_ELEMENT_FACTORY( DmeCollisionJoint, CDmeCollisionJoint );
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
//
|
||||
//-----------------------------------------------------------------------------
|
||||
void CDmeCollisionJoint::OnConstruction()
|
||||
{
|
||||
m_flMassBias.InitAndSet( this, "massBias", 1.0f );
|
||||
m_flDamping.InitAndSet( this, "damping", 0.0f );
|
||||
m_flRotDamping.InitAndSet( this, "rotationalDamping", 0.0f );
|
||||
m_flInertia.InitAndSet( this, "inertia", 1.0f );
|
||||
m_ConstrainX.Init( this, "constrainX" );
|
||||
m_ConstrainY.Init( this, "constrainY" );
|
||||
m_ConstrainZ.Init( this, "constrainZ" );
|
||||
m_JointMergeList.Init( this, "jointMergeList" );
|
||||
m_JointCollideList.Init( this, "jointCollideList" );
|
||||
}
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
//
|
||||
//-----------------------------------------------------------------------------
|
||||
void CDmeCollisionJoint::OnDestruction()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
|
||||
//===========================================================================
|
||||
// Expose DmeKeyValueString class to the scene database
|
||||
//===========================================================================
|
||||
IMPLEMENT_ELEMENT_FACTORY( DmeCollisionJoints, CDmeCollisionJoints );
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
//
|
||||
//-----------------------------------------------------------------------------
|
||||
void CDmeCollisionJoints::OnConstruction()
|
||||
{
|
||||
m_bConcavePerJoint.InitAndSet( this, "concavePerJoint", false );
|
||||
m_bSelfCollisions.InitAndSet( this, "selfCollisions", true );
|
||||
m_bBoneFollower.InitAndSet( this, "boneFollower", false );
|
||||
m_RootBone.Init( this, "rootBone" );
|
||||
m_AnimatedFriction.Init( this, "animatedFriction" );
|
||||
m_JointSkipList.Init( this, "jointSkipList" );
|
||||
m_JointList.Init( this, "jointList" );
|
||||
}
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
//
|
||||
//-----------------------------------------------------------------------------
|
||||
void CDmeCollisionJoints::OnDestruction()
|
||||
{
|
||||
}
|
50
mdlobjects/dmecollisionmodel.cpp
Normal file
50
mdlobjects/dmecollisionmodel.cpp
Normal file
@ -0,0 +1,50 @@
|
||||
//====== Copyright <20> 1996-2004, Valve Corporation, All rights reserved. =====//
|
||||
//
|
||||
// Dme version of a collisionmodel
|
||||
//
|
||||
//===========================================================================//
|
||||
|
||||
|
||||
#include "mdlobjects/dmecollisionmodel.h"
|
||||
#include "datamodel/dmelementfactoryhelper.h"
|
||||
|
||||
|
||||
// memdbgon must be the last include file in a .cpp file!!!
|
||||
#include "tier0/memdbgon.h"
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Expose this class to the scene database
|
||||
//-----------------------------------------------------------------------------
|
||||
IMPLEMENT_ELEMENT_FACTORY( DmeCollisionModel, CDmeCollisionModel );
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
//
|
||||
//-----------------------------------------------------------------------------
|
||||
void CDmeCollisionModel::OnConstruction()
|
||||
{
|
||||
m_flMass.InitAndSet( this, "mass", 0.0f );
|
||||
m_bAutomaticMassComputation.InitAndSet( this, "automaticMassComputation", true );
|
||||
m_flInertia.InitAndSet( this, "inertia", 1.0f );
|
||||
m_flDamping.InitAndSet( this, "damping", 0.0f );
|
||||
m_flRotationalDamping.InitAndSet( this, "rotationalDamping", 0.0f );
|
||||
m_flDrag.InitAndSet( this, "drag", -1.0f );
|
||||
m_nMaxConvexPieces.InitAndSet( this, "maxConvexPieces", 40 );
|
||||
m_bRemove2D.InitAndSet( this, "remove2d", false );
|
||||
m_flWeldPositionTolerance.InitAndSet( this, "weldPositionTolerance", 0.0f );
|
||||
m_flWeldNormalTolerance.InitAndSet( this, "weldNormalTolerance", 0.999f );
|
||||
m_bConcave.InitAndSet( this, "concave", false );
|
||||
m_bForceMassCenter.InitAndSet( this, "forceMassCenter", false );
|
||||
m_vecMassCenter.InitAndSet( this, "massCenter", Vector( 0.0f, 0.0f, 0.0f ) );
|
||||
m_bAssumeWorldSpace.InitAndSet( this, "assumeWorldSpace", false );
|
||||
m_SurfaceProperty.InitAndSet( this, "surfaceProperty", "default" );
|
||||
}
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
//
|
||||
//-----------------------------------------------------------------------------
|
||||
void CDmeCollisionModel::OnDestruction()
|
||||
{
|
||||
}
|
42
mdlobjects/dmedefinebone.cpp
Normal file
42
mdlobjects/dmedefinebone.cpp
Normal file
@ -0,0 +1,42 @@
|
||||
//====== Copyright <20> 1996-2008, Valve Corporation, All rights reserved. =====//
|
||||
//
|
||||
// Dme representation of QC: $sequence
|
||||
//
|
||||
//===========================================================================//
|
||||
|
||||
|
||||
#include "datamodel/dmelementfactoryhelper.h"
|
||||
#include "mdlobjects/dmedefinebone.h"
|
||||
#include "mdlobjects/dmedefinebonelist.h"
|
||||
|
||||
|
||||
// memdbgon must be the last include file in a .cpp file!!!
|
||||
#include "tier0/memdbgon.h"
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Expose this class to the scene database
|
||||
//-----------------------------------------------------------------------------
|
||||
IMPLEMENT_ELEMENT_FACTORY( DmeDefineBone, CDmeDefineBone );
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
//
|
||||
//-----------------------------------------------------------------------------
|
||||
void CDmeDefineBone::OnConstruction()
|
||||
{
|
||||
m_Parent.Init( this, "parent" );
|
||||
m_Translation.Init( this, "translation" );
|
||||
m_Rotation.Init( this, "rotation" );
|
||||
m_RealignTranslation.Init( this, "realignTranslation" );
|
||||
m_RealignRotation.Init( this, "realignRotation" );
|
||||
m_sContentsDescription.Init( this, "contentsDescription" );
|
||||
}
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
//
|
||||
//-----------------------------------------------------------------------------
|
||||
void CDmeDefineBone::OnDestruction()
|
||||
{
|
||||
}
|
37
mdlobjects/dmedefinebonelist.cpp
Normal file
37
mdlobjects/dmedefinebonelist.cpp
Normal file
@ -0,0 +1,37 @@
|
||||
//====== Copyright <20> 1996-2008, Valve Corporation, All rights reserved. =====//
|
||||
//
|
||||
// A list of DmeSequences's
|
||||
//
|
||||
//===========================================================================//
|
||||
|
||||
|
||||
#include "datamodel/dmelementfactoryhelper.h"
|
||||
#include "mdlobjects/dmedefinebone.h"
|
||||
#include "mdlobjects/dmedefinebonelist.h"
|
||||
|
||||
|
||||
// memdbgon must be the last include file in a .cpp file!!!
|
||||
#include "tier0/memdbgon.h"
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Expose this class to the scene database
|
||||
//-----------------------------------------------------------------------------
|
||||
IMPLEMENT_ELEMENT_FACTORY( DmeDefineBoneList, CDmeDefineBoneList );
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
//
|
||||
//-----------------------------------------------------------------------------
|
||||
void CDmeDefineBoneList::OnConstruction()
|
||||
{
|
||||
m_DefineBones.Init( this, "defineBones" );
|
||||
}
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
//
|
||||
//-----------------------------------------------------------------------------
|
||||
void CDmeDefineBoneList::OnDestruction()
|
||||
{
|
||||
}
|
37
mdlobjects/dmeelementgroup.cpp
Normal file
37
mdlobjects/dmeelementgroup.cpp
Normal file
@ -0,0 +1,37 @@
|
||||
//===== Copyright (c) 1996-2009, Valve Corporation, All rights reserved. ====
|
||||
//
|
||||
// Dme Asset
|
||||
//
|
||||
//===========================================================================
|
||||
|
||||
|
||||
// Valve includes
|
||||
#include "datamodel/dmelementfactoryhelper.h"
|
||||
#include "mdlobjects/dmeelementgroup.h"
|
||||
|
||||
|
||||
// memdbgon must be the last include file in a .cpp file!!!
|
||||
#include "tier0/memdbgon.h"
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// DmeIkChain
|
||||
//-----------------------------------------------------------------------------
|
||||
IMPLEMENT_ELEMENT_FACTORY( DmeElementGroup, CDmeElementGroup );
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
//
|
||||
//-----------------------------------------------------------------------------
|
||||
void CDmeElementGroup::OnConstruction()
|
||||
{
|
||||
m_eElementList.Init( this, "elementList" );
|
||||
}
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
//
|
||||
//-----------------------------------------------------------------------------
|
||||
void CDmeElementGroup::OnDestruction()
|
||||
{
|
||||
}
|
44
mdlobjects/dmeeyeball.cpp
Normal file
44
mdlobjects/dmeeyeball.cpp
Normal file
@ -0,0 +1,44 @@
|
||||
//====== Copyright <20> 1996-2009, Valve Corporation, All rights reserved. =======
|
||||
//
|
||||
// DmeEyeball
|
||||
//
|
||||
//=============================================================================
|
||||
|
||||
|
||||
// Valve includes
|
||||
#include "datamodel/dmelementfactoryhelper.h"
|
||||
#include "mdlobjects/dmeeyeball.h"
|
||||
#include "movieobjects/dmedag.h"
|
||||
#include "movieobjects/dmematerial.h"
|
||||
|
||||
|
||||
// memdbgon must be the last include file in a .cpp file!!!
|
||||
#include "tier0/memdbgon.h"
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Expose this class to the scene database
|
||||
//-----------------------------------------------------------------------------
|
||||
IMPLEMENT_ELEMENT_FACTORY( DmeEyeball, CDmeEyeball );
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
//
|
||||
//-----------------------------------------------------------------------------
|
||||
void CDmeEyeball::OnConstruction()
|
||||
{
|
||||
m_flRadius.InitAndSet( this, "radius", 0.5 );
|
||||
m_flYawAngle.InitAndSet( this, "angle", 2.0 );
|
||||
m_flIrisScale.InitAndSet( this, "irisScale", 1.0 );
|
||||
m_sMaterialName.Init( this, "materialName" );
|
||||
m_sParentBoneName.Init( this, "parentBoneName" );
|
||||
m_vPosition.Init( this, "position" );
|
||||
}
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
//
|
||||
//-----------------------------------------------------------------------------
|
||||
void CDmeEyeball::OnDestruction()
|
||||
{
|
||||
}
|
39
mdlobjects/dmeeyeballglobals.cpp
Normal file
39
mdlobjects/dmeeyeballglobals.cpp
Normal file
@ -0,0 +1,39 @@
|
||||
//====== Copyright <20> 1996-2009, Valve Corporation, All rights reserved. =====//
|
||||
//
|
||||
// A list of DmeEyeballs's
|
||||
//
|
||||
//===========================================================================//
|
||||
|
||||
|
||||
// Valve includes
|
||||
#include "mdlobjects/dmeeyeballglobals.h"
|
||||
#include "datamodel/dmelementfactoryhelper.h"
|
||||
#include "movieobjects/dmedag.h"
|
||||
|
||||
|
||||
// memdbgon must be the last include file in a .cpp file!!!
|
||||
#include "tier0/memdbgon.h"
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Expose this class to the scene database
|
||||
//-----------------------------------------------------------------------------
|
||||
IMPLEMENT_ELEMENT_FACTORY( DmeEyeballGlobals, CDmeEyeballGlobals );
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
//
|
||||
//-----------------------------------------------------------------------------
|
||||
void CDmeEyeballGlobals::OnConstruction()
|
||||
{
|
||||
m_vEyePosition.Init( this, "eyePosition" );
|
||||
m_flMaxEyeDeflection.InitAndSet( this, "maximumEyeDeflection", 90.0f );
|
||||
}
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
//
|
||||
//-----------------------------------------------------------------------------
|
||||
void CDmeEyeballGlobals::OnDestruction()
|
||||
{
|
||||
}
|
45
mdlobjects/dmeeyelid.cpp
Normal file
45
mdlobjects/dmeeyelid.cpp
Normal file
@ -0,0 +1,45 @@
|
||||
//============ Copyright (c) Valve Corporation, All rights reserved. ==========
|
||||
//
|
||||
//=============================================================================
|
||||
|
||||
|
||||
|
||||
// Valve includes
|
||||
#include "datamodel/dmelementfactoryhelper.h"
|
||||
#include "mdlobjects/dmeeyelid.h"
|
||||
#include "movieobjects/dmedag.h"
|
||||
|
||||
|
||||
// memdbgon must be the last include file in a .cpp file!!!
|
||||
#include "tier0/memdbgon.h"
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Expose this class to the scene database
|
||||
//-----------------------------------------------------------------------------
|
||||
IMPLEMENT_ELEMENT_FACTORY( DmeEyelid, CDmeEyelid );
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
//
|
||||
//-----------------------------------------------------------------------------
|
||||
void CDmeEyelid::OnConstruction()
|
||||
{
|
||||
m_bUpper.Init( this, "upper" );
|
||||
m_sLowererFlex.Init( this, "lowererFlex" );
|
||||
m_flLowererHeight.Init( this, "lowererHeight" );
|
||||
m_sNeutralFlex.Init( this, "neutralFlex" );
|
||||
m_flNeutralHeight.Init( this, "neutralHeight" );
|
||||
m_sRaiserFlex.Init( this, "raiserFlex" );
|
||||
m_flRaiserHeight.Init( this, "raiserHeight" );
|
||||
m_sRightEyeballName.Init( this, "rightEyeballName" );
|
||||
m_sLeftEyeballName.Init( this, "leftEyeballName" );
|
||||
}
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
//
|
||||
//-----------------------------------------------------------------------------
|
||||
void CDmeEyelid::OnDestruction()
|
||||
{
|
||||
}
|
57
mdlobjects/dmehitbox.cpp
Normal file
57
mdlobjects/dmehitbox.cpp
Normal file
@ -0,0 +1,57 @@
|
||||
//====== Copyright <20> 1996-2004, Valve Corporation, All rights reserved. =====//
|
||||
//
|
||||
// Dme version of a hitbox
|
||||
//
|
||||
//===========================================================================//
|
||||
|
||||
|
||||
// Valve includes
|
||||
#include "datamodel/dmelementfactoryhelper.h"
|
||||
#include "mdlobjects/dmehitbox.h"
|
||||
#include "tier2/renderutils.h"
|
||||
|
||||
|
||||
// memdbgon must be the last include file in a .cpp file!!!
|
||||
#include "tier0/memdbgon.h"
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Expose this class to the scene database
|
||||
//-----------------------------------------------------------------------------
|
||||
IMPLEMENT_ELEMENT_FACTORY( DmeHitbox, CDmeHitbox );
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Purpose:
|
||||
//-----------------------------------------------------------------------------
|
||||
void CDmeHitbox::OnConstruction()
|
||||
{
|
||||
m_sSurfaceProperty.Init( this, "surfaceProperty" );
|
||||
m_nGroupId.Init( this, "groupId" );
|
||||
m_sBoneName.Init( this, "boneName" );
|
||||
m_cRenderColor.InitAndSet( this, "renderColor", Color( 255, 255, 255, 64 ) );
|
||||
|
||||
// Set by CDmeBBox to FLT_MAX, -FLT_MAX
|
||||
m_vMinBounds = Vector( 0.0f, 0.0f, 0.0f );
|
||||
m_vMaxBounds = Vector( 0.0f, 0.0f, 0.0f );
|
||||
}
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
//
|
||||
//-----------------------------------------------------------------------------
|
||||
void CDmeHitbox::OnDestruction()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Rendering method for the dag
|
||||
//-----------------------------------------------------------------------------
|
||||
void CDmeHitbox::Draw( const matrix3x4_t &shapeToWorld, CDmeDrawSettings *pDrawSettings /* = NULL */ )
|
||||
{
|
||||
Vector vecOrigin;
|
||||
QAngle angles;
|
||||
MatrixAngles( shapeToWorld, angles, vecOrigin );
|
||||
RenderBox( vecOrigin, angles, m_vMinBounds, m_vMaxBounds, m_cRenderColor, true );
|
||||
}
|
37
mdlobjects/dmehitboxset.cpp
Normal file
37
mdlobjects/dmehitboxset.cpp
Normal file
@ -0,0 +1,37 @@
|
||||
//====== Copyright <20> 1996-2004, Valve Corporation, All rights reserved. =====//
|
||||
//
|
||||
// Dme version of a hitbox set
|
||||
//
|
||||
//===========================================================================//
|
||||
|
||||
|
||||
#include "datamodel/dmelementfactoryhelper.h"
|
||||
#include "mdlobjects/dmehitbox.h"
|
||||
#include "mdlobjects/dmehitboxset.h"
|
||||
|
||||
|
||||
// memdbgon must be the last include file in a .cpp file!!!
|
||||
#include "tier0/memdbgon.h"
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Expose this class to the scene database
|
||||
//-----------------------------------------------------------------------------
|
||||
IMPLEMENT_ELEMENT_FACTORY( DmeHitboxSet, CDmeHitboxSet );
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
//
|
||||
//-----------------------------------------------------------------------------
|
||||
void CDmeHitboxSet::OnConstruction()
|
||||
{
|
||||
m_HitboxList.Init( this, "hitboxList" );
|
||||
}
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
//
|
||||
//-----------------------------------------------------------------------------
|
||||
void CDmeHitboxSet::OnDestruction()
|
||||
{
|
||||
}
|
38
mdlobjects/dmehitboxsetlist.cpp
Normal file
38
mdlobjects/dmehitboxsetlist.cpp
Normal file
@ -0,0 +1,38 @@
|
||||
//====== Copyright <20> 1996-2004, Valve Corporation, All rights reserved. =====//
|
||||
//
|
||||
// A list of DmeHitboxSetList's
|
||||
//
|
||||
//===========================================================================//
|
||||
|
||||
|
||||
#include "datamodel/dmelementfactoryhelper.h"
|
||||
#include "mdlobjects/dmehitbox.h"
|
||||
#include "mdlobjects/dmehitboxset.h"
|
||||
#include "mdlobjects/dmehitboxsetlist.h"
|
||||
|
||||
|
||||
// memdbgon must be the last include file in a .cpp file!!!
|
||||
#include "tier0/memdbgon.h"
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Expose this class to the scene database
|
||||
//-----------------------------------------------------------------------------
|
||||
IMPLEMENT_ELEMENT_FACTORY( DmeHitboxSetList, CDmeHitboxSetList );
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
//
|
||||
//-----------------------------------------------------------------------------
|
||||
void CDmeHitboxSetList::OnConstruction()
|
||||
{
|
||||
m_HitboxSetList.Init( this, "hitboxSetList" );
|
||||
}
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
//
|
||||
//-----------------------------------------------------------------------------
|
||||
void CDmeHitboxSetList::OnDestruction()
|
||||
{
|
||||
}
|
219
mdlobjects/dmeik.cpp
Normal file
219
mdlobjects/dmeik.cpp
Normal file
@ -0,0 +1,219 @@
|
||||
//===== Copyright (c) 1996-2009, Valve Corporation, All rights reserved. ====
|
||||
//
|
||||
// Dme Ik rules
|
||||
//
|
||||
//===========================================================================
|
||||
|
||||
|
||||
// Valve includes
|
||||
#include "datamodel/dmelementfactoryhelper.h"
|
||||
#include "mdlobjects/dmeik.h"
|
||||
|
||||
|
||||
// memdbgon must be the last include file in a .cpp file!!!
|
||||
#include "tier0/memdbgon.h"
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// DmeIkChain
|
||||
//-----------------------------------------------------------------------------
|
||||
IMPLEMENT_ELEMENT_FACTORY( DmeIkChain, CDmeIkChain );
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
//
|
||||
//-----------------------------------------------------------------------------
|
||||
void CDmeIkChain::OnConstruction()
|
||||
{
|
||||
m_sEndJoint.Init( this, "endJoint" );
|
||||
m_flHeight.InitAndSet( this, "height", 18.0f );
|
||||
m_flPad.Init( this, "pad" );
|
||||
m_flFloor.Init( this, "floor" );
|
||||
m_vKnee.Init( this, "knee" );
|
||||
m_vCenter.Init( this, "center" );
|
||||
}
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
//
|
||||
//-----------------------------------------------------------------------------
|
||||
void CDmeIkChain::OnDestruction()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// DmeIkLock
|
||||
//-----------------------------------------------------------------------------
|
||||
IMPLEMENT_ELEMENT_FACTORY( DmeIkLock, CDmeIkLock );
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
//
|
||||
//-----------------------------------------------------------------------------
|
||||
void CDmeIkLock::OnConstruction()
|
||||
{
|
||||
m_eIkChain.Init( this, "ikChain", FATTRIB_NEVERCOPY );
|
||||
m_flLockPosition.Init( this, "lockPosition" );
|
||||
m_flLockRotation.Init( this, "lockRotation" );
|
||||
}
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
//
|
||||
//-----------------------------------------------------------------------------
|
||||
void CDmeIkLock::OnDestruction()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// DmeIkRange
|
||||
//-----------------------------------------------------------------------------
|
||||
IMPLEMENT_ELEMENT_FACTORY( DmeIkRange, CDmeIkRange );
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
//
|
||||
//-----------------------------------------------------------------------------
|
||||
void CDmeIkRange::OnConstruction()
|
||||
{
|
||||
m_nStartFrame.Init( this, "startFrame" );
|
||||
m_nEndFrame.Init( this, "endFrame" );
|
||||
m_nMaxStartFrame.Init( this, "maxStartFrame" );
|
||||
m_nMaxEndFrame.Init( this, "maxEndFrame" );
|
||||
}
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
//
|
||||
//-----------------------------------------------------------------------------
|
||||
void CDmeIkRange::OnDestruction()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// DmeIkRule
|
||||
//-----------------------------------------------------------------------------
|
||||
IMPLEMENT_ELEMENT_FACTORY( DmeIkRule, CDmeIkRule );
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
//
|
||||
//-----------------------------------------------------------------------------
|
||||
void CDmeIkRule::OnConstruction()
|
||||
{
|
||||
m_eIkChain.Init( this, "ikChain", FATTRIB_NEVERCOPY );
|
||||
m_eRange.InitAndCreate( this, "range" );
|
||||
m_nUseType.InitAndSet( this, "useType", USE_SEQUENCE );
|
||||
}
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
//
|
||||
//-----------------------------------------------------------------------------
|
||||
void CDmeIkRule::OnDestruction()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// DmeIkTouchRule
|
||||
//-----------------------------------------------------------------------------
|
||||
IMPLEMENT_ELEMENT_FACTORY( DmeIkTouchRule, CDmeIkTouchRule );
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
//
|
||||
//-----------------------------------------------------------------------------
|
||||
void CDmeIkTouchRule::OnConstruction()
|
||||
{
|
||||
m_sBoneName.Init( this, "boneName" );
|
||||
}
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
//
|
||||
//-----------------------------------------------------------------------------
|
||||
void CDmeIkTouchRule::OnDestruction()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// DmeIkFootstepRule
|
||||
//-----------------------------------------------------------------------------
|
||||
IMPLEMENT_ELEMENT_FACTORY( DmeIkFootstepRule, CDmeIkFootstepRule );
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
//
|
||||
//-----------------------------------------------------------------------------
|
||||
void CDmeIkFootstepRule::OnConstruction()
|
||||
{
|
||||
// These are optional
|
||||
// m_nContact.Init( this, "contact" );
|
||||
// m_flHeight.Init( this, "height" );
|
||||
// m_flFloor.Init( this, "floor" );
|
||||
// m_flPad.Init( this, "pad" );
|
||||
}
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
//
|
||||
//-----------------------------------------------------------------------------
|
||||
void CDmeIkFootstepRule::OnDestruction()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// DmeIkAttachmentRule
|
||||
//-----------------------------------------------------------------------------
|
||||
IMPLEMENT_ELEMENT_FACTORY( DmeIkAttachmentRule, CDmeIkAttachmentRule );
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
//
|
||||
//-----------------------------------------------------------------------------
|
||||
void CDmeIkAttachmentRule::OnConstruction()
|
||||
{
|
||||
m_sAttachmentName.Init( this, "attachmentName" );
|
||||
m_flRadius.Init( this, "radius" );
|
||||
|
||||
// These are optional
|
||||
// m_sFallbackBone.Init( this, "fallbackBone" );
|
||||
// m_vFallbackPoint.Init( this, "fallbackPoint" );
|
||||
// m_qFallbackRotation.Init( this, "fallbackRotation" );
|
||||
}
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
//
|
||||
//-----------------------------------------------------------------------------
|
||||
void CDmeIkAttachmentRule::OnDestruction()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// DmeIkReleaseRule
|
||||
//-----------------------------------------------------------------------------
|
||||
IMPLEMENT_ELEMENT_FACTORY( DmeIkReleaseRule, CDmeIkReleaseRule );
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
//
|
||||
//-----------------------------------------------------------------------------
|
||||
void CDmeIkReleaseRule::OnConstruction()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
//
|
||||
//-----------------------------------------------------------------------------
|
||||
void CDmeIkReleaseRule::OnDestruction()
|
||||
{
|
||||
}
|
36
mdlobjects/dmeincludemodellist.cpp
Normal file
36
mdlobjects/dmeincludemodellist.cpp
Normal file
@ -0,0 +1,36 @@
|
||||
//====== Copyright <20> 1996-2004, Valve Corporation, All rights reserved. =====//
|
||||
//
|
||||
// Dme version of a body group list
|
||||
//
|
||||
//===========================================================================//
|
||||
|
||||
|
||||
#include "datamodel/dmelementfactoryhelper.h"
|
||||
#include "mdlobjects/dmeincludemodellist.h"
|
||||
|
||||
|
||||
// memdbgon must be the last include file in a .cpp file!!!
|
||||
#include "tier0/memdbgon.h"
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Expose this class to the scene database
|
||||
//-----------------------------------------------------------------------------
|
||||
IMPLEMENT_ELEMENT_FACTORY( DmeIncludeModelList, CDmeIncludeModelList );
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
//
|
||||
//-----------------------------------------------------------------------------
|
||||
void CDmeIncludeModelList::OnConstruction()
|
||||
{
|
||||
m_IncludeModels.Init( this, "includeModels" );
|
||||
}
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
//
|
||||
//-----------------------------------------------------------------------------
|
||||
void CDmeIncludeModelList::OnDestruction()
|
||||
{
|
||||
}
|
93
mdlobjects/dmejigglebone.cpp
Normal file
93
mdlobjects/dmejigglebone.cpp
Normal file
@ -0,0 +1,93 @@
|
||||
//====== Copyright <20> 1996-2009, Valve Corporation, All rights reserved. =======
|
||||
//
|
||||
// DmeJiggleBone
|
||||
//
|
||||
//=============================================================================
|
||||
|
||||
|
||||
// Valve includes
|
||||
#include "datamodel/dmelementfactoryhelper.h"
|
||||
#include "mdlobjects/dmejigglebone.h"
|
||||
|
||||
|
||||
// memdbgon must be the last include file in a .cpp file!!!
|
||||
#include "tier0/memdbgon.h"
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// DmeJiggleBone
|
||||
//-----------------------------------------------------------------------------
|
||||
IMPLEMENT_ELEMENT_FACTORY( DmeJiggleBone, CDmeJiggleBone );
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
//
|
||||
//-----------------------------------------------------------------------------
|
||||
void CDmeJiggleBone::OnConstruction()
|
||||
{
|
||||
// flags
|
||||
m_bRigid.InitAndSet( this, "rigid", false );
|
||||
m_bFlexible.InitAndSet( this, "flexible", false );
|
||||
m_bBaseSpring.InitAndSet( this, "baseSpring", false );
|
||||
m_bYawConstrained.InitAndSet( this, "yawConstrained", false );
|
||||
m_bPitchConstrained.InitAndSet( this, "pitchConstrained", false );
|
||||
m_bLengthConstrained.InitAndSet( this, "lengthConstrained", false );
|
||||
m_bAngleConstrained.InitAndSet( this, "angleConstrained", false );
|
||||
|
||||
// general params
|
||||
m_flLength.InitAndSet( this, "length", 10.0f );
|
||||
m_flTipMass.Init( this, "tipMass" );
|
||||
|
||||
// angle constraint
|
||||
m_flAngleLimit.Init( this, "angleLimit" );
|
||||
|
||||
// yaw constraint
|
||||
m_flYawMin.Init( this, "yawMin" );
|
||||
m_flYawMax.Init( this, "yawMax" );
|
||||
m_flYawFriction.Init( this, "yawFriction" );
|
||||
m_flYawBounce.Init( this, "yawBounce" );
|
||||
|
||||
// flexible params
|
||||
m_flYawStiffness.InitAndSet( this, "yawStiffness", 100.0f );
|
||||
m_flYawDamping.Init( this, "yawDamping" );
|
||||
|
||||
m_flPitchStiffness.InitAndSet( this, "pitchStiffness", 100.0f );
|
||||
m_flPitchDamping.Init( this, "pitchDamping" );
|
||||
|
||||
m_flAlongStiffness.InitAndSet( this, "alongStiffness", 100.0f );
|
||||
m_flAlongDamping.Init( this, "alongDamping" );
|
||||
|
||||
// pitch constraint
|
||||
m_flPitchMin.Init( this, "pitchMin" );
|
||||
m_flPitchMax.Init( this, "pitchMax" );
|
||||
m_flPitchFriction.Init( this, "pitchFriction" );
|
||||
m_flPitchBounce.Init( this, "pitchBounce" );
|
||||
|
||||
// base spring
|
||||
m_flBaseMass.Init( this, "baseMass" );
|
||||
m_flBaseStiffness.Init( this, "baseStiffness", 100.0f );
|
||||
m_flBaseDamping.Init( this, "baseDamping" );
|
||||
|
||||
// base spring yaw
|
||||
m_flBaseYawMin.Init( this, "baseYawMin", -100.0f );
|
||||
m_flBaseYawMax.Init( this, "baseYawMax", 100.0f );
|
||||
m_flBaseYawFriction.Init( this, "baseYawFriction" );
|
||||
|
||||
// base spring pitch
|
||||
m_flBasePitchMin.Init( this, "basePitchMin", -100.0f );
|
||||
m_flBasePitchMax.Init( this, "basePitchMax", 100.0f );
|
||||
m_flBasePitchFriction.Init( this, "basePitchFriction" );
|
||||
|
||||
// base spring pitch
|
||||
m_flBaseAlongMin.Init( this, "baseAlongMin", -100.0f );
|
||||
m_flBaseAlongMax.Init( this, "baseAlongMax", 100.0f );
|
||||
m_flBaseAlongFriction.Init( this, "baseAlongFriction" );
|
||||
}
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
//
|
||||
//-----------------------------------------------------------------------------
|
||||
void CDmeJiggleBone::OnDestruction()
|
||||
{
|
||||
}
|
39
mdlobjects/dmelod.cpp
Normal file
39
mdlobjects/dmelod.cpp
Normal file
@ -0,0 +1,39 @@
|
||||
//====== Copyright <20> 1996-2004, Valve Corporation, All rights reserved. =====//
|
||||
//
|
||||
// Dme version of a hitbox
|
||||
//
|
||||
//===========================================================================//
|
||||
|
||||
#include "mdlobjects/dmelod.h"
|
||||
#include "datamodel/dmelementfactoryhelper.h"
|
||||
#include "movieobjects/dmemodel.h"
|
||||
#include "movieobjects/dmedag.h"
|
||||
#include "movieobjects/dmecombinationoperator.h"
|
||||
|
||||
// memdbgon must be the last include file in a .cpp file!!!
|
||||
#include "tier0/memdbgon.h"
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Expose this class to the scene database
|
||||
//-----------------------------------------------------------------------------
|
||||
IMPLEMENT_ELEMENT_FACTORY( DmeLOD, CDmeLOD );
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Purpose:
|
||||
//-----------------------------------------------------------------------------
|
||||
void CDmeLOD::OnConstruction()
|
||||
{
|
||||
m_Path.Init( this, "path" );
|
||||
m_Model.Init( this, "model" );
|
||||
m_Skeleton.Init( this, "skeleton" );
|
||||
m_CombinationOperator.Init( this, "combinationOperator" );
|
||||
m_flSwitchMetric.Init( this, "switchMetric" );
|
||||
m_bNoFlex.Init( this, "noFlex" );
|
||||
m_bIsShadowLOD.Init( this, "isShadowLOD" );
|
||||
}
|
||||
|
||||
void CDmeLOD::OnDestruction()
|
||||
{
|
||||
}
|
86
mdlobjects/dmelodlist.cpp
Normal file
86
mdlobjects/dmelodlist.cpp
Normal file
@ -0,0 +1,86 @@
|
||||
//====== Copyright <20> 1996-2004, Valve Corporation, All rights reserved. =====//
|
||||
//
|
||||
// Dme version of a hitbox
|
||||
//
|
||||
//===========================================================================//
|
||||
|
||||
|
||||
// Valve includes
|
||||
#include "mdlobjects/dmelodlist.h"
|
||||
#include "datamodel/dmelementfactoryhelper.h"
|
||||
#include "mdlobjects/dmelod.h"
|
||||
#include "mdlobjects/dmeeyeball.h"
|
||||
|
||||
|
||||
// memdbgon must be the last include file in a .cpp file!!!
|
||||
#include "tier0/memdbgon.h"
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Expose this class to the scene database
|
||||
//-----------------------------------------------------------------------------
|
||||
IMPLEMENT_ELEMENT_FACTORY( DmeLODList, CDmeLODList );
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Purpose:
|
||||
//-----------------------------------------------------------------------------
|
||||
void CDmeLODList::OnConstruction()
|
||||
{
|
||||
m_LODs.Init( this, "lodList" );
|
||||
m_EyeballList.Init( this, "eyeballList" );
|
||||
}
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
//
|
||||
//-----------------------------------------------------------------------------
|
||||
void CDmeLODList::OnDestruction()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Returns the number of LODs in this body part, can be 0
|
||||
//-----------------------------------------------------------------------------
|
||||
int CDmeLODList::LODCount() const
|
||||
{
|
||||
return m_LODs.Count();
|
||||
}
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Returns the root LOD. This is the one with the switch metric 0
|
||||
//-----------------------------------------------------------------------------
|
||||
CDmeLOD* CDmeLODList::GetRootLOD()
|
||||
{
|
||||
int nCount = m_LODs.Count();
|
||||
int nMinIndex = -1;
|
||||
float flMinMetric = FLT_MAX;
|
||||
for ( int i = 0; i < nCount; ++i )
|
||||
{
|
||||
if ( m_LODs[i]->m_flSwitchMetric < flMinMetric )
|
||||
{
|
||||
nMinIndex = i;
|
||||
flMinMetric = m_LODs[i]->m_flSwitchMetric;
|
||||
if ( flMinMetric == 0.0f )
|
||||
break;
|
||||
}
|
||||
}
|
||||
return ( nMinIndex >= 0 ) ? m_LODs[nMinIndex] : NULL;
|
||||
}
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Returns the shadow LOD
|
||||
//-----------------------------------------------------------------------------
|
||||
CDmeLOD* CDmeLODList::GetShadowLOD()
|
||||
{
|
||||
int nCount = m_LODs.Count();
|
||||
for ( int i = 0; i < nCount; ++i )
|
||||
{
|
||||
if ( m_LODs[i]->m_bIsShadowLOD )
|
||||
return m_LODs[i];
|
||||
}
|
||||
return NULL;
|
||||
}
|
36
mdlobjects/dmematerialgroup.cpp
Normal file
36
mdlobjects/dmematerialgroup.cpp
Normal file
@ -0,0 +1,36 @@
|
||||
//====== Copyright <20> 1996-2008, Valve Corporation, All rights reserved. =====//
|
||||
//
|
||||
// DmeMaterialGroup
|
||||
//
|
||||
//===========================================================================//
|
||||
|
||||
|
||||
#include "datamodel/dmelementfactoryhelper.h"
|
||||
#include "mdlobjects/dmematerialgroup.h"
|
||||
|
||||
|
||||
// memdbgon must be the last include file in a .cpp file!!!
|
||||
#include "tier0/memdbgon.h"
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Expose this class to the scene database
|
||||
//-----------------------------------------------------------------------------
|
||||
IMPLEMENT_ELEMENT_FACTORY( DmeMaterialGroup, CDmeMaterialGroup );
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
//
|
||||
//-----------------------------------------------------------------------------
|
||||
void CDmeMaterialGroup::OnConstruction()
|
||||
{
|
||||
m_MaterialList.Init( this, "materialList" );
|
||||
}
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
//
|
||||
//-----------------------------------------------------------------------------
|
||||
void CDmeMaterialGroup::OnDestruction()
|
||||
{
|
||||
}
|
37
mdlobjects/dmematerialgrouplist.cpp
Normal file
37
mdlobjects/dmematerialgrouplist.cpp
Normal file
@ -0,0 +1,37 @@
|
||||
//====== Copyright <20> 1996-2008, Valve Corporation, All rights reserved. =====//
|
||||
//
|
||||
// A list of DmeMaterialGroups's - QC $texturegroup
|
||||
//
|
||||
//===========================================================================//
|
||||
|
||||
|
||||
#include "datamodel/dmelementfactoryhelper.h"
|
||||
#include "mdlobjects/dmematerialgroup.h"
|
||||
#include "mdlobjects/dmematerialgrouplist.h"
|
||||
|
||||
|
||||
// memdbgon must be the last include file in a .cpp file!!!
|
||||
#include "tier0/memdbgon.h"
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Expose this class to the scene database
|
||||
//-----------------------------------------------------------------------------
|
||||
IMPLEMENT_ELEMENT_FACTORY( DmeMaterialGroupList, CDmeMaterialGroupList );
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
//
|
||||
//-----------------------------------------------------------------------------
|
||||
void CDmeMaterialGroupList::OnConstruction()
|
||||
{
|
||||
m_MaterialGroups.Init( this, "materialGroups" );
|
||||
}
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
//
|
||||
//-----------------------------------------------------------------------------
|
||||
void CDmeMaterialGroupList::OnDestruction()
|
||||
{
|
||||
}
|
755
mdlobjects/dmematsysroot.cpp
Normal file
755
mdlobjects/dmematsysroot.cpp
Normal file
@ -0,0 +1,755 @@
|
||||
//===== Copyright (c) 1996-2009, Valve Corporation, All rights reserved. ====
|
||||
//
|
||||
// Animation commands
|
||||
//
|
||||
//==========================================================================
|
||||
|
||||
|
||||
// Valve includes
|
||||
#include "datamodel/dmelementfactoryhelper.h"
|
||||
#include "movieobjects/dmemodel.h"
|
||||
#include "movieobjects/dmedrawsettings.h"
|
||||
#include "mdlobjects/dmeanimcmd.h"
|
||||
#include "mdlobjects/dmebodygroup.h"
|
||||
#include "mdlobjects/dmebodygrouplist.h"
|
||||
#include "mdlobjects/dmelodlist.h"
|
||||
#include "mdlobjects/dmematsysroot.h"
|
||||
#include "mdlobjects/dmesequence.h"
|
||||
#include "mdlobjects/dmesequencelist.h"
|
||||
#include "tier1/utldict.h"
|
||||
#include "bone_setup.h"
|
||||
|
||||
|
||||
// memdbgon must be the last include file in a .cpp file!!!
|
||||
#include "tier0/memdbgon.h"
|
||||
|
||||
|
||||
//=============================================================================
|
||||
// CDmeMatSysSettings
|
||||
//=============================================================================
|
||||
IMPLEMENT_ELEMENT_FACTORY( DmeMatSysPanelSettings, CDmeMatSysPanelSettings );
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
//
|
||||
//-----------------------------------------------------------------------------
|
||||
void CDmeMatSysPanelSettings::OnConstruction()
|
||||
{
|
||||
m_cBackgroundColor.InitAndSet( this, "backgroundColor", Color( 0.3f, 0.3f, 0.3f ) );
|
||||
m_cAmbientColor.InitAndSet( this, "ambientColor", Color( 0.3f, 0.3f, 0.3f ) );
|
||||
m_bDrawGroundPlane.InitAndSet( this, "drawGroundPlane", true );
|
||||
m_bDrawOriginAxis.InitAndSet( this, "drawOriginAxis", true );
|
||||
}
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
//
|
||||
//-----------------------------------------------------------------------------
|
||||
void CDmeMatSysPanelSettings::OnDestruction()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
//=============================================================================
|
||||
// CDmeMatSysSettings
|
||||
//=============================================================================
|
||||
IMPLEMENT_ELEMENT_FACTORY( DmeMatSysRoot, CDmeMatSysRoot );
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
//
|
||||
//-----------------------------------------------------------------------------
|
||||
void CDmeMatSysRoot::OnConstruction()
|
||||
{
|
||||
m_Settings.InitAndCreate( this, "settings" );
|
||||
}
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
//
|
||||
//-----------------------------------------------------------------------------
|
||||
void CDmeMatSysRoot::OnDestruction()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
//=============================================================================
|
||||
// IDmeMatSysModel
|
||||
//=============================================================================
|
||||
//-----------------------------------------------------------------------------
|
||||
//
|
||||
//-----------------------------------------------------------------------------
|
||||
int IDmeMatSysModel::SelectSequence( const char *pszSequenceName )
|
||||
{
|
||||
Assert( 0 );
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
//
|
||||
//-----------------------------------------------------------------------------
|
||||
void IDmeMatSysModel::SetTime( DmeTime_t dmeTime )
|
||||
{
|
||||
Assert( 0 );
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
//
|
||||
//-----------------------------------------------------------------------------
|
||||
void IDmeMatSysModel::SetFrame( float flFrame )
|
||||
{
|
||||
Assert( 0 );
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
//=============================================================================
|
||||
// CDmeMatSysMDLDag
|
||||
//=============================================================================
|
||||
IMPLEMENT_ELEMENT_FACTORY( DmeMatSysMDLDag, CDmeMatSysMDLDag );
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
//
|
||||
//-----------------------------------------------------------------------------
|
||||
void CDmeMatSysMDLDag::OnConstruction()
|
||||
{
|
||||
CDmeMDL *pDmeMDL = CreateElement< CDmeMDL >( CUtlString( GetName() ) + "Shape", GetFileId() );
|
||||
if ( pDmeMDL )
|
||||
{
|
||||
pDmeMDL->DrawInEngine( true );
|
||||
SetShape( pDmeMDL );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
//
|
||||
//-----------------------------------------------------------------------------
|
||||
void CDmeMatSysMDLDag::OnDestruction()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
//
|
||||
//-----------------------------------------------------------------------------
|
||||
studiohdr_t *CDmeMatSysMDLDag::GetStudioHdr() const
|
||||
{
|
||||
CDmeMDL *pDmeMDL = GetDmeMDL();
|
||||
if ( !pDmeMDL )
|
||||
return NULL;
|
||||
|
||||
const MDLHandle_t hMDL = pDmeMDL->GetMDL();
|
||||
if ( hMDL == MDLHANDLE_INVALID || g_pMDLCache->IsErrorModel( hMDL ) )
|
||||
return NULL;
|
||||
|
||||
return g_pMDLCache->GetStudioHdr( hMDL );
|
||||
}
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
//
|
||||
//-----------------------------------------------------------------------------
|
||||
void CDmeMatSysMDLDag::GetSequenceList( CUtlVector< CUtlString > *pOutList )
|
||||
{
|
||||
if ( !pOutList )
|
||||
return;
|
||||
|
||||
pOutList->RemoveAll();
|
||||
|
||||
studiohdr_t *pStudioHdr = GetStudioHdr();
|
||||
if ( !pStudioHdr )
|
||||
return;
|
||||
|
||||
for ( int j = 0; j < pStudioHdr->GetNumSeq(); ++j )
|
||||
{
|
||||
if ( !( pStudioHdr->pSeqdesc( j ).flags & STUDIO_HIDDEN ) )
|
||||
{
|
||||
const char *pszSequenceName = pStudioHdr->pSeqdesc(j).pszLabel();
|
||||
if ( pszSequenceName && pszSequenceName[0] )
|
||||
{
|
||||
pOutList->AddToTail( pszSequenceName );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
//
|
||||
//-----------------------------------------------------------------------------
|
||||
void CDmeMatSysMDLDag::GetActivityList( CUtlVector< CUtlString > *pOutList )
|
||||
{
|
||||
pOutList->RemoveAll();
|
||||
|
||||
studiohdr_t *pStudioHdr = GetStudioHdr();
|
||||
if ( !pStudioHdr )
|
||||
return;
|
||||
|
||||
CUtlDict<int, unsigned short> activityNames( true, 0, pStudioHdr->GetNumSeq() );
|
||||
|
||||
for ( int j = 0; j < pStudioHdr->GetNumSeq(); ++j )
|
||||
{
|
||||
if ( !( pStudioHdr->pSeqdesc( j ).flags & STUDIO_HIDDEN ) )
|
||||
{
|
||||
const char *pszActivityName = pStudioHdr->pSeqdesc( j ).pszActivityName();
|
||||
if ( pszActivityName && pszActivityName[0] )
|
||||
{
|
||||
// Multiple sequences can have the same activity name; only add unique activity names
|
||||
if ( activityNames.Find( pszActivityName ) == activityNames.InvalidIndex() )
|
||||
{
|
||||
pOutList->AddToTail( pszActivityName );
|
||||
activityNames.Insert( pszActivityName, j );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
//
|
||||
//-----------------------------------------------------------------------------
|
||||
int CDmeMatSysMDLDag::SelectSequence( const char *pszSequenceName )
|
||||
{
|
||||
if ( !pszSequenceName || !pszSequenceName[0] )
|
||||
return -1;
|
||||
|
||||
CDmeMDL *pDmeMdl = GetDmeMDL();
|
||||
|
||||
studiohdr_t *pStudioHdr = GetStudioHdr();
|
||||
if ( !pStudioHdr )
|
||||
return -1;
|
||||
|
||||
pDmeMdl->m_nSequence = -1;
|
||||
|
||||
for ( int i = 0; i < pStudioHdr->GetNumSeq(); ++i )
|
||||
{
|
||||
mstudioseqdesc_t &seqdesc = pStudioHdr->pSeqdesc( i );
|
||||
if ( !Q_stricmp( seqdesc.pszLabel(), pszSequenceName ) )
|
||||
{
|
||||
pDmeMdl->m_nSequence = i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if ( pDmeMdl->m_nSequence < 0 )
|
||||
{
|
||||
pDmeMdl->m_nSequence = 0;
|
||||
return -1;
|
||||
}
|
||||
|
||||
CStudioHdr cStudioHdr( pStudioHdr, g_pMDLCache );
|
||||
|
||||
float flPoseParameter[MAXSTUDIOPOSEPARAM];
|
||||
Studio_CalcDefaultPoseParameters( &cStudioHdr, flPoseParameter, MAXSTUDIOPOSEPARAM );
|
||||
|
||||
int nFrameCount = Studio_MaxFrame( &cStudioHdr, pDmeMdl->m_nSequence, flPoseParameter );
|
||||
if ( nFrameCount == 0 )
|
||||
{
|
||||
nFrameCount = 1;
|
||||
}
|
||||
|
||||
return nFrameCount;
|
||||
}
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
//
|
||||
//-----------------------------------------------------------------------------
|
||||
void CDmeMatSysMDLDag::SetTime( DmeTime_t dmeTime )
|
||||
{
|
||||
CDmeMDL *pDmeMDL = GetDmeMDL();
|
||||
if ( !pDmeMDL )
|
||||
return;
|
||||
|
||||
pDmeMDL->m_flTime = dmeTime.GetSeconds();
|
||||
}
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
//
|
||||
//-----------------------------------------------------------------------------
|
||||
void CDmeMatSysMDLDag::SetFrame( float flFrame )
|
||||
{
|
||||
CDmeMDL *pDmeMDL = GetDmeMDL();
|
||||
if ( !pDmeMDL )
|
||||
return;
|
||||
|
||||
pDmeMDL->m_flTime = flFrame / pDmeMDL->m_flPlaybackRate;
|
||||
}
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
//
|
||||
//-----------------------------------------------------------------------------
|
||||
void CDmeMatSysMDLDag::SetMDL( MDLHandle_t hMDL )
|
||||
{
|
||||
CDmeMDL *pDmeMDL = GetDmeMDL();
|
||||
if ( !pDmeMDL )
|
||||
return;
|
||||
|
||||
pDmeMDL->SetMDL( hMDL );
|
||||
}
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
//
|
||||
//-----------------------------------------------------------------------------
|
||||
MDLHandle_t CDmeMatSysMDLDag::GetMDL() const
|
||||
{
|
||||
CDmeMDL *pDmeMDL = GetDmeMDL();
|
||||
if ( !pDmeMDL )
|
||||
return MDLHANDLE_INVALID;
|
||||
|
||||
return pDmeMDL->GetMDL();
|
||||
}
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
//
|
||||
//-----------------------------------------------------------------------------
|
||||
CDmeMDL *CDmeMatSysMDLDag::GetDmeMDL() const
|
||||
{
|
||||
return CastElement< CDmeMDL >( m_Shape );
|
||||
}
|
||||
|
||||
|
||||
//=============================================================================
|
||||
// CDmeMatSysDMXDag
|
||||
//=============================================================================
|
||||
IMPLEMENT_ELEMENT_FACTORY( DmeMatSysDMXDag, CDmeMatSysDMXDag );
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
//
|
||||
//-----------------------------------------------------------------------------
|
||||
void CDmeMatSysDMXDag::OnConstruction()
|
||||
{
|
||||
m_eDmxRoot.InitAndSet( this, "dmxRoot", DMELEMENT_HANDLE_INVALID );
|
||||
m_hDmxModel = DMELEMENT_HANDLE_INVALID;
|
||||
}
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
//
|
||||
//-----------------------------------------------------------------------------
|
||||
void CDmeMatSysDMXDag::OnDestruction()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
//
|
||||
//-----------------------------------------------------------------------------
|
||||
void CDmeMatSysDMXDag::Draw( CDmeDrawSettings *pDrawSettings /* = NULL */ )
|
||||
{
|
||||
if ( !m_Visible )
|
||||
return;
|
||||
|
||||
// This is meant to be called from mixed rendering environment and
|
||||
// DmeMesh windings are backwards relative to MDL windings
|
||||
|
||||
CMatRenderContextPtr pRenderContext( g_pMaterialSystem );
|
||||
pRenderContext->CullMode( MATERIAL_CULLMODE_CW );
|
||||
|
||||
BaseClass::Draw( pDrawSettings );
|
||||
|
||||
pRenderContext->CullMode( MATERIAL_CULLMODE_CCW );
|
||||
}
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
//
|
||||
//-----------------------------------------------------------------------------
|
||||
void CDmeMatSysDMXDag::GetSequenceList( CUtlVector< CUtlString > *pOutList )
|
||||
{
|
||||
// TODO: Look for sequences in the DMX file
|
||||
Assert( 0 );
|
||||
pOutList->RemoveAll();
|
||||
}
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
//
|
||||
//-----------------------------------------------------------------------------
|
||||
void CDmeMatSysDMXDag::GetActivityList( CUtlVector< CUtlString > *pOutList )
|
||||
{
|
||||
// DMX Model files don't have any activities
|
||||
pOutList->RemoveAll();
|
||||
}
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
//
|
||||
//-----------------------------------------------------------------------------
|
||||
void CDmeMatSysDMXDag::SetDmxRoot( CDmElement *pDmxRoot )
|
||||
{
|
||||
m_eDmxRoot.Set( pDmxRoot );
|
||||
|
||||
// Remove old DmeModel child
|
||||
if ( m_hDmxModel != DMELEMENT_HANDLE_INVALID )
|
||||
{
|
||||
for ( int i = 0; i < GetChildCount(); ++i )
|
||||
{
|
||||
CDmeDag *pDmeDag = GetChild( i );
|
||||
if ( !pDmeDag )
|
||||
continue;
|
||||
|
||||
if ( pDmeDag->GetHandle() == m_hDmxModel )
|
||||
{
|
||||
RemoveChild( i );
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
m_hDmxModel = DMELEMENT_HANDLE_INVALID;
|
||||
|
||||
matrix3x4_t mIdentity;
|
||||
SetIdentityMatrix( mIdentity );
|
||||
GetTransform()->SetTransform( mIdentity );
|
||||
|
||||
if ( pDmxRoot )
|
||||
{
|
||||
CDmeModel *pDmeModel = pDmxRoot->GetValueElement< CDmeModel >( "model" );
|
||||
if ( pDmeModel )
|
||||
{
|
||||
if ( !pDmeModel->IsZUp() )
|
||||
{
|
||||
GetTransform()->SetTransform(
|
||||
matrix3x4_t(
|
||||
0.0f, 0.0f, 1.0f, 0.0f,
|
||||
1.0f, 0.0f, 0.0f, 0.0f,
|
||||
0.0f, 1.0f, 0.0f, 0.0f ) );
|
||||
}
|
||||
|
||||
m_hDmxModel = pDmeModel->GetHandle();
|
||||
|
||||
AddChild( pDmeModel );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//=============================================================================
|
||||
// CDmeMatSysMPPDag
|
||||
//=============================================================================
|
||||
IMPLEMENT_ELEMENT_FACTORY( DmeMatSysMPPDag, CDmeMatSysMPPDag );
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
//
|
||||
//-----------------------------------------------------------------------------
|
||||
void CDmeMatSysMPPDag::OnConstruction()
|
||||
{
|
||||
m_eMppRoot.InitAndSet( this, "mppRoot", DMELEMENT_HANDLE_INVALID );
|
||||
m_hDmeBodyGroupList = DMELEMENT_HANDLE_INVALID;
|
||||
m_hDmeSequenceList = DMELEMENT_HANDLE_INVALID;
|
||||
}
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
//
|
||||
//-----------------------------------------------------------------------------
|
||||
void CDmeMatSysMPPDag::OnDestruction()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
//
|
||||
//-----------------------------------------------------------------------------
|
||||
void CDmeMatSysMPPDag::Draw( CDmeDrawSettings *pDrawSettings /* = NULL */ )
|
||||
{
|
||||
if ( !m_Visible )
|
||||
return;
|
||||
|
||||
// This is meant to be called from mixed rendering environment and
|
||||
// DmeMesh windings are backwards relative to MDL windings
|
||||
|
||||
CMatRenderContextPtr pRenderContext( g_pMaterialSystem );
|
||||
pRenderContext->CullMode( MATERIAL_CULLMODE_CW );
|
||||
|
||||
BaseClass::Draw( pDrawSettings );
|
||||
|
||||
pRenderContext->CullMode( MATERIAL_CULLMODE_CCW );
|
||||
}
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
//
|
||||
//-----------------------------------------------------------------------------
|
||||
void CDmeMatSysMPPDag::GetSequenceList( CUtlVector< CUtlString > *pOutList )
|
||||
{
|
||||
pOutList->RemoveAll();
|
||||
|
||||
if ( !m_eMppRoot )
|
||||
return;
|
||||
|
||||
CDmeSequenceList *pDmeSequenceList = m_eMppRoot->GetValueElement< CDmeSequenceList >( "sequenceList" );
|
||||
if ( !pDmeSequenceList )
|
||||
return;
|
||||
|
||||
CUtlVector< CDmeSequenceBase * > sortedSequenceList;
|
||||
pDmeSequenceList->GetSortedSequenceList( sortedSequenceList );
|
||||
|
||||
for ( int i = 0; i < sortedSequenceList.Count(); ++i )
|
||||
{
|
||||
pOutList->AddToTail( sortedSequenceList[i]->GetName() );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
//
|
||||
//-----------------------------------------------------------------------------
|
||||
void CDmeMatSysMPPDag::GetActivityList( CUtlVector< CUtlString > *pOutList )
|
||||
{
|
||||
pOutList->RemoveAll();
|
||||
|
||||
if ( !m_eMppRoot )
|
||||
return;
|
||||
|
||||
CDmeSequenceList *pDmeSequenceList = m_eMppRoot->GetValueElement< CDmeSequenceList >( "sequenceList" );
|
||||
if ( !pDmeSequenceList )
|
||||
return;
|
||||
|
||||
CUtlVector< CDmeSequenceBase * > sortedSequenceList;
|
||||
pDmeSequenceList->GetSortedSequenceList( sortedSequenceList );
|
||||
|
||||
CUtlDict<int, unsigned short> activityNames( true, 0, sortedSequenceList.Count() );
|
||||
|
||||
for ( int i = 0; i < sortedSequenceList.Count(); ++i )
|
||||
{
|
||||
const char *pszActivityName = sortedSequenceList[i]->m_eActivity->GetName();
|
||||
if ( pszActivityName && pszActivityName[0] )
|
||||
{
|
||||
// Multiple sequences can have the same activity name; only add unique activity names
|
||||
if ( activityNames.Find( pszActivityName ) == activityNames.InvalidIndex() )
|
||||
{
|
||||
pOutList->AddToTail( pszActivityName );
|
||||
activityNames.Insert( pszActivityName, i );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
//
|
||||
//-----------------------------------------------------------------------------
|
||||
CUtlString UniqueIdToString( const UniqueId_t &uniqueId )
|
||||
{
|
||||
char buf[64];
|
||||
UniqueIdToString( uniqueId, buf, ARRAYSIZE( buf ) );
|
||||
return CUtlString( buf );
|
||||
}
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
//
|
||||
//-----------------------------------------------------------------------------
|
||||
void CDmeMatSysMPPDag::SetMppRoot( CDmElement *pMppRoot )
|
||||
{
|
||||
m_eMppRoot.Set( pMppRoot );
|
||||
|
||||
RemoveNullAndImplicitChildren();
|
||||
|
||||
m_hDmeBodyGroupList = DMELEMENT_HANDLE_INVALID;
|
||||
m_hDmeSequenceList = DMELEMENT_HANDLE_INVALID;
|
||||
|
||||
matrix3x4_t mIdentity;
|
||||
SetIdentityMatrix( mIdentity );
|
||||
GetTransform()->SetTransform( mIdentity );
|
||||
|
||||
if ( pMppRoot )
|
||||
{
|
||||
CDmeBodyGroupList *pDmeBodyGroupList = pMppRoot->GetValueElement< CDmeBodyGroupList >( "bodyGroupList" );
|
||||
if ( pDmeBodyGroupList )
|
||||
{
|
||||
m_hDmeBodyGroupList = pDmeBodyGroupList->GetHandle();
|
||||
}
|
||||
|
||||
CDmeSequenceList *pDmeSequenceList = pMppRoot->GetValueElement< CDmeSequenceList >( "sequenceList" );
|
||||
if ( pDmeSequenceList )
|
||||
{
|
||||
m_hDmeSequenceList = pDmeSequenceList->GetHandle();
|
||||
}
|
||||
|
||||
bool bZUp = true;
|
||||
|
||||
for ( int i = 0; i < pDmeBodyGroupList->m_BodyGroups.Count(); ++i )
|
||||
{
|
||||
CDmeBodyGroup *pDmeBodyGroup = pDmeBodyGroupList->m_BodyGroups[i];
|
||||
if ( !pDmeBodyGroup )
|
||||
continue;
|
||||
|
||||
CDmeDag *pDmeBodyGroupDag = CreateElement< CDmeDag >( pDmeBodyGroup->GetName(), pDmeBodyGroup->GetFileId() );
|
||||
AddChild( pDmeBodyGroupDag );
|
||||
m_hChildren.AddToTail( pDmeBodyGroupDag->GetHandle() );
|
||||
|
||||
for ( int j = 0; j < pDmeBodyGroup->m_BodyParts.Count(); ++j )
|
||||
{
|
||||
CDmeBodyPart *pDmeBodyPart = pDmeBodyGroup->m_BodyParts[j];
|
||||
if ( !pDmeBodyPart )
|
||||
continue;
|
||||
|
||||
CDmeLODList *pDmeLODList = CastElement< CDmeLODList >( pDmeBodyPart );
|
||||
if ( !pDmeLODList )
|
||||
continue;
|
||||
|
||||
for ( int k = 0; k < pDmeLODList->m_LODs.Count(); ++k )
|
||||
{
|
||||
CDmeLOD *pDmeLOD = pDmeLODList->m_LODs[k];
|
||||
if ( !pDmeLOD )
|
||||
continue;
|
||||
|
||||
CDmeModel *pDmeModel = pDmeLOD->m_Model;
|
||||
if ( !pDmeModel )
|
||||
continue;
|
||||
|
||||
pDmeBodyGroupDag->AddChild( pDmeModel );
|
||||
|
||||
if ( !pDmeModel->IsZUp() )
|
||||
bZUp = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ( !bZUp )
|
||||
{
|
||||
GetTransform()->SetTransform(
|
||||
matrix3x4_t(
|
||||
0.0f, 0.0f, 1.0f, 0.0f,
|
||||
1.0f, 0.0f, 0.0f, 0.0f,
|
||||
0.0f, 1.0f, 0.0f, 0.0f ) );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
//
|
||||
//-----------------------------------------------------------------------------
|
||||
int CDmeMatSysMPPDag::SelectSequence( const char *pszSequenceName )
|
||||
{
|
||||
m_hDmeSequence = DMELEMENT_HANDLE_INVALID;
|
||||
m_dmeOperatorList.RemoveAll();
|
||||
|
||||
if ( !pszSequenceName || !pszSequenceName[0] )
|
||||
return -1;
|
||||
|
||||
if ( !m_eMppRoot )
|
||||
return -1;
|
||||
|
||||
CDmeSequenceList *pDmeSequenceList = m_eMppRoot->GetValueElement< CDmeSequenceList >( "sequenceList" );
|
||||
if ( !pDmeSequenceList )
|
||||
return -1;
|
||||
|
||||
CUtlVector< CDmeSequenceBase * > sortedSequenceList;
|
||||
for ( int i = 0; i < pDmeSequenceList->m_Sequences.Count(); ++i )
|
||||
{
|
||||
CDmeSequenceBase *pDmeSequenceBase = pDmeSequenceList->m_Sequences[i];
|
||||
if ( pDmeSequenceBase && !Q_stricmp( pszSequenceName, pDmeSequenceBase->GetName() ) )
|
||||
{
|
||||
CDmeSequence *pDmeSequence = CastElement< CDmeSequence >( pDmeSequenceBase );
|
||||
if ( !pDmeSequence )
|
||||
continue;
|
||||
|
||||
m_hDmeSequence = pDmeSequence->GetHandle();
|
||||
pDmeSequence->PrepareChannels( m_dmeOperatorList );
|
||||
|
||||
return pDmeSequence->GetFrameCount();
|
||||
}
|
||||
}
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
//
|
||||
//-----------------------------------------------------------------------------
|
||||
void CDmeMatSysMPPDag::SetTime( DmeTime_t dmeTime )
|
||||
{
|
||||
CDmeSequence *pDmeSequence = CastElement< CDmeSequence >( g_pDataModel->GetElement( m_hDmeSequence ) );
|
||||
if ( !pDmeSequence )
|
||||
return;
|
||||
|
||||
pDmeSequence->UpdateChannels( m_dmeOperatorList, dmeTime );
|
||||
|
||||
CUtlStack< CDmeDag * > depthFirstStack;
|
||||
depthFirstStack.Push( this );
|
||||
|
||||
while ( depthFirstStack.Count() > 0 )
|
||||
{
|
||||
CDmeDag *pDmeDag = NULL;
|
||||
depthFirstStack.Pop( pDmeDag );
|
||||
if ( !pDmeDag )
|
||||
continue;
|
||||
|
||||
for ( int i = pDmeDag->GetChildCount() - 1; i >= 0; --i )
|
||||
{
|
||||
depthFirstStack.Push( pDmeDag->GetChild( i ) );
|
||||
}
|
||||
|
||||
if ( !Q_stricmp( pDmeDag->GetName(), "root" ) )
|
||||
{
|
||||
CDmeTransform *pDmeTransform = pDmeDag->GetTransform();
|
||||
if ( !pDmeTransform )
|
||||
continue;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
//
|
||||
//-----------------------------------------------------------------------------
|
||||
void CDmeMatSysMPPDag::SetFrame( float flFrame )
|
||||
{
|
||||
// TODO: Handle a frame rate, Assume 30 fps :(
|
||||
SetTime( DmeTime_t( flFrame / 30.0f ) );
|
||||
}
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
//
|
||||
//-----------------------------------------------------------------------------
|
||||
void CDmeMatSysMPPDag::RemoveNullAndImplicitChildren()
|
||||
{
|
||||
// Clean up all automatically added children
|
||||
CUtlStack< int > childRemoveStack;
|
||||
for ( int i = 0; i < GetChildCount(); ++i )
|
||||
{
|
||||
CDmeDag *pDmeDag = GetChild( i );
|
||||
if ( pDmeDag )
|
||||
{
|
||||
for ( int j = 0; j < m_hChildren.Count(); ++j )
|
||||
{
|
||||
if ( pDmeDag->GetHandle() == m_hChildren[j] )
|
||||
{
|
||||
childRemoveStack.Push( i );
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// Remove NULL Children
|
||||
childRemoveStack.Push( i );
|
||||
}
|
||||
}
|
||||
|
||||
for ( int i = 0; i < childRemoveStack.Count(); ++i )
|
||||
{
|
||||
RemoveChild( childRemoveStack.Top() );
|
||||
childRemoveStack.Pop();
|
||||
}
|
||||
|
||||
m_hChildren.RemoveAll();
|
||||
}
|
36
mdlobjects/dmemdllist.cpp
Normal file
36
mdlobjects/dmemdllist.cpp
Normal file
@ -0,0 +1,36 @@
|
||||
//====== Copyright <20> 1996-2008, Valve Corporation, All rights reserved. =====//
|
||||
//
|
||||
// A general list element for the MDL pipeline
|
||||
//
|
||||
//===========================================================================//
|
||||
|
||||
|
||||
#include "datamodel/dmelementfactoryhelper.h"
|
||||
#include "mdlobjects/dmemdllist.h"
|
||||
|
||||
|
||||
// memdbgon must be the last include file in a .cpp file!!!
|
||||
#include "tier0/memdbgon.h"
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Expose this class to the scene database
|
||||
//-----------------------------------------------------------------------------
|
||||
IMPLEMENT_ELEMENT_FACTORY( DmeMdlList, CDmeMdlList );
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
//
|
||||
//-----------------------------------------------------------------------------
|
||||
void CDmeMdlList::OnConstruction()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
//
|
||||
//-----------------------------------------------------------------------------
|
||||
void CDmeMdlList::OnDestruction()
|
||||
{
|
||||
}
|
||||
|
92
mdlobjects/dmemotioncontrol.cpp
Normal file
92
mdlobjects/dmemotioncontrol.cpp
Normal file
@ -0,0 +1,92 @@
|
||||
//===== Copyright (c) 1996-2009, Valve Corporation, All rights reserved. ====
|
||||
//
|
||||
// Animation/Sequence events
|
||||
//
|
||||
//==========================================================================
|
||||
|
||||
|
||||
// Valve includes
|
||||
#include "mdlobjects/dmemotioncontrol.h"
|
||||
#include "datamodel/dmelementfactoryhelper.h"
|
||||
#include "studio.h"
|
||||
|
||||
|
||||
// memdbgon must be the last include file in a .cpp file!!!
|
||||
#include "tier0/memdbgon.h"
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Expose this class to the scene database
|
||||
//-----------------------------------------------------------------------------
|
||||
IMPLEMENT_ELEMENT_FACTORY( DmeMotionControl, CDmeMotionControl );
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
//
|
||||
//-----------------------------------------------------------------------------
|
||||
void CDmeMotionControl::OnConstruction()
|
||||
{
|
||||
m_bX.Init( this, "X" );
|
||||
m_bY.Init( this, "Y" );
|
||||
m_bZ.Init( this, "Z" );
|
||||
m_bXR.Init( this, "XR" );
|
||||
m_bYR.Init( this, "YR" );
|
||||
m_bZR.Init( this, "ZR" );
|
||||
m_bLX.Init( this, "LX" );
|
||||
m_bLY.Init( this, "LY" );
|
||||
m_bLZ.Init( this, "LZ" );
|
||||
m_bLXR.Init( this, "LXR" );
|
||||
m_bLYR.Init( this, "LYR" );
|
||||
m_bLZR.Init( this, "LZR" );
|
||||
m_bLM.Init( this, "LM" );
|
||||
}
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
//
|
||||
//-----------------------------------------------------------------------------
|
||||
void CDmeMotionControl::OnDestruction()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
//
|
||||
//-----------------------------------------------------------------------------
|
||||
void CDmeMotionControl::SetStudioMotionControl( int nStudioMotionControl )
|
||||
{
|
||||
m_bX = ( nStudioMotionControl & STUDIO_X ) != 0;
|
||||
m_bY = ( nStudioMotionControl & STUDIO_Y ) != 0;
|
||||
m_bZ = ( nStudioMotionControl & STUDIO_Z ) != 0;
|
||||
m_bXR = ( nStudioMotionControl & STUDIO_XR ) != 0;
|
||||
m_bYR = ( nStudioMotionControl & STUDIO_YR ) != 0;
|
||||
m_bZR = ( nStudioMotionControl & STUDIO_ZR ) != 0;
|
||||
m_bLX = ( nStudioMotionControl & STUDIO_LX ) != 0;
|
||||
m_bLY = ( nStudioMotionControl & STUDIO_LY ) != 0;
|
||||
m_bLZ = ( nStudioMotionControl & STUDIO_LZ ) != 0;
|
||||
m_bLXR = ( nStudioMotionControl & STUDIO_LXR ) != 0;
|
||||
m_bLYR = ( nStudioMotionControl & STUDIO_LYR ) != 0;
|
||||
m_bLZR = ( nStudioMotionControl & STUDIO_LZR ) != 0;
|
||||
m_bLM = ( nStudioMotionControl & STUDIO_LINEAR ) != 0;
|
||||
}
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
//
|
||||
//-----------------------------------------------------------------------------
|
||||
int CDmeMotionControl::GetStudioMotionControl() const
|
||||
{
|
||||
return ( m_bX ? STUDIO_X : 0 ) |
|
||||
( m_bY ? STUDIO_Y : 0 ) |
|
||||
( m_bZ ? STUDIO_Z : 0 ) |
|
||||
( m_bXR ? STUDIO_XR : 0 ) |
|
||||
( m_bYR ? STUDIO_YR : 0 ) |
|
||||
( m_bZR ? STUDIO_ZR : 0 ) |
|
||||
( m_bLX ? STUDIO_LX : 0 ) |
|
||||
( m_bLY ? STUDIO_LY : 0 ) |
|
||||
( m_bLZ ? STUDIO_LZ : 0 ) |
|
||||
( m_bLXR ? STUDIO_LXR : 0 ) |
|
||||
( m_bLYR ? STUDIO_LYR : 0 ) |
|
||||
( m_bLZR ? STUDIO_LZR : 0 ) |
|
||||
( m_bLM ? STUDIO_LINEAR : 0 );
|
||||
}
|
40
mdlobjects/dmemouth.cpp
Normal file
40
mdlobjects/dmemouth.cpp
Normal file
@ -0,0 +1,40 @@
|
||||
//============ Copyright (c) Valve Corporation, All rights reserved. ==========
|
||||
//
|
||||
//=============================================================================
|
||||
|
||||
|
||||
|
||||
// Valve includes
|
||||
#include "datamodel/dmelementfactoryhelper.h"
|
||||
#include "mdlobjects/dmemouth.h"
|
||||
#include "movieobjects/dmedag.h"
|
||||
|
||||
|
||||
// memdbgon must be the last include file in a .cpp file!!!
|
||||
#include "tier0/memdbgon.h"
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Expose this class to the scene database
|
||||
//-----------------------------------------------------------------------------
|
||||
IMPLEMENT_ELEMENT_FACTORY( DmeMouth, CDmeMouth );
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
//
|
||||
//-----------------------------------------------------------------------------
|
||||
void CDmeMouth::OnConstruction()
|
||||
{
|
||||
m_nMouthNumber.Init( this, "mouthNumber" );
|
||||
m_sFlexControllerName.Init( this, "flexControllerName" );
|
||||
m_sBoneName.Init( this, "boneName" );
|
||||
m_vForward.Init( this, "forward" );
|
||||
}
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
//
|
||||
//-----------------------------------------------------------------------------
|
||||
void CDmeMouth::OnDestruction()
|
||||
{
|
||||
}
|
41
mdlobjects/dmeposeparameter.cpp
Normal file
41
mdlobjects/dmeposeparameter.cpp
Normal file
@ -0,0 +1,41 @@
|
||||
//===== Copyright (c) 1996-2009, Valve Corporation, All rights reserved. ====
|
||||
//
|
||||
// Dme version of QC $poseparameter
|
||||
//
|
||||
//===========================================================================//
|
||||
|
||||
|
||||
// Valve includes
|
||||
#include "datamodel/dmelementfactoryhelper.h"
|
||||
#include "mdlobjects/dmeposeparameter.h"
|
||||
|
||||
|
||||
// memdbgon must be the last include file in a .cpp file!!!
|
||||
#include "tier0/memdbgon.h"
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Expose this class to the scene database
|
||||
//-----------------------------------------------------------------------------
|
||||
IMPLEMENT_ELEMENT_FACTORY( DmePoseParameter, CDmePoseParameter );
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
//
|
||||
//-----------------------------------------------------------------------------
|
||||
void CDmePoseParameter::OnConstruction()
|
||||
{
|
||||
m_flMin.Init( this, "min" );
|
||||
m_flMax.Init( this, "max" );
|
||||
m_bLoop.Init( this, "loop" );
|
||||
m_flLoopRange.Init( this, "loopRange" );
|
||||
m_bWrap.Init( this, "wrap" );
|
||||
}
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
//
|
||||
//-----------------------------------------------------------------------------
|
||||
void CDmePoseParameter::OnDestruction()
|
||||
{
|
||||
}
|
38
mdlobjects/dmeposeparameterlist.cpp
Normal file
38
mdlobjects/dmeposeparameterlist.cpp
Normal file
@ -0,0 +1,38 @@
|
||||
//===== Copyright (c) 1996-2009, Valve Corporation, All rights reserved. ====
|
||||
//
|
||||
// List of DmePoseParamaters
|
||||
//
|
||||
//===========================================================================//
|
||||
|
||||
|
||||
// Valve includes
|
||||
#include "datamodel/dmelementfactoryhelper.h"
|
||||
#include "mdlobjects/dmeposeparameter.h"
|
||||
#include "mdlobjects/dmeposeparameterlist.h"
|
||||
|
||||
|
||||
// memdbgon must be the last include file in a .cpp file!!!
|
||||
#include "tier0/memdbgon.h"
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Expose this class to the scene database
|
||||
//-----------------------------------------------------------------------------
|
||||
IMPLEMENT_ELEMENT_FACTORY( DmePoseParameterList, CDmePoseParameterList );
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
//
|
||||
//-----------------------------------------------------------------------------
|
||||
void CDmePoseParameterList::OnConstruction()
|
||||
{
|
||||
m_ePoseParameterList.Init( this, "poseParameterList" );
|
||||
}
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
//
|
||||
//-----------------------------------------------------------------------------
|
||||
void CDmePoseParameterList::OnDestruction()
|
||||
{
|
||||
}
|
36
mdlobjects/dmeproceduralbone.cpp
Normal file
36
mdlobjects/dmeproceduralbone.cpp
Normal file
@ -0,0 +1,36 @@
|
||||
//====== Copyright <20> 1996-2009, Valve Corporation, All rights reserved. =======
|
||||
//
|
||||
// DmeProceduralBone
|
||||
//
|
||||
//=============================================================================
|
||||
|
||||
|
||||
// Valve includes
|
||||
#include "datamodel/dmelementfactoryhelper.h"
|
||||
#include "mdlobjects/dmeproceduralbone.h"
|
||||
|
||||
|
||||
// memdbgon must be the last include file in a .cpp file!!!
|
||||
#include "tier0/memdbgon.h"
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Expose this class to the scene database
|
||||
//-----------------------------------------------------------------------------
|
||||
IMPLEMENT_ELEMENT_FACTORY( DmeProceduralBone, CDmeProceduralBone );
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
//
|
||||
//-----------------------------------------------------------------------------
|
||||
void CDmeProceduralBone::OnConstruction()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
//
|
||||
//-----------------------------------------------------------------------------
|
||||
void CDmeProceduralBone::OnDestruction()
|
||||
{
|
||||
}
|
646
mdlobjects/dmesequence.cpp
Normal file
646
mdlobjects/dmesequence.cpp
Normal file
@ -0,0 +1,646 @@
|
||||
//====== Copyright <20> 1996-2008, Valve Corporation, All rights reserved. =====//
|
||||
//
|
||||
// Dme representation of QC: $sequence
|
||||
//
|
||||
//===========================================================================//
|
||||
|
||||
|
||||
// Valve includes
|
||||
#include "datamodel/dmelementfactoryhelper.h"
|
||||
#include "movieobjects/dmeattributereference.h"
|
||||
#include "movieobjects/dmeanimationlist.h"
|
||||
#include "movieobjects/dmechannel.h"
|
||||
#include "movieobjects/dmeconnectionoperator.h"
|
||||
#include "movieobjects/dmedag.h"
|
||||
#include "mdlobjects/dmeanimcmd.h"
|
||||
#include "mdlobjects/dmeik.h"
|
||||
#include "mdlobjects/dmemotioncontrol.h"
|
||||
#include "mdlobjects/dmesequence.h"
|
||||
#include "mdlobjects/dmebonemask.h"
|
||||
|
||||
|
||||
// memdbgon must be the last include file in a .cpp file!!!
|
||||
#include "tier0/memdbgon.h"
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// CDmeAnimationEvent
|
||||
//-----------------------------------------------------------------------------
|
||||
//-----------------------------------------------------------------------------
|
||||
// Expose this class to the scene database
|
||||
//-----------------------------------------------------------------------------
|
||||
IMPLEMENT_ELEMENT_FACTORY( DmeAnimationEvent, CDmeAnimationEvent );
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
//
|
||||
//-----------------------------------------------------------------------------
|
||||
void CDmeAnimationEvent::OnConstruction()
|
||||
{
|
||||
m_nFrame.Init( this, "frame" );
|
||||
m_sDataString.Init( this, "dataString" );
|
||||
}
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
//
|
||||
//-----------------------------------------------------------------------------
|
||||
void CDmeAnimationEvent::OnDestruction()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// CDmeSequenceActivity
|
||||
//-----------------------------------------------------------------------------
|
||||
//-----------------------------------------------------------------------------
|
||||
// Expose this class to the scene database
|
||||
//-----------------------------------------------------------------------------
|
||||
IMPLEMENT_ELEMENT_FACTORY( DmeSequenceActivity, CDmeSequenceActivity );
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
//
|
||||
//-----------------------------------------------------------------------------
|
||||
void CDmeSequenceActivity::OnConstruction()
|
||||
{
|
||||
m_nWeight.InitAndSet( this, "weight", 1.0 );
|
||||
m_sModifierList.Init( this, "modifierList" );
|
||||
}
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
//
|
||||
//-----------------------------------------------------------------------------
|
||||
void CDmeSequenceActivity::OnDestruction()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// CDmeSequenceBlendBase
|
||||
//-----------------------------------------------------------------------------
|
||||
//-----------------------------------------------------------------------------
|
||||
// Expose this class to the scene database
|
||||
//-----------------------------------------------------------------------------
|
||||
IMPLEMENT_ELEMENT_FACTORY( DmeSequenceBlendBase, CDmeSequenceBlendBase );
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
//
|
||||
//-----------------------------------------------------------------------------
|
||||
void CDmeSequenceBlendBase::OnConstruction()
|
||||
{
|
||||
m_sPoseParameterName.Init( this, "poseParameterName" );
|
||||
}
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
//
|
||||
//-----------------------------------------------------------------------------
|
||||
void CDmeSequenceBlendBase::OnDestruction()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// CDmeSequenceBlend
|
||||
//-----------------------------------------------------------------------------
|
||||
//-----------------------------------------------------------------------------
|
||||
// Expose this class to the scene database
|
||||
//-----------------------------------------------------------------------------
|
||||
IMPLEMENT_ELEMENT_FACTORY( DmeSequenceBlend, CDmeSequenceBlend );
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
//
|
||||
//-----------------------------------------------------------------------------
|
||||
void CDmeSequenceBlend::OnConstruction()
|
||||
{
|
||||
m_flParamStart.Init( this, "paramStart" );
|
||||
m_flParamEnd.Init( this, "paramEnd" );
|
||||
}
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
//
|
||||
//-----------------------------------------------------------------------------
|
||||
void CDmeSequenceBlend::OnDestruction()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// CDmeSequenceCalcBlend
|
||||
//-----------------------------------------------------------------------------
|
||||
//-----------------------------------------------------------------------------
|
||||
// Expose this class to the scene database
|
||||
//-----------------------------------------------------------------------------
|
||||
IMPLEMENT_ELEMENT_FACTORY( DmeSequenceCalcBlend, CDmeSequenceCalcBlend );
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
//
|
||||
//-----------------------------------------------------------------------------
|
||||
void CDmeSequenceCalcBlend::OnConstruction()
|
||||
{
|
||||
m_sAttachmentName.Init( this, "attachmentName" );
|
||||
m_eMotionControl.InitAndCreate( this, "motionControl" );
|
||||
}
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
//
|
||||
//-----------------------------------------------------------------------------
|
||||
void CDmeSequenceCalcBlend::OnDestruction()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// CDmeSequenceLayerBase
|
||||
//-----------------------------------------------------------------------------
|
||||
//-----------------------------------------------------------------------------
|
||||
// Expose this class to the scene database
|
||||
//-----------------------------------------------------------------------------
|
||||
IMPLEMENT_ELEMENT_FACTORY( DmeSequenceLayerBase, CDmeSequenceLayerBase );
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
//
|
||||
//-----------------------------------------------------------------------------
|
||||
void CDmeSequenceLayerBase::OnConstruction()
|
||||
{
|
||||
m_eAnimation.Init( this, "animation" );
|
||||
}
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
//
|
||||
//-----------------------------------------------------------------------------
|
||||
void CDmeSequenceLayerBase::OnDestruction()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// CDmeSequenceAddLayer
|
||||
//-----------------------------------------------------------------------------
|
||||
//-----------------------------------------------------------------------------
|
||||
// Expose this class to the scene database
|
||||
//-----------------------------------------------------------------------------
|
||||
IMPLEMENT_ELEMENT_FACTORY( DmeSequenceAddLayer, CDmeSequenceAddLayer );
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
//
|
||||
//-----------------------------------------------------------------------------
|
||||
void CDmeSequenceAddLayer::OnConstruction()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
//
|
||||
//-----------------------------------------------------------------------------
|
||||
void CDmeSequenceAddLayer::OnDestruction()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// CDmeSequenceBlendLayer
|
||||
//-----------------------------------------------------------------------------
|
||||
//-----------------------------------------------------------------------------
|
||||
// Expose this class to the scene database
|
||||
//-----------------------------------------------------------------------------
|
||||
IMPLEMENT_ELEMENT_FACTORY( DmeSequenceBlendLayer, CDmeSequenceBlendLayer );
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
//
|
||||
//-----------------------------------------------------------------------------
|
||||
void CDmeSequenceBlendLayer::OnConstruction()
|
||||
{
|
||||
m_flStartFrame.Init( this, "startFrame" );
|
||||
m_flPeakFrame.Init( this, "peakFrame" );
|
||||
m_flTailFrame.Init( this, "tailFrame" );
|
||||
m_flEndFrame.Init( this, "endFrame" );
|
||||
m_bSpline.Init( this, "spline" );
|
||||
m_bCrossfade.Init( this, "crossfade" );
|
||||
m_bNoBlend.Init( this, "noBlend" );
|
||||
m_bLocal.Init( this, "local" );
|
||||
m_sPoseParameterName.Init( this, "poseParameterName" );
|
||||
}
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
//
|
||||
//-----------------------------------------------------------------------------
|
||||
void CDmeSequenceBlendLayer::OnDestruction()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// CDmeSequenceBase
|
||||
//-----------------------------------------------------------------------------
|
||||
//-----------------------------------------------------------------------------
|
||||
// Expose this class to the scene database
|
||||
//-----------------------------------------------------------------------------
|
||||
IMPLEMENT_ELEMENT_FACTORY( DmeSequenceBase, CDmeSequenceBase );
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
//
|
||||
//-----------------------------------------------------------------------------
|
||||
void CDmeSequenceBase::OnConstruction()
|
||||
{
|
||||
m_eActivity.InitAndCreate( this, "activity" );
|
||||
m_bHidden.InitAndSet( this, "hidden", false );
|
||||
m_bDelta.InitAndSet( this, "delta", false );
|
||||
m_bWorldSpace.InitAndSet( this, "worldSpace", false );
|
||||
m_bPreDelta.InitAndSet( this, "preDelta", false );
|
||||
m_bAutoPlay.InitAndSet( this, "autoPlay", false );
|
||||
m_bRealtime.InitAndSet( this, "realtime", false );
|
||||
m_flFadeIn.InitAndSet( this, "fadein", 0.2f );
|
||||
m_flFadeOut.InitAndSet( this, "fadeout", 0.2f );
|
||||
m_sEntryNode.Init( this, "entryNode" );
|
||||
m_sExitNode.Init( this, "exitNode" );
|
||||
m_bReverseNodeTransition.Init( this, "reverseNodeTransition" );
|
||||
|
||||
m_bSnap.Init( this, "snap" );
|
||||
m_bPost.Init( this, "post" );
|
||||
m_bLoop.Init( this, "loop" );
|
||||
|
||||
m_eIkLockList.Init( this, "ikLockList", FATTRIB_NEVERCOPY );
|
||||
m_eAnimationEventList.Init( this, "animationEventList" );
|
||||
m_eLayerList.Init( this, "layerList" );
|
||||
m_sKeyValues.Init( this, "keyValues" );
|
||||
|
||||
if ( m_eActivity.GetElement() )
|
||||
{
|
||||
if ( !Q_strcmp( "unnamed", m_eActivity.GetElement()->GetName() ) )
|
||||
{
|
||||
m_eActivity.GetElement()->SetName( "" );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
//
|
||||
//-----------------------------------------------------------------------------
|
||||
void CDmeSequenceBase::OnDestruction()
|
||||
{
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// qsort function for sorting DmeBaseSequence elements based on type and
|
||||
// sequence references.
|
||||
//
|
||||
// * A DmeBaseSequence must be either a DmeSequence or a DmeMultiSequence
|
||||
// They are mutually exclusive, cannot be both
|
||||
// * DmeMultiSequence refer to DmeSequence's so should always go last
|
||||
// * DmeMultiSequence cannot refer to other DmeMultiSequence so they are
|
||||
// considered equal
|
||||
// * DmeSequence can refer to other DmeSequence elements via DmeAnimCmd's
|
||||
// but circular references are not allowed. If a DmeSequence refers
|
||||
// to another, the DmeSequence being referenced needs to be before the
|
||||
// DmeSequence doing the referring
|
||||
// * If no referrals between two DmeSequence's, sort based on DmeAnimCmd count
|
||||
// so DmeSequence's with fewer DmeAnimCmd's go first
|
||||
//-----------------------------------------------------------------------------
|
||||
int CDmeSequenceBase::QSortFunction( const void *pVoidSeq1, const void *pVoidSeq2 )
|
||||
{
|
||||
const CDmeSequenceBase *pBaseSeq1 = *( const CDmeSequenceBase ** )pVoidSeq1;
|
||||
const CDmeSequenceBase *pBaseSeq2 = *( const CDmeSequenceBase ** )pVoidSeq2;
|
||||
|
||||
if ( !pBaseSeq1 || !pBaseSeq2 )
|
||||
return 0;
|
||||
|
||||
const CDmeSequence* pSeq1 = CastElement< CDmeSequence >( pBaseSeq1 ); // NULL if MultiSequence
|
||||
const CDmeSequence* pSeq2 = CastElement< CDmeSequence >( pBaseSeq2 ); // NULL if MultiSequence
|
||||
|
||||
if ( pSeq1 && !pSeq2 ) // 1 Seq, 2 Multi, 1 < 2
|
||||
return -1;
|
||||
|
||||
if ( !pSeq1 && pSeq2 ) // 1 Multi, 2 Seq, 1 > 2
|
||||
return 1;
|
||||
|
||||
if ( !pSeq1 && !pSeq2 ) // Both Multi, 1 == 2, Multi can't refer to other multi
|
||||
return 0;
|
||||
|
||||
// Both Seq, check for references
|
||||
bool bRef[2] = { false, false };
|
||||
const CDmeSequence *const pSeq[2] = { pSeq1, pSeq2 };
|
||||
|
||||
for ( int i = 0; i < 2; ++i )
|
||||
{
|
||||
for ( int j = 0; j < pSeq[i]->m_eAnimationCommandList.Count(); ++j )
|
||||
{
|
||||
const CDmeAnimCmd *pAnimCmd = pSeq[i]->m_eAnimationCommandList[j];
|
||||
const CDmeAnimCmdSubtract *pAnimCmdSubtract = CastElement< CDmeAnimCmdSubtract >( pAnimCmd );
|
||||
if ( pAnimCmdSubtract && pAnimCmdSubtract->m_eAnimation.GetHandle() == pSeq[ (i + 1) % 2 ]->GetHandle() )
|
||||
{
|
||||
bRef[i] = true;
|
||||
break;
|
||||
}
|
||||
else
|
||||
{
|
||||
const CDmeAnimCmdAlign *pAnimCmdAlign = CastElement< CDmeAnimCmdAlign >( pAnimCmd );
|
||||
if ( pAnimCmdAlign && pAnimCmdAlign->m_eAnimation.GetHandle() == pSeq[ ( i + 1 ) % 2 ]->GetHandle() )
|
||||
{
|
||||
bRef[i] = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ( bRef[0] && !bRef[1] ) // 1 references 2, so 1 > 2
|
||||
return 1;
|
||||
|
||||
if ( !bRef[0] && bRef[1] ) // 1 references by 2, so 1 < 2
|
||||
return -1;
|
||||
|
||||
if ( bRef[0] && bRef[1] )
|
||||
{
|
||||
Error( "Animation %s & %s reference each other, circular references are not allowed\n", pSeq1->GetName(), pSeq2->GetName() );
|
||||
return 0;
|
||||
}
|
||||
|
||||
if ( pSeq1->m_eAnimationCommandList.Count() < pSeq2->m_eAnimationCommandList.Count() )
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
else if ( pSeq1->m_eAnimationCommandList.Count() > pSeq2->m_eAnimationCommandList.Count() )
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// CDmeSequence
|
||||
//-----------------------------------------------------------------------------
|
||||
//-----------------------------------------------------------------------------
|
||||
// Expose this class to the scene database
|
||||
//-----------------------------------------------------------------------------
|
||||
IMPLEMENT_ELEMENT_FACTORY( DmeSequence, CDmeSequence );
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
//
|
||||
//-----------------------------------------------------------------------------
|
||||
void CDmeSequence::OnConstruction()
|
||||
{
|
||||
m_eSkeleton.Init( this, "skeleton" );
|
||||
m_eAnimationList.Init( this, "animationList" );
|
||||
|
||||
m_flFPS.InitAndSet( this, "fps", 30.0f );
|
||||
m_vOrigin.InitAndSet( this, "origin", Vector( 0.0f, 0.0f, 0.0f ) );
|
||||
m_flScale.InitAndSet( this, "scale", 1.0f );
|
||||
m_nStartLoop.Init( this, "startLoop" );
|
||||
|
||||
m_bForceLoop.Init( this, "forceLoop" );
|
||||
m_bAutoIk.Init( this, "autoIk" );
|
||||
m_flMotionRollback.InitAndSet( this, "motionRollback", 0.3f );
|
||||
m_bAnimBlocks.InitAndSet( this, "animBlocks", true );
|
||||
m_bAnimBlockStall.InitAndSet( this, "animBlockStall", true );
|
||||
|
||||
m_eMotionControl.InitAndCreate( this, "motionControl" );
|
||||
|
||||
m_eAnimationCommandList.Init( this, "animationCommandList" );
|
||||
m_eIkRuleList.Init( this, "ikRuleList", FATTRIB_NEVERCOPY );
|
||||
|
||||
m_eBoneMask.Init( this, "boneMask" );
|
||||
}
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
//
|
||||
//-----------------------------------------------------------------------------
|
||||
void CDmeSequence::OnDestruction()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
//
|
||||
//-----------------------------------------------------------------------------
|
||||
CDmeChannelsClip *CDmeSequence::GetDmeChannelsClip() const
|
||||
{
|
||||
CDmeAnimationList *pDmeAnimationList = m_eAnimationList.GetElement();
|
||||
if ( !pDmeAnimationList )
|
||||
return NULL;
|
||||
|
||||
for ( int i = 0; i < pDmeAnimationList->GetAnimationCount(); ++i )
|
||||
{
|
||||
CDmeChannelsClip *pDmeChannelsClip = pDmeAnimationList->GetAnimation( i );
|
||||
if ( pDmeChannelsClip )
|
||||
return pDmeChannelsClip;
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
//
|
||||
//-----------------------------------------------------------------------------
|
||||
DmeFramerate_t CDmeSequence::GetFrameRate(
|
||||
DmeFramerate_t fallbackFrameRate /* = 30 */,
|
||||
bool bForceFallback /* = false */ ) const
|
||||
{
|
||||
CDmeChannelsClip *pDmeChannelsClip = GetDmeChannelsClip();
|
||||
if ( !pDmeChannelsClip )
|
||||
return fallbackFrameRate;
|
||||
|
||||
DmeFramerate_t dmeFrameRate = fallbackFrameRate;
|
||||
if ( !bForceFallback && pDmeChannelsClip->HasAttribute( "frameRate" ) )
|
||||
{
|
||||
const int nFrameRate = pDmeChannelsClip->GetValue< int >( "frameRate", 0 );
|
||||
if ( nFrameRate >= 0 )
|
||||
{
|
||||
dmeFrameRate = DmeFramerate_t( nFrameRate );
|
||||
}
|
||||
}
|
||||
|
||||
return dmeFrameRate;
|
||||
}
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
//
|
||||
//-----------------------------------------------------------------------------
|
||||
int CDmeSequence::GetFrameCount(
|
||||
DmeFramerate_t fallbackFrameRate /* = 30 */,
|
||||
bool bForceFallback /* = false */ ) const
|
||||
{
|
||||
CDmeChannelsClip *pDmeChannelsClip = GetDmeChannelsClip();
|
||||
if ( !pDmeChannelsClip )
|
||||
return 0;
|
||||
|
||||
const DmeFramerate_t dmeFrameRate = GetFrameRate( fallbackFrameRate, bForceFallback );
|
||||
|
||||
const DmeTime_t nStartTime = pDmeChannelsClip->GetStartTime();
|
||||
const int nStartFrame = FrameForTime( nStartTime, dmeFrameRate );
|
||||
|
||||
const DmeTime_t nEndTime = pDmeChannelsClip->GetEndTime();
|
||||
const int nEndFrame = FrameForTime( nEndTime, dmeFrameRate );
|
||||
|
||||
return nEndFrame - nStartFrame + 1;
|
||||
}
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Does a search through connection operators for dependent DmeOperators
|
||||
//-----------------------------------------------------------------------------
|
||||
void CDmeSequence::GetDependentOperators( CUtlVector< IDmeOperator * > &operatorList, CDmeOperator *pDmeOperator ) const
|
||||
{
|
||||
if ( !pDmeOperator || !CastElement< CDmeOperator >( pDmeOperator ) )
|
||||
return;
|
||||
|
||||
// Abort if the specified operator is already in the operatorList
|
||||
for ( int i = 0; i < operatorList.Count(); ++i )
|
||||
{
|
||||
CDmeOperator *pTmpDmeOperator = CastElement< CDmeOperator >( reinterpret_cast< CDmeOperator * >( operatorList[i] ) );
|
||||
if ( pTmpDmeOperator && pTmpDmeOperator == pDmeOperator )
|
||||
return;
|
||||
}
|
||||
|
||||
operatorList.AddToTail( pDmeOperator );
|
||||
|
||||
CUtlVector< CDmAttribute * > outAttrList;
|
||||
pDmeOperator->GetOutputAttributes( outAttrList );
|
||||
|
||||
for ( int i = 0; i < outAttrList.Count(); ++i )
|
||||
{
|
||||
CDmElement *pDmElement = outAttrList[i]->GetOwner();
|
||||
if ( !pDmElement )
|
||||
continue;
|
||||
|
||||
if ( pDmElement != pDmeOperator )
|
||||
{
|
||||
CUtlVector< CDmElement * > reList0;
|
||||
FindReferringElements( reList0, pDmElement, g_pDataModel->GetSymbol( "element" ), false );
|
||||
for ( int j = 0; j < reList0.Count(); ++j )
|
||||
{
|
||||
CDmeAttributeReference *pRe0 = CastElement< CDmeAttributeReference >( reList0[j] );
|
||||
if ( !pRe0 || pRe0->GetReferencedAttribute() != outAttrList[i] )
|
||||
continue;
|
||||
|
||||
CUtlVector< CDmElement * > reList1;
|
||||
FindReferringElements( reList1, pRe0, g_pDataModel->GetSymbol( "input" ), false );
|
||||
for ( int k = 0; k < reList1.Count(); ++k )
|
||||
{
|
||||
CDmeConnectionOperator *pRe1 = CastElement< CDmeConnectionOperator >( reList1[k] );
|
||||
if ( !pRe1 )
|
||||
continue;
|
||||
|
||||
GetDependentOperators( operatorList, pRe1 );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
GetDependentOperators( operatorList, CastElement< CDmeOperator >( pDmElement ) );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
//
|
||||
//-----------------------------------------------------------------------------
|
||||
void CDmeSequence::PrepareChannels( CUtlVector< IDmeOperator * > &dmeOperatorList )
|
||||
{
|
||||
dmeOperatorList.RemoveAll();
|
||||
|
||||
CDmeAnimationList *pDmeAnimationList = m_eAnimationList.GetElement();
|
||||
if ( !pDmeAnimationList )
|
||||
return;
|
||||
|
||||
for ( int i = 0; i < pDmeAnimationList->GetAnimationCount(); ++i )
|
||||
{
|
||||
CDmeChannelsClip *pDmeChannelsClip = pDmeAnimationList->GetAnimation( i );
|
||||
if ( !pDmeChannelsClip )
|
||||
continue;
|
||||
|
||||
for ( int j = 0; j < pDmeChannelsClip->m_Channels.Count(); ++j )
|
||||
{
|
||||
CDmeChannel *pDmeChannel = pDmeChannelsClip->m_Channels[j];
|
||||
if ( !pDmeChannel )
|
||||
continue;
|
||||
|
||||
pDmeChannel->SetMode( CM_PLAY );
|
||||
GetDependentOperators( dmeOperatorList, pDmeChannel );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Update channels so they are in position for the next frame
|
||||
//-----------------------------------------------------------------------------
|
||||
void CDmeSequence::UpdateChannels( CUtlVector< IDmeOperator * > &dmeOperatorList, DmeTime_t nClipTime )
|
||||
{
|
||||
CDmeAnimationList *pDmeAnimationList = m_eAnimationList.GetElement();
|
||||
if ( !pDmeAnimationList )
|
||||
return;
|
||||
|
||||
for ( int i = 0; i < pDmeAnimationList->GetAnimationCount(); ++i )
|
||||
{
|
||||
CDmeChannelsClip *pDmeChannelsClip = pDmeAnimationList->GetAnimation( i );
|
||||
if ( !pDmeChannelsClip )
|
||||
continue;
|
||||
|
||||
const DmeTime_t channelTime = pDmeChannelsClip->ToChildMediaTime( nClipTime );
|
||||
|
||||
const int nChannelsCount = pDmeChannelsClip->m_Channels.Count();
|
||||
for ( int j = 0; j < nChannelsCount; ++j )
|
||||
{
|
||||
pDmeChannelsClip->m_Channels[j]->SetCurrentTime( channelTime );
|
||||
}
|
||||
}
|
||||
|
||||
// Recompute the position of the joints
|
||||
{
|
||||
CDisableUndoScopeGuard guard;
|
||||
g_pDmElementFramework->SetOperators( dmeOperatorList );
|
||||
g_pDmElementFramework->Operate( true );
|
||||
}
|
||||
|
||||
g_pDmElementFramework->BeginEdit();
|
||||
}
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// CDmeMultiSequence
|
||||
//-----------------------------------------------------------------------------
|
||||
//-----------------------------------------------------------------------------
|
||||
// Expose this class to the scene database
|
||||
//-----------------------------------------------------------------------------
|
||||
IMPLEMENT_ELEMENT_FACTORY( DmeMultiSequence, CDmeMultiSequence );
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
//
|
||||
//-----------------------------------------------------------------------------
|
||||
void CDmeMultiSequence::OnConstruction()
|
||||
{
|
||||
m_nBlendWidth.InitAndSet( this, "blendWidth", 0 );
|
||||
m_eBlendRef.Init( this, "blendRef", FATTRIB_NEVERCOPY );
|
||||
m_eBlendComp.Init( this, "blendComp", FATTRIB_NEVERCOPY );
|
||||
m_eBlendCenter.Init( this, "blendCenter", FATTRIB_NEVERCOPY );
|
||||
m_eSequenceList.Init( this, "sequenceList", FATTRIB_NEVERCOPY );
|
||||
m_eBlendList.Init( this, "blendList" );
|
||||
}
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
//
|
||||
//-----------------------------------------------------------------------------
|
||||
void CDmeMultiSequence::OnDestruction()
|
||||
{
|
||||
}
|
83
mdlobjects/dmesequencelist.cpp
Normal file
83
mdlobjects/dmesequencelist.cpp
Normal file
@ -0,0 +1,83 @@
|
||||
//====== Copyright <20> 1996-2008, Valve Corporation, All rights reserved. =====//
|
||||
//
|
||||
// A list of DmeSequences's
|
||||
//
|
||||
//===========================================================================//
|
||||
|
||||
|
||||
#include "datamodel/dmelementfactoryhelper.h"
|
||||
#include "mdlobjects/dmesequence.h"
|
||||
#include "mdlobjects/dmesequencelist.h"
|
||||
#include "mdlobjects/dmeik.h"
|
||||
|
||||
|
||||
// memdbgon must be the last include file in a .cpp file!!!
|
||||
#include "tier0/memdbgon.h"
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Expose this class to the scene database
|
||||
//-----------------------------------------------------------------------------
|
||||
IMPLEMENT_ELEMENT_FACTORY( DmeSequenceList, CDmeSequenceList );
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
//
|
||||
//-----------------------------------------------------------------------------
|
||||
void CDmeSequenceList::OnConstruction()
|
||||
{
|
||||
m_Sequences.Init( this, "sequences" );
|
||||
m_eIkChainList.Init( this, "ikChainList" );
|
||||
}
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
//
|
||||
//-----------------------------------------------------------------------------
|
||||
void CDmeSequenceList::OnDestruction()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Returns a sorted of the sequences in the m_Sequences attribute in order of priority
|
||||
// Sequences that are referred to come before the sequences that refer to them
|
||||
//-----------------------------------------------------------------------------
|
||||
void CDmeSequenceList::GetSortedSequenceList( CUtlVector< CDmeSequenceBase * > &sortedSequenceList ) const
|
||||
{
|
||||
sortedSequenceList.RemoveAll();
|
||||
|
||||
const int nSequenceCount = m_Sequences.Count();
|
||||
|
||||
sortedSequenceList.EnsureCapacity( nSequenceCount );
|
||||
|
||||
for ( int i = 0; i < nSequenceCount; ++i )
|
||||
{
|
||||
CDmeSequenceBase *pDmeSequenceBase = m_Sequences[i];
|
||||
if ( !pDmeSequenceBase )
|
||||
continue;
|
||||
|
||||
sortedSequenceList.AddToTail( pDmeSequenceBase );
|
||||
}
|
||||
|
||||
qsort( sortedSequenceList.Base(), sortedSequenceList.Count(), sizeof( CDmeSequenceBase * ), CDmeSequenceBase::QSortFunction );
|
||||
}
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Sorts the sequences in the m_Sequences attribute in order of priority
|
||||
// Sequences that are referred to come before the sequences that refer to them
|
||||
//-----------------------------------------------------------------------------
|
||||
void CDmeSequenceList::SortSequences()
|
||||
{
|
||||
CUtlVector< CDmeSequenceBase * > sortedSequenceList;
|
||||
|
||||
GetSortedSequenceList( sortedSequenceList );
|
||||
|
||||
m_Sequences.RemoveAll();
|
||||
m_Sequences.EnsureCount( sortedSequenceList.Count() );
|
||||
for ( int i = 0; i < m_Sequences.Count(); ++i )
|
||||
{
|
||||
m_Sequences.Set( i, sortedSequenceList[i] );
|
||||
}
|
||||
}
|
874
mdlobjects/dmeskinner.cpp
Normal file
874
mdlobjects/dmeskinner.cpp
Normal file
@ -0,0 +1,874 @@
|
||||
//====== Copyright <20> 1996-2009, Valve Corporation, All rights reserved. =======
|
||||
//
|
||||
// DmeEyeball
|
||||
//
|
||||
//=============================================================================
|
||||
|
||||
|
||||
// Valve includes
|
||||
#include "datamodel/dmelementfactoryhelper.h"
|
||||
#include "mdlobjects/dmeskinner.h"
|
||||
#include "movieobjects/dmedag.h"
|
||||
#include "movieobjects/dmemodel.h"
|
||||
#include "mathlib/mathlib.h"
|
||||
|
||||
|
||||
// memdbgon must be the last include file in a .cpp file!!!
|
||||
#include "tier0/memdbgon.h"
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Class for a unit Super Ellipsoid at the origin
|
||||
//-----------------------------------------------------------------------------
|
||||
class CSuperEllipsoid
|
||||
{
|
||||
public:
|
||||
CSuperEllipsoid(
|
||||
double powerXZ = 1.0,
|
||||
double powerY = 1.0 );
|
||||
|
||||
bool IntersectFromOriginThroughPoint(
|
||||
Vector point,
|
||||
double dDistance ) const;
|
||||
|
||||
// Evaluate for root finding: [ | x | ^ ( 2 / powerXZ ) + | z | ^ ( 2 / powerXZ ) ] ^ ( powerXZ / powerY ) + | y | ^ powerY - 1 = 0
|
||||
double RootEvaluate( const Vector &p ) const;
|
||||
|
||||
protected:
|
||||
static void EvaluateRayFromOrigin(
|
||||
const Vector &rayDirection,
|
||||
double dDistance,
|
||||
Vector &pointOnRay );
|
||||
|
||||
static bool IntersectUnitBoxFromOrigin(
|
||||
const Vector &rayDirection,
|
||||
double &dMin,
|
||||
double &dMax );
|
||||
|
||||
void SolveHit(
|
||||
double v0,
|
||||
const Vector &intPoint0,
|
||||
double v1,
|
||||
const Vector &intPoint1,
|
||||
Vector &intPoint ) const;
|
||||
|
||||
static const double s_dEpsilon;
|
||||
|
||||
double m_powerXZ;
|
||||
double m_powerY;
|
||||
int m_nMaxIterations;
|
||||
};
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Expose this class to the scene database
|
||||
//-----------------------------------------------------------------------------
|
||||
IMPLEMENT_ELEMENT_FACTORY( DmeSkinnerVolume, CDmeSkinnerVolume );
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
//
|
||||
//-----------------------------------------------------------------------------
|
||||
void CDmeSkinnerVolume::OnConstruction()
|
||||
{
|
||||
m_mMatrix.Init( this, "matrix" );
|
||||
m_flStrength.Init( this, "strength", 1.0f );
|
||||
m_flFalloff.Init( this, "falloff", 0.0f );
|
||||
m_nFalloffType.Init( this, "falloffType", FT_LINEAR );
|
||||
m_flPowerY.InitAndSet( this, "powerY", 1.0f );
|
||||
m_flPowerXZ.InitAndSet( this, "powerXZ", 1.0f );
|
||||
}
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
//
|
||||
//-----------------------------------------------------------------------------
|
||||
void CDmeSkinnerVolume::OnDestruction()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Expose this class to the scene database
|
||||
//-----------------------------------------------------------------------------
|
||||
IMPLEMENT_ELEMENT_FACTORY( DmeSkinnerJoint, CDmeSkinnerJoint );
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
//
|
||||
//-----------------------------------------------------------------------------
|
||||
void CDmeSkinnerJoint::OnConstruction()
|
||||
{
|
||||
m_mBindWorldMatrix.Init( this, "bindWorldMatrix" );
|
||||
m_eVolumeList.Init( this, "volumeList" );
|
||||
}
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
//
|
||||
//-----------------------------------------------------------------------------
|
||||
void CDmeSkinnerJoint::OnDestruction()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Expose this class to the scene database
|
||||
//-----------------------------------------------------------------------------
|
||||
IMPLEMENT_ELEMENT_FACTORY( DmeSkinner, CDmeSkinner );
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
//
|
||||
//-----------------------------------------------------------------------------
|
||||
void CDmeSkinner::OnConstruction()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
//
|
||||
//-----------------------------------------------------------------------------
|
||||
void CDmeSkinner::OnDestruction()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
//
|
||||
//-----------------------------------------------------------------------------
|
||||
bool CDmeSkinner::ReskinMeshes( CDmeModel *pDmeModel, int nJointPerVertexCount )
|
||||
{
|
||||
CUtlStack< CDmeDag * > depthFirstStack;
|
||||
depthFirstStack.Push( pDmeModel );
|
||||
|
||||
CDmeDag *pDmeDag;
|
||||
CDmeMesh *pDmeMesh;
|
||||
|
||||
while ( depthFirstStack.Count() > 0 )
|
||||
{
|
||||
depthFirstStack.Pop( pDmeDag );
|
||||
if ( !pDmeDag )
|
||||
continue;
|
||||
|
||||
pDmeMesh = CastElement< CDmeMesh >( pDmeDag->GetShape() );
|
||||
if ( pDmeMesh )
|
||||
{
|
||||
ReskinMesh( pDmeModel, pDmeMesh, nJointPerVertexCount );
|
||||
}
|
||||
|
||||
for ( int i = pDmeDag->GetChildCount() - 1; i >= 0; --i )
|
||||
{
|
||||
depthFirstStack.Push( pDmeDag->GetChild( i ) );
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
//
|
||||
//-----------------------------------------------------------------------------
|
||||
class CJointWeight
|
||||
{
|
||||
public:
|
||||
int m_nJointDataIndex;
|
||||
float m_flWeight;
|
||||
};
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
//
|
||||
//-----------------------------------------------------------------------------
|
||||
class CVertexWeight
|
||||
{
|
||||
public:
|
||||
CVertexWeight( int nWeightsPerVertex )
|
||||
: m_nWeightPerVertex( MAX( 0, nWeightsPerVertex ) )
|
||||
{
|
||||
}
|
||||
|
||||
int m_nWeightPerVertex;
|
||||
|
||||
CUtlVector< CJointWeight > m_weights; // Sorted Weight List
|
||||
|
||||
static int SortWeights( const CJointWeight *pLhs, const CJointWeight *pRhs );
|
||||
|
||||
int Count() const {
|
||||
return MIN( m_nWeightPerVertex, m_weights.Count() );
|
||||
}
|
||||
|
||||
void Reset()
|
||||
{
|
||||
m_weights.Purge();
|
||||
}
|
||||
|
||||
void AddWeight(
|
||||
int nJointDataIndex,
|
||||
float flWeight );
|
||||
|
||||
void Sort();
|
||||
|
||||
float ComputeTotalWeight() const
|
||||
{
|
||||
float flTotalWeight = 0.0f;
|
||||
|
||||
const int nWeightCount = Count();
|
||||
|
||||
for ( int i = 0; i < nWeightCount; ++i )
|
||||
{
|
||||
flTotalWeight += m_weights[ i ].m_flWeight;
|
||||
}
|
||||
|
||||
return flTotalWeight;
|
||||
}
|
||||
|
||||
float GetWeight( int nWeightIndex ) const
|
||||
{
|
||||
if ( nWeightIndex < m_weights.Count() )
|
||||
return m_weights[ nWeightIndex ].m_flWeight;
|
||||
|
||||
return 0.0f;
|
||||
}
|
||||
|
||||
int GetJointIndex( int nWeightIndex ) const
|
||||
{
|
||||
if ( nWeightIndex < m_weights.Count() )
|
||||
return m_weights[ nWeightIndex ].m_nJointDataIndex;
|
||||
|
||||
return 0;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
//
|
||||
//-----------------------------------------------------------------------------
|
||||
void CVertexWeight::AddWeight(
|
||||
int nJointDataIndex,
|
||||
float flWeight )
|
||||
{
|
||||
CJointWeight &jointWeight = m_weights[ m_weights.AddToTail() ];
|
||||
jointWeight.m_nJointDataIndex = nJointDataIndex;
|
||||
jointWeight.m_flWeight = flWeight;
|
||||
}
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
//
|
||||
//-----------------------------------------------------------------------------
|
||||
void CVertexWeight::Sort()
|
||||
{
|
||||
m_weights.Sort( SortWeights );
|
||||
}
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Sort them from highest to lowest
|
||||
//-----------------------------------------------------------------------------
|
||||
int CVertexWeight::SortWeights( const CJointWeight *pLhs, const CJointWeight *pRhs )
|
||||
{
|
||||
if ( pLhs->m_flWeight < pRhs->m_flWeight )
|
||||
return 1;
|
||||
|
||||
if ( pLhs->m_flWeight > pRhs->m_flWeight )
|
||||
return -1;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
//
|
||||
//-----------------------------------------------------------------------------
|
||||
bool CDmeSkinner::ReskinMesh( CDmeModel *pDmeModel, CDmeMesh *pDmeMesh, int nJointPerVertexCount )
|
||||
{
|
||||
if ( !pDmeMesh )
|
||||
return false;
|
||||
|
||||
CDmeDag *pDmeDagMeshParent = FindReferringElement< CDmeDag >( pDmeMesh, "shape" );
|
||||
if ( !pDmeDagMeshParent )
|
||||
return false;
|
||||
|
||||
CDmeVertexData *pDmeVertexData = pDmeMesh->GetBindBaseState();
|
||||
if ( !pDmeVertexData )
|
||||
{
|
||||
Error( "CDmeSkinner: No \"bind\" base state on DmeMesh \"%s\"\n", pDmeMesh->GetName() );
|
||||
return false;
|
||||
}
|
||||
|
||||
FieldIndex_t nJointWeightsField = -1;
|
||||
FieldIndex_t nJointIndicesField = -1;
|
||||
pDmeVertexData->CreateJointWeightsAndIndices( nJointPerVertexCount, &nJointWeightsField, &nJointIndicesField );
|
||||
|
||||
if ( nJointWeightsField < 0 || nJointIndicesField < 0 )
|
||||
{
|
||||
Error( "CDmeSkinner: Couldn't create jointWeights & jointIndices fields on DmeMesh \"%s\"\n", pDmeMesh->GetName() );
|
||||
return false;
|
||||
}
|
||||
pDmeVertexData->RemoveAllVertexData( nJointWeightsField );
|
||||
pDmeVertexData->RemoveAllVertexData( nJointIndicesField );
|
||||
|
||||
const CUtlVector< Vector > &positions = pDmeVertexData->GetPositionData();
|
||||
|
||||
CUtlVector< float > jointWeights;
|
||||
CUtlVector< int > jointIndices;
|
||||
|
||||
struct s_VolumeStruct
|
||||
{
|
||||
CDmeSkinnerVolume *m_pDmeSkinnerVolume;
|
||||
VMatrix m_mMat;
|
||||
};
|
||||
|
||||
struct s_JointStruct
|
||||
{
|
||||
s_JointStruct()
|
||||
: m_pDmeSkinnerJoint( NULL )
|
||||
, m_nJointIndex( -1 )
|
||||
{
|
||||
}
|
||||
|
||||
s_JointStruct( const s_JointStruct &rhs )
|
||||
{
|
||||
m_pDmeSkinnerJoint = rhs.m_pDmeSkinnerJoint;
|
||||
m_nJointIndex = rhs.m_nJointIndex;
|
||||
m_volumes.CopyArray( rhs.m_volumes.Base(), m_volumes.Count() );
|
||||
}
|
||||
CDmeSkinnerJoint *m_pDmeSkinnerJoint;
|
||||
int m_nJointIndex;
|
||||
CUtlVector< s_VolumeStruct > m_volumes;
|
||||
};
|
||||
|
||||
CUtlVector< s_JointStruct > volumeJointList;
|
||||
|
||||
{
|
||||
matrix3x4_t gwm;
|
||||
pDmeDagMeshParent->GetAbsTransform( gwm );
|
||||
VMatrix gwvm;
|
||||
gwvm.CopyFrom3x4( gwm );
|
||||
|
||||
VMatrix vm; // Volume matrix
|
||||
VMatrix vmi; // Volume matrix inverse
|
||||
matrix3x4_t m0;
|
||||
matrix3x4_t m1;
|
||||
|
||||
CUtlStack< CDmeDag * > depthFirstStack;
|
||||
depthFirstStack.Push( this );
|
||||
CDmeDag *pDmeDag;
|
||||
CDmeSkinnerJoint *pDmeSkinnerJoint;
|
||||
CDmeSkinnerVolume *pDmeSkinnerVolume;
|
||||
|
||||
while ( depthFirstStack.Count() > 0 )
|
||||
{
|
||||
depthFirstStack.Pop( pDmeDag );
|
||||
if ( !pDmeDag )
|
||||
continue;
|
||||
|
||||
pDmeSkinnerJoint = CastElement< CDmeSkinnerJoint >( pDmeDag );
|
||||
if ( pDmeSkinnerJoint )
|
||||
{
|
||||
if ( pDmeSkinnerJoint->m_eVolumeList.Count() > 0 )
|
||||
{
|
||||
int nJointIndex = pDmeModel->GetJointIndex( pDmeSkinnerJoint->GetName() );
|
||||
if ( nJointIndex < 0 ) // This joint isn't in the joint list as well as it's children, so ignore
|
||||
{
|
||||
Warning( "DmeSkinner: Skinner Joint %s isn't in DmeModel %s.jointList, ignoring it and all children\n", pDmeSkinnerJoint->GetName(), pDmeModel->GetName() );
|
||||
continue;
|
||||
}
|
||||
|
||||
s_JointStruct &js = volumeJointList[ volumeJointList.AddToTail() ];
|
||||
js.m_pDmeSkinnerJoint = pDmeSkinnerJoint;
|
||||
js.m_nJointIndex = nJointIndex;
|
||||
|
||||
for ( int i = 0; i < pDmeSkinnerJoint->m_eVolumeList.Count(); ++i )
|
||||
{
|
||||
|
||||
pDmeSkinnerVolume = CastElement< CDmeSkinnerVolume >( pDmeSkinnerJoint->m_eVolumeList[ i ] );
|
||||
if ( !pDmeSkinnerVolume )
|
||||
continue;
|
||||
|
||||
s_VolumeStruct &vs = js.m_volumes[ js.m_volumes.AddToTail() ];
|
||||
vs.m_pDmeSkinnerVolume = pDmeSkinnerVolume;
|
||||
|
||||
pDmeSkinnerVolume->m_mMatrix.Get().MatrixMul( pDmeSkinnerJoint->m_mBindWorldMatrix.Get(), vm );
|
||||
vm.InverseGeneral( vmi );
|
||||
vmi.MatrixMul( gwvm, vs.m_mMat );
|
||||
vs.m_mMat = vs.m_mMat.Transpose();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for ( int i = pDmeDag->GetChildCount() - 1; i >= 0; --i )
|
||||
{
|
||||
depthFirstStack.Push( pDmeDag->GetChild( i ) );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Vector v;
|
||||
Vector sv;
|
||||
|
||||
CVertexWeight vw( nJointPerVertexCount );
|
||||
|
||||
for ( int i = 0; i < positions.Count(); ++i )
|
||||
{
|
||||
vw.Reset();
|
||||
|
||||
const Vector &p = positions[ i ];
|
||||
for ( int j = 0; j < volumeJointList.Count(); ++j )
|
||||
{
|
||||
const s_JointStruct &js = volumeJointList[ j ];
|
||||
|
||||
float flMaxWeight = 0.0f;
|
||||
|
||||
for ( int k = 0; k < js.m_volumes.Count(); ++k )
|
||||
{
|
||||
const s_VolumeStruct &vs = js.m_volumes[ k ];
|
||||
|
||||
const CDmeSkinnerVolume *pDmeSkinnerVolume = vs.m_pDmeSkinnerVolume;
|
||||
vs.m_mMat.V3Mul( p, v );
|
||||
|
||||
float f = pDmeSkinnerVolume->m_flFalloff;
|
||||
float l = 0.0;
|
||||
float w = 0.0;
|
||||
|
||||
if ( pDmeSkinnerVolume->IsEllipse() )
|
||||
{
|
||||
l = v.Length();
|
||||
w = RemapValClamped( l, 1.0f, f + 1.0f, 1.0f, 0.0f );
|
||||
}
|
||||
else
|
||||
{
|
||||
double dIFS = 1.0 / ( 1.0 + static_cast< double >( f ) );
|
||||
sv.x = v.x * dIFS;
|
||||
sv.y = v.y * dIFS;
|
||||
sv.z = v.z * dIFS;
|
||||
if ( CSuperEllipsoid( pDmeSkinnerVolume->m_flPowerXZ, pDmeSkinnerVolume->m_flPowerY ).IntersectFromOriginThroughPoint( sv, l ) )
|
||||
{
|
||||
if ( l == 0.0 )
|
||||
{
|
||||
w = 1.0;
|
||||
}
|
||||
else
|
||||
{
|
||||
w = RemapValClamped( sv.Length(), l * dIFS, l, 1.0, 0.0 );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
float s = pDmeSkinnerVolume->m_flStrength;
|
||||
switch ( pDmeSkinnerVolume->m_nFalloffType )
|
||||
{
|
||||
case CDmeSkinnerVolume::FT_SMOOTH:
|
||||
w = ( cosf( ( 1.0f - w ) * M_PI ) + 1.0f ) / 2.0f;
|
||||
break;
|
||||
case CDmeSkinnerVolume::FT_SPIKE:
|
||||
w = 1.0f - cosf( w * M_PI / 2.0 );
|
||||
break;
|
||||
case CDmeSkinnerVolume::FT_DOME:
|
||||
w = cosf( ( 1.0f - w ) * M_PI / 2.0 );
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
w = fabs( w * s );
|
||||
|
||||
if ( w > 0.00001 && w > flMaxWeight )
|
||||
{
|
||||
flMaxWeight = w;
|
||||
}
|
||||
}
|
||||
|
||||
if ( flMaxWeight > 0.0 )
|
||||
{
|
||||
vw.AddWeight( js.m_nJointIndex, flMaxWeight );
|
||||
}
|
||||
}
|
||||
|
||||
vw.Sort();
|
||||
|
||||
const float flTotalWeight = vw.ComputeTotalWeight();
|
||||
if ( vw.Count() <= 0 || flTotalWeight <= 0 )
|
||||
{
|
||||
Warning( "Mesh Vertex %s.v[%d] is not influenced by any volume\n", pDmeDagMeshParent->GetName(), i );
|
||||
}
|
||||
else
|
||||
{
|
||||
for ( int j = 0; j < nJointPerVertexCount; ++j )
|
||||
{
|
||||
jointIndices.AddToTail( vw.GetJointIndex( j ) );
|
||||
jointWeights.AddToTail( vw.GetWeight( j ) / flTotalWeight );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
pDmeVertexData->AddVertexData( nJointIndicesField, jointIndices.Count() );
|
||||
pDmeVertexData->SetVertexData( nJointIndicesField, 0, jointIndices.Count(), AT_INT, jointIndices.Base() );
|
||||
|
||||
pDmeVertexData->AddVertexData( nJointWeightsField, jointWeights.Count() );
|
||||
pDmeVertexData->SetVertexData( nJointWeightsField, 0, jointWeights.Count(), AT_FLOAT, jointWeights.Base() );
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
|
||||
//====== Copyright (c) 1996-2009, Valve Corporation, All rights reserved. =====
|
||||
//
|
||||
// TODO: This belongs in a lib somewhere, comes from sdktools/maya/vsSkinner
|
||||
//
|
||||
//=============================================================================
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Statics
|
||||
//-----------------------------------------------------------------------------
|
||||
const double CSuperEllipsoid::s_dEpsilon = 1.0e-6;
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
//
|
||||
//-----------------------------------------------------------------------------
|
||||
CSuperEllipsoid::CSuperEllipsoid(
|
||||
double powerXZ /* = 1.0 */,
|
||||
double powerY /* = 1.0 */ )
|
||||
: m_powerXZ( powerXZ )
|
||||
, m_powerY( powerY )
|
||||
, m_nMaxIterations( 100 )
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
//
|
||||
//-----------------------------------------------------------------------------
|
||||
double CSuperEllipsoid::RootEvaluate( const Vector &p ) const
|
||||
{
|
||||
return pow( pow( abs( static_cast< double >( p.x ) ), 2.0 / m_powerXZ ) + pow( abs( static_cast< double >( p.z ) ), 2.0 / m_powerXZ ), m_powerXZ / m_powerY ) + pow( abs( static_cast< double >( p.y ) ), 2.0 / m_powerY ) - 1.0;
|
||||
}
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
//
|
||||
//-----------------------------------------------------------------------------
|
||||
bool CSuperEllipsoid::IntersectFromOriginThroughPoint(
|
||||
Vector point,
|
||||
double dDistance ) const
|
||||
{
|
||||
if ( abs( point.x ) < s_dEpsilon ) point.x = 0.0;
|
||||
if ( abs( point.y ) < s_dEpsilon ) point.y = 0.0;
|
||||
if ( abs( point.z ) < s_dEpsilon ) point.z = 0.0;
|
||||
|
||||
// Point Is The Origin
|
||||
if ( point.Length() < s_dEpsilon )
|
||||
{
|
||||
dDistance = 0.0;
|
||||
return true;
|
||||
}
|
||||
|
||||
// Check for early exit cases
|
||||
const double dVal = RootEvaluate( point );
|
||||
|
||||
// Close enough
|
||||
if ( abs( dVal ) < s_dEpsilon )
|
||||
{
|
||||
dDistance = point.Length();
|
||||
return true;
|
||||
}
|
||||
|
||||
// Outside of the Super Ellipsoid
|
||||
if ( dVal > 0.0 )
|
||||
return false;
|
||||
|
||||
Vector rayDirection = point;
|
||||
rayDirection.NormalizeInPlace();
|
||||
|
||||
double dMin = 0.0;
|
||||
double dMax = 0.0;
|
||||
|
||||
if ( !IntersectUnitBoxFromOrigin( rayDirection, dMin, dMax ) )
|
||||
return false;
|
||||
|
||||
// This ought to work!
|
||||
dMin = point.Length();
|
||||
|
||||
Vector intPoint0;
|
||||
EvaluateRayFromOrigin( rayDirection, dMin, intPoint0 );
|
||||
const double v0 = RootEvaluate( intPoint0 );
|
||||
|
||||
if ( abs( v0 ) < s_dEpsilon )
|
||||
{
|
||||
dDistance = dMin;
|
||||
return true;
|
||||
}
|
||||
|
||||
Vector intPoint1;
|
||||
EvaluateRayFromOrigin( rayDirection, dMax, intPoint1 );
|
||||
const double v1 = RootEvaluate( intPoint1 );
|
||||
|
||||
if ( abs( v1 ) < s_dEpsilon )
|
||||
{
|
||||
dDistance = dMax;
|
||||
return true;
|
||||
}
|
||||
|
||||
Vector intPoint;
|
||||
SolveHit( v0, intPoint0, v1, intPoint1, intPoint );
|
||||
dDistance = VectorLength( intPoint );
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
//
|
||||
//-----------------------------------------------------------------------------
|
||||
void CSuperEllipsoid::EvaluateRayFromOrigin(
|
||||
const Vector &rayDirection,
|
||||
double dDistance,
|
||||
Vector &pointOnRay )
|
||||
{
|
||||
pointOnRay = rayDirection * dDistance;
|
||||
}
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
//
|
||||
//-----------------------------------------------------------------------------
|
||||
bool CSuperEllipsoid::IntersectUnitBoxFromOrigin(
|
||||
const Vector &rayDirection,
|
||||
double &dMin,
|
||||
double &dMax )
|
||||
{
|
||||
static const double dMaxValue = 1.0;
|
||||
static const double dMinValue = -dMaxValue;
|
||||
|
||||
const double dMaxBound = sqrt( 3.0 * dMaxValue * dMaxValue );
|
||||
const double dMinBound = -dMaxBound;
|
||||
|
||||
double tMin = 0.0;
|
||||
double tMax = 0.0;
|
||||
|
||||
/* Left/right. */
|
||||
|
||||
if ( abs( rayDirection.x ) > s_dEpsilon )
|
||||
{
|
||||
if ( rayDirection.x > s_dEpsilon )
|
||||
{
|
||||
dMin = dMinValue / rayDirection.x;
|
||||
dMax = dMaxValue / rayDirection.x;
|
||||
|
||||
if ( dMax < s_dEpsilon )
|
||||
return false;
|
||||
}
|
||||
else
|
||||
{
|
||||
dMax = dMinValue / rayDirection.x;
|
||||
|
||||
if ( dMax < s_dEpsilon )
|
||||
return false;
|
||||
|
||||
dMin = dMaxValue / rayDirection.x;
|
||||
}
|
||||
|
||||
if ( dMin > dMax )
|
||||
return false;
|
||||
}
|
||||
else
|
||||
{
|
||||
dMin = dMinBound;
|
||||
dMax = dMaxBound;
|
||||
}
|
||||
|
||||
/* Top/bottom. */
|
||||
|
||||
if ( abs( rayDirection.y ) > s_dEpsilon )
|
||||
{
|
||||
if ( rayDirection.y > s_dEpsilon )
|
||||
{
|
||||
tMin = dMinValue / rayDirection.y;
|
||||
tMax = dMaxValue / rayDirection.y;
|
||||
}
|
||||
else
|
||||
{
|
||||
tMax = dMinValue / rayDirection.y;
|
||||
tMin = dMaxValue / rayDirection.y;
|
||||
}
|
||||
|
||||
if ( tMax < dMax )
|
||||
{
|
||||
if ( tMax < s_dEpsilon )
|
||||
return false;
|
||||
|
||||
if ( tMin > dMin )
|
||||
{
|
||||
if ( tMin > tMax )
|
||||
return false;
|
||||
|
||||
dMin = tMin;
|
||||
}
|
||||
else
|
||||
{
|
||||
if ( dMin > tMax )
|
||||
return false;
|
||||
}
|
||||
|
||||
dMax = tMax;
|
||||
}
|
||||
else
|
||||
{
|
||||
if ( tMin > dMin )
|
||||
{
|
||||
if ( tMin > dMax )
|
||||
return false;
|
||||
|
||||
dMin = tMin;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* Front/back. */
|
||||
|
||||
if ( abs( rayDirection.z ) > s_dEpsilon )
|
||||
{
|
||||
if ( rayDirection.z > s_dEpsilon )
|
||||
{
|
||||
tMin = dMinValue / rayDirection.z;
|
||||
tMax = dMaxValue / rayDirection.z;
|
||||
}
|
||||
else
|
||||
{
|
||||
tMax = dMinValue / rayDirection.z;
|
||||
tMin = dMaxValue / rayDirection.z;
|
||||
}
|
||||
|
||||
if ( tMax < dMax )
|
||||
{
|
||||
if ( tMax < s_dEpsilon )
|
||||
return false;
|
||||
|
||||
if ( tMin > dMin )
|
||||
{
|
||||
if ( tMin > tMax )
|
||||
return false;
|
||||
|
||||
dMin = tMin;
|
||||
}
|
||||
else
|
||||
{
|
||||
if ( dMin > tMax )
|
||||
return false;
|
||||
}
|
||||
|
||||
dMax = tMax;
|
||||
}
|
||||
else
|
||||
{
|
||||
if ( tMin > dMin )
|
||||
{
|
||||
if ( tMin > dMax )
|
||||
return false;
|
||||
|
||||
dMin = tMin;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
//
|
||||
//-----------------------------------------------------------------------------
|
||||
void CSuperEllipsoid::SolveHit(
|
||||
double v0,
|
||||
const Vector &intPoint0,
|
||||
double v1,
|
||||
const Vector &intPoint1,
|
||||
Vector &intPoint ) const
|
||||
{
|
||||
Vector p0 = intPoint0;
|
||||
Vector p1 = intPoint1;
|
||||
|
||||
double x;
|
||||
Vector p2;
|
||||
double v2;
|
||||
Vector p3;
|
||||
double v3;
|
||||
|
||||
for ( int i = 0; i < m_nMaxIterations; ++i )
|
||||
{
|
||||
if ( abs( v0 ) < s_dEpsilon )
|
||||
{
|
||||
intPoint = p0;
|
||||
return;
|
||||
}
|
||||
|
||||
if ( fabs( v1 ) < s_dEpsilon )
|
||||
{
|
||||
intPoint = p1;
|
||||
return;
|
||||
}
|
||||
|
||||
x = abs( v0 ) / abs( v1 - v0 );
|
||||
VectorSubtract( p1, p0, p2 );
|
||||
VectorMultiply( p2, x, p2 );
|
||||
VectorAdd( p0, p2, p2 );
|
||||
|
||||
v2 = RootEvaluate( p2 );
|
||||
|
||||
VectorSubtract( p1, p0, p3 );
|
||||
VectorMultiply( p3, 0.5, p3 );
|
||||
VectorAdd( p0, p3, p3 );
|
||||
|
||||
v3 = RootEvaluate( p3 );
|
||||
|
||||
if ( v2 * v3 < 0.0 )
|
||||
{
|
||||
v0 = v2;
|
||||
p0 = p2;
|
||||
v1 = v3;
|
||||
p1 = p3;
|
||||
}
|
||||
else
|
||||
{
|
||||
if ( abs( v2 ) < abs( v3 ) )
|
||||
{
|
||||
if ( v0 * v2 < 0.0 )
|
||||
{
|
||||
v1 = v2;
|
||||
p1 = p2;
|
||||
}
|
||||
else
|
||||
{
|
||||
v0 = v2;
|
||||
p0 = p2;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if ( v0 * v3 < 0.0 )
|
||||
{
|
||||
v1 = v3;
|
||||
p1 = p3;
|
||||
}
|
||||
else
|
||||
{
|
||||
v0 = v3;
|
||||
p0 = p3;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ( fabs( v0 ) < fabs( v1 ) )
|
||||
{
|
||||
intPoint = p0;
|
||||
}
|
||||
else
|
||||
{
|
||||
intPoint = p1;
|
||||
}
|
||||
}
|
119
mdlobjects/mdlobjects.vpc
Normal file
119
mdlobjects/mdlobjects.vpc
Normal file
@ -0,0 +1,119 @@
|
||||
//-----------------------------------------------------------------------------
|
||||
// MDLOBJECTS.VPC
|
||||
//
|
||||
// Project Script
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
$Macro SRCDIR ".."
|
||||
|
||||
$Include "$SRCDIR\vpc_scripts\source_lib_base.vpc"
|
||||
|
||||
$Configuration
|
||||
{
|
||||
$Compiler
|
||||
{
|
||||
$PreprocessorDefinitions "$BASE;MDLOBJECTS_LIB"
|
||||
}
|
||||
}
|
||||
|
||||
$Project "mdlobjects"
|
||||
{
|
||||
$Folder "Source Files"
|
||||
{
|
||||
$File "authphysfx.cpp"
|
||||
$File "dmebodygroup.cpp"
|
||||
$File "dmebodygrouplist.cpp"
|
||||
$File "dmecollisionmodel.cpp"
|
||||
$File "dmecollisionjoints.cpp"
|
||||
$File "dmebbox.cpp"
|
||||
$File "dmehitbox.cpp"
|
||||
$File "dmehitboxset.cpp"
|
||||
$File "dmehitboxsetlist.cpp"
|
||||
$File "dmebodypart.cpp"
|
||||
$File "dmeblankbodypart.cpp"
|
||||
$File "dmelod.cpp"
|
||||
$File "dmelodlist.cpp"
|
||||
$File "dmemdllist.cpp"
|
||||
$File "dmeboneweight.cpp"
|
||||
$File "dmebonemask.cpp"
|
||||
$File "dmebonemasklist.cpp"
|
||||
$File "dmesequence.cpp"
|
||||
$File "dmesequencelist.cpp"
|
||||
$File "dmeincludemodellist.cpp"
|
||||
$File "dmedefinebone.cpp"
|
||||
$File "dmedefinebonelist.cpp"
|
||||
$File "dmematerialgroup.cpp"
|
||||
$File "dmematerialgrouplist.cpp"
|
||||
$File "dmeeyeballglobals.cpp"
|
||||
$File "dmeeyeball.cpp"
|
||||
$File "dmeskinner.cpp"
|
||||
$File "dmeik.cpp"
|
||||
$File "dmeanimcmd.cpp"
|
||||
$File "dmemotioncontrol.cpp"
|
||||
$File "dmeposeparameter.cpp"
|
||||
$File "dmeposeparameterlist.cpp"
|
||||
$File "dmeanimblocksize.cpp"
|
||||
$File "dmeasset.cpp"
|
||||
$File "dmeelementgroup.cpp"
|
||||
$File "dmeboneflexdriver.cpp"
|
||||
$File "dmeproceduralbone.cpp"
|
||||
$File "dmejigglebone.cpp"
|
||||
$File "mpp_utils.cpp"
|
||||
$File "dmematsysroot.cpp"
|
||||
$File "dmeassemblycommand.cpp"
|
||||
$File "dmeanimationassemblycommand.cpp"
|
||||
$File "dmeeyelid.cpp"
|
||||
$File "dmemouth.cpp"
|
||||
$File "physmodelsource.cpp"
|
||||
}
|
||||
|
||||
$Folder "Interface"
|
||||
{
|
||||
$File "$SRCDIR\public\mdlobjects\authphysfx.h"
|
||||
$File "$SRCDIR\public\mdlobjects\dmebodygroup.h"
|
||||
$File "$SRCDIR\public\mdlobjects\dmebodygrouplist.h"
|
||||
$File "$SRCDIR\public\mdlobjects\dmecollisionmodel.h"
|
||||
$File "$SRCDIR\public\mdlobjects\dmecollisionjoints.h"
|
||||
$File "$SRCDIR\public\mdlobjects\dmebbox.h"
|
||||
$File "$SRCDIR\public\mdlobjects\dmehitbox.h"
|
||||
$File "$SRCDIR\public\mdlobjects\dmehitboxset.h"
|
||||
$File "$SRCDIR\public\mdlobjects\dmehitboxsetlist.h"
|
||||
$File "$SRCDIR\public\mdlobjects\dmebodypart.h"
|
||||
$File "$SRCDIR\public\mdlobjects\dmeblankbodypart.h"
|
||||
$File "$SRCDIR\public\mdlobjects\dmelod.h"
|
||||
$File "$SRCDIR\public\mdlobjects\dmelodlist.h"
|
||||
$File "$SRCDIR\public\mdlobjects\dmemdllist.h"
|
||||
$File "$SRCDIR\public\mdlobjects\dmeboneweight.h"
|
||||
$File "$SRCDIR\public\mdlobjects\dmebonemask.h"
|
||||
$File "$SRCDIR\public\mdlobjects\dmebonemasklist.h"
|
||||
$File "$SRCDIR\public\mdlobjects\dmesequence.h"
|
||||
$File "$SRCDIR\public\mdlobjects\dmesequencelist.h"
|
||||
$File "$SRCDIR\public\mdlobjects\dmeincludemodellist.h"
|
||||
$File "$SRCDIR\public\mdlobjects\dmedefinebone.h"
|
||||
$File "$SRCDIR\public\mdlobjects\dmedefinebonelist.h"
|
||||
$File "$SRCDIR\public\mdlobjects\mdlobjects.h"
|
||||
$File "$SRCDIR\public\mdlobjects\dmematerialgroup.h"
|
||||
$File "$SRCDIR\public\mdlobjects\dmematerialgrouplist.h"
|
||||
$File "$SRCDIR\public\mdlobjects\dmeeyeballglobals.h"
|
||||
$File "$SRCDIR\public\mdlobjects\dmeeyeball.h"
|
||||
$File "$SRCDIR\public\mdlobjects\dmeskinner.h"
|
||||
$File "$SRCDIR\public\mdlobjects\dmeik.h"
|
||||
$File "$SRCDIR\public\mdlobjects\dmeanimcmd.h"
|
||||
$File "$SRCDIR\public\mdlobjects\dmemotioncontrol.h"
|
||||
$File "$SRCDIR\public\mdlobjects\dmeposeparameter.h"
|
||||
$File "$SRCDIR\public\mdlobjects\dmeposeparameterlist.h"
|
||||
$File "$SRCDIR\public\mdlobjects\dmeanimblocksize.h"
|
||||
$File "$SRCDIR\public\mdlobjects\dmeasset.h"
|
||||
$File "$SRCDIR\public\mdlobjects\dmeelementgroup.h"
|
||||
$File "$SRCDIR\public\mdlobjects\dmeboneflexdriver.h"
|
||||
$File "$SRCDIR\public\mdlobjects\dmeproceduralbone.h"
|
||||
$File "$SRCDIR\public\mdlobjects\dmejigglebone.h"
|
||||
$File "$SRCDIR\public\mdlobjects\mpp_utils.h"
|
||||
$File "$SRCDIR\public\mdlobjects\dmematsysroot.h"
|
||||
$File "$SRCDIR\public\mdlobjects\dmeassemblycommand.h"
|
||||
$File "$SRCDIR\public\mdlobjects\dmeanimationassemblycommand.h"
|
||||
$File "$SRCDIR\public\mdlobjects\dmeeyelid.h"
|
||||
$File "$SRCDIR\public\mdlobjects\dmemouth.h"
|
||||
$File "$SRCDIR\public\mdlobjects\physmodelsource.h"
|
||||
}
|
||||
}
|
13
mdlobjects/mdlobjects.vpc.vpc_cache
Normal file
13
mdlobjects/mdlobjects.vpc.vpc_cache
Normal file
@ -0,0 +1,13 @@
|
||||
"vpc_cache"
|
||||
{
|
||||
"CacheVersion" "1"
|
||||
"win32"
|
||||
{
|
||||
"CRCFile" "mdlobjects.vcxproj.vpc_crc"
|
||||
"OutputFiles"
|
||||
{
|
||||
"0" "mdlobjects.vcxproj"
|
||||
"1" "mdlobjects.vcxproj.filters"
|
||||
}
|
||||
}
|
||||
}
|
1465
mdlobjects/mpp_utils.cpp
Normal file
1465
mdlobjects/mpp_utils.cpp
Normal file
File diff suppressed because it is too large
Load Diff
314
mdlobjects/physmodelsource.cpp
Normal file
314
mdlobjects/physmodelsource.cpp
Normal file
@ -0,0 +1,314 @@
|
||||
//===== Copyright <20> Valve Corporation, All rights reserved. ======//
|
||||
#include "mdlobjects/physmodelsource.h"
|
||||
#include "meshutils/mesh.h"
|
||||
#include "movieobjects/dmemodel.h"
|
||||
#include "dmeutils/dmmeshutils.h"
|
||||
#include "meshsystem/imeshsystem.h"
|
||||
#include "mathlib/disjoint_set_forest.h"
|
||||
#include "meshutils/mesh.h"
|
||||
#include "bone_setup.h"
|
||||
|
||||
void CPhysModelSource::GetBoneTriangles( CUtlStringToken joint, uint nFlags, float flMinWeight, CUtlVector<Vector> &arrVertices, CUtlVector<uint> &arrIndices )const
|
||||
{
|
||||
/*
|
||||
if( m_pRenderModel )
|
||||
{
|
||||
::GetBoneTriangles( m_pRenderModel, joint, nFlags, flMinWeight, arrVertices, arrIndices );
|
||||
}
|
||||
else */if( m_pDmeModel )
|
||||
{
|
||||
int nMeshBoneIndex = m_pDmeModel->GetJointIndex( joint );
|
||||
|
||||
uint isEnumAll = nFlags & FLAG_ENUMERATE_VERTICES_ALL;
|
||||
|
||||
int nJointCount = m_pDmeModel->GetJointCount();
|
||||
CVarBitVec bonesInSubtree( nJointCount );
|
||||
if( uint( nMeshBoneIndex ) < uint( nJointCount ) )
|
||||
{
|
||||
bonesInSubtree.Set( nMeshBoneIndex );
|
||||
if( nFlags & FLAG_ENUMERATE_VERTICES_WITH_SUBTREE )
|
||||
{
|
||||
ComputeSubtree( m_pDmeModel, nMeshBoneIndex, &bonesInSubtree );
|
||||
}
|
||||
}
|
||||
|
||||
CreateDmeModelCache();
|
||||
for( int nMesh = 0; nMesh < m_DmeMeshCache.Count() ; ++nMesh )
|
||||
{
|
||||
CMesh *pMesh = m_DmeMeshCache[nMesh];
|
||||
|
||||
CMesh::SkinningDataFields_t skinData = pMesh->GetSkinningDataFields();
|
||||
if( isEnumAll || skinData.HasSkinningData() )
|
||||
{
|
||||
CUtlVector<int> mapVerts;
|
||||
mapVerts.SetCount( pMesh->VertexCount() );
|
||||
mapVerts.FillWithValue( -1 );
|
||||
|
||||
for( int nVertex = 0; nVertex < pMesh->VertexCount(); ++nVertex )
|
||||
{
|
||||
if( isEnumAll || pMesh->GetVertexJointSumWeight( skinData, nVertex, bonesInSubtree ) > flMinWeight )
|
||||
{
|
||||
// this vertex belongs to this joint
|
||||
mapVerts[nVertex] = arrVertices.AddToTail( pMesh->GetVertexPosition( nVertex ) );
|
||||
}
|
||||
}
|
||||
|
||||
for( int nTri = 0, nTriCount = pMesh->TriangleCount(); nTri < nTriCount; ++nTri )
|
||||
{
|
||||
int v[3];
|
||||
for( int nTriVertIndex = 0; nTriVertIndex < 3; ++nTriVertIndex )
|
||||
{
|
||||
int nIndexInMesh = pMesh->m_pIndices[nTri * 3 + nTriVertIndex ];
|
||||
v[ nTriVertIndex ] = mapVerts[ nIndexInMesh ];
|
||||
}
|
||||
if( v[0] >= 0 && v[1] >= 0 && v[2] >= 0 )
|
||||
{
|
||||
// all 3 vertices of this triangle are mapped (i.e. belong to this bone)
|
||||
arrIndices.AddToTail( v[0] );
|
||||
arrIndices.AddToTail( v[1] );
|
||||
arrIndices.AddToTail( v[2] );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void CPhysModelSource::CreateDmeModelCache() const
|
||||
{
|
||||
if( m_pDmeModel && m_DmeMeshCache.Count() == 0 )
|
||||
{
|
||||
CUtlVector< CDmeDag* > dags;
|
||||
LoadCollisionMeshes( m_DmeMeshCache, dags, m_pDmeModel, 1.0f );
|
||||
if( dags.Count() == m_DmeMeshCache.Count() )
|
||||
{
|
||||
m_DmeDagIndexCache.SetCount( dags.Count() );
|
||||
for( int i = 0; i < dags.Count(); ++i )
|
||||
{
|
||||
m_DmeDagIndexCache[i] = m_pDmeModel->GetJointIndex( dags[i] );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
int CPhysModelSource::GetDmeDagIndex( int nMesh )const
|
||||
{
|
||||
if( uint( nMesh ) < uint( m_DmeDagIndexCache.Count() ) )
|
||||
{
|
||||
return m_DmeDagIndexCache[ nMesh ];
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
||||
int CPhysModelSource::GetBoneCount()const
|
||||
{
|
||||
/*
|
||||
if( m_pRenderModel )
|
||||
{
|
||||
return m_pRenderModel->NumBones();
|
||||
}
|
||||
*/
|
||||
|
||||
if( m_pDmeModel )
|
||||
{
|
||||
return m_pDmeModel->GetJointCount();
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
const char *CPhysModelSource::GetBoneNameByIndex( int nIndex )const
|
||||
{
|
||||
/*
|
||||
if( m_pRenderModel )
|
||||
{
|
||||
return m_pRenderModel->MasterSkeleton().GetBoneNameByIndex( nIndex );
|
||||
}
|
||||
*/
|
||||
if( m_pDmeModel )
|
||||
{
|
||||
return m_pDmeModel->GetJoint( nIndex )->GetName();
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
AABB_t CPhysModelSource::GetBoneInfluenceBbox( CUtlStringToken joint, uint nFlags, const CTransform &bindPose, float flMinWeight )const
|
||||
{
|
||||
AABB_t bbox;
|
||||
bbox.MakeInvalid();
|
||||
EnumerateBoneVerts( joint, nFlags, [&]( const Vector &vGlobal, float w ){
|
||||
if( ( nFlags & FLAG_ENUMERATE_VERTICES_ALL ) || ( w >= flMinWeight ) )
|
||||
{
|
||||
Vector vLocal = bindPose.TransformVectorByInverse( vGlobal );
|
||||
bbox |= vLocal;
|
||||
}
|
||||
});
|
||||
return bbox;
|
||||
}
|
||||
|
||||
|
||||
|
||||
bool CPhysModelSource::BoneHasMeat( CUtlStringToken joint, uint nFlags, const CTransform &bindPose )const
|
||||
{
|
||||
AABB_t bbox = GetBoneInfluenceBbox( joint, nFlags, bindPose );
|
||||
if( bbox.IsEmpty() )
|
||||
return false;
|
||||
|
||||
Vector vDelta = bbox.m_vMaxBounds - bbox.m_vMinBounds;
|
||||
float flDim = vDelta.SmallestComponentValue();
|
||||
|
||||
//float flDim = bbox.LengthOfSmallestDimension( );
|
||||
|
||||
// don't accept too flat or degenerate geometries
|
||||
return flDim > 1.0f;
|
||||
}
|
||||
|
||||
|
||||
class CDmeModelSubtreeAdaptor
|
||||
{
|
||||
public:
|
||||
CDmeModelSubtreeAdaptor( const CDmeModel *pModel ) : m_pDmeModel ( pModel ){}
|
||||
int GetParent( int nJoint )const
|
||||
{
|
||||
CDmeDag *pParent = m_pDmeModel->GetJoint( nJoint )->GetParent();
|
||||
if( pParent )
|
||||
return m_pDmeModel->GetJointIndex( pParent );
|
||||
return -1;
|
||||
}
|
||||
protected:
|
||||
const CDmeModel *m_pDmeModel;
|
||||
};
|
||||
|
||||
|
||||
void ComputeSubtree( const CDmeModel *pDmeModel, int nSubtreeTipBone, CVarBitVec *pSubtree )
|
||||
{
|
||||
CDmeModelSubtreeAdaptor adaptor( pDmeModel );
|
||||
ComputeSubtree( &adaptor, nSubtreeTipBone, pSubtree );
|
||||
}
|
||||
|
||||
|
||||
int CPhysModelSource::GetParentJoint( int nJoint )const
|
||||
{
|
||||
if( m_pDmeModel )
|
||||
{
|
||||
CDmeDag *pParent = m_pDmeModel->GetJoint( nJoint )->GetParent();
|
||||
if( pParent )
|
||||
return m_pDmeModel->GetJointIndex( pParent );
|
||||
}
|
||||
|
||||
/*
|
||||
if( m_pRenderModel )
|
||||
{
|
||||
return m_pRenderModel->MasterSkeleton().GetParent( nJoint );
|
||||
}
|
||||
*/
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
||||
void CPhysModelSource::GetBoneSubtree( int nBone, CVarBitVec *pSubtree ) const
|
||||
{
|
||||
/*
|
||||
if( m_pRenderModel )
|
||||
{
|
||||
m_pRenderModel->MasterSkeleton().GetBoneSubtree( nBone, pSubtree );
|
||||
}
|
||||
*/
|
||||
if( m_pDmeModel )
|
||||
{
|
||||
ComputeSubtree( m_pDmeModel, nBone, pSubtree );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
CTransform CPhysModelSource::GetBindPoseParentTransform( int nJointIndex )const
|
||||
{
|
||||
CTransform tm = g_TransformIdentity;
|
||||
/*
|
||||
if( m_pRenderModel )
|
||||
{
|
||||
m_pRenderModel->MasterSkeleton().GetBindPoseParentTransform( nJointIndex, tm );
|
||||
}
|
||||
*/
|
||||
if( m_pDmeModel )
|
||||
{
|
||||
matrix3x4_t mat;
|
||||
m_pDmeModel->GetJoint( nJointIndex )->GetLocalMatrix( mat );
|
||||
tm = MatrixTransform( mat );
|
||||
}
|
||||
return tm;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
void CPhysModelSource::GetBindPoseWorldTransforms( CUtlVector< CTransform > &transforms )const
|
||||
{
|
||||
/*
|
||||
if( m_pRenderModel )
|
||||
{
|
||||
int nBones = m_pRenderModel->NumBones( );
|
||||
transforms.SetCount( nBones );
|
||||
m_pRenderModel->MasterSkeleton().GetBindPoseWorldTransforms( g_TransformIdentity, 1.0f, nBones, transforms.Base() );
|
||||
}
|
||||
*/
|
||||
if( m_pDmeModel )
|
||||
{
|
||||
int nBones = m_pDmeModel->GetJointCount();
|
||||
transforms.SetCount( nBones );
|
||||
for( int i = 0; i < nBones; ++i )
|
||||
{
|
||||
matrix3x4_t mat;
|
||||
m_pDmeModel->GetJoint( i )->GetAbsTransform( mat );
|
||||
transforms[i] = MatrixTransform( mat );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
CPhysModelSource::Stats_t CPhysModelSource::GetStats( )const
|
||||
{
|
||||
Stats_t stats;
|
||||
/*
|
||||
if( GetRenderModel() )
|
||||
{
|
||||
for( int nMesh = 0; nMesh < GetRenderModel()->GetNumMeshes(); ++nMesh )
|
||||
{
|
||||
HRenderMesh hMesh = GetRenderModel()->GetMesh( nMesh );
|
||||
const CUtlVector<TraceDataForDraw_t> *pDrawData;
|
||||
g_pMeshSystem->GetToolsGeometryInfo( hMesh, &pDrawData );
|
||||
const CRenderMesh *pPermMesh = ResourceHandleToData( hMesh );
|
||||
if( pDrawData && pPermMesh )
|
||||
{
|
||||
stats.m_nMeshCount += pDrawData->Count();
|
||||
for( int nDrawData = 0; nDrawData < pDrawData->Count(); ++nDrawData )
|
||||
{
|
||||
const TraceDataForDraw_t &data = pDrawData->Element( nDrawData );
|
||||
stats.m_nVertCount += data.m_nTraceVertices;
|
||||
stats.m_nTriCount += data.m_nTraceTriangles;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
*/
|
||||
{
|
||||
CreateDmeModelCache();
|
||||
stats.m_nMeshCount = m_DmeMeshCache.Count();
|
||||
for( int nMesh = 0; nMesh < stats.m_nMeshCount; ++nMesh )
|
||||
{
|
||||
CMesh *pMesh = m_DmeMeshCache[nMesh];
|
||||
stats.m_nTriCount += pMesh->TriangleCount();
|
||||
stats.m_nVertCount += pMesh->VertexCount();
|
||||
}
|
||||
}
|
||||
return stats;
|
||||
}
|
Reference in New Issue
Block a user