Jump to content

  • Log In with Google      Sign In   
  • Create Account


dlan

Member Since 06 Oct 2013
Offline Last Active Yesterday, 05:06 AM

#5155104 Ogre3D Animation Help

Posted by dlan on 21 May 2014 - 12:10 PM

How do you export your model to Ogre3D format? The exporter usually create a mesh and skeleton file where you have all you animation separated. For me you got a problem with how you export your model.

 

In my case, the modeling software I used export the mesh / skeleton and animation definition in xml form that I later convert into Ogre mesh format with the Ogrexmlconverter tool.

 

I never tried to clone animations at runtime, but I suppose you can use getNodeTrackIterator() to get all the track for an animation (a track is associated to a bone, which is derived from a node), then iterate on each keyframes of a track to get it content (with getNodeKeyFrame of the nodetrack object) and use the getTime() function of the KeyFrame to filter out unneeded frames. After that, you will need to use CreateNodeTrack and CreateNodeKeyFrame on your node track to create your frames on your new animation.

 

 

Here's a sample of an animation xml file that can be converted to Ogre format, to give you an idea of the hierarchy used by Ogre:







<animations>
	<animation name="Idle" length="3.33333" >
	<tracks>
	<track bone="LeftHand" >
		<keyframes>
			<keyframe time="0" >
				<translate x="0" y="0" z="0" />
				<rotate angle="0" >
					<axis x="0" y="0" z="-1" />
				</rotate>
				<scale x="1" y="1" z="1" />
			</keyframe>
			<keyframe time="0.673401" >
				<translate x="0" y="0" z="0" />
				<rotate angle="0" >
					<axis x="0" y="0" z="-1" />
				</rotate>
				<scale x="1" y="1" z="1" />
			</keyframe>
			
		</keyframes>
	</track>
	<track bone="RightHand" >
		<keyframes>
			<keyframe time="0" >
				<translate x="0" y="0" z="0" />
				<rotate angle="0.0872659" >
					<axis x="0" y="0" z="1" />
				</rotate>
				<scale x="1" y="1" z="1" />
			</keyframe>
			<keyframe time="0.673401" >
				<translate x="0" y="0" z="0" />
				<rotate angle="0.0872659" >
					<axis x="0" y="0" z="1" />
				</rotate>
				<scale x="1" y="1" z="1" />
			</keyframe>
			
		</keyframes>
	</track>
	<tracks>
	</animation>
</animations>



#5145763 how to go to be considered when making save/load functionality?

Posted by dlan on 09 April 2014 - 02:40 PM

Protobufis a library to consider when dealing with serialization / creation of custom file type, I personally use it for storing levels data. You just create a proto file with your class structure like this:



message InventorySlot
{
  required int32 itemId = 1;
  required int32 itemcount = 2;
}

message CharacterData {
     required string name = 1;
     required int32 health = 2;
     repeated InventorySlot inventory = 3;
}

