Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Messages - madeyes

Pages: [1] 2
1
Thanks for your help. I've got a lot of reading to do!

2
C / C++ /C# / Help with understanding demo source
« on: July 03, 2016 »
Hi!
I'm going through the source code to the old Excess demo - Cortex Sous-vide for learning purposes (even though it is DirectX 9 the algorithms are still useful). I'm stuck on a method that is used in a few places to control the position of the camera and some other objects. I'm sure someone in here knows the theory behind this and can point me in the right direction. I'm not even sure what background reading to do.
Code is at the bottom of this post. The code should be understandable in isolation, but the full source is here https://github.com/kusma/vlee/tree/cortex-sous-vide
getCubePos is the method used to get the position for the camera in 3D. I have plotted out the points that would be returned from getCubeKeyframe in the attached image.
With this image, the getCubeKeyframe method makes a bit more sense to me.
The more confusing part to me is why 4 samples are taken, and what the tangents and those particular polynomials are for. I guess the polynomials are to make the path curved?

After a bit of research I think they are Hermite basis functions?

Thanks!
madeyes


Code: [Select]
Vector3 getCubeKeyframe(int key)
{
const Vector3 keyframes[] = {
Vector3(0,   0,   0),
Vector3(60,  0,   0),
Vector3(120, 0,   0),
Vector3(120, 60,  0),
Vector3(120, 120, 0),
Vector3(60,  120, 0),
Vector3(0,   120, 0),
Vector3(0,   120, 60),
Vector3(0,   120, 120),
Vector3(0,   60,  120),
Vector3(0,   0,   120),
Vector3(0,   0,   60),
Vector3(0,   0,   0),
Vector3(0,   0,  -60),
Vector3(0,   0,  -120),
Vector3(60,  0,  -120),
Vector3(120, 0,  -120),
Vector3(120,-60,  -120),
Vector3(120,-120,-120),
Vector3(60, -120,-120),
Vector3(0,  -120,-120),
Vector3(0,  -120,-60),
Vector3(0,  -120, 0),
Vector3(0,  -60, 0)
};
return keyframes[key % ARRAY_SIZE(keyframes)] * 0.5
   + keyframes[(key - 1) % ARRAY_SIZE(keyframes)] * 0.25
   + keyframes[(key + 1) % ARRAY_SIZE(keyframes)] * 0.25;
}

Vector3 getCubePos(float cam_time)
{
int k0 = int(floor(cam_time) - 1);
int k1 = k0 + 1;
int k2 = k1 + 1;
int k3 = k2 + 1;

Vector3 samples[4] = {
getCubeKeyframe(k0), getCubeKeyframe(k1), getCubeKeyframe(k2), getCubeKeyframe(k3)
};

Vector3 tangents[2] = {
(samples[2] - samples[0]) / 2.0,
(samples[3] - samples[1]) / 2.0
};

float t = cam_time - floor(cam_time);
float t2 = t * t;
float t3 = t2 * t;
float w[4] = {
// 2t^3 - 3t^2 + 1
2.0f * t3 - 3.0f * t2 + 1.0f,
// t^3 - 2t^2 + t
1.0f * t3 - 2.0f * t2 + t,
// -2t^3 + 3t^2
w[2] = -2.0f * t3 + 3.0f * t2,
// t^3 - t^2
w[3] =  1.0f * t3 - 1.0f * t2
};

return samples[1] * w[0] +
   tangents[0] * w[1] +
   samples[2] * w[2] +
   tangents[1] * w[3];
}

3
ASM / Re: VGA Floor Casting
« on: May 16, 2014 »
It works OK in DOSBox under 64-bit windows 7 if you increase the CPU speed with ctrl-f12.
rain_storm: Awesome 256-byte .

4
General coding questions / Cicada principle
« on: April 20, 2012 »
It seems like this would be good for making small demos
http://designfestival.com/the-cicada-principle-and-why-it-matters-to-web-designers/
Anyone used principles like this before?

5
General coding questions / Re: LISP?
« on: February 03, 2012 »
Hey spathi, I'm giving LISP a go too. It's good to try something completely different to improve your programming abilities.  I am reading "Land of Lisp: Learn to Program Lisp, One Game at a Time! by Conrad Barski" which is a really fun book that reminds me of the excitement of first learning programming from Usbourne books for the BBC micro :)
I wonder if anyone has written a cool demo in LISP?

