genesis-3d_engine/Engine/addons/resource/resinfo.h

489 lines
11 KiB
C
Raw Normal View History

/****************************************************************************
Copyright (c) 2011-2013,WebJet Business Division,CYOU
http://www.genesis-3d.com.cn
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
****************************************************************************/
#ifndef __resinfo_H__
#define __resinfo_H__
#include "resource.h"
#include "graphicsystem/Material/materialinstance.h"
#include "graphicsystem/GraphicObjectManager.h"
namespace Sprite
{
class SpritePackage;
}
namespace Resources
{
const int MAX_RES_LOAD_PRIORITY = 65535;
const int DEFAULT_RES_LOAD_PRIORITY = 65535;
//--------------------------------------------------------------------------------
/**
<EFBFBD><EFBFBD>Դ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ֱ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>̬<EFBFBD><EFBFBD>
1<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ⲿ<EFBFBD><EFBFBD><EFBFBD>ϵı<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>̬<EFBFBD><EFBFBD><EFBFBD><EFBFBD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FBFBD><EFBFBD>Ϊ<EFBFBD>ⲿ<EFBFBD>ж<EFBFBD><EFBFBD><EFBFBD>Ч<EFBFBD>Ե<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
*/
class ResInfoContainer;
class baseResInfo : public Core::RefCounted
{
__DeclareClass(baseResInfo);
public:
baseResInfo() :
priority(DEFAULT_RES_LOAD_PRIORITY),
isAsynLoading(false),
container(0),
defaultResUsed(false),
needReCompile(false)
{};
virtual ~baseResInfo()
{};
// <20><>ԴID
const Resources::ResourceId& GetResID() const {
return resID;
}
void SetResID(const Resources::ResourceId& id){
resID = id;
}
// <20><>Դ<EFBFBD><D4B4><EFBFBD>ص<EFBFBD><D8B5><EFBFBD><EFBFBD>ȼ<EFBFBD><C8BC><EFBFBD> >0 <20><>ʾ<EFBFBD>ӳټ<D3B3><D9BC>ء<EFBFBD><D8A1><EFBFBD><EFBFBD><EFBFBD>Խ<EFBFBD>󣬼<EFBFBD><F3A3ACBC><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ȼ<EFBFBD>Խ<EFBFBD><D4BD>
Priority GetPriority(void) const {
return priority;
}
void SetPriority(Priority p ){
priority = p;
}
// <20><>Դ<EFBFBD><D4B4><EFBFBD>ݶ<EFBFBD><DDB6><EFBFBD>
const GPtr<Resources::Resource>& GetRes() const{
return resData;
}
void SetRes(const GPtr<Resources::Resource>& res){
resData = res;
}
void SetContainer(ResInfoContainer* m)
{
container = m;
}
ResInfoContainer* GetContainer()
{
return container;
}
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>̬<EFBFBD>Ƿ<EFBFBD><C7B7><EFBFBD><EFBFBD>ڡ<EFBFBD>Ĭ<EFBFBD><C4AC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>£<EFBFBD><C2A3><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>̬<EFBFBD><CCAC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>̬һ<CCAC>¡<EFBFBD><C2A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ҫ<EFBFBD><D2AA>д
virtual bool IsCompiled() const
{
return IsLoaded()&&!needReCompile;
}
// <20>ڲ<EFBFBD>ʹ<EFBFBD>õĽӿ<C4BD>
// <20><>Դ<EFBFBD><D4B4>Ϣ<EFBFBD>Ƿ<EFBFBD>׼<EFBFBD><D7BC><EFBFBD><EFBFBD><EFBFBD>ϣ<EFBFBD><CFA3><EFBFBD><EFBFBD>Ա<EFBFBD>ҵ<EFBFBD><D2B5><EFBFBD>߼<EFBFBD>ʹ<EFBFBD><CAB9><EFBFBD>ˡ<EFBFBD>
// <20><>ͬ<EFBFBD><CDAC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Դ<EFBFBD><D4B4>״̬<D7B4>жϲ<D0B6>ͬ<EFBFBD><CDAC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ӧ<EFBFBD>ø<EFBFBD><C3B8><EFBFBD><EFBFBD><EFBFBD>Ҫ<EFBFBD><D2AA>д<EFBFBD>ĺ<EFBFBD><C4BA><EFBFBD>
virtual bool CanUsable() const
{
return IsLoaded() && IsCompiled();
}
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>̬<EFBFBD>Ƿ<EFBFBD><C7B7><EFBFBD><EFBFBD>ڲ<EFBFBD><DAB2><EFBFBD><EFBFBD><EFBFBD>
virtual bool IsLoaded() const
{
return resData && resData->GetState() == Resources::Resource::Loaded;
}
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>̬
bool Compile();
// <20><>Ҫ<EFBFBD><D2AA><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ظú<D8B8><C3BA><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>̬<EFBFBD>ı<EFBFBD><C4B1><EFBFBD><EFBFBD>͸<EFBFBD>ֵ
virtual void OnCompile(){ }
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϊ<EFBFBD><CEAA>ʼ״̬
virtual void Discard(){
resData = 0;
resID.Clear();
isAsynLoading = false;
priority = DEFAULT_RES_LOAD_PRIORITY;
}
// <20><><EFBFBD><EFBFBD>Ĭ<EFBFBD>ϵ<EFBFBD><CFB5><EFBFBD>Դ<EFBFBD><D4B4><EFBFBD><EFBFBD>
virtual void AssignDefaultResData(const GPtr<baseResInfo>& defaultRes)
{
if ( defaultRes )
{
ResourceId tempResID;
Priority tempPriority;
bool tempAsynLoading;
tempResID = resID;
tempPriority = priority;
tempAsynLoading = isAsynLoading;
Discard();
//ResetHandle();
resID = tempResID;
priority = tempPriority;
isAsynLoading = tempAsynLoading;
resData = defaultRes->resData;
defaultResUsed = true;
}
}
// <20><>Ҫ<EFBFBD><D2AA>Ϊ<EFBFBD><CEAA>֧<EFBFBD><D6A7>fbx<62><78><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ע<EFBFBD><EFBFBD><E2A3AC><EFBFBD>ܻ<EFBFBD><DCBB><EFBFBD><EFBFBD><EFBFBD>bug
// <20><><EFBFBD><EFBFBD>copy<70><79>Ҫres<65><73><EFBFBD><EFBFBD>Ϣ<EFBFBD><CFA2><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ģ<EFBFBD><C4A3><EFBFBD><EFBFBD><EFBFBD>copy<70><79><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ҫɾ<D2AA><C9BE>֮ǰ<D6AE><C7B0>res<65><73><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
//
virtual void CopyFrom(const GPtr<baseResInfo>& res)
{
if ( res )
{
ResourceId tempResID;
Priority tempPriority;
bool tempAsynLoading;
tempResID = resID;
tempPriority = priority;
tempAsynLoading = isAsynLoading;
Discard();
resID = tempResID;
priority = tempPriority;
isAsynLoading = tempAsynLoading;
resData = res->resData;
AssignDefaultResCompile( res );
defaultResUsed = false;
}
}
// <20><><EFBFBD><EFBFBD>Ĭ<EFBFBD>ϵ<EFBFBD><CFB5><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>̬
virtual void AssignDefaultResCompile(const GPtr<baseResInfo>& defaultRes)
{
return;
}
// <20>Ƿ<EFBFBD><C7B7><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><ECB2BD><EFBFBD><EFBFBD>
bool IsAsynLoading() const
{
return isAsynLoading;
}
void SetAsynLoading(bool b)
{
isAsynLoading = b;
}
bool IsDefaultResUsed()
{
return defaultResUsed;
}
void SetDefaultResUsed(bool isUsed)
{
defaultResUsed = isUsed;
}
void SetNeedReCompile(bool isNeedReCompile)
{
needReCompile = isNeedReCompile;
}
bool IsNeedReCompile()
{
return needReCompile;
}
virtual void ResetHandle()
{
}
protected:
friend class ResourceManager;
Priority priority;
Resources::ResourceId resID;
GPtr<Resources::Resource> resData;
bool isAsynLoading;
ResInfoContainer* container;
bool defaultResUsed;
bool needReCompile;
};
//------------------------------------------------------------------------
class TextureResInfo : public baseResInfo
{
__DeclareSubClass(TextureResInfo,baseResInfo);
public:
TextureResInfo()
{
texHandle = RenderBase::TextureHandle();
}
virtual ~TextureResInfo()
{
}
void SetData(const Resources::ResourceId& tex_id, const RenderBase::TextureHandle& handle)
{
resID = tex_id;
texHandle = handle;
}
void SetHandle(const RenderBase::TextureHandle& handle)
{
texHandle = handle;
}
const RenderBase::TextureHandle& GetHandle() const
{
return texHandle;
}
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>̬<EFBFBD>Ƿ<EFBFBD><C7B7><EFBFBD><EFBFBD><EFBFBD>
virtual bool IsCompiled() const
{
#ifdef __GENESIS_EDITOR__
return GetHandle().IsValid() && Super::IsCompiled();
#else
return GetHandle().IsValid();
#endif
}
virtual void ResetHandle()
{
texHandle = RenderBase::TextureHandle();
}
virtual void Discard();
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>̬
virtual void OnCompile();
virtual void AssignDefaultResCompile(const GPtr<baseResInfo>& defaultRes);
#ifndef __GENESIS_EDITOR__
virtual bool CanUsable() const
{
return IsCompiled();
}
#endif
protected:
RenderBase::TextureHandle texHandle;
};
//--------------------------------------------------------------------------------
class PrimitiveResInfo : public baseResInfo
{
__DeclareSubClass(PrimitiveResInfo,baseResInfo);
public:
PrimitiveResInfo()
{
primHandle = RenderBase::PrimitiveHandle();
}
virtual ~PrimitiveResInfo()
{
}
const RenderBase::PrimitiveHandle& GetHandle() const
{
return primHandle;
}
void SetHandle( const RenderBase::PrimitiveHandle& h)
{
primHandle = h;
}
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>̬<EFBFBD>Ƿ<EFBFBD><C7B7><EFBFBD><EFBFBD><EFBFBD>
virtual bool IsCompiled() const
{
#ifdef __GENESIS_EDITOR__
return GetHandle().IsValid() && Super::IsCompiled();
#else
return GetHandle().IsValid();
#endif
}
virtual void ResetHandle()
{
primHandle = RenderBase::PrimitiveHandle();
}
virtual void Discard();
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>̬
virtual void OnCompile();
virtual void AssignDefaultResCompile(const GPtr<baseResInfo>& defaultRes);
#ifndef __GENESIS_EDITOR__
virtual bool CanUsable() const
{
return IsCompiled();
}
#endif
protected:
RenderBase::PrimitiveHandle primHandle;
};
//------------------------------------------------------------------------
class MaterialResInfo : public baseResInfo
{
__DeclareSubClass(MaterialResInfo,baseResInfo);
public:
MaterialResInfo()
{
matIns = NULL;
mbSave = true;
mbImport = false;
}
virtual ~MaterialResInfo()
{
}
const Resources::ResourceId& GetMatID() const
{
return GetResID();
}
void SetMatID(const Resources::ResourceId& matID)
{
SetResID(matID);
}
const GPtr<Graphic::MaterialInstance>& GetHandle() const
{
return matIns;
}
GPtr<Graphic::MaterialInstance>& GetHandle()
{
return matIns;
}
void SetHandle(const GPtr<Graphic::MaterialInstance>& m )
{
matIns = m;
}
void SetSave(const bool bFlag )
{
mbSave = bFlag;
}
bool GetSave()
{
return mbSave;
}
void SetImport(const bool bImport)
{
mbImport = bImport;
}
bool GetImport()
{
return mbImport;
}
virtual void AssignDefaultResCompile(const GPtr<baseResInfo>& defaultRes);
virtual void ResetHandle()
{
matIns = NULL;
}
virtual void CopyFrom(const GPtr<baseResInfo>& res)
{
baseResInfo::CopyFrom(res);
GPtr<MaterialResInfo> matInfo = res.downcast<MaterialResInfo>();
mbSave = matInfo->mbSave;
mbImport = matInfo->mbImport;
}
protected:
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>̬<EFBFBD>Ƿ<EFBFBD><C7B7><EFBFBD><EFBFBD><EFBFBD>
virtual bool IsCompiled() const
{
return GetHandle().isvalid()&&Super::IsCompiled();
}
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>̬
virtual void OnCompile();
protected:
GPtr<Graphic::MaterialInstance> matIns;
bool mbSave;
bool mbImport;
friend class ResourceManager;
};
class SpritePackageResInfo : public baseResInfo
{
__DeclareSubClass(SpritePackageResInfo,baseResInfo);
public:
GPtr<Sprite::SpritePackage> GetPackage() const;
};
//------------------------------------------------------------------------
// <20><><EFBFBD><EFBFBD><EFBFBD>Ǽ򵥵<C7BC><F2B5A5B5><EFBFBD>Դ<EFBFBD><D4B4><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ҫ<EFBFBD><D2AA><EFBFBD><EFBFBD><EFBFBD>ض<EFBFBD><D8B6>Ķ<EFBFBD><C4B6><EFBFBD>
typedef baseResInfo TemplateResInfo;
typedef baseResInfo AudioResInfo;
typedef baseResInfo AudioResInfo;
typedef baseResInfo RawResInfo;
typedef baseResInfo AnimationResInfo;
typedef baseResInfo SkeletonResInfo;
typedef baseResInfo PhysXMaterialResInfo;
//------------------------------------------------------------------------
}
#endif // __resinfo_H__