then you use the generator to create your c++ classes (or other language, there is a lot of decent third party protobuf library / generator available : http://code.google.com/p/protobuf/wiki/ThirdPartyAddOns ), and you can use the built-in SerializeToOstream function to save your objects content into a binary file. 

 

Another library I used for save file in one of my RPG project is SQLite, which is a file based database library. No need to have a server or anything, just include the library in your project, and you can open a database file and use SQL command like it's a normal database. It's geared toward speed and small memory footprint.  you need to know a little about SQL, but the advantage is that you can patch your save file really easily. I also played around with integrating an economy system, built-in sql function make it easy to do so.




#5143434 Linux development...

Posted by dlan on 31 March 2014 - 04:55 AM

Coming from the Windows world, I found Netbeans to be quite user friendly, and it have a lot of similarities with visual studio. Even if It's a Java IDE at first, the c/c++ support is really good, I didn't have any trouble making the debugger work either.

 

Netbeans also has a pretty powerful plugin system, so you can easily add feature later on. Here's an exemple on configuring SFML under linux, work pretty much the same way for other libraries : http://trevoke.net/blog/2009/03/08/howto-sfml-with-netbeans/




#5112282 PIX Crash

Posted by dlan on 26 November 2013 - 05:51 PM

Perhaps I'm a little late, but do you have the KB2670838 (this is a platform update) installed on your computer? I got the same problem when I tried to debug a DX11 build on win7 with PIX. After uninstalling this update, I have been able to make it work.




#5104078 [LUA][C++] getting parameters from a function

Posted by dlan on 24 October 2013 - 06:10 AM

if(i==0) name=lua_tostring(l, lua_gettop(l));

 

Since lua_gettop give you the depth of the stack, even if i=0 in your case, lua_tostring will get the second argument pushed on the stack. after doing lua_pop, it will change the stack, hence give you the first argument.

 

you can get rid of your for loop and simply do:

 

n = lua_tointeger(l,1)
name = lua_tostring(l,2)
 

 

lua_pop is unecessary, lua will take care of the stack in your case, it's only if you happen to push an additional value in your stack within your c++ function that you need to pop the value yourself.

 




#5101644 Advice on creating a dll from C++ project and use it in C# winForms project

Posted by dlan on 15 October 2013 - 03:21 PM

I have made something similar for my game editor, here how it goes : 

 

I created a custom panel class derived from the existing panel control, that allow me to override function like the OnPaint function. I pass the panel handle to a native function in my C DLL that do all the opengl setup stuff.

 

In my panel OnPaint function, I add a call to my native render function, which draw one frame each time it's called. Now, a simple call to myPanel.Invalidate() will automatically re-render the game scene on the panel.

 

If I need to have a steady 60fps directly in editor,  I call myPanel.Invalidate() in  the Application_Idle event of the mainform. I manage the 60fps limit directly into the native render function.

 

About the wrapping, in the C# side, I declare each native functions like this : 

[DllImport(enginePath, CallingConvention = CallingConvention.Cdecl)]
public static extern void editor_draw_frame();

 

don't forget to export properly your functions in your C++ DLL, otherwise .NET won't find them. (a mistake I made at first smile.png )




#5101321 Implementing Audio into my game engine, what should I use?

Posted by dlan on 14 October 2013 - 10:31 AM

Since cross platform seem to be one of your concern, If FMOD doesn't suit you, I recommend you to look at portaudio  and libsndfile. Portaudio is essentially a wrapper around existing sound library like direct sound on windows and ALSA on linux.

 

libsndfile allow you to load fairly easily audio file, and read their content without thinking too much about the underlying file format, and it's obviously quite easy to use along portaudio. These libraries are open source and free to use, so you can easily modify it for your need.




#5099748 OpenGL Windows Question

Posted by dlan on 08 October 2013 - 06:06 PM

GLFW is your best bet here, it's really an active project, and they just released the version 3, which add nice features like multi monitor support and physical key input. an alternative is freeglut, it only come as source release, but you can found window binary for it pretty easily. keep in mind that GLFW abstract mainly windows creation and input management, for rendering, you just have to use regular opengl calls that work the same way across platform. You will have use for glew only if you use function that aren't available on microsoft opengl implementation, like vertex buffer generation.

 

Also, for debugging, you could look into gDebugger : http://www.gremedy.com/ , it come with everything you need to debug graphic code (buffer visualization, breakpoint on specific opengl call, etc.)

 

 

I personally use GLFW/GLEW under windows and linux and I haven't any trouble setting it up under vs2010, the api is quite straightforward.  Just keep in mind that it still a library bound to pc, so if you aim to tinker with mobile devices/opengl es, you could look into alternative like regal, which aim to be a full cross platform library : https://github.com/p3/regal it's still in early development, but have a lot of potential.

 

Another advice, if you just start with opengl, it's probably better to avoid any old tutorial using fixed function pipeline (like the one using  deprecated glbegin glend function)




PARTNERS