From ab7a837ebcde229a661178574e2701d758f530be Mon Sep 17 00:00:00 2001 From: momo5502 Date: Thu, 29 Dec 2016 03:06:30 +0100 Subject: [PATCH] [IMaterial] Fix water --- .../Modules/AssetInterfaces/IMaterial.cpp | 19 +++++++++---------- src/Game/Structs.hpp | 18 ++++++++++++++---- 2 files changed, 23 insertions(+), 14 deletions(-) diff --git a/src/Components/Modules/AssetInterfaces/IMaterial.cpp b/src/Components/Modules/AssetInterfaces/IMaterial.cpp index 8d6fb9cb..49f7ffe8 100644 --- a/src/Components/Modules/AssetInterfaces/IMaterial.cpp +++ b/src/Components/Modules/AssetInterfaces/IMaterial.cpp @@ -75,13 +75,12 @@ namespace Assets if (material->textureTable[i].semantic == SEMANTIC_WATER_MAP) { - material->textureTable[i].info.water->floatTime = reader.read(); + material->textureTable[i].info.water->writable.floatTime = reader.read(); material->textureTable[i].info.water->M = reader.read(); material->textureTable[i].info.water->N = reader.read(); int count = material->textureTable[i].info.water->M * material->textureTable[i].info.water->N; - material->textureTable[i].info.water->H0X = reader.readArray(count); - material->textureTable[i].info.water->H0Y = reader.readArray(count); - /*material->textureTable[i].info.water->wTerm =*/ reader.readArray(count); + material->textureTable[i].info.water->H0 = reader.readArray(count); + material->textureTable[i].info.water->wTerm = reader.readArray(count); material->textureTable[i].info.water->Lx = reader.read(); material->textureTable[i].info.water->Lz = reader.read(); material->textureTable[i].info.water->gravity = reader.read(); @@ -386,18 +385,18 @@ namespace Assets Utils::Stream::ClearPointer(&destTextureDef->info.water); // Save_water_t - if (water->H0X) + if (water->H0) { buffer->align(Utils::Stream::ALIGN_4); - buffer->save(water->H0X, 8, water->M * water->N); - Utils::Stream::ClearPointer(&destWater->H0X); + buffer->save(water->H0, 8, water->M * water->N); + Utils::Stream::ClearPointer(&destWater->H0); } - if (water->H0Y) + if (water->wTerm) { buffer->align(Utils::Stream::ALIGN_4); - buffer->save(water->H0Y, 4, water->M * water->N); - Utils::Stream::ClearPointer(&destWater->H0Y); + buffer->save(water->wTerm, 4, water->M * water->N); + Utils::Stream::ClearPointer(&destWater->wTerm); } if (water->image) diff --git a/src/Game/Structs.hpp b/src/Game/Structs.hpp index c24f4d4f..26f4711b 100644 --- a/src/Game/Structs.hpp +++ b/src/Game/Structs.hpp @@ -334,12 +334,22 @@ namespace Game char* name; }; - struct water_t + struct WaterWritable { 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 N; float Lx;