Commit 3e399ff4 authored by D-AIRY's avatar D-AIRY

Refractivity; some optimizations

parent 2806c391
/*
mtrltp_refract.ps
Рендер прозрачной геометрии с рефракцией
*/
#include "../struct.h"
#include "../mtrl.h"
//##########################################################################
SamplerState g_sScene: register(s0);
SamplerState g_sSceneRefract: register(s1);
Texture2D g_txColor: register(t0); // basetexture
Texture2D g_txDuDv: register(t2); // detail_r
Texture2D g_txParameters: register(t10); //
Texture2D g_txSceneColor: register(t11); //
Texture2D g_txSceneDepth: register(t12); //
//##########################################################################
// half4 g_vNearFarLayers;
#include "../const.h"
cbuffer CDataClipPlanes: register(b6)
{
float4 g_vClipPlanes[4];
};
//##########################################################################
float4 main(VSO_SceneCommon IN):COLOR0
{
// ClipFar(IN.vPos.z, g_vNearFarLayers.y);
// IN.vNormal = normalize(IN.vNormal);
float3 vPos = IN.vPos.xyz / IN.vPos.w;
[unroll]for(uint i = 0; i < 4; ++i)
{
float4 vPlane = g_vClipPlanes[i];
clip(dot(vPlane.xyz, vPos) + vPlane.w);
}
float2 vDuDv = g_txDuDv.Sample(g_sScene, IN.vTexUV).xy;
float2 vSceneUV = (vPos.xy * float2(1.0, -1.0) + float2(0.5 / 1024.0, 0.5 / 768.0)) * 0.5 + 0.5;
float2 vSceneUVrefract = vSceneUV + (vDuDv - 0.5) * 0.3; // 0.035
float3 vSceneColor;
if(g_txSceneDepth.Sample(g_sSceneRefract, vSceneUVrefract).x < ComDepthByPos(IN.vPos, g_vNearFarLayers.xy))
{
vSceneColor = g_txSceneColor.Sample(g_sSceneRefract, vSceneUV).xyz;
// clip(-1);
}
else
{
// clip(-1);
vSceneColor = g_txSceneColor.Sample(g_sSceneRefract, vSceneUVrefract).xyz;
// return(float4(ComDepthByPos(IN.vPos, g_vNearFarLayers.xy), 0, 0, 1));
// return(float4(g_txSceneDepth.Sample(g_sSceneRefract, vSceneUVrefract).x, 0, 0, 1));
}
// float3 vSceneColor = g_txSceneColor.Sample(g_sSceneRefract, vSceneUVrefract).xyz;
float4 vColor = g_txColor.Sample(g_sScene, IN.vTexUV);
// return(float4(float3(), 1.0));
return(float4(float3(vSceneColor * (1.0 - vColor.w) + vColor.xyz * vColor.w), 1.0));
/* return(CreateGbuffer(
float4(g_txColor.Sample(g_sScene, IN.vTexUV).xyz, 0.0f),
IN.vNormal,
g_txParameters.Sample(g_sScene, IN.vTexUV),
IN.vPos,
g_vNearFarLayers
)); */
}
......@@ -45,7 +45,7 @@ PSO_Gbuffer main(VSO_SkyBox IN)
vColor,
-normalize(IN.vTexUV),
(float4)0,
(float4)0,
float4(0, 0, g_vNearFarLayers.y - g_vNearFarLayers.x, 1.0),
g_vNearFarLayers
));
}
......@@ -324,6 +324,7 @@ EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{846B2EA2-15BC-40C4-B273-47A1D40E8BE9}"
ProjectSection(SolutionItems) = preProject
dependencies.dgml = dependencies.dgml
Performance2.psess = Performance2.psess
EndProjectSection
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "freetype", "..\..\..\sdks\freetype-2.10.0\builds\windows\vc2010\freetype.vcxproj", "{F0BA654B-EFF1-4F48-8ED5-4B1AA6888687}"
......@@ -720,4 +721,7 @@ Global
{74D74409-BAC7-4DD0-8C74-117516B4A01C} = {13D5622C-8643-4BD8-A730-B5C919DAFDDC}
{6FE14C5C-6052-4D96-A89F-0843D91F89AD} = {E6B16854-D4A4-4B56-8E1C-482DD523F205}
EndGlobalSection
GlobalSection(Performance) = preSolution
HasPerformanceSessions = true
EndGlobalSection
EndGlobal
......@@ -112,6 +112,7 @@
<GenerateDebugInformation>true</GenerateDebugInformation>
<ImportLibrary>../../../libs/$(TargetName).lib</ImportLibrary>
<ProgramDatabaseFile>$(ProjectDir)$(TargetName).pdb</ProgramDatabaseFile>
<Profile>true</Profile>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
......@@ -128,6 +129,7 @@
<GenerateDebugInformation>true</GenerateDebugInformation>
<ImportLibrary>../../../libs64/$(TargetName).lib</ImportLibrary>
<ProgramDatabaseFile>$(ProjectDir)$(TargetName).pdb</ProgramDatabaseFile>
<Profile>true</Profile>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
......
......@@ -110,6 +110,7 @@
<GenerateDebugInformation>true</GenerateDebugInformation>
<ProgramDatabaseFile>$(ProjectDir)$(TargetName).pdb</ProgramDatabaseFile>
<ImportLibrary>../../../libs/$(TargetName).lib</ImportLibrary>
<Profile>true</Profile>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
......@@ -126,6 +127,7 @@
<GenerateDebugInformation>true</GenerateDebugInformation>
<ProgramDatabaseFile>$(ProjectDir)$(TargetName).pdb</ProgramDatabaseFile>
<ImportLibrary>../../../libs64/$(TargetName).lib</ImportLibrary>
<Profile>true</Profile>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
......
Subproject commit f59fc8a2d290bda9a6881d653fa9bfe67a5c98a0
Subproject commit f1a3bc115a4137b6fd29e9a12450a8c08a97bc22
......@@ -228,3 +228,8 @@ bool CDynamicModel::hasTransparentSubsets(UINT uLod) const
{
return(m_pShared->hasTransparentSubsets(m_uSkin, uLod));
}
IXMaterial* CDynamicModel::getTransparentMaterial(UINT uLod)
{
return(m_pShared->getTransparentMaterial(m_uSkin, uLod));
}
......@@ -48,6 +48,7 @@ public:
UINT getPSPcount(UINT uLod) const;
SMPLANE getPSP(UINT uLod, UINT uPlane) const;
bool hasTransparentSubsets(UINT uLod) const;
IXMaterial* getTransparentMaterial(UINT uLod);
protected:
CDynamicModelProvider *m_pProvider;
CDynamicModelShared *m_pShared;
......
......@@ -162,19 +162,20 @@ void CDynamicModelProvider::computeVisibility(const IFrustum *pFrustum, CRendera
if(pItem->isVisible)
{
pItem->isTransparent = pMdl->hasTransparentSubsets(pItem->uLod);
IXMaterial *pMaterial = pMdl->getTransparentMaterial(pItem->uLod);
if(pItem->isTransparent)
{
UINT uPSPcount = pMdl->getPSPcount(pItem->uLod);
if(uPSPcount)
{
pVisibility->addItemTransparentDynamic({pMdl, true, pMdl->getPSP(pItem->uLod, 0)});
pVisibility->addItemTransparentDynamic({pMdl, true, pMdl->getPSP(pItem->uLod, 0), 0, pMaterial});
}
else
{
pVisibility->addItemTransparentDynamic({pMdl, false});
pVisibility->addItemTransparentDynamic({pMdl, false, SMPLANE(), 0, pMaterial});
}
}
mem_release(pMaterial);
}
}
else
......@@ -274,7 +275,7 @@ void CDynamicModelProvider::getTransparentObject(CRenderableVisibility *pVisibil
{
pObject->psp = pMdl->psp;
}
pObject->pMaterial = pMdl->pMaterial;
//! @fixme use transparent local bound
pObject->vMin = pMdl->pReferenceMdl->getLocalBoundMin() + pMdl->pReferenceMdl->getPosition();
pObject->vMax = pMdl->pReferenceMdl->getLocalBoundMax() + pMdl->pReferenceMdl->getPosition();
......
......@@ -391,12 +391,39 @@ bool CDynamicModelShared::hasTransparentSubsets(UINT uSkin, UINT uLod)
{
return(false);
}
//! @todo add uLod support
return(m_isTransparent[uSkin]);
}
IXMaterial* CDynamicModelShared::getTransparentMaterial(UINT uSkin, UINT uLod)
{
assert(uSkin < m_uSkinCount);
if(uSkin >= m_uSkinCount)
{
return(NULL);
}
assert(uLod < m_aLods.size());
if(uLod >= m_aLods.size())
{
return(NULL);
}
for(UINT j = 0, jl = m_pResource->getSubsetCount(uLod); j < jl; ++j)
{
auto pSubset = m_pResource->getSubset(uLod, j);
IXMaterial *pMaterial = m_pppMaterials[uSkin][pSubset->iMaterialID];
if(pMaterial && pMaterial->isTransparent())
{
pMaterial->AddRef();
return(pMaterial);
}
}
return(NULL);
}
float3 CDynamicModelShared::getTransparentBoundMin(UINT uSkin, UINT uLod) const
{
//! @todo Implement me!
......
......@@ -31,6 +31,7 @@ public:
void initGPUresources();
bool hasTransparentSubsets(UINT uSkin, UINT uLod);
IXMaterial* getTransparentMaterial(UINT uSkin, UINT uLod);
void onMaterialTransparencyChanged(const IXMaterial *pMaterial);
float3 getTransparentBoundMin(UINT uSkin, UINT uLod) const;
......
......@@ -32,6 +32,7 @@ public:
bool hasPSP;
SMPLANE psp;
UINT uLod;
IXMaterial *pMaterial;
};
void setItemCount(UINT uCount);
......
Subproject commit 1ba4ead2f56437f757e6dee41f72c22fd836709a
Subproject commit c7a4f320b908e62e123169293eaae63ef5e23f81
......@@ -141,6 +141,8 @@ void CBaseAnimating::setModel(const char * mdl)
m_pModel = pModel;
m_pModel->setSkin(m_iSkin);
m_pModel->setScale(m_fBaseScale);
m_pModel->setPosition(getPos());
m_pModel->setOrientation(getOrient());
auto pAnimating = m_pModel->asAnimatedModel();
if(pAnimating)
......
......@@ -52,10 +52,10 @@ public:
virtual ~CBaseEntity();
//! Возвращает имя движкового класса объекта
const char * getClassName();
const char* getClassName();
//! Возвращает имя объекта
const char * getName();
const char* getName();
//! Возвращает баунд объекта
virtual void getMinMax(float3 * min, float3 * max);
......@@ -90,22 +90,22 @@ public:
SMQuaternion getOrient();
//! Устанавливает свойство объекта
virtual bool setKV(const char * name, const char * value);
virtual bool setKV(const char *name, const char *value);
//! Получает свойство объекта
virtual bool getKV(const char * name, char * out, int bufsize);
virtual bool getKV(const char *name, char *out, int bufsize);
//! Устанавливает родительский объект для объекта
void setParent(CBaseEntity * pEnt, int attachment = -1);
void setParent(CBaseEntity *pEnt, int attachment = -1);
//! Возвращает родительский объект объекта
CBaseEntity * getParent();
CBaseEntity* getParent();
//! Устанавливает владельца
void setOwner(CBaseEntity * pEnt);
void setOwner(CBaseEntity *pEnt);
//! Возвращает владельца объекта
CBaseEntity * getOwner();
CBaseEntity* getOwner();
//! Получает объект менеджера
CEntityManager * getManager();
CEntityManager* getManager();
//void updateDiscreteLinearVelocity(int step, float dt);
//const float3_t & getDiscreteLinearVelocity() const;
......
......@@ -14,7 +14,7 @@ CEntityFactoryMap::CEntityFactoryMap():
}
void CEntityFactoryMap::addFactory(IEntityFactory * pFactory, const char * szName)
void CEntityFactoryMap::addFactory(IEntityFactory *pFactory, const char *szName)
{
if(!pFactory->isEditorHidden())
{
......@@ -22,21 +22,21 @@ void CEntityFactoryMap::addFactory(IEntityFactory * pFactory, const char * szNam
}
m_mFactories[AAString(szName)] = pFactory;
}
CBaseEntity * CEntityFactoryMap::create(const char * szName, CEntityManager * pWorld, bool bDelayPostLoad)
CBaseEntity* CEntityFactoryMap::create(const char *szName, CEntityManager *pWorld, bool bDelayPostLoad)
{
IEntityFactory * pFactory = getFactory(szName);
IEntityFactory *pFactory = getFactory(szName);
if(pFactory)
{
EntDefaultsMap * defs = pFactory->getDefaults();
CBaseEntity * pEnt = pFactory->create(pWorld);
EntDefaultsMap *defs = pFactory->getDefaults();
CBaseEntity *pEnt = pFactory->create(pWorld);
pEnt->setDefaults();
pEnt->setClassName(pFactory->getClassName());
if(defs->Size() > 0)
{
proptable_t * pt = pFactory->getPropTable();
const char * key;
const EntDefaultsMap::Node * pNode;
proptable_t *pt = pFactory->getPropTable();
const char *key;
const EntDefaultsMap::Node *pNode;
while(pt)
{
for(int i = 0, l = pt->numFields; i < l; ++i)
......@@ -59,17 +59,27 @@ CBaseEntity * CEntityFactoryMap::create(const char * szName, CEntityManager * pW
{
pEnt->_initEditorBoxes();
}
if(pFactory->isSyncable())
{
pWorld->regSync(pEnt);
}
return(pEnt);
}
return(NULL);
}
void CEntityFactoryMap::destroy(CBaseEntity * pEnt)
void CEntityFactoryMap::destroy(CBaseEntity *pEnt)
{
if(pEnt)
{
IEntityFactory * pFactory = getFactory(pEnt->getClassName());
IEntityFactory *pFactory = getFactory(pEnt->getClassName());
if(pFactory)
{
if(pFactory->isSyncable())
{
pEnt->m_pMgr->unregSync(pEnt);
}
return(pFactory->destroy(pEnt));
}
}
......
......@@ -22,13 +22,14 @@ class CEntityManager;
class IEntityFactory
{
public:
virtual CBaseEntity * create(CEntityManager * pWorld) = 0;
virtual CBaseEntity* create(CEntityManager * pWorld) = 0;
virtual void destroy(CBaseEntity * pEnt) = 0;
virtual const char * getClassName() = 0;
virtual proptable_t * getPropTable() = 0;
virtual const char* getClassName() = 0;
virtual proptable_t* getPropTable() = 0;
virtual bool isEditorHidden() = 0;
virtual EntDefaultsMap * getDefaults() = 0;
virtual IEntityFactory * copy(const char * szName, bool showInListing) = 0;
virtual EntDefaultsMap* getDefaults() = 0;
virtual IEntityFactory* copy(const char * szName, bool showInListing) = 0;
virtual bool isSyncable() = 0;
};
class CEntityFactoryMap
......@@ -37,21 +38,21 @@ class CEntityFactoryMap
public:
CEntityFactoryMap();
void addFactory(IEntityFactory * pFactory, const char * szName);
CBaseEntity * create(const char * szName, CEntityManager * pMgr, bool bDelayPostLoad=false);
void destroy(CBaseEntity * pEnt);
void addFactory(IEntityFactory *pFactory, const char *szName);
CBaseEntity* create(const char *szName, CEntityManager *pMgr, bool bDelayPostLoad=false);
void destroy(CBaseEntity *pEnt);
static CEntityFactoryMap * GetInstance();
proptable_t * getPropTable(const char * szClass);
bool isEditorHidden(const char * szClass);
EntDefaultsMap * getDefaults(const char * szClass);
static CEntityFactoryMap* GetInstance();
proptable_t* getPropTable(const char *szClass);
bool isEditorHidden(const char *szClass);
EntDefaultsMap* getDefaults(const char *szClass);
int getListCount();
void getListing(const char ** pszOut, int size);
void getListing(const char **pszOut, int size);
const char *getClassNamePtr(const char *szClassName);
const char* getClassNamePtr(const char *szClassName);
private:
IEntityFactory * getFactory(const char * szName);
IEntityFactory* getFactory(const char *szName);
AssotiativeArray<AAString, IEntityFactory*> m_mFactories;
int m_iShowInListCount;
};
......@@ -60,11 +61,12 @@ template <class T>
class CEntityFactory: public IEntityFactory
{
public:
CEntityFactory(const char * szName, bool showInListing)
CEntityFactory(const char * szName, bool showInListing, bool isSyncable=true)
{
m_bShowInListing = showInListing;
m_szClassName = szName;
m_pPropTable = T::SGetPropTable();
m_isSyncable = isSyncable;
CEntityFactoryMap::GetInstance()->addFactory(this, szName);
}
......@@ -77,7 +79,7 @@ public:
}
}
IEntityFactory * copy(const char * szName, bool showInListing)
IEntityFactory* copy(const char *szName, bool showInListing) override
{
CEntityFactory<T> * newF = new CEntityFactory<T>(*this);
newF->m_szClassName = szName;
......@@ -86,12 +88,12 @@ public:
return(newF);
}
CBaseEntity * create(CEntityManager * pWorld)
CBaseEntity* create(CEntityManager *pWorld) override
{
return(new T(pWorld));
}
void destroy(CBaseEntity * pEnt)
void destroy(CBaseEntity *pEnt) override
{
if(pEnt)
{
......@@ -99,22 +101,27 @@ public:
}
}
const char * getClassName()
const char* getClassName() override
{
return(m_szClassName);
}
proptable_t * getPropTable()
proptable_t* getPropTable() override
{
return(m_pPropTable);
}
bool isEditorHidden()
bool isEditorHidden() override
{
return(!m_bShowInListing);
}
EntDefaultsMap * getDefaults()
bool isSyncable() override
{
return(m_isSyncable);
}
EntDefaultsMap* getDefaults() override
{
return(&m_mDefaults);
}
......@@ -123,6 +130,7 @@ private:
const char * m_szClassName;
proptable_t * m_pPropTable;
bool m_bShowInListing;
bool m_isSyncable;
EntDefaultsMap m_mDefaults;
Array<CEntityFactory<T>*> m_vDerivatives;
};
......@@ -130,6 +138,9 @@ private:
#define REGISTER_ENTITY(cls, name) \
CEntityFactory<cls> ent_ ## name ## _factory(#name, 1)
#define REGISTER_ENTITY_NOSYNC(cls, name) \
CEntityFactory<cls> ent_ ## name ## _factory(#name, 1, 0)
#define REGISTER_ENTITY_NOLISTING(cls, name) \
CEntityFactory<cls> ent_ ## name ## _factory(#name, 0)
......
......@@ -143,18 +143,18 @@ void CEntityManager::sync()
//static time_point tOld = std::chrono::high_resolution_clock::now();
//float dt;
//dt = (float)std::chrono::duration_cast<std::chrono::microseconds>(std::chrono::high_resolution_clock::now() - tOld).count() / 1000000.0f;
for(int i = 0, l = m_vEntList.size(); i < l; ++i)
for(int i = 0, l = m_vEntSyncList.size(); i < l; ++i)
{
pEnt = m_vEntList[i];
pEnt = m_vEntSyncList[i];
if(pEnt)
{
pEnt->m_bSynced = false;
}
}
for(int i = 0, l = m_vEntList.size(); i < l; ++i)
for(int i = 0, l = m_vEntSyncList.size(); i < l; ++i)
{
pEnt = m_vEntList[i];
pEnt = m_vEntSyncList[i];
if(pEnt && !pEnt->m_bSynced)
{
//pEnt->updateDiscreteLinearVelocity(0, dt);
......@@ -178,7 +178,7 @@ void CEntityManager::unloadObjLevel()
}
}
ID CEntityManager::reg(CBaseEntity * pEnt)
ID CEntityManager::reg(CBaseEntity *pEnt)
{
ID ent;
if(!pEnt)
......@@ -209,7 +209,7 @@ void CEntityManager::unreg(ID ent)
timeout_t * t;
timeout_output_t * to;
CBaseEntity * pEnt = m_vEntList[ent];
CBaseEntity *pEnt = m_vEntList[ent];
for(int i = 0, l = m_vOutputTimeout.size(); i < l; ++i)
{
......@@ -249,7 +249,25 @@ void CEntityManager::unreg(ID ent)
m_vFreeIDs.push_back(ent);
}
ID CEntityManager::setTimeout(void(CBaseEntity::*func)(float dt), CBaseEntity * pEnt, float delay)
void CEntityManager::regSync(CBaseEntity *pEnt)
{
assert(pEnt);
m_vEntSyncList.push_back(pEnt);
}
void CEntityManager::unregSync(CBaseEntity *pEnt)
{
assert(pEnt);
for(UINT i = 0, l = m_vEntSyncList.size(); i < l; ++i)
{
if(m_vEntSyncList[i] == pEnt)
{
m_vEntSyncList.erase(i);
break;
}
}
}
ID CEntityManager::setTimeout(void(CBaseEntity::*func)(float dt), CBaseEntity *pEnt, float delay)
{
timeout_t t;
t.status = TS_WAIT;
......@@ -277,7 +295,7 @@ ID CEntityManager::setTimeout(void(CBaseEntity::*func)(float dt), CBaseEntity *
return(id);
}
ID CEntityManager::setInterval(void(CBaseEntity::*func)(float dt), CBaseEntity * pEnt, float delay)
ID CEntityManager::setInterval(void(CBaseEntity::*func)(float dt), CBaseEntity *pEnt, float delay)
{
timeout_t t;
t.status = TS_WAIT;
......@@ -487,9 +505,9 @@ err:
}
CBaseEntity * CEntityManager::findEntityByName(const char * name, CBaseEntity * pStart)
CBaseEntity* CEntityManager::findEntityByName(const char *szName, CBaseEntity *pStart)
{
if(!name[0])
if(!szName[0])
{
return(NULL);
}
......@@ -504,7 +522,7 @@ CBaseEntity * CEntityManager::findEntityByName(const char * name, CBaseEntity *
}
if(bFound)
{
if(!strcmp(pEnt->getName(), name))
if(!strcmp(pEnt->getName(), szName))
{
return(pEnt);
}
......@@ -520,7 +538,7 @@ CBaseEntity * CEntityManager::findEntityByName(const char * name, CBaseEntity *
return(NULL);
}
int CEntityManager::countEntityByName(const char * name)
int CEntityManager::countEntityByName(const char *name)
{
if(!name[0])
{
......@@ -537,7 +555,7 @@ int CEntityManager::countEntityByName(const char * name)
return(c);
}
CBaseEntity * CEntityManager::findEntityByClass(const char * name, CBaseEntity * pStart)
CBaseEntity* CEntityManager::findEntityByClass(const char *name, CBaseEntity *pStart)
{
bool bFound = !pStart;
CBaseEntity * pEnt;
......@@ -566,7 +584,7 @@ CBaseEntity * CEntityManager::findEntityByClass(const char * name, CBaseEntity *
return(NULL);
}
CBaseEntity * CEntityManager::findEntityInSphere(const float3 &f3Origin, float fRadius, CBaseEntity * pStart)
CBaseEntity* CEntityManager::findEntityInSphere(const float3 &f3Origin, float fRadius, CBaseEntity *pStart)
{
bool bFound = !pStart;
CBaseEntity * pEnt;
......@@ -675,7 +693,7 @@ void CEntityManager::loadDynClasses()
}
}
void CEntityManager::dumpList(int argc, const char ** argv)
void CEntityManager::dumpList(int argc, const char **argv)
{
const char * filter = "";
if(argc > 1)
......@@ -707,7 +725,7 @@ void CEntityManager::dumpList(int argc, const char ** argv)
printf("-----------------------------------------------------\n" COLOR_RESET);
}
void CEntityManager::entKV(int argc, const char ** argv)
void CEntityManager::entKV(int argc, const char **argv)
{
int id = 0;
if(argc == 1)
......@@ -762,7 +780,7 @@ int CEntityManager::getCount()
return(m_vEntList.size());
}
CBaseEntity * CEntityManager::getById(ID id)
CBaseEntity* CEntityManager::getById(ID id)
{
if(id < 0 || (UINT)id >= m_vEntList.size())
{
......@@ -772,7 +790,7 @@ CBaseEntity * CEntityManager::getById(ID id)
return(pEnt ? (pEnt->getFlags() & EF_REMOVED ? NULL : pEnt) : NULL);
}
CBaseEntity * CEntityManager::cloneEntity(CBaseEntity *pOther)
CBaseEntity* CEntityManager::cloneEntity(CBaseEntity *pOther)
{
if(!pOther)
{
......@@ -815,7 +833,7 @@ CBaseEntity * CEntityManager::cloneEntity(CBaseEntity *pOther)
return(pEnt);
}
void CEntityManager::setOutputTimeout(named_output_t * pOutput, inputdata_t * pData)
void CEntityManager::setOutputTimeout(named_output_t *pOutput, inputdata_t *pData)
{
timeout_output_t t;
t.status = TS_WAIT;
......
......@@ -69,6 +69,7 @@ struct timeout_output_t
class CEntityManager
{
friend class CBaseEntity;
friend class CEntityFactoryMap;
public:
CEntityManager();
~CEntityManager();
......@@ -82,29 +83,29 @@ public:
void loadDefaults();
void loadDynClasses();
ID setTimeout(void(CBaseEntity::*func)(float dt), CBaseEntity * pEnt, float delay);
ID setInterval(void(CBaseEntity::*func)(float dt), CBaseEntity * pEnt, float delay);
void setOutputTimeout(named_output_t * pOutput, inputdata_t * pData);
ID setTimeout(void(CBaseEntity::*func)(float dt), CBaseEntity *pEnt, float delay);
ID setInterval(void(CBaseEntity::*func)(float dt), CBaseEntity *pEnt, float delay);
void setOutputTimeout(named_output_t * pOutput, inputdata_t *pData);
void clearTimeout(ID id);
void clearInterval(ID id);
int countEntityByName(const char * name);
CBaseEntity * findEntityByName(const char * name, CBaseEntity * pStart = 0);
int countEntityByName(const char *szName);
CBaseEntity* findEntityByName(const char *szName, CBaseEntity *pStart = 0);
CBaseEntity * findEntityByClass(const char * name, CBaseEntity * pStart = 0);
CBaseEntity* findEntityByClass(const char *szName, CBaseEntity *pStart = 0);
CBaseEntity * findEntityInSphere(const float3 &f3Origin, float fRadius, CBaseEntity * pStart = 0);
CBaseEntity* findEntityInSphere(const float3 &f3Origin, float fRadius, CBaseEntity *pStart = 0);
bool exportList(const char * file);
bool import(const char * file, bool shouldSendProgress = false);
bool exportList(const char *szFile);
bool import(const char *szFile, bool shouldSendProgress = false);
void dumpList(int argc, const char ** argv);
void entKV(int argc, const char ** argv);
void dumpList(int argc, const char **argv);
void entKV(int argc, const char **argv);
int getCount();
CBaseEntity * getById(ID id);