[IMaterial] Fix water

This commit is contained in:
momo5502 2016-12-29 03:06:30 +01:00
parent e5e164e9b5
commit ab7a837ebc
2 changed files with 23 additions and 14 deletions

View File

@ -75,13 +75,12 @@ namespace Assets
if (material->textureTable[i].semantic == SEMANTIC_WATER_MAP) if (material->textureTable[i].semantic == SEMANTIC_WATER_MAP)
{ {
material->textureTable[i].info.water->floatTime = reader.read<float>(); material->textureTable[i].info.water->writable.floatTime = reader.read<float>();
material->textureTable[i].info.water->M = reader.read<int>(); material->textureTable[i].info.water->M = reader.read<int>();
material->textureTable[i].info.water->N = reader.read<int>(); material->textureTable[i].info.water->N = reader.read<int>();
int count = material->textureTable[i].info.water->M * material->textureTable[i].info.water->N; int count = material->textureTable[i].info.water->M * material->textureTable[i].info.water->N;
material->textureTable[i].info.water->H0X = reader.readArray<float>(count); material->textureTable[i].info.water->H0 = reader.readArray<Game::complex_s>(count);
material->textureTable[i].info.water->H0Y = reader.readArray<float>(count); material->textureTable[i].info.water->wTerm = reader.readArray<float>(count);
/*material->textureTable[i].info.water->wTerm =*/ reader.readArray<float>(count);
material->textureTable[i].info.water->Lx = reader.read<float>(); material->textureTable[i].info.water->Lx = reader.read<float>();
material->textureTable[i].info.water->Lz = reader.read<float>(); material->textureTable[i].info.water->Lz = reader.read<float>();
material->textureTable[i].info.water->gravity = reader.read<float>(); material->textureTable[i].info.water->gravity = reader.read<float>();
@ -386,18 +385,18 @@ namespace Assets
Utils::Stream::ClearPointer(&destTextureDef->info.water); Utils::Stream::ClearPointer(&destTextureDef->info.water);
// Save_water_t // Save_water_t
if (water->H0X) if (water->H0)
{ {
buffer->align(Utils::Stream::ALIGN_4); buffer->align(Utils::Stream::ALIGN_4);
buffer->save(water->H0X, 8, water->M * water->N); buffer->save(water->H0, 8, water->M * water->N);
Utils::Stream::ClearPointer(&destWater->H0X); Utils::Stream::ClearPointer(&destWater->H0);
} }
if (water->H0Y) if (water->wTerm)
{ {
buffer->align(Utils::Stream::ALIGN_4); buffer->align(Utils::Stream::ALIGN_4);
buffer->save(water->H0Y, 4, water->M * water->N); buffer->save(water->wTerm, 4, water->M * water->N);
Utils::Stream::ClearPointer(&destWater->H0Y); Utils::Stream::ClearPointer(&destWater->wTerm);
} }
if (water->image) if (water->image)

View File

@ -334,12 +334,22 @@ namespace Game
char* name; char* name;
}; };
struct water_t struct WaterWritable
{ {
float floatTime; float floatTime;
float *H0X; // Count = M * N };
float *H0Y; // Count = M * N
//float *wTerm; // Count = M * N struct complex_s
{
float real;
float imag;
};
struct water_t
{
WaterWritable writable;
complex_s *H0;
float *wTerm;
int M; int M;
int N; int N;
float Lx; float Lx;