-
-
Notifications
You must be signed in to change notification settings - Fork 35.5k
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
SVGLoader: Implement 'defs' and 'use' nodes #20209
Conversation
I've commited the jsm instead of the js, please wait while I fix this. |
Done. |
It seems the test file
Relevant for this PR? |
The |
I will look into implementing the other form of referencing the node. It seems easy. The SVG spec says it is possible to reference external SVG files with |
After looking more at it I've seen the |
I've added a console warning when |
I think it's okay to keep it 👍. |
examples/js/loaders/SVGLoader.js
Outdated
@@ -674,11 +698,11 @@ THREE.SVGLoader.prototype = Object.assign( Object.create( THREE.Loader.prototype | |||
var cxp = q * rx * y1p / ry; | |||
var cyp = - q * ry * x1p / rx; | |||
|
|||
// Step 3: Compute (cx, cy) from (cx′, cy′) | |||
// Step 3: Compute (cx, cy) from (cxâ², cyâ²) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🤔
examples/js/loaders/SVGLoader.js
Outdated
var cx = Math.cos( x_axis_rotation ) * cxp - Math.sin( x_axis_rotation ) * cyp + ( start.x + end.x ) / 2; | ||
var cy = Math.sin( x_axis_rotation ) * cxp + Math.cos( x_axis_rotation ) * cyp + ( start.y + end.y ) / 2; | ||
|
||
// Step 4: Compute θ1 and Δθ | ||
// Step 4: Compute θ1 and Îθ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🤔
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What codification should have the source .js files? UTF-8 or other?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should be UTF-8. Maybe modularize.js
doesn't currently support that?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe
modularize.js
doesn't currently support that?
But the problem is in the .js, not the jsm.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just tested, and modularize seems to behave correctly.
examples/js/loaders/SVGLoader.js
Outdated
@@ -1092,144 +1118,158 @@ THREE.SVGLoader.prototype = Object.assign( Object.create( THREE.Loader.prototype | |||
|
|||
function parseNodeTransform( node ) { | |||
|
|||
var transform = new THREE.Matrix3(); | |||
var transform = new Matrix3(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does this work?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
My mistake. Fixed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm, are you sure it's fixed?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry, I must have failed to git add it.
examples/jsm/loaders/SVGLoader.js
Outdated
@@ -684,11 +708,11 @@ SVGLoader.prototype = Object.assign( Object.create( Loader.prototype ), { | |||
var cxp = q * rx * y1p / ry; | |||
var cyp = - q * ry * x1p / rx; | |||
|
|||
// Step 3: Compute (cx, cy) from (cx′, cy′) | |||
// Step 3: Compute (cx, cy) from (cxâ², cyâ²) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Still seeing encoding issues...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed also.
Thanks! |
The
defs
node contains definitions to use later by theuse
node. It allows to use SVG files which contains svg clone objects.Thanks to @TakumaKira for the expression to get the referenced node.
Fixes #14569