My Project
ParaScriptingCommon.h
1 //-----------------------------------------------------------------------------
2 // Copyright (C) 2004 - 2006 ParaEngine Dev Studio, All Rights Reserved.
3 // Date: 2005.9
4 // Description: API for common objects.
5 //-----------------------------------------------------------------------------
6 #pragma once
7 
8 #include "ParaScriptingGlobal.h"
9 #include <string>
10 
11 namespace ParaEngine{
12  struct AssetEntity;
13  class CParameterBlock;
14 }
15 
16 namespace luabind
17 {
18  namespace adl{
19  class object;
20  }
21  using adl::object;
22 }
23 
24 namespace ParaScripting
25 {
26  using namespace std;
27  using namespace ParaEngine;
28  using namespace luabind;
29  class ParaAssetObject;
30 
37  class PE_CORE_DECL ParaParamBlock
38  {
39  public:
40  CParameterBlock * m_pParamBlock;
41  ParaParamBlock():m_pParamBlock(NULL){};
42  ParaParamBlock(CParameterBlock * pBlock):m_pParamBlock(pBlock){};
43 
47  bool IsValid();
48 
50  void Clear();
51 
52  void SetInt(const char* sParamName, int value);
53  void SetBoolean(const char* sParamName, bool value);
54  void SetFloat(const char* sParamName, float value);
55  void SetVector2(const char* sParamName, float x, float y);
56  void SetVector3(const char* sParamName, float x, float y, float z);
57  void SetVector4(const char* sParamName, float x, float y, float z, float w);
58 
63  void SetMatrix43(const char* sParamName, const char* matrix);
67  void SetParam(const char* sParamName, const char* sValue);
68 
74  void SetTexture(int nTextureIndex, const char* sFilePath);
75  void SetTexture_(const char* sParamName, const char* sFilePath);
76 
78  void SetTextureObj(int nTextureIndex, const ParaAssetObject& assetObject);
79  };
80 
85  class PE_CORE_DECL ParaAssetObject
86  {
87  public:
88  AssetEntity * m_pAsset;
89 
90  ParaAssetObject():m_pAsset(NULL){};
91  ParaAssetObject(AssetEntity * pEntity):m_pAsset(pEntity){};
92 
93  AssetEntity * GetAssetEntity();
94  TextureEntity * GetTextureEntity();
95 
99  static TextureEntity * GetTexture(const object& texture);
100  static TextureEntity * GetTextureWithParams(const object& texture);
101 
105  bool IsValid();
106 
111  bool IsLoaded();
112 
114  bool equals(const ParaAssetObject obj) const;
115 
121  bool Reload();
122 
126  void UnloadAsset();
127 
131  void LoadAsset();
132 
138  void Refresh();
139  void Refresh1(const char* sFilename);
140 
146  void Release();
147 
149  int GetRefCount();
150 
156  void GarbageCollectMe();
157 
160  string GetKeyName();
162  const char* GetKeyName_();
163 
166  string GetFileName();
168  const char* GetFileName_();
169 
170 
189  int GetType();
190 
197  int SetHandle(int nHandle);
198 
201  int GetHandle();
202 
204  ParaAttributeObject GetAttributeObject();
205 
207  //
208  // for effect entity
209  //
211 
218  ParaParamBlock GetParamBlock();
219 
221  bool Begin();
223  bool BeginPass(int nPass);
228  void SetTexture(int nIndex, const char* filename);
229 
231  bool EndPass();
233  bool End();
234 
236  bool CommitChanges();
237 
239  //
240  // for TextureEntity
241  //
243 
248  void SetTextureFPS(float FPS);
253  void EnableTextureAutoAnimation(bool bEnable);
258  void SetCurrentFrameNumber(int nFrame);
263  int GetCurrentFrameNumber();
264 
269  int GetFrameCount();
270 
275  int GetWidth();
280  int GetHeight();
281 
283  void SetSize(int nWidth, int nHeight);
284 
288  object GetBoundingBox(const object& box);
289 
291  //
292  // for static mesh entity
293  //
295 
302  int GetNumReplaceableTextures();
303 
310  ParaAssetObject GetDefaultReplaceableTexture(int ReplaceableTextureID);
311 
312  void SetCallback(int callbackType,const char * func);
313  };
314 
315 
324  class PE_CORE_DECL ParaAsset
325  {
326  public:
333  static bool OpenArchive(const char* strFileName);
334 
335 
343  static bool GeneratePkgFile(const char* srcZip, const char* destPkg );
344 
353  static bool GeneratePkgFile_(const char* srcZip, const char* destPkg, int nVersion);
354 
361  static bool OpenArchive2(const char* strFileName, bool bUseRelativePath);
362 
368  static bool OpenArchiveEx(const char* strFileName, const char* sRootDir);
369 
372  static void CloseArchive(const string& path);
373 
378  static const char* GetAssetServerUrl();
379 
385  static void SetAssetServerUrl(const char* path);
386 
389  static void GarbageCollect();
401  static void Unload(const char* assettype);
404  static void UnloadAll();
405 
407  static void UnloadDatabase();
408 
415  static void Init();
416 
420  static ParaAssetObject LoadEffectFile(const char* strAssetName, const char* strFilePath);
421 
425  static ParaAssetObject GetEffectFile(const char* strAssetName);
426 
432  static ParaAssetObject LoadParaX(const char* strAssetName, const char* strFilePath);
433 
437  static ParaAssetObject LoadDatabase( const char* strAssetName, const char* strFilePath);
438 
448  static ParaAssetObject LoadStaticMesh(const char* strAssetName, const char* strFilePath);
449 
451  static ParaAssetObject LoadPickingBuffer(const char* strAssetName);
452 
465 
467 
469 
471 
473 
475 
477 
481  static ParaAssetObject LoadTexture(const char* strAssetName, const char* strFilePath, int nSurfaceType);
482  static ParaAssetObject LoadRenderTarget(const char* strAssetName, int width, int height);
490  static ParaAssetObject LoadSpriteFrame(const char* strAssetName, int nFrames, int nRow, int nCol);
495  static ParaAssetObject LoadFont(const char* strAssetName, const char* FontName, int nFontSize);
499  static ParaAssetObject LoadImageFont(const char* strAssetName, const char* TextureName, int nSize, int nTxtColumns);
504  static ParaAssetObject LoadSound(const char* strAssetName, const char* strFilePath, bool bInit);
505 
514  static void AddFontName(const string& sLocalName, const string& sTypeFaceName);
515 
517  //
518  // static functions: manager class functions.
519  //
521 
527  static int GetBoneAnimProviderIDByName(const char* sName);
528 
532  static const char* GetBoneAnimProviderFileNameByID(int nAnimID);
533 
543  static int CreateBoneAnimProvider(int nAnimID, const char* name, const char* filename, bool bOverwrite);
544 
548  static bool DeleteBoneAnimProvider(int nAnimID);
549 
556  static int PrintToFile(const char* strFileName, DWORD dwSelection);
557 
561  static bool Refresh(const char* filename);
562  };
563 }
Which DXT Compression to Use? Obviously, there are some trade-offs between the different formats whic...
Definition: TextureEntity.h:29
different physics engine has different winding order.
Definition: EventBinding.h:32
a list of CParameter{name, value} pairs of anything.
Definition: ParaScriptingCommon.h:37
Definition: PEtypes.h:507
Definition: enum_maker.hpp:46
it represents an attribute object associated with an object.
Definition: ParaScriptingGlobal.h:458
for luabind, The main drawback of this approach is that the compilation time will increase for the fi...
Definition: luaSQLite.cpp:1971
Base class for managed asset entity in ParaEngine.
Definition: AssetEntity.h:25
it represents an asset entity.
Definition: ParaScriptingCommon.h:85
a list of CParameter{name, value} pairs of anything.
Definition: ParameterBlock.h:108
ParaAsset namespace contains a list of HAPI functions to manage resources(asset) used in game world c...
Definition: ParaScriptingCommon.h:324