Jump to content

  • Log In with Google      Sign In   
  • Create Account

Awesome job so far everyone! Please give us your feedback on how our article efforts are going. We still need more finished articles for our May contest theme: Remake the Classics

Alundra

Member Since 19 Jul 2011
Offline Last Active Yesterday, 07:13 PM
-----

#5062445 [c++] non-recursive way to iterate tree

Posted by Alundra on 16 May 2013 - 08:04 PM

Hi all,

Imagine a scene manager who has a root node with children, so it's a tree.

One way is to iterate the tree using recursivity, but perf is not the best.

An alternative is to use a similare code to a showed code in the wxWidgets documentation :

wxTreeItemId FindItemNamed(wxTreeCtrl &tree, const std::wstring &name)
{
	std::stack<wxTreeItemId> items;
	if (tree->GetRootItem().IsOk())
		items.push(tree->GetRootItem());
 
	while (!items.empty())
	{
		wxTreeItemId next = items.top();
		items.pop();
 
		if (next != tree->GetRootItem() && tree->GetItemText(next) == name)
			return next;
 
		wxTreeItemIdValue cookie;
		wxTreeItemId nextChild = tree->GetFirstChild(next, cookie);
		while (nextChild.IsOk())
		{
			items.push(nextChild);
			nextChild = tree->GetNextSibling(nextChild);
		}
	}
 
	return wxTreeItemId();
} 

 

Is this method a good way to handle a tree ?

Thanks




#5059333 [Renderer] Public buffer class

Posted by Alundra on 04 May 2013 - 09:04 PM

Hi,

I saw in a lot of engine and public code that buffer class is a common way of doing.

But, the only public usage of the buffer is for the geometry who is stored in a mesh class generally.

This can be replaced by a class named MeshGeometry who can has template virtual pure function who is inherited.

Using a class MeshGeometry is more high level, more directly in context, it can be extended with DynamicMeshGeometry.

Why this method is not popular ?

 

Thanks




#5057591 Shadowmapping a big scene

Posted by Alundra on 28 April 2013 - 05:44 PM

You can combine two methods if your light doesn't rotate. You can generate the lightmap for static scene and use the shadow mapping using an ortho projection for dynamic objects. The best is SDSM, Vilem Otte gave the link of the paper, you can found the demo source who is Direct3D11 based. It's important to notice that SDSM needs compute shader, without compute shader you will need to read back a lot and you will lost performance.




#5048456 SDL - waste of time?

Posted by Alundra on 30 March 2013 - 08:08 PM

You can use SDL for the unix version to handle window and input.

Quake4, Unreal Tournament, Unreal Tournament 2003, Unreal Tournament 2004, and many other do that.

You can change the window/input code after, SDL is here to make you winning time.




#5045462 pimpl for renderer class

Posted by Alundra on 21 March 2013 - 07:52 PM

What do you think about the method to have 2 folders and to include the good one in the project ?

It's to have the same class name, same function name, no one virtual and just some specific function to get platform data.




#5037984 global function or static function ?

Posted by Alundra on 01 March 2013 - 06:42 AM

You can have a look at Doom3 BFG math source code who use a class to store static function :

https://github.com/id-Software/DOOM-3-BFG/blob/master/neo/idlib/math/Math.h

line 315




#4906066 [DX9] Getting size of the window

Posted by Alundra on 25 January 2012 - 04:46 AM

Get the size from the current back buffer :

IDirect3DSurface9* pSurface;
pD3D9Device->GetBackBuffer( 0, 0, D3DBACKBUFFER_TYPE_MONO, &pSurface );
D3DSURFACE_DESC SurfaceDesc;
pSurface->GetDesc( &SurfaceDesc );
UINT Width = SurfaceDesc.Width;
UINT Height = Surface.Height;
SAFE_RELEASE( pSurface );



#4905184 EasySky - good sky system for indie developers

Posted by Alundra on 22 January 2012 - 02:10 PM

Personally I don't think dynamic sky like that is good for a game because the most of time a game needs to be fixed for the story.
By the way, you have done a good work here.
I think dynamic sky like that is good for a game like Warcraft3 or similar.
It's funny, when I have launch your video, the scroll of the sky remembered me Quake3.


PARTNERS