Dagger3d! engine

  • (8 Pages)
  • +
  • « First
  • 6
  • 7
  • 8

116 Replies - 11020 Views - Last Post: 18 April 2011 - 03:20 PM

#106 Tom9729  Icon User is offline

  • Segmentation fault
  • member icon

Reputation: 180
  • View blog
  • Posts: 2,641
  • Joined: 30-December 07

Re: Dagger3d! engine

Posted 30 December 2009 - 07:42 PM

First order of business is that the API documentation for the SVN version of Dagger3D is now online. For a good overview of everything, check out the dagger3d header. A few files are still missing documentation, but expect that to change in the next few days!

Second item is that I got a little carried away playing with the font code. Basically I added inline colours and real tab support. Read about it here, see screenshot below.

Posted Image

Source for example in screenshot.
#include <stdlib.h>
#include <GL/glut.h>
#include <dagger3d.h>

int font;

void keyb()
{
	if (dWindowKeyPressedOnce(D_KEY_ESCAPE))
	{
		exit(0);
	}
}

void display()
{
       	char *msg = NULL, *timeOfDay;

	timeOfDay = dTimeOfDayStr();
	dStringAppend(&msg, "^$Hey, the time is now: %s\n"
		      "Also ^0this is a huge ^3paragraph of "
		      "text to test ^5the word wrap. ^4We are "
		      "also ^0testing ^1different colors.", timeOfDay);
	free(timeOfDay);

	glColor4f(1.0f, 1.0f, 1.0f, 1.0f);
	dFontPrint(font, 100.0f, 400.0f, 30, msg);
	free(msg);
	
	msg = NULL;
	dStringAppend(&msg, "^$^5Here is some more text!\n"
		"And ^0here\t^5 is a tab (ie. 8 spaces).");
	dFontPrint(font, 200.0f, 100.0f, 22, msg);
	free(msg);

	msg = NULL;
	dStringAppend(&msg, 
		      "^$Color codes\n"
		      "^1^^1 ^9red\n"
		      "^2^^2 ^9green\n"
		      "^3^^3 ^9yellow\n"
		      "^4^^4 ^9blue\n"
		      "^5^^5 ^9teal\n"
		      "^6^^6 ^9magenta\n"
		      "^7^^7 ^9black\n"
		      "^8^^8 ^9gray\n"
		      "^9^^9 ^9white\n"
		      "^0^^0 ^9orange\n"
		);
	dFontPrint(font, 500.0f, 200.0f, 22, msg);
	free(msg);
}

int main(int argc, char **argv)
{
	dInit(argc, argv, D_WINDOW);
	dWindowOpen("Font", 640, 480, 60, 0);
	dWindowSetDisplayFunc(display);
	dWindowSetInputFunc(keyb);

	font = dFontLoad("examples/FreeSans.ttf", 12);

	glutMainLoop();

	return 0;
}


Was This Post Helpful? 1
  • +
  • -

#107 Tom9729  Icon User is offline

  • Segmentation fault
  • member icon

Reputation: 180
  • View blog
  • Posts: 2,641
  • Joined: 30-December 07

Re: Dagger3d! engine

Posted 11 January 2010 - 03:04 AM

Another bunch of little updates.

* Mostly finished the virtual camera system. It supports multiple cameras with 5 and 6 degrees of freedom. Basically 5DOF = translational degrees of freedom along the XYZ axes and two additional degrees of rotational freedom (pitch and yaw). This is your typical FPS camera.
6DOF is all of that plus roll, more useful for flight sim-type games. The only thing I really think I have left to add is support for strafing. Also I think it would be kind of neat to have a wrapper around gluLookAt() that creates a camera and sets the proper orientation, because a lot of the examples I am looking at use it.

Camera example, mouse controlled flying 5DOF camera through a field of cubes.
Posted Image

* Enabled MSAA (multisample anti-aliasing) by default. Added support for backface culling.

* Renamed all function from the format dX to dgX to avoid conflicts with the physics library I am looking to use (ODE).

* Restructured source/include directories so that it is much more organised. Also I wrote a new configure script that should work better than the old one, supports folders in source directory, etc.

* Added some memory allocation macros.

