Jump to content

2D water simulation using a C++ dll


Recommended Posts

I wrote this a while ago and only recently implemented shading.

The current shading algorithm could use some improvements.

Most of the source is based from here

The .dll source is also in the archive (made with Visual Studio 2012 Express).

2D Water simulation using a C++ dll.7z

If you use a x64 bit OS then:

For anyone having trouble running this on a x64 OS, set #AutoIt3Wrapper_UseX64=n (OP code assumes you are running x86 AutoIt).

 

EDIT:

Added an example using a .gif file (split into frames).

Edited by DatMCEyeBall

"Just be fred, all we gotta do, just be fred."  -Vocaliod

"That is a Hadouken. A KAMEHAMEHA would have taken him 13 days and 54 episodes to form." - Roden Hoxha

@tabhooked

Clock made of cursors ♣ Desktop Widgets ♣ Water Simulation

Link to comment
Share on other sites

I can't get it run. msvcp110d.dll was missing but after downloaded it, nothing happens when starting the script.

Tested on Win 8.1 and 3.3.10.2.

Br,

UEZ

Edited by UEZ

Please don't send me any personal message and ask for support! I will not reply!

Selection of finest graphical examples at Codepen.io

The own fart smells best!
Her 'sikim hıyar' diyene bir avuç tuz alıp koşma!
¯\_(ツ)_/¯  ٩(●̮̮̃•̃)۶ ٩(-̮̮̃-̃)۶ૐ

Link to comment
Share on other sites

Cool, works now. I will check whether it can be loaded from memory and use it for my watermark app.

Btw, I tried several times to learn C++ using MS VS but it is a overkill with plenty of features which I don't need when being a C++ noob besides to use the IDE environment.

A mentor would be nice...

Br,

UEZ

Edited by UEZ

Please don't send me any personal message and ask for support! I will not reply!

Selection of finest graphical examples at Codepen.io

The own fart smells best!
Her 'sikim hıyar' diyene bir avuç tuz alıp koşma!
¯\_(ツ)_/¯  ٩(●̮̮̃•̃)۶ ٩(-̮̮̃-̃)۶ૐ

Link to comment
Share on other sites

Cool, works now. I will check whether it can be loaded from memory and use it for my watermark app.

Look at the first line of WaterSim.au3 (the Global Enum line).

Check the UseBuffer1 flag in the params structure (forgot the Enum's name) if so use the HM (height map) #1 if not use #2

Add to the data (+=) at the specified location an amount (it's a height map used by the .dll so add a number like 512 or more - depends on what you prefer)

The height map is a 1D array, I think the main .au3 file still has a _PixelIndexFromXY (or similar) function, use it to convert XY co-ordinates into the index of the array. 

Call the NewFrame function to draw and flatten the water.

I can write you something special instead. If you want me to do so then please PM me.

A mentor would be nice...

Mentor?  :sorcerer:

C++ for dummies(link to .pdf) is what I used to learn it, VS is just there for convenience.

Edited by DatMCEyeBall

"Just be fred, all we gotta do, just be fred."  -Vocaliod

"That is a Hadouken. A KAMEHAMEHA would have taken him 13 days and 54 episodes to form." - Roden Hoxha

@tabhooked

Clock made of cursors ♣ Desktop Widgets ♣ Water Simulation

Link to comment
Share on other sites

I mean rather to load the DLL from the memory.


Thanks for the Dummy stuff but I've already a lot of C++ documentations (incl. this).  :whistle: 

Br,
UEZ

Edited by UEZ

Please don't send me any personal message and ask for support! I will not reply!

Selection of finest graphical examples at Codepen.io

The own fart smells best!
Her 'sikim hıyar' diyene bir avuç tuz alıp koşma!
¯\_(ツ)_/¯  ٩(●̮̮̃•̃)۶ ٩(-̮̮̃-̃)۶ૐ

Link to comment
Share on other sites

For anyone having trouble running this on a x64 OS, set #AutoIt3Wrapper_UseX64=n (OP code assumes you are running x86 AutoIt).

@DatMCEyeBall

Cool effect!

Link to comment
Share on other sites

For anyone having trouble running this on a x64 OS, set #AutoIt3Wrapper_UseX64=n (OP code assumes you are running x86 AutoIt).

I'm adding this to the OP.

 

I mean rather to load the DLL from the memory.

Thanks for the Dummy stuff but I've already a lot of C++ documentations (incl. this).   :whistle:

What exactly is bothering you with MS VS C++?

If you have a problem then Google it - that's what I do.

Edited by DatMCEyeBall

"Just be fred, all we gotta do, just be fred."  -Vocaliod

"That is a Hadouken. A KAMEHAMEHA would have taken him 13 days and 54 episodes to form." - Roden Hoxha

@tabhooked

Clock made of cursors ♣ Desktop Widgets ♣ Water Simulation

Link to comment
Share on other sites

I'm adding this to the OP.

 
 

What exactly is bothering you with MS VS C++?

If you have a problem then Google it - that's what I do.

 

I find it hard to use the editor - it is so oversized compared to SciTE. Anyhow, if I find enough motivation I will try again.

 

Br,

UEZ

Please don't send me any personal message and ask for support! I will not reply!

Selection of finest graphical examples at Codepen.io

The own fart smells best!
Her 'sikim hıyar' diyene bir avuç tuz alıp koşma!
¯\_(ツ)_/¯  ٩(●̮̮̃•̃)۶ ٩(-̮̮̃-̃)۶ૐ

Link to comment
Share on other sites

If you try searching on Youtube for "Microsoft Visual Studio 2012 C++ tutorial":

http://www.youtube.com/watch?v=xoExJLVroZc

"Just be fred, all we gotta do, just be fred."  -Vocaliod

"That is a Hadouken. A KAMEHAMEHA would have taken him 13 days and 54 episodes to form." - Roden Hoxha

@tabhooked

Clock made of cursors ♣ Desktop Widgets ♣ Water Simulation

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...