Merge branch 'main' into dev-LayerStyle
commit
6a742f6526
|
@ -893,7 +893,7 @@ bool angleLargeThanPi(vec2 a, vec2 b)
|
|||
|
||||
/************************************************************************************/
|
||||
|
||||
void drawLine(in float d, inout uint styleIndex, out vec4 elementColor, out vec2 metallicRoughness)
|
||||
void drawLine(in float d, uint styleIndex, out vec4 elementColor, out vec2 metallicRoughness)
|
||||
{
|
||||
elementColor = vec4(1);
|
||||
metallicRoughness = vec2(0.8);
|
||||
|
@ -969,6 +969,30 @@ void drawLine(in float d, inout uint styleIndex, out vec4 elementColor, out vec2
|
|||
}
|
||||
}
|
||||
|
||||
void nextStyleIndex(inout uint styleIndex)
|
||||
{
|
||||
uint headUint = floatBitsToUint(style[styleIndex + 1]);
|
||||
vec4 head = unpackUnorm4x8(headUint);
|
||||
switch (int(head.a * 100) % 10)
|
||||
{
|
||||
/// Plain
|
||||
case 0: {
|
||||
styleIndex += 3;
|
||||
break;
|
||||
}
|
||||
/// RadialGradient
|
||||
case 1: {
|
||||
uint size = headUint % (1 << 15);
|
||||
styleIndex += 2 + size * 2;
|
||||
break;
|
||||
}
|
||||
case 2: {
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
bool shouldFillBeginCap(vec2 localUV, bool onVeryBegin, int endType, vec2 p0, vec2 tangentBegin, vec2 tangentEndLast)
|
||||
{
|
||||
vec2 normal;
|
||||
|
@ -1015,9 +1039,8 @@ void main()
|
|||
vec4 color = vec4(0);
|
||||
// if(isinf(path[0].x)) imageStore(gBaseColor, ivec2(pixelLocation),
|
||||
// vec4(vec2(pixelLocation)/vec2(imageSize(gBaseColor)), 1,1)); return;
|
||||
for (uint styleIndex = 0; styleIndex < styleSize; styleIndex++)
|
||||
for (uint styleIndex = 0; styleIndex < styleSize;)
|
||||
{
|
||||
|
||||
styleIndex += 6;
|
||||
vec2 localUV = vec2(pixelLocation) / pixelRatio + leftTop;
|
||||
|
||||
|
@ -1056,6 +1079,7 @@ void main()
|
|||
elementColor = vec4(unpackUnorm4x8(floatBitsToUint(style[++styleIndex])).rgb, 1);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
else // Stroke
|
||||
{
|
||||
|
@ -1129,8 +1153,8 @@ void main()
|
|||
|
||||
// if (onBegin ? shouldFillBeginCap(localUV, onVeryBegin, endType, p[0], tangentBegin,
|
||||
// tangentEndLast)
|
||||
// : (onEnd ? /*shouldFillEndCap(localUV, onVeryEnd, endType, p[3], tangentEnd,
|
||||
// tangentBeginNext)*/ false
|
||||
// : (onEnd ? shouldFillEndCap(localUV, onVeryEnd, endType, p[3], tangentEnd,
|
||||
// tangentBeginNext)
|
||||
// : d < minDistance))
|
||||
bool hit = d < minDistance;
|
||||
if (onBegin)
|
||||
|
@ -1183,10 +1207,11 @@ void main()
|
|||
{
|
||||
// hitElement = shouldFillEndCap(localUV, true, endType, p3Last, tangentEndLast);
|
||||
}
|
||||
nextStyleIndex(styleIndex);
|
||||
|
||||
}
|
||||
if (hitElement)
|
||||
color = elementColor;
|
||||
styleIndex += 100;
|
||||
}
|
||||
if (color.a != 0)
|
||||
imageStore(gBaseColor, ivec2(pixelLocation), color);
|
||||
|
|
|
@ -78,6 +78,7 @@ std::vector<GLfloat> generateStyleBuffer(const std::vector<BaseStyle>& styles)
|
|||
|
||||
auto encoded = style.material->encoded();
|
||||
styleBuffer.insert(styleBuffer.end(), encoded.begin(), encoded.end());
|
||||
qDebug() << "style size" << styleBuffer.size();
|
||||
}
|
||||
return styleBuffer;
|
||||
}
|
||||
|
|
|
@ -10,6 +10,8 @@ using namespace Renderer;
|
|||
|
||||
namespace UnitTest
|
||||
{
|
||||
void messageHandler(QtMsgType type, const QMessageLogContext& context, const QString& msg);
|
||||
|
||||
TEST_CLASS(ElementRendererStokeTypeTest)
|
||||
{
|
||||
private:
|
||||
|
@ -20,6 +22,7 @@ namespace UnitTest
|
|||
|
||||
TEST_METHOD_INITIALIZE(initialize)
|
||||
{
|
||||
qInstallMessageHandler(messageHandler);
|
||||
QGuiApplication::setAttribute(Qt::AA_EnableHighDpiScaling);
|
||||
QCoreApplication::setAttribute(Qt::AA_UseHighDpiPixmaps);
|
||||
QApplication::setHighDpiScaleFactorRoundingPolicy(Qt::HighDpiScaleFactorRoundingPolicy::PassThrough);
|
||||
|
|
Loading…
Reference in New Issue