* Mostly implemented a virtual light system (inspired by Mark Kilgard's multilight example). Still need to add support for shadows, spotlights, and materials.

Port of Kilgard's multilight example to Dagger3D.
Posted Image

* Brought one of my old experiments back to life. Basically it is a 2D box, you press the space bar and balls get dropped with semi-random initial velocities. Gravity affects the balls and they can bounce off each other. Difficult to do efficiently (I did not).

Semi-animated screenshot of bouncing ball experiment.
Posted Image

Starting work on a simple GUI system that will probably only include some very basic stuff, mainly buttons, text, and maybe some very very simple input fields.

Also looking into writing a resource => header file compiler, so that you can include (for example) a texture or font inside an executable.

Ahhhh I totally need to go to bed now...

Edit: I've also started posting these updates to my blog. May restart my DIC blog and post them there as well...

This post has been edited by Tom9729: 11 January 2010 - 03:08 AM

Was This Post Helpful? 1
  • +
  • -

#108 Tom9729  Icon User is offline

  • Segmentation fault
  • member icon

Reputation: 180
  • View blog
  • Posts: 2,641
  • Joined: 30-December 07

Re: Dagger3d! engine

Posted 18 May 2010 - 12:30 AM

Short update but I've been busy with school...

- Everything seems to be working with minor changes on Tiger (PowerPC). The only hiccup I ran into was endianness. Haven't tested it on Intel OS X since I don't have one of those machines (yet) ;).

- Added shadow volumes, although I'm not too happy with the implementation. Hoping to clean up how they are used before releasing 0.3.1.

- Would like to get some joystick support in for next release (0.3.2). Also would like to work on the GUI system a bit but this may or may not happen as I'm hopefully going to be working this summer, in addition to having a little school/research work.
Was This Post Helpful? 0
  • +
  • -

#109 Tom9729  Icon User is offline

  • Segmentation fault
  • member icon

Reputation: 180
  • View blog
  • Posts: 2,641
  • Joined: 30-December 07

Re: Dagger3d! engine

Posted 18 July 2010 - 01:08 AM

Release 0.3.1 changes (excluding the things I already posted about, eg. fonts and shadows).

  • Cleaned up shadow volume code.
  • Frustum culling, it's a bit of a manual process right now because there's no real scene manager but you can get all the information you need from the active camera.
  • New built-in font.
  • OS X Tiger PPC binaries. I had a friend test on x86 Leopard and it works, although I do not have binaries at the moment.
  • Joystick support on Windows/Linux. OS X does not have a joystick API so writing a driver to interface with Dagger is a lot more work.
  • A ton of other little things that I can't think of right now because I added them over a month ago. ;)

Hopefully tutorials coming soon, and some cooler demos.

Far off future stuff:
  • Skeletal animation (MD5 models? Collada looks pretty beastly...).
  • GUI toolkit (yes I know I've said this before, but it's hard :)).
  • Integration with GLConsole or something similar.
  • Integration with Python or another scripting language.
  • Streaming audio.
  • A real scene manager.
  • The kitchen sink.


Website: http://dagger3d.sf.net
Downloads: https://sourceforge....dagger3d-0.3.1/
Was This Post Helpful? 1
  • +
  • -

#110 Tom9729  Icon User is offline

  • Segmentation fault
  • member icon

Reputation: 180
  • View blog
  • Posts: 2,641
  • Joined: 30-December 07

Re: Dagger3d! engine

Posted 19 July 2010 - 08:15 PM

I finally wrote a tutorial for Dagger3D.

http://dagger3d.sour...p?id=tutorial01

Also I can't remember if I mentioned this but a long time ago I put up a MinGW package for Windows that has everything you need to develop with Dagger (minus a text editor, I recommend Emacs but that's up to you). Eventually I'll toss my Linux->Windows cross-compiler up there too...
Was This Post Helpful? 0
  • +
  • -

#111 Amrykid  Icon User is offline

  • 4+1=Moo
  • member icon

Reputation: 148
  • View blog
  • Posts: 1,589
  • Joined: 16-December 08

Re: Dagger3d! engine

Posted 19 July 2010 - 09:15 PM

This is looking good! Keep up the good work! :bigsmile:

This post has been edited by Amrykid: 19 July 2010 - 09:16 PM

Was This Post Helpful? 1
  • +
  • -

#112 NeoTifa  Icon User is online

  • Whorediot
  • member icon





Reputation: 2778
  • View blog
  • Posts: 15,880
  • Joined: 24-September 08

Re: Dagger3d! engine

Posted 26 July 2010 - 10:28 AM

You are the awesomest Tom.
Was This Post Helpful? 1
  • +
  • -

#113 Tom9729  Icon User is offline

  • Segmentation fault
  • member icon

Reputation: 180
  • View blog
  • Posts: 2,641
  • Joined: 30-December 07

Re: Dagger3d! engine

Posted 27 July 2010 - 08:08 PM

Java bindings coming soon.

Right now it's just some rough SWIG-generated code but expect a nice pretty Java API later. ;)

