diff --git a/ArchitectureColoredPainting/res/Shaders/painting.comp b/ArchitectureColoredPainting/res/Shaders/painting.comp index 50a32b8..c0af01c 100644 --- a/ArchitectureColoredPainting/res/Shaders/painting.comp +++ b/ArchitectureColoredPainting/res/Shaders/painting.comp @@ -1352,8 +1352,8 @@ void main() vec3 debugBVH = vec3(0); // bool debugHit = false; - vec4 color = vec4(0.76, 0.33, 0.15, -1); - // vec4 color = vec4(1,1,1, -1); + //vec4 color = vec4(0.76, 0.33, 0.15, -1); + vec4 color = vec4(1,1,1, -1); vec2 metallicRoughness = vec2(0, 0.8); stack.top = 0; uint index = 0, visitTime = 0; @@ -1423,7 +1423,7 @@ void main() imageStore(gBaseColor, pixelLocation, vec4(color.rgb, 1)); imageStore(gMetallicRoughness, pixelLocation, vec4(metallicRoughness, 0, 1)); - //return; + return; if (/*color.a!=-1&&*/ debugBVH == vec3(0)) { // imageStore(gBaseColor, pixelLocation, vec4(vec3(1, 1, 0),1)); diff --git a/ArchitectureColoredPainting/res/Shaders/painting.vert b/ArchitectureColoredPainting/res/Shaders/painting.vert index f294dc6..9c5f22f 100644 --- a/ArchitectureColoredPainting/res/Shaders/painting.vert +++ b/ArchitectureColoredPainting/res/Shaders/painting.vert @@ -14,6 +14,7 @@ uniform mat4 projection; void main() { TexCoords = aTexCoords; + TexCoords.y = -TexCoords.y; WorldPos = vec3(model * vec4(aPos, 1.0)); Normal = mat3(model) * aNormal; diff --git a/ArchitectureColoredPainting/src/Editor/util/PaintingUtil.cpp b/ArchitectureColoredPainting/src/Editor/util/PaintingUtil.cpp index 7c66c24..8c4ec74 100644 --- a/ArchitectureColoredPainting/src/Editor/util/PaintingUtil.cpp +++ b/ArchitectureColoredPainting/src/Editor/util/PaintingUtil.cpp @@ -34,7 +34,6 @@ QJsonObject PaintingUtil::readJsonFile(QString jsonFilePath) { Painting PaintingUtil::transfromToPainting(QString jsonFilePath) { Painting painting; - QTransform transform; glm::bvec2 flip(0, 0); QJsonObject jsonObj = readJsonFile(jsonFilePath); qDebug() << jsonObj; @@ -47,7 +46,7 @@ Painting PaintingUtil::transfromToPainting(QString jsonFilePath) { queue layerQueue; LayerWrapper* root = layerManager->getRoot(); root->getCache(); - layerQueue.push({ root, transform, flip }); + layerQueue.push({ root, root->property.transform, flip }); while (!layerQueue.empty()) { auto layerNode = layerQueue.front(); layerQueue.pop(); @@ -71,8 +70,10 @@ FolderLayerWrapper* PaintingUtil::handleLayerWrapper(LayerWrapper* nowLayer, QTr if (leafLayer != nullptr) { GroupElement* wrapperElement = dynamic_cast(leafLayer->wrappedElement); - if (wrapperElement != nullptr) + if (wrapperElement != nullptr) { + transform = wrapperElement->sourceLayer->property.transform * transform; return wrapperElement->sourceLayer; + } PixelPath pixelPath = nowLayer->getCache(); QPainterPath painterPath = pixelPath.getPainterPath(); @@ -90,7 +91,7 @@ FolderLayerWrapper* PaintingUtil::handleLayerWrapper(LayerWrapper* nowLayer, QTr qDebug() << trans.map(painterPath); element.contour = std::make_shared >>(PainterPathUtil::transformToLines(trans.map(painterPath))); - QSize screenSize = pixelPath.getPixmap().size(); + QSize screenSize = QSize(1024, 1024); element.style = std::make_shared(0.06); @@ -105,8 +106,8 @@ FolderLayerWrapper* PaintingUtil::handleLayerWrapper(LayerWrapper* nowLayer, QTr qDebug() << elementTrans.center.x << elementTrans.center.y; decomposeTransform(transform, elementTrans.rotation, elementTrans.scale); elementTrans.scale = glm::vec2( - bound.width() / screenSize.width(), - bound.height() / screenSize.height() + bound.width() * 2 / screenSize.width(), + bound.height() * 2 / screenSize.height() ); elementTrans.flip = glm::bvec2( nowLayer->property.flipHorizontally,