Jump to content

  • Log In with Google      Sign In   
  • Create Account

hannesnisula

Member Since 18 Sep 2008
Offline Last Active Dec 16 2014 04:40 AM

#4804717 Underlying structure of a game

Posted by hannesnisula on 30 April 2011 - 04:43 AM

bump


#4804156 Underlying structure of a game

Posted by hannesnisula on 28 April 2011 - 03:37 PM

Hi I'm trying to figure out how to structure my game. My plan is to have objects that consists of several children that could be separated from the parent, like a human losing an arm etc. But my problem seems to be how to do with the meshes. My meshes can consist of several sub meshes and for a humanoid each part needs to be associated with a sub mesh, because my humanoid models are built as such. So how would be a good idea to go about accomplishing this? Should I split the mesh into several meshes consisting of a sub mesh each and associate the limb objects with this or do I associate each limb with a sub mesh?

If I split the full mesh into several other new meshes consisting of one limb each it feels useless to have a sub mesh class since I'd need to split most multiple-submesh-meshes up into their own individual meshes anyway. I also need to associate some objects with meshes (consisting of an arbitrary number of sub meshes) that are not supposed to be split or anything fancy like that.

I don't know if there are some obvious errors with my suggestions or if there's a good solution but I'd like to hear you guys' thoughts on this.

Thanks in advance!


#4778635 Nothing being rendered and no errors

Posted by hannesnisula on 24 February 2011 - 03:12 PM

I've tried to make sure the matrices and everything is working as intended. I can render a Teapot created with D3DXCreateTeapot() but when I try to render my cube with an IB and a VB nothing is being shown. I also get no errors from any of the functions.

Here's my code for my rendering function:
m_pDevice->Clear(0, 0, D3DCLEAR_ZBUFFER | D3DCLEAR_TARGET, D3DCOLOR_XRGB(0, 255, 0), 1.0f, 0);

	m_pDevice->BeginScene();
	m_pDevice->SetFVF(D3DFVF_XYZ | D3DFVF_NORMAL);

	
	MESubMesh* pSubMesh = pMesh->GetSubMesh(i);

	HRESULT result = m_pDevice->SetIndices(pSubMesh->GetIndexBuffer());


	result = m_pDevice->SetStreamSource(	0,
											pSubMesh->GetVertexBuffer(),
											0,
											pMesh->GetVertexDeclaration().GetSize());
	
	result = m_pDevice->DrawIndexedPrimitive(	D3DPT_TRIANGLELIST,
												0,
												0,
												pSubMesh->GetVertexCount(),
												0,
												pSubMesh->GetIndexCount() / 3);
			
	m_pDevice->EndScene();

	m_pDevice->Present(0, 0, 0, 0);


If I don't call the SetFVF() I get the error saying "Vertex shader declaration not set" which makes me think if the device is trying to render using a vertex shader though I have not set any/compiled any or loaded any.

Anyone have a guess what could be wrong?


#580929 Win32 API Custom Classes

Posted by hannesnisula on 29 August 2010 - 06:58 AM

I'm creating my own classes for windows in Win32 API and I now wonder what approach I should be taking for the message procedures.

I thought I'd have some functions like OnButtonDown() but how would I make this happen? Should the message procedure be hidden from the user of the classes so they should only be concerned about the OnButtonDown() functions? What are some good approaches accomplishing this? Is it a good idea at all?

These classes would be used for my editor and I'm using Object Oriented Programming, if that's any use for anyone.

Feedback would be much appreciated.




PARTNERS