DragonNest/GameCommon/CameraData.cpp
2024-12-20 16:56:44 +08:00

45 lines
2.3 KiB
C++
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

#include "StdAfx.h"
#include "CameraData.h"
#ifdef _DEBUG
#define new new(_NORMAL_BLOCK,__FILE__,__LINE__)
#endif
CCameraData::CCameraData(void)
{
}
CCameraData::~CCameraData(void)
{
}
void CCameraData::LoadResource( CStream *pStream )
{
pStream->Read( &m_Header, sizeof( SCameraFileHeader ) );
pStream->Seek( CAMERA_HEADER_RESERVED, SEEK_CUR );
if( strstr( m_Header.szHeaderString, CAMERA_FILE_STRING ) == NULL ) return;
m_vecFOV.resize( m_Header.nFOVKeyCount );
m_vecPosition.resize( m_Header.nPositionKeyCount );
m_vecRotation.resize( m_Header.nRotationKeyCount );
if( m_Header.nFOVKeyCount )
{
pStream->Read( &m_vecFOV[ 0 ], m_Header.nFOVKeyCount * sizeof( SCameraFOVKey ) );
}
if( m_Header.nPositionKeyCount )
{
pStream->Read( &m_vecPosition[ 0 ], m_Header.nPositionKeyCount * sizeof( SCameraPositionKey ) );
}
if( m_Header.nRotationKeyCount )
{
pStream->Read( &m_vecRotation[ 0 ], m_Header.nRotationKeyCount * sizeof( SCameraRotationKey ) );
}
}
void CCameraData::Clear( void )
{
ZeroMemory( &m_Header, sizeof(SCameraFileHeader) );
m_vecFOV.clear();
m_vecPosition.clear();
m_vecRotation.clear();
}