mirror of
https://github.com/ClassiCube/ClassiCube.git
synced 2025-09-19 12:35:52 -04:00
Optimise lava animation algorithm.
This commit is contained in:
parent
0160285b98
commit
35844e526d
@ -73,8 +73,8 @@ namespace ClassicalSharp.TexturePack {
|
||||
}
|
||||
if( !validated ) ValidateAnimations();
|
||||
|
||||
foreach( AnimationData anim in animations )
|
||||
ApplyAnimation( anim );
|
||||
for( int i = 0; i < animations.Count; i++ )
|
||||
ApplyAnimation( animations[i] );
|
||||
}
|
||||
|
||||
/// <summary> Reads a text file that contains a number of lines, with each line describing:<br/>
|
||||
|
@ -31,12 +31,13 @@ namespace ClassicalSharp {
|
||||
for( int j = 0; j < 9; j++ ) {
|
||||
int xx = x + (j % 3 - 1) + xOffset;
|
||||
int yy = y + (j / 3 - 1) + yOffset;
|
||||
localSoupHeat += soupHeat[Index( xx, yy )];
|
||||
localSoupHeat += soupHeat[(yy & 0xF) << 4 | (xx & 0xF)];
|
||||
}
|
||||
|
||||
float localPotHeat =
|
||||
potHeat[Index( x, y )] + potHeat[Index( x, y + 1 )] +
|
||||
potHeat[Index( x + 1, y )] + potHeat[Index( x + 1, y + 1 )];
|
||||
float localPotHeat = potHeat[i]
|
||||
+ potHeat[y << 4 | ((x + 1) & 0xF)] + // x + 1, y
|
||||
+ potHeat[((y + 1) & 0xF) << 4 | x] + // x, y + 1
|
||||
+ potHeat[((y + 1) & 0xF) << 4 | ((x + 1) & 0xF)];
|
||||
|
||||
soupHeat[i] = localSoupHeat / 10 + localPotHeat / 4 * 0.8f;
|
||||
potHeat[i] += flameHeat[i] * 0.01f;
|
||||
@ -62,9 +63,5 @@ namespace ClassicalSharp {
|
||||
ptr++;
|
||||
}
|
||||
}
|
||||
|
||||
static int Index( int x, int y ) {
|
||||
return (y & 0xF) << 4 | (x & 0xF);
|
||||
}
|
||||
}
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user