6
General chat / Demo party?
« on: July 28, 2011 »
So I was thinking of going to sunrise but then decided probably not as I think I'd be a hanger on. I don't even have a laptop to take... and I wouldn't be making any production. But I've never been to a (demo) party before so don't know what to expect. Anyone able to enlighten me?

7
General chat / Re: Wow
« on: July 07, 2011 »
Impressive! The disembodied hand is creepy though..

8
General chat / Re: If you have a Facebook account.
« on: April 30, 2011 »
It now says under those settings:
A Note About Your Photos
There is a false rumor circulating that Facebook is changing who owns your private photos. You own all of the content and information you post on Facebook

9
Projects / Re: BBQ 2010 (Shader 3.0)
« on: June 09, 2010 »
 :clap:
Wow really liking this effect. I didn't catch the original but this is great. Well done.

10
Projects / Re: Intro
« on: May 12, 2010 »
zawran: yes I agree I wouldn't normally bother to download something I need to get dlls for.

I attach the demo recompiled with static libraries. Thanks for the tip Jim.
This is the first time I've played about with these visual studio settings so I can't guarantee it will work (I haven't got a way of testing it sorry).

11
Projects / Re: Intro
« on: May 11, 2010 »
I can't help I'm afraid as I don't have another machine to try it on.
Maybe I shouldn't have built it with VS2010

12
Projects / Re: Intro
« on: May 10, 2010 »
Thanks guys.
Yeh it's my first complete intro, although I have played around with individual effects using SDL.

AH sorry about the missing runtime dlls. I'm on XP 32-bit and I have only tried it on XP and Vista machines.

13
Projects / Intro
« on: May 08, 2010 »
Hi,
After a long break from demo coding (my last demo was a 256 byte), I had a play with C++ and SDL and this is what I came up with. Seems a bit amateurish compared to some of the stuff in this forum, but I had fun making it :) It's the kind of thing I always wanted to make back in the DOS days when I had no skill. I first saw this lissajous effect in Cronologia  by cascada.
I hope it's OK to include the music with this, it was a freely available remix of nemesis the warlock on http://www.remix64.com. And I hope it's OK to use your font shockwave.
If not then I guess this post better get deleted...

Enjoy...

14
General chat / Re: Windows 7
« on: February 03, 2010 »
Thanks for your replies everyone. I still find it fun to do mode 13h with asm, but I can probably live without it - there's plenty of other stuff I want to play with and limited time :)
A friend of mine had performance problems on win 7 with the desktop window manager using all of one of her cpus  - but I don't know the spec of her pc. It was probably underspecced for win 7.
I think I've made my choice. Off to get my Vista upgrade.

15
General chat / Windows 7
« on: February 02, 2010 »
Anyone tried demo coding on Windows 7 yet....I downgraded to XP from Vista because I couldn't run DOS ASM and do 256 byte demos (that and Vista made me mad). But now I'm thinking of getting Win7 as it's supposed to be good....so does it run DOS programs OK fullscreen?

There's always DOSBOX I suppose but not always fast enough. Or a virtual machine with FreeDOS in it could work.

16
General chat / cool demo tool
« on: January 21, 2010 »
Hi everyone,

Sorry if you've already seen this but I think this tool I noticed over at pouet is awesome.
Realtime update of the opengl display as you code  :o
http://www.pouet.net/prod.php?which=54245

17
General chat / Re: Good Java books?
« on: December 18, 2009 »
No one mentioned Thinking in Java yet? http://www.faqs.org/docs/think_java/TIJ3_c.htm
Good free online book.

18
Mandelbroth? Is that some sort of fractal soup? ;D ;)

19
General chat / Re: Are you a Silver Surfer?
« on: June 19, 2009 »
I noticed grey last time I had my hair cut :(
And the barber started shaving hair out of my ears lol! Surely that shouldn't happen until I'm 60? ???

20
Coding tutorials / Re: TUTORIAL #1 - Setup
« on: June 16, 2009 »
These tutorials are a great idea....keep it up stormbringer I hope to see lots more
When I get time I'll be having a play with this

Pages: [1] 2