initial
This commit is contained in:
105
public/fbxsystem/fbxsystem.cpp
Normal file
105
public/fbxsystem/fbxsystem.cpp
Normal file
@@ -0,0 +1,105 @@
|
||||
//============ Copyright (c) Valve Corporation, All rights reserved. ==========
|
||||
//
|
||||
//=============================================================================
|
||||
|
||||
|
||||
// Valve includes
|
||||
#include "fbxsystem/ifbxsystem.h"
|
||||
#include "tier0/dbg.h"
|
||||
|
||||
// Local includes
|
||||
#include "fbxsystem.h"
|
||||
|
||||
|
||||
// Last include
|
||||
#include "tier0/memdbgon.h"
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
//
|
||||
//-----------------------------------------------------------------------------
|
||||
DEFINE_LOGGING_CHANNEL_NO_TAGS( LOG_FBX_SYSTEM, "FbxSystem" );
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
//
|
||||
//-----------------------------------------------------------------------------
|
||||
CFbxSystem s_fbxSystem;
|
||||
IFbxSystem *g_pFbx = &s_fbxSystem;
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
//
|
||||
//-----------------------------------------------------------------------------
|
||||
CFbxSystem::CFbxSystem()
|
||||
: m_pFbxManager( NULL )
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
//
|
||||
//-----------------------------------------------------------------------------
|
||||
CFbxSystem::~CFbxSystem()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Initialize the FBX SDK, hook up the pointer, FBX is started up on first use
|
||||
// via CFbxSystem::GetFbxManager
|
||||
//-----------------------------------------------------------------------------
|
||||
InitReturnVal_t CFbxSystem::Init()
|
||||
{
|
||||
return INIT_OK;
|
||||
}
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
//
|
||||
//-----------------------------------------------------------------------------
|
||||
void CFbxSystem::Shutdown()
|
||||
{
|
||||
if ( m_pFbxManager )
|
||||
{
|
||||
m_pFbxManager->Destroy();
|
||||
m_pFbxManager = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
//
|
||||
//-----------------------------------------------------------------------------
|
||||
FbxManager *CFbxSystem::GetFbxManager()
|
||||
{
|
||||
if ( m_pFbxManager )
|
||||
return m_pFbxManager;
|
||||
|
||||
m_pFbxManager = FbxManager::Create();
|
||||
if ( m_pFbxManager )
|
||||
{
|
||||
FbxIOSettings *pFbxIOSettings = FbxIOSettings::Create( m_pFbxManager, IOSROOT );
|
||||
if ( !pFbxIOSettings )
|
||||
{
|
||||
m_pFbxManager->Destroy();
|
||||
m_pFbxManager = NULL;
|
||||
Log_Error( LOG_FBX_SYSTEM, "Error! Cannot create FbxIOSettings\n" );
|
||||
}
|
||||
m_pFbxManager->SetIOSettings( pFbxIOSettings );
|
||||
|
||||
// TODO: This can be slow... and currently no FBX plug-ins exist (must be looking at all files to see if they are plug-ins)
|
||||
// TODO: Do we need FBX plug-ins? - sApplicationPath will be d:/dev/main/game/bin, for example (wherever studiomdl.exe is)
|
||||
// TODO: If we need plug-ins in the future, then we should put them in a specific directory under game/bin maybe?
|
||||
/*
|
||||
const FbxString sApplicationPath = FbxGetApplicationDirectory();
|
||||
pFbxManager->LoadPluginsDirectory( sApplicationPath.Buffer() );
|
||||
*/
|
||||
}
|
||||
else
|
||||
{
|
||||
Log_Error( LOG_FBX_SYSTEM, "Error! Cannot create FbxManager\n" );
|
||||
}
|
||||
|
||||
return m_pFbxManager;
|
||||
}
|
||||
44
public/fbxsystem/fbxsystem.h
Normal file
44
public/fbxsystem/fbxsystem.h
Normal file
@@ -0,0 +1,44 @@
|
||||
//============ Copyright (c) Valve Corporation, All rights reserved. ==========
|
||||
//
|
||||
//=============================================================================
|
||||
|
||||
|
||||
#ifndef FBXSYSTEM_H
|
||||
#define FBXSYSTEM_H
|
||||
|
||||
|
||||
#if COMPILER_MSVC
|
||||
#pragma once
|
||||
#endif
|
||||
|
||||
|
||||
// Valve includes
|
||||
#include "fbxsystem/ifbxsystem.h"
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
//
|
||||
//-----------------------------------------------------------------------------
|
||||
class CFbxSystem : public CBaseAppSystem< IFbxSystem >
|
||||
{
|
||||
typedef CBaseAppSystem< IFbxSystem > BaseClass;
|
||||
|
||||
public:
|
||||
CFbxSystem();
|
||||
virtual ~CFbxSystem();
|
||||
|
||||
// From CBaseAppSystem
|
||||
virtual InitReturnVal_t Init() OVERRIDE;
|
||||
virtual void Shutdown() OVERRIDE;
|
||||
virtual AppSystemTier_t GetTier() OVERRIDE { return APP_SYSTEM_TIER2; }
|
||||
virtual bool IsSingleton() OVERRIDE{ return false; }
|
||||
|
||||
// From IFbxSystem
|
||||
virtual FbxManager *GetFbxManager();
|
||||
|
||||
private:
|
||||
FbxManager *m_pFbxManager;
|
||||
|
||||
};
|
||||
|
||||
#endif // FBXSYSTEM_H
|
||||
49
public/fbxsystem/ifbxsystem.h
Normal file
49
public/fbxsystem/ifbxsystem.h
Normal file
@@ -0,0 +1,49 @@
|
||||
//============ Copyright (c) Valve Corporation, All rights reserved. ==========
|
||||
//
|
||||
//=============================================================================
|
||||
|
||||
|
||||
#ifndef IFBXSYSTEM_H
|
||||
#define IFBXSYSTEM_H
|
||||
#pragma once
|
||||
|
||||
|
||||
// FBX includes
|
||||
#include <fbxsdk.h>
|
||||
|
||||
// Valve includes
|
||||
#include "appframework/iappsystem.h"
|
||||
#include "tier0/logging.h"
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
//
|
||||
//-----------------------------------------------------------------------------
|
||||
abstract_class IFbxSystem : public IAppSystem
|
||||
{
|
||||
public:
|
||||
virtual InitReturnVal_t Init() = 0;
|
||||
virtual void Shutdown() = 0;
|
||||
virtual FbxManager *GetFbxManager() = 0;
|
||||
|
||||
};
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
//
|
||||
//-----------------------------------------------------------------------------
|
||||
extern IFbxSystem *g_pFbx;
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// External declaration of the logging channel for FBX system
|
||||
//-----------------------------------------------------------------------------
|
||||
DECLARE_LOGGING_CHANNEL( LOG_FBX_SYSTEM );
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
//
|
||||
//-----------------------------------------------------------------------------
|
||||
#define FBX_INTERFACE_VERSION "FBXSystem001"
|
||||
|
||||
|
||||
#endif // IFBXSYSTEM_H
|
||||
Reference in New Issue
Block a user