2 #include "IAttributeFields.h" 36 ATTRIBUTE_METHOD1(
AssetEntity, GetLocalFileName_s,
const char**) { *p1 = cls->GetLocalFileName().c_str();
return S_OK; }
37 ATTRIBUTE_METHOD1(
AssetEntity, SetLocalFileName_s,
const char*) { cls->SetLocalFileName(p1);
return S_OK; }
39 ATTRIBUTE_METHOD1(
AssetEntity, GetRemoteAssetURL_s,
const char**) {
static std::string s; s = cls->GetRemoteAssetURL().c_str(); *p1 = s.c_str();
return S_OK; }
41 ATTRIBUTE_METHOD1(
AssetEntity, IsValid_s,
bool*) { *p1 = cls->IsValid();
return S_OK; }
42 ATTRIBUTE_METHOD1(
AssetEntity, IsLoaded_s,
bool*) { *p1 = cls->IsLoaded();
return S_OK; }
43 ATTRIBUTE_METHOD1(
AssetEntity, IsLocked_s,
bool*) { *p1 = cls->IsLocked();
return S_OK; }
44 ATTRIBUTE_METHOD1(
AssetEntity, IsInitialized_s,
bool*) { *p1 = cls->IsInitialized();
return S_OK; }
46 ATTRIBUTE_METHOD1(
AssetEntity, GetState_s,
int*) { *p1 = (int)cls->GetState();
return S_OK; }
100 virtual AssetType GetType(){
return base;};
103 virtual const std::string& GetIdentifier();
110 virtual bool AutoSync(
bool bForceSync =
false,
bool bLazyLoading=
true);
118 virtual void Refresh(
const char* sFilename=NULL,
bool bLazyLoad =
false);
125 virtual void SetLocalFileName(
const char* sFileName);
179 m_assetState = state;
185 virtual HRESULT RestoreDeviceObjects(){
return S_OK;};
186 virtual HRESULT InvalidateDeviceObjects(){
return S_OK;};
187 virtual HRESULT DeleteDeviceObjects(){
m_bIsInitialized =
false;
return S_OK;};
208 RestoreDeviceObjects();
218 InvalidateDeviceObjects();
219 DeleteDeviceObjects();
243 virtual bool Lock(
int nMethod=0);
271 string m_localfilename;
275 #include "AssetManager.h" AssetState GetState()
return the asset state.
Definition: AssetEntity.h:172
static const string & GetAssetServerUrl()
get the asset server url.
Definition: AssetEntity.cpp:53
an attribute class is a collection of attribute fields.
Definition: AttributeClass.h:10
the asset is always remote.
Definition: AssetEntity.h:62
virtual CParameterBlock * GetParamBlock(bool bCreateIfNotExist=false)
get effect parameter block with this object.
Definition: AssetEntity.h:133
bool IsInitialized()
whether initialized.
Definition: AssetEntity.cpp:48
void SetState(AssetState state)
set the asset state.
Definition: AssetEntity.h:177
virtual bool GetBoundingBox(Vector3 *pMin, Vector3 *pMax)
Get AABB bounding box of the asset object.
Definition: AssetEntity.h:250
virtual int Release()
call this function to safely release this asset.
Definition: AssetEntity.cpp:254
virtual void Refresh(const char *sFilename=NULL, bool bLazyLoad=false)
refresh the asset from local disk.
Definition: AssetEntity.cpp:230
AssetType
each asset type has a unique asset type number
Definition: AssetEntity.h:82
virtual HRESULT RendererRecreated()
callback of listening the event that renderer was recreated on Android/WP8 all opengl related id has ...
Definition: AssetEntity.h:191
different physics engine has different winding order.
Definition: EventBinding.h:32
if a remote file can not be downloaded.
Definition: AssetEntity.h:75
the asset is local, which means that we have found a local disk version of the file.
Definition: AssetEntity.h:60
if file can not be found in local disk or in local cache, we will put it in sync start state...
Definition: AssetEntity.h:69
virtual bool IsLoaded()
most assets are loaded asynchronously.
Definition: AssetEntity.cpp:43
Standard 3-dimensional vector.
Definition: ParaVector3.h:16
AssetKey m_key
this is the unique key object.
Definition: AssetEntity.h:250
virtual const string & GetLocalFileName()
the actual local file name.
Definition: AssetEntity.cpp:239
bool m_bIsInitialized
whether this entity is initialized;Entity is by default lazily initialized
Definition: AssetEntity.h:256
virtual string GetRemoteAssetURL()
get the remote server url of this asset.
Definition: AssetEntity.cpp:81
bool IsValid()
whether this is a valid resource object.
Definition: AssetEntity.h:137
virtual int InstallFields(CAttributeClass *pClass, bool bOverride)
this class should be implemented if one wants to add new attribute.
Definition: AssetEntity.cpp:265
if a remote file is downloaded to cache and loaded.
Definition: AssetEntity.h:72
A common interface for all classes implementing IAttributeFields By implementing this class's virtual...
Definition: IAttributeFields.h:59
the file is not found or failed to load
Definition: AssetEntity.h:78
virtual void UnLock()
UnLock the object.
Definition: AssetEntity.cpp:76
virtual void Cleanup()
Clean up additional resources.
Definition: AssetEntity.h:195
virtual bool AutoSync(bool bForceSync=false, bool bLazyLoading=true)
call this function to automatically sync with the remote server according to current asset state ...
Definition: AssetEntity.cpp:165
virtual IAttributeFields * GetAttributeObject()
get the attribute object of this asset.
Definition: AssetEntity.cpp:154
std::string AssetKey
the unique key object for asset entity.
Definition: AssetEntity.h:13
virtual bool Lock(int nMethod=0)
Lock the object.
Definition: AssetEntity.cpp:66
AssetKey & GetKey()
return the key object.
Definition: AssetEntity.h:167
bool m_bIsValid
whether this is a valid resource object.
Definition: AssetEntity.h:259
void GarbageCollectMe()
if its reference count is zero, unload this asset object.
Definition: AssetEntity.h:228
void UnloadAsset()
unload asset.
Definition: AssetEntity.h:215
void LoadAsset()
load asset.
Definition: AssetEntity.h:204
static void SetAssetServerUrl(const char *pStr)
set the asset server url.
Definition: AssetEntity.cpp:58
asset is from the local cache.
Definition: AssetEntity.h:65
Base class for managed asset entity in ParaEngine.
Definition: AssetEntity.h:25
asset is always created in normal state.
Definition: AssetEntity.h:57
a list of CParameter{name, value} pairs of anything.
Definition: ParameterBlock.h:108
bool IsLocked()
whether this is a locked resource resource.
Definition: AssetEntity.h:237
AssetState
the asset state.
Definition: AssetEntity.h:54