From 8c52f6094e89981c1167c5ae70902ba54aec6cdc Mon Sep 17 00:00:00 2001 From: Deamon Date: Thu, 9 Jan 2020 09:26:29 +0200 Subject: [PATCH] step 1 --- src/main.cpp | 16 +- src/ui/FrontendUI.h | 2 +- .../src/engine/shader/ShaderDefinitions.h | 460 +++++++++--------- 3 files changed, 239 insertions(+), 239 deletions(-) diff --git a/src/main.cpp b/src/main.cpp index 78a4caaa0..ba2a470e1 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -312,15 +312,15 @@ int main(){ glfwWindowHint(GLFW_OPENGL_DEBUG_CONTEXT, GLFW_TRUE); - const char * url = "https://wow.tools/casc/file/fname?buildconfig=54b3dc4ced90d45071f72a05fecfd063&cdnconfig=524df013928ee0fa66af5cfa1862153e&filename="; - const char * urlFileId = "https://wow.tools/casc/file/fdid?buildconfig=54b3dc4ced90d45071f72a05fecfd063&cdnconfig=524df013928ee0fa66af5cfa1862153e&filename=data&filedataid="; +// const char * url = "https://wow.tools/casc/file/fname?buildconfig=54b3dc4ced90d45071f72a05fecfd063&cdnconfig=524df013928ee0fa66af5cfa1862153e&filename="; +// const char * urlFileId = "https://wow.tools/casc/file/fdid?buildconfig=54b3dc4ced90d45071f72a05fecfd063&cdnconfig=524df013928ee0fa66af5cfa1862153e&filename=data&filedataid="; // HttpZipRequestProcessor *processor = new HttpZipRequestProcessor(url); // ZipRequestProcessor *processor = new ZipRequestProcessor(filePath); // MpqRequestProcessor *processor = new MpqRequestProcessor(filePath); - RequestProcessor *processor = new HttpRequestProcessor(url, urlFileId); +// RequestProcessor *processor = new HttpRequestProcessor(url, urlFileId); // CascRequestProcessor *processor = new CascRequestProcessor(filePath); - processor->setThreaded(true); -// RequestProcessor *processor = nullptr; +// processor->setThreaded(true); + RequestProcessor *processor = nullptr; glfwInit(); @@ -382,9 +382,9 @@ int main(){ CSqliteDB *sqliteDB = new CSqliteDB("./export.db3"); -// WoWFilesCacheStorage *storage = nullptr; - WoWFilesCacheStorage *storage = new WoWFilesCacheStorage(processor); - processor->setFileRequester(storage); + WoWFilesCacheStorage *storage = nullptr; +// WoWFilesCacheStorage *storage = new WoWFilesCacheStorage(processor); +// processor->setFileRequester(storage); //Create device IDevice * device = IDeviceFactory::createDevice(rendererName, &callback); diff --git a/src/ui/FrontendUI.h b/src/ui/FrontendUI.h index 96511f93d..c2bdb3495 100644 --- a/src/ui/FrontendUI.h +++ b/src/ui/FrontendUI.h @@ -56,7 +56,7 @@ class FrontendUI : public IDeviceUI { bool showAboutWindow = false; // c bool showWorldPosTooltip = false; - bool cascOpened = true; + bool cascOpened = false; bool mapCanBeOpened = true; float minimapZoom = 1; diff --git a/wowViewerLib/src/engine/shader/ShaderDefinitions.h b/wowViewerLib/src/engine/shader/ShaderDefinitions.h index 9dbfd5561..1ab3b10ac 100644 --- a/wowViewerLib/src/engine/shader/ShaderDefinitions.h +++ b/wowViewerLib/src/engine/shader/ShaderDefinitions.h @@ -35,45 +35,45 @@ struct shaderMetaData { extern const std::unordered_map shaderMetaInfo; extern const std::unordered_map> attributesPerShaderName; extern const std::unordered_map>> fieldDefMapPerShaderName; -struct renderFrameBufferShader { +struct wmoShader { enum class Attribute { - a_position = 0, renderFrameBufferShaderAttributeEnd + aPosition = 0, aNormal = 1, aTexCoord = 2, aTexCoord2 = 3, aTexCoord3 = 4, aColor = 5, aColor2 = 6, wmoShaderAttributeEnd }; }; -struct m2Shader { +struct waterShader { enum class Attribute { - aPosition = 0, aNormal = 1, bones = 2, boneWeights = 3, aTexCoord = 4, aTexCoord2 = 5, m2ShaderAttributeEnd + aPosition = 0, waterShaderAttributeEnd }; }; -struct wmoShader { +struct ribbonShader { enum class Attribute { - aPosition = 0, aNormal = 1, aTexCoord = 2, aTexCoord2 = 3, aTexCoord3 = 4, aColor = 5, aColor2 = 6, wmoShaderAttributeEnd + aPosition = 0, aColor = 1, aTexcoord0 = 2, ribbonShaderAttributeEnd }; }; -struct drawPortalShader { +struct renderFrameBufferShader { enum class Attribute { - aPosition = 0, drawPortalShaderAttributeEnd + a_position = 0, renderFrameBufferShaderAttributeEnd }; }; -struct m2ParticleShader { +struct drawDepthShader { enum class Attribute { - aPosition = 0, aColor = 1, aTexcoord0 = 2, aTexcoord1 = 3, aTexcoord2 = 4, m2ParticleShaderAttributeEnd + position = 0, texture = 1, drawDepthShaderAttributeEnd }; }; -struct adtShader { +struct drawPoints { enum class Attribute { - aHeight = 0, aColor = 1, aVertexLighting = 2, aNormal = 3, aIndex = 4, adtShaderAttributeEnd + aPosition = 0, drawPointsAttributeEnd }; }; -struct drawLinesShader { +struct m2Shader { enum class Attribute { - aPosition = 0, drawLinesShaderAttributeEnd + aPosition = 0, aNormal = 1, bones = 2, boneWeights = 3, aTexCoord = 4, aTexCoord2 = 5, m2ShaderAttributeEnd }; }; @@ -89,55 +89,46 @@ struct adtLodShader { }; }; -struct ribbonShader { +struct drawBBShader { enum class Attribute { - aPosition = 0, aColor = 1, aTexcoord0 = 2, ribbonShaderAttributeEnd + aPosition = 0, drawBBShaderAttributeEnd }; }; -struct drawDepthShader { +struct adtShader { enum class Attribute { - position = 0, texture = 1, drawDepthShaderAttributeEnd + aHeight = 0, aColor = 1, aVertexLighting = 2, aNormal = 3, aIndex = 4, adtShaderAttributeEnd }; }; -struct waterShader { +struct drawPortalShader { enum class Attribute { - aPosition = 0, waterShaderAttributeEnd + aPosition = 0, drawPortalShaderAttributeEnd }; }; -struct drawBBShader { +struct drawFrustumShader { enum class Attribute { - aPosition = 0, drawBBShaderAttributeEnd + aPosition = 0, drawFrustumShaderAttributeEnd }; }; -struct drawPoints { +struct drawLinesShader { enum class Attribute { - aPosition = 0, drawPointsAttributeEnd + aPosition = 0, drawLinesShaderAttributeEnd }; }; -struct drawFrustumShader { +struct m2ParticleShader { enum class Attribute { - aPosition = 0, drawFrustumShaderAttributeEnd + aPosition = 0, aColor = 1, aTexcoord0 = 2, aTexcoord1 = 3, aTexcoord2 = 4, m2ParticleShaderAttributeEnd }; }; std::string loadShader(std::string shaderName); #ifdef SHADERDATACPP const std::unordered_map> attributesPerShaderName = { -{"renderFrameBufferShader", { -{"a_position", 0}, -}},{"m2Shader", { -{"aPosition", 0}, -{"aNormal", 1}, -{"bones", 2}, -{"boneWeights", 3}, -{"aTexCoord", 4}, -{"aTexCoord2", 5}, -}},{"wmoShader", { +{"wmoShader", { {"aPosition", 0}, {"aNormal", 1}, {"aTexCoord", 2}, @@ -145,114 +136,120 @@ const std::unordered_map> attributesPe {"aTexCoord3", 4}, {"aColor", 5}, {"aColor2", 6}, -}},{"drawPortalShader", { +}},{"waterShader", { {"aPosition", 0}, -}},{"m2ParticleShader", { +}},{"ribbonShader", { {"aPosition", 0}, {"aColor", 1}, {"aTexcoord0", 2}, -{"aTexcoord1", 3}, -{"aTexcoord2", 4}, -}},{"adtShader", { -{"aHeight", 0}, -{"aColor", 1}, -{"aVertexLighting", 2}, -{"aNormal", 3}, -{"aIndex", 4}, -}},{"drawLinesShader", { +}},{"renderFrameBufferShader", { +{"a_position", 0}, +}},{"drawDepthShader", { +{"position", 0}, +{"texture", 1}, +}},{"drawPoints", { {"aPosition", 0}, +}},{"m2Shader", { +{"aPosition", 0}, +{"aNormal", 1}, +{"bones", 2}, +{"boneWeights", 3}, +{"aTexCoord", 4}, +{"aTexCoord2", 5}, }},{"adtWater", { {"aPositionTransp", 0}, {"aTexCoord", 1}, }},{"adtLodShader", { {"aHeight", 0}, {"aIndex", 1}, -}},{"ribbonShader", { +}},{"drawBBShader", { {"aPosition", 0}, +}},{"adtShader", { +{"aHeight", 0}, {"aColor", 1}, -{"aTexcoord0", 2}, -}},{"drawDepthShader", { -{"position", 0}, -{"texture", 1}, -}},{"waterShader", { +{"aVertexLighting", 2}, +{"aNormal", 3}, +{"aIndex", 4}, +}},{"drawPortalShader", { {"aPosition", 0}, -}},{"drawBBShader", { +}},{"drawFrustumShader", { {"aPosition", 0}, -}},{"drawPoints", { +}},{"drawLinesShader", { {"aPosition", 0}, -}},{"drawFrustumShader", { +}},{"m2ParticleShader", { {"aPosition", 0}, +{"aColor", 1}, +{"aTexcoord0", 2}, +{"aTexcoord1", 3}, +{"aTexcoord2", 4}, }},}; -const std::unordered_map shaderMetaInfo = {{ "waterShader.frag.spv", { +const std::unordered_map shaderMetaInfo = {{ "wmoShader.vert.spv", { { -{0,4,16}, +{0,1,64}, +{0,0,128}, +{0,2,16}, } } -},{ "ribbonShader.vert.spv", { +},{ "waterShader.vert.spv", { { {0,0,128}, +{0,1,64}, } } -},{ "wmoShader.frag.spv", { +},{ "waterShader.frag.spv", { { -{0,4,112}, -{0,3,64}, +{0,4,16}, } } -},{ "ribbonShader.frag.spv", { +},{ "ribbonShader.vert.spv", { { +{0,0,128}, } } -},{ "m2Shader.vert.spv", { +},{ "ribbonShader.frag.spv", { { -{0,1,14144}, -{0,2,160}, -{0,0,128}, } } -},{ "m2ParticleShader.frag.spv", { +},{ "drawDepthShader.frag.spv", { { -{0,4,32}, +{0,2,12}, } } -},{ "waterShader.vert.spv", { +},{ "adtWater.vert.spv", { { {0,0,128}, -{0,1,64}, } } -},{ "drawPortalShader.vert.spv", { +},{ "m2ParticleShader.frag.spv", { { -{0,0,128}, -{0,1,64}, +{0,4,32}, } } -},{ "drawPortalShader.frag.spv", { +},{ "drawBBShader.vert.spv", { { -{0,1,16}, +{0,1,112}, +{0,0,128}, } } -},{ "wmoShader.vert.spv", { +},{ "drawFrustumShader.vert.spv", { { -{0,1,64}, {0,0,128}, -{0,2,16}, } } -},{ "adtWater.vert.spv", { +},{ "drawFrustumShader.frag.spv", { { -{0,0,128}, +{0,2,12}, } } -},{ "drawDepthShader.vert.spv", { +},{ "drawBBShader.frag.spv", { { -{0,2,16}, +{0,0,112}, } } -},{ "drawLinesShader.vert.spv", { +},{ "adtLodShader.frag.spv", { { -{0,0,128}, +{0,0,84}, } } },{ "adtShader.frag.spv", { @@ -261,45 +258,46 @@ const std::unordered_map shaderMetaInfo = {{ "water {0,4,32}, } } -},{ "renderFrameBufferShader.frag.spv", { +},{ "adtLodShader.vert.spv", { { -{0,2,168}, +{0,0,144}, } } -},{ "m2ParticleShader.vert.spv", { +},{ "adtShader.vert.spv", { { {0,0,128}, +{0,2,16}, } } -},{ "adtLodShader.vert.spv", { +},{ "adtWater.frag.spv", { { -{0,0,144}, +{0,4,16}, } } -},{ "adtShader.vert.spv", { +},{ "wmoShader.frag.spv", { { -{0,0,128}, -{0,2,16}, +{0,4,112}, +{0,3,64}, } } -},{ "adtLodShader.frag.spv", { +},{ "drawLinesShader.vert.spv", { { -{0,0,84}, +{0,0,128}, } } -},{ "drawPoints.frag.spv", { +},{ "drawDepthShader.vert.spv", { { -{0,1,12}, +{0,2,16}, } } -},{ "adtWater.frag.spv", { +},{ "drawLinesShader.frag.spv", { { -{0,4,16}, +{0,1,12}, } } -},{ "drawFrustumShader.frag.spv", { +},{ "drawPoints.frag.spv", { { -{0,2,12}, +{0,1,12}, } } },{ "drawPoints.vert.spv", { @@ -308,47 +306,109 @@ const std::unordered_map shaderMetaInfo = {{ "water {0,1,64}, } } -},{ "drawDepthShader.frag.spv", { +},{ "m2Shader.vert.spv", { { -{0,2,12}, +{0,1,14144}, +{0,2,160}, +{0,0,128}, } } -},{ "drawBBShader.frag.spv", { +},{ "drawPortalShader.frag.spv", { { -{0,0,112}, +{0,1,16}, } } -},{ "drawLinesShader.frag.spv", { +},{ "drawPortalShader.vert.spv", { { -{0,1,12}, +{0,0,128}, +{0,1,64}, } } },{ "renderFrameBufferShader.vert.spv", { { } } -},{ "m2Shader.frag.spv", { +},{ "m2ParticleShader.vert.spv", { { -{0,4,240}, -{0,3,64}, {0,0,128}, -{0,1,14144}, } } -},{ "drawBBShader.vert.spv", { +},{ "m2Shader.frag.spv", { { -{0,1,112}, +{0,4,240}, +{0,3,64}, {0,0,128}, +{0,1,14144}, } } -},{ "drawFrustumShader.vert.spv", { +},{ "renderFrameBufferShader.frag.spv", { { -{0,0,128}, +{0,2,168}, } } },}; const std::unordered_map>> fieldDefMapPerShaderName = { + {"wmoShader", { + { + 2, { + {"_179.VertexShader_UseLitColor", false, 0, 1, 4, 0}, + } + }, + { + 0, { + {"_108.uLookAtMat", true, 0, 4, 4, 0}, + {"_108.uPMatrix", true, 64, 4, 4, 0}, + } + }, + { + 1, { + {"_93.uPlacementMat", true, 0, 4, 4, 0}, + } + }, + { + 4, { + {"_21.uViewUp", true, 0, 1, 4, 0}, + {"_21.uSunDir_FogStart", true, 16, 1, 4, 0}, + {"_21.uSunColor_uFogEnd", true, 32, 1, 4, 0}, + {"_21.uAmbientLight", true, 48, 1, 4, 0}, + {"_21.uAmbientLight2AndIsBatchA", true, 64, 1, 4, 0}, + {"_21.UseLitColor_EnableAlpha_PixelShader", false, 80, 1, 4, 0}, + {"_21.FogColor_AlphaTest", true, 96, 1, 4, 0}, + } + }, + { + 3, { + {"_902.uPlacementMat", true, 0, 4, 4, 0}, + } + }, + }}, + {"waterShader", { + { + 1, { + {"_32.uPlacementMat", true, 0, 4, 4, 0}, + } + }, + { + 4, { + {"_12.waterTypeV", false, 0, 1, 4, 0}, + } + }, + { + 0, { + {"_24.uLookAtMat", true, 0, 4, 4, 0}, + {"_24.uPMatrix", true, 64, 4, 4, 0}, + } + }, + }}, + {"ribbonShader", { + { + 0, { + {"_41.uLookAtMat", true, 0, 4, 4, 0}, + {"_41.uPMatrix", true, 64, 4, 4, 0}, + } + }, + }}, {"renderFrameBufferShader", { { 2, { @@ -358,6 +418,29 @@ const std::unordered_map