Page 1 of 1

How does CC render mesh(or point cloud) from a ccHObject?

Posted: Tue Feb 18, 2025 8:20 am
by Bonestan1
Hi Daniel, thanks for great open source software like CC!

I was looking into how CC loads and renders a mesh or point cloud. So I started tracing the call stack from loading to rendering, this started off relatively smoothly until I traced it to the draw3D method in ccGLWindow class, which seems to be the key to displaying the entity.

Code: Select all

void ccGLWindow::draw3D(CC_DRAW_CONTEXT& CONTEXT, RenderingParams& renderingParams)
{
	...
	//we draw 3D entities
	if (m_globalDBRoot)
	{
		m_globalDBRoot->draw(CONTEXT);
	}

	if (m_winDBRoot)
	{
		m_winDBRoot->draw(CONTEXT);
	}
	...
}
So I think ccHObject->draw(...) method is the part that draws the entity, but when I try to draw it in the draw(...) method, I tried to add breakpoints inside the draw(...) method, add all kinds of print statements and even remove the function body of draw, but it didn't affect the display, which makes me very puzzled, it's the other functions that really control the drawing of the entity, I sincerely hope to get your help.

Could you direct me to the call stack for CC entity rendering?

Thank in advance!!!

Re: How does CC render mesh(or point cloud) from a ccHObject?

Posted: Tue Feb 18, 2025 10:33 am
by daniel
Look for the drawMeOnly() method in ccMesh. The draw() method is generic and recursively calls itself on the child entites, calling 'drawMeOnly()' on each entity each time.