Skip to content

Commit

Permalink
3ds: fix blending
Browse files Browse the repository at this point in the history
  • Loading branch information
Cpasjuste committed Oct 25, 2018
1 parent b3ad886 commit 06a057d
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 7 deletions.
13 changes: 7 additions & 6 deletions source/platforms/3ds/ctr_renderer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -172,15 +172,16 @@ void CTRRenderer::draw(VertexArray *vertexArray,
vtx->texcoord[1] = texture ? v.texCoords.y /
(texture->getTextureRect().height *
(texture->getTextureRect().height / texture->getSize().y)) : 0;
vtx->blend[0] = 0; // reserved for future expansion
vtx->blend[1] = texture ? (v.color != Color::White ? 1.0f : 0) : 1.0f;
vtx->blend[0] = 0;
float blend = v.color.r == 255 && v.color.g == 255 && v.color.b == 255 ? 0 : 1;
vtx->blend[1] = texture ? blend : 1.0f;
vtx->color = v.color.toABGR();
}

size_t len = ctx.vtxBufPos - ctx.vtxBufLastPos;
if (!len) return;
C3D_DrawArrays(type, ctx.vtxBufLastPos, len);
ctx.vtxBufLastPos = ctx.vtxBufPos;
if (ctx.vtxBufPos - ctx.vtxBufLastPos) {
C3D_DrawArrays(type, ctx.vtxBufLastPos, ctx.vtxBufPos - ctx.vtxBufLastPos);
ctx.vtxBufLastPos = ctx.vtxBufPos;
}
}

void CTRRenderer::clear() {
Expand Down
2 changes: 1 addition & 1 deletion test/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ int main(int argc, char **argv) {
auto *tex = new C2DTexture(renderer->getIo()->getDataPath() + "gbatemp.png");
if (tex->available) {
tex->setPosition(rect->getSize().x / 2, rect->getSize().y / 2);
//tex->setScale(0.5f * scaling, 0.5f * scaling);
tex->setScale(0.5f * scaling, 0.5f * scaling);
tex->setOrigin(Origin::Center);
rect->add(tex);
}
Expand Down

0 comments on commit 06a057d

Please sign in to comment.