MCPcopy Create free account
hub / github.com/NVIDIAGameWorks/Blast / onSampleStart

Method onSampleStart

samples/SampleBase/scene/SceneController.cpp:1131–1184  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1129}
1130
1131void SceneController::onSampleStart()
1132{
1133 // setup camera
1134 CFirstPersonCamera* camera = &getRenderer().getCamera();
1135 DirectX::XMVECTORF32 lookAtPt = { 0, 10, 0, 0 };
1136 DirectX::XMVECTORF32 eyePt = { 0, 20, 60, 0 };
1137 camera->SetViewParams(eyePt, lookAtPt);
1138 camera->SetRotateButtons(false, false, true, false);
1139 camera->SetEnablePositionMovement(true);
1140
1141 // setup scene
1142 m_scene = new Scene(getRenderer(), getPhysXController(), getBlastController(), getCommonUIController());
1143
1144 const SampleConfig& config = getManager()->getConfig();
1145
1146 // add packman repo to search dirs
1147 bool packmanResourcesAdded = false;
1148 if (const char* packmanPath = std::getenv("PM_PACKAGES_ROOT"))
1149 {
1150 const char* RESOURCES_CONFIG_FILE = "resources.xml";
1151
1152 std::string path;
1153 if (getRenderer().getResourceManager().findFile(RESOURCES_CONFIG_FILE, path))
1154 {
1155 if (getRenderer().getResourceManager().addSearchDir("..\\..\\samples\\resources\\BlastSampleResources\\") ||
1156 getRenderer().getResourceManager().addSearchDir("..\\..\\..\\samples\\resources\\BlastSampleResources\\"))
1157 {
1158 packmanResourcesAdded = true;
1159 }
1160 }
1161 }
1162 if (!packmanResourcesAdded)
1163 {
1164 getManager()->getCommonUIController().addPopupMessage("Error", "BlastSampleResources package wasn't found. Consider running download_sample_resources.bat in root folder.", 5.0f);
1165 }
1166
1167 // parse asset file
1168 AssetList assetList;
1169 if (!config.assetsFile.empty())
1170 {
1171 std::string path;
1172 if (getRenderer().getResourceManager().findFile(config.assetsFile, path))
1173 {
1174 parseAssetList(assetList, path);
1175 }
1176 }
1177
1178 // add both asset file and asset list from config
1179 addAssets(config.additionalAssetList, true); // only used for command line assets
1180 addAssets(assetList, packmanResourcesAdded);
1181
1182 // prepare scene
1183 spawnAsset(0);
1184}
1185
1186void SceneController::addAssets(const AssetList& assetList, bool loadModels)
1187{

Callers

nothing calls this directly

Calls 5

parseAssetListFunction · 0.85
addSearchDirMethod · 0.80
addPopupMessageMethod · 0.80
findFileMethod · 0.45
emptyMethod · 0.45

Tested by

no test coverage detected