Integrating up through commit 90f050496
This commit is contained in:
@@ -559,7 +559,7 @@ public:
|
||||
virtual bool Init();
|
||||
virtual void OnFrameStart();
|
||||
virtual void Update();
|
||||
virtual void RenderWorld(const int nRenderFlags, const SRenderingPassInfo& passInfo, const char* szDebugName);
|
||||
virtual void RenderWorld(int nRenderFlags, const SRenderingPassInfo& passInfo, const char* szDebugName);
|
||||
virtual void PreWorldStreamUpdate(const CCamera& cam);
|
||||
virtual void WorldStreamUpdate();
|
||||
virtual void ShutDown();
|
||||
@@ -570,7 +570,7 @@ public:
|
||||
virtual void PostLoadLevel();
|
||||
virtual bool InitLevelForEditor(const char* szFolderName, const char* szMissionName);
|
||||
virtual bool LevelLoadingInProgress();
|
||||
virtual void DisplayInfo(float& fTextPosX, float& fTextPosY, float& fTextStepY, const bool bEnhanced);
|
||||
virtual void DisplayInfo(float& fTextPosX, float& fTextPosY, float& fTextStepY, bool bEnhanced);
|
||||
virtual void DisplayMemoryStatistics();
|
||||
virtual void SetupDistanceFog();
|
||||
virtual IStatObj* LoadStatObjUnsafeManualRef(const char* fileName, const char* geomName = nullptr, /*[Out]*/ IStatObj::SSubObject** subObject = nullptr,
|
||||
@@ -893,7 +893,7 @@ public:
|
||||
void UpdatePostRender(const SRenderingPassInfo& passInfo);
|
||||
|
||||
virtual void RenderScene(const int nRenderFlags, const SRenderingPassInfo& passInfo);
|
||||
virtual void RenderSceneReflection(const int nRenderFlags, const SRenderingPassInfo& passInfo);
|
||||
virtual void RenderSceneReflection(int nRenderFlags, const SRenderingPassInfo& passInfo);
|
||||
virtual void DebugDraw_UpdateDebugNode();
|
||||
|
||||
void DebugDraw_Draw();
|
||||
|
||||
@@ -38,7 +38,9 @@
|
||||
#include <I3DEngine.h>
|
||||
#include <LoadScreenBus.h>
|
||||
#include <StatObjBus.h>
|
||||
#include "AzCore/Component/TickBus.h"
|
||||
|
||||
#include <AzCore/Component/TickBus.h>
|
||||
#include <AzFramework/API/ApplicationAPI.h>
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
#define LEVEL_DATA_FILE "LevelData.xml"
|
||||
@@ -154,6 +156,9 @@ bool C3DEngine::InitLevelForEditor([[maybe_unused]] const char* szFolderName, [[
|
||||
|
||||
ClearDebugFPSInfo();
|
||||
|
||||
bool usePrefabSystemEnabled = false;
|
||||
AzFramework::ApplicationRequests::Bus::BroadcastResult(
|
||||
usePrefabSystemEnabled, &AzFramework::ApplicationRequests::IsPrefabSystemEnabled);
|
||||
|
||||
if (!szFolderName || !szFolderName[0])
|
||||
{
|
||||
@@ -161,7 +166,7 @@ bool C3DEngine::InitLevelForEditor([[maybe_unused]] const char* szFolderName, [[
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (!szMissionName || !szMissionName[0])
|
||||
if (!usePrefabSystemEnabled && (!szMissionName || !szMissionName[0]))
|
||||
{
|
||||
Warning("C3DEngine::LoadLevel: Mission name is not specified");
|
||||
}
|
||||
@@ -248,6 +253,17 @@ bool C3DEngine::LevelLoadingInProgress()
|
||||
|
||||
bool C3DEngine::LoadCompiledOctreeForEditor()
|
||||
{
|
||||
bool usePrefabSystemForLevels = false;
|
||||
AzFramework::ApplicationRequests::Bus::BroadcastResult(
|
||||
usePrefabSystemForLevels, &AzFramework::ApplicationRequests::IsPrefabSystemForLevelsEnabled);
|
||||
|
||||
if (usePrefabSystemForLevels)
|
||||
{
|
||||
// Prefab levels don't use any of the legacy level data.
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
// Load LevelData.xml File.
|
||||
XmlNodeRef xmlLevelData = GetSystem()->LoadXmlFromFile(GetLevelFilePath(LEVEL_DATA_FILE));
|
||||
|
||||
@@ -257,18 +273,8 @@ bool C3DEngine::LoadCompiledOctreeForEditor()
|
||||
return false;
|
||||
}
|
||||
|
||||
std::vector<struct IStatObj*>* pStatObjTable = NULL;
|
||||
std::vector<_smart_ptr<IMaterial> >* pMatTable = NULL;
|
||||
|
||||
int nSID = 0;
|
||||
|
||||
XmlNodeRef nodeRef = xmlLevelData->findChild("SurfaceTypes");
|
||||
|
||||
LoadCollisionClasses(xmlLevelData->findChild("CollisionClasses"));
|
||||
|
||||
SAFE_DELETE(pStatObjTable);
|
||||
SAFE_DELETE(pMatTable);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -617,6 +623,11 @@ bool C3DEngine::LoadLevel(const char* szFolderName, const char* szMissionName)
|
||||
GetISystem()->LoadConfiguration(GetLevelFilePath(LEVEL_CONFIG_FILE));
|
||||
}
|
||||
|
||||
bool usePrefabSystemForLevels = false;
|
||||
AzFramework::ApplicationRequests::Bus::BroadcastResult(
|
||||
usePrefabSystemForLevels, &AzFramework::ApplicationRequests::IsPrefabSystemForLevelsEnabled);
|
||||
|
||||
if (!usePrefabSystemForLevels)
|
||||
{ // check is LevelData.xml file exist
|
||||
char sMapFileName[_MAX_PATH];
|
||||
cry_strcpy(sMapFileName, m_szLevelFolder);
|
||||
@@ -659,12 +670,16 @@ bool C3DEngine::LoadLevel(const char* szFolderName, const char* szMissionName)
|
||||
}
|
||||
|
||||
// Load LevelData.xml File.
|
||||
XmlNodeRef xmlLevelData = GetSystem()->LoadXmlFromFile(GetLevelFilePath(LEVEL_DATA_FILE));
|
||||
|
||||
if (xmlLevelData == 0)
|
||||
XmlNodeRef xmlLevelData;
|
||||
if (!usePrefabSystemForLevels)
|
||||
{
|
||||
Error("C3DEngine::LoadLevel: xml file not found (files missing?)"); // files missing ?
|
||||
return false;
|
||||
xmlLevelData = GetSystem()->LoadXmlFromFile(GetLevelFilePath(LEVEL_DATA_FILE));
|
||||
|
||||
if (xmlLevelData == 0)
|
||||
{
|
||||
Error("C3DEngine::LoadLevel: xml file not found (files missing?)"); // files missing ?
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
// re-create decal manager
|
||||
@@ -690,41 +705,48 @@ bool C3DEngine::LoadLevel(const char* szFolderName, const char* szMissionName)
|
||||
m_pObjManager->PreloadLevelObjects();
|
||||
}
|
||||
|
||||
std::vector<struct IStatObj*>* pStatObjTable = NULL;
|
||||
std::vector<_smart_ptr<IMaterial> >* pMatTable = NULL;
|
||||
|
||||
int nSID = 0;
|
||||
|
||||
// load terrain
|
||||
XmlNodeRef nodeRef = xmlLevelData->findChild("SurfaceTypes");
|
||||
|
||||
LoadCollisionClasses(xmlLevelData->findChild("CollisionClasses"));
|
||||
if (!usePrefabSystemForLevels)
|
||||
{
|
||||
LoadCollisionClasses(xmlLevelData->findChild("CollisionClasses"));
|
||||
}
|
||||
|
||||
gEnv->pSystem->SetSystemGlobalState(ESYSTEM_GLOBAL_STATE_LEVEL_LOAD_START_STATIC_WORLD);
|
||||
|
||||
#if defined(FEATURE_SVO_GI)
|
||||
if (gEnv->pConsole->GetCVar("e_GI")->GetIVal())
|
||||
if (usePrefabSystemForLevels)
|
||||
{
|
||||
// Load SVOGI settings
|
||||
char szFileName[256];
|
||||
azsprintf(szFileName, "mission_%s.xml", szMissionName);
|
||||
XmlNodeRef xmlMission = GetSystem()->LoadXmlFromFile(Get3DEngine()->GetLevelFilePath(szFileName));
|
||||
if (xmlMission)
|
||||
{
|
||||
LoadTISettings(xmlMission->findChild("Environment"));
|
||||
}
|
||||
// When using the prefab system, just initialize a default manager instead of loading values from the indoor.dat file.
|
||||
m_pVisAreaManager = new CVisAreaManager();
|
||||
}
|
||||
else
|
||||
{
|
||||
#if defined(FEATURE_SVO_GI)
|
||||
if (gEnv->pConsole->GetCVar("e_GI")->GetIVal())
|
||||
{
|
||||
// Load SVOGI settings
|
||||
char szFileName[256];
|
||||
azsprintf(szFileName, "mission_%s.xml", szMissionName);
|
||||
XmlNodeRef xmlMission = GetSystem()->LoadXmlFromFile(Get3DEngine()->GetLevelFilePath(szFileName));
|
||||
if (xmlMission)
|
||||
{
|
||||
LoadTISettings(xmlMission->findChild("Environment"));
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
// load indoors
|
||||
if (!LoadVisAreas(&pStatObjTable, &pMatTable))
|
||||
{
|
||||
Error("VisAreas file (%s) not found or file version error, please try to re-export the level", COMPILED_VISAREA_MAP_FILE_NAME);
|
||||
return false;
|
||||
// load indoors
|
||||
std::vector<struct IStatObj*>* pStatObjTable = NULL;
|
||||
std::vector<_smart_ptr<IMaterial>>* pMatTable = NULL;
|
||||
|
||||
if (!LoadVisAreas(&pStatObjTable, &pMatTable))
|
||||
{
|
||||
Error("VisAreas file (%s) not found or file version error, please try to re-export the level", COMPILED_VISAREA_MAP_FILE_NAME);
|
||||
return false;
|
||||
}
|
||||
|
||||
SAFE_DELETE(pStatObjTable);
|
||||
SAFE_DELETE(pMatTable);
|
||||
}
|
||||
|
||||
SAFE_DELETE(pStatObjTable);
|
||||
SAFE_DELETE(pMatTable);
|
||||
|
||||
//Update loading screen and important tick functions
|
||||
SYNCHRONOUS_LOADING_TICK();
|
||||
@@ -737,29 +759,37 @@ bool C3DEngine::LoadLevel(const char* szFolderName, const char* szMissionName)
|
||||
// load leveldata.xml
|
||||
m_pTerrainWaterMat = 0;
|
||||
m_nWaterBottomTexId = 0;
|
||||
|
||||
// This call is needed whether or not the prefab system is used for levels. If prefabs are used, it will initialize the
|
||||
// environment and time of day managers with default values. With legacy levels, they will intialize from the saved xml files.
|
||||
LoadMissionDataFromXMLNode(szMissionName);
|
||||
|
||||
//Update loading screen and important tick functions
|
||||
SYNCHRONOUS_LOADING_TICK();
|
||||
|
||||
|
||||
// init water if not initialized already (if no mission was found)
|
||||
if (!GetOcean())
|
||||
if (!usePrefabSystemForLevels)
|
||||
{
|
||||
PrintMessage("===== Creating Ocean =====");
|
||||
CreateOcean(m_pTerrainWaterMat, COcean::GetWaterLevelInfo());
|
||||
}
|
||||
// init water if not initialized already (if no mission was found)
|
||||
if (!GetOcean())
|
||||
{
|
||||
PrintMessage("===== Creating Ocean =====");
|
||||
CreateOcean(m_pTerrainWaterMat, COcean::GetWaterLevelInfo());
|
||||
}
|
||||
|
||||
PrintMessage("===== Load level physics data =====");
|
||||
LoadFlaresData();
|
||||
PrintMessage("===== Load level physics data =====");
|
||||
LoadFlaresData();
|
||||
}
|
||||
|
||||
// restore game state
|
||||
EnableOceanRendering(true);
|
||||
m_pObjManager->SetLockCGFResources(false);
|
||||
|
||||
PrintMessage("===== loading occlusion mesh =====");
|
||||
if (!usePrefabSystemForLevels)
|
||||
{
|
||||
PrintMessage("===== loading occlusion mesh =====");
|
||||
|
||||
GetObjManager()->LoadOcclusionMesh(szFolderName);
|
||||
GetObjManager()->LoadOcclusionMesh(szFolderName);
|
||||
}
|
||||
|
||||
PrintMessage("===== Finished loading static world =====");
|
||||
|
||||
@@ -817,7 +847,9 @@ void C3DEngine::LoadMissionDataFromXMLNode(const char* szMissionName)
|
||||
}
|
||||
else
|
||||
{
|
||||
Error("C3DEngine::LoadMissionDataFromXMLNode: Mission file not found: %s", szFileName);
|
||||
// XML file couldn't be found, just use the defaults for everything.
|
||||
LoadEnvironmentSettingsFromXML(nullptr, GetDefSID());
|
||||
LoadTimeOfDaySettingsFromXML(nullptr);
|
||||
}
|
||||
}
|
||||
else
|
||||
@@ -832,10 +864,13 @@ char* C3DEngine::GetXMLAttribText(XmlNodeRef pInputNode, const char* szLevel1, c
|
||||
|
||||
cry_strcpy(szResText, szDefaultValue);
|
||||
|
||||
XmlNodeRef nodeLevel = pInputNode->findChild(szLevel1);
|
||||
if (nodeLevel && nodeLevel->haveAttr(szLevel2))
|
||||
if (pInputNode)
|
||||
{
|
||||
cry_strcpy(szResText, nodeLevel->getAttr(szLevel2));
|
||||
XmlNodeRef nodeLevel = pInputNode->findChild(szLevel1);
|
||||
if (nodeLevel && nodeLevel->haveAttr(szLevel2))
|
||||
{
|
||||
cry_strcpy(szResText, nodeLevel->getAttr(szLevel2));
|
||||
}
|
||||
}
|
||||
|
||||
return szResText;
|
||||
@@ -847,13 +882,16 @@ char* C3DEngine::GetXMLAttribText(XmlNodeRef pInputNode, const char* szLevel1, c
|
||||
|
||||
cry_strcpy(szResText, szDefaultValue);
|
||||
|
||||
XmlNodeRef nodeLevel = pInputNode->findChild(szLevel1);
|
||||
if (nodeLevel)
|
||||
if (pInputNode)
|
||||
{
|
||||
nodeLevel = nodeLevel->findChild(szLevel2);
|
||||
XmlNodeRef nodeLevel = pInputNode->findChild(szLevel1);
|
||||
if (nodeLevel)
|
||||
{
|
||||
cry_strcpy(szResText, nodeLevel->getAttr(szLevel3));
|
||||
nodeLevel = nodeLevel->findChild(szLevel2);
|
||||
if (nodeLevel)
|
||||
{
|
||||
cry_strcpy(szResText, nodeLevel->getAttr(szLevel3));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -904,7 +942,7 @@ void C3DEngine::LoadEnvironmentSettingsFromXML(XmlNodeRef pInputNode, [[maybe_un
|
||||
|
||||
{
|
||||
char moonTexture[256];
|
||||
cry_strcpy(moonTexture, GetXMLAttribText(pInputNode, "Moon", "Texture", ""));
|
||||
cry_strcpy(moonTexture, GetXMLAttribText(pInputNode, "Moon", "Texture", "Textures/Skys/Night/half_moon.dds"));
|
||||
|
||||
ITexture* pTex(0);
|
||||
if (moonTexture[0] != '\0')
|
||||
@@ -923,14 +961,14 @@ void C3DEngine::LoadEnvironmentSettingsFromXML(XmlNodeRef pInputNode, [[maybe_un
|
||||
m_volFogGlobalDensityMultiplierLDR = (float)max(atof(GetXMLAttribText(pInputNode, "Fog", "LDRGlobalDensMult", "1.0")), 0.0);
|
||||
|
||||
// SkyBox
|
||||
const string skyMaterialName = GetXMLAttribText(pInputNode, "SkyBox", "Material", "Materials/Sky/Sky");
|
||||
const string skyLowSpecMaterialName = GetXMLAttribText(pInputNode, "SkyBox", "MaterialLowSpec", "Materials/Sky/Sky");
|
||||
const string skyMaterialName = GetXMLAttribText(pInputNode, "SkyBox", "Material", "EngineAssets/Materials/Sky/Sky");
|
||||
const string skyLowSpecMaterialName = GetXMLAttribText(pInputNode, "SkyBox", "MaterialLowSpec", "EngineAssets/Materials/Sky/Sky");
|
||||
SetSkyMaterialPath(skyMaterialName);
|
||||
SetSkyLowSpecMaterialPath(skyLowSpecMaterialName);
|
||||
LoadSkyMaterial();
|
||||
|
||||
m_fSkyBoxAngle = (float)atof(GetXMLAttribText(pInputNode, "SkyBox", "Angle", "0.0"));
|
||||
m_fSkyBoxStretching = (float)atof(GetXMLAttribText(pInputNode, "SkyBox", "Stretching", "1.0"));
|
||||
m_fSkyBoxStretching = (float)atof(GetXMLAttribText(pInputNode, "SkyBox", "Stretching", "0.5"));
|
||||
|
||||
// set terrain water (aka the infinite ocean), sun road and bottom shaders
|
||||
if (OceanToggle::IsActive())
|
||||
|
||||
@@ -37,7 +37,7 @@ namespace LegacyCryPhysicsUtils
|
||||
strided_pointer<Vec3mem> pts = strided_pointer<Vec3mem>((Vec3mem*)_pts.data, _pts.iStride);
|
||||
|
||||
ptitem* pt, * ptmax, * ptdeleted, * ptlist = npts > sizeof(ptbuf) / sizeof(ptbuf[0]) ? new ptitem[npts] : ptbuf;
|
||||
qhtritem* tr, * trnext, * trend, * trnew, * trdata = trbuf, * trstart = 0, * trlast, * trbest;
|
||||
qhtritem* tr, * trnext, * trend, * trnew, * trdata = trbuf, * trstart = 0, * trlast, * trbest = nullptr;
|
||||
int i, j, k, ti, trdatasz = sizeof(trbuf) / sizeof(trbuf[0]), bidx[6], n, next_iter, delbuds;
|
||||
qhtritem** tmparr_ptr = tmparr_ptr_buf;
|
||||
int* tmparr_idx = tmparr_idx_buf, tmparr_sz = 512;
|
||||
@@ -679,7 +679,7 @@ namespace LegacyCryPhysicsUtils
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
vtxthunk* pThunks, * pPrevThunk, * pContStart, ** pSags, ** pBottoms, * pPinnacle, * pBounds[2], * pPrevBounds[2], * ptr, * ptr_next;
|
||||
vtxthunk* pThunks, * pPrevThunk, * pContStart, ** pSags, ** pBottoms, * pPinnacle = nullptr, * pBounds[2], * pPrevBounds[2], * ptr, * ptr_next;
|
||||
vtxthunk bufThunks[32], * bufSags[16], * bufBottoms[16];
|
||||
int i, nThunks, nBottoms = 0, nSags = 0, iBottom = 0, nConts = 0, j, isag, nThunks0, nTris = 0, nPrevSags, nTrisCnt, iter, nDegenTris = 0;
|
||||
float ymax, ymin, e, area0 = 0, area1 = 0, cntarea, minCntArea;
|
||||
|
||||
@@ -281,46 +281,49 @@ void CObjManager::PreloadLevelObjects()
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
|
||||
// Request objects loading from Streaming System.
|
||||
if (const char* pCgfName = pResList->GetFirst())
|
||||
if (pResList)
|
||||
{
|
||||
while (pCgfName)
|
||||
if (const char* pCgfName = pResList->GetFirst())
|
||||
{
|
||||
if (strstr(pCgfName, ".cgf"))
|
||||
while (pCgfName)
|
||||
{
|
||||
const char* sLodName = strstr(pCgfName, "_lod");
|
||||
if (sLodName && (sLodName[4] >= '0' && sLodName[4] <= '9'))
|
||||
if (strstr(pCgfName, ".cgf"))
|
||||
{
|
||||
// Ignore Lod files.
|
||||
pCgfName = pResList->GetNext();
|
||||
continue;
|
||||
}
|
||||
|
||||
cgfFilename = pCgfName;
|
||||
|
||||
if (bVerboseLogging)
|
||||
{
|
||||
CryLog("%s", cgfFilename.c_str());
|
||||
}
|
||||
IStatObj* pStatObj = GetObjManager()->LoadStatObjUnsafeManualRef(cgfFilename.c_str(), NULL, 0, true, 0);
|
||||
if (pStatObj)
|
||||
{
|
||||
if (pStatObj->IsMeshStrippedCGF())
|
||||
const char* sLodName = strstr(pCgfName, "_lod");
|
||||
if (sLodName && (sLodName[4] >= '0' && sLodName[4] <= '9'))
|
||||
{
|
||||
nInLevelCacheCount++;
|
||||
// Ignore Lod files.
|
||||
pCgfName = pResList->GetNext();
|
||||
continue;
|
||||
}
|
||||
|
||||
cgfFilename = pCgfName;
|
||||
|
||||
if (bVerboseLogging)
|
||||
{
|
||||
CryLog("%s", cgfFilename.c_str());
|
||||
}
|
||||
IStatObj* pStatObj = GetObjManager()->LoadStatObjUnsafeManualRef(cgfFilename.c_str(), NULL, 0, true, 0);
|
||||
if (pStatObj)
|
||||
{
|
||||
if (pStatObj->IsMeshStrippedCGF())
|
||||
{
|
||||
nInLevelCacheCount++;
|
||||
}
|
||||
}
|
||||
// cgfStreamer.StartStreaming(cgfFilename.c_str());
|
||||
nCgfCounter++;
|
||||
|
||||
// This loop can take a few seconds, so we should refresh the loading screen and call the loading tick functions to
|
||||
// ensure that no big gaps in coverage occur.
|
||||
SYNCHRONOUS_LOADING_TICK();
|
||||
}
|
||||
//cgfStreamer.StartStreaming(cgfFilename.c_str());
|
||||
nCgfCounter++;
|
||||
|
||||
//This loop can take a few seconds, so we should refresh the loading screen and call the loading tick functions to ensure that no big gaps in coverage occur.
|
||||
SYNCHRONOUS_LOADING_TICK();
|
||||
pCgfName = pResList->GetNext();
|
||||
}
|
||||
|
||||
pCgfName = pResList->GetNext();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// PrintMessage("Finished requesting level CGF's: %d objects in %.1f sec", nCgfCounter, GetCurAsyncTimeSec()-fStartTime);
|
||||
|
||||
// Continue updating streaming system until all CGF's are loaded
|
||||
|
||||
Reference in New Issue
Block a user