Search found 63 matches

by Derrik
Wed Oct 22, 2014 5:07 pm
Forum: DS/DSi Development
Topic: Using quaternions
Replies: 15
Views: 21111

Re: Using quaternions

Good spot! Sometimes code just needs another pair of eyes to see the problem. I fixed that and managed to get much further, I almost have all of the maths I need to start work on my game! I've attached my current status, in the demo, rotate with the D-Pad and press A to translate at the direction th...
by Derrik
Tue Oct 21, 2014 7:53 pm
Forum: DS/DSi Development
Topic: Using quaternions
Replies: 15
Views: 21111

Re: Using quaternions

I was able to find an atan2Lerp function here: http://www.coranac.com/2009/02/on-arctangent/ All I need now is a function which moves the model at the angle that it is rotated at (by the quaternion). So first of all I need a quaternion to euler function, I found one here: http://www.euclideanspace.c...
by Derrik
Tue Oct 21, 2014 6:19 pm
Forum: DS/DSi Development
Topic: Using quaternions
Replies: 15
Views: 21111

Re: Using quaternions

I've given it a go but sadly it's not as simple as: #define atanLerp(a) ((int32)(atan((double)a / (double)4096.0) * (double)4096.0)) I tried to convert the radians to degrees and then convert the degrees to a DS angle with: #define atanLerp(a) degreesToAngle(atan((double)a / (double)4096.0) * (M_PI ...
by Derrik
Mon Oct 20, 2014 4:40 pm
Forum: DS/DSi Development
Topic: Using quaternions
Replies: 15
Views: 21111

Re: Using quaternions

I came across a problem. I need to implement a quaternion to euler function, however all of the formulas I have found online rely on atan or atan2. Unfortunately libnds does not have any inverse tan functions. Is there a work around for this?

Many thanks once again!
by Derrik
Sun Oct 19, 2014 8:19 pm
Forum: DS/DSi Development
Topic: Using quaternions
Replies: 15
Views: 21111

Re: Using quaternions

I think your main issue is dealing with fixed point numbers. There is no automatic conversion to and from floats - and you have a lot of mixing of the two in your code. I have not fixed all of the code - just the bare minimum needed to get the teapot to spin around the y axis. you should be able to...
by Derrik
Sat Oct 18, 2014 7:08 pm
Forum: DS/DSi Development
Topic: Using quaternions
Replies: 15
Views: 21111

Re: Using quaternions

Here's what I've got at the moment:

http://www.321webs.com/download/80285.htm

As you can see from the code, I'm really not sure of what I should be doing.

Thanks for the help.
by Derrik
Sat Oct 18, 2014 12:22 pm
Forum: DS/DSi Development
Topic: Using quaternions
Replies: 15
Views: 21111

Using quaternions

I have a model loaded, but I'm having trouble rotating it correctly in 3D space. When using Euler angles the axis change after each rotation: glRotatef(angleX, 1.0f, 0.0f, 0.0f); glRotatef(angleY, 0.0f, 1.0f, 0.0f); glRotatef(angleZ, 0.0f, 0.0f, 1.0f); If I reorder them, the resultant orientation ch...
by Derrik
Fri Oct 10, 2014 8:16 pm
Forum: DS/DSi Development
Topic: Saving like a commerical game
Replies: 1
Views: 6564

Saving like a commerical game

I am aware that it is possible to write to the microSD using stdio calls with libfat, for example: FILE *f = fopen("gameSave.bin", "wb"); fwrite(data, dataLen, 1, f); fclose(f); However I was wondering if it is possible to write data the same way as a commercial game, so that the...
by Derrik
Fri Sep 19, 2014 5:08 pm
Forum: DS/DSi Development
Topic: Microphone volume
Replies: 2
Views: 6465

Re: Microphone volume

I tried recording a buffer and getting the volume, but I couldn't get it to work. I am using this example: devkitPro\examples\nds\audio\micrecord\ In the micHandler function I add this to the end: static u8 oldsmp = 0; register s8 smp_s = (*(char *)data) ^ 0x80; register u8 smp = ((smp_s < 0) ? (-sm...
by Derrik
Mon Aug 25, 2014 7:14 pm
Forum: DS/DSi Development
Topic: Backgrounds and VRAM layout
Replies: 1
Views: 5763

Backgrounds and VRAM layout

I want to have 4 layers of `BgType_Text8bpp` backgrounds on both screens, with extended palettes, each with their own map and tile space in VRAM. Somehow PAlib managed to do this, but since I've been using libnds, I have not been able to achieve the same thing. Here is the VRAM configuration I am at...