Example code using the rough API.
public class Test
{
	public static void main(String[] args)
	{
		System.loadLibrary("dagger3d-java");
				
		DG_JNI.dgInit(0, null);
		DG_JNI.dgWindowSetNoCallbacks(0);
		DG_JNI.dgWindowOpen("Foo", 800, 600, 60, 0);

		// Initialize timers.
		DG_JNI.dgWindowTimerInit();
		
		// Get timer references.
		int sceneTimer = DG_JNI.dgWindowTimerGetScene();
		int logicTimer = DG_JNI.dgWindowTimerGetLogic();
		int inputTimer = DG_JNI.dgWindowTimerGetInput();

		float xrot = 0, yrot = 0;

		while (true)
		{	
			if (DG_JNI.dgTimerCheck(sceneTimer) == 1)
			{
				DG_JNI.dgWindowRenderSceneStartNoCallbacks();
				DG_JNI.dgWindowDrawFPS();
				DG_JNI.glTranslatef(0, 0, -10);
				DG_JNI.glRotatef(xrot, 1, 0, 0);
				DG_JNI.glRotatef(yrot, 0, 1, 0);
				DG_JNI.glutSolidCube(3);
				DG_JNI.dgWindowRenderSceneStopNoCallbacks();
			}

			if (DG_JNI.dgTimerCheck(inputTimer) == 1)
			{
				if (DG_JNI.dgKeyboardPressedOnce(DG_JNIConstants.DG_KEY_ESCAPE) == 1)
				{
					DG_JNI.exit(0);
				}
			}

			if (DG_JNI.dgTimerCheck(logicTimer) == 1)
			{
				xrot += 1;
				yrot += 1;
			}

			DG_JNI.glutMainLoopEvent();
			DG_JNI.dgWindowDisplayPoke();	
		}
	}
}



Because of some changes I made internally, it should be easier to also do bindings for other languages that don't easily support callbacks/closures. SWIG has a feature called directors that I haven't really looked into, but the documentation seems to be pretty thin in some parts so I think I'm just going to continue with what I have now. :)

Edit: I found someone to possibly do C# bindings, probably for Mono. More on this later!

This post has been edited by Tom9729: 27 July 2010 - 08:21 PM

Was This Post Helpful? 1
  • +
  • -

#114 Tom9729  Icon User is offline

  • Segmentation fault
  • member icon

Reputation: 180
  • View blog
  • Posts: 2,641
  • Joined: 30-December 07

Re: Dagger3d! engine

Posted 08 August 2010 - 05:01 PM

:/ Been working on the Java bindings for about a week now, ran into a couple little problems.

  • freeglut is broken on OS X, looking into the source code they only support X11 which means on OS X you need to have the X server installed and running to use anything compiled with freeglut, and I can't even get the examples to work on Leopard.
  • Using plain GLUT means I have to use callbacks, which seem to be somewhat tricky to do in JNI. I have code that I think should work but I'm getting some strange errors that I think are related to GLUT being used in a way that it doesn't like (hehe). Some Googling led me upon someone else having the same problem...in 2003. Not promising...
  • C# and P/Invoke might work better, but I'm getting to the point where I'd just rather get back to work instead of wasting time on this any longer.

Was This Post Helpful? 0
  • +
  • -

#115 Vermiculus  Icon User is offline

  • D.I.C Regular
  • member icon

Reputation: 10
  • View blog
  • Posts: 314
  • Joined: 26-February 09

Re: Dagger3d! engine

Posted 14 August 2010 - 06:49 PM

View PostTom9729, on 17 June 2008 - 04:31 PM, said:

The technology behind games (namely the engine) should if possible be Open Source, but the games themself should not be.


Epic quote.

And epic engine!

This post has been edited by Vermiculus: 14 August 2010 - 06:51 PM

Was This Post Helpful? 1
  • +
  • -

#116 Tom9729  Icon User is offline

  • Segmentation fault
  • member icon

Reputation: 180
  • View blog
  • Posts: 2,641
  • Joined: 30-December 07

Re: Dagger3d! engine

Posted 18 April 2011 - 12:00 AM

Haven't posted in a really long time, been very busy with school and playing Minecraft. However I am still working on this stuff in my free time.

Snippet from the slightly outdated change-log.

I also wrote a simple customizable particle system, and I've been working on a terrain engine.

Obligatory screenshots (you've already seen these if I have you on Facebook).

Attached Image

Attached Image

Attached Image

Attached Image

Attached Image

This post has been edited by Tom9729: 18 April 2011 - 12:01 AM

Was This Post Helpful? 4
  • +
  • -

#117 Core  Icon User is offline

  • using System.Linq;
  • member icon

Reputation: 774
  • View blog
  • Posts: 5,097
  • Joined: 08-December 08

Re: Dagger3d! engine

Posted 18 April 2011 - 03:20 PM

That's some amazing work, Tom! Keep it up!
Was This Post Helpful? 0
  • +
  • -

  • (8 Pages)
  • +
  • « First
  • 6
  • 7
  • 8