mirror of
https://github.com/ClassiCube/ClassiCube.git
synced 2025-09-15 02:25:32 -04:00
Updated Minecraft Classic lava animation algorithm. (markdown)
parent
cc86858682
commit
d476609599
@ -1,5 +1,5 @@
|
|||||||
From goodlyay's dropbox
|
_From goodlyay's dropbox_
|
||||||
```
|
|
||||||
Huge thanks to my dad (John Alvarado) for doing most of the work in figuring this out.
|
Huge thanks to my dad (John Alvarado) for doing most of the work in figuring this out.
|
||||||
|
|
||||||
The algorithm uses a 3-layer cellular automata to simulate a dynamic heated fluid.
|
The algorithm uses a 3-layer cellular automata to simulate a dynamic heated fluid.
|
||||||
@ -14,8 +14,10 @@ The second layer represents the potHeat,
|
|||||||
The third layer represents the soupHeat.
|
The third layer represents the soupHeat.
|
||||||
|
|
||||||
|
|
||||||
All of these array values start at 0 when the game starts and are updated every frame.
|
All of these array values start at 0 when the game starts and are updated every frame
|
||||||
|
|
||||||
|
### Lava
|
||||||
|
---
|
||||||
|
|
||||||
Each frame, for every position in the lava texture array, it calculates the corresponding values of the soupHeat, potHeat, and flameHeat layers as follows:
|
Each frame, for every position in the lava texture array, it calculates the corresponding values of the soupHeat, potHeat, and flameHeat layers as follows:
|
||||||
|
|
||||||
@ -51,29 +53,9 @@ After the above arrays are updated, for every pixel in the lava texture, it calc
|
|||||||
|
|
||||||
Finally, it converts the red green and blue to bytes and assigns them to the texture
|
Finally, it converts the red green and blue to bytes and assigns them to the texture
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
-----------------------------------------------------------------------------
|
|
||||||
Water:
|
|
||||||
|
|
||||||
This is VERY similar to lava, with a few minor differences. We'll keep the same variable names.
|
### Water
|
||||||
|
---
|
||||||
|
|
||||||
|
|
||||||
The first layer represents the flameHeat (This can be negative.),
|
|
||||||
The second layer represents the potHeat,
|
|
||||||
The third layer represents the soupHeat.
|
|
||||||
|
|
||||||
|
|
||||||
All of these array values start at 0 when the game starts and are updated every frame.
|
|
||||||
|
|
||||||
|
|
||||||
Each frame, for every position in the water texture array, it calculates the corresponding values of the soupHeat, potHeat, and flameHeat layers as follows:
|
Each frame, for every position in the water texture array, it calculates the corresponding values of the soupHeat, potHeat, and flameHeat layers as follows:
|
||||||
@ -104,5 +86,4 @@ After the above arrays are updated, for every pixel in the water texture, it cal
|
|||||||
float blue = 255
|
float blue = 255
|
||||||
float alpha = 146 + colorHeat^2 * 50
|
float alpha = 146 + colorHeat^2 * 50
|
||||||
|
|
||||||
Finally, it converts the red green and blue to bytes and assigns them to the texture
|
Finally, it converts the red green and blue to bytes and assigns them to the texture
|
||||||
```
|
|
Loading…
x
Reference in New Issue
Block a user