Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added option to not show back face of text #38

Open
wants to merge 5 commits into
base: master
Choose a base branch
from

Conversation

Danielbook
Copy link

Added an optional option to textcomponents, option.backface {bool}.
The extrusion of the text is set to 0 if user don't want back facing text

Added an optional option to textcomponents, option.backface {bool}. 
The extrusion of the text is set to 0 if user don't want back facing text
@@ -400,24 +401,28 @@ function meshesForText(text, font, options) {
transform.update();
meshBuilder.addMeshData(meshData, transform);
}

if (options.backface)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please add { }

frontFace();
else // If the back face shouldn't be visible, set extrusion to 0s
if (options.backface) {
frontFace();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldnt it be the backface() that is drawn if options.backface is true?

Also, could you make the default behavior be to draw backface if nothing is specified (to behave like before), by doing options.backface = options.backface !== undefined ? options.backface || true; at the top?

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree with @rherlitz. Thank you for the review!

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the review, added the options.backface at the top, but when i change that the backface() is to be drawn when option.backface is true, I get the text backwards. The text isn't visible on the other side of the material due to the other face not being drawn.

With frontface drawn, no backface:
skarmavbild 2016-07-13 kl 10 26 32

With backface drawn, no frontface:
skarmavbild 2016-07-13 kl 10 25 50

Updated the functions to draw correct face of glyph mesh
For some reason, the backface has to be drawn before front face, or else the text gets all weird
@Danielbook
Copy link
Author

The bug was because of the extrusion, fixed now!

Should be good to go 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants