aboutsummaryrefslogtreecommitdiff
path: root/APEX_1.4/snippets/SnippetResourcesLoading/SnippetResourcesLoading.cpp
diff options
context:
space:
mode:
authorsschirm <[email protected]>2017-02-27 16:40:12 +0100
committersschirm <[email protected]>2017-03-01 18:04:26 +0100
commit7840347c32755e94a807f978f1cbb558717ac8cf (patch)
tree295cd3ca93a45f8fcc43cf3cbf3887c0e0c5526b /APEX_1.4/snippets/SnippetResourcesLoading/SnippetResourcesLoading.cpp
parentPre-release comments marking end of beta. (diff)
downloadphysx-3.4-7840347c32755e94a807f978f1cbb558717ac8cf.tar.xz
physx-3.4-7840347c32755e94a807f978f1cbb558717ac8cf.zip
PhysX 3.4, APEX 1.4 final release @21757769v3.4.0-rc-2
Diffstat (limited to 'APEX_1.4/snippets/SnippetResourcesLoading/SnippetResourcesLoading.cpp')
-rw-r--r--APEX_1.4/snippets/SnippetResourcesLoading/SnippetResourcesLoading.cpp32
1 files changed, 17 insertions, 15 deletions
diff --git a/APEX_1.4/snippets/SnippetResourcesLoading/SnippetResourcesLoading.cpp b/APEX_1.4/snippets/SnippetResourcesLoading/SnippetResourcesLoading.cpp
index ae749a3c..88a97bff 100644
--- a/APEX_1.4/snippets/SnippetResourcesLoading/SnippetResourcesLoading.cpp
+++ b/APEX_1.4/snippets/SnippetResourcesLoading/SnippetResourcesLoading.cpp
@@ -19,6 +19,8 @@
#include "basicios/BasicIosAsset.h"
#include "RenderMeshAsset.h"
+#include <legacy/ModuleLegacy.h>
+
#include "PsString.h"
#include <sys/stat.h>
@@ -58,15 +60,10 @@ public:
{
Asset* asset = 0;
- CHAR buf[256];
- strcpy(buf, gMediaPath);
- strcat(buf, name);
- strcat(buf, ".apx");
- const char* path = &buf[1];
+ const char* path = name;
// does file exists?
- struct stat info;
- if ((stat(path, &info) != -1) && (info.st_mode & (S_IFREG)) != 0)
+ if (isFileExist(path))
{
PxFileBuf* stream = gApexSDK->createStream(path, PxFileBuf::OPEN_READ_ONLY);
@@ -159,6 +156,11 @@ void initApex()
gApexSDK = CreateApexSDK(apexDesc, &error);
PX_ASSERT(gApexSDK);
+#if APEX_MODULES_STATIC_LINK
+ nvidia::apex::instantiateModuleParticles();
+ nvidia::apex::instantiateModuleLegacy();
+#endif
+
// Initialize particles module
ModuleParticles* apexParticlesModule = static_cast<ModuleParticles*>(gApexSDK->createModule("Particles"));
PX_ASSERT(apexParticlesModule);
@@ -178,29 +180,29 @@ void releaseAPEX()
delete gMyResourceCallback;
}
-int main(int, char**)
+void snippetMain(const char* rootPath)
{
initPhysX();
initApex();
Asset* asset;
- gMediaPath = GetCommandLine();
- PathRemoveFileSpec(gMediaPath);
- strcat(gMediaPath, "/../../snippets/SnippetCommon/");
+ std::string path;
+ path.append(rootPath);
+ path.append("/snippets/SnippetCommon/");
- asset = loadApexAsset(EMITTER_AUTHORING_TYPE_NAME, "testMeshEmitter4BasicIos6");
+ std::string file0 = path + "testMeshEmitter4BasicIos6.apx";
+ asset = loadApexAsset(EMITTER_AUTHORING_TYPE_NAME, file0.c_str());
asset->forceLoadAssets();
gApexSDK->forceLoadAssets();
asset->release();
- asset = loadApexAsset(EMITTER_AUTHORING_TYPE_NAME, "testSpriteEmitter4BasicIos6");
+ std::string file1 = path + "testMeshEmitter4BasicIos6.apx";
+ asset = loadApexAsset(EMITTER_AUTHORING_TYPE_NAME, file1.c_str());
asset->forceLoadAssets();
gApexSDK->forceLoadAssets();
asset->release();
releaseAPEX();
releasePhysX();
-
- return 0;
}