So I whipped together a little app that basically ripples water
All the rippling in the top corner was caused by one splash ricocheting off the walls. The app certainly isn't fast, but it does everything I wanted it to, and it is clear proof of concept that this method of creating that ripple effect does work.
Re: So I whipped together a little app that basically ripples water
Oh hell no. System.Runtime.InteropServices.Marshal.Copy() actually runs slightly faster than the bitmap pointers I had been using, and is a little easier to read, so that's what I went with. That, and a lot of math...
Re: So I whipped together a little app that basically ripples water
Why don't you post the code? I'd like to see it in action. You could put it in the code bank if you like.
Make as many mistakes as you can as quickly as you can. We want to make sure that we make a great enough number of mistakes in a given amount of time so that we can be successful.
"Persistence is the magic of success." Paramahansa Yogananda
Re: So I whipped together a little app that basically ripples water
I haven't, and my math is merely the sum of my perception of loosely what's happening in a ripple. It's entirely possible that I'm completely off the mark in terms of true wave dynamics, but damnit, it looks cool
Last edited by timeshifter; May 1st, 2009 at 07:22 AM.
Re: So I whipped together a little app that basically ripples water
Oi... just got the same system implemented for an isometric field instead of a pixel map... runs a heck of a lot faster and looks cooler, IMO. Sadly, I probably should spend the last three hours of the work day doing some actual work (I've been doing this all day), but maybe tonight I'll get around to adding some nice gradients based on height. The points in the array are associated with the vertexes here, not the cells... took a bit of trial and error before I finally got a single conditional which tests everything needed to determine if any given point should be the anchor for a cell...
EDIT: Oh, and if someone could figure out why the heck the app posted (and this new one) runs into that stupid stack overflow GDI+ error? I'm somewhat at a loss for what it's screaming about...
EDIT2: Got it. turns out the Stack Overflow was because I was driving the calculate loop with a timer (and the app clearly doesn't run at above 64 FPS), and disposing of the Graphics object every frame doubled the framerate...
Last edited by timeshifter; Apr 30th, 2009 at 03:14 PM.
Re: So I whipped together a little app that basically ripples water
Just updating the attachment above... added a couple new things, and this code should be pretty darn stable. At least, I haven't been able to make it crash.