Page 1 of 2

help,How to use C# code to get data from a graph

Posted: Wed Mar 13, 2019 7:29 am
by myt888
How to use C# code to get data from a graph
Triangle count
Vertex count
Material count
Image

Re: help,How to use C# code to get data from a graph

Posted: Wed Mar 13, 2019 11:08 am
by Cry-Flare
Hi there,

These details are not exposed to the C# interface and are not accessible.
You would need to use C++ to interact with the deeper internals of CRYENGINE.

Re: help,How to use C# code to get data from a graph

Posted: Thu Mar 14, 2019 1:45 am
by myt888
What should I do if I use C++?

Can you give me a simple example?

Please help me. I really need it.

Re: help,How to use C# code to get data from a graph

Posted: Fri Mar 15, 2019 11:30 am
by Cry-Flare
You can get the detail from the CStatObj structures. Other details from the CRenderMesh structure. Something like;

Code: Select all

if (IEntity* pEntity = gEnv->pEntitySystem->FindEntityByName("stat_check"))
{
if (IStatObj* pStatObj = pEntity->GetStatObj(0))
{
IStatObj::SStatistics stats;
pStatObj->GetStatistics(stats);
IRenderAuxText::Draw2dLabel(25,25, 3, ColorF(0,255,0), false, "Entity Id:: %d", pEntity->GetId());
IRenderAuxText::Draw2dLabel(25,50, 3, ColorF(0,255,0), false, "Vertices: %d", stats.nVertices);
IRenderAuxText::Draw2dLabel(25,75, 3, ColorF(0,255,0), false, "Indices: %d", stats.nIndices);

if (IRenderMesh* pRenderMesh = pStatObj->GetRenderMesh())
{
int nTotalTriCount = 0;
for (CRenderChunk& chunk : pRenderMesh->GetChunks())
{
if (chunk.m_nMatFlags & MTL_FLAG_NODRAW || !chunk.pRE)
continue;
if (chunk.nNumIndices > 0)
nTotalTriCount += chunk.nNumIndices / 3;
}

IRenderAuxText::Draw2dLabel(25,100, 3, ColorF(0,255,0), false, "Loaded Tris: %d", pRenderMesh->GetIndicesCount() / 3);
IRenderAuxText::Draw2dLabel(25,125,3, ColorF(0,255,0), false, "Total Tris: %d", nTotalTriCount);
}

IRenderAuxText::Draw2dLabel(25,150, 3, ColorF(0,255,0), false, "Mesh memory usage: %d", stats.nMeshSizeLoaded);
}
}

Re: help,How to use C# code to get data from a graph

Posted: Mon Mar 18, 2019 7:08 am
by myt888
Thank you so much for your great help. I've been able to get these data. I'm really happy.
Image

I am sorry for not seeing the picture.
My question is: I can now get a .cgf performance data (as shown in the previous image), my definition is
Char * fileName = "D:\\C++\\Assets\\objects\\sphere.cgf";
IStatObj* pStatObj = gEnv->p3DEngine->LoadStatObj(fileName);
Can only get a fixed "sphere.cgf"
I want to get all * .cgf in the folder of objects at one time. What should I do?

Re: help,How to use C# code to get data from a graph

Posted: Fri Mar 22, 2019 5:45 am
by riyasathe
This topic was helpful for me as I was searching the answer for the same question. Thanks a lot for this informative thread!

Re: help,How to use C# code to get data from a graph

Posted: Fri Mar 22, 2019 1:36 pm
by Cry-Flare
We cannot see the image you posted. I am unsure of the question you are asking, can you elaborate with an example?

Re: help,How to use C# code to get data from a graph

Posted: Tue Mar 26, 2019 1:28 am
by myt888
I am sorry for not seeing the picture.
My question is: I can now get a .cgf performance data (as shown in the previous image), my definition is
Char * fileName = "D:\\C++\\Assets\\objects\\sphere.cgf";
IStatObj* pStatObj = gEnv->p3DEngine->LoadStatObj(fileName);
Can only get a fixed "sphere.cgf"
I want to get all * .cgf in the folder of objects at one time. What should I do?

Re: help,How to use C# code to get data from a graph

Posted: Wed Mar 27, 2019 3:17 pm
by Cry-Flare
You will need to open and load the CGF to get information about it in CRYENGINE.
You can do this using the CryPak interface.

Re: help,How to use C# code to get data from a graph

Posted: Tue Apr 02, 2019 6:25 am
by myt888
Thank you for your reply. I really need code to implement it.

Read all * CGF under the folder one by one, which makes it more efficient

Can you help me?